react 16.4.2 → 16.6.0-alpha.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/LICENSE CHANGED
@@ -1,6 +1,6 @@
1
1
  MIT License
2
2
 
3
- Copyright (c) 2013-present, Facebook, Inc.
3
+ Copyright (c) Facebook, Inc. and its affiliates.
4
4
 
5
5
  Permission is hereby granted, free of charge, to any person obtaining a copy
6
6
  of this software and associated documentation files (the "Software"), to deal
package/README.md CHANGED
@@ -1,13 +1,10 @@
1
- # react
1
+ # `react`
2
2
 
3
- An npm package to get you immediate access to [React](https://reactjs.org/),
4
- without also requiring the JSX transformer. This is especially useful for cases where you
5
- want to [`browserify`](https://github.com/substack/node-browserify) your module using
6
- `React`.
3
+ React is a JavaScript library for creating user interfaces.
7
4
 
8
- **Note:** by default, React will be in development mode. The development version includes extra warnings about common mistakes, whereas the production version includes extra performance optimizations and strips all error messages.
5
+ The `react` package contains only the functionality necessary to define React components. It is typically used together with a React renderer like `react-dom` for the web, or `react-native` for the native environments.
9
6
 
10
- To use React in production mode, set the environment variable `NODE_ENV` to `production`. A minifier that performs dead-code elimination such as [UglifyJS](https://github.com/mishoo/UglifyJS2) is recommended to completely remove the extra code present in development mode.
7
+ **Note:** by default, React will be in development mode. The development version includes extra warnings about common mistakes, whereas the production version includes extra performance optimizations and strips all error messages. Don't forget to use the [production build](https://reactjs.org/docs/optimizing-performance.html#use-the-production-build) when deploying your application.
11
8
 
12
9
  ## Example Usage
13
10
 
@@ -1,7 +1,7 @@
1
- /** @license React v16.4.2
1
+ /** @license React v16.6.0-alpha.0
2
2
  * react.development.js
3
3
  *
4
- * Copyright (c) 2013-present, Facebook, Inc.
4
+ * Copyright (c) Facebook, Inc. and its affiliates.
5
5
  *
6
6
  * This source code is licensed under the MIT license found in the
7
7
  * LICENSE file in the root directory of this source tree.
@@ -16,15 +16,11 @@ if (process.env.NODE_ENV !== "production") {
16
16
  'use strict';
17
17
 
18
18
  var _assign = require('object-assign');
19
- var invariant = require('fbjs/lib/invariant');
20
- var emptyObject = require('fbjs/lib/emptyObject');
21
- var warning = require('fbjs/lib/warning');
22
- var emptyFunction = require('fbjs/lib/emptyFunction');
23
19
  var checkPropTypes = require('prop-types/checkPropTypes');
24
20
 
25
21
  // TODO: this is special because it gets imported during build.
26
22
 
27
- var ReactVersion = '16.4.2';
23
+ var ReactVersion = '16.6.0-alpha.0';
28
24
 
29
25
  // The Symbol used to tag the ReactElement-like types. If there is no native Symbol
30
26
  // nor polyfill, then a plain number is used for performance.
@@ -39,13 +35,13 @@ var REACT_PROVIDER_TYPE = hasSymbol ? Symbol.for('react.provider') : 0xeacd;
39
35
  var REACT_CONTEXT_TYPE = hasSymbol ? Symbol.for('react.context') : 0xeace;
40
36
  var REACT_ASYNC_MODE_TYPE = hasSymbol ? Symbol.for('react.async_mode') : 0xeacf;
41
37
  var REACT_FORWARD_REF_TYPE = hasSymbol ? Symbol.for('react.forward_ref') : 0xead0;
42
- var REACT_TIMEOUT_TYPE = hasSymbol ? Symbol.for('react.timeout') : 0xead1;
38
+ var REACT_PLACEHOLDER_TYPE = hasSymbol ? Symbol.for('react.placeholder') : 0xead1;
43
39
 
44
40
  var MAYBE_ITERATOR_SYMBOL = typeof Symbol === 'function' && Symbol.iterator;
45
41
  var FAUX_ITERATOR_SYMBOL = '@@iterator';
46
42
 
47
43
  function getIteratorFn(maybeIterable) {
48
- if (maybeIterable === null || typeof maybeIterable === 'undefined') {
44
+ if (maybeIterable === null || typeof maybeIterable !== 'object') {
49
45
  return null;
50
46
  }
51
47
  var maybeIterator = MAYBE_ITERATOR_SYMBOL && maybeIterable[MAYBE_ITERATOR_SYMBOL] || maybeIterable[FAUX_ITERATOR_SYMBOL];
@@ -55,9 +51,6 @@ function getIteratorFn(maybeIterable) {
55
51
  return null;
56
52
  }
57
53
 
58
- // Relying on the `invariant()` implementation lets us
59
- // have preserve the format and params in the www builds.
60
-
61
54
  // Exports ReactDOM.createRoot
62
55
 
63
56
 
@@ -88,8 +81,63 @@ var enableSuspense = false;
88
81
  // Gather advanced timing metrics for Profiler subtrees.
89
82
 
90
83
 
84
+ // Trace which interactions trigger each commit.
85
+
86
+
91
87
  // Only used in www builds.
92
88
 
89
+
90
+ // Only used in www builds.
91
+
92
+
93
+ // React Fire: prevent the value and checked attributes from syncing
94
+ // with their related DOM properties
95
+
96
+ /**
97
+ * Use invariant() to assert state which your program assumes to be true.
98
+ *
99
+ * Provide sprintf-style format (only %s is supported) and arguments
100
+ * to provide information about what broke and what you were
101
+ * expecting.
102
+ *
103
+ * The invariant message will be stripped in production, but the invariant
104
+ * will remain to ensure logic does not differ in production.
105
+ */
106
+
107
+ var validateFormat = function () {};
108
+
109
+ {
110
+ validateFormat = function (format) {
111
+ if (format === undefined) {
112
+ throw new Error('invariant requires an error message argument');
113
+ }
114
+ };
115
+ }
116
+
117
+ function invariant(condition, format, a, b, c, d, e, f) {
118
+ validateFormat(format);
119
+
120
+ if (!condition) {
121
+ var error = void 0;
122
+ if (format === undefined) {
123
+ error = new Error('Minified exception occurred; use the non-minified dev environment ' + 'for the full error message and additional helpful warnings.');
124
+ } else {
125
+ var args = [a, b, c, d, e, f];
126
+ var argIndex = 0;
127
+ error = new Error(format.replace(/%s/g, function () {
128
+ return args[argIndex++];
129
+ }));
130
+ error.name = 'Invariant Violation';
131
+ }
132
+
133
+ error.framesToPop = 1; // we don't care about invariant's own frame
134
+ throw error;
135
+ }
136
+ }
137
+
138
+ // Relying on the `invariant()` implementation lets us
139
+ // preserve the format and params in the www builds.
140
+
93
141
  /**
94
142
  * Forked from fbjs/warning:
95
143
  * https://github.com/facebook/fbjs/blob/e66ba20ad5be433eb54423f2b097d829324d9de6/packages/fbjs/src/__forks__/warning.js
@@ -129,7 +177,7 @@ var lowPriorityWarning = function () {};
129
177
 
130
178
  lowPriorityWarning = function (condition, format) {
131
179
  if (format === undefined) {
132
- throw new Error('`warning(condition, format, ...args)` requires a warning ' + 'message argument');
180
+ throw new Error('`lowPriorityWarning(condition, format, ...args)` requires a warning ' + 'message argument');
133
181
  }
134
182
  if (!condition) {
135
183
  for (var _len2 = arguments.length, args = Array(_len2 > 2 ? _len2 - 2 : 0), _key2 = 2; _key2 < _len2; _key2++) {
@@ -143,6 +191,95 @@ var lowPriorityWarning = function () {};
143
191
 
144
192
  var lowPriorityWarning$1 = lowPriorityWarning;
145
193
 
194
+ /**
195
+ * Similar to invariant but only logs a warning if the condition is not met.
196
+ * This can be used to log issues in development environments in critical
197
+ * paths. Removing the logging code for production environments will keep the
198
+ * same logic and follow the same code paths.
199
+ */
200
+
201
+ var warningWithoutStack = function () {};
202
+
203
+ {
204
+ warningWithoutStack = function (condition, format) {
205
+ for (var _len = arguments.length, args = Array(_len > 2 ? _len - 2 : 0), _key = 2; _key < _len; _key++) {
206
+ args[_key - 2] = arguments[_key];
207
+ }
208
+
209
+ if (format === undefined) {
210
+ throw new Error('`warningWithoutStack(condition, format, ...args)` requires a warning ' + 'message argument');
211
+ }
212
+ if (args.length > 8) {
213
+ // Check before the condition to catch violations early.
214
+ throw new Error('warningWithoutStack() currently supports at most 8 arguments.');
215
+ }
216
+ if (condition) {
217
+ return;
218
+ }
219
+ if (typeof console !== 'undefined') {
220
+ var _args$map = args.map(function (item) {
221
+ return '' + item;
222
+ }),
223
+ a = _args$map[0],
224
+ b = _args$map[1],
225
+ c = _args$map[2],
226
+ d = _args$map[3],
227
+ e = _args$map[4],
228
+ f = _args$map[5],
229
+ g = _args$map[6],
230
+ h = _args$map[7];
231
+
232
+ var message = 'Warning: ' + format;
233
+
234
+ // We intentionally don't use spread (or .apply) because it breaks IE9:
235
+ // https://github.com/facebook/react/issues/13610
236
+ switch (args.length) {
237
+ case 0:
238
+ console.error(message);
239
+ break;
240
+ case 1:
241
+ console.error(message, a);
242
+ break;
243
+ case 2:
244
+ console.error(message, a, b);
245
+ break;
246
+ case 3:
247
+ console.error(message, a, b, c);
248
+ break;
249
+ case 4:
250
+ console.error(message, a, b, c, d);
251
+ break;
252
+ case 5:
253
+ console.error(message, a, b, c, d, e);
254
+ break;
255
+ case 6:
256
+ console.error(message, a, b, c, d, e, f);
257
+ break;
258
+ case 7:
259
+ console.error(message, a, b, c, d, e, f, g);
260
+ break;
261
+ case 8:
262
+ console.error(message, a, b, c, d, e, f, g, h);
263
+ break;
264
+ default:
265
+ throw new Error('warningWithoutStack() currently supports at most 8 arguments.');
266
+ }
267
+ }
268
+ try {
269
+ // --- Welcome to debugging React ---
270
+ // This error was thrown as a convenience so that you can use this stack
271
+ // to find the callsite that caused this warning to fire.
272
+ var argIndex = 0;
273
+ var _message = 'Warning: ' + format.replace(/%s/g, function () {
274
+ return args[argIndex++];
275
+ });
276
+ throw new Error(_message);
277
+ } catch (x) {}
278
+ };
279
+ }
280
+
281
+ var warningWithoutStack$1 = warningWithoutStack;
282
+
146
283
  var didWarnStateUpdateForUnmountedComponent = {};
147
284
 
148
285
  function warnNoop(publicInstance, callerName) {
@@ -153,7 +290,7 @@ function warnNoop(publicInstance, callerName) {
153
290
  if (didWarnStateUpdateForUnmountedComponent[warningKey]) {
154
291
  return;
155
292
  }
156
- warning(false, "Can't call %s on a component that is not yet mounted. " + 'This is a no-op, but it might indicate a bug in your application. ' + 'Instead, assign to `this.state` directly or define a `state = {};` ' + 'class property with the desired state in the %s component.', callerName, componentName);
293
+ warningWithoutStack$1(false, "Can't call %s on a component that is not yet mounted. " + 'This is a no-op, but it might indicate a bug in your application. ' + 'Instead, assign to `this.state` directly or define a `state = {};` ' + 'class property with the desired state in the %s component.', callerName, componentName);
157
294
  didWarnStateUpdateForUnmountedComponent[warningKey] = true;
158
295
  }
159
296
  }
@@ -226,12 +363,18 @@ var ReactNoopUpdateQueue = {
226
363
  }
227
364
  };
228
365
 
366
+ var emptyObject = {};
367
+ {
368
+ Object.freeze(emptyObject);
369
+ }
370
+
229
371
  /**
230
372
  * Base class helpers for the updating state of a component.
231
373
  */
232
374
  function Component(props, context, updater) {
233
375
  this.props = props;
234
376
  this.context = context;
377
+ // If a component has string refs, we will assign a different object later.
235
378
  this.refs = emptyObject;
236
379
  // We initialize the default updater but the real one gets injected by the
237
380
  // renderer.
@@ -322,6 +465,7 @@ ComponentDummy.prototype = Component.prototype;
322
465
  function PureComponent(props, context, updater) {
323
466
  this.props = props;
324
467
  this.context = context;
468
+ // If a component has string refs, we will assign a different object later.
325
469
  this.refs = emptyObject;
326
470
  this.updater = updater || ReactNoopUpdateQueue;
327
471
  }
@@ -354,9 +498,177 @@ var ReactCurrentOwner = {
354
498
  * @internal
355
499
  * @type {ReactComponent}
356
500
  */
357
- current: null
501
+ current: null,
502
+ currentDispatcher: null
503
+ };
504
+
505
+ var BEFORE_SLASH_RE = /^(.*)[\\\/]/;
506
+
507
+ var describeComponentFrame = function (name, source, ownerName) {
508
+ var sourceInfo = '';
509
+ if (source) {
510
+ var path = source.fileName;
511
+ var fileName = path.replace(BEFORE_SLASH_RE, '');
512
+ {
513
+ // In DEV, include code for a common special case:
514
+ // prefer "folder/index.js" instead of just "index.js".
515
+ if (/^index\./.test(fileName)) {
516
+ var match = path.match(BEFORE_SLASH_RE);
517
+ if (match) {
518
+ var pathBeforeSlash = match[1];
519
+ if (pathBeforeSlash) {
520
+ var folderName = pathBeforeSlash.replace(BEFORE_SLASH_RE, '');
521
+ fileName = folderName + '/' + fileName;
522
+ }
523
+ }
524
+ }
525
+ }
526
+ sourceInfo = ' (at ' + fileName + ':' + source.lineNumber + ')';
527
+ } else if (ownerName) {
528
+ sourceInfo = ' (created by ' + ownerName + ')';
529
+ }
530
+ return '\n in ' + (name || 'Unknown') + sourceInfo;
531
+ };
532
+
533
+ var Resolved = 1;
534
+
535
+
536
+
537
+
538
+ function refineResolvedThenable(thenable) {
539
+ return thenable._reactStatus === Resolved ? thenable._reactResult : null;
540
+ }
541
+
542
+ function getComponentName(type) {
543
+ if (type == null) {
544
+ // Host root, text node or just invalid type.
545
+ return null;
546
+ }
547
+ {
548
+ if (typeof type.tag === 'number') {
549
+ warningWithoutStack$1(false, 'Received an unexpected object in getComponentName(). ' + 'This is likely a bug in React. Please file an issue.');
550
+ }
551
+ }
552
+ if (typeof type === 'function') {
553
+ return type.displayName || type.name || null;
554
+ }
555
+ if (typeof type === 'string') {
556
+ return type;
557
+ }
558
+ switch (type) {
559
+ case REACT_ASYNC_MODE_TYPE:
560
+ return 'AsyncMode';
561
+ case REACT_FRAGMENT_TYPE:
562
+ return 'Fragment';
563
+ case REACT_PORTAL_TYPE:
564
+ return 'Portal';
565
+ case REACT_PROFILER_TYPE:
566
+ return 'Profiler';
567
+ case REACT_STRICT_MODE_TYPE:
568
+ return 'StrictMode';
569
+ case REACT_PLACEHOLDER_TYPE:
570
+ return 'Placeholder';
571
+ }
572
+ if (typeof type === 'object') {
573
+ switch (type.$$typeof) {
574
+ case REACT_CONTEXT_TYPE:
575
+ return 'Context.Consumer';
576
+ case REACT_PROVIDER_TYPE:
577
+ return 'Context.Provider';
578
+ case REACT_FORWARD_REF_TYPE:
579
+ var renderFn = type.render;
580
+ var functionName = renderFn.displayName || renderFn.name || '';
581
+ return type.displayName || (functionName !== '' ? 'ForwardRef(' + functionName + ')' : 'ForwardRef');
582
+ }
583
+ if (typeof type.then === 'function') {
584
+ var thenable = type;
585
+ var resolvedThenable = refineResolvedThenable(thenable);
586
+ if (resolvedThenable) {
587
+ return getComponentName(resolvedThenable);
588
+ }
589
+ }
590
+ }
591
+ return null;
592
+ }
593
+
594
+ var ReactDebugCurrentFrame = {};
595
+
596
+ var currentlyValidatingElement = null;
597
+
598
+ function setCurrentlyValidatingElement(element) {
599
+ {
600
+ currentlyValidatingElement = element;
601
+ }
602
+ }
603
+
604
+ {
605
+ // Stack implementation injected by the current renderer.
606
+ ReactDebugCurrentFrame.getCurrentStack = null;
607
+
608
+ ReactDebugCurrentFrame.getStackAddendum = function () {
609
+ var stack = '';
610
+
611
+ // Add an extra top frame while an element is being validated
612
+ if (currentlyValidatingElement) {
613
+ var name = getComponentName(currentlyValidatingElement.type);
614
+ var owner = currentlyValidatingElement._owner;
615
+ stack += describeComponentFrame(name, currentlyValidatingElement._source, owner && getComponentName(owner.type));
616
+ }
617
+
618
+ // Delegate to the injected renderer-specific implementation
619
+ var impl = ReactDebugCurrentFrame.getCurrentStack;
620
+ if (impl) {
621
+ stack += impl() || '';
622
+ }
623
+
624
+ return stack;
625
+ };
626
+ }
627
+
628
+ var ReactSharedInternals = {
629
+ ReactCurrentOwner: ReactCurrentOwner,
630
+ // Used by renderers to avoid bundling object-assign twice in UMD bundles:
631
+ assign: _assign
358
632
  };
359
633
 
634
+ {
635
+ _assign(ReactSharedInternals, {
636
+ // These should not be included in production.
637
+ ReactDebugCurrentFrame: ReactDebugCurrentFrame,
638
+ // Shim for React DOM 16.0.0 which still destructured (but not used) this.
639
+ // TODO: remove in React 17.0.
640
+ ReactComponentTreeHook: {}
641
+ });
642
+ }
643
+
644
+ /**
645
+ * Similar to invariant but only logs a warning if the condition is not met.
646
+ * This can be used to log issues in development environments in critical
647
+ * paths. Removing the logging code for production environments will keep the
648
+ * same logic and follow the same code paths.
649
+ */
650
+
651
+ var warning = warningWithoutStack$1;
652
+
653
+ {
654
+ warning = function (condition, format) {
655
+ if (condition) {
656
+ return;
657
+ }
658
+ var ReactDebugCurrentFrame = ReactSharedInternals.ReactDebugCurrentFrame;
659
+ var stack = ReactDebugCurrentFrame.getStackAddendum();
660
+ // eslint-disable-next-line react-internal/warning-and-invariant-args
661
+
662
+ for (var _len = arguments.length, args = Array(_len > 2 ? _len - 2 : 0), _key = 2; _key < _len; _key++) {
663
+ args[_key - 2] = arguments[_key];
664
+ }
665
+
666
+ warningWithoutStack$1.apply(undefined, [false, format + '%s'].concat(args, [stack]));
667
+ };
668
+ }
669
+
670
+ var warning$1 = warning;
671
+
360
672
  var hasOwnProperty = Object.prototype.hasOwnProperty;
361
673
 
362
674
  var RESERVED_PROPS = {
@@ -397,7 +709,7 @@ function defineKeyPropWarningGetter(props, displayName) {
397
709
  var warnAboutAccessingKey = function () {
398
710
  if (!specialPropKeyWarningShown) {
399
711
  specialPropKeyWarningShown = true;
400
- warning(false, '%s: `key` is not a prop. Trying to access it will result ' + 'in `undefined` being returned. If you need to access the same ' + 'value within the child component, you should pass it as a different ' + 'prop. (https://fb.me/react-special-props)', displayName);
712
+ warningWithoutStack$1(false, '%s: `key` is not a prop. Trying to access it will result ' + 'in `undefined` being returned. If you need to access the same ' + 'value within the child component, you should pass it as a different ' + 'prop. (https://fb.me/react-special-props)', displayName);
401
713
  }
402
714
  };
403
715
  warnAboutAccessingKey.isReactWarning = true;
@@ -411,7 +723,7 @@ function defineRefPropWarningGetter(props, displayName) {
411
723
  var warnAboutAccessingRef = function () {
412
724
  if (!specialPropRefWarningShown) {
413
725
  specialPropRefWarningShown = true;
414
- warning(false, '%s: `ref` is not a prop. Trying to access it will result ' + 'in `undefined` being returned. If you need to access the same ' + 'value within the child component, you should pass it as a different ' + 'prop. (https://fb.me/react-special-props)', displayName);
726
+ warningWithoutStack$1(false, '%s: `ref` is not a prop. Trying to access it will result ' + 'in `undefined` being returned. If you need to access the same ' + 'value within the child component, you should pass it as a different ' + 'prop. (https://fb.me/react-special-props)', displayName);
415
727
  }
416
728
  };
417
729
  warnAboutAccessingRef.isReactWarning = true;
@@ -559,14 +871,12 @@ function createElement(type, config, children) {
559
871
  }
560
872
  {
561
873
  if (key || ref) {
562
- if (typeof props.$$typeof === 'undefined' || props.$$typeof !== REACT_ELEMENT_TYPE) {
563
- var displayName = typeof type === 'function' ? type.displayName || type.name || 'Unknown' : type;
564
- if (key) {
565
- defineKeyPropWarningGetter(props, displayName);
566
- }
567
- if (ref) {
568
- defineRefPropWarningGetter(props, displayName);
569
- }
874
+ var displayName = typeof type === 'function' ? type.displayName || type.name || 'Unknown' : type;
875
+ if (key) {
876
+ defineKeyPropWarningGetter(props, displayName);
877
+ }
878
+ if (ref) {
879
+ defineRefPropWarningGetter(props, displayName);
570
880
  }
571
881
  }
572
882
  }
@@ -657,28 +967,13 @@ function cloneElement(element, config, children) {
657
967
  * Verifies the object is a ReactElement.
658
968
  * See https://reactjs.org/docs/react-api.html#isvalidelement
659
969
  * @param {?object} object
660
- * @return {boolean} True if `object` is a valid component.
970
+ * @return {boolean} True if `object` is a ReactElement.
661
971
  * @final
662
972
  */
663
973
  function isValidElement(object) {
664
974
  return typeof object === 'object' && object !== null && object.$$typeof === REACT_ELEMENT_TYPE;
665
975
  }
666
976
 
667
- var ReactDebugCurrentFrame = {};
668
-
669
- {
670
- // Component that is being worked on
671
- ReactDebugCurrentFrame.getCurrentStack = null;
672
-
673
- ReactDebugCurrentFrame.getStackAddendum = function () {
674
- var impl = ReactDebugCurrentFrame.getCurrentStack;
675
- if (impl) {
676
- return impl();
677
- }
678
- return null;
679
- };
680
- }
681
-
682
977
  var SEPARATOR = '.';
683
978
  var SUBSEPARATOR = ':';
684
979
 
@@ -806,7 +1101,7 @@ function traverseAllChildrenImpl(children, nameSoFar, callback, traverseContext)
806
1101
  {
807
1102
  // Warn about using Maps as children
808
1103
  if (iteratorFn === children.entries) {
809
- !didWarnAboutMaps ? warning(false, 'Using Maps as children is unsupported and will likely yield ' + 'unexpected results. Convert it to a sequence/iterable of keyed ' + 'ReactElements instead.%s', ReactDebugCurrentFrame.getStackAddendum()) : void 0;
1104
+ !didWarnAboutMaps ? warning$1(false, 'Using Maps as children is unsupported and will likely yield ' + 'unexpected results. Convert it to a sequence/iterable of keyed ' + 'ReactElements instead.') : void 0;
810
1105
  didWarnAboutMaps = true;
811
1106
  }
812
1107
  }
@@ -911,7 +1206,9 @@ function mapSingleChildIntoContext(bookKeeping, child, childKey) {
911
1206
 
912
1207
  var mappedChild = func.call(context, child, bookKeeping.count++);
913
1208
  if (Array.isArray(mappedChild)) {
914
- mapIntoWithKeyPrefixInternal(mappedChild, result, childKey, emptyFunction.thatReturnsArgument);
1209
+ mapIntoWithKeyPrefixInternal(mappedChild, result, childKey, function (c) {
1210
+ return c;
1211
+ });
915
1212
  } else if (mappedChild != null) {
916
1213
  if (isValidElement(mappedChild)) {
917
1214
  mappedChild = cloneAndReplaceKey(mappedChild,
@@ -965,7 +1262,9 @@ function mapChildren(children, func, context) {
965
1262
  * @return {number} The number of children.
966
1263
  */
967
1264
  function countChildren(children) {
968
- return traverseAllChildren(children, emptyFunction.thatReturnsNull, null);
1265
+ return traverseAllChildren(children, function () {
1266
+ return null;
1267
+ }, null);
969
1268
  }
970
1269
 
971
1270
  /**
@@ -976,7 +1275,9 @@ function countChildren(children) {
976
1275
  */
977
1276
  function toArray(children) {
978
1277
  var result = [];
979
- mapIntoWithKeyPrefixInternal(children, result, null, emptyFunction.thatReturnsArgument);
1278
+ mapIntoWithKeyPrefixInternal(children, result, null, function (child) {
1279
+ return child;
1280
+ });
980
1281
  return result;
981
1282
  }
982
1283
 
@@ -999,31 +1300,35 @@ function onlyChild(children) {
999
1300
  return children;
1000
1301
  }
1001
1302
 
1303
+ function readContext(context, observedBits) {
1304
+ var dispatcher = ReactCurrentOwner.currentDispatcher;
1305
+ !(dispatcher !== null) ? invariant(false, 'Context.unstable_read(): Context can only be read while React is rendering, e.g. inside the render method or getDerivedStateFromProps.') : void 0;
1306
+ return dispatcher.readContext(context, observedBits);
1307
+ }
1308
+
1002
1309
  function createContext(defaultValue, calculateChangedBits) {
1003
1310
  if (calculateChangedBits === undefined) {
1004
1311
  calculateChangedBits = null;
1005
1312
  } else {
1006
1313
  {
1007
- !(calculateChangedBits === null || typeof calculateChangedBits === 'function') ? warning(false, 'createContext: Expected the optional second argument to be a ' + 'function. Instead received: %s', calculateChangedBits) : void 0;
1314
+ !(calculateChangedBits === null || typeof calculateChangedBits === 'function') ? warningWithoutStack$1(false, 'createContext: Expected the optional second argument to be a ' + 'function. Instead received: %s', calculateChangedBits) : void 0;
1008
1315
  }
1009
1316
  }
1010
1317
 
1011
1318
  var context = {
1012
1319
  $$typeof: REACT_CONTEXT_TYPE,
1013
1320
  _calculateChangedBits: calculateChangedBits,
1014
- _defaultValue: defaultValue,
1015
- _currentValue: defaultValue,
1016
1321
  // As a workaround to support multiple concurrent renderers, we categorize
1017
1322
  // some renderers as primary and others as secondary. We only expect
1018
1323
  // there to be two concurrent renderers at most: React Native (primary) and
1019
1324
  // Fabric (secondary); React DOM (primary) and React ART (secondary).
1020
1325
  // Secondary renderers store their context values on separate fields.
1326
+ _currentValue: defaultValue,
1021
1327
  _currentValue2: defaultValue,
1022
- _changedBits: 0,
1023
- _changedBits2: 0,
1024
1328
  // These are circular
1025
1329
  Provider: null,
1026
- Consumer: null
1330
+ Consumer: null,
1331
+ unstable_read: null
1027
1332
  };
1028
1333
 
1029
1334
  context.Provider = {
@@ -1031,6 +1336,7 @@ function createContext(defaultValue, calculateChangedBits) {
1031
1336
  _context: context
1032
1337
  };
1033
1338
  context.Consumer = context;
1339
+ context.unstable_read = readContext.bind(null, context);
1034
1340
 
1035
1341
  {
1036
1342
  context._currentRenderer = null;
@@ -1040,12 +1346,36 @@ function createContext(defaultValue, calculateChangedBits) {
1040
1346
  return context;
1041
1347
  }
1042
1348
 
1349
+ function lazy(ctor) {
1350
+ var thenable = null;
1351
+ return {
1352
+ then: function (resolve, reject) {
1353
+ if (thenable === null) {
1354
+ // Lazily create thenable by wrapping in an extra thenable.
1355
+ thenable = ctor();
1356
+ ctor = null;
1357
+ }
1358
+ return thenable.then(resolve, reject);
1359
+ },
1360
+
1361
+ // React uses these fields to store the result.
1362
+ _reactStatus: -1,
1363
+ _reactResult: null
1364
+ };
1365
+ }
1366
+
1043
1367
  function forwardRef(render) {
1044
1368
  {
1045
- !(typeof render === 'function') ? warning(false, 'forwardRef requires a render function but was given %s.', render === null ? 'null' : typeof render) : void 0;
1369
+ if (typeof render !== 'function') {
1370
+ warningWithoutStack$1(false, 'forwardRef requires a render function but was given %s.', render === null ? 'null' : typeof render);
1371
+ } else {
1372
+ !(
1373
+ // Do not warn for 0 arguments because it could be due to usage of the 'arguments' object
1374
+ render.length === 0 || render.length === 2) ? warningWithoutStack$1(false, 'forwardRef render functions accept exactly two parameters: props and ref. %s', render.length === 1 ? 'Did you forget to use the ref parameter?' : 'Any additional parameter will be undefined.') : void 0;
1375
+ }
1046
1376
 
1047
1377
  if (render != null) {
1048
- !(render.defaultProps == null && render.propTypes == null) ? warning(false, 'forwardRef render functions do not support propTypes or defaultProps. ' + 'Did you accidentally pass a React component?') : void 0;
1378
+ !(render.defaultProps == null && render.propTypes == null) ? warningWithoutStack$1(false, 'forwardRef render functions do not support propTypes or defaultProps. ' + 'Did you accidentally pass a React component?') : void 0;
1049
1379
  }
1050
1380
  }
1051
1381
 
@@ -1055,51 +1385,10 @@ function forwardRef(render) {
1055
1385
  };
1056
1386
  }
1057
1387
 
1058
- var describeComponentFrame = function (name, source, ownerName) {
1059
- return '\n in ' + (name || 'Unknown') + (source ? ' (at ' + source.fileName.replace(/^.*[\\\/]/, '') + ':' + source.lineNumber + ')' : ownerName ? ' (created by ' + ownerName + ')' : '');
1060
- };
1061
-
1062
1388
  function isValidElementType(type) {
1063
1389
  return typeof type === 'string' || typeof type === 'function' ||
1064
1390
  // Note: its typeof might be other than 'symbol' or 'number' if it's a polyfill.
1065
- type === REACT_FRAGMENT_TYPE || type === REACT_ASYNC_MODE_TYPE || type === REACT_PROFILER_TYPE || type === REACT_STRICT_MODE_TYPE || type === REACT_TIMEOUT_TYPE || typeof type === 'object' && type !== null && (type.$$typeof === REACT_PROVIDER_TYPE || type.$$typeof === REACT_CONTEXT_TYPE || type.$$typeof === REACT_FORWARD_REF_TYPE);
1066
- }
1067
-
1068
- function getComponentName(fiber) {
1069
- var type = fiber.type;
1070
-
1071
- if (typeof type === 'function') {
1072
- return type.displayName || type.name;
1073
- }
1074
- if (typeof type === 'string') {
1075
- return type;
1076
- }
1077
- switch (type) {
1078
- case REACT_ASYNC_MODE_TYPE:
1079
- return 'AsyncMode';
1080
- case REACT_CONTEXT_TYPE:
1081
- return 'Context.Consumer';
1082
- case REACT_FRAGMENT_TYPE:
1083
- return 'ReactFragment';
1084
- case REACT_PORTAL_TYPE:
1085
- return 'ReactPortal';
1086
- case REACT_PROFILER_TYPE:
1087
- return 'Profiler(' + fiber.pendingProps.id + ')';
1088
- case REACT_PROVIDER_TYPE:
1089
- return 'Context.Provider';
1090
- case REACT_STRICT_MODE_TYPE:
1091
- return 'StrictMode';
1092
- case REACT_TIMEOUT_TYPE:
1093
- return 'Timeout';
1094
- }
1095
- if (typeof type === 'object' && type !== null) {
1096
- switch (type.$$typeof) {
1097
- case REACT_FORWARD_REF_TYPE:
1098
- var functionName = type.render.displayName || type.render.name || '';
1099
- return functionName !== '' ? 'ForwardRef(' + functionName + ')' : 'ForwardRef';
1100
- }
1101
- }
1102
- return null;
1391
+ type === REACT_FRAGMENT_TYPE || type === REACT_ASYNC_MODE_TYPE || type === REACT_PROFILER_TYPE || type === REACT_STRICT_MODE_TYPE || type === REACT_PLACEHOLDER_TYPE || typeof type === 'object' && type !== null && (typeof type.then === 'function' || type.$$typeof === REACT_PROVIDER_TYPE || type.$$typeof === REACT_CONTEXT_TYPE || type.$$typeof === REACT_FORWARD_REF_TYPE);
1103
1392
  }
1104
1393
 
1105
1394
  /**
@@ -1109,52 +1398,15 @@ function getComponentName(fiber) {
1109
1398
  * that support it.
1110
1399
  */
1111
1400
 
1112
- var currentlyValidatingElement = void 0;
1113
1401
  var propTypesMisspellWarningShown = void 0;
1114
1402
 
1115
- var getDisplayName = function () {};
1116
- var getStackAddendum = function () {};
1117
-
1118
1403
  {
1119
- currentlyValidatingElement = null;
1120
-
1121
1404
  propTypesMisspellWarningShown = false;
1122
-
1123
- getDisplayName = function (element) {
1124
- if (element == null) {
1125
- return '#empty';
1126
- } else if (typeof element === 'string' || typeof element === 'number') {
1127
- return '#text';
1128
- } else if (typeof element.type === 'string') {
1129
- return element.type;
1130
- }
1131
-
1132
- var type = element.type;
1133
- if (type === REACT_FRAGMENT_TYPE) {
1134
- return 'React.Fragment';
1135
- } else if (typeof type === 'object' && type !== null && type.$$typeof === REACT_FORWARD_REF_TYPE) {
1136
- var functionName = type.render.displayName || type.render.name || '';
1137
- return functionName !== '' ? 'ForwardRef(' + functionName + ')' : 'ForwardRef';
1138
- } else {
1139
- return type.displayName || type.name || 'Unknown';
1140
- }
1141
- };
1142
-
1143
- getStackAddendum = function () {
1144
- var stack = '';
1145
- if (currentlyValidatingElement) {
1146
- var name = getDisplayName(currentlyValidatingElement);
1147
- var owner = currentlyValidatingElement._owner;
1148
- stack += describeComponentFrame(name, currentlyValidatingElement._source, owner && getComponentName(owner));
1149
- }
1150
- stack += ReactDebugCurrentFrame.getStackAddendum() || '';
1151
- return stack;
1152
- };
1153
1405
  }
1154
1406
 
1155
1407
  function getDeclarationErrorAddendum() {
1156
1408
  if (ReactCurrentOwner.current) {
1157
- var name = getComponentName(ReactCurrentOwner.current);
1409
+ var name = getComponentName(ReactCurrentOwner.current.type);
1158
1410
  if (name) {
1159
1411
  return '\n\nCheck the render method of `' + name + '`.';
1160
1412
  }
@@ -1220,14 +1472,14 @@ function validateExplicitKey(element, parentType) {
1220
1472
  var childOwner = '';
1221
1473
  if (element && element._owner && element._owner !== ReactCurrentOwner.current) {
1222
1474
  // Give the component that originally created this child.
1223
- childOwner = ' It was passed a child from ' + getComponentName(element._owner) + '.';
1475
+ childOwner = ' It was passed a child from ' + getComponentName(element._owner.type) + '.';
1224
1476
  }
1225
1477
 
1226
- currentlyValidatingElement = element;
1478
+ setCurrentlyValidatingElement(element);
1227
1479
  {
1228
- warning(false, 'Each child in an array or iterator should have a unique "key" prop.' + '%s%s See https://fb.me/react-warning-keys for more information.%s', currentComponentErrorInfo, childOwner, getStackAddendum());
1480
+ warning$1(false, 'Each child in an array or iterator should have a unique "key" prop.' + '%s%s See https://fb.me/react-warning-keys for more information.', currentComponentErrorInfo, childOwner);
1229
1481
  }
1230
- currentlyValidatingElement = null;
1482
+ setCurrentlyValidatingElement(null);
1231
1483
  }
1232
1484
 
1233
1485
  /**
@@ -1290,21 +1542,21 @@ function validatePropTypes(element) {
1290
1542
  } else if (typeof type === 'object' && type !== null && type.$$typeof === REACT_FORWARD_REF_TYPE) {
1291
1543
  // ForwardRef
1292
1544
  var functionName = type.render.displayName || type.render.name || '';
1293
- name = functionName !== '' ? 'ForwardRef(' + functionName + ')' : 'ForwardRef';
1545
+ name = type.displayName || (functionName !== '' ? 'ForwardRef(' + functionName + ')' : 'ForwardRef');
1294
1546
  propTypes = type.propTypes;
1295
1547
  } else {
1296
1548
  return;
1297
1549
  }
1298
1550
  if (propTypes) {
1299
- currentlyValidatingElement = element;
1300
- checkPropTypes(propTypes, element.props, 'prop', name, getStackAddendum);
1301
- currentlyValidatingElement = null;
1551
+ setCurrentlyValidatingElement(element);
1552
+ checkPropTypes(propTypes, element.props, 'prop', name, ReactDebugCurrentFrame.getStackAddendum);
1553
+ setCurrentlyValidatingElement(null);
1302
1554
  } else if (type.PropTypes !== undefined && !propTypesMisspellWarningShown) {
1303
1555
  propTypesMisspellWarningShown = true;
1304
- warning(false, 'Component %s declared `PropTypes` instead of `propTypes`. Did you misspell the property assignment?', name || 'Unknown');
1556
+ warningWithoutStack$1(false, 'Component %s declared `PropTypes` instead of `propTypes`. Did you misspell the property assignment?', name || 'Unknown');
1305
1557
  }
1306
1558
  if (typeof type.getDefaultProps === 'function') {
1307
- !type.getDefaultProps.isReactClassApproved ? warning(false, 'getDefaultProps is only used on classic React.createClass ' + 'definitions. Use a static property named `defaultProps` instead.') : void 0;
1559
+ !type.getDefaultProps.isReactClassApproved ? warningWithoutStack$1(false, 'getDefaultProps is only used on classic React.createClass ' + 'definitions. Use a static property named `defaultProps` instead.') : void 0;
1308
1560
  }
1309
1561
  }
1310
1562
 
@@ -1313,22 +1565,22 @@ function validatePropTypes(element) {
1313
1565
  * @param {ReactElement} fragment
1314
1566
  */
1315
1567
  function validateFragmentProps(fragment) {
1316
- currentlyValidatingElement = fragment;
1568
+ setCurrentlyValidatingElement(fragment);
1317
1569
 
1318
1570
  var keys = Object.keys(fragment.props);
1319
1571
  for (var i = 0; i < keys.length; i++) {
1320
1572
  var key = keys[i];
1321
1573
  if (key !== 'children' && key !== 'key') {
1322
- warning(false, 'Invalid prop `%s` supplied to `React.Fragment`. ' + 'React.Fragment can only have `key` and `children` props.%s', key, getStackAddendum());
1574
+ warning$1(false, 'Invalid prop `%s` supplied to `React.Fragment`. ' + 'React.Fragment can only have `key` and `children` props.', key);
1323
1575
  break;
1324
1576
  }
1325
1577
  }
1326
1578
 
1327
1579
  if (fragment.ref !== null) {
1328
- warning(false, 'Invalid attribute `ref` supplied to `React.Fragment`.%s', getStackAddendum());
1580
+ warning$1(false, 'Invalid attribute `ref` supplied to `React.Fragment`.');
1329
1581
  }
1330
1582
 
1331
- currentlyValidatingElement = null;
1583
+ setCurrentlyValidatingElement(null);
1332
1584
  }
1333
1585
 
1334
1586
  function createElementWithValidation(type, props, children) {
@@ -1349,18 +1601,19 @@ function createElementWithValidation(type, props, children) {
1349
1601
  info += getDeclarationErrorAddendum();
1350
1602
  }
1351
1603
 
1352
- info += getStackAddendum() || '';
1353
-
1354
1604
  var typeString = void 0;
1355
1605
  if (type === null) {
1356
1606
  typeString = 'null';
1357
1607
  } else if (Array.isArray(type)) {
1358
1608
  typeString = 'array';
1609
+ } else if (type !== undefined && type.$$typeof === REACT_ELEMENT_TYPE) {
1610
+ typeString = '<' + (getComponentName(type.type) || 'Unknown') + ' />';
1611
+ info = ' Did you accidentally export a JSX literal instead of a component?';
1359
1612
  } else {
1360
1613
  typeString = typeof type;
1361
1614
  }
1362
1615
 
1363
- warning(false, 'React.createElement: type is invalid -- expected a string (for ' + 'built-in components) or a class/function (for composite ' + 'components) but got: %s.%s', typeString, info);
1616
+ warning$1(false, 'React.createElement: type is invalid -- expected a string (for ' + 'built-in components) or a class/function (for composite ' + 'components) but got: %s.%s', typeString, info);
1364
1617
  }
1365
1618
 
1366
1619
  var element = createElement.apply(this, arguments);
@@ -1448,25 +1701,12 @@ var React = {
1448
1701
 
1449
1702
  version: ReactVersion,
1450
1703
 
1451
- __SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED: {
1452
- ReactCurrentOwner: ReactCurrentOwner,
1453
- // Used by renderers to avoid bundling object-assign twice in UMD bundles:
1454
- assign: _assign
1455
- }
1704
+ __SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED: ReactSharedInternals
1456
1705
  };
1457
1706
 
1458
1707
  if (enableSuspense) {
1459
- React.Timeout = REACT_TIMEOUT_TYPE;
1460
- }
1461
-
1462
- {
1463
- _assign(React.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED, {
1464
- // These should not be included in production.
1465
- ReactDebugCurrentFrame: ReactDebugCurrentFrame,
1466
- // Shim for React DOM 16.0.0 which still destructured (but not used) this.
1467
- // TODO: remove in React 17.0.
1468
- ReactComponentTreeHook: {}
1469
- });
1708
+ React.Placeholder = REACT_PLACEHOLDER_TYPE;
1709
+ React.lazy = lazy;
1470
1710
  }
1471
1711
 
1472
1712
 
@@ -1479,7 +1719,7 @@ var React$3 = ( React$2 && React ) || React$2;
1479
1719
 
1480
1720
  // TODO: decide on the top-level export form.
1481
1721
  // This is hacky but makes it work with both Rollup and Jest.
1482
- var react = React$3.default ? React$3.default : React$3;
1722
+ var react = React$3.default || React$3;
1483
1723
 
1484
1724
  module.exports = react;
1485
1725
  })();