react 16.4.0 → 16.5.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/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.0
1
+ /** @license React v16.5.1
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.0';
23
+ var ReactVersion = '16.5.1';
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,11 +81,63 @@ var enableSuspense = false;
88
81
  // Gather advanced timing metrics for Profiler subtrees.
89
82
 
90
83
 
91
- // Fires getDerivedStateFromProps for state *or* props changes
84
+ // Track which interactions trigger each commit.
85
+
86
+
87
+ // Only used in www builds.
92
88
 
93
89
 
94
90
  // Only used in www builds.
95
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
+
96
141
  /**
97
142
  * Forked from fbjs/warning:
98
143
  * https://github.com/facebook/fbjs/blob/e66ba20ad5be433eb54423f2b097d829324d9de6/packages/fbjs/src/__forks__/warning.js
@@ -132,7 +177,7 @@ var lowPriorityWarning = function () {};
132
177
 
133
178
  lowPriorityWarning = function (condition, format) {
134
179
  if (format === undefined) {
135
- 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');
136
181
  }
137
182
  if (!condition) {
138
183
  for (var _len2 = arguments.length, args = Array(_len2 > 2 ? _len2 - 2 : 0), _key2 = 2; _key2 < _len2; _key2++) {
@@ -146,6 +191,95 @@ var lowPriorityWarning = function () {};
146
191
 
147
192
  var lowPriorityWarning$1 = lowPriorityWarning;
148
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
+
149
283
  var didWarnStateUpdateForUnmountedComponent = {};
150
284
 
151
285
  function warnNoop(publicInstance, callerName) {
@@ -156,7 +290,7 @@ function warnNoop(publicInstance, callerName) {
156
290
  if (didWarnStateUpdateForUnmountedComponent[warningKey]) {
157
291
  return;
158
292
  }
159
- 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);
160
294
  didWarnStateUpdateForUnmountedComponent[warningKey] = true;
161
295
  }
162
296
  }
@@ -229,12 +363,18 @@ var ReactNoopUpdateQueue = {
229
363
  }
230
364
  };
231
365
 
366
+ var emptyObject = {};
367
+ {
368
+ Object.freeze(emptyObject);
369
+ }
370
+
232
371
  /**
233
372
  * Base class helpers for the updating state of a component.
234
373
  */
235
374
  function Component(props, context, updater) {
236
375
  this.props = props;
237
376
  this.context = context;
377
+ // If a component has string refs, we will assign a different object later.
238
378
  this.refs = emptyObject;
239
379
  // We initialize the default updater but the real one gets injected by the
240
380
  // renderer.
@@ -325,6 +465,7 @@ ComponentDummy.prototype = Component.prototype;
325
465
  function PureComponent(props, context, updater) {
326
466
  this.props = props;
327
467
  this.context = context;
468
+ // If a component has string refs, we will assign a different object later.
328
469
  this.refs = emptyObject;
329
470
  this.updater = updater || ReactNoopUpdateQueue;
330
471
  }
@@ -357,9 +498,177 @@ var ReactCurrentOwner = {
357
498
  * @internal
358
499
  * @type {ReactComponent}
359
500
  */
360
- 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
361
632
  };
362
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
+
363
672
  var hasOwnProperty = Object.prototype.hasOwnProperty;
364
673
 
365
674
  var RESERVED_PROPS = {
@@ -400,7 +709,7 @@ function defineKeyPropWarningGetter(props, displayName) {
400
709
  var warnAboutAccessingKey = function () {
401
710
  if (!specialPropKeyWarningShown) {
402
711
  specialPropKeyWarningShown = true;
403
- 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);
404
713
  }
405
714
  };
406
715
  warnAboutAccessingKey.isReactWarning = true;
@@ -414,7 +723,7 @@ function defineRefPropWarningGetter(props, displayName) {
414
723
  var warnAboutAccessingRef = function () {
415
724
  if (!specialPropRefWarningShown) {
416
725
  specialPropRefWarningShown = true;
417
- 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);
418
727
  }
419
728
  };
420
729
  warnAboutAccessingRef.isReactWarning = true;
@@ -562,14 +871,12 @@ function createElement(type, config, children) {
562
871
  }
563
872
  {
564
873
  if (key || ref) {
565
- if (typeof props.$$typeof === 'undefined' || props.$$typeof !== REACT_ELEMENT_TYPE) {
566
- var displayName = typeof type === 'function' ? type.displayName || type.name || 'Unknown' : type;
567
- if (key) {
568
- defineKeyPropWarningGetter(props, displayName);
569
- }
570
- if (ref) {
571
- defineRefPropWarningGetter(props, displayName);
572
- }
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);
573
880
  }
574
881
  }
575
882
  }
@@ -660,28 +967,13 @@ function cloneElement(element, config, children) {
660
967
  * Verifies the object is a ReactElement.
661
968
  * See https://reactjs.org/docs/react-api.html#isvalidelement
662
969
  * @param {?object} object
663
- * @return {boolean} True if `object` is a valid component.
970
+ * @return {boolean} True if `object` is a ReactElement.
664
971
  * @final
665
972
  */
666
973
  function isValidElement(object) {
667
974
  return typeof object === 'object' && object !== null && object.$$typeof === REACT_ELEMENT_TYPE;
668
975
  }
669
976
 
670
- var ReactDebugCurrentFrame = {};
671
-
672
- {
673
- // Component that is being worked on
674
- ReactDebugCurrentFrame.getCurrentStack = null;
675
-
676
- ReactDebugCurrentFrame.getStackAddendum = function () {
677
- var impl = ReactDebugCurrentFrame.getCurrentStack;
678
- if (impl) {
679
- return impl();
680
- }
681
- return null;
682
- };
683
- }
684
-
685
977
  var SEPARATOR = '.';
686
978
  var SUBSEPARATOR = ':';
687
979
 
@@ -809,7 +1101,7 @@ function traverseAllChildrenImpl(children, nameSoFar, callback, traverseContext)
809
1101
  {
810
1102
  // Warn about using Maps as children
811
1103
  if (iteratorFn === children.entries) {
812
- !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;
813
1105
  didWarnAboutMaps = true;
814
1106
  }
815
1107
  }
@@ -887,7 +1179,7 @@ function forEachSingleChild(bookKeeping, child, name) {
887
1179
  /**
888
1180
  * Iterates through children that are typically specified as `props.children`.
889
1181
  *
890
- * See https://reactjs.org/docs/react-api.html#react.children.foreach
1182
+ * See https://reactjs.org/docs/react-api.html#reactchildrenforeach
891
1183
  *
892
1184
  * The provided forEachFunc(child, index) will be called for each
893
1185
  * leaf child.
@@ -914,7 +1206,9 @@ function mapSingleChildIntoContext(bookKeeping, child, childKey) {
914
1206
 
915
1207
  var mappedChild = func.call(context, child, bookKeeping.count++);
916
1208
  if (Array.isArray(mappedChild)) {
917
- mapIntoWithKeyPrefixInternal(mappedChild, result, childKey, emptyFunction.thatReturnsArgument);
1209
+ mapIntoWithKeyPrefixInternal(mappedChild, result, childKey, function (c) {
1210
+ return c;
1211
+ });
918
1212
  } else if (mappedChild != null) {
919
1213
  if (isValidElement(mappedChild)) {
920
1214
  mappedChild = cloneAndReplaceKey(mappedChild,
@@ -939,7 +1233,7 @@ function mapIntoWithKeyPrefixInternal(children, array, prefix, func, context) {
939
1233
  /**
940
1234
  * Maps children that are typically specified as `props.children`.
941
1235
  *
942
- * See https://reactjs.org/docs/react-api.html#react.children.map
1236
+ * See https://reactjs.org/docs/react-api.html#reactchildrenmap
943
1237
  *
944
1238
  * The provided mapFunction(child, key, index) will be called for each
945
1239
  * leaf child.
@@ -962,24 +1256,28 @@ function mapChildren(children, func, context) {
962
1256
  * Count the number of children that are typically specified as
963
1257
  * `props.children`.
964
1258
  *
965
- * See https://reactjs.org/docs/react-api.html#react.children.count
1259
+ * See https://reactjs.org/docs/react-api.html#reactchildrencount
966
1260
  *
967
1261
  * @param {?*} children Children tree container.
968
1262
  * @return {number} The number of children.
969
1263
  */
970
1264
  function countChildren(children) {
971
- return traverseAllChildren(children, emptyFunction.thatReturnsNull, null);
1265
+ return traverseAllChildren(children, function () {
1266
+ return null;
1267
+ }, null);
972
1268
  }
973
1269
 
974
1270
  /**
975
1271
  * Flatten a children object (typically specified as `props.children`) and
976
1272
  * return an array with appropriately re-keyed children.
977
1273
  *
978
- * See https://reactjs.org/docs/react-api.html#react.children.toarray
1274
+ * See https://reactjs.org/docs/react-api.html#reactchildrentoarray
979
1275
  */
980
1276
  function toArray(children) {
981
1277
  var result = [];
982
- mapIntoWithKeyPrefixInternal(children, result, null, emptyFunction.thatReturnsArgument);
1278
+ mapIntoWithKeyPrefixInternal(children, result, null, function (child) {
1279
+ return child;
1280
+ });
983
1281
  return result;
984
1282
  }
985
1283
 
@@ -987,7 +1285,7 @@ function toArray(children) {
987
1285
  * Returns the first child in a collection of children and verifies that there
988
1286
  * is only one child in the collection.
989
1287
  *
990
- * See https://reactjs.org/docs/react-api.html#react.children.only
1288
+ * See https://reactjs.org/docs/react-api.html#reactchildrenonly
991
1289
  *
992
1290
  * The current implementation of this function assumes that a single child gets
993
1291
  * passed without a wrapper, but the purpose of this helper function is to
@@ -1002,31 +1300,35 @@ function onlyChild(children) {
1002
1300
  return children;
1003
1301
  }
1004
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
+
1005
1309
  function createContext(defaultValue, calculateChangedBits) {
1006
1310
  if (calculateChangedBits === undefined) {
1007
1311
  calculateChangedBits = null;
1008
1312
  } else {
1009
1313
  {
1010
- !(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;
1011
1315
  }
1012
1316
  }
1013
1317
 
1014
1318
  var context = {
1015
1319
  $$typeof: REACT_CONTEXT_TYPE,
1016
1320
  _calculateChangedBits: calculateChangedBits,
1017
- _defaultValue: defaultValue,
1018
- _currentValue: defaultValue,
1019
1321
  // As a workaround to support multiple concurrent renderers, we categorize
1020
1322
  // some renderers as primary and others as secondary. We only expect
1021
1323
  // there to be two concurrent renderers at most: React Native (primary) and
1022
1324
  // Fabric (secondary); React DOM (primary) and React ART (secondary).
1023
1325
  // Secondary renderers store their context values on separate fields.
1326
+ _currentValue: defaultValue,
1024
1327
  _currentValue2: defaultValue,
1025
- _changedBits: 0,
1026
- _changedBits2: 0,
1027
1328
  // These are circular
1028
1329
  Provider: null,
1029
- Consumer: null
1330
+ Consumer: null,
1331
+ unstable_read: null
1030
1332
  };
1031
1333
 
1032
1334
  context.Provider = {
@@ -1034,6 +1336,7 @@ function createContext(defaultValue, calculateChangedBits) {
1034
1336
  _context: context
1035
1337
  };
1036
1338
  context.Consumer = context;
1339
+ context.unstable_read = readContext.bind(null, context);
1037
1340
 
1038
1341
  {
1039
1342
  context._currentRenderer = null;
@@ -1043,12 +1346,36 @@ function createContext(defaultValue, calculateChangedBits) {
1043
1346
  return context;
1044
1347
  }
1045
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
+
1046
1367
  function forwardRef(render) {
1047
1368
  {
1048
- !(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
+ }
1049
1376
 
1050
1377
  if (render != null) {
1051
- !(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;
1052
1379
  }
1053
1380
  }
1054
1381
 
@@ -1058,51 +1385,10 @@ function forwardRef(render) {
1058
1385
  };
1059
1386
  }
1060
1387
 
1061
- var describeComponentFrame = function (name, source, ownerName) {
1062
- return '\n in ' + (name || 'Unknown') + (source ? ' (at ' + source.fileName.replace(/^.*[\\\/]/, '') + ':' + source.lineNumber + ')' : ownerName ? ' (created by ' + ownerName + ')' : '');
1063
- };
1064
-
1065
1388
  function isValidElementType(type) {
1066
1389
  return typeof type === 'string' || typeof type === 'function' ||
1067
1390
  // Note: its typeof might be other than 'symbol' or 'number' if it's a polyfill.
1068
- 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);
1069
- }
1070
-
1071
- function getComponentName(fiber) {
1072
- var type = fiber.type;
1073
-
1074
- if (typeof type === 'function') {
1075
- return type.displayName || type.name;
1076
- }
1077
- if (typeof type === 'string') {
1078
- return type;
1079
- }
1080
- switch (type) {
1081
- case REACT_ASYNC_MODE_TYPE:
1082
- return 'AsyncMode';
1083
- case REACT_CONTEXT_TYPE:
1084
- return 'Context.Consumer';
1085
- case REACT_FRAGMENT_TYPE:
1086
- return 'ReactFragment';
1087
- case REACT_PORTAL_TYPE:
1088
- return 'ReactPortal';
1089
- case REACT_PROFILER_TYPE:
1090
- return 'Profiler(' + fiber.pendingProps.id + ')';
1091
- case REACT_PROVIDER_TYPE:
1092
- return 'Context.Provider';
1093
- case REACT_STRICT_MODE_TYPE:
1094
- return 'StrictMode';
1095
- case REACT_TIMEOUT_TYPE:
1096
- return 'Timeout';
1097
- }
1098
- if (typeof type === 'object' && type !== null) {
1099
- switch (type.$$typeof) {
1100
- case REACT_FORWARD_REF_TYPE:
1101
- var functionName = type.render.displayName || type.render.name || '';
1102
- return functionName !== '' ? 'ForwardRef(' + functionName + ')' : 'ForwardRef';
1103
- }
1104
- }
1105
- 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);
1106
1392
  }
1107
1393
 
1108
1394
  /**
@@ -1112,46 +1398,15 @@ function getComponentName(fiber) {
1112
1398
  * that support it.
1113
1399
  */
1114
1400
 
1115
- var currentlyValidatingElement = void 0;
1116
1401
  var propTypesMisspellWarningShown = void 0;
1117
1402
 
1118
- var getDisplayName = function () {};
1119
- var getStackAddendum = function () {};
1120
-
1121
1403
  {
1122
- currentlyValidatingElement = null;
1123
-
1124
1404
  propTypesMisspellWarningShown = false;
1125
-
1126
- getDisplayName = function (element) {
1127
- if (element == null) {
1128
- return '#empty';
1129
- } else if (typeof element === 'string' || typeof element === 'number') {
1130
- return '#text';
1131
- } else if (typeof element.type === 'string') {
1132
- return element.type;
1133
- } else if (element.type === REACT_FRAGMENT_TYPE) {
1134
- return 'React.Fragment';
1135
- } else {
1136
- return element.type.displayName || element.type.name || 'Unknown';
1137
- }
1138
- };
1139
-
1140
- getStackAddendum = function () {
1141
- var stack = '';
1142
- if (currentlyValidatingElement) {
1143
- var name = getDisplayName(currentlyValidatingElement);
1144
- var owner = currentlyValidatingElement._owner;
1145
- stack += describeComponentFrame(name, currentlyValidatingElement._source, owner && getComponentName(owner));
1146
- }
1147
- stack += ReactDebugCurrentFrame.getStackAddendum() || '';
1148
- return stack;
1149
- };
1150
1405
  }
1151
1406
 
1152
1407
  function getDeclarationErrorAddendum() {
1153
1408
  if (ReactCurrentOwner.current) {
1154
- var name = getComponentName(ReactCurrentOwner.current);
1409
+ var name = getComponentName(ReactCurrentOwner.current.type);
1155
1410
  if (name) {
1156
1411
  return '\n\nCheck the render method of `' + name + '`.';
1157
1412
  }
@@ -1217,14 +1472,14 @@ function validateExplicitKey(element, parentType) {
1217
1472
  var childOwner = '';
1218
1473
  if (element && element._owner && element._owner !== ReactCurrentOwner.current) {
1219
1474
  // Give the component that originally created this child.
1220
- childOwner = ' It was passed a child from ' + getComponentName(element._owner) + '.';
1475
+ childOwner = ' It was passed a child from ' + getComponentName(element._owner.type) + '.';
1221
1476
  }
1222
1477
 
1223
- currentlyValidatingElement = element;
1478
+ setCurrentlyValidatingElement(element);
1224
1479
  {
1225
- 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);
1226
1481
  }
1227
- currentlyValidatingElement = null;
1482
+ setCurrentlyValidatingElement(null);
1228
1483
  }
1229
1484
 
1230
1485
  /**
@@ -1277,22 +1532,31 @@ function validateChildKeys(node, parentType) {
1277
1532
  * @param {ReactElement} element
1278
1533
  */
1279
1534
  function validatePropTypes(element) {
1280
- var componentClass = element.type;
1281
- if (typeof componentClass !== 'function') {
1535
+ var type = element.type;
1536
+ var name = void 0,
1537
+ propTypes = void 0;
1538
+ if (typeof type === 'function') {
1539
+ // Class or functional component
1540
+ name = type.displayName || type.name;
1541
+ propTypes = type.propTypes;
1542
+ } else if (typeof type === 'object' && type !== null && type.$$typeof === REACT_FORWARD_REF_TYPE) {
1543
+ // ForwardRef
1544
+ var functionName = type.render.displayName || type.render.name || '';
1545
+ name = type.displayName || (functionName !== '' ? 'ForwardRef(' + functionName + ')' : 'ForwardRef');
1546
+ propTypes = type.propTypes;
1547
+ } else {
1282
1548
  return;
1283
1549
  }
1284
- var name = componentClass.displayName || componentClass.name;
1285
- var propTypes = componentClass.propTypes;
1286
1550
  if (propTypes) {
1287
- currentlyValidatingElement = element;
1288
- checkPropTypes(propTypes, element.props, 'prop', name, getStackAddendum);
1289
- currentlyValidatingElement = null;
1290
- } else if (componentClass.PropTypes !== undefined && !propTypesMisspellWarningShown) {
1551
+ setCurrentlyValidatingElement(element);
1552
+ checkPropTypes(propTypes, element.props, 'prop', name, ReactDebugCurrentFrame.getStackAddendum);
1553
+ setCurrentlyValidatingElement(null);
1554
+ } else if (type.PropTypes !== undefined && !propTypesMisspellWarningShown) {
1291
1555
  propTypesMisspellWarningShown = true;
1292
- 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');
1293
1557
  }
1294
- if (typeof componentClass.getDefaultProps === 'function') {
1295
- !componentClass.getDefaultProps.isReactClassApproved ? warning(false, 'getDefaultProps is only used on classic React.createClass ' + 'definitions. Use a static property named `defaultProps` instead.') : void 0;
1558
+ if (typeof type.getDefaultProps === 'function') {
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;
1296
1560
  }
1297
1561
  }
1298
1562
 
@@ -1301,22 +1565,22 @@ function validatePropTypes(element) {
1301
1565
  * @param {ReactElement} fragment
1302
1566
  */
1303
1567
  function validateFragmentProps(fragment) {
1304
- currentlyValidatingElement = fragment;
1568
+ setCurrentlyValidatingElement(fragment);
1305
1569
 
1306
1570
  var keys = Object.keys(fragment.props);
1307
1571
  for (var i = 0; i < keys.length; i++) {
1308
1572
  var key = keys[i];
1309
1573
  if (key !== 'children' && key !== 'key') {
1310
- 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);
1311
1575
  break;
1312
1576
  }
1313
1577
  }
1314
1578
 
1315
1579
  if (fragment.ref !== null) {
1316
- warning(false, 'Invalid attribute `ref` supplied to `React.Fragment`.%s', getStackAddendum());
1580
+ warning$1(false, 'Invalid attribute `ref` supplied to `React.Fragment`.');
1317
1581
  }
1318
1582
 
1319
- currentlyValidatingElement = null;
1583
+ setCurrentlyValidatingElement(null);
1320
1584
  }
1321
1585
 
1322
1586
  function createElementWithValidation(type, props, children) {
@@ -1337,18 +1601,19 @@ function createElementWithValidation(type, props, children) {
1337
1601
  info += getDeclarationErrorAddendum();
1338
1602
  }
1339
1603
 
1340
- info += getStackAddendum() || '';
1341
-
1342
1604
  var typeString = void 0;
1343
1605
  if (type === null) {
1344
1606
  typeString = 'null';
1345
1607
  } else if (Array.isArray(type)) {
1346
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?';
1347
1612
  } else {
1348
1613
  typeString = typeof type;
1349
1614
  }
1350
1615
 
1351
- 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);
1352
1617
  }
1353
1618
 
1354
1619
  var element = createElement.apply(this, arguments);
@@ -1436,25 +1701,12 @@ var React = {
1436
1701
 
1437
1702
  version: ReactVersion,
1438
1703
 
1439
- __SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED: {
1440
- ReactCurrentOwner: ReactCurrentOwner,
1441
- // Used by renderers to avoid bundling object-assign twice in UMD bundles:
1442
- assign: _assign
1443
- }
1704
+ __SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED: ReactSharedInternals
1444
1705
  };
1445
1706
 
1446
1707
  if (enableSuspense) {
1447
- React.Timeout = REACT_TIMEOUT_TYPE;
1448
- }
1449
-
1450
- {
1451
- _assign(React.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED, {
1452
- // These should not be included in production.
1453
- ReactDebugCurrentFrame: ReactDebugCurrentFrame,
1454
- // Shim for React DOM 16.0.0 which still destructured (but not used) this.
1455
- // TODO: remove in React 17.0.
1456
- ReactComponentTreeHook: {}
1457
- });
1708
+ React.Placeholder = REACT_PLACEHOLDER_TYPE;
1709
+ React.lazy = lazy;
1458
1710
  }
1459
1711
 
1460
1712
 
@@ -1467,7 +1719,7 @@ var React$3 = ( React$2 && React ) || React$2;
1467
1719
 
1468
1720
  // TODO: decide on the top-level export form.
1469
1721
  // This is hacky but makes it work with both Rollup and Jest.
1470
- var react = React$3.default ? React$3.default : React$3;
1722
+ var react = React$3.default || React$3;
1471
1723
 
1472
1724
  module.exports = react;
1473
1725
  })();