react 16.9.0-alpha.0 → 16.9.0-rc.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/build-info.json +5 -5
- package/cjs/react.development.js +332 -93
- package/cjs/react.production.min.js +17 -16
- package/package.json +2 -3
- package/umd/react.development.js +2739 -2253
- package/umd/react.production.min.js +27 -25
- package/umd/react.profiling.min.js +31 -29
package/build-info.json
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
{
|
|
2
|
-
"branch": "
|
|
3
|
-
"buildNumber": "
|
|
4
|
-
"checksum": "
|
|
5
|
-
"commit": "
|
|
2
|
+
"branch": "master",
|
|
3
|
+
"buildNumber": "33869",
|
|
4
|
+
"checksum": "2fe1c5c",
|
|
5
|
+
"commit": "a1dbb852c",
|
|
6
6
|
"environment": "ci",
|
|
7
|
-
"reactVersion": "16.8.6-canary-
|
|
7
|
+
"reactVersion": "16.8.6-canary-a1dbb852c"
|
|
8
8
|
}
|
package/cjs/react.development.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/** @license React v16.9.0-
|
|
1
|
+
/** @license React v16.9.0-rc.0
|
|
2
2
|
* react.development.js
|
|
3
3
|
*
|
|
4
4
|
* Copyright (c) Facebook, Inc. and its affiliates.
|
|
@@ -20,7 +20,7 @@ var checkPropTypes = require('prop-types/checkPropTypes');
|
|
|
20
20
|
|
|
21
21
|
// TODO: this is special because it gets imported during build.
|
|
22
22
|
|
|
23
|
-
var ReactVersion = '16.9.0-
|
|
23
|
+
var ReactVersion = '16.9.0-rc.0';
|
|
24
24
|
|
|
25
25
|
// The Symbol used to tag the ReactElement-like types. If there is no native Symbol
|
|
26
26
|
// nor polyfill, then a plain number is used for performance.
|
|
@@ -33,17 +33,17 @@ var REACT_STRICT_MODE_TYPE = hasSymbol ? Symbol.for('react.strict_mode') : 0xeac
|
|
|
33
33
|
var REACT_PROFILER_TYPE = hasSymbol ? Symbol.for('react.profiler') : 0xead2;
|
|
34
34
|
var REACT_PROVIDER_TYPE = hasSymbol ? Symbol.for('react.provider') : 0xeacd;
|
|
35
35
|
var REACT_CONTEXT_TYPE = hasSymbol ? Symbol.for('react.context') : 0xeace;
|
|
36
|
+
// TODO: We don't use AsyncMode or ConcurrentMode anymore. They were temporary
|
|
37
|
+
// (unstable) APIs that have been removed. Can we remove the symbols?
|
|
36
38
|
|
|
37
39
|
var REACT_CONCURRENT_MODE_TYPE = hasSymbol ? Symbol.for('react.concurrent_mode') : 0xeacf;
|
|
38
40
|
var REACT_FORWARD_REF_TYPE = hasSymbol ? Symbol.for('react.forward_ref') : 0xead0;
|
|
39
41
|
var REACT_SUSPENSE_TYPE = hasSymbol ? Symbol.for('react.suspense') : 0xead1;
|
|
42
|
+
var REACT_SUSPENSE_LIST_TYPE = hasSymbol ? Symbol.for('react.suspense_list') : 0xead8;
|
|
40
43
|
var REACT_MEMO_TYPE = hasSymbol ? Symbol.for('react.memo') : 0xead3;
|
|
41
44
|
var REACT_LAZY_TYPE = hasSymbol ? Symbol.for('react.lazy') : 0xead4;
|
|
42
|
-
var
|
|
43
|
-
var
|
|
44
|
-
|
|
45
|
-
// React event targets
|
|
46
|
-
var REACT_EVENT_TARGET_TOUCH_HIT = hasSymbol ? Symbol.for('react.event_target.touch_hit') : 0xead7;
|
|
45
|
+
var REACT_FUNDAMENTAL_TYPE = hasSymbol ? Symbol.for('react.fundamental') : 0xead5;
|
|
46
|
+
var REACT_RESPONDER_TYPE = hasSymbol ? Symbol.for('react.responder') : 0xead6;
|
|
47
47
|
|
|
48
48
|
var MAYBE_ITERATOR_SYMBOL = typeof Symbol === 'function' && Symbol.iterator;
|
|
49
49
|
var FAUX_ITERATOR_SYMBOL = '@@iterator';
|
|
@@ -59,16 +59,15 @@ function getIteratorFn(maybeIterable) {
|
|
|
59
59
|
return null;
|
|
60
60
|
}
|
|
61
61
|
|
|
62
|
-
// Do not require this module directly! Use
|
|
62
|
+
// Do not require this module directly! Use normal `invariant` calls with
|
|
63
63
|
// template literal strings. The messages will be converted to ReactError during
|
|
64
64
|
// build, and in production they will be minified.
|
|
65
65
|
|
|
66
|
-
// Do not require this module directly! Use
|
|
66
|
+
// Do not require this module directly! Use normal `invariant` calls with
|
|
67
67
|
// template literal strings. The messages will be converted to ReactError during
|
|
68
68
|
// build, and in production they will be minified.
|
|
69
69
|
|
|
70
|
-
function ReactError(
|
|
71
|
-
var error = new Error(message);
|
|
70
|
+
function ReactError(error) {
|
|
72
71
|
error.name = 'Invariant Violation';
|
|
73
72
|
return error;
|
|
74
73
|
}
|
|
@@ -319,7 +318,7 @@ Component.prototype.setState = function (partialState, callback) {
|
|
|
319
318
|
(function () {
|
|
320
319
|
if (!(typeof partialState === 'object' || typeof partialState === 'function' || partialState == null)) {
|
|
321
320
|
{
|
|
322
|
-
throw ReactError('setState(...): takes an object of state variables to update or a function which returns an object of state variables.');
|
|
321
|
+
throw ReactError(Error('setState(...): takes an object of state variables to update or a function which returns an object of state variables.'));
|
|
323
322
|
}
|
|
324
323
|
}
|
|
325
324
|
})();
|
|
@@ -411,6 +410,14 @@ var ReactCurrentDispatcher = {
|
|
|
411
410
|
current: null
|
|
412
411
|
};
|
|
413
412
|
|
|
413
|
+
/**
|
|
414
|
+
* Keeps track of the current batch's configuration such as how long an update
|
|
415
|
+
* should suspend for if it needs to.
|
|
416
|
+
*/
|
|
417
|
+
var ReactCurrentBatchConfig = {
|
|
418
|
+
suspense: null
|
|
419
|
+
};
|
|
420
|
+
|
|
414
421
|
/**
|
|
415
422
|
* Keeps track of the current owner.
|
|
416
423
|
*
|
|
@@ -482,8 +489,6 @@ function getComponentName(type) {
|
|
|
482
489
|
return type;
|
|
483
490
|
}
|
|
484
491
|
switch (type) {
|
|
485
|
-
case REACT_CONCURRENT_MODE_TYPE:
|
|
486
|
-
return 'ConcurrentMode';
|
|
487
492
|
case REACT_FRAGMENT_TYPE:
|
|
488
493
|
return 'Fragment';
|
|
489
494
|
case REACT_PORTAL_TYPE:
|
|
@@ -494,6 +499,8 @@ function getComponentName(type) {
|
|
|
494
499
|
return 'StrictMode';
|
|
495
500
|
case REACT_SUSPENSE_TYPE:
|
|
496
501
|
return 'Suspense';
|
|
502
|
+
case REACT_SUSPENSE_LIST_TYPE:
|
|
503
|
+
return 'SuspenseList';
|
|
497
504
|
}
|
|
498
505
|
if (typeof type === 'object') {
|
|
499
506
|
switch (type.$$typeof) {
|
|
@@ -514,26 +521,6 @@ function getComponentName(type) {
|
|
|
514
521
|
}
|
|
515
522
|
break;
|
|
516
523
|
}
|
|
517
|
-
case REACT_EVENT_COMPONENT_TYPE:
|
|
518
|
-
{
|
|
519
|
-
var eventComponent = type;
|
|
520
|
-
var displayName = eventComponent.displayName;
|
|
521
|
-
if (displayName !== undefined) {
|
|
522
|
-
return displayName;
|
|
523
|
-
}
|
|
524
|
-
break;
|
|
525
|
-
}
|
|
526
|
-
case REACT_EVENT_TARGET_TYPE:
|
|
527
|
-
{
|
|
528
|
-
var eventTarget = type;
|
|
529
|
-
if (eventTarget.type === REACT_EVENT_TARGET_TOUCH_HIT) {
|
|
530
|
-
return 'TouchHitTarget';
|
|
531
|
-
}
|
|
532
|
-
var _displayName = eventTarget.displayName;
|
|
533
|
-
if (_displayName !== undefined) {
|
|
534
|
-
return _displayName;
|
|
535
|
-
}
|
|
536
|
-
}
|
|
537
524
|
}
|
|
538
525
|
}
|
|
539
526
|
return null;
|
|
@@ -573,11 +560,19 @@ function setCurrentlyValidatingElement(element) {
|
|
|
573
560
|
};
|
|
574
561
|
}
|
|
575
562
|
|
|
563
|
+
/**
|
|
564
|
+
* Used by act() to track whether you're inside an act() scope.
|
|
565
|
+
*/
|
|
566
|
+
|
|
567
|
+
var IsSomeRendererActing = {
|
|
568
|
+
current: false
|
|
569
|
+
};
|
|
570
|
+
|
|
576
571
|
var ReactSharedInternals = {
|
|
577
572
|
ReactCurrentDispatcher: ReactCurrentDispatcher,
|
|
573
|
+
ReactCurrentBatchConfig: ReactCurrentBatchConfig,
|
|
578
574
|
ReactCurrentOwner: ReactCurrentOwner,
|
|
579
|
-
|
|
580
|
-
ReactShouldWarnActingUpdates: { current: false },
|
|
575
|
+
IsSomeRendererActing: IsSomeRendererActing,
|
|
581
576
|
// Used by renderers to avoid bundling object-assign twice in UMD bundles:
|
|
582
577
|
assign: _assign
|
|
583
578
|
};
|
|
@@ -691,8 +686,10 @@ function defineRefPropWarningGetter(props, displayName) {
|
|
|
691
686
|
* if something is a React Element.
|
|
692
687
|
*
|
|
693
688
|
* @param {*} type
|
|
689
|
+
* @param {*} props
|
|
694
690
|
* @param {*} key
|
|
695
691
|
* @param {string|object} ref
|
|
692
|
+
* @param {*} owner
|
|
696
693
|
* @param {*} self A *temporary* helper to detect places where `this` is
|
|
697
694
|
* different from the `owner` when React.createElement is called, so that we
|
|
698
695
|
* can warn. We want to get rid of owner and replace string `ref`s with arrow
|
|
@@ -700,8 +697,6 @@ function defineRefPropWarningGetter(props, displayName) {
|
|
|
700
697
|
* change in behavior.
|
|
701
698
|
* @param {*} source An annotation object (added by a transpiler or otherwise)
|
|
702
699
|
* indicating filename, line number, and/or other information.
|
|
703
|
-
* @param {*} owner
|
|
704
|
-
* @param {*} props
|
|
705
700
|
* @internal
|
|
706
701
|
*/
|
|
707
702
|
var ReactElement = function (type, key, ref, self, source, owner, props) {
|
|
@@ -760,6 +755,73 @@ var ReactElement = function (type, key, ref, self, source, owner, props) {
|
|
|
760
755
|
return element;
|
|
761
756
|
};
|
|
762
757
|
|
|
758
|
+
/**
|
|
759
|
+
* https://github.com/reactjs/rfcs/pull/107
|
|
760
|
+
* @param {*} type
|
|
761
|
+
* @param {object} props
|
|
762
|
+
* @param {string} key
|
|
763
|
+
*/
|
|
764
|
+
|
|
765
|
+
|
|
766
|
+
/**
|
|
767
|
+
* https://github.com/reactjs/rfcs/pull/107
|
|
768
|
+
* @param {*} type
|
|
769
|
+
* @param {object} props
|
|
770
|
+
* @param {string} key
|
|
771
|
+
*/
|
|
772
|
+
function jsxDEV(type, config, maybeKey, source, self) {
|
|
773
|
+
var propName = void 0;
|
|
774
|
+
|
|
775
|
+
// Reserved names are extracted
|
|
776
|
+
var props = {};
|
|
777
|
+
|
|
778
|
+
var key = null;
|
|
779
|
+
var ref = null;
|
|
780
|
+
|
|
781
|
+
if (hasValidRef(config)) {
|
|
782
|
+
ref = config.ref;
|
|
783
|
+
}
|
|
784
|
+
|
|
785
|
+
if (hasValidKey(config)) {
|
|
786
|
+
key = '' + config.key;
|
|
787
|
+
}
|
|
788
|
+
|
|
789
|
+
// Remaining properties are added to a new props object
|
|
790
|
+
for (propName in config) {
|
|
791
|
+
if (hasOwnProperty.call(config, propName) && !RESERVED_PROPS.hasOwnProperty(propName)) {
|
|
792
|
+
props[propName] = config[propName];
|
|
793
|
+
}
|
|
794
|
+
}
|
|
795
|
+
|
|
796
|
+
// intentionally not checking if key was set above
|
|
797
|
+
// this key is higher priority as it's static
|
|
798
|
+
if (maybeKey !== undefined) {
|
|
799
|
+
key = '' + maybeKey;
|
|
800
|
+
}
|
|
801
|
+
|
|
802
|
+
// Resolve default props
|
|
803
|
+
if (type && type.defaultProps) {
|
|
804
|
+
var defaultProps = type.defaultProps;
|
|
805
|
+
for (propName in defaultProps) {
|
|
806
|
+
if (props[propName] === undefined) {
|
|
807
|
+
props[propName] = defaultProps[propName];
|
|
808
|
+
}
|
|
809
|
+
}
|
|
810
|
+
}
|
|
811
|
+
|
|
812
|
+
if (key || ref) {
|
|
813
|
+
var displayName = typeof type === 'function' ? type.displayName || type.name || 'Unknown' : type;
|
|
814
|
+
if (key) {
|
|
815
|
+
defineKeyPropWarningGetter(props, displayName);
|
|
816
|
+
}
|
|
817
|
+
if (ref) {
|
|
818
|
+
defineRefPropWarningGetter(props, displayName);
|
|
819
|
+
}
|
|
820
|
+
}
|
|
821
|
+
|
|
822
|
+
return ReactElement(type, key, ref, self, source, ReactCurrentOwner.current, props);
|
|
823
|
+
}
|
|
824
|
+
|
|
763
825
|
/**
|
|
764
826
|
* Create and return a new ReactElement of the given type.
|
|
765
827
|
* See https://reactjs.org/docs/react-api.html#createelement
|
|
@@ -854,7 +916,7 @@ function cloneElement(element, config, children) {
|
|
|
854
916
|
(function () {
|
|
855
917
|
if (!!(element === null || element === undefined)) {
|
|
856
918
|
{
|
|
857
|
-
throw ReactError('React.cloneElement(...): The argument must be a React element, but you passed ' + element + '.');
|
|
919
|
+
throw ReactError(Error('React.cloneElement(...): The argument must be a React element, but you passed ' + element + '.'));
|
|
858
920
|
}
|
|
859
921
|
}
|
|
860
922
|
})();
|
|
@@ -1080,7 +1142,7 @@ function traverseAllChildrenImpl(children, nameSoFar, callback, traverseContext)
|
|
|
1080
1142
|
(function () {
|
|
1081
1143
|
{
|
|
1082
1144
|
{
|
|
1083
|
-
throw ReactError('Objects are not valid as a React child (found: ' + (childrenString === '[object Object]' ? 'object with keys {' + Object.keys(children).join(', ') + '}' : childrenString) + ').' + addendum);
|
|
1145
|
+
throw ReactError(Error('Objects are not valid as a React child (found: ' + (childrenString === '[object Object]' ? 'object with keys {' + Object.keys(children).join(', ') + '}' : childrenString) + ').' + addendum));
|
|
1084
1146
|
}
|
|
1085
1147
|
}
|
|
1086
1148
|
})();
|
|
@@ -1262,7 +1324,7 @@ function onlyChild(children) {
|
|
|
1262
1324
|
(function () {
|
|
1263
1325
|
if (!isValidElement(children)) {
|
|
1264
1326
|
{
|
|
1265
|
-
throw ReactError('React.Children.only expected to receive a single React element child.');
|
|
1327
|
+
throw ReactError(Error('React.Children.only expected to receive a single React element child.'));
|
|
1266
1328
|
}
|
|
1267
1329
|
}
|
|
1268
1330
|
})();
|
|
@@ -1447,7 +1509,7 @@ function forwardRef(render) {
|
|
|
1447
1509
|
function isValidElementType(type) {
|
|
1448
1510
|
return typeof type === 'string' || typeof type === 'function' ||
|
|
1449
1511
|
// Note: its typeof might be other than 'symbol' or 'number' if it's a polyfill.
|
|
1450
|
-
type === REACT_FRAGMENT_TYPE || type === REACT_CONCURRENT_MODE_TYPE || type === REACT_PROFILER_TYPE || type === REACT_STRICT_MODE_TYPE || type === REACT_SUSPENSE_TYPE || typeof type === 'object' && type !== null && (type.$$typeof === REACT_LAZY_TYPE || type.$$typeof === REACT_MEMO_TYPE || type.$$typeof === REACT_PROVIDER_TYPE || type.$$typeof === REACT_CONTEXT_TYPE || type.$$typeof === REACT_FORWARD_REF_TYPE || type.$$typeof ===
|
|
1512
|
+
type === REACT_FRAGMENT_TYPE || type === REACT_CONCURRENT_MODE_TYPE || type === REACT_PROFILER_TYPE || type === REACT_STRICT_MODE_TYPE || type === REACT_SUSPENSE_TYPE || type === REACT_SUSPENSE_LIST_TYPE || typeof type === 'object' && type !== null && (type.$$typeof === REACT_LAZY_TYPE || type.$$typeof === REACT_MEMO_TYPE || type.$$typeof === REACT_PROVIDER_TYPE || type.$$typeof === REACT_CONTEXT_TYPE || type.$$typeof === REACT_FORWARD_REF_TYPE || type.$$typeof === REACT_FUNDAMENTAL_TYPE || type.$$typeof === REACT_RESPONDER_TYPE);
|
|
1451
1513
|
}
|
|
1452
1514
|
|
|
1453
1515
|
function memo(type, compare) {
|
|
@@ -1468,7 +1530,7 @@ function resolveDispatcher() {
|
|
|
1468
1530
|
(function () {
|
|
1469
1531
|
if (!(dispatcher !== null)) {
|
|
1470
1532
|
{
|
|
1471
|
-
throw ReactError('Invalid hook call. Hooks can only be called inside of the body of a function component. This could happen for one of the following reasons:\n1. You might have mismatching versions of React and the renderer (such as React DOM)\n2. You might be breaking the Rules of Hooks\n3. You might have more than one copy of React in the same app\nSee https://fb.me/react-invalid-hook-call for tips about how to debug and fix this problem.');
|
|
1533
|
+
throw ReactError(Error('Invalid hook call. Hooks can only be called inside of the body of a function component. This could happen for one of the following reasons:\n1. You might have mismatching versions of React and the renderer (such as React DOM)\n2. You might be breaking the Rules of Hooks\n3. You might have more than one copy of React in the same app\nSee https://fb.me/react-invalid-hook-call for tips about how to debug and fix this problem.'));
|
|
1472
1534
|
}
|
|
1473
1535
|
}
|
|
1474
1536
|
})();
|
|
@@ -1542,6 +1604,30 @@ function useDebugValue(value, formatterFn) {
|
|
|
1542
1604
|
}
|
|
1543
1605
|
}
|
|
1544
1606
|
|
|
1607
|
+
var emptyObject$1 = {};
|
|
1608
|
+
|
|
1609
|
+
function useResponder(responder, listenerProps) {
|
|
1610
|
+
var dispatcher = resolveDispatcher();
|
|
1611
|
+
{
|
|
1612
|
+
if (responder == null || responder.$$typeof !== REACT_RESPONDER_TYPE) {
|
|
1613
|
+
warning$1(false, 'useResponder: invalid first argument. Expected an event responder, but instead got %s', responder);
|
|
1614
|
+
return;
|
|
1615
|
+
}
|
|
1616
|
+
}
|
|
1617
|
+
return dispatcher.useResponder(responder, listenerProps || emptyObject$1);
|
|
1618
|
+
}
|
|
1619
|
+
|
|
1620
|
+
// Within the scope of the callback, mark all updates as being allowed to suspend.
|
|
1621
|
+
function withSuspenseConfig(scope, config) {
|
|
1622
|
+
var previousConfig = ReactCurrentBatchConfig.suspense;
|
|
1623
|
+
ReactCurrentBatchConfig.suspense = config === undefined ? null : config;
|
|
1624
|
+
try {
|
|
1625
|
+
scope();
|
|
1626
|
+
} finally {
|
|
1627
|
+
ReactCurrentBatchConfig.suspense = previousConfig;
|
|
1628
|
+
}
|
|
1629
|
+
}
|
|
1630
|
+
|
|
1545
1631
|
/**
|
|
1546
1632
|
* ReactElementValidator provides a wrapper around a element factory
|
|
1547
1633
|
* which validates the props passed to the element. This is intended to be
|
|
@@ -1565,9 +1651,8 @@ function getDeclarationErrorAddendum() {
|
|
|
1565
1651
|
return '';
|
|
1566
1652
|
}
|
|
1567
1653
|
|
|
1568
|
-
function getSourceInfoErrorAddendum(
|
|
1569
|
-
if (
|
|
1570
|
-
var source = elementProps.__source;
|
|
1654
|
+
function getSourceInfoErrorAddendum(source) {
|
|
1655
|
+
if (source !== undefined) {
|
|
1571
1656
|
var fileName = source.fileName.replace(/^.*[\\\/]/, '');
|
|
1572
1657
|
var lineNumber = source.lineNumber;
|
|
1573
1658
|
return '\n\nCheck your code at ' + fileName + ':' + lineNumber + '.';
|
|
@@ -1575,6 +1660,13 @@ function getSourceInfoErrorAddendum(elementProps) {
|
|
|
1575
1660
|
return '';
|
|
1576
1661
|
}
|
|
1577
1662
|
|
|
1663
|
+
function getSourceInfoErrorAddendumForProps(elementProps) {
|
|
1664
|
+
if (elementProps !== null && elementProps !== undefined) {
|
|
1665
|
+
return getSourceInfoErrorAddendum(elementProps.__source);
|
|
1666
|
+
}
|
|
1667
|
+
return '';
|
|
1668
|
+
}
|
|
1669
|
+
|
|
1578
1670
|
/**
|
|
1579
1671
|
* Warn if there's no key explicitly set on dynamic arrays of children or
|
|
1580
1672
|
* object keys are not valid. This allows us to keep track of children between
|
|
@@ -1735,6 +1827,90 @@ function validateFragmentProps(fragment) {
|
|
|
1735
1827
|
setCurrentlyValidatingElement(null);
|
|
1736
1828
|
}
|
|
1737
1829
|
|
|
1830
|
+
function jsxWithValidation(type, props, key, isStaticChildren, source, self) {
|
|
1831
|
+
var validType = isValidElementType(type);
|
|
1832
|
+
|
|
1833
|
+
// We warn in this case but don't throw. We expect the element creation to
|
|
1834
|
+
// succeed and there will likely be errors in render.
|
|
1835
|
+
if (!validType) {
|
|
1836
|
+
var info = '';
|
|
1837
|
+
if (type === undefined || typeof type === 'object' && type !== null && Object.keys(type).length === 0) {
|
|
1838
|
+
info += ' You likely forgot to export your component from the file ' + "it's defined in, or you might have mixed up default and named imports.";
|
|
1839
|
+
}
|
|
1840
|
+
|
|
1841
|
+
var sourceInfo = getSourceInfoErrorAddendum(source);
|
|
1842
|
+
if (sourceInfo) {
|
|
1843
|
+
info += sourceInfo;
|
|
1844
|
+
} else {
|
|
1845
|
+
info += getDeclarationErrorAddendum();
|
|
1846
|
+
}
|
|
1847
|
+
|
|
1848
|
+
var typeString = void 0;
|
|
1849
|
+
if (type === null) {
|
|
1850
|
+
typeString = 'null';
|
|
1851
|
+
} else if (Array.isArray(type)) {
|
|
1852
|
+
typeString = 'array';
|
|
1853
|
+
} else if (type !== undefined && type.$$typeof === REACT_ELEMENT_TYPE) {
|
|
1854
|
+
typeString = '<' + (getComponentName(type.type) || 'Unknown') + ' />';
|
|
1855
|
+
info = ' Did you accidentally export a JSX literal instead of a component?';
|
|
1856
|
+
} else {
|
|
1857
|
+
typeString = typeof type;
|
|
1858
|
+
}
|
|
1859
|
+
|
|
1860
|
+
warning$1(false, 'React.jsx: type is invalid -- expected a string (for ' + 'built-in components) or a class/function (for composite ' + 'components) but got: %s.%s', typeString, info);
|
|
1861
|
+
}
|
|
1862
|
+
|
|
1863
|
+
var element = jsxDEV(type, props, key, source, self);
|
|
1864
|
+
|
|
1865
|
+
// The result can be nullish if a mock or a custom function is used.
|
|
1866
|
+
// TODO: Drop this when these are no longer allowed as the type argument.
|
|
1867
|
+
if (element == null) {
|
|
1868
|
+
return element;
|
|
1869
|
+
}
|
|
1870
|
+
|
|
1871
|
+
// Skip key warning if the type isn't valid since our key validation logic
|
|
1872
|
+
// doesn't expect a non-string/function type and can throw confusing errors.
|
|
1873
|
+
// We don't want exception behavior to differ between dev and prod.
|
|
1874
|
+
// (Rendering will throw with a helpful message and as soon as the type is
|
|
1875
|
+
// fixed, the key warnings will appear.)
|
|
1876
|
+
if (validType) {
|
|
1877
|
+
var children = props.children;
|
|
1878
|
+
if (children !== undefined) {
|
|
1879
|
+
if (isStaticChildren) {
|
|
1880
|
+
for (var i = 0; i < children.length; i++) {
|
|
1881
|
+
validateChildKeys(children[i], type);
|
|
1882
|
+
}
|
|
1883
|
+
} else {
|
|
1884
|
+
validateChildKeys(children, type);
|
|
1885
|
+
}
|
|
1886
|
+
}
|
|
1887
|
+
}
|
|
1888
|
+
|
|
1889
|
+
if (props.key !== undefined) {
|
|
1890
|
+
warning$1(false, 'React.jsx: Spreading a key to JSX is a deprecated pattern. ' + 'Explicitly pass a key after spreading props in your JSX call. ' + 'E.g. <ComponentName {...props} key={key} />');
|
|
1891
|
+
}
|
|
1892
|
+
|
|
1893
|
+
if (type === REACT_FRAGMENT_TYPE) {
|
|
1894
|
+
validateFragmentProps(element);
|
|
1895
|
+
} else {
|
|
1896
|
+
validatePropTypes(element);
|
|
1897
|
+
}
|
|
1898
|
+
|
|
1899
|
+
return element;
|
|
1900
|
+
}
|
|
1901
|
+
|
|
1902
|
+
// These two functions exist to still get child warnings in dev
|
|
1903
|
+
// even with the prod transform. This means that jsxDEV is purely
|
|
1904
|
+
// opt-in behavior for better messages but that we won't stop
|
|
1905
|
+
// giving you warnings if you use production apis.
|
|
1906
|
+
function jsxWithValidationStatic(type, props, key) {
|
|
1907
|
+
return jsxWithValidation(type, props, key, true);
|
|
1908
|
+
}
|
|
1909
|
+
|
|
1910
|
+
function jsxWithValidationDynamic(type, props, key) {
|
|
1911
|
+
return jsxWithValidation(type, props, key, false);
|
|
1912
|
+
}
|
|
1913
|
+
|
|
1738
1914
|
function createElementWithValidation(type, props, children) {
|
|
1739
1915
|
var validType = isValidElementType(type);
|
|
1740
1916
|
|
|
@@ -1746,7 +1922,7 @@ function createElementWithValidation(type, props, children) {
|
|
|
1746
1922
|
info += ' You likely forgot to export your component from the file ' + "it's defined in, or you might have mixed up default and named imports.";
|
|
1747
1923
|
}
|
|
1748
1924
|
|
|
1749
|
-
var sourceInfo =
|
|
1925
|
+
var sourceInfo = getSourceInfoErrorAddendumForProps(props);
|
|
1750
1926
|
if (sourceInfo) {
|
|
1751
1927
|
info += sourceInfo;
|
|
1752
1928
|
} else {
|
|
@@ -1825,42 +2001,71 @@ function cloneElementWithValidation(element, props, children) {
|
|
|
1825
2001
|
return newElement;
|
|
1826
2002
|
}
|
|
1827
2003
|
|
|
1828
|
-
|
|
2004
|
+
var hasBadMapPolyfill = void 0;
|
|
1829
2005
|
|
|
1830
|
-
var error = noop;
|
|
1831
|
-
var warn = noop;
|
|
1832
2006
|
{
|
|
1833
|
-
|
|
1834
|
-
|
|
1835
|
-
|
|
1836
|
-
var
|
|
1837
|
-
|
|
1838
|
-
|
|
1839
|
-
|
|
1840
|
-
|
|
1841
|
-
|
|
1842
|
-
|
|
1843
|
-
|
|
1844
|
-
|
|
1845
|
-
|
|
1846
|
-
|
|
1847
|
-
|
|
2007
|
+
hasBadMapPolyfill = false;
|
|
2008
|
+
try {
|
|
2009
|
+
var frozenObject = Object.freeze({});
|
|
2010
|
+
var testMap = new Map([[frozenObject, null]]);
|
|
2011
|
+
var testSet = new Set([frozenObject]);
|
|
2012
|
+
// This is necessary for Rollup to not consider these unused.
|
|
2013
|
+
// https://github.com/rollup/rollup/issues/1771
|
|
2014
|
+
// TODO: we can remove these if Rollup fixes the bug.
|
|
2015
|
+
testMap.set(0, 0);
|
|
2016
|
+
testSet.add(0);
|
|
2017
|
+
} catch (e) {
|
|
2018
|
+
// TODO: Consider warning about bad polyfills
|
|
2019
|
+
hasBadMapPolyfill = true;
|
|
2020
|
+
}
|
|
2021
|
+
}
|
|
2022
|
+
|
|
2023
|
+
function createFundamentalComponent(impl) {
|
|
2024
|
+
// We use responder as a Map key later on. When we have a bad
|
|
2025
|
+
// polyfill, then we can't use it as a key as the polyfill tries
|
|
2026
|
+
// to add a property to the object.
|
|
2027
|
+
if (true && !hasBadMapPolyfill) {
|
|
2028
|
+
Object.freeze(impl);
|
|
2029
|
+
}
|
|
2030
|
+
var fundamantalComponent = {
|
|
2031
|
+
$$typeof: REACT_FUNDAMENTAL_TYPE,
|
|
2032
|
+
impl: impl
|
|
1848
2033
|
};
|
|
1849
|
-
|
|
1850
|
-
|
|
1851
|
-
|
|
1852
|
-
|
|
1853
|
-
|
|
1854
|
-
|
|
1855
|
-
|
|
1856
|
-
|
|
1857
|
-
|
|
1858
|
-
|
|
1859
|
-
|
|
1860
|
-
|
|
1861
|
-
|
|
1862
|
-
|
|
2034
|
+
{
|
|
2035
|
+
Object.freeze(fundamantalComponent);
|
|
2036
|
+
}
|
|
2037
|
+
return fundamantalComponent;
|
|
2038
|
+
}
|
|
2039
|
+
|
|
2040
|
+
function createEventResponder(displayName, responderConfig) {
|
|
2041
|
+
var getInitialState = responderConfig.getInitialState,
|
|
2042
|
+
onEvent = responderConfig.onEvent,
|
|
2043
|
+
onMount = responderConfig.onMount,
|
|
2044
|
+
onUnmount = responderConfig.onUnmount,
|
|
2045
|
+
onOwnershipChange = responderConfig.onOwnershipChange,
|
|
2046
|
+
onRootEvent = responderConfig.onRootEvent,
|
|
2047
|
+
rootEventTypes = responderConfig.rootEventTypes,
|
|
2048
|
+
targetEventTypes = responderConfig.targetEventTypes;
|
|
2049
|
+
|
|
2050
|
+
var eventResponder = {
|
|
2051
|
+
$$typeof: REACT_RESPONDER_TYPE,
|
|
2052
|
+
displayName: displayName,
|
|
2053
|
+
getInitialState: getInitialState || null,
|
|
2054
|
+
onEvent: onEvent || null,
|
|
2055
|
+
onMount: onMount || null,
|
|
2056
|
+
onOwnershipChange: onOwnershipChange || null,
|
|
2057
|
+
onRootEvent: onRootEvent || null,
|
|
2058
|
+
onUnmount: onUnmount || null,
|
|
2059
|
+
rootEventTypes: rootEventTypes || null,
|
|
2060
|
+
targetEventTypes: targetEventTypes || null
|
|
1863
2061
|
};
|
|
2062
|
+
// We use responder as a Map key later on. When we have a bad
|
|
2063
|
+
// polyfill, then we can't use it as a key as the polyfill tries
|
|
2064
|
+
// to add a property to the object.
|
|
2065
|
+
if (true && !hasBadMapPolyfill) {
|
|
2066
|
+
Object.freeze(eventResponder);
|
|
2067
|
+
}
|
|
2068
|
+
return eventResponder;
|
|
1864
2069
|
}
|
|
1865
2070
|
|
|
1866
2071
|
// Helps identify side effects in begin-phase lifecycle hooks and setState reducers:
|
|
@@ -1897,16 +2102,13 @@ var warn = noop;
|
|
|
1897
2102
|
// Disable javascript: URL strings in href for XSS protection.
|
|
1898
2103
|
|
|
1899
2104
|
|
|
1900
|
-
// Disables yielding during render in Concurrent Mode. Used for debugging only.
|
|
1901
|
-
|
|
1902
|
-
|
|
1903
2105
|
// React Fire: prevent the value and checked attributes from syncing
|
|
1904
2106
|
// with their related DOM properties
|
|
1905
2107
|
|
|
1906
2108
|
|
|
1907
2109
|
// These APIs will no longer be "unstable" in the upcoming 16.7 release,
|
|
1908
2110
|
// Control this behavior with a flag to support 16.6 minor releases in the meanwhile.
|
|
1909
|
-
|
|
2111
|
+
|
|
1910
2112
|
|
|
1911
2113
|
|
|
1912
2114
|
|
|
@@ -1914,11 +2116,38 @@ var enableStableConcurrentModeAPIs = false;
|
|
|
1914
2116
|
// This is a flag so we can fix warnings in RN core before turning it on
|
|
1915
2117
|
|
|
1916
2118
|
|
|
1917
|
-
// Experimental React
|
|
2119
|
+
// Experimental React Flare event system and event components support.
|
|
2120
|
+
var enableFlareAPI = false;
|
|
2121
|
+
|
|
2122
|
+
// Experimental Host Component support.
|
|
2123
|
+
var enableFundamentalAPI = false;
|
|
2124
|
+
|
|
2125
|
+
// New API for JSX transforms to target - https://github.com/reactjs/rfcs/pull/107
|
|
2126
|
+
var enableJSXTransformAPI = false;
|
|
2127
|
+
|
|
2128
|
+
// We will enforce mocking scheduler with scheduler/unstable_mock at some point. (v17?)
|
|
2129
|
+
// Till then, we warn about the missing mock, but still fallback to a sync mode compatible version
|
|
2130
|
+
|
|
2131
|
+
// Temporary flag to revert the fix in #15650
|
|
2132
|
+
|
|
2133
|
+
|
|
2134
|
+
// For tests, we flush suspense fallbacks in an act scope;
|
|
2135
|
+
// *except* in some of our own tests, where we test incremental loading states.
|
|
2136
|
+
|
|
1918
2137
|
|
|
2138
|
+
// Changes priority of some events like mousemove to user-blocking priority,
|
|
2139
|
+
// but without making them discrete. The flag exists in case it causes
|
|
2140
|
+
// starvation problems.
|
|
1919
2141
|
|
|
1920
|
-
|
|
1921
|
-
//
|
|
2142
|
+
|
|
2143
|
+
// Add a callback property to suspense to notify which promises are currently
|
|
2144
|
+
// in the update queue. This allows reporting and tracing of what is causing
|
|
2145
|
+
// the user to see a loading state.
|
|
2146
|
+
|
|
2147
|
+
|
|
2148
|
+
// Part of the simplification of React.createElement so we can eventually move
|
|
2149
|
+
// from React.createElement to React.jsx
|
|
2150
|
+
// https://github.com/reactjs/rfcs/blob/createlement-rfc/text/0000-create-element-changes.md
|
|
1922
2151
|
|
|
1923
2152
|
var React = {
|
|
1924
2153
|
Children: {
|
|
@@ -1938,9 +2167,6 @@ var React = {
|
|
|
1938
2167
|
lazy: lazy,
|
|
1939
2168
|
memo: memo,
|
|
1940
2169
|
|
|
1941
|
-
error: error,
|
|
1942
|
-
warn: warn,
|
|
1943
|
-
|
|
1944
2170
|
useCallback: useCallback,
|
|
1945
2171
|
useContext: useContext,
|
|
1946
2172
|
useEffect: useEffect,
|
|
@@ -1956,6 +2182,7 @@ var React = {
|
|
|
1956
2182
|
Profiler: REACT_PROFILER_TYPE,
|
|
1957
2183
|
StrictMode: REACT_STRICT_MODE_TYPE,
|
|
1958
2184
|
Suspense: REACT_SUSPENSE_TYPE,
|
|
2185
|
+
unstable_SuspenseList: REACT_SUSPENSE_LIST_TYPE,
|
|
1959
2186
|
|
|
1960
2187
|
createElement: createElementWithValidation,
|
|
1961
2188
|
cloneElement: cloneElementWithValidation,
|
|
@@ -1964,19 +2191,31 @@ var React = {
|
|
|
1964
2191
|
|
|
1965
2192
|
version: ReactVersion,
|
|
1966
2193
|
|
|
1967
|
-
|
|
2194
|
+
unstable_withSuspenseConfig: withSuspenseConfig,
|
|
1968
2195
|
|
|
1969
2196
|
__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED: ReactSharedInternals
|
|
1970
2197
|
};
|
|
1971
2198
|
|
|
2199
|
+
if (enableFlareAPI) {
|
|
2200
|
+
React.unstable_useResponder = useResponder;
|
|
2201
|
+
React.unstable_createResponder = createEventResponder;
|
|
2202
|
+
}
|
|
2203
|
+
|
|
2204
|
+
if (enableFundamentalAPI) {
|
|
2205
|
+
React.unstable_createFundamental = createFundamentalComponent;
|
|
2206
|
+
}
|
|
2207
|
+
|
|
1972
2208
|
// Note: some APIs are added with feature flags.
|
|
1973
2209
|
// Make sure that stable builds for open source
|
|
1974
2210
|
// don't modify the React object to avoid deopts.
|
|
1975
2211
|
// Also let's not expose their names in stable builds.
|
|
1976
2212
|
|
|
1977
|
-
if (
|
|
1978
|
-
|
|
1979
|
-
|
|
2213
|
+
if (enableJSXTransformAPI) {
|
|
2214
|
+
{
|
|
2215
|
+
React.jsxDEV = jsxWithValidation;
|
|
2216
|
+
React.jsx = jsxWithValidationDynamic;
|
|
2217
|
+
React.jsxs = jsxWithValidationStatic;
|
|
2218
|
+
}
|
|
1980
2219
|
}
|
|
1981
2220
|
|
|
1982
2221
|
|