react 16.4.0-alpha.0911da3 → 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.
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,4 +1,4 @@
1
- /** @license React v16.4.0-alpha.0911da3
1
+ /** @license React v16.5.0
2
2
  * react.development.js
3
3
  *
4
4
  * Copyright (c) 2013-present, Facebook, Inc.
@@ -16,37 +16,32 @@ if (process.env.NODE_ENV !== "production") {
16
16
  'use strict';
17
17
 
18
18
  var _assign = require('object-assign');
19
- var emptyObject = require('fbjs/lib/emptyObject');
20
- var invariant = require('fbjs/lib/invariant');
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-alpha.0911da3';
23
+ var ReactVersion = '16.5.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.
31
- var hasSymbol = typeof Symbol === 'function' && Symbol['for'];
32
-
33
- var REACT_ELEMENT_TYPE = hasSymbol ? Symbol['for']('react.element') : 0xeac7;
34
- var REACT_CALL_TYPE = hasSymbol ? Symbol['for']('react.call') : 0xeac8;
35
- var REACT_RETURN_TYPE = hasSymbol ? Symbol['for']('react.return') : 0xeac9;
36
- var REACT_PORTAL_TYPE = hasSymbol ? Symbol['for']('react.portal') : 0xeaca;
37
- var REACT_FRAGMENT_TYPE = hasSymbol ? Symbol['for']('react.fragment') : 0xeacb;
38
- var REACT_STRICT_MODE_TYPE = hasSymbol ? Symbol['for']('react.strict_mode') : 0xeacc;
39
- var REACT_PROVIDER_TYPE = hasSymbol ? Symbol['for']('react.provider') : 0xeacd;
40
- var REACT_CONTEXT_TYPE = hasSymbol ? Symbol['for']('react.context') : 0xeace;
41
- var REACT_ASYNC_MODE_TYPE = hasSymbol ? Symbol['for']('react.async_mode') : 0xeacf;
42
- var REACT_LOADING_TYPE = hasSymbol ? Symbol['for']('react.loading') : 0xeada;
43
- var REACT_TIMEOUT_TYPE = hasSymbol ? Symbol['for']('react.timeout') : 0xeadb;
27
+ var hasSymbol = typeof Symbol === 'function' && Symbol.for;
28
+
29
+ var REACT_ELEMENT_TYPE = hasSymbol ? Symbol.for('react.element') : 0xeac7;
30
+ var REACT_PORTAL_TYPE = hasSymbol ? Symbol.for('react.portal') : 0xeaca;
31
+ var REACT_FRAGMENT_TYPE = hasSymbol ? Symbol.for('react.fragment') : 0xeacb;
32
+ var REACT_STRICT_MODE_TYPE = hasSymbol ? Symbol.for('react.strict_mode') : 0xeacc;
33
+ var REACT_PROFILER_TYPE = hasSymbol ? Symbol.for('react.profiler') : 0xead2;
34
+ var REACT_PROVIDER_TYPE = hasSymbol ? Symbol.for('react.provider') : 0xeacd;
35
+ var REACT_CONTEXT_TYPE = hasSymbol ? Symbol.for('react.context') : 0xeace;
36
+ var REACT_ASYNC_MODE_TYPE = hasSymbol ? Symbol.for('react.async_mode') : 0xeacf;
37
+ var REACT_FORWARD_REF_TYPE = hasSymbol ? Symbol.for('react.forward_ref') : 0xead0;
38
+ var REACT_PLACEHOLDER_TYPE = hasSymbol ? Symbol.for('react.placeholder') : 0xead1;
44
39
 
45
40
  var MAYBE_ITERATOR_SYMBOL = typeof Symbol === 'function' && Symbol.iterator;
46
41
  var FAUX_ITERATOR_SYMBOL = '@@iterator';
47
42
 
48
43
  function getIteratorFn(maybeIterable) {
49
- if (maybeIterable === null || typeof maybeIterable === 'undefined') {
44
+ if (maybeIterable === null || typeof maybeIterable !== 'object') {
50
45
  return null;
51
46
  }
52
47
  var maybeIterator = MAYBE_ITERATOR_SYMBOL && maybeIterable[MAYBE_ITERATOR_SYMBOL] || maybeIterable[FAUX_ITERATOR_SYMBOL];
@@ -57,12 +52,88 @@ function getIteratorFn(maybeIterable) {
57
52
  }
58
53
 
59
54
  /**
60
- * WARNING: DO NOT manually require this module.
61
- * This is a replacement for `invariant(...)` used by the error code system
62
- * and will _only_ be required by the corresponding babel pass.
63
- * It always throws.
55
+ * Use invariant() to assert state which your program assumes to be true.
56
+ *
57
+ * Provide sprintf-style format (only %s is supported) and arguments
58
+ * to provide information about what broke and what you were
59
+ * expecting.
60
+ *
61
+ * The invariant message will be stripped in production, but the invariant
62
+ * will remain to ensure logic does not differ in production.
64
63
  */
65
64
 
65
+ var validateFormat = function () {};
66
+
67
+ {
68
+ validateFormat = function (format) {
69
+ if (format === undefined) {
70
+ throw new Error('invariant requires an error message argument');
71
+ }
72
+ };
73
+ }
74
+
75
+ function invariant(condition, format, a, b, c, d, e, f) {
76
+ validateFormat(format);
77
+
78
+ if (!condition) {
79
+ var error = void 0;
80
+ if (format === undefined) {
81
+ error = new Error('Minified exception occurred; use the non-minified dev environment ' + 'for the full error message and additional helpful warnings.');
82
+ } else {
83
+ var args = [a, b, c, d, e, f];
84
+ var argIndex = 0;
85
+ error = new Error(format.replace(/%s/g, function () {
86
+ return args[argIndex++];
87
+ }));
88
+ error.name = 'Invariant Violation';
89
+ }
90
+
91
+ error.framesToPop = 1; // we don't care about invariant's own frame
92
+ throw error;
93
+ }
94
+ }
95
+
96
+ // Relying on the `invariant()` implementation lets us
97
+ // preserve the format and params in the www builds.
98
+
99
+ // Exports ReactDOM.createRoot
100
+
101
+
102
+ // Experimental error-boundary API that can recover from errors within a single
103
+ // render phase
104
+
105
+ // Suspense
106
+ var enableSuspense = false;
107
+ // Helps identify side effects in begin-phase lifecycle hooks and setState reducers:
108
+
109
+
110
+ // In some cases, StrictMode should also double-render lifecycles.
111
+ // This can be confusing for tests though,
112
+ // And it can be bad for performance in production.
113
+ // This feature flag can be used to control the behavior:
114
+
115
+
116
+ // To preserve the "Pause on caught exceptions" behavior of the debugger, we
117
+ // replay the begin phase of a failed component inside invokeGuardedCallback.
118
+
119
+
120
+ // Warn about deprecated, async-unsafe lifecycles; relates to RFC #6:
121
+
122
+
123
+ // Warn about legacy context API
124
+
125
+
126
+ // Gather advanced timing metrics for Profiler subtrees.
127
+
128
+
129
+ // Track which interactions trigger each commit.
130
+
131
+
132
+ // Only used in www builds.
133
+
134
+
135
+ // Only used in www builds.
136
+
66
137
  /**
67
138
  * Forked from fbjs/warning:
68
139
  * https://github.com/facebook/fbjs/blob/e66ba20ad5be433eb54423f2b097d829324d9de6/packages/fbjs/src/__forks__/warning.js
@@ -102,7 +173,7 @@ var lowPriorityWarning = function () {};
102
173
 
103
174
  lowPriorityWarning = function (condition, format) {
104
175
  if (format === undefined) {
105
- throw new Error('`warning(condition, format, ...args)` requires a warning ' + 'message argument');
176
+ throw new Error('`lowPriorityWarning(condition, format, ...args)` requires a warning ' + 'message argument');
106
177
  }
107
178
  if (!condition) {
108
179
  for (var _len2 = arguments.length, args = Array(_len2 > 2 ? _len2 - 2 : 0), _key2 = 2; _key2 < _len2; _key2++) {
@@ -116,6 +187,50 @@ var lowPriorityWarning = function () {};
116
187
 
117
188
  var lowPriorityWarning$1 = lowPriorityWarning;
118
189
 
190
+ /**
191
+ * Similar to invariant but only logs a warning if the condition is not met.
192
+ * This can be used to log issues in development environments in critical
193
+ * paths. Removing the logging code for production environments will keep the
194
+ * same logic and follow the same code paths.
195
+ */
196
+
197
+ var warningWithoutStack = function () {};
198
+
199
+ {
200
+ warningWithoutStack = function (condition, format) {
201
+ for (var _len = arguments.length, args = Array(_len > 2 ? _len - 2 : 0), _key = 2; _key < _len; _key++) {
202
+ args[_key - 2] = arguments[_key];
203
+ }
204
+
205
+ if (format === undefined) {
206
+ throw new Error('`warningWithoutStack(condition, format, ...args)` requires a warning ' + 'message argument');
207
+ }
208
+ if (condition) {
209
+ return;
210
+ }
211
+ if (typeof console !== 'undefined') {
212
+ var _console;
213
+
214
+ var stringArgs = args.map(function (item) {
215
+ return '' + item;
216
+ });
217
+ (_console = console).error.apply(_console, ['Warning: ' + format].concat(stringArgs));
218
+ }
219
+ try {
220
+ // --- Welcome to debugging React ---
221
+ // This error was thrown as a convenience so that you can use this stack
222
+ // to find the callsite that caused this warning to fire.
223
+ var argIndex = 0;
224
+ var message = 'Warning: ' + format.replace(/%s/g, function () {
225
+ return args[argIndex++];
226
+ });
227
+ throw new Error(message);
228
+ } catch (x) {}
229
+ };
230
+ }
231
+
232
+ var warningWithoutStack$1 = warningWithoutStack;
233
+
119
234
  var didWarnStateUpdateForUnmountedComponent = {};
120
235
 
121
236
  function warnNoop(publicInstance, callerName) {
@@ -126,7 +241,7 @@ function warnNoop(publicInstance, callerName) {
126
241
  if (didWarnStateUpdateForUnmountedComponent[warningKey]) {
127
242
  return;
128
243
  }
129
- warning(false, '%s(...): Can only update a mounted or mounting component. ' + 'This usually means you called %s() on an unmounted component. ' + 'This is a no-op.\n\nPlease check the code for the %s component.', callerName, callerName, componentName);
244
+ 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);
130
245
  didWarnStateUpdateForUnmountedComponent[warningKey] = true;
131
246
  }
132
247
  }
@@ -199,12 +314,18 @@ var ReactNoopUpdateQueue = {
199
314
  }
200
315
  };
201
316
 
317
+ var emptyObject = {};
318
+ {
319
+ Object.freeze(emptyObject);
320
+ }
321
+
202
322
  /**
203
323
  * Base class helpers for the updating state of a component.
204
324
  */
205
325
  function Component(props, context, updater) {
206
326
  this.props = props;
207
327
  this.context = context;
328
+ // If a component has string refs, we will assign a different object later.
208
329
  this.refs = emptyObject;
209
330
  // We initialize the default updater but the real one gets injected by the
210
331
  // renderer.
@@ -295,6 +416,7 @@ ComponentDummy.prototype = Component.prototype;
295
416
  function PureComponent(props, context, updater) {
296
417
  this.props = props;
297
418
  this.context = context;
419
+ // If a component has string refs, we will assign a different object later.
298
420
  this.refs = emptyObject;
299
421
  this.updater = updater || ReactNoopUpdateQueue;
300
422
  }
@@ -308,7 +430,7 @@ pureComponentPrototype.isPureReactComponent = true;
308
430
  // an immutable object with a single mutable value
309
431
  function createRef() {
310
432
  var refObject = {
311
- value: null
433
+ current: null
312
434
  };
313
435
  {
314
436
  Object.seal(refObject);
@@ -327,9 +449,177 @@ var ReactCurrentOwner = {
327
449
  * @internal
328
450
  * @type {ReactComponent}
329
451
  */
330
- current: null
452
+ current: null,
453
+ currentDispatcher: null
454
+ };
455
+
456
+ var BEFORE_SLASH_RE = /^(.*)[\\\/]/;
457
+
458
+ var describeComponentFrame = function (name, source, ownerName) {
459
+ var sourceInfo = '';
460
+ if (source) {
461
+ var path = source.fileName;
462
+ var fileName = path.replace(BEFORE_SLASH_RE, '');
463
+ {
464
+ // In DEV, include code for a common special case:
465
+ // prefer "folder/index.js" instead of just "index.js".
466
+ if (/^index\./.test(fileName)) {
467
+ var match = path.match(BEFORE_SLASH_RE);
468
+ if (match) {
469
+ var pathBeforeSlash = match[1];
470
+ if (pathBeforeSlash) {
471
+ var folderName = pathBeforeSlash.replace(BEFORE_SLASH_RE, '');
472
+ fileName = folderName + '/' + fileName;
473
+ }
474
+ }
475
+ }
476
+ }
477
+ sourceInfo = ' (at ' + fileName + ':' + source.lineNumber + ')';
478
+ } else if (ownerName) {
479
+ sourceInfo = ' (created by ' + ownerName + ')';
480
+ }
481
+ return '\n in ' + (name || 'Unknown') + sourceInfo;
331
482
  };
332
483
 
484
+ var Resolved = 1;
485
+
486
+
487
+
488
+
489
+ function refineResolvedThenable(thenable) {
490
+ return thenable._reactStatus === Resolved ? thenable._reactResult : null;
491
+ }
492
+
493
+ function getComponentName(type) {
494
+ if (type == null) {
495
+ // Host root, text node or just invalid type.
496
+ return null;
497
+ }
498
+ {
499
+ if (typeof type.tag === 'number') {
500
+ warningWithoutStack$1(false, 'Received an unexpected object in getComponentName(). ' + 'This is likely a bug in React. Please file an issue.');
501
+ }
502
+ }
503
+ if (typeof type === 'function') {
504
+ return type.displayName || type.name || null;
505
+ }
506
+ if (typeof type === 'string') {
507
+ return type;
508
+ }
509
+ switch (type) {
510
+ case REACT_ASYNC_MODE_TYPE:
511
+ return 'AsyncMode';
512
+ case REACT_FRAGMENT_TYPE:
513
+ return 'Fragment';
514
+ case REACT_PORTAL_TYPE:
515
+ return 'Portal';
516
+ case REACT_PROFILER_TYPE:
517
+ return 'Profiler';
518
+ case REACT_STRICT_MODE_TYPE:
519
+ return 'StrictMode';
520
+ case REACT_PLACEHOLDER_TYPE:
521
+ return 'Placeholder';
522
+ }
523
+ if (typeof type === 'object') {
524
+ switch (type.$$typeof) {
525
+ case REACT_CONTEXT_TYPE:
526
+ return 'Context.Consumer';
527
+ case REACT_PROVIDER_TYPE:
528
+ return 'Context.Provider';
529
+ case REACT_FORWARD_REF_TYPE:
530
+ var renderFn = type.render;
531
+ var functionName = renderFn.displayName || renderFn.name || '';
532
+ return functionName !== '' ? 'ForwardRef(' + functionName + ')' : 'ForwardRef';
533
+ }
534
+ if (typeof type.then === 'function') {
535
+ var thenable = type;
536
+ var resolvedThenable = refineResolvedThenable(thenable);
537
+ if (resolvedThenable) {
538
+ return getComponentName(resolvedThenable);
539
+ }
540
+ }
541
+ }
542
+ return null;
543
+ }
544
+
545
+ var ReactDebugCurrentFrame = {};
546
+
547
+ var currentlyValidatingElement = null;
548
+
549
+ function setCurrentlyValidatingElement(element) {
550
+ {
551
+ currentlyValidatingElement = element;
552
+ }
553
+ }
554
+
555
+ {
556
+ // Stack implementation injected by the current renderer.
557
+ ReactDebugCurrentFrame.getCurrentStack = null;
558
+
559
+ ReactDebugCurrentFrame.getStackAddendum = function () {
560
+ var stack = '';
561
+
562
+ // Add an extra top frame while an element is being validated
563
+ if (currentlyValidatingElement) {
564
+ var name = getComponentName(currentlyValidatingElement.type);
565
+ var owner = currentlyValidatingElement._owner;
566
+ stack += describeComponentFrame(name, currentlyValidatingElement._source, owner && getComponentName(owner.type));
567
+ }
568
+
569
+ // Delegate to the injected renderer-specific implementation
570
+ var impl = ReactDebugCurrentFrame.getCurrentStack;
571
+ if (impl) {
572
+ stack += impl() || '';
573
+ }
574
+
575
+ return stack;
576
+ };
577
+ }
578
+
579
+ var ReactSharedInternals = {
580
+ ReactCurrentOwner: ReactCurrentOwner,
581
+ // Used by renderers to avoid bundling object-assign twice in UMD bundles:
582
+ assign: _assign
583
+ };
584
+
585
+ {
586
+ _assign(ReactSharedInternals, {
587
+ // These should not be included in production.
588
+ ReactDebugCurrentFrame: ReactDebugCurrentFrame,
589
+ // Shim for React DOM 16.0.0 which still destructured (but not used) this.
590
+ // TODO: remove in React 17.0.
591
+ ReactComponentTreeHook: {}
592
+ });
593
+ }
594
+
595
+ /**
596
+ * Similar to invariant but only logs a warning if the condition is not met.
597
+ * This can be used to log issues in development environments in critical
598
+ * paths. Removing the logging code for production environments will keep the
599
+ * same logic and follow the same code paths.
600
+ */
601
+
602
+ var warning = warningWithoutStack$1;
603
+
604
+ {
605
+ warning = function (condition, format) {
606
+ if (condition) {
607
+ return;
608
+ }
609
+ var ReactDebugCurrentFrame = ReactSharedInternals.ReactDebugCurrentFrame;
610
+ var stack = ReactDebugCurrentFrame.getStackAddendum();
611
+ // eslint-disable-next-line react-internal/warning-and-invariant-args
612
+
613
+ for (var _len = arguments.length, args = Array(_len > 2 ? _len - 2 : 0), _key = 2; _key < _len; _key++) {
614
+ args[_key - 2] = arguments[_key];
615
+ }
616
+
617
+ warningWithoutStack$1.apply(undefined, [false, format + '%s'].concat(args, [stack]));
618
+ };
619
+ }
620
+
621
+ var warning$1 = warning;
622
+
333
623
  var hasOwnProperty = Object.prototype.hasOwnProperty;
334
624
 
335
625
  var RESERVED_PROPS = {
@@ -370,7 +660,7 @@ function defineKeyPropWarningGetter(props, displayName) {
370
660
  var warnAboutAccessingKey = function () {
371
661
  if (!specialPropKeyWarningShown) {
372
662
  specialPropKeyWarningShown = true;
373
- 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);
663
+ 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);
374
664
  }
375
665
  };
376
666
  warnAboutAccessingKey.isReactWarning = true;
@@ -384,7 +674,7 @@ function defineRefPropWarningGetter(props, displayName) {
384
674
  var warnAboutAccessingRef = function () {
385
675
  if (!specialPropRefWarningShown) {
386
676
  specialPropRefWarningShown = true;
387
- 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);
677
+ 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);
388
678
  }
389
679
  };
390
680
  warnAboutAccessingRef.isReactWarning = true;
@@ -416,7 +706,7 @@ function defineRefPropWarningGetter(props, displayName) {
416
706
  */
417
707
  var ReactElement = function (type, key, ref, self, source, owner, props) {
418
708
  var element = {
419
- // This tag allow us to uniquely identify this as a React Element
709
+ // This tag allows us to uniquely identify this as a React Element
420
710
  $$typeof: REACT_ELEMENT_TYPE,
421
711
 
422
712
  // Built-in properties that belong on the element
@@ -532,14 +822,12 @@ function createElement(type, config, children) {
532
822
  }
533
823
  {
534
824
  if (key || ref) {
535
- if (typeof props.$$typeof === 'undefined' || props.$$typeof !== REACT_ELEMENT_TYPE) {
536
- var displayName = typeof type === 'function' ? type.displayName || type.name || 'Unknown' : type;
537
- if (key) {
538
- defineKeyPropWarningGetter(props, displayName);
539
- }
540
- if (ref) {
541
- defineRefPropWarningGetter(props, displayName);
542
- }
825
+ var displayName = typeof type === 'function' ? type.displayName || type.name || 'Unknown' : type;
826
+ if (key) {
827
+ defineKeyPropWarningGetter(props, displayName);
828
+ }
829
+ if (ref) {
830
+ defineRefPropWarningGetter(props, displayName);
543
831
  }
544
832
  }
545
833
  }
@@ -563,6 +851,8 @@ function cloneAndReplaceKey(oldElement, newKey) {
563
851
  * See https://reactjs.org/docs/react-api.html#cloneelement
564
852
  */
565
853
  function cloneElement(element, config, children) {
854
+ !!(element === null || element === undefined) ? invariant(false, 'React.cloneElement(...): The argument must be a React element, but you passed %s.', element) : void 0;
855
+
566
856
  var propName = void 0;
567
857
 
568
858
  // Original props are copied
@@ -628,28 +918,13 @@ function cloneElement(element, config, children) {
628
918
  * Verifies the object is a ReactElement.
629
919
  * See https://reactjs.org/docs/react-api.html#isvalidelement
630
920
  * @param {?object} object
631
- * @return {boolean} True if `object` is a valid component.
921
+ * @return {boolean} True if `object` is a ReactElement.
632
922
  * @final
633
923
  */
634
924
  function isValidElement(object) {
635
925
  return typeof object === 'object' && object !== null && object.$$typeof === REACT_ELEMENT_TYPE;
636
926
  }
637
927
 
638
- var ReactDebugCurrentFrame = {};
639
-
640
- {
641
- // Component that is being worked on
642
- ReactDebugCurrentFrame.getCurrentStack = null;
643
-
644
- ReactDebugCurrentFrame.getStackAddendum = function () {
645
- var impl = ReactDebugCurrentFrame.getCurrentStack;
646
- if (impl) {
647
- return impl();
648
- }
649
- return null;
650
- };
651
- }
652
-
653
928
  var SEPARATOR = '.';
654
929
  var SUBSEPARATOR = ':';
655
930
 
@@ -777,7 +1052,7 @@ function traverseAllChildrenImpl(children, nameSoFar, callback, traverseContext)
777
1052
  {
778
1053
  // Warn about using Maps as children
779
1054
  if (iteratorFn === children.entries) {
780
- warning(didWarnAboutMaps, '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());
1055
+ !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;
781
1056
  didWarnAboutMaps = true;
782
1057
  }
783
1058
  }
@@ -855,7 +1130,7 @@ function forEachSingleChild(bookKeeping, child, name) {
855
1130
  /**
856
1131
  * Iterates through children that are typically specified as `props.children`.
857
1132
  *
858
- * See https://reactjs.org/docs/react-api.html#react.children.foreach
1133
+ * See https://reactjs.org/docs/react-api.html#reactchildrenforeach
859
1134
  *
860
1135
  * The provided forEachFunc(child, index) will be called for each
861
1136
  * leaf child.
@@ -882,7 +1157,9 @@ function mapSingleChildIntoContext(bookKeeping, child, childKey) {
882
1157
 
883
1158
  var mappedChild = func.call(context, child, bookKeeping.count++);
884
1159
  if (Array.isArray(mappedChild)) {
885
- mapIntoWithKeyPrefixInternal(mappedChild, result, childKey, emptyFunction.thatReturnsArgument);
1160
+ mapIntoWithKeyPrefixInternal(mappedChild, result, childKey, function (c) {
1161
+ return c;
1162
+ });
886
1163
  } else if (mappedChild != null) {
887
1164
  if (isValidElement(mappedChild)) {
888
1165
  mappedChild = cloneAndReplaceKey(mappedChild,
@@ -907,7 +1184,7 @@ function mapIntoWithKeyPrefixInternal(children, array, prefix, func, context) {
907
1184
  /**
908
1185
  * Maps children that are typically specified as `props.children`.
909
1186
  *
910
- * See https://reactjs.org/docs/react-api.html#react.children.map
1187
+ * See https://reactjs.org/docs/react-api.html#reactchildrenmap
911
1188
  *
912
1189
  * The provided mapFunction(child, key, index) will be called for each
913
1190
  * leaf child.
@@ -930,24 +1207,28 @@ function mapChildren(children, func, context) {
930
1207
  * Count the number of children that are typically specified as
931
1208
  * `props.children`.
932
1209
  *
933
- * See https://reactjs.org/docs/react-api.html#react.children.count
1210
+ * See https://reactjs.org/docs/react-api.html#reactchildrencount
934
1211
  *
935
1212
  * @param {?*} children Children tree container.
936
1213
  * @return {number} The number of children.
937
1214
  */
938
- function countChildren(children, context) {
939
- return traverseAllChildren(children, emptyFunction.thatReturnsNull, null);
1215
+ function countChildren(children) {
1216
+ return traverseAllChildren(children, function () {
1217
+ return null;
1218
+ }, null);
940
1219
  }
941
1220
 
942
1221
  /**
943
1222
  * Flatten a children object (typically specified as `props.children`) and
944
1223
  * return an array with appropriately re-keyed children.
945
1224
  *
946
- * See https://reactjs.org/docs/react-api.html#react.children.toarray
1225
+ * See https://reactjs.org/docs/react-api.html#reactchildrentoarray
947
1226
  */
948
1227
  function toArray(children) {
949
1228
  var result = [];
950
- mapIntoWithKeyPrefixInternal(children, result, null, emptyFunction.thatReturnsArgument);
1229
+ mapIntoWithKeyPrefixInternal(children, result, null, function (child) {
1230
+ return child;
1231
+ });
951
1232
  return result;
952
1233
  }
953
1234
 
@@ -955,7 +1236,7 @@ function toArray(children) {
955
1236
  * Returns the first child in a collection of children and verifies that there
956
1237
  * is only one child in the collection.
957
1238
  *
958
- * See https://reactjs.org/docs/react-api.html#react.children.only
1239
+ * See https://reactjs.org/docs/react-api.html#reactchildrenonly
959
1240
  *
960
1241
  * The current implementation of this function assumes that a single child gets
961
1242
  * passed without a wrapper, but the purpose of this helper function is to
@@ -970,63 +1251,93 @@ function onlyChild(children) {
970
1251
  return children;
971
1252
  }
972
1253
 
1254
+ function readContext(context, observedBits) {
1255
+ var dispatcher = ReactCurrentOwner.currentDispatcher;
1256
+ !(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;
1257
+ return dispatcher.readContext(context, observedBits);
1258
+ }
1259
+
973
1260
  function createContext(defaultValue, calculateChangedBits) {
974
1261
  if (calculateChangedBits === undefined) {
975
1262
  calculateChangedBits = null;
976
1263
  } else {
977
1264
  {
978
- warning(calculateChangedBits === null || typeof calculateChangedBits === 'function', 'createContext: Expected the optional second argument to be a ' + 'function. Instead received: %s', calculateChangedBits);
1265
+ !(calculateChangedBits === null || typeof calculateChangedBits === 'function') ? warningWithoutStack$1(false, 'createContext: Expected the optional second argument to be a ' + 'function. Instead received: %s', calculateChangedBits) : void 0;
979
1266
  }
980
1267
  }
981
1268
 
982
1269
  var context = {
983
1270
  $$typeof: REACT_CONTEXT_TYPE,
984
- calculateChangedBits: calculateChangedBits,
985
- defaultValue: defaultValue,
986
- currentValue: defaultValue,
987
- changedBits: 0,
1271
+ _calculateChangedBits: calculateChangedBits,
1272
+ // As a workaround to support multiple concurrent renderers, we categorize
1273
+ // some renderers as primary and others as secondary. We only expect
1274
+ // there to be two concurrent renderers at most: React Native (primary) and
1275
+ // Fabric (secondary); React DOM (primary) and React ART (secondary).
1276
+ // Secondary renderers store their context values on separate fields.
1277
+ _currentValue: defaultValue,
1278
+ _currentValue2: defaultValue,
988
1279
  // These are circular
989
1280
  Provider: null,
990
- Consumer: null
1281
+ Consumer: null,
1282
+ unstable_read: null
991
1283
  };
992
1284
 
993
1285
  context.Provider = {
994
1286
  $$typeof: REACT_PROVIDER_TYPE,
995
- context: context
1287
+ _context: context
996
1288
  };
997
1289
  context.Consumer = context;
1290
+ context.unstable_read = readContext.bind(null, context);
998
1291
 
999
1292
  {
1000
1293
  context._currentRenderer = null;
1294
+ context._currentRenderer2 = null;
1001
1295
  }
1002
1296
 
1003
1297
  return context;
1004
1298
  }
1005
1299
 
1006
- var describeComponentFrame = function (name, source, ownerName) {
1007
- return '\n in ' + (name || 'Unknown') + (source ? ' (at ' + source.fileName.replace(/^.*[\\\/]/, '') + ':' + source.lineNumber + ')' : ownerName ? ' (created by ' + ownerName + ')' : '');
1008
- };
1300
+ function lazy(ctor) {
1301
+ var thenable = null;
1302
+ return {
1303
+ then: function (resolve, reject) {
1304
+ if (thenable === null) {
1305
+ // Lazily create thenable by wrapping in an extra thenable.
1306
+ thenable = ctor();
1307
+ ctor = null;
1308
+ }
1309
+ return thenable.then(resolve, reject);
1310
+ },
1009
1311
 
1010
- function getComponentName(fiber) {
1011
- var type = fiber.type;
1312
+ // React uses these fields to store the result.
1313
+ _reactStatus: -1,
1314
+ _reactResult: null
1315
+ };
1316
+ }
1012
1317
 
1013
- if (typeof type === 'function') {
1014
- return type.displayName || type.name;
1015
- }
1016
- if (typeof type === 'string') {
1017
- return type;
1018
- }
1019
- switch (type) {
1020
- case REACT_FRAGMENT_TYPE:
1021
- return 'ReactFragment';
1022
- case REACT_PORTAL_TYPE:
1023
- return 'ReactPortal';
1024
- case REACT_CALL_TYPE:
1025
- return 'ReactCall';
1026
- case REACT_RETURN_TYPE:
1027
- return 'ReactReturn';
1318
+ function forwardRef(render) {
1319
+ {
1320
+ if (typeof render !== 'function') {
1321
+ warningWithoutStack$1(false, 'forwardRef requires a render function but was given %s.', render === null ? 'null' : typeof render);
1322
+ } else {
1323
+ !(render.length === 2) ? warningWithoutStack$1(false, 'forwardRef render functions accept two parameters: props and ref. ' + 'Did you forget to use the ref parameter?') : void 0;
1324
+ }
1325
+
1326
+ if (render != null) {
1327
+ !(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;
1328
+ }
1028
1329
  }
1029
- return null;
1330
+
1331
+ return {
1332
+ $$typeof: REACT_FORWARD_REF_TYPE,
1333
+ render: render
1334
+ };
1335
+ }
1336
+
1337
+ function isValidElementType(type) {
1338
+ return typeof type === 'string' || typeof type === 'function' ||
1339
+ // Note: its typeof might be other than 'symbol' or 'number' if it's a polyfill.
1340
+ 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);
1030
1341
  }
1031
1342
 
1032
1343
  /**
@@ -1036,50 +1347,15 @@ function getComponentName(fiber) {
1036
1347
  * that support it.
1037
1348
  */
1038
1349
 
1039
- var currentlyValidatingElement = void 0;
1040
1350
  var propTypesMisspellWarningShown = void 0;
1041
1351
 
1042
- var getDisplayName = function () {};
1043
- var getStackAddendum = function () {};
1044
-
1045
- var VALID_FRAGMENT_PROPS = void 0;
1046
-
1047
1352
  {
1048
- currentlyValidatingElement = null;
1049
-
1050
1353
  propTypesMisspellWarningShown = false;
1051
-
1052
- getDisplayName = function (element) {
1053
- if (element == null) {
1054
- return '#empty';
1055
- } else if (typeof element === 'string' || typeof element === 'number') {
1056
- return '#text';
1057
- } else if (typeof element.type === 'string') {
1058
- return element.type;
1059
- } else if (element.type === REACT_FRAGMENT_TYPE) {
1060
- return 'React.Fragment';
1061
- } else {
1062
- return element.type.displayName || element.type.name || 'Unknown';
1063
- }
1064
- };
1065
-
1066
- getStackAddendum = function () {
1067
- var stack = '';
1068
- if (currentlyValidatingElement) {
1069
- var name = getDisplayName(currentlyValidatingElement);
1070
- var owner = currentlyValidatingElement._owner;
1071
- stack += describeComponentFrame(name, currentlyValidatingElement._source, owner && getComponentName(owner));
1072
- }
1073
- stack += ReactDebugCurrentFrame.getStackAddendum() || '';
1074
- return stack;
1075
- };
1076
-
1077
- VALID_FRAGMENT_PROPS = new Map([['children', true], ['key', true]]);
1078
1354
  }
1079
1355
 
1080
1356
  function getDeclarationErrorAddendum() {
1081
1357
  if (ReactCurrentOwner.current) {
1082
- var name = getComponentName(ReactCurrentOwner.current);
1358
+ var name = getComponentName(ReactCurrentOwner.current.type);
1083
1359
  if (name) {
1084
1360
  return '\n\nCheck the render method of `' + name + '`.';
1085
1361
  }
@@ -1145,14 +1421,14 @@ function validateExplicitKey(element, parentType) {
1145
1421
  var childOwner = '';
1146
1422
  if (element && element._owner && element._owner !== ReactCurrentOwner.current) {
1147
1423
  // Give the component that originally created this child.
1148
- childOwner = ' It was passed a child from ' + getComponentName(element._owner) + '.';
1424
+ childOwner = ' It was passed a child from ' + getComponentName(element._owner.type) + '.';
1149
1425
  }
1150
1426
 
1151
- currentlyValidatingElement = element;
1427
+ setCurrentlyValidatingElement(element);
1152
1428
  {
1153
- 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());
1429
+ 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);
1154
1430
  }
1155
- currentlyValidatingElement = null;
1431
+ setCurrentlyValidatingElement(null);
1156
1432
  }
1157
1433
 
1158
1434
  /**
@@ -1205,22 +1481,31 @@ function validateChildKeys(node, parentType) {
1205
1481
  * @param {ReactElement} element
1206
1482
  */
1207
1483
  function validatePropTypes(element) {
1208
- var componentClass = element.type;
1209
- if (typeof componentClass !== 'function') {
1484
+ var type = element.type;
1485
+ var name = void 0,
1486
+ propTypes = void 0;
1487
+ if (typeof type === 'function') {
1488
+ // Class or functional component
1489
+ name = type.displayName || type.name;
1490
+ propTypes = type.propTypes;
1491
+ } else if (typeof type === 'object' && type !== null && type.$$typeof === REACT_FORWARD_REF_TYPE) {
1492
+ // ForwardRef
1493
+ var functionName = type.render.displayName || type.render.name || '';
1494
+ name = functionName !== '' ? 'ForwardRef(' + functionName + ')' : 'ForwardRef';
1495
+ propTypes = type.propTypes;
1496
+ } else {
1210
1497
  return;
1211
1498
  }
1212
- var name = componentClass.displayName || componentClass.name;
1213
- var propTypes = componentClass.propTypes;
1214
1499
  if (propTypes) {
1215
- currentlyValidatingElement = element;
1216
- checkPropTypes(propTypes, element.props, 'prop', name, getStackAddendum);
1217
- currentlyValidatingElement = null;
1218
- } else if (componentClass.PropTypes !== undefined && !propTypesMisspellWarningShown) {
1500
+ setCurrentlyValidatingElement(element);
1501
+ checkPropTypes(propTypes, element.props, 'prop', name, ReactDebugCurrentFrame.getStackAddendum);
1502
+ setCurrentlyValidatingElement(null);
1503
+ } else if (type.PropTypes !== undefined && !propTypesMisspellWarningShown) {
1219
1504
  propTypesMisspellWarningShown = true;
1220
- warning(false, 'Component %s declared `PropTypes` instead of `propTypes`. Did you misspell the property assignment?', name || 'Unknown');
1505
+ warningWithoutStack$1(false, 'Component %s declared `PropTypes` instead of `propTypes`. Did you misspell the property assignment?', name || 'Unknown');
1221
1506
  }
1222
- if (typeof componentClass.getDefaultProps === 'function') {
1223
- warning(componentClass.getDefaultProps.isReactClassApproved, 'getDefaultProps is only used on classic React.createClass ' + 'definitions. Use a static property named `defaultProps` instead.');
1507
+ if (typeof type.getDefaultProps === 'function') {
1508
+ !type.getDefaultProps.isReactClassApproved ? warningWithoutStack$1(false, 'getDefaultProps is only used on classic React.createClass ' + 'definitions. Use a static property named `defaultProps` instead.') : void 0;
1224
1509
  }
1225
1510
  }
1226
1511
 
@@ -1229,28 +1514,26 @@ function validatePropTypes(element) {
1229
1514
  * @param {ReactElement} fragment
1230
1515
  */
1231
1516
  function validateFragmentProps(fragment) {
1232
- currentlyValidatingElement = fragment;
1517
+ setCurrentlyValidatingElement(fragment);
1233
1518
 
1234
1519
  var keys = Object.keys(fragment.props);
1235
1520
  for (var i = 0; i < keys.length; i++) {
1236
1521
  var key = keys[i];
1237
- if (!VALID_FRAGMENT_PROPS.has(key)) {
1238
- warning(false, 'Invalid prop `%s` supplied to `React.Fragment`. ' + 'React.Fragment can only have `key` and `children` props.%s', key, getStackAddendum());
1522
+ if (key !== 'children' && key !== 'key') {
1523
+ warning$1(false, 'Invalid prop `%s` supplied to `React.Fragment`. ' + 'React.Fragment can only have `key` and `children` props.', key);
1239
1524
  break;
1240
1525
  }
1241
1526
  }
1242
1527
 
1243
1528
  if (fragment.ref !== null) {
1244
- warning(false, 'Invalid attribute `ref` supplied to `React.Fragment`.%s', getStackAddendum());
1529
+ warning$1(false, 'Invalid attribute `ref` supplied to `React.Fragment`.');
1245
1530
  }
1246
1531
 
1247
- currentlyValidatingElement = null;
1532
+ setCurrentlyValidatingElement(null);
1248
1533
  }
1249
1534
 
1250
1535
  function createElementWithValidation(type, props, children) {
1251
- var validType = typeof type === 'string' || typeof type === 'function' ||
1252
- // Note: its typeof might be other than 'symbol' or 'number' if it's a polyfill.
1253
- type === REACT_FRAGMENT_TYPE || type === REACT_ASYNC_MODE_TYPE || type === REACT_STRICT_MODE_TYPE || type === REACT_LOADING_TYPE || type === REACT_TIMEOUT_TYPE || typeof type === 'object' && type !== null && (type.$$typeof === REACT_PROVIDER_TYPE || type.$$typeof === REACT_CONTEXT_TYPE);
1536
+ var validType = isValidElementType(type);
1254
1537
 
1255
1538
  // We warn in this case but don't throw. We expect the element creation to
1256
1539
  // succeed and there will likely be errors in render.
@@ -1267,18 +1550,19 @@ function createElementWithValidation(type, props, children) {
1267
1550
  info += getDeclarationErrorAddendum();
1268
1551
  }
1269
1552
 
1270
- info += getStackAddendum() || '';
1271
-
1272
1553
  var typeString = void 0;
1273
1554
  if (type === null) {
1274
1555
  typeString = 'null';
1275
1556
  } else if (Array.isArray(type)) {
1276
1557
  typeString = 'array';
1558
+ } else if (type !== undefined && type.$$typeof === REACT_ELEMENT_TYPE) {
1559
+ typeString = '<' + (getComponentName(type.type) || 'Unknown') + ' />';
1560
+ info = ' Did you accidentally export a JSX literal instead of a component?';
1277
1561
  } else {
1278
1562
  typeString = typeof type;
1279
1563
  }
1280
1564
 
1281
- 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);
1565
+ 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);
1282
1566
  }
1283
1567
 
1284
1568
  var element = createElement.apply(this, arguments);
@@ -1352,12 +1636,12 @@ var React = {
1352
1636
  PureComponent: PureComponent,
1353
1637
 
1354
1638
  createContext: createContext,
1639
+ forwardRef: forwardRef,
1355
1640
 
1356
1641
  Fragment: REACT_FRAGMENT_TYPE,
1357
1642
  StrictMode: REACT_STRICT_MODE_TYPE,
1358
1643
  unstable_AsyncMode: REACT_ASYNC_MODE_TYPE,
1359
- Loading: REACT_LOADING_TYPE,
1360
- Timeout: REACT_TIMEOUT_TYPE,
1644
+ unstable_Profiler: REACT_PROFILER_TYPE,
1361
1645
 
1362
1646
  createElement: createElementWithValidation,
1363
1647
  cloneElement: cloneElementWithValidation,
@@ -1366,21 +1650,12 @@ var React = {
1366
1650
 
1367
1651
  version: ReactVersion,
1368
1652
 
1369
- __SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED: {
1370
- ReactCurrentOwner: ReactCurrentOwner,
1371
- // Used by renderers to avoid bundling object-assign twice in UMD bundles:
1372
- assign: _assign
1373
- }
1653
+ __SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED: ReactSharedInternals
1374
1654
  };
1375
1655
 
1376
- {
1377
- _assign(React.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED, {
1378
- // These should not be included in production.
1379
- ReactDebugCurrentFrame: ReactDebugCurrentFrame,
1380
- // Shim for React DOM 16.0.0 which still destructured (but not used) this.
1381
- // TODO: remove in React 17.0.
1382
- ReactComponentTreeHook: {}
1383
- });
1656
+ if (enableSuspense) {
1657
+ React.Placeholder = REACT_PLACEHOLDER_TYPE;
1658
+ React.lazy = lazy;
1384
1659
  }
1385
1660
 
1386
1661
 
@@ -1393,7 +1668,7 @@ var React$3 = ( React$2 && React ) || React$2;
1393
1668
 
1394
1669
  // TODO: decide on the top-level export form.
1395
1670
  // This is hacky but makes it work with both Rollup and Jest.
1396
- var react = React$3['default'] ? React$3['default'] : React$3;
1671
+ var react = React$3.default || React$3;
1397
1672
 
1398
1673
  module.exports = react;
1399
1674
  })();