react 16.0.0-rc.3 → 16.1.0-rc

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/LICENSE CHANGED
@@ -1,31 +1,21 @@
1
- BSD License
2
-
3
- For React software
1
+ MIT License
4
2
 
5
3
  Copyright (c) 2013-present, Facebook, Inc.
6
- All rights reserved.
7
-
8
- Redistribution and use in source and binary forms, with or without modification,
9
- are permitted provided that the following conditions are met:
10
-
11
- * Redistributions of source code must retain the above copyright notice, this
12
- list of conditions and the following disclaimer.
13
4
 
14
- * Redistributions in binary form must reproduce the above copyright notice,
15
- this list of conditions and the following disclaimer in the documentation
16
- and/or other materials provided with the distribution.
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
17
11
 
18
- * Neither the name Facebook nor the names of its contributors may be used to
19
- endorse or promote products derived from this software without specific
20
- prior written permission.
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
21
14
 
22
- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
23
- ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
24
- WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
25
- DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR
26
- ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
27
- (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
28
- LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
29
- ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
30
- (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
31
- SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
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,48 +1,116 @@
1
- /** @license React v16.0.0-rc.3
1
+ /** @license React v16.1.0-rc
2
2
  * react.development.js
3
3
  *
4
- * Copyright 2013-present, Facebook, Inc.
5
- * All rights reserved.
4
+ * Copyright (c) 2013-present, Facebook, Inc.
6
5
  *
7
- * This source code is licensed under the BSD-style license found in the
8
- * LICENSE file in the root directory of this source tree. An additional grant
9
- * of patent rights can be found in the PATENTS file in the same directory.
6
+ * This source code is licensed under the MIT license found in the
7
+ * LICENSE file in the root directory of this source tree.
10
8
  */
11
- 'use strict';
12
9
 
10
+ 'use strict';
13
11
 
14
12
  if (process.env.NODE_ENV !== "production") {
15
- (function() {
16
-
13
+ (function() {
17
14
  'use strict';
18
15
 
19
- var objectAssign$1 = require('object-assign');
20
- var require$$0 = require('fbjs/lib/warning');
21
- var emptyObject = require('fbjs/lib/emptyObject');
16
+ var _assign = require('object-assign');
22
17
  var invariant = require('fbjs/lib/invariant');
18
+ var emptyObject = require('fbjs/lib/emptyObject');
19
+ var warning = require('fbjs/lib/warning');
23
20
  var emptyFunction = require('fbjs/lib/emptyFunction');
24
21
  var checkPropTypes = require('prop-types/checkPropTypes');
25
22
 
23
+ // TODO: this is special because it gets imported during build.
24
+
25
+ var ReactVersion = '16.1.0-rc';
26
+
26
27
  /**
27
- * Copyright (c) 2013-present, Facebook, Inc.
28
- * All rights reserved.
29
- *
30
- * This source code is licensed under the BSD-style license found in the
31
- * LICENSE file in the root directory of this source tree. An additional grant
32
- * of patent rights can be found in the PATENTS file in the same directory.
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
33
52
  *
34
- * @providesModule reactProdInvariant
35
- *
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.
36
61
  */
37
62
 
63
+ var lowPriorityWarning = function () {};
64
+
38
65
  {
39
- 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
+ };
40
98
  }
41
99
 
100
+ var lowPriorityWarning$1 = lowPriorityWarning;
101
+
102
+ var didWarnStateUpdateForUnmountedComponent = {};
103
+
42
104
  function warnNoop(publicInstance, callerName) {
43
105
  {
44
106
  var constructor = publicInstance.constructor;
45
- 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;
46
114
  }
47
115
  }
48
116
 
@@ -114,85 +182,19 @@ var ReactNoopUpdateQueue = {
114
182
  }
115
183
  };
116
184
 
117
- var ReactNoopUpdateQueue_1 = ReactNoopUpdateQueue;
118
-
119
- /**
120
- * Copyright 2014-2015, Facebook, Inc.
121
- * All rights reserved.
122
- *
123
- * This source code is licensed under the BSD-style license found in the
124
- * LICENSE file in the root directory of this source tree. An additional grant
125
- * of patent rights can be found in the PATENTS file in the same directory.
126
- *
127
- * @providesModule lowPriorityWarning
128
- */
129
-
130
- /**
131
- * Forked from fbjs/warning:
132
- * https://github.com/facebook/fbjs/blob/e66ba20ad5be433eb54423f2b097d829324d9de6/packages/fbjs/src/__forks__/warning.js
133
- *
134
- * Only change is we use console.warn instead of console.error,
135
- * and do nothing when 'console' is not supported.
136
- * This really simplifies the code.
137
- * ---
138
- * Similar to invariant but only logs a warning if the condition is not met.
139
- * This can be used to log issues in development environments in critical
140
- * paths. Removing the logging code for production environments will keep the
141
- * same logic and follow the same code paths.
142
- */
143
-
144
- var lowPriorityWarning = function () {};
145
-
146
- {
147
- var printWarning = function (format) {
148
- for (var _len = arguments.length, args = Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {
149
- args[_key - 1] = arguments[_key];
150
- }
151
-
152
- var argIndex = 0;
153
- var message = 'Warning: ' + format.replace(/%s/g, function () {
154
- return args[argIndex++];
155
- });
156
- if (typeof console !== 'undefined') {
157
- console.warn(message);
158
- }
159
- try {
160
- // --- Welcome to debugging React ---
161
- // This error was thrown as a convenience so that you can use this stack
162
- // to find the callsite that caused this warning to fire.
163
- throw new Error(message);
164
- } catch (x) {}
165
- };
166
-
167
- lowPriorityWarning = function (condition, format) {
168
- if (format === undefined) {
169
- throw new Error('`warning(condition, format, ...args)` requires a warning ' + 'message argument');
170
- }
171
- if (!condition) {
172
- for (var _len2 = arguments.length, args = Array(_len2 > 2 ? _len2 - 2 : 0), _key2 = 2; _key2 < _len2; _key2++) {
173
- args[_key2 - 2] = arguments[_key2];
174
- }
175
-
176
- printWarning.apply(undefined, [format].concat(args));
177
- }
178
- };
179
- }
180
-
181
- var lowPriorityWarning_1 = lowPriorityWarning;
182
-
183
185
  /**
184
186
  * Base class helpers for the updating state of a component.
185
187
  */
186
- function ReactComponent(props, context, updater) {
188
+ function Component(props, context, updater) {
187
189
  this.props = props;
188
190
  this.context = context;
189
191
  this.refs = emptyObject;
190
192
  // We initialize the default updater but the real one gets injected by the
191
193
  // renderer.
192
- this.updater = updater || ReactNoopUpdateQueue_1;
194
+ this.updater = updater || ReactNoopUpdateQueue;
193
195
  }
194
196
 
195
- ReactComponent.prototype.isReactComponent = {};
197
+ Component.prototype.isReactComponent = {};
196
198
 
197
199
  /**
198
200
  * Sets a subset of the state. Always use this to mutate
@@ -219,7 +221,7 @@ ReactComponent.prototype.isReactComponent = {};
219
221
  * @final
220
222
  * @protected
221
223
  */
222
- ReactComponent.prototype.setState = function (partialState, callback) {
224
+ Component.prototype.setState = function (partialState, callback) {
223
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;
224
226
  this.updater.enqueueSetState(this, partialState, callback, 'setState');
225
227
  };
@@ -238,7 +240,7 @@ ReactComponent.prototype.setState = function (partialState, callback) {
238
240
  * @final
239
241
  * @protected
240
242
  */
241
- ReactComponent.prototype.forceUpdate = function (callback) {
243
+ Component.prototype.forceUpdate = function (callback) {
242
244
  this.updater.enqueueForceUpdate(this, callback, 'forceUpdate');
243
245
  };
244
246
 
@@ -253,9 +255,9 @@ ReactComponent.prototype.forceUpdate = function (callback) {
253
255
  replaceState: ['replaceState', 'Refactor your code to use setState instead (see ' + 'https://github.com/facebook/react/issues/3236).']
254
256
  };
255
257
  var defineDeprecationWarning = function (methodName, info) {
256
- Object.defineProperty(ReactComponent.prototype, methodName, {
258
+ Object.defineProperty(Component.prototype, methodName, {
257
259
  get: function () {
258
- 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]);
259
261
  return undefined;
260
262
  }
261
263
  });
@@ -270,61 +272,43 @@ ReactComponent.prototype.forceUpdate = function (callback) {
270
272
  /**
271
273
  * Base class helpers for the updating state of a component.
272
274
  */
273
- function ReactPureComponent(props, context, updater) {
274
- // Duplicated from ReactComponent.
275
+ function PureComponent(props, context, updater) {
276
+ // Duplicated from Component.
275
277
  this.props = props;
276
278
  this.context = context;
277
279
  this.refs = emptyObject;
278
280
  // We initialize the default updater but the real one gets injected by the
279
281
  // renderer.
280
- this.updater = updater || ReactNoopUpdateQueue_1;
282
+ this.updater = updater || ReactNoopUpdateQueue;
281
283
  }
282
284
 
283
285
  function ComponentDummy() {}
284
- ComponentDummy.prototype = ReactComponent.prototype;
285
- var pureComponentPrototype = ReactPureComponent.prototype = new ComponentDummy();
286
- pureComponentPrototype.constructor = ReactPureComponent;
286
+ ComponentDummy.prototype = Component.prototype;
287
+ var pureComponentPrototype = PureComponent.prototype = new ComponentDummy();
288
+ pureComponentPrototype.constructor = PureComponent;
287
289
  // Avoid an extra prototype jump for these methods.
288
- objectAssign$1(pureComponentPrototype, ReactComponent.prototype);
290
+ _assign(pureComponentPrototype, Component.prototype);
289
291
  pureComponentPrototype.isPureReactComponent = true;
290
292
 
291
- function ReactAsyncComponent(props, context, updater) {
292
- // Duplicated from ReactComponent.
293
+ function AsyncComponent(props, context, updater) {
294
+ // Duplicated from Component.
293
295
  this.props = props;
294
296
  this.context = context;
295
297
  this.refs = emptyObject;
296
298
  // We initialize the default updater but the real one gets injected by the
297
299
  // renderer.
298
- this.updater = updater || ReactNoopUpdateQueue_1;
300
+ this.updater = updater || ReactNoopUpdateQueue;
299
301
  }
300
302
 
301
- var asyncComponentPrototype = ReactAsyncComponent.prototype = new ComponentDummy();
302
- asyncComponentPrototype.constructor = ReactAsyncComponent;
303
+ var asyncComponentPrototype = AsyncComponent.prototype = new ComponentDummy();
304
+ asyncComponentPrototype.constructor = AsyncComponent;
303
305
  // Avoid an extra prototype jump for these methods.
304
- objectAssign$1(asyncComponentPrototype, ReactComponent.prototype);
306
+ _assign(asyncComponentPrototype, Component.prototype);
305
307
  asyncComponentPrototype.unstable_isAsyncReactComponent = true;
306
308
  asyncComponentPrototype.render = function () {
307
309
  return this.props.children;
308
310
  };
309
311
 
310
- var ReactBaseClasses = {
311
- Component: ReactComponent,
312
- PureComponent: ReactPureComponent,
313
- AsyncComponent: ReactAsyncComponent
314
- };
315
-
316
- /**
317
- * Copyright 2013-present, Facebook, Inc.
318
- * All rights reserved.
319
- *
320
- * This source code is licensed under the BSD-style license found in the
321
- * LICENSE file in the root directory of this source tree. An additional grant
322
- * of patent rights can be found in the PATENTS file in the same directory.
323
- *
324
- * @providesModule ReactCurrentOwner
325
- *
326
- */
327
-
328
312
  /**
329
313
  * Keeps track of the current owner.
330
314
  *
@@ -339,14 +323,8 @@ var ReactCurrentOwner = {
339
323
  current: null
340
324
  };
341
325
 
342
- var ReactCurrentOwner_1 = ReactCurrentOwner;
343
-
344
326
  var hasOwnProperty = Object.prototype.hasOwnProperty;
345
327
 
346
- {
347
- var warning$2 = require$$0;
348
- }
349
-
350
328
  // The Symbol used to tag the ReactElement type. If there is no native Symbol
351
329
  // nor polyfill, then a plain number is used for performance.
352
330
  var REACT_ELEMENT_TYPE$1 = typeof Symbol === 'function' && Symbol['for'] && Symbol['for']('react.element') || 0xeac7;
@@ -389,7 +367,7 @@ function defineKeyPropWarningGetter(props, displayName) {
389
367
  var warnAboutAccessingKey = function () {
390
368
  if (!specialPropKeyWarningShown) {
391
369
  specialPropKeyWarningShown = true;
392
- 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);
393
371
  }
394
372
  };
395
373
  warnAboutAccessingKey.isReactWarning = true;
@@ -403,7 +381,7 @@ function defineRefPropWarningGetter(props, displayName) {
403
381
  var warnAboutAccessingRef = function () {
404
382
  if (!specialPropRefWarningShown) {
405
383
  specialPropRefWarningShown = true;
406
- 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);
407
385
  }
408
386
  };
409
387
  warnAboutAccessingRef.isReactWarning = true;
@@ -491,9 +469,9 @@ var ReactElement = function (type, key, ref, self, source, owner, props) {
491
469
 
492
470
  /**
493
471
  * Create and return a new ReactElement of the given type.
494
- * See https://facebook.github.io/react/docs/react-api.html#createelement
472
+ * See https://reactjs.org/docs/react-api.html#createelement
495
473
  */
496
- ReactElement.createElement = function (type, config, children) {
474
+ function createElement(type, config, children) {
497
475
  var propName;
498
476
 
499
477
  // Reserved names are extracted
@@ -562,39 +540,30 @@ ReactElement.createElement = function (type, config, children) {
562
540
  }
563
541
  }
564
542
  }
565
- return ReactElement(type, key, ref, self, source, ReactCurrentOwner_1.current, props);
566
- };
543
+ return ReactElement(type, key, ref, self, source, ReactCurrentOwner.current, props);
544
+ }
567
545
 
568
546
  /**
569
547
  * Return a function that produces ReactElements of a given type.
570
- * See https://facebook.github.io/react/docs/react-api.html#createfactory
548
+ * See https://reactjs.org/docs/react-api.html#createfactory
571
549
  */
572
- ReactElement.createFactory = function (type) {
573
- var factory = ReactElement.createElement.bind(null, type);
574
- // Expose the type on the factory and the prototype so that it can be
575
- // easily accessed on elements. E.g. `<Foo />.type === Foo`.
576
- // This should not be named `constructor` since this may not be the function
577
- // that created the element, and it may not even be a constructor.
578
- // Legacy hook TODO: Warn if this is accessed
579
- factory.type = type;
580
- return factory;
581
- };
582
550
 
583
- ReactElement.cloneAndReplaceKey = function (oldElement, newKey) {
551
+
552
+ function cloneAndReplaceKey(oldElement, newKey) {
584
553
  var newElement = ReactElement(oldElement.type, newKey, oldElement.ref, oldElement._self, oldElement._source, oldElement._owner, oldElement.props);
585
554
 
586
555
  return newElement;
587
- };
556
+ }
588
557
 
589
558
  /**
590
559
  * Clone and return a new ReactElement using element as the starting point.
591
- * See https://facebook.github.io/react/docs/react-api.html#cloneelement
560
+ * See https://reactjs.org/docs/react-api.html#cloneelement
592
561
  */
593
- ReactElement.cloneElement = function (element, config, children) {
562
+ function cloneElement(element, config, children) {
594
563
  var propName;
595
564
 
596
565
  // Original props are copied
597
- var props = objectAssign$1({}, element.props);
566
+ var props = _assign({}, element.props);
598
567
 
599
568
  // Reserved names are extracted
600
569
  var key = element.key;
@@ -613,7 +582,7 @@ ReactElement.cloneElement = function (element, config, children) {
613
582
  if (hasValidRef(config)) {
614
583
  // Silently steal the ref from the parent.
615
584
  ref = config.ref;
616
- owner = ReactCurrentOwner_1.current;
585
+ owner = ReactCurrentOwner.current;
617
586
  }
618
587
  if (hasValidKey(config)) {
619
588
  key = '' + config.key;
@@ -650,32 +619,18 @@ ReactElement.cloneElement = function (element, config, children) {
650
619
  }
651
620
 
652
621
  return ReactElement(element.type, key, ref, self, source, owner, props);
653
- };
622
+ }
654
623
 
655
624
  /**
656
625
  * Verifies the object is a ReactElement.
657
- * See https://facebook.github.io/react/docs/react-api.html#isvalidelement
626
+ * See https://reactjs.org/docs/react-api.html#isvalidelement
658
627
  * @param {?object} object
659
628
  * @return {boolean} True if `object` is a valid component.
660
629
  * @final
661
630
  */
662
- ReactElement.isValidElement = function (object) {
631
+ function isValidElement(object) {
663
632
  return typeof object === 'object' && object !== null && object.$$typeof === REACT_ELEMENT_TYPE$1;
664
- };
665
-
666
- var ReactElement_1 = ReactElement;
667
-
668
- /**
669
- * Copyright 2013-present, Facebook, Inc.
670
- * All rights reserved.
671
- *
672
- * This source code is licensed under the BSD-style license found in the
673
- * LICENSE file in the root directory of this source tree. An additional grant
674
- * of patent rights can be found in the PATENTS file in the same directory.
675
- *
676
- * @providesModule ReactDebugCurrentFrame
677
- *
678
- */
633
+ }
679
634
 
680
635
  var ReactDebugCurrentFrame = {};
681
636
 
@@ -692,21 +647,12 @@ var ReactDebugCurrentFrame = {};
692
647
  };
693
648
  }
694
649
 
695
- var ReactDebugCurrentFrame_1 = ReactDebugCurrentFrame;
696
-
697
- {
698
- var warning$1 = require$$0;
699
-
700
- var _require = ReactDebugCurrentFrame_1,
701
- getStackAddendum = _require.getStackAddendum;
702
- }
703
-
704
650
  var ITERATOR_SYMBOL = typeof Symbol === 'function' && Symbol.iterator;
705
651
  var FAUX_ITERATOR_SYMBOL = '@@iterator'; // Before Symbol spec.
706
652
  // The Symbol used to tag the ReactElement type. If there is no native Symbol
707
653
  // nor polyfill, then a plain number is used for performance.
708
654
  var REACT_ELEMENT_TYPE = typeof Symbol === 'function' && Symbol['for'] && Symbol['for']('react.element') || 0xeac7;
709
-
655
+ var REACT_PORTAL_TYPE = typeof Symbol === 'function' && Symbol['for'] && Symbol['for']('react.portal') || 0xeaca;
710
656
  var SEPARATOR = '.';
711
657
  var SUBSEPARATOR = ':';
712
658
 
@@ -793,7 +739,7 @@ function traverseAllChildrenImpl(children, nameSoFar, callback, traverseContext)
793
739
  if (children === null || type === 'string' || type === 'number' ||
794
740
  // The following is inlined from ReactElement. This means we can optimize
795
741
  // some checks. React Fiber also inlines this logic for similar purposes.
796
- type === 'object' && children.$$typeof === REACT_ELEMENT_TYPE) {
742
+ type === 'object' && children.$$typeof === REACT_ELEMENT_TYPE || type === 'object' && children.$$typeof === REACT_PORTAL_TYPE) {
797
743
  callback(traverseContext, children,
798
744
  // If it's the only child, treat the name as if it was wrapped in an array
799
745
  // so that it's consistent if the number of children grows.
@@ -818,7 +764,7 @@ function traverseAllChildrenImpl(children, nameSoFar, callback, traverseContext)
818
764
  {
819
765
  // Warn about using Maps as children
820
766
  if (iteratorFn === children.entries) {
821
- 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());
822
768
  didWarnAboutMaps = true;
823
769
  }
824
770
  }
@@ -834,7 +780,7 @@ function traverseAllChildrenImpl(children, nameSoFar, callback, traverseContext)
834
780
  } else if (type === 'object') {
835
781
  var addendum = '';
836
782
  {
837
- 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();
838
784
  }
839
785
  var childrenString = '' + children;
840
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);
@@ -896,7 +842,7 @@ function forEachSingleChild(bookKeeping, child, name) {
896
842
  /**
897
843
  * Iterates through children that are typically specified as `props.children`.
898
844
  *
899
- * 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
900
846
  *
901
847
  * The provided forEachFunc(child, index) will be called for each
902
848
  * leaf child.
@@ -925,8 +871,8 @@ function mapSingleChildIntoContext(bookKeeping, child, childKey) {
925
871
  if (Array.isArray(mappedChild)) {
926
872
  mapIntoWithKeyPrefixInternal(mappedChild, result, childKey, emptyFunction.thatReturnsArgument);
927
873
  } else if (mappedChild != null) {
928
- if (ReactElement_1.isValidElement(mappedChild)) {
929
- mappedChild = ReactElement_1.cloneAndReplaceKey(mappedChild,
874
+ if (isValidElement(mappedChild)) {
875
+ mappedChild = cloneAndReplaceKey(mappedChild,
930
876
  // Keep both the (mapped) and old keys if they differ, just as
931
877
  // traverseAllChildren used to do for objects as children
932
878
  keyPrefix + (mappedChild.key && (!child || child.key !== mappedChild.key) ? escapeUserProvidedKey(mappedChild.key) + '/' : '') + childKey);
@@ -948,7 +894,7 @@ function mapIntoWithKeyPrefixInternal(children, array, prefix, func, context) {
948
894
  /**
949
895
  * Maps children that are typically specified as `props.children`.
950
896
  *
951
- * 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
952
898
  *
953
899
  * The provided mapFunction(child, key, index) will be called for each
954
900
  * leaf child.
@@ -971,7 +917,7 @@ function mapChildren(children, func, context) {
971
917
  * Count the number of children that are typically specified as
972
918
  * `props.children`.
973
919
  *
974
- * 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
975
921
  *
976
922
  * @param {?*} children Children tree container.
977
923
  * @return {number} The number of children.
@@ -984,7 +930,7 @@ function countChildren(children, context) {
984
930
  * Flatten a children object (typically specified as `props.children`) and
985
931
  * return an array with appropriately re-keyed children.
986
932
  *
987
- * 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
988
934
  */
989
935
  function toArray(children) {
990
936
  var result = [];
@@ -992,33 +938,11 @@ function toArray(children) {
992
938
  return result;
993
939
  }
994
940
 
995
- var ReactChildren = {
996
- forEach: forEachChildren,
997
- map: mapChildren,
998
- count: countChildren,
999
- toArray: toArray
1000
- };
1001
-
1002
- var ReactChildren_1 = ReactChildren;
1003
-
1004
- /**
1005
- * Copyright 2013-present, Facebook, Inc.
1006
- * All rights reserved.
1007
- *
1008
- * This source code is licensed under the BSD-style license found in the
1009
- * LICENSE file in the root directory of this source tree. An additional grant
1010
- * of patent rights can be found in the PATENTS file in the same directory.
1011
- *
1012
- * @providesModule ReactVersion
1013
- */
1014
-
1015
- var ReactVersion = '16.0.0-rc.3';
1016
-
1017
941
  /**
1018
942
  * Returns the first child in a collection of children and verifies that there
1019
943
  * is only one child in the collection.
1020
944
  *
1021
- * 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
1022
946
  *
1023
947
  * The current implementation of this function assumes that a single child gets
1024
948
  * passed without a wrapper, but the purpose of this helper function is to
@@ -1029,71 +953,34 @@ var ReactVersion = '16.0.0-rc.3';
1029
953
  * structure.
1030
954
  */
1031
955
  function onlyChild(children) {
1032
- !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;
1033
957
  return children;
1034
958
  }
1035
959
 
1036
- var onlyChild_1 = onlyChild;
1037
-
1038
- /**
1039
- * Copyright 2016-present, Facebook, Inc.
1040
- * All rights reserved.
1041
- *
1042
- * This source code is licensed under the BSD-style license found in the
1043
- * LICENSE file in the root directory of this source tree. An additional grant
1044
- * of patent rights can be found in the PATENTS file in the same directory.
1045
- *
1046
- *
1047
- * @providesModule describeComponentFrame
1048
- */
1049
-
1050
- var describeComponentFrame$1 = function (name, source, ownerName) {
960
+ var describeComponentFrame = function (name, source, ownerName) {
1051
961
  return '\n in ' + (name || 'Unknown') + (source ? ' (at ' + source.fileName.replace(/^.*[\\\/]/, '') + ':' + source.lineNumber + ')' : ownerName ? ' (created by ' + ownerName + ')' : '');
1052
962
  };
1053
963
 
1054
- /**
1055
- * Copyright 2013-present, Facebook, Inc.
1056
- * All rights reserved.
1057
- *
1058
- * This source code is licensed under the BSD-style license found in the
1059
- * LICENSE file in the root directory of this source tree. An additional grant
1060
- * of patent rights can be found in the PATENTS file in the same directory.
1061
- *
1062
- * @providesModule getComponentName
1063
- *
1064
- */
964
+ function getComponentName(fiber) {
965
+ var type = fiber.type;
1065
966
 
1066
- function getComponentName$1(instanceOrFiber) {
1067
- if (typeof instanceOrFiber.getName === 'function') {
1068
- // Stack reconciler
1069
- var instance = instanceOrFiber;
1070
- return instance.getName();
967
+ if (typeof type === 'string') {
968
+ return type;
1071
969
  }
1072
- if (typeof instanceOrFiber.tag === 'number') {
1073
- // Fiber reconciler
1074
- var fiber = instanceOrFiber;
1075
- var type = fiber.type;
1076
-
1077
- if (typeof type === 'string') {
1078
- return type;
1079
- }
1080
- if (typeof type === 'function') {
1081
- return type.displayName || type.name;
1082
- }
970
+ if (typeof type === 'function') {
971
+ return type.displayName || type.name;
1083
972
  }
1084
973
  return null;
1085
974
  }
1086
975
 
1087
- 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
+ */
1088
982
 
1089
983
  {
1090
- var checkPropTypes$1 = checkPropTypes;
1091
- var lowPriorityWarning$1 = lowPriorityWarning_1;
1092
- var ReactDebugCurrentFrame$1 = ReactDebugCurrentFrame_1;
1093
- var warning$3 = require$$0;
1094
- var describeComponentFrame = describeComponentFrame$1;
1095
- var getComponentName = getComponentName_1;
1096
-
1097
984
  var currentlyValidatingElement = null;
1098
985
 
1099
986
  var getDisplayName = function (element) {
@@ -1103,29 +990,35 @@ var getComponentName_1 = getComponentName$1;
1103
990
  return '#text';
1104
991
  } else if (typeof element.type === 'string') {
1105
992
  return element.type;
993
+ } else if (element.type === REACT_FRAGMENT_TYPE$1) {
994
+ return 'React.Fragment';
1106
995
  } else {
1107
996
  return element.type.displayName || element.type.name || 'Unknown';
1108
997
  }
1109
998
  };
1110
999
 
1111
- var getStackAddendum$1 = function () {
1000
+ var getStackAddendum = function () {
1112
1001
  var stack = '';
1113
1002
  if (currentlyValidatingElement) {
1114
1003
  var name = getDisplayName(currentlyValidatingElement);
1115
1004
  var owner = currentlyValidatingElement._owner;
1116
1005
  stack += describeComponentFrame(name, currentlyValidatingElement._source, owner && getComponentName(owner));
1117
1006
  }
1118
- stack += ReactDebugCurrentFrame$1.getStackAddendum() || '';
1007
+ stack += ReactDebugCurrentFrame.getStackAddendum() || '';
1119
1008
  return stack;
1120
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]]);
1121
1014
  }
1122
1015
 
1123
1016
  var ITERATOR_SYMBOL$1 = typeof Symbol === 'function' && Symbol.iterator;
1124
1017
  var FAUX_ITERATOR_SYMBOL$1 = '@@iterator'; // Before Symbol spec.
1125
1018
 
1126
1019
  function getDeclarationErrorAddendum() {
1127
- if (ReactCurrentOwner_1.current) {
1128
- var name = getComponentName(ReactCurrentOwner_1.current);
1020
+ if (ReactCurrentOwner.current) {
1021
+ var name = getComponentName(ReactCurrentOwner.current);
1129
1022
  if (name) {
1130
1023
  return '\n\nCheck the render method of `' + name + '`.';
1131
1024
  }
@@ -1189,14 +1082,14 @@ function validateExplicitKey(element, parentType) {
1189
1082
  // property, it may be the creator of the child that's responsible for
1190
1083
  // assigning it a key.
1191
1084
  var childOwner = '';
1192
- if (element && element._owner && element._owner !== ReactCurrentOwner_1.current) {
1085
+ if (element && element._owner && element._owner !== ReactCurrentOwner.current) {
1193
1086
  // Give the component that originally created this child.
1194
1087
  childOwner = ' It was passed a child from ' + getComponentName(element._owner) + '.';
1195
1088
  }
1196
1089
 
1197
1090
  currentlyValidatingElement = element;
1198
1091
  {
1199
- 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());
1200
1093
  }
1201
1094
  currentlyValidatingElement = null;
1202
1095
  }
@@ -1217,11 +1110,11 @@ function validateChildKeys(node, parentType) {
1217
1110
  if (Array.isArray(node)) {
1218
1111
  for (var i = 0; i < node.length; i++) {
1219
1112
  var child = node[i];
1220
- if (ReactElement_1.isValidElement(child)) {
1113
+ if (isValidElement(child)) {
1221
1114
  validateExplicitKey(child, parentType);
1222
1115
  }
1223
1116
  }
1224
- } else if (ReactElement_1.isValidElement(node)) {
1117
+ } else if (isValidElement(node)) {
1225
1118
  // This element was passed in a valid location.
1226
1119
  if (node._store) {
1227
1120
  node._store.validated = true;
@@ -1235,7 +1128,7 @@ function validateChildKeys(node, parentType) {
1235
1128
  var iterator = iteratorFn.call(node);
1236
1129
  var step;
1237
1130
  while (!(step = iterator.next()).done) {
1238
- if (ReactElement_1.isValidElement(step.value)) {
1131
+ if (isValidElement(step.value)) {
1239
1132
  validateExplicitKey(step.value, parentType);
1240
1133
  }
1241
1134
  }
@@ -1256,465 +1149,195 @@ function validatePropTypes(element) {
1256
1149
  return;
1257
1150
  }
1258
1151
  var name = componentClass.displayName || componentClass.name;
1259
-
1260
- // ReactNative `View.propTypes` have been deprecated in favor of `ViewPropTypes`.
1261
- // In their place a temporary getter has been added with a deprecated warning message.
1262
- // Avoid triggering that warning during validation using the temporary workaround,
1263
- // __propTypesSecretDontUseThesePlease.
1264
- // TODO (bvaughn) Revert this particular change any time after April 1 ReactNative tag.
1265
- var propTypes = typeof componentClass.__propTypesSecretDontUseThesePlease === 'object' ? componentClass.__propTypesSecretDontUseThesePlease : componentClass.propTypes;
1152
+ var propTypes = componentClass.propTypes;
1266
1153
 
1267
1154
  if (propTypes) {
1268
1155
  currentlyValidatingElement = element;
1269
- checkPropTypes$1(propTypes, element.props, 'prop', name, getStackAddendum$1);
1156
+ checkPropTypes(propTypes, element.props, 'prop', name, getStackAddendum);
1270
1157
  currentlyValidatingElement = null;
1271
1158
  }
1272
1159
  if (typeof componentClass.getDefaultProps === 'function') {
1273
- 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.');
1274
1161
  }
1275
1162
  }
1276
1163
 
1277
- var ReactElementValidator$1 = {
1278
- createElement: function (type, props, children) {
1279
- var validType = typeof type === 'string' || typeof type === 'function';
1280
- // We warn in this case but don't throw. We expect the element creation to
1281
- // succeed and there will likely be errors in render.
1282
- if (!validType) {
1283
- var info = '';
1284
- if (type === undefined || typeof type === 'object' && type !== null && Object.keys(type).length === 0) {
1285
- info += ' You likely forgot to export your component from the file ' + "it's defined in.";
1286
- }
1287
-
1288
- var sourceInfo = getSourceInfoErrorAddendum(props);
1289
- if (sourceInfo) {
1290
- info += sourceInfo;
1291
- } else {
1292
- info += getDeclarationErrorAddendum();
1293
- }
1294
-
1295
- 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;
1296
1170
 
1297
- 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);
1298
- }
1171
+ var _iteratorNormalCompletion = true;
1172
+ var _didIteratorError = false;
1173
+ var _iteratorError = undefined;
1299
1174
 
1300
- 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;
1301
1178
 
1302
- // The result can be nullish if a mock or a custom function is used.
1303
- // TODO: Drop this when these are no longer allowed as the type argument.
1304
- if (element == null) {
1305
- 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
+ }
1306
1183
  }
1307
-
1308
- // Skip key warning if the type isn't valid since our key validation logic
1309
- // doesn't expect a non-string/function type and can throw confusing errors.
1310
- // We don't want exception behavior to differ between dev and prod.
1311
- // (Rendering will throw with a helpful message and as soon as the type is
1312
- // fixed, the key warnings will appear.)
1313
- if (validType) {
1314
- for (var i = 2; i < arguments.length; i++) {
1315
- 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;
1316
1195
  }
1317
1196
  }
1197
+ }
1318
1198
 
1319
- validatePropTypes(element);
1320
-
1321
- return element;
1322
- },
1199
+ if (fragment.ref !== null) {
1200
+ warning(false, 'Invalid attribute `ref` supplied to `React.Fragment`.%s', getStackAddendum());
1201
+ }
1323
1202
 
1324
- createFactory: function (type) {
1325
- var validatedFactory = ReactElementValidator$1.createElement.bind(null, type);
1326
- // Legacy hook TODO: Warn if this is accessed
1327
- validatedFactory.type = type;
1203
+ currentlyValidatingElement = null;
1204
+ }
1328
1205
 
1329
- {
1330
- Object.defineProperty(validatedFactory, 'type', {
1331
- enumerable: false,
1332
- get: function () {
1333
- lowPriorityWarning$1(false, 'Factory.type is deprecated. Access the class directly ' + 'before passing it to createFactory.');
1334
- Object.defineProperty(this, 'type', {
1335
- value: type
1336
- });
1337
- return type;
1338
- }
1339
- });
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.";
1340
1214
  }
1341
1215
 
1342
- return validatedFactory;
1343
- },
1344
-
1345
- cloneElement: function (element, props, children) {
1346
- var newElement = ReactElement_1.cloneElement.apply(this, arguments);
1347
- for (var i = 2; i < arguments.length; i++) {
1348
- validateChildKeys(arguments[i], newElement.type);
1216
+ var sourceInfo = getSourceInfoErrorAddendum(props);
1217
+ if (sourceInfo) {
1218
+ info += sourceInfo;
1219
+ } else {
1220
+ info += getDeclarationErrorAddendum();
1349
1221
  }
1350
- validatePropTypes(newElement);
1351
- return newElement;
1352
- }
1353
- };
1354
1222
 
1355
- var ReactElementValidator_1 = ReactElementValidator$1;
1223
+ info += getStackAddendum() || '';
1356
1224
 
1357
- {
1358
- var warning$4 = require$$0;
1359
- }
1360
-
1361
- function isNative(fn) {
1362
- // Based on isNative() from Lodash
1363
- var funcToString = Function.prototype.toString;
1364
- var reIsNative = RegExp('^' + funcToString
1365
- // Take an example native function source for comparison
1366
- .call(Object.prototype.hasOwnProperty)
1367
- // Strip regex characters so we can use it for regex
1368
- .replace(/[\\^$.*+?()[\]{}|]/g, '\\$&')
1369
- // Remove hasOwnProperty from the template to make it generic
1370
- .replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g, '$1.*?') + '$');
1371
- try {
1372
- var source = funcToString.call(fn);
1373
- return reIsNative.test(source);
1374
- } catch (err) {
1375
- 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);
1376
1226
  }
1377
- }
1378
-
1379
- var canUseCollections =
1380
- // Array.from
1381
- typeof Array.from === 'function' &&
1382
- // Map
1383
- typeof Map === 'function' && isNative(Map) &&
1384
- // Map.prototype.keys
1385
- Map.prototype != null && typeof Map.prototype.keys === 'function' && isNative(Map.prototype.keys) &&
1386
- // Set
1387
- typeof Set === 'function' && isNative(Set) &&
1388
- // Set.prototype.keys
1389
- Set.prototype != null && typeof Set.prototype.keys === 'function' && isNative(Set.prototype.keys);
1390
-
1391
- var setItem;
1392
- var getItem;
1393
- var removeItem;
1394
- var getItemIDs;
1395
- var addRoot;
1396
- var removeRoot;
1397
- var getRootIDs;
1398
-
1399
- if (canUseCollections) {
1400
- var itemMap = new Map();
1401
- var rootIDSet = new Set();
1402
-
1403
- setItem = function (id, item) {
1404
- itemMap.set(id, item);
1405
- };
1406
- getItem = function (id) {
1407
- return itemMap.get(id);
1408
- };
1409
- removeItem = function (id) {
1410
- itemMap['delete'](id);
1411
- };
1412
- getItemIDs = function () {
1413
- return Array.from(itemMap.keys());
1414
- };
1415
-
1416
- addRoot = function (id) {
1417
- rootIDSet.add(id);
1418
- };
1419
- removeRoot = function (id) {
1420
- rootIDSet['delete'](id);
1421
- };
1422
- getRootIDs = function () {
1423
- return Array.from(rootIDSet.keys());
1424
- };
1425
- } else {
1426
- var itemByKey = {};
1427
- var rootByKey = {};
1428
-
1429
- // Use non-numeric keys to prevent V8 performance issues:
1430
- // https://github.com/facebook/react/pull/7232
1431
- var getKeyFromID = function (id) {
1432
- return '.' + id;
1433
- };
1434
- var getIDFromKey = function (key) {
1435
- return parseInt(key.substr(1), 10);
1436
- };
1437
-
1438
- setItem = function (id, item) {
1439
- var key = getKeyFromID(id);
1440
- itemByKey[key] = item;
1441
- };
1442
- getItem = function (id) {
1443
- var key = getKeyFromID(id);
1444
- return itemByKey[key];
1445
- };
1446
- removeItem = function (id) {
1447
- var key = getKeyFromID(id);
1448
- delete itemByKey[key];
1449
- };
1450
- getItemIDs = function () {
1451
- return Object.keys(itemByKey).map(getIDFromKey);
1452
- };
1453
-
1454
- addRoot = function (id) {
1455
- var key = getKeyFromID(id);
1456
- rootByKey[key] = true;
1457
- };
1458
- removeRoot = function (id) {
1459
- var key = getKeyFromID(id);
1460
- delete rootByKey[key];
1461
- };
1462
- getRootIDs = function () {
1463
- return Object.keys(rootByKey).map(getIDFromKey);
1464
- };
1465
- }
1466
1227
 
1467
- var unmountedIDs = [];
1228
+ var element = createElement.apply(this, arguments);
1468
1229
 
1469
- function purgeDeep(id) {
1470
- var item = getItem(id);
1471
- if (item) {
1472
- 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
+ }
1473
1235
 
1474
- removeItem(id);
1475
- 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
+ }
1476
1245
  }
1477
- }
1478
1246
 
1479
- function getDisplayName$1(element) {
1480
- if (element == null) {
1481
- return '#empty';
1482
- } else if (typeof element === 'string' || typeof element === 'number') {
1483
- return '#text';
1484
- } else if (typeof element.type === 'string') {
1485
- return element.type;
1247
+ if (typeof type === 'symbol' && type === REACT_FRAGMENT_TYPE$1) {
1248
+ validateFragmentProps(element);
1486
1249
  } else {
1487
- return element.type.displayName || element.type.name || 'Unknown';
1250
+ validatePropTypes(element);
1488
1251
  }
1489
- }
1490
-
1491
- function describeID(id) {
1492
- var name = ReactComponentTreeHook.getDisplayName(id);
1493
- var element = ReactComponentTreeHook.getElement(id);
1494
- var ownerID = ReactComponentTreeHook.getOwnerID(id);
1495
- var ownerName = void 0;
1496
1252
 
1497
- if (ownerID) {
1498
- ownerName = ReactComponentTreeHook.getDisplayName(ownerID);
1499
- }
1500
- warning$4(element, 'ReactComponentTreeHook: Missing React element for debugID %s when ' + 'building stack', id);
1501
- return describeComponentFrame$1(name || '', element && element._source, ownerName || '');
1253
+ return element;
1502
1254
  }
1503
1255
 
1504
- var ReactComponentTreeHook = {
1505
- onSetChildren: function (id, nextChildIDs) {
1506
- var item = getItem(id);
1507
- !item ? invariant(false, 'Item must have been set') : void 0;
1508
- item.childIDs = nextChildIDs;
1509
-
1510
- for (var i = 0; i < nextChildIDs.length; i++) {
1511
- var nextChildID = nextChildIDs[i];
1512
- var nextChild = getItem(nextChildID);
1513
- !nextChild ? invariant(false, 'Expected hook events to fire for the child before its parent includes it in onSetChildren().') : void 0;
1514
- !(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;
1515
- !nextChild.isMounted ? invariant(false, 'Expected onMountComponent() to fire for the child before its parent includes it in onSetChildren().') : void 0;
1516
- if (nextChild.parentID == null) {
1517
- nextChild.parentID = id;
1518
- // TODO: This shouldn't be necessary but mounting a new root during in
1519
- // componentWillMount currently causes not-yet-mounted components to
1520
- // be purged from our tree data so their parent id is missing.
1521
- }
1522
- !(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;
1523
- }
1524
- },
1525
- onBeforeMountComponent: function (id, element, parentID) {
1526
- var item = {
1527
- element: element,
1528
- parentID: parentID,
1529
- text: null,
1530
- childIDs: [],
1531
- isMounted: false,
1532
- updateCount: 0
1533
- };
1534
- setItem(id, item);
1535
- },
1536
- onBeforeUpdateComponent: function (id, element) {
1537
- var item = getItem(id);
1538
- if (!item || !item.isMounted) {
1539
- // We may end up here as a result of setState() in componentWillUnmount().
1540
- // In this case, ignore the element.
1541
- return;
1542
- }
1543
- item.element = element;
1544
- },
1545
- onMountComponent: function (id) {
1546
- var item = getItem(id);
1547
- !item ? invariant(false, 'Item must have been set') : void 0;
1548
- item.isMounted = true;
1549
- var isRoot = item.parentID === 0;
1550
- if (isRoot) {
1551
- addRoot(id);
1552
- }
1553
- },
1554
- onUpdateComponent: function (id) {
1555
- var item = getItem(id);
1556
- if (!item || !item.isMounted) {
1557
- // We may end up here as a result of setState() in componentWillUnmount().
1558
- // In this case, ignore the element.
1559
- return;
1560
- }
1561
- item.updateCount++;
1562
- },
1563
- onUnmountComponent: function (id) {
1564
- var item = getItem(id);
1565
- if (item) {
1566
- // We need to check if it exists.
1567
- // `item` might not exist if it is inside an error boundary, and a sibling
1568
- // error boundary child threw while mounting. Then this instance never
1569
- // got a chance to mount, but it still gets an unmounting event during
1570
- // the error boundary cleanup.
1571
- item.isMounted = false;
1572
- var isRoot = item.parentID === 0;
1573
- if (isRoot) {
1574
- removeRoot(id);
1575
- }
1576
- }
1577
- unmountedIDs.push(id);
1578
- },
1579
- purgeUnmountedComponents: function () {
1580
- if (ReactComponentTreeHook._preventPurging) {
1581
- // Should only be used for testing.
1582
- return;
1583
- }
1256
+ function createFactoryWithValidation(type) {
1257
+ var validatedFactory = createElementWithValidation.bind(null, type);
1258
+ // Legacy hook TODO: Warn if this is accessed
1259
+ validatedFactory.type = type;
1584
1260
 
1585
- for (var i = 0; i < unmountedIDs.length; i++) {
1586
- var id = unmountedIDs[i];
1587
- purgeDeep(id);
1588
- }
1589
- unmountedIDs.length = 0;
1590
- },
1591
- isMounted: function (id) {
1592
- var item = getItem(id);
1593
- return item ? item.isMounted : false;
1594
- },
1595
- getCurrentStackAddendum: function () {
1596
- var info = '';
1597
- var currentOwner = ReactCurrentOwner_1.current;
1598
- if (currentOwner) {
1599
- !(typeof currentOwner.tag !== 'number') ? invariant(false, 'Fiber owners should not show up in Stack stack traces.') : void 0;
1600
- if (typeof currentOwner._debugID === 'number') {
1601
- 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;
1602
1270
  }
1603
- }
1604
- return info;
1605
- },
1606
- getStackAddendumByID: function (id) {
1607
- var info = '';
1608
- while (id) {
1609
- info += describeID(id);
1610
- id = ReactComponentTreeHook.getParentID(id);
1611
- }
1612
- return info;
1613
- },
1614
- getChildIDs: function (id) {
1615
- var item = getItem(id);
1616
- return item ? item.childIDs : [];
1617
- },
1618
- getDisplayName: function (id) {
1619
- var element = ReactComponentTreeHook.getElement(id);
1620
- if (!element) {
1621
- return null;
1622
- }
1623
- return getDisplayName$1(element);
1624
- },
1625
- getElement: function (id) {
1626
- var item = getItem(id);
1627
- return item ? item.element : null;
1628
- },
1629
- getOwnerID: function (id) {
1630
- var element = ReactComponentTreeHook.getElement(id);
1631
- if (!element || !element._owner) {
1632
- return null;
1633
- }
1634
- return element._owner._debugID;
1635
- },
1636
- getParentID: function (id) {
1637
- var item = getItem(id);
1638
- return item ? item.parentID : null;
1639
- },
1640
- getSource: function (id) {
1641
- var item = getItem(id);
1642
- var element = item ? item.element : null;
1643
- var source = element != null ? element._source : null;
1644
- return source;
1645
- },
1646
- getText: function (id) {
1647
- var element = ReactComponentTreeHook.getElement(id);
1648
- if (typeof element === 'string') {
1649
- return element;
1650
- } else if (typeof element === 'number') {
1651
- return '' + element;
1652
- } else {
1653
- return null;
1654
- }
1655
- },
1656
- getUpdateCount: function (id) {
1657
- var item = getItem(id);
1658
- return item ? item.updateCount : 0;
1659
- },
1660
-
1661
-
1662
- getRootIDs: getRootIDs,
1663
- getRegisteredIDs: getItemIDs
1664
- };
1665
-
1666
- var ReactComponentTreeHook_1 = ReactComponentTreeHook;
1271
+ });
1272
+ }
1667
1273
 
1668
- var createElement = ReactElement_1.createElement;
1669
- var createFactory = ReactElement_1.createFactory;
1670
- var cloneElement = ReactElement_1.cloneElement;
1274
+ return validatedFactory;
1275
+ }
1671
1276
 
1672
- {
1673
- var ReactElementValidator = ReactElementValidator_1;
1674
- createElement = ReactElementValidator.createElement;
1675
- createFactory = ReactElementValidator.createFactory;
1676
- 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;
1677
1284
  }
1678
1285
 
1286
+ var REACT_FRAGMENT_TYPE = typeof Symbol === 'function' && Symbol['for'] && Symbol['for']('react.fragment') || 0xeacb;
1287
+
1679
1288
  var React = {
1680
1289
  Children: {
1681
- map: ReactChildren_1.map,
1682
- forEach: ReactChildren_1.forEach,
1683
- count: ReactChildren_1.count,
1684
- toArray: ReactChildren_1.toArray,
1685
- only: onlyChild_1
1290
+ map: mapChildren,
1291
+ forEach: forEachChildren,
1292
+ count: countChildren,
1293
+ toArray: toArray,
1294
+ only: onlyChild
1686
1295
  },
1687
1296
 
1688
- Component: ReactBaseClasses.Component,
1689
- PureComponent: ReactBaseClasses.PureComponent,
1690
- unstable_AsyncComponent: ReactBaseClasses.AsyncComponent,
1691
-
1692
- createElement: createElement,
1693
- cloneElement: cloneElement,
1694
- isValidElement: ReactElement_1.isValidElement,
1297
+ Component: Component,
1298
+ PureComponent: PureComponent,
1299
+ unstable_AsyncComponent: AsyncComponent,
1695
1300
 
1696
- createFactory: createFactory,
1301
+ createElement: createElementWithValidation,
1302
+ cloneElement: cloneElementWithValidation,
1303
+ createFactory: createFactoryWithValidation,
1304
+ isValidElement: isValidElement,
1697
1305
 
1698
1306
  version: ReactVersion,
1699
1307
 
1700
1308
  __SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED: {
1701
- ReactCurrentOwner: ReactCurrentOwner_1,
1309
+ ReactCurrentOwner: ReactCurrentOwner,
1702
1310
  // Used by renderers to avoid bundling object-assign twice in UMD bundles:
1703
- assign: objectAssign$1
1311
+ assign: _assign
1704
1312
  }
1705
1313
  };
1706
1314
 
1315
+ if (enableReactFragment) {
1316
+ React.Fragment = REACT_FRAGMENT_TYPE;
1317
+ }
1318
+
1707
1319
  {
1708
- 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, {
1709
1321
  // These should not be included in production.
1710
- ReactComponentTreeHook: ReactComponentTreeHook_1,
1711
- 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: {}
1712
1326
  });
1713
1327
  }
1714
1328
 
1715
- var ReactEntry = React;
1716
1329
 
1717
- module.exports = ReactEntry;
1718
1330
 
1719
- })();
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
+ })();
1720
1343
  }