react 16.0.0 → 16.1.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,6 +1,6 @@
1
1
  # react
2
2
 
3
- An npm package to get you immediate access to [React](https://facebook.github.io/react/),
3
+ An npm package to get you immediate access to [React](https://reactjs.org/),
4
4
  without also requiring the JSX transformer. This is especially useful for cases where you
5
5
  want to [`browserify`](https://github.com/substack/node-browserify) your module using
6
6
  `React`.
@@ -1,4 +1,4 @@
1
- /** @license React v16.0.0
1
+ /** @license React v16.1.0
2
2
  * react.development.js
3
3
  *
4
4
  * Copyright (c) 2013-present, Facebook, Inc.
@@ -6,39 +6,111 @@
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.
8
8
  */
9
- 'use strict';
10
9
 
10
+ 'use strict';
11
11
 
12
12
  if (process.env.NODE_ENV !== "production") {
13
- (function() {
14
-
13
+ (function() {
15
14
  'use strict';
16
15
 
17
- var objectAssign$1 = require('object-assign');
18
- var require$$0 = require('fbjs/lib/warning');
19
- var emptyObject = require('fbjs/lib/emptyObject');
16
+ var _assign = require('object-assign');
20
17
  var invariant = require('fbjs/lib/invariant');
18
+ var emptyObject = require('fbjs/lib/emptyObject');
19
+ var warning = require('fbjs/lib/warning');
21
20
  var emptyFunction = require('fbjs/lib/emptyFunction');
22
21
  var checkPropTypes = require('prop-types/checkPropTypes');
23
22
 
23
+ // TODO: this is special because it gets imported during build.
24
+
25
+ var ReactVersion = '16.1.0';
26
+
24
27
  /**
25
- * Copyright (c) 2013-present, Facebook, Inc.
26
- *
27
- * This source code is licensed under the MIT license found in the
28
- * LICENSE file in the root directory of this source tree.
28
+ * WARNING: DO NOT manually require this module.
29
+ * This is a replacement for `invariant(...)` used by the error code system
30
+ * and will _only_ be required by the corresponding babel pass.
31
+ * It always throws.
32
+ */
33
+
34
+ // Exports React.Fragment
35
+ var enableReactFragment = false;
36
+ // Exports ReactDOM.createRoot
37
+
38
+
39
+
40
+ // Mutating mode (React DOM, React ART, React Native):
41
+
42
+ // Experimental noop mode (currently unused):
43
+
44
+ // Experimental persistent mode (CS):
45
+
46
+
47
+ // Only used in www builds.
48
+
49
+ /**
50
+ * Forked from fbjs/warning:
51
+ * https://github.com/facebook/fbjs/blob/e66ba20ad5be433eb54423f2b097d829324d9de6/packages/fbjs/src/__forks__/warning.js
29
52
  *
30
- * @providesModule reactProdInvariant
31
- *
53
+ * Only change is we use console.warn instead of console.error,
54
+ * and do nothing when 'console' is not supported.
55
+ * This really simplifies the code.
56
+ * ---
57
+ * Similar to invariant but only logs a warning if the condition is not met.
58
+ * This can be used to log issues in development environments in critical
59
+ * paths. Removing the logging code for production environments will keep the
60
+ * same logic and follow the same code paths.
32
61
  */
33
62
 
63
+ var lowPriorityWarning = function () {};
64
+
34
65
  {
35
- var warning = require$$0;
66
+ var printWarning = function (format) {
67
+ for (var _len = arguments.length, args = Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {
68
+ args[_key - 1] = arguments[_key];
69
+ }
70
+
71
+ var argIndex = 0;
72
+ var message = 'Warning: ' + format.replace(/%s/g, function () {
73
+ return args[argIndex++];
74
+ });
75
+ if (typeof console !== 'undefined') {
76
+ console.warn(message);
77
+ }
78
+ try {
79
+ // --- Welcome to debugging React ---
80
+ // This error was thrown as a convenience so that you can use this stack
81
+ // to find the callsite that caused this warning to fire.
82
+ throw new Error(message);
83
+ } catch (x) {}
84
+ };
85
+
86
+ lowPriorityWarning = function (condition, format) {
87
+ if (format === undefined) {
88
+ throw new Error('`warning(condition, format, ...args)` requires a warning ' + 'message argument');
89
+ }
90
+ if (!condition) {
91
+ for (var _len2 = arguments.length, args = Array(_len2 > 2 ? _len2 - 2 : 0), _key2 = 2; _key2 < _len2; _key2++) {
92
+ args[_key2 - 2] = arguments[_key2];
93
+ }
94
+
95
+ printWarning.apply(undefined, [format].concat(args));
96
+ }
97
+ };
36
98
  }
37
99
 
100
+ var lowPriorityWarning$1 = lowPriorityWarning;
101
+
102
+ var didWarnStateUpdateForUnmountedComponent = {};
103
+
38
104
  function warnNoop(publicInstance, callerName) {
39
105
  {
40
106
  var constructor = publicInstance.constructor;
41
- 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, constructor && (constructor.displayName || constructor.name) || 'ReactClass');
107
+ var componentName = constructor && (constructor.displayName || constructor.name) || 'ReactClass';
108
+ var warningKey = componentName + '.' + callerName;
109
+ if (didWarnStateUpdateForUnmountedComponent[warningKey]) {
110
+ return;
111
+ }
112
+ 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);
113
+ didWarnStateUpdateForUnmountedComponent[warningKey] = true;
42
114
  }
43
115
  }
44
116
 
@@ -110,83 +182,19 @@ var ReactNoopUpdateQueue = {
110
182
  }
111
183
  };
112
184
 
113
- var ReactNoopUpdateQueue_1 = ReactNoopUpdateQueue;
114
-
115
- /**
116
- * Copyright (c) 2014-present, Facebook, Inc.
117
- *
118
- * This source code is licensed under the MIT license found in the
119
- * LICENSE file in the root directory of this source tree.
120
- *
121
- * @providesModule lowPriorityWarning
122
- */
123
-
124
- /**
125
- * Forked from fbjs/warning:
126
- * https://github.com/facebook/fbjs/blob/e66ba20ad5be433eb54423f2b097d829324d9de6/packages/fbjs/src/__forks__/warning.js
127
- *
128
- * Only change is we use console.warn instead of console.error,
129
- * and do nothing when 'console' is not supported.
130
- * This really simplifies the code.
131
- * ---
132
- * Similar to invariant but only logs a warning if the condition is not met.
133
- * This can be used to log issues in development environments in critical
134
- * paths. Removing the logging code for production environments will keep the
135
- * same logic and follow the same code paths.
136
- */
137
-
138
- var lowPriorityWarning = function () {};
139
-
140
- {
141
- var printWarning = function (format) {
142
- for (var _len = arguments.length, args = Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {
143
- args[_key - 1] = arguments[_key];
144
- }
145
-
146
- var argIndex = 0;
147
- var message = 'Warning: ' + format.replace(/%s/g, function () {
148
- return args[argIndex++];
149
- });
150
- if (typeof console !== 'undefined') {
151
- console.warn(message);
152
- }
153
- try {
154
- // --- Welcome to debugging React ---
155
- // This error was thrown as a convenience so that you can use this stack
156
- // to find the callsite that caused this warning to fire.
157
- throw new Error(message);
158
- } catch (x) {}
159
- };
160
-
161
- lowPriorityWarning = function (condition, format) {
162
- if (format === undefined) {
163
- throw new Error('`warning(condition, format, ...args)` requires a warning ' + 'message argument');
164
- }
165
- if (!condition) {
166
- for (var _len2 = arguments.length, args = Array(_len2 > 2 ? _len2 - 2 : 0), _key2 = 2; _key2 < _len2; _key2++) {
167
- args[_key2 - 2] = arguments[_key2];
168
- }
169
-
170
- printWarning.apply(undefined, [format].concat(args));
171
- }
172
- };
173
- }
174
-
175
- var lowPriorityWarning_1 = lowPriorityWarning;
176
-
177
185
  /**
178
186
  * Base class helpers for the updating state of a component.
179
187
  */
180
- function ReactComponent(props, context, updater) {
188
+ function Component(props, context, updater) {
181
189
  this.props = props;
182
190
  this.context = context;
183
191
  this.refs = emptyObject;
184
192
  // We initialize the default updater but the real one gets injected by the
185
193
  // renderer.
186
- this.updater = updater || ReactNoopUpdateQueue_1;
194
+ this.updater = updater || ReactNoopUpdateQueue;
187
195
  }
188
196
 
189
- ReactComponent.prototype.isReactComponent = {};
197
+ Component.prototype.isReactComponent = {};
190
198
 
191
199
  /**
192
200
  * Sets a subset of the state. Always use this to mutate
@@ -213,7 +221,7 @@ ReactComponent.prototype.isReactComponent = {};
213
221
  * @final
214
222
  * @protected
215
223
  */
216
- ReactComponent.prototype.setState = function (partialState, callback) {
224
+ Component.prototype.setState = function (partialState, callback) {
217
225
  !(typeof partialState === 'object' || typeof partialState === 'function' || partialState == null) ? invariant(false, 'setState(...): takes an object of state variables to update or a function which returns an object of state variables.') : void 0;
218
226
  this.updater.enqueueSetState(this, partialState, callback, 'setState');
219
227
  };
@@ -232,7 +240,7 @@ ReactComponent.prototype.setState = function (partialState, callback) {
232
240
  * @final
233
241
  * @protected
234
242
  */
235
- ReactComponent.prototype.forceUpdate = function (callback) {
243
+ Component.prototype.forceUpdate = function (callback) {
236
244
  this.updater.enqueueForceUpdate(this, callback, 'forceUpdate');
237
245
  };
238
246
 
@@ -247,9 +255,9 @@ ReactComponent.prototype.forceUpdate = function (callback) {
247
255
  replaceState: ['replaceState', 'Refactor your code to use setState instead (see ' + 'https://github.com/facebook/react/issues/3236).']
248
256
  };
249
257
  var defineDeprecationWarning = function (methodName, info) {
250
- Object.defineProperty(ReactComponent.prototype, methodName, {
258
+ Object.defineProperty(Component.prototype, methodName, {
251
259
  get: function () {
252
- lowPriorityWarning_1(false, '%s(...) is deprecated in plain JavaScript React classes. %s', info[0], info[1]);
260
+ lowPriorityWarning$1(false, '%s(...) is deprecated in plain JavaScript React classes. %s', info[0], info[1]);
253
261
  return undefined;
254
262
  }
255
263
  });
@@ -264,59 +272,43 @@ ReactComponent.prototype.forceUpdate = function (callback) {
264
272
  /**
265
273
  * Base class helpers for the updating state of a component.
266
274
  */
267
- function ReactPureComponent(props, context, updater) {
268
- // Duplicated from ReactComponent.
275
+ function PureComponent(props, context, updater) {
276
+ // Duplicated from Component.
269
277
  this.props = props;
270
278
  this.context = context;
271
279
  this.refs = emptyObject;
272
280
  // We initialize the default updater but the real one gets injected by the
273
281
  // renderer.
274
- this.updater = updater || ReactNoopUpdateQueue_1;
282
+ this.updater = updater || ReactNoopUpdateQueue;
275
283
  }
276
284
 
277
285
  function ComponentDummy() {}
278
- ComponentDummy.prototype = ReactComponent.prototype;
279
- var pureComponentPrototype = ReactPureComponent.prototype = new ComponentDummy();
280
- pureComponentPrototype.constructor = ReactPureComponent;
286
+ ComponentDummy.prototype = Component.prototype;
287
+ var pureComponentPrototype = PureComponent.prototype = new ComponentDummy();
288
+ pureComponentPrototype.constructor = PureComponent;
281
289
  // Avoid an extra prototype jump for these methods.
282
- objectAssign$1(pureComponentPrototype, ReactComponent.prototype);
290
+ _assign(pureComponentPrototype, Component.prototype);
283
291
  pureComponentPrototype.isPureReactComponent = true;
284
292
 
285
- function ReactAsyncComponent(props, context, updater) {
286
- // Duplicated from ReactComponent.
293
+ function AsyncComponent(props, context, updater) {
294
+ // Duplicated from Component.
287
295
  this.props = props;
288
296
  this.context = context;
289
297
  this.refs = emptyObject;
290
298
  // We initialize the default updater but the real one gets injected by the
291
299
  // renderer.
292
- this.updater = updater || ReactNoopUpdateQueue_1;
300
+ this.updater = updater || ReactNoopUpdateQueue;
293
301
  }
294
302
 
295
- var asyncComponentPrototype = ReactAsyncComponent.prototype = new ComponentDummy();
296
- asyncComponentPrototype.constructor = ReactAsyncComponent;
303
+ var asyncComponentPrototype = AsyncComponent.prototype = new ComponentDummy();
304
+ asyncComponentPrototype.constructor = AsyncComponent;
297
305
  // Avoid an extra prototype jump for these methods.
298
- objectAssign$1(asyncComponentPrototype, ReactComponent.prototype);
306
+ _assign(asyncComponentPrototype, Component.prototype);
299
307
  asyncComponentPrototype.unstable_isAsyncReactComponent = true;
300
308
  asyncComponentPrototype.render = function () {
301
309
  return this.props.children;
302
310
  };
303
311
 
304
- var ReactBaseClasses = {
305
- Component: ReactComponent,
306
- PureComponent: ReactPureComponent,
307
- AsyncComponent: ReactAsyncComponent
308
- };
309
-
310
- /**
311
- * Copyright (c) 2013-present, Facebook, Inc.
312
- *
313
- * This source code is licensed under the MIT license found in the
314
- * LICENSE file in the root directory of this source tree.
315
- *
316
- * @providesModule ReactCurrentOwner
317
- *
318
- */
319
-
320
312
  /**
321
313
  * Keeps track of the current owner.
322
314
  *
@@ -331,14 +323,8 @@ var ReactCurrentOwner = {
331
323
  current: null
332
324
  };
333
325
 
334
- var ReactCurrentOwner_1 = ReactCurrentOwner;
335
-
336
326
  var hasOwnProperty = Object.prototype.hasOwnProperty;
337
327
 
338
- {
339
- var warning$2 = require$$0;
340
- }
341
-
342
328
  // The Symbol used to tag the ReactElement type. If there is no native Symbol
343
329
  // nor polyfill, then a plain number is used for performance.
344
330
  var REACT_ELEMENT_TYPE$1 = typeof Symbol === 'function' && Symbol['for'] && Symbol['for']('react.element') || 0xeac7;
@@ -381,7 +367,7 @@ function defineKeyPropWarningGetter(props, displayName) {
381
367
  var warnAboutAccessingKey = function () {
382
368
  if (!specialPropKeyWarningShown) {
383
369
  specialPropKeyWarningShown = true;
384
- warning$2(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);
370
+ 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);
385
371
  }
386
372
  };
387
373
  warnAboutAccessingKey.isReactWarning = true;
@@ -395,7 +381,7 @@ function defineRefPropWarningGetter(props, displayName) {
395
381
  var warnAboutAccessingRef = function () {
396
382
  if (!specialPropRefWarningShown) {
397
383
  specialPropRefWarningShown = true;
398
- warning$2(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);
384
+ 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);
399
385
  }
400
386
  };
401
387
  warnAboutAccessingRef.isReactWarning = true;
@@ -483,9 +469,9 @@ var ReactElement = function (type, key, ref, self, source, owner, props) {
483
469
 
484
470
  /**
485
471
  * Create and return a new ReactElement of the given type.
486
- * See https://facebook.github.io/react/docs/react-api.html#createelement
472
+ * See https://reactjs.org/docs/react-api.html#createelement
487
473
  */
488
- ReactElement.createElement = function (type, config, children) {
474
+ function createElement(type, config, children) {
489
475
  var propName;
490
476
 
491
477
  // Reserved names are extracted
@@ -554,39 +540,30 @@ ReactElement.createElement = function (type, config, children) {
554
540
  }
555
541
  }
556
542
  }
557
- return ReactElement(type, key, ref, self, source, ReactCurrentOwner_1.current, props);
558
- };
543
+ return ReactElement(type, key, ref, self, source, ReactCurrentOwner.current, props);
544
+ }
559
545
 
560
546
  /**
561
547
  * Return a function that produces ReactElements of a given type.
562
- * See https://facebook.github.io/react/docs/react-api.html#createfactory
548
+ * See https://reactjs.org/docs/react-api.html#createfactory
563
549
  */
564
- ReactElement.createFactory = function (type) {
565
- var factory = ReactElement.createElement.bind(null, type);
566
- // Expose the type on the factory and the prototype so that it can be
567
- // easily accessed on elements. E.g. `<Foo />.type === Foo`.
568
- // This should not be named `constructor` since this may not be the function
569
- // that created the element, and it may not even be a constructor.
570
- // Legacy hook TODO: Warn if this is accessed
571
- factory.type = type;
572
- return factory;
573
- };
574
550
 
575
- ReactElement.cloneAndReplaceKey = function (oldElement, newKey) {
551
+
552
+ function cloneAndReplaceKey(oldElement, newKey) {
576
553
  var newElement = ReactElement(oldElement.type, newKey, oldElement.ref, oldElement._self, oldElement._source, oldElement._owner, oldElement.props);
577
554
 
578
555
  return newElement;
579
- };
556
+ }
580
557
 
581
558
  /**
582
559
  * Clone and return a new ReactElement using element as the starting point.
583
- * See https://facebook.github.io/react/docs/react-api.html#cloneelement
560
+ * See https://reactjs.org/docs/react-api.html#cloneelement
584
561
  */
585
- ReactElement.cloneElement = function (element, config, children) {
562
+ function cloneElement(element, config, children) {
586
563
  var propName;
587
564
 
588
565
  // Original props are copied
589
- var props = objectAssign$1({}, element.props);
566
+ var props = _assign({}, element.props);
590
567
 
591
568
  // Reserved names are extracted
592
569
  var key = element.key;
@@ -605,7 +582,7 @@ ReactElement.cloneElement = function (element, config, children) {
605
582
  if (hasValidRef(config)) {
606
583
  // Silently steal the ref from the parent.
607
584
  ref = config.ref;
608
- owner = ReactCurrentOwner_1.current;
585
+ owner = ReactCurrentOwner.current;
609
586
  }
610
587
  if (hasValidKey(config)) {
611
588
  key = '' + config.key;
@@ -642,30 +619,18 @@ ReactElement.cloneElement = function (element, config, children) {
642
619
  }
643
620
 
644
621
  return ReactElement(element.type, key, ref, self, source, owner, props);
645
- };
622
+ }
646
623
 
647
624
  /**
648
625
  * Verifies the object is a ReactElement.
649
- * See https://facebook.github.io/react/docs/react-api.html#isvalidelement
626
+ * See https://reactjs.org/docs/react-api.html#isvalidelement
650
627
  * @param {?object} object
651
628
  * @return {boolean} True if `object` is a valid component.
652
629
  * @final
653
630
  */
654
- ReactElement.isValidElement = function (object) {
631
+ function isValidElement(object) {
655
632
  return typeof object === 'object' && object !== null && object.$$typeof === REACT_ELEMENT_TYPE$1;
656
- };
657
-
658
- var ReactElement_1 = ReactElement;
659
-
660
- /**
661
- * Copyright (c) 2013-present, Facebook, Inc.
662
- *
663
- * This source code is licensed under the MIT license found in the
664
- * LICENSE file in the root directory of this source tree.
665
- *
666
- * @providesModule ReactDebugCurrentFrame
667
- *
668
- */
633
+ }
669
634
 
670
635
  var ReactDebugCurrentFrame = {};
671
636
 
@@ -682,21 +647,12 @@ var ReactDebugCurrentFrame = {};
682
647
  };
683
648
  }
684
649
 
685
- var ReactDebugCurrentFrame_1 = ReactDebugCurrentFrame;
686
-
687
- {
688
- var warning$1 = require$$0;
689
-
690
- var _require = ReactDebugCurrentFrame_1,
691
- getStackAddendum = _require.getStackAddendum;
692
- }
693
-
694
650
  var ITERATOR_SYMBOL = typeof Symbol === 'function' && Symbol.iterator;
695
651
  var FAUX_ITERATOR_SYMBOL = '@@iterator'; // Before Symbol spec.
696
652
  // The Symbol used to tag the ReactElement type. If there is no native Symbol
697
653
  // nor polyfill, then a plain number is used for performance.
698
654
  var REACT_ELEMENT_TYPE = typeof Symbol === 'function' && Symbol['for'] && Symbol['for']('react.element') || 0xeac7;
699
-
655
+ var REACT_PORTAL_TYPE = typeof Symbol === 'function' && Symbol['for'] && Symbol['for']('react.portal') || 0xeaca;
700
656
  var SEPARATOR = '.';
701
657
  var SUBSEPARATOR = ':';
702
658
 
@@ -783,7 +739,7 @@ function traverseAllChildrenImpl(children, nameSoFar, callback, traverseContext)
783
739
  if (children === null || type === 'string' || type === 'number' ||
784
740
  // The following is inlined from ReactElement. This means we can optimize
785
741
  // some checks. React Fiber also inlines this logic for similar purposes.
786
- type === 'object' && children.$$typeof === REACT_ELEMENT_TYPE) {
742
+ type === 'object' && children.$$typeof === REACT_ELEMENT_TYPE || type === 'object' && children.$$typeof === REACT_PORTAL_TYPE) {
787
743
  callback(traverseContext, children,
788
744
  // If it's the only child, treat the name as if it was wrapped in an array
789
745
  // so that it's consistent if the number of children grows.
@@ -808,7 +764,7 @@ function traverseAllChildrenImpl(children, nameSoFar, callback, traverseContext)
808
764
  {
809
765
  // Warn about using Maps as children
810
766
  if (iteratorFn === children.entries) {
811
- warning$1(didWarnAboutMaps, 'Using Maps as children is unsupported and will likely yield ' + 'unexpected results. Convert it to a sequence/iterable of keyed ' + 'ReactElements instead.%s', getStackAddendum());
767
+ 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());
812
768
  didWarnAboutMaps = true;
813
769
  }
814
770
  }
@@ -824,7 +780,7 @@ function traverseAllChildrenImpl(children, nameSoFar, callback, traverseContext)
824
780
  } else if (type === 'object') {
825
781
  var addendum = '';
826
782
  {
827
- addendum = ' If you meant to render a collection of children, use an array ' + 'instead.' + getStackAddendum();
783
+ addendum = ' If you meant to render a collection of children, use an array ' + 'instead.' + ReactDebugCurrentFrame.getStackAddendum();
828
784
  }
829
785
  var childrenString = '' + children;
830
786
  invariant(false, 'Objects are not valid as a React child (found: %s).%s', childrenString === '[object Object]' ? 'object with keys {' + Object.keys(children).join(', ') + '}' : childrenString, addendum);
@@ -886,7 +842,7 @@ function forEachSingleChild(bookKeeping, child, name) {
886
842
  /**
887
843
  * Iterates through children that are typically specified as `props.children`.
888
844
  *
889
- * See https://facebook.github.io/react/docs/react-api.html#react.children.foreach
845
+ * See https://reactjs.org/docs/react-api.html#react.children.foreach
890
846
  *
891
847
  * The provided forEachFunc(child, index) will be called for each
892
848
  * leaf child.
@@ -915,8 +871,8 @@ function mapSingleChildIntoContext(bookKeeping, child, childKey) {
915
871
  if (Array.isArray(mappedChild)) {
916
872
  mapIntoWithKeyPrefixInternal(mappedChild, result, childKey, emptyFunction.thatReturnsArgument);
917
873
  } else if (mappedChild != null) {
918
- if (ReactElement_1.isValidElement(mappedChild)) {
919
- mappedChild = ReactElement_1.cloneAndReplaceKey(mappedChild,
874
+ if (isValidElement(mappedChild)) {
875
+ mappedChild = cloneAndReplaceKey(mappedChild,
920
876
  // Keep both the (mapped) and old keys if they differ, just as
921
877
  // traverseAllChildren used to do for objects as children
922
878
  keyPrefix + (mappedChild.key && (!child || child.key !== mappedChild.key) ? escapeUserProvidedKey(mappedChild.key) + '/' : '') + childKey);
@@ -938,7 +894,7 @@ function mapIntoWithKeyPrefixInternal(children, array, prefix, func, context) {
938
894
  /**
939
895
  * Maps children that are typically specified as `props.children`.
940
896
  *
941
- * See https://facebook.github.io/react/docs/react-api.html#react.children.map
897
+ * See https://reactjs.org/docs/react-api.html#react.children.map
942
898
  *
943
899
  * The provided mapFunction(child, key, index) will be called for each
944
900
  * leaf child.
@@ -961,7 +917,7 @@ function mapChildren(children, func, context) {
961
917
  * Count the number of children that are typically specified as
962
918
  * `props.children`.
963
919
  *
964
- * See https://facebook.github.io/react/docs/react-api.html#react.children.count
920
+ * See https://reactjs.org/docs/react-api.html#react.children.count
965
921
  *
966
922
  * @param {?*} children Children tree container.
967
923
  * @return {number} The number of children.
@@ -974,7 +930,7 @@ function countChildren(children, context) {
974
930
  * Flatten a children object (typically specified as `props.children`) and
975
931
  * return an array with appropriately re-keyed children.
976
932
  *
977
- * See https://facebook.github.io/react/docs/react-api.html#react.children.toarray
933
+ * See https://reactjs.org/docs/react-api.html#react.children.toarray
978
934
  */
979
935
  function toArray(children) {
980
936
  var result = [];
@@ -982,31 +938,11 @@ function toArray(children) {
982
938
  return result;
983
939
  }
984
940
 
985
- var ReactChildren = {
986
- forEach: forEachChildren,
987
- map: mapChildren,
988
- count: countChildren,
989
- toArray: toArray
990
- };
991
-
992
- var ReactChildren_1 = ReactChildren;
993
-
994
- /**
995
- * Copyright (c) 2013-present, Facebook, Inc.
996
- *
997
- * This source code is licensed under the MIT license found in the
998
- * LICENSE file in the root directory of this source tree.
999
- *
1000
- * @providesModule ReactVersion
1001
- */
1002
-
1003
- var ReactVersion = '16.0.0';
1004
-
1005
941
  /**
1006
942
  * Returns the first child in a collection of children and verifies that there
1007
943
  * is only one child in the collection.
1008
944
  *
1009
- * See https://facebook.github.io/react/docs/react-api.html#react.children.only
945
+ * See https://reactjs.org/docs/react-api.html#react.children.only
1010
946
  *
1011
947
  * The current implementation of this function assumes that a single child gets
1012
948
  * passed without a wrapper, but the purpose of this helper function is to
@@ -1017,67 +953,34 @@ var ReactVersion = '16.0.0';
1017
953
  * structure.
1018
954
  */
1019
955
  function onlyChild(children) {
1020
- !ReactElement_1.isValidElement(children) ? invariant(false, 'React.Children.only expected to receive a single React element child.') : void 0;
956
+ !isValidElement(children) ? invariant(false, 'React.Children.only expected to receive a single React element child.') : void 0;
1021
957
  return children;
1022
958
  }
1023
959
 
1024
- var onlyChild_1 = onlyChild;
1025
-
1026
- /**
1027
- * Copyright (c) 2016-present, Facebook, Inc.
1028
- *
1029
- * This source code is licensed under the MIT license found in the
1030
- * LICENSE file in the root directory of this source tree.
1031
- *
1032
- *
1033
- * @providesModule describeComponentFrame
1034
- */
1035
-
1036
- var describeComponentFrame$1 = function (name, source, ownerName) {
960
+ var describeComponentFrame = function (name, source, ownerName) {
1037
961
  return '\n in ' + (name || 'Unknown') + (source ? ' (at ' + source.fileName.replace(/^.*[\\\/]/, '') + ':' + source.lineNumber + ')' : ownerName ? ' (created by ' + ownerName + ')' : '');
1038
962
  };
1039
963
 
1040
- /**
1041
- * Copyright (c) 2013-present, Facebook, Inc.
1042
- *
1043
- * This source code is licensed under the MIT license found in the
1044
- * LICENSE file in the root directory of this source tree.
1045
- *
1046
- * @providesModule getComponentName
1047
- *
1048
- */
964
+ function getComponentName(fiber) {
965
+ var type = fiber.type;
1049
966
 
1050
- function getComponentName$1(instanceOrFiber) {
1051
- if (typeof instanceOrFiber.getName === 'function') {
1052
- // Stack reconciler
1053
- var instance = instanceOrFiber;
1054
- return instance.getName();
967
+ if (typeof type === 'string') {
968
+ return type;
1055
969
  }
1056
- if (typeof instanceOrFiber.tag === 'number') {
1057
- // Fiber reconciler
1058
- var fiber = instanceOrFiber;
1059
- var type = fiber.type;
1060
-
1061
- if (typeof type === 'string') {
1062
- return type;
1063
- }
1064
- if (typeof type === 'function') {
1065
- return type.displayName || type.name;
1066
- }
970
+ if (typeof type === 'function') {
971
+ return type.displayName || type.name;
1067
972
  }
1068
973
  return null;
1069
974
  }
1070
975
 
1071
- var getComponentName_1 = getComponentName$1;
976
+ /**
977
+ * ReactElementValidator provides a wrapper around a element factory
978
+ * which validates the props passed to the element. This is intended to be
979
+ * used only in DEV and could be replaced by a static type checker for languages
980
+ * that support it.
981
+ */
1072
982
 
1073
983
  {
1074
- var checkPropTypes$1 = checkPropTypes;
1075
- var lowPriorityWarning$1 = lowPriorityWarning_1;
1076
- var ReactDebugCurrentFrame$1 = ReactDebugCurrentFrame_1;
1077
- var warning$3 = require$$0;
1078
- var describeComponentFrame = describeComponentFrame$1;
1079
- var getComponentName = getComponentName_1;
1080
-
1081
984
  var currentlyValidatingElement = null;
1082
985
 
1083
986
  var getDisplayName = function (element) {
@@ -1087,29 +990,35 @@ var getComponentName_1 = getComponentName$1;
1087
990
  return '#text';
1088
991
  } else if (typeof element.type === 'string') {
1089
992
  return element.type;
993
+ } else if (element.type === REACT_FRAGMENT_TYPE$1) {
994
+ return 'React.Fragment';
1090
995
  } else {
1091
996
  return element.type.displayName || element.type.name || 'Unknown';
1092
997
  }
1093
998
  };
1094
999
 
1095
- var getStackAddendum$1 = function () {
1000
+ var getStackAddendum = function () {
1096
1001
  var stack = '';
1097
1002
  if (currentlyValidatingElement) {
1098
1003
  var name = getDisplayName(currentlyValidatingElement);
1099
1004
  var owner = currentlyValidatingElement._owner;
1100
1005
  stack += describeComponentFrame(name, currentlyValidatingElement._source, owner && getComponentName(owner));
1101
1006
  }
1102
- stack += ReactDebugCurrentFrame$1.getStackAddendum() || '';
1007
+ stack += ReactDebugCurrentFrame.getStackAddendum() || '';
1103
1008
  return stack;
1104
1009
  };
1010
+
1011
+ var REACT_FRAGMENT_TYPE$1 = typeof Symbol === 'function' && Symbol['for'] && Symbol['for']('react.fragment') || 0xeacb;
1012
+
1013
+ var VALID_FRAGMENT_PROPS = new Map([['children', true], ['key', true]]);
1105
1014
  }
1106
1015
 
1107
1016
  var ITERATOR_SYMBOL$1 = typeof Symbol === 'function' && Symbol.iterator;
1108
1017
  var FAUX_ITERATOR_SYMBOL$1 = '@@iterator'; // Before Symbol spec.
1109
1018
 
1110
1019
  function getDeclarationErrorAddendum() {
1111
- if (ReactCurrentOwner_1.current) {
1112
- var name = getComponentName(ReactCurrentOwner_1.current);
1020
+ if (ReactCurrentOwner.current) {
1021
+ var name = getComponentName(ReactCurrentOwner.current);
1113
1022
  if (name) {
1114
1023
  return '\n\nCheck the render method of `' + name + '`.';
1115
1024
  }
@@ -1173,14 +1082,14 @@ function validateExplicitKey(element, parentType) {
1173
1082
  // property, it may be the creator of the child that's responsible for
1174
1083
  // assigning it a key.
1175
1084
  var childOwner = '';
1176
- if (element && element._owner && element._owner !== ReactCurrentOwner_1.current) {
1085
+ if (element && element._owner && element._owner !== ReactCurrentOwner.current) {
1177
1086
  // Give the component that originally created this child.
1178
1087
  childOwner = ' It was passed a child from ' + getComponentName(element._owner) + '.';
1179
1088
  }
1180
1089
 
1181
1090
  currentlyValidatingElement = element;
1182
1091
  {
1183
- warning$3(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$1());
1092
+ 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());
1184
1093
  }
1185
1094
  currentlyValidatingElement = null;
1186
1095
  }
@@ -1201,11 +1110,11 @@ function validateChildKeys(node, parentType) {
1201
1110
  if (Array.isArray(node)) {
1202
1111
  for (var i = 0; i < node.length; i++) {
1203
1112
  var child = node[i];
1204
- if (ReactElement_1.isValidElement(child)) {
1113
+ if (isValidElement(child)) {
1205
1114
  validateExplicitKey(child, parentType);
1206
1115
  }
1207
1116
  }
1208
- } else if (ReactElement_1.isValidElement(node)) {
1117
+ } else if (isValidElement(node)) {
1209
1118
  // This element was passed in a valid location.
1210
1119
  if (node._store) {
1211
1120
  node._store.validated = true;
@@ -1219,7 +1128,7 @@ function validateChildKeys(node, parentType) {
1219
1128
  var iterator = iteratorFn.call(node);
1220
1129
  var step;
1221
1130
  while (!(step = iterator.next()).done) {
1222
- if (ReactElement_1.isValidElement(step.value)) {
1131
+ if (isValidElement(step.value)) {
1223
1132
  validateExplicitKey(step.value, parentType);
1224
1133
  }
1225
1134
  }
@@ -1244,455 +1153,191 @@ function validatePropTypes(element) {
1244
1153
 
1245
1154
  if (propTypes) {
1246
1155
  currentlyValidatingElement = element;
1247
- checkPropTypes$1(propTypes, element.props, 'prop', name, getStackAddendum$1);
1156
+ checkPropTypes(propTypes, element.props, 'prop', name, getStackAddendum);
1248
1157
  currentlyValidatingElement = null;
1249
1158
  }
1250
1159
  if (typeof componentClass.getDefaultProps === 'function') {
1251
- warning$3(componentClass.getDefaultProps.isReactClassApproved, 'getDefaultProps is only used on classic React.createClass ' + 'definitions. Use a static property named `defaultProps` instead.');
1160
+ warning(componentClass.getDefaultProps.isReactClassApproved, 'getDefaultProps is only used on classic React.createClass ' + 'definitions. Use a static property named `defaultProps` instead.');
1252
1161
  }
1253
1162
  }
1254
1163
 
1255
- var ReactElementValidator$1 = {
1256
- createElement: function (type, props, children) {
1257
- var validType = typeof type === 'string' || typeof type === 'function';
1258
- // We warn in this case but don't throw. We expect the element creation to
1259
- // succeed and there will likely be errors in render.
1260
- if (!validType) {
1261
- var info = '';
1262
- if (type === undefined || typeof type === 'object' && type !== null && Object.keys(type).length === 0) {
1263
- info += ' You likely forgot to export your component from the file ' + "it's defined in.";
1264
- }
1265
-
1266
- var sourceInfo = getSourceInfoErrorAddendum(props);
1267
- if (sourceInfo) {
1268
- info += sourceInfo;
1269
- } else {
1270
- info += getDeclarationErrorAddendum();
1271
- }
1272
-
1273
- info += ReactDebugCurrentFrame$1.getStackAddendum() || '';
1164
+ /**
1165
+ * Given a fragment, validate that it can only be provided with fragment props
1166
+ * @param {ReactElement} fragment
1167
+ */
1168
+ function validateFragmentProps(fragment) {
1169
+ currentlyValidatingElement = fragment;
1274
1170
 
1275
- warning$3(false, 'React.createElement: type is invalid -- expected a string (for ' + 'built-in components) or a class/function (for composite ' + 'components) but got: %s.%s', type == null ? type : typeof type, info);
1276
- }
1171
+ var _iteratorNormalCompletion = true;
1172
+ var _didIteratorError = false;
1173
+ var _iteratorError = undefined;
1277
1174
 
1278
- var element = ReactElement_1.createElement.apply(this, arguments);
1175
+ try {
1176
+ for (var _iterator = Object.keys(fragment.props)[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true) {
1177
+ var key = _step.value;
1279
1178
 
1280
- // The result can be nullish if a mock or a custom function is used.
1281
- // TODO: Drop this when these are no longer allowed as the type argument.
1282
- if (element == null) {
1283
- return element;
1179
+ if (!VALID_FRAGMENT_PROPS.has(key)) {
1180
+ warning(false, 'Invalid prop `%s` supplied to `React.Fragment`. ' + 'React.Fragment can only have `key` and `children` props.%s', key, getStackAddendum());
1181
+ break;
1182
+ }
1284
1183
  }
1285
-
1286
- // Skip key warning if the type isn't valid since our key validation logic
1287
- // doesn't expect a non-string/function type and can throw confusing errors.
1288
- // We don't want exception behavior to differ between dev and prod.
1289
- // (Rendering will throw with a helpful message and as soon as the type is
1290
- // fixed, the key warnings will appear.)
1291
- if (validType) {
1292
- for (var i = 2; i < arguments.length; i++) {
1293
- validateChildKeys(arguments[i], type);
1184
+ } catch (err) {
1185
+ _didIteratorError = true;
1186
+ _iteratorError = err;
1187
+ } finally {
1188
+ try {
1189
+ if (!_iteratorNormalCompletion && _iterator['return']) {
1190
+ _iterator['return']();
1191
+ }
1192
+ } finally {
1193
+ if (_didIteratorError) {
1194
+ throw _iteratorError;
1294
1195
  }
1295
1196
  }
1197
+ }
1296
1198
 
1297
- validatePropTypes(element);
1298
-
1299
- return element;
1300
- },
1199
+ if (fragment.ref !== null) {
1200
+ warning(false, 'Invalid attribute `ref` supplied to `React.Fragment`.%s', getStackAddendum());
1201
+ }
1301
1202
 
1302
- createFactory: function (type) {
1303
- var validatedFactory = ReactElementValidator$1.createElement.bind(null, type);
1304
- // Legacy hook TODO: Warn if this is accessed
1305
- validatedFactory.type = type;
1203
+ currentlyValidatingElement = null;
1204
+ }
1306
1205
 
1307
- {
1308
- Object.defineProperty(validatedFactory, 'type', {
1309
- enumerable: false,
1310
- get: function () {
1311
- lowPriorityWarning$1(false, 'Factory.type is deprecated. Access the class directly ' + 'before passing it to createFactory.');
1312
- Object.defineProperty(this, 'type', {
1313
- value: type
1314
- });
1315
- return type;
1316
- }
1317
- });
1206
+ function createElementWithValidation(type, props, children) {
1207
+ var validType = typeof type === 'string' || typeof type === 'function' || typeof type === 'symbol' || typeof type === 'number';
1208
+ // We warn in this case but don't throw. We expect the element creation to
1209
+ // succeed and there will likely be errors in render.
1210
+ if (!validType) {
1211
+ var info = '';
1212
+ if (type === undefined || typeof type === 'object' && type !== null && Object.keys(type).length === 0) {
1213
+ info += ' You likely forgot to export your component from the file ' + "it's defined in.";
1318
1214
  }
1319
1215
 
1320
- return validatedFactory;
1321
- },
1322
-
1323
- cloneElement: function (element, props, children) {
1324
- var newElement = ReactElement_1.cloneElement.apply(this, arguments);
1325
- for (var i = 2; i < arguments.length; i++) {
1326
- validateChildKeys(arguments[i], newElement.type);
1216
+ var sourceInfo = getSourceInfoErrorAddendum(props);
1217
+ if (sourceInfo) {
1218
+ info += sourceInfo;
1219
+ } else {
1220
+ info += getDeclarationErrorAddendum();
1327
1221
  }
1328
- validatePropTypes(newElement);
1329
- return newElement;
1330
- }
1331
- };
1332
1222
 
1333
- var ReactElementValidator_1 = ReactElementValidator$1;
1223
+ info += getStackAddendum() || '';
1334
1224
 
1335
- {
1336
- var warning$4 = require$$0;
1337
- }
1338
-
1339
- function isNative(fn) {
1340
- // Based on isNative() from Lodash
1341
- var funcToString = Function.prototype.toString;
1342
- var reIsNative = RegExp('^' + funcToString
1343
- // Take an example native function source for comparison
1344
- .call(Object.prototype.hasOwnProperty)
1345
- // Strip regex characters so we can use it for regex
1346
- .replace(/[\\^$.*+?()[\]{}|]/g, '\\$&')
1347
- // Remove hasOwnProperty from the template to make it generic
1348
- .replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g, '$1.*?') + '$');
1349
- try {
1350
- var source = funcToString.call(fn);
1351
- return reIsNative.test(source);
1352
- } catch (err) {
1353
- return false;
1225
+ 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', type == null ? type : typeof type, info);
1354
1226
  }
1355
- }
1356
-
1357
- var canUseCollections =
1358
- // Array.from
1359
- typeof Array.from === 'function' &&
1360
- // Map
1361
- typeof Map === 'function' && isNative(Map) &&
1362
- // Map.prototype.keys
1363
- Map.prototype != null && typeof Map.prototype.keys === 'function' && isNative(Map.prototype.keys) &&
1364
- // Set
1365
- typeof Set === 'function' && isNative(Set) &&
1366
- // Set.prototype.keys
1367
- Set.prototype != null && typeof Set.prototype.keys === 'function' && isNative(Set.prototype.keys);
1368
-
1369
- var setItem;
1370
- var getItem;
1371
- var removeItem;
1372
- var getItemIDs;
1373
- var addRoot;
1374
- var removeRoot;
1375
- var getRootIDs;
1376
-
1377
- if (canUseCollections) {
1378
- var itemMap = new Map();
1379
- var rootIDSet = new Set();
1380
-
1381
- setItem = function (id, item) {
1382
- itemMap.set(id, item);
1383
- };
1384
- getItem = function (id) {
1385
- return itemMap.get(id);
1386
- };
1387
- removeItem = function (id) {
1388
- itemMap['delete'](id);
1389
- };
1390
- getItemIDs = function () {
1391
- return Array.from(itemMap.keys());
1392
- };
1393
-
1394
- addRoot = function (id) {
1395
- rootIDSet.add(id);
1396
- };
1397
- removeRoot = function (id) {
1398
- rootIDSet['delete'](id);
1399
- };
1400
- getRootIDs = function () {
1401
- return Array.from(rootIDSet.keys());
1402
- };
1403
- } else {
1404
- var itemByKey = {};
1405
- var rootByKey = {};
1406
-
1407
- // Use non-numeric keys to prevent V8 performance issues:
1408
- // https://github.com/facebook/react/pull/7232
1409
- var getKeyFromID = function (id) {
1410
- return '.' + id;
1411
- };
1412
- var getIDFromKey = function (key) {
1413
- return parseInt(key.substr(1), 10);
1414
- };
1415
1227
 
1416
- setItem = function (id, item) {
1417
- var key = getKeyFromID(id);
1418
- itemByKey[key] = item;
1419
- };
1420
- getItem = function (id) {
1421
- var key = getKeyFromID(id);
1422
- return itemByKey[key];
1423
- };
1424
- removeItem = function (id) {
1425
- var key = getKeyFromID(id);
1426
- delete itemByKey[key];
1427
- };
1428
- getItemIDs = function () {
1429
- return Object.keys(itemByKey).map(getIDFromKey);
1430
- };
1431
-
1432
- addRoot = function (id) {
1433
- var key = getKeyFromID(id);
1434
- rootByKey[key] = true;
1435
- };
1436
- removeRoot = function (id) {
1437
- var key = getKeyFromID(id);
1438
- delete rootByKey[key];
1439
- };
1440
- getRootIDs = function () {
1441
- return Object.keys(rootByKey).map(getIDFromKey);
1442
- };
1443
- }
1228
+ var element = createElement.apply(this, arguments);
1444
1229
 
1445
- var unmountedIDs = [];
1446
-
1447
- function purgeDeep(id) {
1448
- var item = getItem(id);
1449
- if (item) {
1450
- var childIDs = item.childIDs;
1230
+ // The result can be nullish if a mock or a custom function is used.
1231
+ // TODO: Drop this when these are no longer allowed as the type argument.
1232
+ if (element == null) {
1233
+ return element;
1234
+ }
1451
1235
 
1452
- removeItem(id);
1453
- childIDs.forEach(purgeDeep);
1236
+ // Skip key warning if the type isn't valid since our key validation logic
1237
+ // doesn't expect a non-string/function type and can throw confusing errors.
1238
+ // We don't want exception behavior to differ between dev and prod.
1239
+ // (Rendering will throw with a helpful message and as soon as the type is
1240
+ // fixed, the key warnings will appear.)
1241
+ if (validType) {
1242
+ for (var i = 2; i < arguments.length; i++) {
1243
+ validateChildKeys(arguments[i], type);
1244
+ }
1454
1245
  }
1455
- }
1456
1246
 
1457
- function getDisplayName$1(element) {
1458
- if (element == null) {
1459
- return '#empty';
1460
- } else if (typeof element === 'string' || typeof element === 'number') {
1461
- return '#text';
1462
- } else if (typeof element.type === 'string') {
1463
- return element.type;
1247
+ if (typeof type === 'symbol' && type === REACT_FRAGMENT_TYPE$1) {
1248
+ validateFragmentProps(element);
1464
1249
  } else {
1465
- return element.type.displayName || element.type.name || 'Unknown';
1250
+ validatePropTypes(element);
1466
1251
  }
1467
- }
1468
1252
 
1469
- function describeID(id) {
1470
- var name = ReactComponentTreeHook.getDisplayName(id);
1471
- var element = ReactComponentTreeHook.getElement(id);
1472
- var ownerID = ReactComponentTreeHook.getOwnerID(id);
1473
- var ownerName = void 0;
1474
-
1475
- if (ownerID) {
1476
- ownerName = ReactComponentTreeHook.getDisplayName(ownerID);
1477
- }
1478
- warning$4(element, 'ReactComponentTreeHook: Missing React element for debugID %s when ' + 'building stack', id);
1479
- return describeComponentFrame$1(name || '', element && element._source, ownerName || '');
1253
+ return element;
1480
1254
  }
1481
1255
 
1482
- var ReactComponentTreeHook = {
1483
- onSetChildren: function (id, nextChildIDs) {
1484
- var item = getItem(id);
1485
- !item ? invariant(false, 'Item must have been set') : void 0;
1486
- item.childIDs = nextChildIDs;
1487
-
1488
- for (var i = 0; i < nextChildIDs.length; i++) {
1489
- var nextChildID = nextChildIDs[i];
1490
- var nextChild = getItem(nextChildID);
1491
- !nextChild ? invariant(false, 'Expected hook events to fire for the child before its parent includes it in onSetChildren().') : void 0;
1492
- !(nextChild.childIDs != null || typeof nextChild.element !== 'object' || nextChild.element == null) ? invariant(false, 'Expected onSetChildren() to fire for a container child before its parent includes it in onSetChildren().') : void 0;
1493
- !nextChild.isMounted ? invariant(false, 'Expected onMountComponent() to fire for the child before its parent includes it in onSetChildren().') : void 0;
1494
- if (nextChild.parentID == null) {
1495
- nextChild.parentID = id;
1496
- // TODO: This shouldn't be necessary but mounting a new root during in
1497
- // componentWillMount currently causes not-yet-mounted components to
1498
- // be purged from our tree data so their parent id is missing.
1499
- }
1500
- !(nextChild.parentID === id) ? invariant(false, 'Expected onBeforeMountComponent() parent and onSetChildren() to be consistent (%s has parents %s and %s).', nextChildID, nextChild.parentID, id) : void 0;
1501
- }
1502
- },
1503
- onBeforeMountComponent: function (id, element, parentID) {
1504
- var item = {
1505
- element: element,
1506
- parentID: parentID,
1507
- text: null,
1508
- childIDs: [],
1509
- isMounted: false,
1510
- updateCount: 0
1511
- };
1512
- setItem(id, item);
1513
- },
1514
- onBeforeUpdateComponent: function (id, element) {
1515
- var item = getItem(id);
1516
- if (!item || !item.isMounted) {
1517
- // We may end up here as a result of setState() in componentWillUnmount().
1518
- // In this case, ignore the element.
1519
- return;
1520
- }
1521
- item.element = element;
1522
- },
1523
- onMountComponent: function (id) {
1524
- var item = getItem(id);
1525
- !item ? invariant(false, 'Item must have been set') : void 0;
1526
- item.isMounted = true;
1527
- var isRoot = item.parentID === 0;
1528
- if (isRoot) {
1529
- addRoot(id);
1530
- }
1531
- },
1532
- onUpdateComponent: function (id) {
1533
- var item = getItem(id);
1534
- if (!item || !item.isMounted) {
1535
- // We may end up here as a result of setState() in componentWillUnmount().
1536
- // In this case, ignore the element.
1537
- return;
1538
- }
1539
- item.updateCount++;
1540
- },
1541
- onUnmountComponent: function (id) {
1542
- var item = getItem(id);
1543
- if (item) {
1544
- // We need to check if it exists.
1545
- // `item` might not exist if it is inside an error boundary, and a sibling
1546
- // error boundary child threw while mounting. Then this instance never
1547
- // got a chance to mount, but it still gets an unmounting event during
1548
- // the error boundary cleanup.
1549
- item.isMounted = false;
1550
- var isRoot = item.parentID === 0;
1551
- if (isRoot) {
1552
- removeRoot(id);
1553
- }
1554
- }
1555
- unmountedIDs.push(id);
1556
- },
1557
- purgeUnmountedComponents: function () {
1558
- if (ReactComponentTreeHook._preventPurging) {
1559
- // Should only be used for testing.
1560
- return;
1561
- }
1256
+ function createFactoryWithValidation(type) {
1257
+ var validatedFactory = createElementWithValidation.bind(null, type);
1258
+ // Legacy hook TODO: Warn if this is accessed
1259
+ validatedFactory.type = type;
1562
1260
 
1563
- for (var i = 0; i < unmountedIDs.length; i++) {
1564
- var id = unmountedIDs[i];
1565
- purgeDeep(id);
1566
- }
1567
- unmountedIDs.length = 0;
1568
- },
1569
- isMounted: function (id) {
1570
- var item = getItem(id);
1571
- return item ? item.isMounted : false;
1572
- },
1573
- getCurrentStackAddendum: function () {
1574
- var info = '';
1575
- var currentOwner = ReactCurrentOwner_1.current;
1576
- if (currentOwner) {
1577
- !(typeof currentOwner.tag !== 'number') ? invariant(false, 'Fiber owners should not show up in Stack stack traces.') : void 0;
1578
- if (typeof currentOwner._debugID === 'number') {
1579
- info += ReactComponentTreeHook.getStackAddendumByID(currentOwner._debugID);
1261
+ {
1262
+ Object.defineProperty(validatedFactory, 'type', {
1263
+ enumerable: false,
1264
+ get: function () {
1265
+ lowPriorityWarning$1(false, 'Factory.type is deprecated. Access the class directly ' + 'before passing it to createFactory.');
1266
+ Object.defineProperty(this, 'type', {
1267
+ value: type
1268
+ });
1269
+ return type;
1580
1270
  }
1581
- }
1582
- return info;
1583
- },
1584
- getStackAddendumByID: function (id) {
1585
- var info = '';
1586
- while (id) {
1587
- info += describeID(id);
1588
- id = ReactComponentTreeHook.getParentID(id);
1589
- }
1590
- return info;
1591
- },
1592
- getChildIDs: function (id) {
1593
- var item = getItem(id);
1594
- return item ? item.childIDs : [];
1595
- },
1596
- getDisplayName: function (id) {
1597
- var element = ReactComponentTreeHook.getElement(id);
1598
- if (!element) {
1599
- return null;
1600
- }
1601
- return getDisplayName$1(element);
1602
- },
1603
- getElement: function (id) {
1604
- var item = getItem(id);
1605
- return item ? item.element : null;
1606
- },
1607
- getOwnerID: function (id) {
1608
- var element = ReactComponentTreeHook.getElement(id);
1609
- if (!element || !element._owner) {
1610
- return null;
1611
- }
1612
- return element._owner._debugID;
1613
- },
1614
- getParentID: function (id) {
1615
- var item = getItem(id);
1616
- return item ? item.parentID : null;
1617
- },
1618
- getSource: function (id) {
1619
- var item = getItem(id);
1620
- var element = item ? item.element : null;
1621
- var source = element != null ? element._source : null;
1622
- return source;
1623
- },
1624
- getText: function (id) {
1625
- var element = ReactComponentTreeHook.getElement(id);
1626
- if (typeof element === 'string') {
1627
- return element;
1628
- } else if (typeof element === 'number') {
1629
- return '' + element;
1630
- } else {
1631
- return null;
1632
- }
1633
- },
1634
- getUpdateCount: function (id) {
1635
- var item = getItem(id);
1636
- return item ? item.updateCount : 0;
1637
- },
1638
-
1639
-
1640
- getRootIDs: getRootIDs,
1641
- getRegisteredIDs: getItemIDs
1642
- };
1643
-
1644
- var ReactComponentTreeHook_1 = ReactComponentTreeHook;
1271
+ });
1272
+ }
1645
1273
 
1646
- var createElement = ReactElement_1.createElement;
1647
- var createFactory = ReactElement_1.createFactory;
1648
- var cloneElement = ReactElement_1.cloneElement;
1274
+ return validatedFactory;
1275
+ }
1649
1276
 
1650
- {
1651
- var ReactElementValidator = ReactElementValidator_1;
1652
- createElement = ReactElementValidator.createElement;
1653
- createFactory = ReactElementValidator.createFactory;
1654
- cloneElement = ReactElementValidator.cloneElement;
1277
+ function cloneElementWithValidation(element, props, children) {
1278
+ var newElement = cloneElement.apply(this, arguments);
1279
+ for (var i = 2; i < arguments.length; i++) {
1280
+ validateChildKeys(arguments[i], newElement.type);
1281
+ }
1282
+ validatePropTypes(newElement);
1283
+ return newElement;
1655
1284
  }
1656
1285
 
1286
+ var REACT_FRAGMENT_TYPE = typeof Symbol === 'function' && Symbol['for'] && Symbol['for']('react.fragment') || 0xeacb;
1287
+
1657
1288
  var React = {
1658
1289
  Children: {
1659
- map: ReactChildren_1.map,
1660
- forEach: ReactChildren_1.forEach,
1661
- count: ReactChildren_1.count,
1662
- toArray: ReactChildren_1.toArray,
1663
- only: onlyChild_1
1290
+ map: mapChildren,
1291
+ forEach: forEachChildren,
1292
+ count: countChildren,
1293
+ toArray: toArray,
1294
+ only: onlyChild
1664
1295
  },
1665
1296
 
1666
- Component: ReactBaseClasses.Component,
1667
- PureComponent: ReactBaseClasses.PureComponent,
1668
- unstable_AsyncComponent: ReactBaseClasses.AsyncComponent,
1669
-
1670
- createElement: createElement,
1671
- cloneElement: cloneElement,
1672
- isValidElement: ReactElement_1.isValidElement,
1297
+ Component: Component,
1298
+ PureComponent: PureComponent,
1299
+ unstable_AsyncComponent: AsyncComponent,
1673
1300
 
1674
- createFactory: createFactory,
1301
+ createElement: createElementWithValidation,
1302
+ cloneElement: cloneElementWithValidation,
1303
+ createFactory: createFactoryWithValidation,
1304
+ isValidElement: isValidElement,
1675
1305
 
1676
1306
  version: ReactVersion,
1677
1307
 
1678
1308
  __SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED: {
1679
- ReactCurrentOwner: ReactCurrentOwner_1,
1309
+ ReactCurrentOwner: ReactCurrentOwner,
1680
1310
  // Used by renderers to avoid bundling object-assign twice in UMD bundles:
1681
- assign: objectAssign$1
1311
+ assign: _assign
1682
1312
  }
1683
1313
  };
1684
1314
 
1315
+ if (enableReactFragment) {
1316
+ React.Fragment = REACT_FRAGMENT_TYPE;
1317
+ }
1318
+
1685
1319
  {
1686
- objectAssign$1(React.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED, {
1320
+ _assign(React.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED, {
1687
1321
  // These should not be included in production.
1688
- ReactComponentTreeHook: ReactComponentTreeHook_1,
1689
- ReactDebugCurrentFrame: ReactDebugCurrentFrame_1
1322
+ ReactDebugCurrentFrame: ReactDebugCurrentFrame,
1323
+ // Shim for React DOM 16.0.0 which still destructured (but not used) this.
1324
+ // TODO: remove in React 17.0.
1325
+ ReactComponentTreeHook: {}
1690
1326
  });
1691
1327
  }
1692
1328
 
1693
- var ReactEntry = React;
1694
1329
 
1695
- module.exports = ReactEntry;
1696
1330
 
1697
- })();
1331
+ var React$2 = Object.freeze({
1332
+ default: React
1333
+ });
1334
+
1335
+ var React$3 = ( React$2 && React ) || React$2;
1336
+
1337
+ // TODO: decide on the top-level export form.
1338
+ // This is hacky but makes it work with both Rollup and Jest.
1339
+ var react = React$3['default'] ? React$3['default'] : React$3;
1340
+
1341
+ module.exports = react;
1342
+ })();
1698
1343
  }