react 16.8.5 → 16.9.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 +392 -58
- package/cjs/react.production.min.js +15 -15
- package/package.json +2 -3
- package/umd/react.development.js +2741 -2182
- package/umd/react.production.min.js +27 -26
- package/umd/react.profiling.min.js +31 -30
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.
|
|
7
|
+
"reactVersion": "16.8.6-canary-a1dbb852c"
|
|
8
8
|
}
|
package/cjs/react.development.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/** @license React v16.
|
|
1
|
+
/** @license React v16.9.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.
|
|
23
|
+
var ReactVersion = '16.9.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,12 +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;
|
|
45
|
+
var REACT_FUNDAMENTAL_TYPE = hasSymbol ? Symbol.for('react.fundamental') : 0xead5;
|
|
46
|
+
var REACT_RESPONDER_TYPE = hasSymbol ? Symbol.for('react.responder') : 0xead6;
|
|
42
47
|
|
|
43
48
|
var MAYBE_ITERATOR_SYMBOL = typeof Symbol === 'function' && Symbol.iterator;
|
|
44
49
|
var FAUX_ITERATOR_SYMBOL = '@@iterator';
|
|
@@ -54,6 +59,19 @@ function getIteratorFn(maybeIterable) {
|
|
|
54
59
|
return null;
|
|
55
60
|
}
|
|
56
61
|
|
|
62
|
+
// Do not require this module directly! Use normal `invariant` calls with
|
|
63
|
+
// template literal strings. The messages will be converted to ReactError during
|
|
64
|
+
// build, and in production they will be minified.
|
|
65
|
+
|
|
66
|
+
// Do not require this module directly! Use normal `invariant` calls with
|
|
67
|
+
// template literal strings. The messages will be converted to ReactError during
|
|
68
|
+
// build, and in production they will be minified.
|
|
69
|
+
|
|
70
|
+
function ReactError(error) {
|
|
71
|
+
error.name = 'Invariant Violation';
|
|
72
|
+
return error;
|
|
73
|
+
}
|
|
74
|
+
|
|
57
75
|
/**
|
|
58
76
|
* Use invariant() to assert state which your program assumes to be true.
|
|
59
77
|
*
|
|
@@ -65,40 +83,6 @@ function getIteratorFn(maybeIterable) {
|
|
|
65
83
|
* will remain to ensure logic does not differ in production.
|
|
66
84
|
*/
|
|
67
85
|
|
|
68
|
-
var validateFormat = function () {};
|
|
69
|
-
|
|
70
|
-
{
|
|
71
|
-
validateFormat = function (format) {
|
|
72
|
-
if (format === undefined) {
|
|
73
|
-
throw new Error('invariant requires an error message argument');
|
|
74
|
-
}
|
|
75
|
-
};
|
|
76
|
-
}
|
|
77
|
-
|
|
78
|
-
function invariant(condition, format, a, b, c, d, e, f) {
|
|
79
|
-
validateFormat(format);
|
|
80
|
-
|
|
81
|
-
if (!condition) {
|
|
82
|
-
var error = void 0;
|
|
83
|
-
if (format === undefined) {
|
|
84
|
-
error = new Error('Minified exception occurred; use the non-minified dev environment ' + 'for the full error message and additional helpful warnings.');
|
|
85
|
-
} else {
|
|
86
|
-
var args = [a, b, c, d, e, f];
|
|
87
|
-
var argIndex = 0;
|
|
88
|
-
error = new Error(format.replace(/%s/g, function () {
|
|
89
|
-
return args[argIndex++];
|
|
90
|
-
}));
|
|
91
|
-
error.name = 'Invariant Violation';
|
|
92
|
-
}
|
|
93
|
-
|
|
94
|
-
error.framesToPop = 1; // we don't care about invariant's own frame
|
|
95
|
-
throw error;
|
|
96
|
-
}
|
|
97
|
-
}
|
|
98
|
-
|
|
99
|
-
// Relying on the `invariant()` implementation lets us
|
|
100
|
-
// preserve the format and params in the www builds.
|
|
101
|
-
|
|
102
86
|
/**
|
|
103
87
|
* Forked from fbjs/warning:
|
|
104
88
|
* https://github.com/facebook/fbjs/blob/e66ba20ad5be433eb54423f2b097d829324d9de6/packages/fbjs/src/__forks__/warning.js
|
|
@@ -331,7 +315,13 @@ Component.prototype.isReactComponent = {};
|
|
|
331
315
|
* @protected
|
|
332
316
|
*/
|
|
333
317
|
Component.prototype.setState = function (partialState, callback) {
|
|
334
|
-
|
|
318
|
+
(function () {
|
|
319
|
+
if (!(typeof partialState === 'object' || typeof partialState === 'function' || partialState == null)) {
|
|
320
|
+
{
|
|
321
|
+
throw ReactError(Error('setState(...): takes an object of state variables to update or a function which returns an object of state variables.'));
|
|
322
|
+
}
|
|
323
|
+
}
|
|
324
|
+
})();
|
|
335
325
|
this.updater.enqueueSetState(this, partialState, callback, 'setState');
|
|
336
326
|
};
|
|
337
327
|
|
|
@@ -420,6 +410,14 @@ var ReactCurrentDispatcher = {
|
|
|
420
410
|
current: null
|
|
421
411
|
};
|
|
422
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
|
+
|
|
423
421
|
/**
|
|
424
422
|
* Keeps track of the current owner.
|
|
425
423
|
*
|
|
@@ -491,8 +489,6 @@ function getComponentName(type) {
|
|
|
491
489
|
return type;
|
|
492
490
|
}
|
|
493
491
|
switch (type) {
|
|
494
|
-
case REACT_CONCURRENT_MODE_TYPE:
|
|
495
|
-
return 'ConcurrentMode';
|
|
496
492
|
case REACT_FRAGMENT_TYPE:
|
|
497
493
|
return 'Fragment';
|
|
498
494
|
case REACT_PORTAL_TYPE:
|
|
@@ -503,6 +499,8 @@ function getComponentName(type) {
|
|
|
503
499
|
return 'StrictMode';
|
|
504
500
|
case REACT_SUSPENSE_TYPE:
|
|
505
501
|
return 'Suspense';
|
|
502
|
+
case REACT_SUSPENSE_LIST_TYPE:
|
|
503
|
+
return 'SuspenseList';
|
|
506
504
|
}
|
|
507
505
|
if (typeof type === 'object') {
|
|
508
506
|
switch (type.$$typeof) {
|
|
@@ -521,6 +519,7 @@ function getComponentName(type) {
|
|
|
521
519
|
if (resolvedThenable) {
|
|
522
520
|
return getComponentName(resolvedThenable);
|
|
523
521
|
}
|
|
522
|
+
break;
|
|
524
523
|
}
|
|
525
524
|
}
|
|
526
525
|
}
|
|
@@ -561,9 +560,19 @@ function setCurrentlyValidatingElement(element) {
|
|
|
561
560
|
};
|
|
562
561
|
}
|
|
563
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
|
+
|
|
564
571
|
var ReactSharedInternals = {
|
|
565
572
|
ReactCurrentDispatcher: ReactCurrentDispatcher,
|
|
573
|
+
ReactCurrentBatchConfig: ReactCurrentBatchConfig,
|
|
566
574
|
ReactCurrentOwner: ReactCurrentOwner,
|
|
575
|
+
IsSomeRendererActing: IsSomeRendererActing,
|
|
567
576
|
// Used by renderers to avoid bundling object-assign twice in UMD bundles:
|
|
568
577
|
assign: _assign
|
|
569
578
|
};
|
|
@@ -677,8 +686,10 @@ function defineRefPropWarningGetter(props, displayName) {
|
|
|
677
686
|
* if something is a React Element.
|
|
678
687
|
*
|
|
679
688
|
* @param {*} type
|
|
689
|
+
* @param {*} props
|
|
680
690
|
* @param {*} key
|
|
681
691
|
* @param {string|object} ref
|
|
692
|
+
* @param {*} owner
|
|
682
693
|
* @param {*} self A *temporary* helper to detect places where `this` is
|
|
683
694
|
* different from the `owner` when React.createElement is called, so that we
|
|
684
695
|
* can warn. We want to get rid of owner and replace string `ref`s with arrow
|
|
@@ -686,8 +697,6 @@ function defineRefPropWarningGetter(props, displayName) {
|
|
|
686
697
|
* change in behavior.
|
|
687
698
|
* @param {*} source An annotation object (added by a transpiler or otherwise)
|
|
688
699
|
* indicating filename, line number, and/or other information.
|
|
689
|
-
* @param {*} owner
|
|
690
|
-
* @param {*} props
|
|
691
700
|
* @internal
|
|
692
701
|
*/
|
|
693
702
|
var ReactElement = function (type, key, ref, self, source, owner, props) {
|
|
@@ -746,6 +755,73 @@ var ReactElement = function (type, key, ref, self, source, owner, props) {
|
|
|
746
755
|
return element;
|
|
747
756
|
};
|
|
748
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
|
+
|
|
749
825
|
/**
|
|
750
826
|
* Create and return a new ReactElement of the given type.
|
|
751
827
|
* See https://reactjs.org/docs/react-api.html#createelement
|
|
@@ -837,7 +913,13 @@ function cloneAndReplaceKey(oldElement, newKey) {
|
|
|
837
913
|
* See https://reactjs.org/docs/react-api.html#cloneelement
|
|
838
914
|
*/
|
|
839
915
|
function cloneElement(element, config, children) {
|
|
840
|
-
|
|
916
|
+
(function () {
|
|
917
|
+
if (!!(element === null || element === undefined)) {
|
|
918
|
+
{
|
|
919
|
+
throw ReactError(Error('React.cloneElement(...): The argument must be a React element, but you passed ' + element + '.'));
|
|
920
|
+
}
|
|
921
|
+
}
|
|
922
|
+
})();
|
|
841
923
|
|
|
842
924
|
var propName = void 0;
|
|
843
925
|
|
|
@@ -1057,7 +1139,13 @@ function traverseAllChildrenImpl(children, nameSoFar, callback, traverseContext)
|
|
|
1057
1139
|
addendum = ' If you meant to render a collection of children, use an array ' + 'instead.' + ReactDebugCurrentFrame.getStackAddendum();
|
|
1058
1140
|
}
|
|
1059
1141
|
var childrenString = '' + children;
|
|
1060
|
-
|
|
1142
|
+
(function () {
|
|
1143
|
+
{
|
|
1144
|
+
{
|
|
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));
|
|
1146
|
+
}
|
|
1147
|
+
}
|
|
1148
|
+
})();
|
|
1061
1149
|
}
|
|
1062
1150
|
}
|
|
1063
1151
|
|
|
@@ -1233,7 +1321,13 @@ function toArray(children) {
|
|
|
1233
1321
|
* structure.
|
|
1234
1322
|
*/
|
|
1235
1323
|
function onlyChild(children) {
|
|
1236
|
-
|
|
1324
|
+
(function () {
|
|
1325
|
+
if (!isValidElement(children)) {
|
|
1326
|
+
{
|
|
1327
|
+
throw ReactError(Error('React.Children.only expected to receive a single React element child.'));
|
|
1328
|
+
}
|
|
1329
|
+
}
|
|
1330
|
+
})();
|
|
1237
1331
|
return children;
|
|
1238
1332
|
}
|
|
1239
1333
|
|
|
@@ -1415,7 +1509,7 @@ function forwardRef(render) {
|
|
|
1415
1509
|
function isValidElementType(type) {
|
|
1416
1510
|
return typeof type === 'string' || typeof type === 'function' ||
|
|
1417
1511
|
// Note: its typeof might be other than 'symbol' or 'number' if it's a polyfill.
|
|
1418
|
-
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);
|
|
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);
|
|
1419
1513
|
}
|
|
1420
1514
|
|
|
1421
1515
|
function memo(type, compare) {
|
|
@@ -1433,7 +1527,13 @@ function memo(type, compare) {
|
|
|
1433
1527
|
|
|
1434
1528
|
function resolveDispatcher() {
|
|
1435
1529
|
var dispatcher = ReactCurrentDispatcher.current;
|
|
1436
|
-
|
|
1530
|
+
(function () {
|
|
1531
|
+
if (!(dispatcher !== null)) {
|
|
1532
|
+
{
|
|
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.'));
|
|
1534
|
+
}
|
|
1535
|
+
}
|
|
1536
|
+
})();
|
|
1437
1537
|
return dispatcher;
|
|
1438
1538
|
}
|
|
1439
1539
|
|
|
@@ -1504,6 +1604,30 @@ function useDebugValue(value, formatterFn) {
|
|
|
1504
1604
|
}
|
|
1505
1605
|
}
|
|
1506
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
|
+
|
|
1507
1631
|
/**
|
|
1508
1632
|
* ReactElementValidator provides a wrapper around a element factory
|
|
1509
1633
|
* which validates the props passed to the element. This is intended to be
|
|
@@ -1527,9 +1651,8 @@ function getDeclarationErrorAddendum() {
|
|
|
1527
1651
|
return '';
|
|
1528
1652
|
}
|
|
1529
1653
|
|
|
1530
|
-
function getSourceInfoErrorAddendum(
|
|
1531
|
-
if (
|
|
1532
|
-
var source = elementProps.__source;
|
|
1654
|
+
function getSourceInfoErrorAddendum(source) {
|
|
1655
|
+
if (source !== undefined) {
|
|
1533
1656
|
var fileName = source.fileName.replace(/^.*[\\\/]/, '');
|
|
1534
1657
|
var lineNumber = source.lineNumber;
|
|
1535
1658
|
return '\n\nCheck your code at ' + fileName + ':' + lineNumber + '.';
|
|
@@ -1537,6 +1660,13 @@ function getSourceInfoErrorAddendum(elementProps) {
|
|
|
1537
1660
|
return '';
|
|
1538
1661
|
}
|
|
1539
1662
|
|
|
1663
|
+
function getSourceInfoErrorAddendumForProps(elementProps) {
|
|
1664
|
+
if (elementProps !== null && elementProps !== undefined) {
|
|
1665
|
+
return getSourceInfoErrorAddendum(elementProps.__source);
|
|
1666
|
+
}
|
|
1667
|
+
return '';
|
|
1668
|
+
}
|
|
1669
|
+
|
|
1540
1670
|
/**
|
|
1541
1671
|
* Warn if there's no key explicitly set on dynamic arrays of children or
|
|
1542
1672
|
* object keys are not valid. This allows us to keep track of children between
|
|
@@ -1697,6 +1827,90 @@ function validateFragmentProps(fragment) {
|
|
|
1697
1827
|
setCurrentlyValidatingElement(null);
|
|
1698
1828
|
}
|
|
1699
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
|
+
|
|
1700
1914
|
function createElementWithValidation(type, props, children) {
|
|
1701
1915
|
var validType = isValidElementType(type);
|
|
1702
1916
|
|
|
@@ -1708,7 +1922,7 @@ function createElementWithValidation(type, props, children) {
|
|
|
1708
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.";
|
|
1709
1923
|
}
|
|
1710
1924
|
|
|
1711
|
-
var sourceInfo =
|
|
1925
|
+
var sourceInfo = getSourceInfoErrorAddendumForProps(props);
|
|
1712
1926
|
if (sourceInfo) {
|
|
1713
1927
|
info += sourceInfo;
|
|
1714
1928
|
} else {
|
|
@@ -1787,6 +2001,73 @@ function cloneElementWithValidation(element, props, children) {
|
|
|
1787
2001
|
return newElement;
|
|
1788
2002
|
}
|
|
1789
2003
|
|
|
2004
|
+
var hasBadMapPolyfill = void 0;
|
|
2005
|
+
|
|
2006
|
+
{
|
|
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
|
|
2033
|
+
};
|
|
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
|
|
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;
|
|
2069
|
+
}
|
|
2070
|
+
|
|
1790
2071
|
// Helps identify side effects in begin-phase lifecycle hooks and setState reducers:
|
|
1791
2072
|
|
|
1792
2073
|
|
|
@@ -1818,13 +2099,55 @@ function cloneElementWithValidation(element, props, children) {
|
|
|
1818
2099
|
// Only used in www builds.
|
|
1819
2100
|
|
|
1820
2101
|
|
|
2102
|
+
// Disable javascript: URL strings in href for XSS protection.
|
|
2103
|
+
|
|
2104
|
+
|
|
1821
2105
|
// React Fire: prevent the value and checked attributes from syncing
|
|
1822
2106
|
// with their related DOM properties
|
|
1823
2107
|
|
|
1824
2108
|
|
|
1825
2109
|
// These APIs will no longer be "unstable" in the upcoming 16.7 release,
|
|
1826
2110
|
// Control this behavior with a flag to support 16.6 minor releases in the meanwhile.
|
|
1827
|
-
|
|
2111
|
+
|
|
2112
|
+
|
|
2113
|
+
|
|
2114
|
+
|
|
2115
|
+
// See https://github.com/react-native-community/discussions-and-proposals/issues/72 for more information
|
|
2116
|
+
// This is a flag so we can fix warnings in RN core before turning it on
|
|
2117
|
+
|
|
2118
|
+
|
|
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
|
+
|
|
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.
|
|
2141
|
+
|
|
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
|
|
1828
2151
|
|
|
1829
2152
|
var React = {
|
|
1830
2153
|
Children: {
|
|
@@ -1856,8 +2179,10 @@ var React = {
|
|
|
1856
2179
|
useState: useState,
|
|
1857
2180
|
|
|
1858
2181
|
Fragment: REACT_FRAGMENT_TYPE,
|
|
2182
|
+
Profiler: REACT_PROFILER_TYPE,
|
|
1859
2183
|
StrictMode: REACT_STRICT_MODE_TYPE,
|
|
1860
2184
|
Suspense: REACT_SUSPENSE_TYPE,
|
|
2185
|
+
unstable_SuspenseList: REACT_SUSPENSE_LIST_TYPE,
|
|
1861
2186
|
|
|
1862
2187
|
createElement: createElementWithValidation,
|
|
1863
2188
|
cloneElement: cloneElementWithValidation,
|
|
@@ -1866,22 +2191,31 @@ var React = {
|
|
|
1866
2191
|
|
|
1867
2192
|
version: ReactVersion,
|
|
1868
2193
|
|
|
1869
|
-
|
|
1870
|
-
unstable_Profiler: REACT_PROFILER_TYPE,
|
|
2194
|
+
unstable_withSuspenseConfig: withSuspenseConfig,
|
|
1871
2195
|
|
|
1872
2196
|
__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED: ReactSharedInternals
|
|
1873
2197
|
};
|
|
1874
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
|
+
|
|
1875
2208
|
// Note: some APIs are added with feature flags.
|
|
1876
2209
|
// Make sure that stable builds for open source
|
|
1877
2210
|
// don't modify the React object to avoid deopts.
|
|
1878
2211
|
// Also let's not expose their names in stable builds.
|
|
1879
2212
|
|
|
1880
|
-
if (
|
|
1881
|
-
|
|
1882
|
-
|
|
1883
|
-
|
|
1884
|
-
|
|
2213
|
+
if (enableJSXTransformAPI) {
|
|
2214
|
+
{
|
|
2215
|
+
React.jsxDEV = jsxWithValidation;
|
|
2216
|
+
React.jsx = jsxWithValidationDynamic;
|
|
2217
|
+
React.jsxs = jsxWithValidationStatic;
|
|
2218
|
+
}
|
|
1885
2219
|
}
|
|
1886
2220
|
|
|
1887
2221
|
|