react 16.7.0-alpha.2 → 16.8.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.
@@ -0,0 +1,8 @@
1
+ {
2
+ "branch": "master",
3
+ "buildNumber": "13364",
4
+ "checksum": "ae8143f",
5
+ "commit": "d1326f466",
6
+ "environment": "ci",
7
+ "reactVersion": "16.7.0-canary-d1326f466"
8
+ }
@@ -1,4 +1,4 @@
1
- /** @license React v16.7.0-alpha.2
1
+ /** @license React v16.8.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.7.0-alpha.2';
23
+ var ReactVersion = '16.8.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.
@@ -54,43 +54,6 @@ function getIteratorFn(maybeIterable) {
54
54
  return null;
55
55
  }
56
56
 
57
- var enableHooks = true;
58
- // Helps identify side effects in begin-phase lifecycle hooks and setState reducers:
59
-
60
-
61
- // In some cases, StrictMode should also double-render lifecycles.
62
- // This can be confusing for tests though,
63
- // And it can be bad for performance in production.
64
- // This feature flag can be used to control the behavior:
65
-
66
-
67
- // To preserve the "Pause on caught exceptions" behavior of the debugger, we
68
- // replay the begin phase of a failed component inside invokeGuardedCallback.
69
-
70
-
71
- // Warn about deprecated, async-unsafe lifecycles; relates to RFC #6:
72
-
73
-
74
- // Gather advanced timing metrics for Profiler subtrees.
75
-
76
-
77
- // Trace which interactions trigger each commit.
78
-
79
-
80
- // Only used in www builds.
81
-
82
-
83
- // Only used in www builds.
84
-
85
-
86
- // React Fire: prevent the value and checked attributes from syncing
87
- // with their related DOM properties
88
-
89
-
90
- // These APIs will no longer be "unstable" in the upcoming 16.7 release,
91
- // Control this behavior with a flag to support 16.6 minor releases in the meanwhile.
92
- var enableStableConcurrentModeAPIs = true;
93
-
94
57
  /**
95
58
  * Use invariant() to assert state which your program assumes to be true.
96
59
  *
@@ -446,6 +409,17 @@ function createRef() {
446
409
  return refObject;
447
410
  }
448
411
 
412
+ /**
413
+ * Keeps track of the current dispatcher.
414
+ */
415
+ var ReactCurrentDispatcher = {
416
+ /**
417
+ * @internal
418
+ * @type {ReactComponent}
419
+ */
420
+ current: null
421
+ };
422
+
449
423
  /**
450
424
  * Keeps track of the current owner.
451
425
  *
@@ -457,8 +431,7 @@ var ReactCurrentOwner = {
457
431
  * @internal
458
432
  * @type {ReactComponent}
459
433
  */
460
- current: null,
461
- currentDispatcher: null
434
+ current: null
462
435
  };
463
436
 
464
437
  var BEFORE_SLASH_RE = /^(.*)[\\\/]/;
@@ -589,6 +562,7 @@ function setCurrentlyValidatingElement(element) {
589
562
  }
590
563
 
591
564
  var ReactSharedInternals = {
565
+ ReactCurrentDispatcher: ReactCurrentDispatcher,
592
566
  ReactCurrentOwner: ReactCurrentOwner,
593
567
  // Used by renderers to avoid bundling object-assign twice in UMD bundles:
594
568
  assign: _assign
@@ -1368,13 +1342,51 @@ function createContext(defaultValue, calculateChangedBits) {
1368
1342
  }
1369
1343
 
1370
1344
  function lazy(ctor) {
1371
- return {
1345
+ var lazyType = {
1372
1346
  $$typeof: REACT_LAZY_TYPE,
1373
1347
  _ctor: ctor,
1374
1348
  // React uses these fields to store the result.
1375
1349
  _status: -1,
1376
1350
  _result: null
1377
1351
  };
1352
+
1353
+ {
1354
+ // In production, this would just set it on the object.
1355
+ var defaultProps = void 0;
1356
+ var propTypes = void 0;
1357
+ Object.defineProperties(lazyType, {
1358
+ defaultProps: {
1359
+ configurable: true,
1360
+ get: function () {
1361
+ return defaultProps;
1362
+ },
1363
+ set: function (newDefaultProps) {
1364
+ warning$1(false, 'React.lazy(...): It is not supported to assign `defaultProps` to ' + 'a lazy component import. Either specify them where the component ' + 'is defined, or create a wrapping component around it.');
1365
+ defaultProps = newDefaultProps;
1366
+ // Match production behavior more closely:
1367
+ Object.defineProperty(lazyType, 'defaultProps', {
1368
+ enumerable: true
1369
+ });
1370
+ }
1371
+ },
1372
+ propTypes: {
1373
+ configurable: true,
1374
+ get: function () {
1375
+ return propTypes;
1376
+ },
1377
+ set: function (newPropTypes) {
1378
+ warning$1(false, 'React.lazy(...): It is not supported to assign `propTypes` to ' + 'a lazy component import. Either specify them where the component ' + 'is defined, or create a wrapping component around it.');
1379
+ propTypes = newPropTypes;
1380
+ // Match production behavior more closely:
1381
+ Object.defineProperty(lazyType, 'propTypes', {
1382
+ enumerable: true
1383
+ });
1384
+ }
1385
+ }
1386
+ });
1387
+ }
1388
+
1389
+ return lazyType;
1378
1390
  }
1379
1391
 
1380
1392
  function forwardRef(render) {
@@ -1420,14 +1432,16 @@ function memo(type, compare) {
1420
1432
  }
1421
1433
 
1422
1434
  function resolveDispatcher() {
1423
- var dispatcher = ReactCurrentOwner.currentDispatcher;
1424
- !(dispatcher !== null) ? invariant(false, 'Hooks can only be called inside the body of a function component.') : void 0;
1435
+ var dispatcher = ReactCurrentDispatcher.current;
1436
+ !(dispatcher !== null) ? invariant(false, 'Hooks can only be called inside the body of a function component. (https://fb.me/react-invalid-hook-call)') : void 0;
1425
1437
  return dispatcher;
1426
1438
  }
1427
1439
 
1428
- function useContext(Context, observedBits) {
1440
+ function useContext(Context, unstable_observedBits) {
1429
1441
  var dispatcher = resolveDispatcher();
1430
1442
  {
1443
+ !(unstable_observedBits === undefined) ? warning$1(false, 'useContext() second argument is reserved for future ' + 'use in React. Passing it is not supported. ' + 'You passed: %s.%s', unstable_observedBits, typeof unstable_observedBits === 'number' && Array.isArray(arguments[2]) ? '\n\nDid you call array.map(useContext)? ' + 'Calling Hooks inside a loop is not supported. ' + 'Learn more at https://fb.me/rules-of-hooks' : '') : void 0;
1444
+
1431
1445
  // TODO: add a more generic warning for invalid values.
1432
1446
  if (Context._context !== undefined) {
1433
1447
  var realContext = Context._context;
@@ -1440,7 +1454,7 @@ function useContext(Context, observedBits) {
1440
1454
  }
1441
1455
  }
1442
1456
  }
1443
- return dispatcher.useContext(Context, observedBits);
1457
+ return dispatcher.useContext(Context, unstable_observedBits);
1444
1458
  }
1445
1459
 
1446
1460
  function useState(initialState) {
@@ -1448,9 +1462,9 @@ function useState(initialState) {
1448
1462
  return dispatcher.useState(initialState);
1449
1463
  }
1450
1464
 
1451
- function useReducer(reducer, initialState, initialAction) {
1465
+ function useReducer(reducer, initialArg, init) {
1452
1466
  var dispatcher = resolveDispatcher();
1453
- return dispatcher.useReducer(reducer, initialState, initialAction);
1467
+ return dispatcher.useReducer(reducer, initialArg, init);
1454
1468
  }
1455
1469
 
1456
1470
  function useRef(initialValue) {
@@ -1463,11 +1477,6 @@ function useEffect(create, inputs) {
1463
1477
  return dispatcher.useEffect(create, inputs);
1464
1478
  }
1465
1479
 
1466
- function useMutationEffect(create, inputs) {
1467
- var dispatcher = resolveDispatcher();
1468
- return dispatcher.useMutationEffect(create, inputs);
1469
- }
1470
-
1471
1480
  function useLayoutEffect(create, inputs) {
1472
1481
  var dispatcher = resolveDispatcher();
1473
1482
  return dispatcher.useLayoutEffect(create, inputs);
@@ -1483,9 +1492,16 @@ function useMemo(create, inputs) {
1483
1492
  return dispatcher.useMemo(create, inputs);
1484
1493
  }
1485
1494
 
1486
- function useImperativeMethods(ref, create, inputs) {
1495
+ function useImperativeHandle(ref, create, inputs) {
1487
1496
  var dispatcher = resolveDispatcher();
1488
- return dispatcher.useImperativeMethods(ref, create, inputs);
1497
+ return dispatcher.useImperativeHandle(ref, create, inputs);
1498
+ }
1499
+
1500
+ function useDebugValue(value, formatterFn) {
1501
+ {
1502
+ var dispatcher = resolveDispatcher();
1503
+ return dispatcher.useDebugValue(value, formatterFn);
1504
+ }
1489
1505
  }
1490
1506
 
1491
1507
  /**
@@ -1574,7 +1590,7 @@ function validateExplicitKey(element, parentType) {
1574
1590
 
1575
1591
  setCurrentlyValidatingElement(element);
1576
1592
  {
1577
- warning$1(false, 'Each child in an array or iterator should have a unique "key" prop.' + '%s%s See https://fb.me/react-warning-keys for more information.', currentComponentErrorInfo, childOwner);
1593
+ warning$1(false, 'Each child in a list should have a unique "key" prop.' + '%s%s See https://fb.me/react-warning-keys for more information.', currentComponentErrorInfo, childOwner);
1578
1594
  }
1579
1595
  setCurrentlyValidatingElement(null);
1580
1596
  }
@@ -1630,16 +1646,17 @@ function validateChildKeys(node, parentType) {
1630
1646
  */
1631
1647
  function validatePropTypes(element) {
1632
1648
  var type = element.type;
1633
- var name = void 0,
1634
- propTypes = void 0;
1649
+ if (type === null || type === undefined || typeof type === 'string') {
1650
+ return;
1651
+ }
1652
+ var name = getComponentName(type);
1653
+ var propTypes = void 0;
1635
1654
  if (typeof type === 'function') {
1636
- // Class or function component
1637
- name = type.displayName || type.name;
1638
1655
  propTypes = type.propTypes;
1639
- } else if (typeof type === 'object' && type !== null && type.$$typeof === REACT_FORWARD_REF_TYPE) {
1640
- // ForwardRef
1641
- var functionName = type.render.displayName || type.render.name || '';
1642
- name = type.displayName || (functionName !== '' ? 'ForwardRef(' + functionName + ')' : 'ForwardRef');
1656
+ } else if (typeof type === 'object' && (type.$$typeof === REACT_FORWARD_REF_TYPE ||
1657
+ // Note: Memo only checks outer props here.
1658
+ // Inner props are checked in the reconciler.
1659
+ type.$$typeof === REACT_MEMO_TYPE)) {
1643
1660
  propTypes = type.propTypes;
1644
1661
  } else {
1645
1662
  return;
@@ -1770,6 +1787,45 @@ function cloneElementWithValidation(element, props, children) {
1770
1787
  return newElement;
1771
1788
  }
1772
1789
 
1790
+ // Helps identify side effects in begin-phase lifecycle hooks and setState reducers:
1791
+
1792
+
1793
+ // In some cases, StrictMode should also double-render lifecycles.
1794
+ // This can be confusing for tests though,
1795
+ // And it can be bad for performance in production.
1796
+ // This feature flag can be used to control the behavior:
1797
+
1798
+
1799
+ // To preserve the "Pause on caught exceptions" behavior of the debugger, we
1800
+ // replay the begin phase of a failed component inside invokeGuardedCallback.
1801
+
1802
+
1803
+ // Warn about deprecated, async-unsafe lifecycles; relates to RFC #6:
1804
+
1805
+
1806
+ // Gather advanced timing metrics for Profiler subtrees.
1807
+
1808
+
1809
+ // Trace which interactions trigger each commit.
1810
+
1811
+
1812
+ // Only used in www builds.
1813
+ // TODO: true? Here it might just be false.
1814
+
1815
+ // Only used in www builds.
1816
+
1817
+
1818
+ // Only used in www builds.
1819
+
1820
+
1821
+ // React Fire: prevent the value and checked attributes from syncing
1822
+ // with their related DOM properties
1823
+
1824
+
1825
+ // These APIs will no longer be "unstable" in the upcoming 16.7 release,
1826
+ // Control this behavior with a flag to support 16.6 minor releases in the meanwhile.
1827
+ var enableStableConcurrentModeAPIs = false;
1828
+
1773
1829
  var React = {
1774
1830
  Children: {
1775
1831
  map: mapChildren,
@@ -1788,6 +1844,17 @@ var React = {
1788
1844
  lazy: lazy,
1789
1845
  memo: memo,
1790
1846
 
1847
+ useCallback: useCallback,
1848
+ useContext: useContext,
1849
+ useEffect: useEffect,
1850
+ useImperativeHandle: useImperativeHandle,
1851
+ useDebugValue: useDebugValue,
1852
+ useLayoutEffect: useLayoutEffect,
1853
+ useMemo: useMemo,
1854
+ useReducer: useReducer,
1855
+ useRef: useRef,
1856
+ useState: useState,
1857
+
1791
1858
  Fragment: REACT_FRAGMENT_TYPE,
1792
1859
  StrictMode: REACT_STRICT_MODE_TYPE,
1793
1860
  Suspense: REACT_SUSPENSE_TYPE,
@@ -1799,28 +1866,22 @@ var React = {
1799
1866
 
1800
1867
  version: ReactVersion,
1801
1868
 
1869
+ unstable_ConcurrentMode: REACT_CONCURRENT_MODE_TYPE,
1870
+ unstable_Profiler: REACT_PROFILER_TYPE,
1871
+
1802
1872
  __SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED: ReactSharedInternals
1803
1873
  };
1804
1874
 
1875
+ // Note: some APIs are added with feature flags.
1876
+ // Make sure that stable builds for open source
1877
+ // don't modify the React object to avoid deopts.
1878
+ // Also let's not expose their names in stable builds.
1879
+
1805
1880
  if (enableStableConcurrentModeAPIs) {
1806
1881
  React.ConcurrentMode = REACT_CONCURRENT_MODE_TYPE;
1807
1882
  React.Profiler = REACT_PROFILER_TYPE;
1808
- } else {
1809
- React.unstable_ConcurrentMode = REACT_CONCURRENT_MODE_TYPE;
1810
- React.unstable_Profiler = REACT_PROFILER_TYPE;
1811
- }
1812
-
1813
- if (enableHooks) {
1814
- React.useCallback = useCallback;
1815
- React.useContext = useContext;
1816
- React.useEffect = useEffect;
1817
- React.useImperativeMethods = useImperativeMethods;
1818
- React.useLayoutEffect = useLayoutEffect;
1819
- React.useMemo = useMemo;
1820
- React.useMutationEffect = useMutationEffect;
1821
- React.useReducer = useReducer;
1822
- React.useRef = useRef;
1823
- React.useState = useState;
1883
+ React.unstable_ConcurrentMode = undefined;
1884
+ React.unstable_Profiler = undefined;
1824
1885
  }
1825
1886
 
1826
1887
 
@@ -1,4 +1,4 @@
1
- /** @license React v16.7.0-alpha.2
1
+ /** @license React v16.8.0
2
2
  * react.production.min.js
3
3
  *
4
4
  * Copyright (c) Facebook, Inc. and its affiliates.
@@ -7,19 +7,19 @@
7
7
  * LICENSE file in the root directory of this source tree.
8
8
  */
9
9
 
10
- 'use strict';var k=require("object-assign"),l="function"===typeof Symbol&&Symbol.for,p=l?Symbol.for("react.element"):60103,q=l?Symbol.for("react.portal"):60106,r=l?Symbol.for("react.fragment"):60107,t=l?Symbol.for("react.strict_mode"):60108,u=l?Symbol.for("react.profiler"):60114,v=l?Symbol.for("react.provider"):60109,w=l?Symbol.for("react.context"):60110,x=l?Symbol.for("react.concurrent_mode"):60111,y=l?Symbol.for("react.forward_ref"):60112,z=l?Symbol.for("react.suspense"):60113,A=l?Symbol.for("react.memo"):
11
- 60115,aa=l?Symbol.for("react.lazy"):60116,B="function"===typeof Symbol&&Symbol.iterator;function ba(a,b,d,c,e,g,h,f){if(!a){a=void 0;if(void 0===b)a=Error("Minified exception occurred; use the non-minified dev environment for the full error message and additional helpful warnings.");else{var m=[d,c,e,g,h,f],n=0;a=Error(b.replace(/%s/g,function(){return m[n++]}));a.name="Invariant Violation"}a.framesToPop=1;throw a;}}
12
- function C(a){for(var b=arguments.length-1,d="https://reactjs.org/docs/error-decoder.html?invariant="+a,c=0;c<b;c++)d+="&args[]="+encodeURIComponent(arguments[c+1]);ba(!1,"Minified React error #"+a+"; visit %s for the full message or use the non-minified dev environment for full errors and additional helpful warnings. ",d)}var D={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},E={};
13
- function F(a,b,d){this.props=a;this.context=b;this.refs=E;this.updater=d||D}F.prototype.isReactComponent={};F.prototype.setState=function(a,b){"object"!==typeof a&&"function"!==typeof a&&null!=a?C("85"):void 0;this.updater.enqueueSetState(this,a,b,"setState")};F.prototype.forceUpdate=function(a){this.updater.enqueueForceUpdate(this,a,"forceUpdate")};function G(){}G.prototype=F.prototype;function H(a,b,d){this.props=a;this.context=b;this.refs=E;this.updater=d||D}var I=H.prototype=new G;
14
- I.constructor=H;k(I,F.prototype);I.isPureReactComponent=!0;var J={current:null,currentDispatcher:null},K=Object.prototype.hasOwnProperty,L={key:!0,ref:!0,__self:!0,__source:!0};
15
- function M(a,b,d){var c=void 0,e={},g=null,h=null;if(null!=b)for(c in void 0!==b.ref&&(h=b.ref),void 0!==b.key&&(g=""+b.key),b)K.call(b,c)&&!L.hasOwnProperty(c)&&(e[c]=b[c]);var f=arguments.length-2;if(1===f)e.children=d;else if(1<f){for(var m=Array(f),n=0;n<f;n++)m[n]=arguments[n+2];e.children=m}if(a&&a.defaultProps)for(c in f=a.defaultProps,f)void 0===e[c]&&(e[c]=f[c]);return{$$typeof:p,type:a,key:g,ref:h,props:e,_owner:J.current}}
16
- function ca(a,b){return{$$typeof:p,type:a.type,key:b,ref:a.ref,props:a.props,_owner:a._owner}}function N(a){return"object"===typeof a&&null!==a&&a.$$typeof===p}function escape(a){var b={"=":"=0",":":"=2"};return"$"+(""+a).replace(/[=:]/g,function(a){return b[a]})}var O=/\/+/g,P=[];function Q(a,b,d,c){if(P.length){var e=P.pop();e.result=a;e.keyPrefix=b;e.func=d;e.context=c;e.count=0;return e}return{result:a,keyPrefix:b,func:d,context:c,count:0}}
10
+ 'use strict';var k=require("object-assign"),n="function"===typeof Symbol&&Symbol.for,p=n?Symbol.for("react.element"):60103,q=n?Symbol.for("react.portal"):60106,r=n?Symbol.for("react.fragment"):60107,t=n?Symbol.for("react.strict_mode"):60108,u=n?Symbol.for("react.profiler"):60114,v=n?Symbol.for("react.provider"):60109,w=n?Symbol.for("react.context"):60110,x=n?Symbol.for("react.concurrent_mode"):60111,y=n?Symbol.for("react.forward_ref"):60112,z=n?Symbol.for("react.suspense"):60113,aa=n?Symbol.for("react.memo"):
11
+ 60115,ba=n?Symbol.for("react.lazy"):60116,A="function"===typeof Symbol&&Symbol.iterator;function ca(a,b,d,c,e,g,h,f){if(!a){a=void 0;if(void 0===b)a=Error("Minified exception occurred; use the non-minified dev environment for the full error message and additional helpful warnings.");else{var l=[d,c,e,g,h,f],m=0;a=Error(b.replace(/%s/g,function(){return l[m++]}));a.name="Invariant Violation"}a.framesToPop=1;throw a;}}
12
+ function B(a){for(var b=arguments.length-1,d="https://reactjs.org/docs/error-decoder.html?invariant="+a,c=0;c<b;c++)d+="&args[]="+encodeURIComponent(arguments[c+1]);ca(!1,"Minified React error #"+a+"; visit %s for the full message or use the non-minified dev environment for full errors and additional helpful warnings. ",d)}var C={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},D={};
13
+ function E(a,b,d){this.props=a;this.context=b;this.refs=D;this.updater=d||C}E.prototype.isReactComponent={};E.prototype.setState=function(a,b){"object"!==typeof a&&"function"!==typeof a&&null!=a?B("85"):void 0;this.updater.enqueueSetState(this,a,b,"setState")};E.prototype.forceUpdate=function(a){this.updater.enqueueForceUpdate(this,a,"forceUpdate")};function F(){}F.prototype=E.prototype;function G(a,b,d){this.props=a;this.context=b;this.refs=D;this.updater=d||C}var H=G.prototype=new F;
14
+ H.constructor=G;k(H,E.prototype);H.isPureReactComponent=!0;var I={current:null},J={current:null},K=Object.prototype.hasOwnProperty,L={key:!0,ref:!0,__self:!0,__source:!0};
15
+ function M(a,b,d){var c=void 0,e={},g=null,h=null;if(null!=b)for(c in void 0!==b.ref&&(h=b.ref),void 0!==b.key&&(g=""+b.key),b)K.call(b,c)&&!L.hasOwnProperty(c)&&(e[c]=b[c]);var f=arguments.length-2;if(1===f)e.children=d;else if(1<f){for(var l=Array(f),m=0;m<f;m++)l[m]=arguments[m+2];e.children=l}if(a&&a.defaultProps)for(c in f=a.defaultProps,f)void 0===e[c]&&(e[c]=f[c]);return{$$typeof:p,type:a,key:g,ref:h,props:e,_owner:J.current}}
16
+ function da(a,b){return{$$typeof:p,type:a.type,key:b,ref:a.ref,props:a.props,_owner:a._owner}}function N(a){return"object"===typeof a&&null!==a&&a.$$typeof===p}function escape(a){var b={"=":"=0",":":"=2"};return"$"+(""+a).replace(/[=:]/g,function(a){return b[a]})}var O=/\/+/g,P=[];function Q(a,b,d,c){if(P.length){var e=P.pop();e.result=a;e.keyPrefix=b;e.func=d;e.context=c;e.count=0;return e}return{result:a,keyPrefix:b,func:d,context:c,count:0}}
17
17
  function R(a){a.result=null;a.keyPrefix=null;a.func=null;a.context=null;a.count=0;10>P.length&&P.push(a)}
18
- function S(a,b,d,c){var e=typeof a;if("undefined"===e||"boolean"===e)a=null;var g=!1;if(null===a)g=!0;else switch(e){case "string":case "number":g=!0;break;case "object":switch(a.$$typeof){case p:case q:g=!0}}if(g)return d(c,a,""===b?"."+T(a,0):b),1;g=0;b=""===b?".":b+":";if(Array.isArray(a))for(var h=0;h<a.length;h++){e=a[h];var f=b+T(e,h);g+=S(e,f,d,c)}else if(null===a||"object"!==typeof a?f=null:(f=B&&a[B]||a["@@iterator"],f="function"===typeof f?f:null),"function"===typeof f)for(a=f.call(a),h=
19
- 0;!(e=a.next()).done;)e=e.value,f=b+T(e,h++),g+=S(e,f,d,c);else"object"===e&&(d=""+a,C("31","[object Object]"===d?"object with keys {"+Object.keys(a).join(", ")+"}":d,""));return g}function U(a,b,d){return null==a?0:S(a,"",b,d)}function T(a,b){return"object"===typeof a&&null!==a&&null!=a.key?escape(a.key):b.toString(36)}function da(a,b){a.func.call(a.context,b,a.count++)}
20
- function ea(a,b,d){var c=a.result,e=a.keyPrefix;a=a.func.call(a.context,b,a.count++);Array.isArray(a)?V(a,c,d,function(a){return a}):null!=a&&(N(a)&&(a=ca(a,e+(!a.key||b&&b.key===a.key?"":(""+a.key).replace(O,"$&/")+"/")+d)),c.push(a))}function V(a,b,d,c,e){var g="";null!=d&&(g=(""+d).replace(O,"$&/")+"/");b=Q(b,g,c,e);U(a,ea,b);R(b)}function W(){var a=J.currentDispatcher;null===a?C("298"):void 0;return a}
21
- var X={Children:{map:function(a,b,d){if(null==a)return a;var c=[];V(a,c,null,b,d);return c},forEach:function(a,b,d){if(null==a)return a;b=Q(null,null,b,d);U(a,da,b);R(b)},count:function(a){return U(a,function(){return null},null)},toArray:function(a){var b=[];V(a,b,null,function(a){return a});return b},only:function(a){N(a)?void 0:C("143");return a}},createRef:function(){return{current:null}},Component:F,PureComponent:H,createContext:function(a,b){void 0===b&&(b=null);a={$$typeof:w,_calculateChangedBits:b,
22
- _currentValue:a,_currentValue2:a,_threadCount:0,Provider:null,Consumer:null};a.Provider={$$typeof:v,_context:a};return a.Consumer=a},forwardRef:function(a){return{$$typeof:y,render:a}},lazy:function(a){return{$$typeof:aa,_ctor:a,_status:-1,_result:null}},memo:function(a,b){return{$$typeof:A,type:a,compare:void 0===b?null:b}},Fragment:r,StrictMode:t,Suspense:z,createElement:M,cloneElement:function(a,b,d){null===a||void 0===a?C("267",a):void 0;var c=void 0,e=k({},a.props),g=a.key,h=a.ref,f=a._owner;
23
- if(null!=b){void 0!==b.ref&&(h=b.ref,f=J.current);void 0!==b.key&&(g=""+b.key);var m=void 0;a.type&&a.type.defaultProps&&(m=a.type.defaultProps);for(c in b)K.call(b,c)&&!L.hasOwnProperty(c)&&(e[c]=void 0===b[c]&&void 0!==m?m[c]:b[c])}c=arguments.length-2;if(1===c)e.children=d;else if(1<c){m=Array(c);for(var n=0;n<c;n++)m[n]=arguments[n+2];e.children=m}return{$$typeof:p,type:a.type,key:g,ref:h,props:e,_owner:f}},createFactory:function(a){var b=M.bind(null,a);b.type=a;return b},isValidElement:N,version:"16.7.0-alpha.2",
24
- __SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED:{ReactCurrentOwner:J,assign:k}};X.ConcurrentMode=x;X.Profiler=u;X.useCallback=function(a,b){return W().useCallback(a,b)};X.useContext=function(a,b){return W().useContext(a,b)};X.useEffect=function(a,b){return W().useEffect(a,b)};X.useImperativeMethods=function(a,b,d){return W().useImperativeMethods(a,b,d)};X.useLayoutEffect=function(a,b){return W().useLayoutEffect(a,b)};X.useMemo=function(a,b){return W().useMemo(a,b)};
25
- X.useMutationEffect=function(a,b){return W().useMutationEffect(a,b)};X.useReducer=function(a,b,d){return W().useReducer(a,b,d)};X.useRef=function(a){return W().useRef(a)};X.useState=function(a){return W().useState(a)};var Y={default:X},Z=Y&&X||Y;module.exports=Z.default||Z;
18
+ function S(a,b,d,c){var e=typeof a;if("undefined"===e||"boolean"===e)a=null;var g=!1;if(null===a)g=!0;else switch(e){case "string":case "number":g=!0;break;case "object":switch(a.$$typeof){case p:case q:g=!0}}if(g)return d(c,a,""===b?"."+T(a,0):b),1;g=0;b=""===b?".":b+":";if(Array.isArray(a))for(var h=0;h<a.length;h++){e=a[h];var f=b+T(e,h);g+=S(e,f,d,c)}else if(null===a||"object"!==typeof a?f=null:(f=A&&a[A]||a["@@iterator"],f="function"===typeof f?f:null),"function"===typeof f)for(a=f.call(a),h=
19
+ 0;!(e=a.next()).done;)e=e.value,f=b+T(e,h++),g+=S(e,f,d,c);else"object"===e&&(d=""+a,B("31","[object Object]"===d?"object with keys {"+Object.keys(a).join(", ")+"}":d,""));return g}function U(a,b,d){return null==a?0:S(a,"",b,d)}function T(a,b){return"object"===typeof a&&null!==a&&null!=a.key?escape(a.key):b.toString(36)}function ea(a,b){a.func.call(a.context,b,a.count++)}
20
+ function fa(a,b,d){var c=a.result,e=a.keyPrefix;a=a.func.call(a.context,b,a.count++);Array.isArray(a)?V(a,c,d,function(a){return a}):null!=a&&(N(a)&&(a=da(a,e+(!a.key||b&&b.key===a.key?"":(""+a.key).replace(O,"$&/")+"/")+d)),c.push(a))}function V(a,b,d,c,e){var g="";null!=d&&(g=(""+d).replace(O,"$&/")+"/");b=Q(b,g,c,e);U(a,fa,b);R(b)}function W(){var a=I.current;null===a?B("307"):void 0;return a}
21
+ var X={Children:{map:function(a,b,d){if(null==a)return a;var c=[];V(a,c,null,b,d);return c},forEach:function(a,b,d){if(null==a)return a;b=Q(null,null,b,d);U(a,ea,b);R(b)},count:function(a){return U(a,function(){return null},null)},toArray:function(a){var b=[];V(a,b,null,function(a){return a});return b},only:function(a){N(a)?void 0:B("143");return a}},createRef:function(){return{current:null}},Component:E,PureComponent:G,createContext:function(a,b){void 0===b&&(b=null);a={$$typeof:w,_calculateChangedBits:b,
22
+ _currentValue:a,_currentValue2:a,_threadCount:0,Provider:null,Consumer:null};a.Provider={$$typeof:v,_context:a};return a.Consumer=a},forwardRef:function(a){return{$$typeof:y,render:a}},lazy:function(a){return{$$typeof:ba,_ctor:a,_status:-1,_result:null}},memo:function(a,b){return{$$typeof:aa,type:a,compare:void 0===b?null:b}},useCallback:function(a,b){return W().useCallback(a,b)},useContext:function(a,b){return W().useContext(a,b)},useEffect:function(a,b){return W().useEffect(a,b)},useImperativeHandle:function(a,
23
+ b,d){return W().useImperativeHandle(a,b,d)},useDebugValue:function(){},useLayoutEffect:function(a,b){return W().useLayoutEffect(a,b)},useMemo:function(a,b){return W().useMemo(a,b)},useReducer:function(a,b,d){return W().useReducer(a,b,d)},useRef:function(a){return W().useRef(a)},useState:function(a){return W().useState(a)},Fragment:r,StrictMode:t,Suspense:z,createElement:M,cloneElement:function(a,b,d){null===a||void 0===a?B("267",a):void 0;var c=void 0,e=k({},a.props),g=a.key,h=a.ref,f=a._owner;if(null!=
24
+ b){void 0!==b.ref&&(h=b.ref,f=J.current);void 0!==b.key&&(g=""+b.key);var l=void 0;a.type&&a.type.defaultProps&&(l=a.type.defaultProps);for(c in b)K.call(b,c)&&!L.hasOwnProperty(c)&&(e[c]=void 0===b[c]&&void 0!==l?l[c]:b[c])}c=arguments.length-2;if(1===c)e.children=d;else if(1<c){l=Array(c);for(var m=0;m<c;m++)l[m]=arguments[m+2];e.children=l}return{$$typeof:p,type:a.type,key:g,ref:h,props:e,_owner:f}},createFactory:function(a){var b=M.bind(null,a);b.type=a;return b},isValidElement:N,version:"16.8.0",
25
+ unstable_ConcurrentMode:x,unstable_Profiler:u,__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED:{ReactCurrentDispatcher:I,ReactCurrentOwner:J,assign:k}},Y={default:X},Z=Y&&X||Y;module.exports=Z.default||Z;
package/package.json CHANGED
@@ -4,19 +4,24 @@
4
4
  "keywords": [
5
5
  "react"
6
6
  ],
7
- "version": "16.7.0-alpha.2",
7
+ "version": "16.8.0",
8
8
  "homepage": "https://reactjs.org/",
9
9
  "bugs": "https://github.com/facebook/react/issues",
10
10
  "license": "MIT",
11
11
  "files": [
12
12
  "LICENSE",
13
13
  "README.md",
14
+ "build-info.json",
14
15
  "index.js",
15
16
  "cjs/",
16
17
  "umd/"
17
18
  ],
18
19
  "main": "index.js",
19
- "repository": "facebook/react",
20
+ "repository": {
21
+ "type": "git",
22
+ "url": "https://github.com/facebook/react.git",
23
+ "directory": "packages/react"
24
+ },
20
25
  "engines": {
21
26
  "node": ">=0.10.0"
22
27
  },
@@ -24,7 +29,7 @@
24
29
  "loose-envify": "^1.1.0",
25
30
  "object-assign": "^4.1.1",
26
31
  "prop-types": "^15.6.2",
27
- "scheduler": "^0.12.0-alpha.2"
32
+ "scheduler": "^0.13.0"
28
33
  },
29
34
  "browserify": {
30
35
  "transform": [
@@ -1,4 +1,4 @@
1
- /** @license React v16.7.0-alpha.2
1
+ /** @license React v16.8.0
2
2
  * react.development.js
3
3
  *
4
4
  * Copyright (c) Facebook, Inc. and its affiliates.
@@ -17,7 +17,7 @@
17
17
 
18
18
  // TODO: this is special because it gets imported during build.
19
19
 
20
- var ReactVersion = '16.7.0-alpha.2';
20
+ var ReactVersion = '16.8.0';
21
21
 
22
22
  // The Symbol used to tag the ReactElement-like types. If there is no native Symbol
23
23
  // nor polyfill, then a plain number is used for performance.
@@ -51,43 +51,6 @@ function getIteratorFn(maybeIterable) {
51
51
  return null;
52
52
  }
53
53
 
54
- var enableHooks = true;
55
- // Helps identify side effects in begin-phase lifecycle hooks and setState reducers:
56
-
57
-
58
- // In some cases, StrictMode should also double-render lifecycles.
59
- // This can be confusing for tests though,
60
- // And it can be bad for performance in production.
61
- // This feature flag can be used to control the behavior:
62
-
63
-
64
- // To preserve the "Pause on caught exceptions" behavior of the debugger, we
65
- // replay the begin phase of a failed component inside invokeGuardedCallback.
66
-
67
-
68
- // Warn about deprecated, async-unsafe lifecycles; relates to RFC #6:
69
-
70
-
71
- // Gather advanced timing metrics for Profiler subtrees.
72
-
73
-
74
- // Trace which interactions trigger each commit.
75
- var enableSchedulerTracing = true;
76
-
77
- // Only used in www builds.
78
-
79
-
80
- // Only used in www builds.
81
-
82
-
83
- // React Fire: prevent the value and checked attributes from syncing
84
- // with their related DOM properties
85
-
86
-
87
- // These APIs will no longer be "unstable" in the upcoming 16.7 release,
88
- // Control this behavior with a flag to support 16.6 minor releases in the meanwhile.
89
- var enableStableConcurrentModeAPIs = true;
90
-
91
54
  /*
92
55
  object-assign
93
56
  (c) Sindre Sorhus
@@ -534,6 +497,8 @@ function createRef() {
534
497
  return refObject;
535
498
  }
536
499
 
500
+ var enableSchedulerDebugging = false;
501
+
537
502
  /* eslint-disable no-var */
538
503
 
539
504
  // TODO: Use symbols?
@@ -561,6 +526,9 @@ var IDLE_PRIORITY = maxSigned31BitInt;
561
526
  var firstCallbackNode = null;
562
527
 
563
528
  var currentDidTimeout = false;
529
+ // Pausing the scheduler is useful for debugging.
530
+ var isSchedulerPaused = false;
531
+
564
532
  var currentPriorityLevel = NormalPriority;
565
533
  var currentEventStartTime = -1;
566
534
  var currentExpirationTime = -1;
@@ -695,13 +663,20 @@ function flushImmediateWork() {
695
663
  }
696
664
 
697
665
  function flushWork(didTimeout) {
666
+ // Exit right away if we're currently paused
667
+
668
+ if (enableSchedulerDebugging && isSchedulerPaused) {
669
+ return;
670
+ }
671
+
698
672
  isExecutingCallback = true;
699
673
  var previousDidTimeout = currentDidTimeout;
700
674
  currentDidTimeout = didTimeout;
701
675
  try {
702
676
  if (didTimeout) {
703
677
  // Flush all the expired callbacks without yielding.
704
- while (firstCallbackNode !== null) {
678
+ while (firstCallbackNode !== null && !(enableSchedulerDebugging && isSchedulerPaused)) {
679
+ // TODO Wrap in feature flag
705
680
  // Read the current time. Flush all the callbacks that expire at or
706
681
  // earlier than that time. Then read the current time again and repeat.
707
682
  // This optimizes for as few performance.now calls as possible.
@@ -709,7 +684,7 @@ function flushWork(didTimeout) {
709
684
  if (firstCallbackNode.expirationTime <= currentTime) {
710
685
  do {
711
686
  flushFirstCallback();
712
- } while (firstCallbackNode !== null && firstCallbackNode.expirationTime <= currentTime);
687
+ } while (firstCallbackNode !== null && firstCallbackNode.expirationTime <= currentTime && !(enableSchedulerDebugging && isSchedulerPaused));
713
688
  continue;
714
689
  }
715
690
  break;
@@ -718,6 +693,9 @@ function flushWork(didTimeout) {
718
693
  // Keep flushing callbacks until we run out of time in the frame.
719
694
  if (firstCallbackNode !== null) {
720
695
  do {
696
+ if (enableSchedulerDebugging && isSchedulerPaused) {
697
+ break;
698
+ }
721
699
  flushFirstCallback();
722
700
  } while (firstCallbackNode !== null && !shouldYieldToHost());
723
701
  }
@@ -856,6 +834,21 @@ function unstable_scheduleCallback(callback, deprecated_options) {
856
834
  return newNode;
857
835
  }
858
836
 
837
+ function unstable_pauseExecution() {
838
+ isSchedulerPaused = true;
839
+ }
840
+
841
+ function unstable_continueExecution() {
842
+ isSchedulerPaused = false;
843
+ if (firstCallbackNode !== null) {
844
+ ensureHostCallbackIsScheduled();
845
+ }
846
+ }
847
+
848
+ function unstable_getFirstCallbackNode() {
849
+ return firstCallbackNode;
850
+ }
851
+
859
852
  function unstable_cancelCallback(callbackNode) {
860
853
  var next = callbackNode.next;
861
854
  if (next === null) {
@@ -951,41 +944,45 @@ var requestHostCallback;
951
944
  var cancelHostCallback;
952
945
  var shouldYieldToHost;
953
946
 
954
- if (typeof window !== 'undefined' && window._schedMock) {
947
+ var globalValue = null;
948
+ if (typeof window !== 'undefined') {
949
+ globalValue = window;
950
+ } else if (typeof global !== 'undefined') {
951
+ globalValue = global;
952
+ }
953
+
954
+ if (globalValue && globalValue._schedMock) {
955
955
  // Dynamic injection, only for testing purposes.
956
- var impl = window._schedMock;
957
- requestHostCallback = impl[0];
958
- cancelHostCallback = impl[1];
959
- shouldYieldToHost = impl[2];
956
+ var globalImpl = globalValue._schedMock;
957
+ requestHostCallback = globalImpl[0];
958
+ cancelHostCallback = globalImpl[1];
959
+ shouldYieldToHost = globalImpl[2];
960
+ getCurrentTime = globalImpl[3];
960
961
  } else if (
961
962
  // If Scheduler runs in a non-DOM environment, it falls back to a naive
962
963
  // implementation using setTimeout.
963
964
  typeof window === 'undefined' ||
964
- // "addEventListener" might not be available on the window object
965
- // if this is a mocked "window" object. So we need to validate that too.
966
- typeof window.addEventListener !== 'function') {
965
+ // Check if MessageChannel is supported, too.
966
+ typeof MessageChannel !== 'function') {
967
+ // If this accidentally gets imported in a non-browser environment, e.g. JavaScriptCore,
968
+ // fallback to a naive implementation.
967
969
  var _callback = null;
968
- var _currentTime = -1;
969
- var _flushCallback = function (didTimeout, ms) {
970
+ var _flushCallback = function (didTimeout) {
970
971
  if (_callback !== null) {
971
- var cb = _callback;
972
- _callback = null;
973
972
  try {
974
- _currentTime = ms;
975
- cb(didTimeout);
973
+ _callback(didTimeout);
976
974
  } finally {
977
- _currentTime = -1;
975
+ _callback = null;
978
976
  }
979
977
  }
980
978
  };
981
979
  requestHostCallback = function (cb, ms) {
982
- if (_currentTime !== -1) {
980
+ if (_callback !== null) {
983
981
  // Protect against re-entrancy.
984
- setTimeout(requestHostCallback, 0, cb, ms);
982
+ setTimeout(requestHostCallback, 0, cb);
985
983
  } else {
986
984
  _callback = cb;
987
- setTimeout(_flushCallback, ms, true, ms);
988
- setTimeout(_flushCallback, maxSigned31BitInt, false, maxSigned31BitInt);
985
+ setTimeout(_flushCallback, 0, false);
989
986
  }
990
987
  };
991
988
  cancelHostCallback = function () {
@@ -994,9 +991,6 @@ typeof window.addEventListener !== 'function') {
994
991
  shouldYieldToHost = function () {
995
992
  return false;
996
993
  };
997
- getCurrentTime = function () {
998
- return _currentTime === -1 ? 0 : _currentTime;
999
- };
1000
994
  } else {
1001
995
  if (typeof console !== 'undefined') {
1002
996
  // TODO: Remove fb.me link
@@ -1028,12 +1022,9 @@ typeof window.addEventListener !== 'function') {
1028
1022
  };
1029
1023
 
1030
1024
  // We use the postMessage trick to defer idle work until after the repaint.
1031
- var messageKey = '__reactIdleCallback$' + Math.random().toString(36).slice(2);
1032
- var idleTick = function (event) {
1033
- if (event.source !== window || event.data !== messageKey) {
1034
- return;
1035
- }
1036
-
1025
+ var channel = new MessageChannel();
1026
+ var port = channel.port2;
1027
+ channel.port1.onmessage = function (event) {
1037
1028
  isMessageEventScheduled = false;
1038
1029
 
1039
1030
  var prevScheduledCallback = scheduledHostCallback;
@@ -1074,9 +1065,6 @@ typeof window.addEventListener !== 'function') {
1074
1065
  }
1075
1066
  }
1076
1067
  };
1077
- // Assumes that we have addEventListener in this environment. Might need
1078
- // something better for old IE.
1079
- window.addEventListener('message', idleTick, false);
1080
1068
 
1081
1069
  var animationTick = function (rafTime) {
1082
1070
  if (scheduledHostCallback !== null) {
@@ -1116,7 +1104,7 @@ typeof window.addEventListener !== 'function') {
1116
1104
  frameDeadline = rafTime + activeFrameTime;
1117
1105
  if (!isMessageEventScheduled) {
1118
1106
  isMessageEventScheduled = true;
1119
- window.postMessage(messageKey, '*');
1107
+ port.postMessage(undefined);
1120
1108
  }
1121
1109
  };
1122
1110
 
@@ -1125,7 +1113,7 @@ typeof window.addEventListener !== 'function') {
1125
1113
  timeoutTime = absoluteTimeout;
1126
1114
  if (isFlushingHostCallback || absoluteTimeout < 0) {
1127
1115
  // Don't wait for the next frame. Continue working ASAP, in a new event.
1128
- window.postMessage(messageKey, '*');
1116
+ port.postMessage(undefined);
1129
1117
  } else if (!isAnimationFrameScheduled) {
1130
1118
  // If rAF didn't already schedule one, we need to schedule a frame.
1131
1119
  // TODO: If this rAF doesn't materialize because the browser throttles, we
@@ -1143,6 +1131,45 @@ typeof window.addEventListener !== 'function') {
1143
1131
  };
1144
1132
  }
1145
1133
 
1134
+ // Helps identify side effects in begin-phase lifecycle hooks and setState reducers:
1135
+
1136
+
1137
+ // In some cases, StrictMode should also double-render lifecycles.
1138
+ // This can be confusing for tests though,
1139
+ // And it can be bad for performance in production.
1140
+ // This feature flag can be used to control the behavior:
1141
+
1142
+
1143
+ // To preserve the "Pause on caught exceptions" behavior of the debugger, we
1144
+ // replay the begin phase of a failed component inside invokeGuardedCallback.
1145
+
1146
+
1147
+ // Warn about deprecated, async-unsafe lifecycles; relates to RFC #6:
1148
+
1149
+
1150
+ // Gather advanced timing metrics for Profiler subtrees.
1151
+
1152
+
1153
+ // Trace which interactions trigger each commit.
1154
+ var enableSchedulerTracing = true;
1155
+
1156
+ // Only used in www builds.
1157
+ // TODO: true? Here it might just be false.
1158
+
1159
+ // Only used in www builds.
1160
+
1161
+
1162
+ // Only used in www builds.
1163
+
1164
+
1165
+ // React Fire: prevent the value and checked attributes from syncing
1166
+ // with their related DOM properties
1167
+
1168
+
1169
+ // These APIs will no longer be "unstable" in the upcoming 16.7 release,
1170
+ // Control this behavior with a flag to support 16.6 minor releases in the meanwhile.
1171
+ var enableStableConcurrentModeAPIs = false;
1172
+
1146
1173
  var DEFAULT_THREAD_ID = 0;
1147
1174
 
1148
1175
  // Counters used to generate unique IDs.
@@ -1500,6 +1527,17 @@ function onWorkCanceled(interactions, threadID) {
1500
1527
  }
1501
1528
  }
1502
1529
 
1530
+ /**
1531
+ * Keeps track of the current dispatcher.
1532
+ */
1533
+ var ReactCurrentDispatcher = {
1534
+ /**
1535
+ * @internal
1536
+ * @type {ReactComponent}
1537
+ */
1538
+ current: null
1539
+ };
1540
+
1503
1541
  /**
1504
1542
  * Keeps track of the current owner.
1505
1543
  *
@@ -1511,8 +1549,7 @@ var ReactCurrentOwner = {
1511
1549
  * @internal
1512
1550
  * @type {ReactComponent}
1513
1551
  */
1514
- current: null,
1515
- currentDispatcher: null
1552
+ current: null
1516
1553
  };
1517
1554
 
1518
1555
  var BEFORE_SLASH_RE = /^(.*)[\\\/]/;
@@ -1643,6 +1680,7 @@ function setCurrentlyValidatingElement(element) {
1643
1680
  }
1644
1681
 
1645
1682
  var ReactSharedInternals = {
1683
+ ReactCurrentDispatcher: ReactCurrentDispatcher,
1646
1684
  ReactCurrentOwner: ReactCurrentOwner,
1647
1685
  // Used by renderers to avoid bundling object-assign twice in UMD bundles:
1648
1686
  assign: objectAssign
@@ -1662,6 +1700,9 @@ var ReactSharedInternals = {
1662
1700
  unstable_scheduleCallback: unstable_scheduleCallback,
1663
1701
  unstable_runWithPriority: unstable_runWithPriority,
1664
1702
  unstable_wrapCallback: unstable_wrapCallback,
1703
+ unstable_getFirstCallbackNode: unstable_getFirstCallbackNode,
1704
+ unstable_pauseExecution: unstable_pauseExecution,
1705
+ unstable_continueExecution: unstable_continueExecution,
1665
1706
  unstable_getCurrentPriorityLevel: unstable_getCurrentPriorityLevel
1666
1707
  },
1667
1708
  SchedulerTracing: {
@@ -2452,13 +2493,51 @@ function createContext(defaultValue, calculateChangedBits) {
2452
2493
  }
2453
2494
 
2454
2495
  function lazy(ctor) {
2455
- return {
2496
+ var lazyType = {
2456
2497
  $$typeof: REACT_LAZY_TYPE,
2457
2498
  _ctor: ctor,
2458
2499
  // React uses these fields to store the result.
2459
2500
  _status: -1,
2460
2501
  _result: null
2461
2502
  };
2503
+
2504
+ {
2505
+ // In production, this would just set it on the object.
2506
+ var defaultProps = void 0;
2507
+ var propTypes = void 0;
2508
+ Object.defineProperties(lazyType, {
2509
+ defaultProps: {
2510
+ configurable: true,
2511
+ get: function () {
2512
+ return defaultProps;
2513
+ },
2514
+ set: function (newDefaultProps) {
2515
+ warning$1(false, 'React.lazy(...): It is not supported to assign `defaultProps` to ' + 'a lazy component import. Either specify them where the component ' + 'is defined, or create a wrapping component around it.');
2516
+ defaultProps = newDefaultProps;
2517
+ // Match production behavior more closely:
2518
+ Object.defineProperty(lazyType, 'defaultProps', {
2519
+ enumerable: true
2520
+ });
2521
+ }
2522
+ },
2523
+ propTypes: {
2524
+ configurable: true,
2525
+ get: function () {
2526
+ return propTypes;
2527
+ },
2528
+ set: function (newPropTypes) {
2529
+ warning$1(false, 'React.lazy(...): It is not supported to assign `propTypes` to ' + 'a lazy component import. Either specify them where the component ' + 'is defined, or create a wrapping component around it.');
2530
+ propTypes = newPropTypes;
2531
+ // Match production behavior more closely:
2532
+ Object.defineProperty(lazyType, 'propTypes', {
2533
+ enumerable: true
2534
+ });
2535
+ }
2536
+ }
2537
+ });
2538
+ }
2539
+
2540
+ return lazyType;
2462
2541
  }
2463
2542
 
2464
2543
  function forwardRef(render) {
@@ -2504,14 +2583,16 @@ function memo(type, compare) {
2504
2583
  }
2505
2584
 
2506
2585
  function resolveDispatcher() {
2507
- var dispatcher = ReactCurrentOwner.currentDispatcher;
2508
- !(dispatcher !== null) ? invariant(false, 'Hooks can only be called inside the body of a function component.') : void 0;
2586
+ var dispatcher = ReactCurrentDispatcher.current;
2587
+ !(dispatcher !== null) ? invariant(false, 'Hooks can only be called inside the body of a function component. (https://fb.me/react-invalid-hook-call)') : void 0;
2509
2588
  return dispatcher;
2510
2589
  }
2511
2590
 
2512
- function useContext(Context, observedBits) {
2591
+ function useContext(Context, unstable_observedBits) {
2513
2592
  var dispatcher = resolveDispatcher();
2514
2593
  {
2594
+ !(unstable_observedBits === undefined) ? warning$1(false, 'useContext() second argument is reserved for future ' + 'use in React. Passing it is not supported. ' + 'You passed: %s.%s', unstable_observedBits, typeof unstable_observedBits === 'number' && Array.isArray(arguments[2]) ? '\n\nDid you call array.map(useContext)? ' + 'Calling Hooks inside a loop is not supported. ' + 'Learn more at https://fb.me/rules-of-hooks' : '') : void 0;
2595
+
2515
2596
  // TODO: add a more generic warning for invalid values.
2516
2597
  if (Context._context !== undefined) {
2517
2598
  var realContext = Context._context;
@@ -2524,7 +2605,7 @@ function useContext(Context, observedBits) {
2524
2605
  }
2525
2606
  }
2526
2607
  }
2527
- return dispatcher.useContext(Context, observedBits);
2608
+ return dispatcher.useContext(Context, unstable_observedBits);
2528
2609
  }
2529
2610
 
2530
2611
  function useState(initialState) {
@@ -2532,9 +2613,9 @@ function useState(initialState) {
2532
2613
  return dispatcher.useState(initialState);
2533
2614
  }
2534
2615
 
2535
- function useReducer(reducer, initialState, initialAction) {
2616
+ function useReducer(reducer, initialArg, init) {
2536
2617
  var dispatcher = resolveDispatcher();
2537
- return dispatcher.useReducer(reducer, initialState, initialAction);
2618
+ return dispatcher.useReducer(reducer, initialArg, init);
2538
2619
  }
2539
2620
 
2540
2621
  function useRef(initialValue) {
@@ -2547,11 +2628,6 @@ function useEffect(create, inputs) {
2547
2628
  return dispatcher.useEffect(create, inputs);
2548
2629
  }
2549
2630
 
2550
- function useMutationEffect(create, inputs) {
2551
- var dispatcher = resolveDispatcher();
2552
- return dispatcher.useMutationEffect(create, inputs);
2553
- }
2554
-
2555
2631
  function useLayoutEffect(create, inputs) {
2556
2632
  var dispatcher = resolveDispatcher();
2557
2633
  return dispatcher.useLayoutEffect(create, inputs);
@@ -2567,9 +2643,16 @@ function useMemo(create, inputs) {
2567
2643
  return dispatcher.useMemo(create, inputs);
2568
2644
  }
2569
2645
 
2570
- function useImperativeMethods(ref, create, inputs) {
2646
+ function useImperativeHandle(ref, create, inputs) {
2571
2647
  var dispatcher = resolveDispatcher();
2572
- return dispatcher.useImperativeMethods(ref, create, inputs);
2648
+ return dispatcher.useImperativeHandle(ref, create, inputs);
2649
+ }
2650
+
2651
+ function useDebugValue(value, formatterFn) {
2652
+ {
2653
+ var dispatcher = resolveDispatcher();
2654
+ return dispatcher.useDebugValue(value, formatterFn);
2655
+ }
2573
2656
  }
2574
2657
 
2575
2658
  /**
@@ -2763,7 +2846,7 @@ function validateExplicitKey(element, parentType) {
2763
2846
 
2764
2847
  setCurrentlyValidatingElement(element);
2765
2848
  {
2766
- warning$1(false, 'Each child in an array or iterator should have a unique "key" prop.' + '%s%s See https://fb.me/react-warning-keys for more information.', currentComponentErrorInfo, childOwner);
2849
+ warning$1(false, 'Each child in a list should have a unique "key" prop.' + '%s%s See https://fb.me/react-warning-keys for more information.', currentComponentErrorInfo, childOwner);
2767
2850
  }
2768
2851
  setCurrentlyValidatingElement(null);
2769
2852
  }
@@ -2819,16 +2902,17 @@ function validateChildKeys(node, parentType) {
2819
2902
  */
2820
2903
  function validatePropTypes(element) {
2821
2904
  var type = element.type;
2822
- var name = void 0,
2823
- propTypes = void 0;
2905
+ if (type === null || type === undefined || typeof type === 'string') {
2906
+ return;
2907
+ }
2908
+ var name = getComponentName(type);
2909
+ var propTypes = void 0;
2824
2910
  if (typeof type === 'function') {
2825
- // Class or function component
2826
- name = type.displayName || type.name;
2827
2911
  propTypes = type.propTypes;
2828
- } else if (typeof type === 'object' && type !== null && type.$$typeof === REACT_FORWARD_REF_TYPE) {
2829
- // ForwardRef
2830
- var functionName = type.render.displayName || type.render.name || '';
2831
- name = type.displayName || (functionName !== '' ? 'ForwardRef(' + functionName + ')' : 'ForwardRef');
2912
+ } else if (typeof type === 'object' && (type.$$typeof === REACT_FORWARD_REF_TYPE ||
2913
+ // Note: Memo only checks outer props here.
2914
+ // Inner props are checked in the reconciler.
2915
+ type.$$typeof === REACT_MEMO_TYPE)) {
2832
2916
  propTypes = type.propTypes;
2833
2917
  } else {
2834
2918
  return;
@@ -2977,6 +3061,17 @@ var React = {
2977
3061
  lazy: lazy,
2978
3062
  memo: memo,
2979
3063
 
3064
+ useCallback: useCallback,
3065
+ useContext: useContext,
3066
+ useEffect: useEffect,
3067
+ useImperativeHandle: useImperativeHandle,
3068
+ useDebugValue: useDebugValue,
3069
+ useLayoutEffect: useLayoutEffect,
3070
+ useMemo: useMemo,
3071
+ useReducer: useReducer,
3072
+ useRef: useRef,
3073
+ useState: useState,
3074
+
2980
3075
  Fragment: REACT_FRAGMENT_TYPE,
2981
3076
  StrictMode: REACT_STRICT_MODE_TYPE,
2982
3077
  Suspense: REACT_SUSPENSE_TYPE,
@@ -2988,28 +3083,22 @@ var React = {
2988
3083
 
2989
3084
  version: ReactVersion,
2990
3085
 
3086
+ unstable_ConcurrentMode: REACT_CONCURRENT_MODE_TYPE,
3087
+ unstable_Profiler: REACT_PROFILER_TYPE,
3088
+
2991
3089
  __SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED: ReactSharedInternals
2992
3090
  };
2993
3091
 
3092
+ // Note: some APIs are added with feature flags.
3093
+ // Make sure that stable builds for open source
3094
+ // don't modify the React object to avoid deopts.
3095
+ // Also let's not expose their names in stable builds.
3096
+
2994
3097
  if (enableStableConcurrentModeAPIs) {
2995
3098
  React.ConcurrentMode = REACT_CONCURRENT_MODE_TYPE;
2996
3099
  React.Profiler = REACT_PROFILER_TYPE;
2997
- } else {
2998
- React.unstable_ConcurrentMode = REACT_CONCURRENT_MODE_TYPE;
2999
- React.unstable_Profiler = REACT_PROFILER_TYPE;
3000
- }
3001
-
3002
- if (enableHooks) {
3003
- React.useCallback = useCallback;
3004
- React.useContext = useContext;
3005
- React.useEffect = useEffect;
3006
- React.useImperativeMethods = useImperativeMethods;
3007
- React.useLayoutEffect = useLayoutEffect;
3008
- React.useMemo = useMemo;
3009
- React.useMutationEffect = useMutationEffect;
3010
- React.useReducer = useReducer;
3011
- React.useRef = useRef;
3012
- React.useState = useState;
3100
+ React.unstable_ConcurrentMode = undefined;
3101
+ React.unstable_Profiler = undefined;
3013
3102
  }
3014
3103
 
3015
3104