react 16.5.1 → 16.6.0-alpha.f47a958

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.
@@ -1,4 +1,4 @@
1
- /** @license React v16.5.1
1
+ /** @license React v16.6.0-alpha.f47a958
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.5.1';
23
+ var ReactVersion = '16.6.0-alpha.f47a958';
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,9 +33,10 @@ 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
- var REACT_ASYNC_MODE_TYPE = hasSymbol ? Symbol.for('react.async_mode') : 0xeacf;
36
+ var REACT_CONCURRENT_MODE_TYPE = hasSymbol ? Symbol.for('react.concurrent_mode') : 0xeacf;
37
37
  var REACT_FORWARD_REF_TYPE = hasSymbol ? Symbol.for('react.forward_ref') : 0xead0;
38
38
  var REACT_PLACEHOLDER_TYPE = hasSymbol ? Symbol.for('react.placeholder') : 0xead1;
39
+ var REACT_PURE_TYPE = hasSymbol ? Symbol.for('react.pure') : 0xead3;
39
40
 
40
41
  var MAYBE_ITERATOR_SYMBOL = typeof Symbol === 'function' && Symbol.iterator;
41
42
  var FAUX_ITERATOR_SYMBOL = '@@iterator';
@@ -54,9 +55,6 @@ function getIteratorFn(maybeIterable) {
54
55
  // Exports ReactDOM.createRoot
55
56
 
56
57
 
57
- // Experimental error-boundary API that can recover from errors within a single
58
- // render phase
59
-
60
58
  // Suspense
61
59
  var enableSuspense = false;
62
60
  // Helps identify side effects in begin-phase lifecycle hooks and setState reducers:
@@ -75,13 +73,10 @@ var enableSuspense = false;
75
73
  // Warn about deprecated, async-unsafe lifecycles; relates to RFC #6:
76
74
 
77
75
 
78
- // Warn about legacy context API
79
-
80
-
81
76
  // Gather advanced timing metrics for Profiler subtrees.
82
77
 
83
78
 
84
- // Track which interactions trigger each commit.
79
+ // Trace which interactions trigger each commit.
85
80
 
86
81
 
87
82
  // Only used in www builds.
@@ -556,8 +551,8 @@ function getComponentName(type) {
556
551
  return type;
557
552
  }
558
553
  switch (type) {
559
- case REACT_ASYNC_MODE_TYPE:
560
- return 'AsyncMode';
554
+ case REACT_CONCURRENT_MODE_TYPE:
555
+ return 'ConcurrentMode';
561
556
  case REACT_FRAGMENT_TYPE:
562
557
  return 'Fragment';
563
558
  case REACT_PORTAL_TYPE:
@@ -1385,10 +1380,28 @@ function forwardRef(render) {
1385
1380
  };
1386
1381
  }
1387
1382
 
1383
+ function pure(render, compare) {
1384
+ {
1385
+ if (typeof render !== 'function') {
1386
+ warningWithoutStack$1(false, 'pure: The first argument must be a function component. Instead ' + 'received: %s', render === null ? 'null' : typeof render);
1387
+ } else {
1388
+ var prototype = render.prototype;
1389
+ if (prototype && prototype.isReactComponent) {
1390
+ warningWithoutStack$1(false, 'pure: The first argument must be a function component. Classes ' + 'are not supported. Use React.PureComponent instead.');
1391
+ }
1392
+ }
1393
+ }
1394
+ return {
1395
+ $$typeof: REACT_PURE_TYPE,
1396
+ render: render,
1397
+ compare: compare === undefined ? null : compare
1398
+ };
1399
+ }
1400
+
1388
1401
  function isValidElementType(type) {
1389
1402
  return typeof type === 'string' || typeof type === 'function' ||
1390
1403
  // Note: its typeof might be other than 'symbol' or 'number' if it's a polyfill.
1391
- type === REACT_FRAGMENT_TYPE || type === REACT_ASYNC_MODE_TYPE || type === REACT_PROFILER_TYPE || type === REACT_STRICT_MODE_TYPE || type === REACT_PLACEHOLDER_TYPE || typeof type === 'object' && type !== null && (typeof type.then === 'function' || type.$$typeof === REACT_PROVIDER_TYPE || type.$$typeof === REACT_CONTEXT_TYPE || type.$$typeof === REACT_FORWARD_REF_TYPE);
1404
+ type === REACT_FRAGMENT_TYPE || type === REACT_CONCURRENT_MODE_TYPE || type === REACT_PROFILER_TYPE || type === REACT_STRICT_MODE_TYPE || type === REACT_PLACEHOLDER_TYPE || typeof type === 'object' && type !== null && (typeof type.then === 'function' || type.$$typeof === REACT_PURE_TYPE || type.$$typeof === REACT_PROVIDER_TYPE || type.$$typeof === REACT_CONTEXT_TYPE || type.$$typeof === REACT_FORWARD_REF_TYPE);
1392
1405
  }
1393
1406
 
1394
1407
  /**
@@ -1536,7 +1549,7 @@ function validatePropTypes(element) {
1536
1549
  var name = void 0,
1537
1550
  propTypes = void 0;
1538
1551
  if (typeof type === 'function') {
1539
- // Class or functional component
1552
+ // Class or function component
1540
1553
  name = type.displayName || type.name;
1541
1554
  propTypes = type.propTypes;
1542
1555
  } else if (typeof type === 'object' && type !== null && type.$$typeof === REACT_FORWARD_REF_TYPE) {
@@ -1688,10 +1701,11 @@ var React = {
1688
1701
 
1689
1702
  createContext: createContext,
1690
1703
  forwardRef: forwardRef,
1704
+ pure: pure,
1691
1705
 
1692
1706
  Fragment: REACT_FRAGMENT_TYPE,
1693
1707
  StrictMode: REACT_STRICT_MODE_TYPE,
1694
- unstable_AsyncMode: REACT_ASYNC_MODE_TYPE,
1708
+ unstable_ConcurrentMode: REACT_CONCURRENT_MODE_TYPE,
1695
1709
  unstable_Profiler: REACT_PROFILER_TYPE,
1696
1710
 
1697
1711
  createElement: createElementWithValidation,
@@ -1,4 +1,4 @@
1
- /** @license React v16.5.1
1
+ /** @license React v16.6.0-alpha.f47a958
2
2
  * react.production.min.js
3
3
  *
4
4
  * Copyright (c) Facebook, Inc. and its affiliates.
@@ -7,18 +7,18 @@
7
7
  * LICENSE file in the root directory of this source tree.
8
8
  */
9
9
 
10
- 'use strict';var m=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.async_mode"):60111,y=n?Symbol.for("react.forward_ref"):60112;n&&Symbol.for("react.placeholder");
11
- var z="function"===typeof Symbol&&Symbol.iterator;function A(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 k=[d,c,e,g,h,f],l=0;a=Error(b.replace(/%s/g,function(){return k[l++]}));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]);A(!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;m(H,E.prototype);H.isPureReactComponent=!0;var I={current:null,currentDispatcher:null},J=Object.prototype.hasOwnProperty,K={key:!0,ref:!0,__self:!0,__source:!0};
15
- function L(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)J.call(b,c)&&!K.hasOwnProperty(c)&&(e[c]=b[c]);var f=arguments.length-2;if(1===f)e.children=d;else if(1<f){for(var k=Array(f),l=0;l<f;l++)k[l]=arguments[l+2];e.children=k}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:I.current}}
16
- function M(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
- 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=z&&a[z]||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 V(a,b){a.func.call(a.context,b,a.count++)}
20
- function aa(a,b,d){var c=a.result,e=a.keyPrefix;a=a.func.call(a.context,b,a.count++);Array.isArray(a)?W(a,c,d,function(a){return a}):null!=a&&(N(a)&&(a=M(a,e+(!a.key||b&&b.key===a.key?"":(""+a.key).replace(O,"$&/")+"/")+d)),c.push(a))}function W(a,b,d,c,e){var g="";null!=d&&(g=(""+d).replace(O,"$&/")+"/");b=Q(b,g,c,e);U(a,aa,b);R(b)}function ba(a,b){var d=I.currentDispatcher;null===d?B("277"):void 0;return d.readContext(a,b)}
21
- var X={Children:{map:function(a,b,d){if(null==a)return a;var c=[];W(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,V,b);R(b)},count:function(a){return U(a,function(){return null},null)},toArray:function(a){var b=[];W(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,Provider:null,Consumer:null,unstable_read:null};a.Provider={$$typeof:v,_context:a};a.Consumer=a;a.unstable_read=ba.bind(null,a);return a},forwardRef:function(a){return{$$typeof:y,render:a}},Fragment:r,StrictMode:t,unstable_AsyncMode:x,unstable_Profiler:u,createElement:L,cloneElement:function(a,b,d){null===a||void 0===a?B("267",a):void 0;var c=void 0,e=m({},a.props),g=a.key,h=a.ref,f=a._owner;if(null!=b){void 0!==b.ref&&(h=b.ref,f=I.current);void 0!==b.key&&(g=""+b.key);
23
- var k=void 0;a.type&&a.type.defaultProps&&(k=a.type.defaultProps);for(c in b)J.call(b,c)&&!K.hasOwnProperty(c)&&(e[c]=void 0===b[c]&&void 0!==k?k[c]:b[c])}c=arguments.length-2;if(1===c)e.children=d;else if(1<c){k=Array(c);for(var l=0;l<c;l++)k[l]=arguments[l+2];e.children=k}return{$$typeof:p,type:a.type,key:g,ref:h,props:e,_owner:f}},createFactory:function(a){var b=L.bind(null,a);b.type=a;return b},isValidElement:N,version:"16.5.1",__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED:{ReactCurrentOwner:I,
24
- assign:m}},Y={default:X},Z=Y&&X||Y;module.exports=Z.default||Z;
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;n&&Symbol.for("react.placeholder");
11
+ var z=n?Symbol.for("react.pure"):60115,A="function"===typeof Symbol&&Symbol.iterator;function B(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 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]);B(!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 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 N(a,b){return{$$typeof:p,type:a.type,key:b,ref:a.ref,props:a.props,_owner:a._owner}}function O(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 P=/\/+/g,Q=[];function R(a,b,d,c){if(Q.length){var e=Q.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
+ function S(a){a.result=null;a.keyPrefix=null;a.func=null;a.context=null;a.count=0;10>Q.length&&Q.push(a)}
18
+ function T(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?"."+U(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+U(e,h);g+=T(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+U(e,h++),g+=T(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 V(a,b,d){return null==a?0:T(a,"",b,d)}function U(a,b){return"object"===typeof a&&null!==a&&null!=a.key?escape(a.key):b.toString(36)}function aa(a,b){a.func.call(a.context,b,a.count++)}
20
+ function ba(a,b,d){var c=a.result,e=a.keyPrefix;a=a.func.call(a.context,b,a.count++);Array.isArray(a)?W(a,c,d,function(a){return a}):null!=a&&(O(a)&&(a=N(a,e+(!a.key||b&&b.key===a.key?"":(""+a.key).replace(P,"$&/")+"/")+d)),c.push(a))}function W(a,b,d,c,e){var g="";null!=d&&(g=(""+d).replace(P,"$&/")+"/");b=R(b,g,c,e);V(a,ba,b);S(b)}function ca(a,b){var d=J.currentDispatcher;null===d?C("277"):void 0;return d.readContext(a,b)}
21
+ var X={Children:{map:function(a,b,d){if(null==a)return a;var c=[];W(a,c,null,b,d);return c},forEach:function(a,b,d){if(null==a)return a;b=R(null,null,b,d);V(a,aa,b);S(b)},count:function(a){return V(a,function(){return null},null)},toArray:function(a){var b=[];W(a,b,null,function(a){return a});return b},only:function(a){O(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,Provider:null,Consumer:null,unstable_read:null};a.Provider={$$typeof:v,_context:a};a.Consumer=a;a.unstable_read=ca.bind(null,a);return a},forwardRef:function(a){return{$$typeof:y,render:a}},pure:function(a,b){return{$$typeof:z,render:a,compare:void 0===b?null:b}},Fragment:r,StrictMode:t,unstable_ConcurrentMode:x,unstable_Profiler:u,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 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:O,version:"16.6.0-alpha.f47a958",
24
+ __SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED:{ReactCurrentOwner:J,assign:k}},Y={default:X},Z=Y&&X||Y;module.exports=Z.default||Z;
package/package.json CHANGED
@@ -4,7 +4,7 @@
4
4
  "keywords": [
5
5
  "react"
6
6
  ],
7
- "version": "16.5.1",
7
+ "version": "16.6.0-alpha.f47a958",
8
8
  "homepage": "https://reactjs.org/",
9
9
  "bugs": "https://github.com/facebook/react/issues",
10
10
  "license": "MIT",
@@ -24,7 +24,7 @@
24
24
  "loose-envify": "^1.1.0",
25
25
  "object-assign": "^4.1.1",
26
26
  "prop-types": "^15.6.2",
27
- "schedule": "^0.4.0"
27
+ "scheduler": "^0.10.0-alpha.f47a958"
28
28
  },
29
29
  "browserify": {
30
30
  "transform": [
@@ -1,4 +1,4 @@
1
- /** @license React v16.5.1
1
+ /** @license React v16.6.0-alpha.f47a958
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.5.1';
20
+ var ReactVersion = '16.6.0-alpha.f47a958';
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.
@@ -30,9 +30,10 @@ var REACT_STRICT_MODE_TYPE = hasSymbol ? Symbol.for('react.strict_mode') : 0xeac
30
30
  var REACT_PROFILER_TYPE = hasSymbol ? Symbol.for('react.profiler') : 0xead2;
31
31
  var REACT_PROVIDER_TYPE = hasSymbol ? Symbol.for('react.provider') : 0xeacd;
32
32
  var REACT_CONTEXT_TYPE = hasSymbol ? Symbol.for('react.context') : 0xeace;
33
- var REACT_ASYNC_MODE_TYPE = hasSymbol ? Symbol.for('react.async_mode') : 0xeacf;
33
+ var REACT_CONCURRENT_MODE_TYPE = hasSymbol ? Symbol.for('react.concurrent_mode') : 0xeacf;
34
34
  var REACT_FORWARD_REF_TYPE = hasSymbol ? Symbol.for('react.forward_ref') : 0xead0;
35
35
  var REACT_PLACEHOLDER_TYPE = hasSymbol ? Symbol.for('react.placeholder') : 0xead1;
36
+ var REACT_PURE_TYPE = hasSymbol ? Symbol.for('react.pure') : 0xead3;
36
37
 
37
38
  var MAYBE_ITERATOR_SYMBOL = typeof Symbol === 'function' && Symbol.iterator;
38
39
  var FAUX_ITERATOR_SYMBOL = '@@iterator';
@@ -51,9 +52,6 @@ function getIteratorFn(maybeIterable) {
51
52
  // Exports ReactDOM.createRoot
52
53
 
53
54
 
54
- // Experimental error-boundary API that can recover from errors within a single
55
- // render phase
56
-
57
55
  // Suspense
58
56
  var enableSuspense = false;
59
57
  // Helps identify side effects in begin-phase lifecycle hooks and setState reducers:
@@ -72,14 +70,11 @@ var enableSuspense = false;
72
70
  // Warn about deprecated, async-unsafe lifecycles; relates to RFC #6:
73
71
 
74
72
 
75
- // Warn about legacy context API
76
-
77
-
78
73
  // Gather advanced timing metrics for Profiler subtrees.
79
74
 
80
75
 
81
- // Track which interactions trigger each commit.
82
- var enableSchedulerTracking = true;
76
+ // Trace which interactions trigger each commit.
77
+ var enableSchedulerTracing = true;
83
78
 
84
79
  // Only used in www builds.
85
80
 
@@ -575,230 +570,514 @@ function createRef() {
575
570
  return refObject;
576
571
  }
577
572
 
578
- var canUseDOM = !!(typeof window !== 'undefined' && window.document && window.document.createElement);
573
+ /* eslint-disable no-var */
579
574
 
580
- /**
581
- * A scheduling library to allow scheduling work with more granular priority and
582
- * control than requestAnimationFrame and requestIdleCallback.
583
- * Current TODO items:
584
- * X- Pull out the scheduleWork polyfill built into React
585
- * X- Initial test coverage
586
- * X- Support for multiple callbacks
587
- * - Support for two priorities; serial and deferred
588
- * - Better test coverage
589
- * - Better docblock
590
- * - Polish documentation, API
591
- */
575
+ // TODO: Use symbols?
576
+ var ImmediatePriority = 1;
577
+ var InteractivePriority = 2;
578
+ var NormalPriority = 3;
579
+ var WheneverPriority = 4;
592
580
 
593
- // This is a built-in polyfill for requestIdleCallback. It works by scheduling
594
- // a requestAnimationFrame, storing the time for the start of the frame, then
595
- // scheduling a postMessage which gets scheduled after paint. Within the
596
- // postMessage handler do as much work as possible until time + frame rate.
597
- // By separating the idle call into a separate event tick we ensure that
598
- // layout, paint and other browser work is counted against the available time.
599
- // The frame rate is dynamically adjusted.
581
+ // Max 31 bit integer. The max integer size in V8 for 32-bit systems.
582
+ // Math.pow(2, 30) - 1
583
+ // 0b111111111111111111111111111111
584
+ var maxSigned31BitInt = 1073741823;
600
585
 
601
- // We capture a local reference to any global, in case it gets polyfilled after
602
- // this module is initially evaluated.
603
- // We want to be using a consistent implementation.
604
- var localDate = Date;
586
+ // Times out immediately
587
+ var IMMEDIATE_PRIORITY_TIMEOUT = -1;
588
+ // Eventually times out
589
+ var INTERACTIVE_PRIORITY_TIMEOUT = 250;
590
+ var NORMAL_PRIORITY_TIMEOUT = 5000;
591
+ // Never times out
592
+ var WHENEVER_PRIORITY_TIMEOUT = maxSigned31BitInt;
605
593
 
606
- // This initialization code may run even on server environments
607
- // if a component just imports ReactDOM (e.g. for findDOMNode).
608
- // Some environments might not have setTimeout or clearTimeout.
609
- // However, we always expect them to be defined on the client.
610
- // https://github.com/facebook/react/pull/13088
611
- var localSetTimeout = typeof setTimeout === 'function' ? setTimeout : undefined;
612
- var localClearTimeout = typeof clearTimeout === 'function' ? clearTimeout : undefined;
594
+ // Callbacks are stored as a circular, doubly linked list.
595
+ var firstCallbackNode = null;
613
596
 
614
- // We don't expect either of these to necessarily be defined,
615
- // but we will error later if they are missing on the client.
616
- var localRequestAnimationFrame = typeof requestAnimationFrame === 'function' ? requestAnimationFrame : undefined;
617
- var localCancelAnimationFrame = typeof cancelAnimationFrame === 'function' ? cancelAnimationFrame : undefined;
597
+ var currentPriorityLevel = NormalPriority;
598
+ var currentEventStartTime = -1;
599
+ var currentExpirationTime = -1;
600
+
601
+ // This is set when a callback is being executed, to prevent re-entrancy.
602
+ var isExecutingCallback = false;
603
+
604
+ var isHostCallbackScheduled = false;
618
605
 
619
606
  var hasNativePerformanceNow = typeof performance === 'object' && typeof performance.now === 'function';
620
607
 
621
- var now = void 0;
608
+ var timeRemaining;
622
609
  if (hasNativePerformanceNow) {
623
- var Performance = performance;
624
- now = function () {
625
- return Performance.now();
610
+ timeRemaining = function () {
611
+ if (firstCallbackNode !== null && firstCallbackNode.expirationTime < currentExpirationTime) {
612
+ // A higher priority callback was scheduled. Yield so we can switch to
613
+ // working on that.
614
+ return 0;
615
+ }
616
+ // We assume that if we have a performance timer that the rAF callback
617
+ // gets a performance timer value. Not sure if this is always true.
618
+ var remaining = getFrameDeadline() - performance.now();
619
+ return remaining > 0 ? remaining : 0;
626
620
  };
627
621
  } else {
628
- now = function () {
629
- return localDate.now();
622
+ timeRemaining = function () {
623
+ // Fallback to Date.now()
624
+ if (firstCallbackNode !== null && firstCallbackNode.expirationTime < currentExpirationTime) {
625
+ return 0;
626
+ }
627
+ var remaining = getFrameDeadline() - Date.now();
628
+ return remaining > 0 ? remaining : 0;
630
629
  };
631
630
  }
632
631
 
633
- var scheduleWork = void 0;
634
- var cancelScheduledWork = void 0;
632
+ var deadlineObject = {
633
+ timeRemaining: timeRemaining,
634
+ didTimeout: false
635
+ };
636
+
637
+ function ensureHostCallbackIsScheduled() {
638
+ if (isExecutingCallback) {
639
+ // Don't schedule work yet; wait until the next time we yield.
640
+ return;
641
+ }
642
+ // Schedule the host callback using the earliest expiration in the list.
643
+ var expirationTime = firstCallbackNode.expirationTime;
644
+ if (!isHostCallbackScheduled) {
645
+ isHostCallbackScheduled = true;
646
+ } else {
647
+ // Cancel the existing host callback.
648
+ cancelHostCallback();
649
+ }
650
+ requestHostCallback(flushWork, expirationTime);
651
+ }
652
+
653
+ function flushFirstCallback() {
654
+ var flushedNode = firstCallbackNode;
635
655
 
636
- if (!canUseDOM) {
637
- var timeoutIds = new Map();
656
+ // Remove the node from the list before calling the callback. That way the
657
+ // list is in a consistent state even if the callback throws.
658
+ var next = firstCallbackNode.next;
659
+ if (firstCallbackNode === next) {
660
+ // This is the last callback in the list.
661
+ firstCallbackNode = null;
662
+ next = null;
663
+ } else {
664
+ var lastCallbackNode = firstCallbackNode.previous;
665
+ firstCallbackNode = lastCallbackNode.next = next;
666
+ next.previous = lastCallbackNode;
667
+ }
668
+
669
+ flushedNode.next = flushedNode.previous = null;
670
+
671
+ // Now it's safe to call the callback.
672
+ var callback = flushedNode.callback;
673
+ var expirationTime = flushedNode.expirationTime;
674
+ var priorityLevel = flushedNode.priorityLevel;
675
+ var previousPriorityLevel = currentPriorityLevel;
676
+ var previousExpirationTime = currentExpirationTime;
677
+ currentPriorityLevel = priorityLevel;
678
+ currentExpirationTime = expirationTime;
679
+ var continuationCallback;
680
+ try {
681
+ continuationCallback = callback(deadlineObject);
682
+ } finally {
683
+ currentPriorityLevel = previousPriorityLevel;
684
+ currentExpirationTime = previousExpirationTime;
685
+ }
638
686
 
639
- scheduleWork = function (callback, options) {
640
- // keeping return type consistent
641
- var callbackConfig = {
642
- scheduledCallback: callback,
643
- timeoutTime: 0,
687
+ // A callback may return a continuation. The continuation should be scheduled
688
+ // with the same priority and expiration as the just-finished callback.
689
+ if (typeof continuationCallback === 'function') {
690
+ var continuationNode = {
691
+ callback: continuationCallback,
692
+ priorityLevel: priorityLevel,
693
+ expirationTime: expirationTime,
644
694
  next: null,
645
- prev: null
695
+ previous: null
646
696
  };
647
- var timeoutId = localSetTimeout(function () {
648
- callback({
649
- timeRemaining: function () {
650
- return Infinity;
651
- },
652
697
 
653
- didTimeout: false
654
- });
655
- });
656
- timeoutIds.set(callback, timeoutId);
657
- return callbackConfig;
658
- };
659
- cancelScheduledWork = function (callbackId) {
660
- var callback = callbackId.scheduledCallback;
661
- var timeoutId = timeoutIds.get(callback);
662
- timeoutIds.delete(callbackId);
663
- localClearTimeout(timeoutId);
664
- };
665
- } else {
666
- {
667
- if (typeof console !== 'undefined') {
668
- if (typeof localRequestAnimationFrame !== 'function') {
669
- console.error("This browser doesn't support requestAnimationFrame. " + 'Make sure that you load a ' + 'polyfill in older browsers. https://fb.me/react-polyfills');
698
+ // Insert the new callback into the list, sorted by its expiration. This is
699
+ // almost the same as the code in `scheduleCallback`, except the callback
700
+ // is inserted into the list *before* callbacks of equal expiration instead
701
+ // of after.
702
+ if (firstCallbackNode === null) {
703
+ // This is the first callback in the list.
704
+ firstCallbackNode = continuationNode.next = continuationNode.previous = continuationNode;
705
+ } else {
706
+ var nextAfterContinuation = null;
707
+ var node = firstCallbackNode;
708
+ do {
709
+ if (node.expirationTime >= expirationTime) {
710
+ // This callback expires at or after the continuation. We will insert
711
+ // the continuation *before* this callback.
712
+ nextAfterContinuation = node;
713
+ break;
714
+ }
715
+ node = node.next;
716
+ } while (node !== firstCallbackNode);
717
+
718
+ if (nextAfterContinuation === null) {
719
+ // No equal or lower priority callback was found, which means the new
720
+ // callback is the lowest priority callback in the list.
721
+ nextAfterContinuation = firstCallbackNode;
722
+ } else if (nextAfterContinuation === firstCallbackNode) {
723
+ // The new callback is the highest priority callback in the list.
724
+ firstCallbackNode = continuationNode;
725
+ ensureHostCallbackIsScheduled(firstCallbackNode);
670
726
  }
671
- if (typeof localCancelAnimationFrame !== 'function') {
672
- console.error("This browser doesn't support cancelAnimationFrame. " + 'Make sure that you load a ' + 'polyfill in older browsers. https://fb.me/react-polyfills');
727
+
728
+ var previous = nextAfterContinuation.previous;
729
+ previous.next = nextAfterContinuation.previous = continuationNode;
730
+ continuationNode.next = nextAfterContinuation;
731
+ continuationNode.previous = previous;
732
+ }
733
+ }
734
+ }
735
+
736
+ function flushImmediateWork() {
737
+ if (
738
+ // Confirm we've exited the outer most event handler
739
+ currentEventStartTime === -1 && firstCallbackNode !== null && firstCallbackNode.priorityLevel === ImmediatePriority) {
740
+ isExecutingCallback = true;
741
+ deadlineObject.didTimeout = true;
742
+ try {
743
+ do {
744
+ flushFirstCallback();
745
+ } while (
746
+ // Keep flushing until there are no more immediate callbacks
747
+ firstCallbackNode !== null && firstCallbackNode.priorityLevel === ImmediatePriority);
748
+ } finally {
749
+ isExecutingCallback = false;
750
+ if (firstCallbackNode !== null) {
751
+ // There's still work remaining. Request another callback.
752
+ ensureHostCallbackIsScheduled(firstCallbackNode);
753
+ } else {
754
+ isHostCallbackScheduled = false;
673
755
  }
674
756
  }
675
757
  }
758
+ }
676
759
 
677
- var headOfPendingCallbacksLinkedList = null;
678
- var tailOfPendingCallbacksLinkedList = null;
760
+ function flushWork(didTimeout) {
761
+ isExecutingCallback = true;
762
+ deadlineObject.didTimeout = didTimeout;
763
+ try {
764
+ if (didTimeout) {
765
+ // Flush all the expired callbacks without yielding.
766
+ while (firstCallbackNode !== null) {
767
+ // Read the current time. Flush all the callbacks that expire at or
768
+ // earlier than that time. Then read the current time again and repeat.
769
+ // This optimizes for as few performance.now calls as possible.
770
+ var currentTime = getCurrentTime();
771
+ if (firstCallbackNode.expirationTime <= currentTime) {
772
+ do {
773
+ flushFirstCallback();
774
+ } while (firstCallbackNode !== null && firstCallbackNode.expirationTime <= currentTime);
775
+ continue;
776
+ }
777
+ break;
778
+ }
779
+ } else {
780
+ // Keep flushing callbacks until we run out of time in the frame.
781
+ if (firstCallbackNode !== null) {
782
+ do {
783
+ flushFirstCallback();
784
+ } while (firstCallbackNode !== null && getFrameDeadline() - getCurrentTime() > 0);
785
+ }
786
+ }
787
+ } finally {
788
+ isExecutingCallback = false;
789
+ if (firstCallbackNode !== null) {
790
+ // There's still work remaining. Request another callback.
791
+ ensureHostCallbackIsScheduled(firstCallbackNode);
792
+ } else {
793
+ isHostCallbackScheduled = false;
794
+ }
795
+ // Before exiting, flush all the immediate work that was scheduled.
796
+ flushImmediateWork();
797
+ }
798
+ }
679
799
 
680
- // We track what the next soonest timeoutTime is, to be able to quickly tell
681
- // if none of the scheduled callbacks have timed out.
682
- var nextSoonestTimeoutTime = -1;
800
+ function unstable_runWithPriority(priorityLevel, eventHandler) {
801
+ switch (priorityLevel) {
802
+ case ImmediatePriority:
803
+ case InteractivePriority:
804
+ case NormalPriority:
805
+ case WheneverPriority:
806
+ break;
807
+ default:
808
+ priorityLevel = NormalPriority;
809
+ }
683
810
 
684
- var isIdleScheduled = false;
685
- var isAnimationFrameScheduled = false;
811
+ var previousPriorityLevel = currentPriorityLevel;
812
+ var previousEventStartTime = currentEventStartTime;
813
+ currentPriorityLevel = priorityLevel;
814
+ currentEventStartTime = getCurrentTime();
686
815
 
687
- // requestAnimationFrame does not run when the tab is in the background.
688
- // if we're backgrounded we prefer for that work to happen so that the page
689
- // continues to load in the background.
690
- // so we also schedule a 'setTimeout' as a fallback.
691
- var animationFrameTimeout = 100;
692
- var rafID = void 0;
693
- var timeoutID = void 0;
694
- var scheduleAnimationFrameWithFallbackSupport = function (callback) {
695
- // schedule rAF and also a setTimeout
696
- rafID = localRequestAnimationFrame(function (timestamp) {
697
- // cancel the setTimeout
698
- localClearTimeout(timeoutID);
699
- callback(timestamp);
700
- });
701
- timeoutID = localSetTimeout(function () {
702
- // cancel the requestAnimationFrame
703
- localCancelAnimationFrame(rafID);
704
- callback(now());
705
- }, animationFrameTimeout);
706
- };
816
+ try {
817
+ return eventHandler();
818
+ } finally {
819
+ currentPriorityLevel = previousPriorityLevel;
820
+ currentEventStartTime = previousEventStartTime;
707
821
 
708
- var frameDeadline = 0;
709
- // We start out assuming that we run at 30fps but then the heuristic tracking
710
- // will adjust this value to a faster fps if we get more frequent animation
711
- // frames.
712
- var previousFrameTime = 33;
713
- var activeFrameTime = 33;
822
+ // Before exiting, flush all the immediate work that was scheduled.
823
+ flushImmediateWork();
824
+ }
825
+ }
714
826
 
715
- var frameDeadlineObject = {
716
- didTimeout: false,
717
- timeRemaining: function () {
718
- var remaining = frameDeadline - now();
719
- return remaining > 0 ? remaining : 0;
720
- }
721
- };
827
+ function unstable_wrapCallback(callback) {
828
+ var parentPriorityLevel = currentPriorityLevel;
829
+ return function () {
830
+ // This is a fork of runWithPriority, inlined for performance.
831
+ var previousPriorityLevel = currentPriorityLevel;
832
+ var previousEventStartTime = currentEventStartTime;
833
+ currentPriorityLevel = parentPriorityLevel;
834
+ currentEventStartTime = getCurrentTime();
722
835
 
723
- /**
724
- * Handles the case where a callback errors:
725
- * - don't catch the error, because this changes debugging behavior
726
- * - do start a new postMessage callback, to call any remaining callbacks,
727
- * - but only if there is an error, so there is not extra overhead.
728
- */
729
- var callUnsafely = function (callbackConfig, arg) {
730
- var callback = callbackConfig.scheduledCallback;
731
- var finishedCalling = false;
732
836
  try {
733
- callback(arg);
734
- finishedCalling = true;
837
+ return callback.apply(this, arguments);
735
838
  } finally {
736
- // always remove it from linked list
737
- cancelScheduledWork(callbackConfig);
738
-
739
- if (!finishedCalling) {
740
- // an error must have been thrown
741
- isIdleScheduled = true;
742
- window.postMessage(messageKey, '*');
743
- }
839
+ currentPriorityLevel = previousPriorityLevel;
840
+ currentEventStartTime = previousEventStartTime;
841
+ flushImmediateWork();
744
842
  }
745
843
  };
844
+ }
746
845
 
747
- /**
748
- * Checks for timed out callbacks, runs them, and then checks again to see if
749
- * any more have timed out.
750
- * Keeps doing this until there are none which have currently timed out.
751
- */
752
- var callTimedOutCallbacks = function () {
753
- if (headOfPendingCallbacksLinkedList === null) {
754
- return;
755
- }
846
+ function unstable_scheduleCallback(callback, deprecated_options) {
847
+ var startTime = currentEventStartTime !== -1 ? currentEventStartTime : getCurrentTime();
756
848
 
757
- var currentTime = now();
758
- // TODO: this would be more efficient if deferred callbacks are stored in
759
- // min heap.
760
- // Or in a linked list with links for both timeoutTime order and insertion
761
- // order.
762
- // For now an easy compromise is the current approach:
763
- // Keep a pointer to the soonest timeoutTime, and check that first.
764
- // If it has not expired, we can skip traversing the whole list.
765
- // If it has expired, then we step through all the callbacks.
766
- if (nextSoonestTimeoutTime === -1 || nextSoonestTimeoutTime > currentTime) {
767
- // We know that none of them have timed out yet.
768
- return;
849
+ var expirationTime;
850
+ if (typeof deprecated_options === 'object' && deprecated_options !== null && typeof deprecated_options.timeout === 'number') {
851
+ // FIXME: Remove this branch once we lift expiration times out of React.
852
+ expirationTime = startTime + deprecated_options.timeout;
853
+ } else {
854
+ switch (currentPriorityLevel) {
855
+ case ImmediatePriority:
856
+ expirationTime = startTime + IMMEDIATE_PRIORITY_TIMEOUT;
857
+ break;
858
+ case InteractivePriority:
859
+ expirationTime = startTime + INTERACTIVE_PRIORITY_TIMEOUT;
860
+ break;
861
+ case WheneverPriority:
862
+ expirationTime = startTime + WHENEVER_PRIORITY_TIMEOUT;
863
+ break;
864
+ case NormalPriority:
865
+ default:
866
+ expirationTime = startTime + NORMAL_PRIORITY_TIMEOUT;
769
867
  }
770
- // NOTE: we intentionally wait to update the nextSoonestTimeoutTime until
771
- // after successfully calling any timed out callbacks.
772
- // If a timed out callback throws an error, we could get stuck in a state
773
- // where the nextSoonestTimeoutTime was set wrong.
774
- var updatedNextSoonestTimeoutTime = -1; // we will update nextSoonestTimeoutTime below
775
- var timedOutCallbacks = [];
776
-
777
- // iterate once to find timed out callbacks and find nextSoonestTimeoutTime
778
- var currentCallbackConfig = headOfPendingCallbacksLinkedList;
779
- while (currentCallbackConfig !== null) {
780
- var _timeoutTime = currentCallbackConfig.timeoutTime;
781
- if (_timeoutTime !== -1 && _timeoutTime <= currentTime) {
782
- // it has timed out!
783
- timedOutCallbacks.push(currentCallbackConfig);
784
- } else {
785
- if (_timeoutTime !== -1 && (updatedNextSoonestTimeoutTime === -1 || _timeoutTime < updatedNextSoonestTimeoutTime)) {
786
- updatedNextSoonestTimeoutTime = _timeoutTime;
787
- }
868
+ }
869
+
870
+ var newNode = {
871
+ callback: callback,
872
+ priorityLevel: currentPriorityLevel,
873
+ expirationTime: expirationTime,
874
+ next: null,
875
+ previous: null
876
+ };
877
+
878
+ // Insert the new callback into the list, ordered first by expiration, then
879
+ // by insertion. So the new callback is inserted any other callback with
880
+ // equal expiration.
881
+ if (firstCallbackNode === null) {
882
+ // This is the first callback in the list.
883
+ firstCallbackNode = newNode.next = newNode.previous = newNode;
884
+ ensureHostCallbackIsScheduled(firstCallbackNode);
885
+ } else {
886
+ var next = null;
887
+ var node = firstCallbackNode;
888
+ do {
889
+ if (node.expirationTime > expirationTime) {
890
+ // The new callback expires before this one.
891
+ next = node;
892
+ break;
788
893
  }
789
- currentCallbackConfig = currentCallbackConfig.next;
894
+ node = node.next;
895
+ } while (node !== firstCallbackNode);
896
+
897
+ if (next === null) {
898
+ // No callback with a later expiration was found, which means the new
899
+ // callback has the latest expiration in the list.
900
+ next = firstCallbackNode;
901
+ } else if (next === firstCallbackNode) {
902
+ // The new callback has the earliest expiration in the entire list.
903
+ firstCallbackNode = newNode;
904
+ ensureHostCallbackIsScheduled(firstCallbackNode);
790
905
  }
791
906
 
792
- if (timedOutCallbacks.length > 0) {
793
- frameDeadlineObject.didTimeout = true;
794
- for (var i = 0, len = timedOutCallbacks.length; i < len; i++) {
795
- callUnsafely(timedOutCallbacks[i], frameDeadlineObject);
907
+ var previous = next.previous;
908
+ previous.next = next.previous = newNode;
909
+ newNode.next = next;
910
+ newNode.previous = previous;
911
+ }
912
+
913
+ return newNode;
914
+ }
915
+
916
+ function unstable_cancelCallback(callbackNode) {
917
+ var next = callbackNode.next;
918
+ if (next === null) {
919
+ // Already cancelled.
920
+ return;
921
+ }
922
+
923
+ if (next === callbackNode) {
924
+ // This is the only scheduled callback. Clear the list.
925
+ firstCallbackNode = null;
926
+ } else {
927
+ // Remove the callback from its position in the list.
928
+ if (callbackNode === firstCallbackNode) {
929
+ firstCallbackNode = next;
930
+ }
931
+ var previous = callbackNode.previous;
932
+ previous.next = next;
933
+ next.previous = previous;
934
+ }
935
+
936
+ callbackNode.next = callbackNode.previous = null;
937
+ }
938
+
939
+ function unstable_getCurrentPriorityLevel() {
940
+ return currentPriorityLevel;
941
+ }
942
+
943
+ // The remaining code is essentially a polyfill for requestIdleCallback. It
944
+ // works by scheduling a requestAnimationFrame, storing the time for the start
945
+ // of the frame, then scheduling a postMessage which gets scheduled after paint.
946
+ // Within the postMessage handler do as much work as possible until time + frame
947
+ // rate. By separating the idle call into a separate event tick we ensure that
948
+ // layout, paint and other browser work is counted against the available time.
949
+ // The frame rate is dynamically adjusted.
950
+
951
+ // We capture a local reference to any global, in case it gets polyfilled after
952
+ // this module is initially evaluated. We want to be using a
953
+ // consistent implementation.
954
+ var localDate = Date;
955
+
956
+ // This initialization code may run even on server environments if a component
957
+ // just imports ReactDOM (e.g. for findDOMNode). Some environments might not
958
+ // have setTimeout or clearTimeout. However, we always expect them to be defined
959
+ // on the client. https://github.com/facebook/react/pull/13088
960
+ var localSetTimeout = typeof setTimeout === 'function' ? setTimeout : undefined;
961
+ var localClearTimeout = typeof clearTimeout === 'function' ? clearTimeout : undefined;
962
+
963
+ // We don't expect either of these to necessarily be defined, but we will error
964
+ // later if they are missing on the client.
965
+ var localRequestAnimationFrame = typeof requestAnimationFrame === 'function' ? requestAnimationFrame : undefined;
966
+ var localCancelAnimationFrame = typeof cancelAnimationFrame === 'function' ? cancelAnimationFrame : undefined;
967
+
968
+ var getCurrentTime;
969
+
970
+ // requestAnimationFrame does not run when the tab is in the background. If
971
+ // we're backgrounded we prefer for that work to happen so that the page
972
+ // continues to load in the background. So we also schedule a 'setTimeout' as
973
+ // a fallback.
974
+ // TODO: Need a better heuristic for backgrounded work.
975
+ var ANIMATION_FRAME_TIMEOUT = 100;
976
+ var rAFID;
977
+ var rAFTimeoutID;
978
+ var requestAnimationFrameWithTimeout = function (callback) {
979
+ // schedule rAF and also a setTimeout
980
+ rAFID = localRequestAnimationFrame(function (timestamp) {
981
+ // cancel the setTimeout
982
+ localClearTimeout(rAFTimeoutID);
983
+ callback(timestamp);
984
+ });
985
+ rAFTimeoutID = localSetTimeout(function () {
986
+ // cancel the requestAnimationFrame
987
+ localCancelAnimationFrame(rAFID);
988
+ callback(getCurrentTime());
989
+ }, ANIMATION_FRAME_TIMEOUT);
990
+ };
991
+
992
+ if (hasNativePerformanceNow) {
993
+ var Performance = performance;
994
+ getCurrentTime = function () {
995
+ return Performance.now();
996
+ };
997
+ } else {
998
+ getCurrentTime = function () {
999
+ return localDate.now();
1000
+ };
1001
+ }
1002
+
1003
+ var requestHostCallback;
1004
+ var cancelHostCallback;
1005
+ var getFrameDeadline;
1006
+
1007
+ if (typeof window !== 'undefined' && window._schedMock) {
1008
+ // Dynamic injection, only for testing purposes.
1009
+ var impl = window._schedMock;
1010
+ requestHostCallback = impl[0];
1011
+ cancelHostCallback = impl[1];
1012
+ getFrameDeadline = impl[2];
1013
+ } else if (
1014
+ // If Scheduler runs in a non-DOM environment, it falls back to a naive
1015
+ // implementation using setTimeout.
1016
+ typeof window === 'undefined' ||
1017
+ // "addEventListener" might not be available on the window object
1018
+ // if this is a mocked "window" object. So we need to validate that too.
1019
+ typeof window.addEventListener !== 'function') {
1020
+ var _callback = null;
1021
+ var _currentTime = -1;
1022
+ var _flushCallback = function (didTimeout, ms) {
1023
+ if (_callback !== null) {
1024
+ var cb = _callback;
1025
+ _callback = null;
1026
+ try {
1027
+ _currentTime = ms;
1028
+ cb(didTimeout);
1029
+ } finally {
1030
+ _currentTime = -1;
796
1031
  }
797
1032
  }
1033
+ };
1034
+ requestHostCallback = function (cb, ms) {
1035
+ if (_currentTime !== -1) {
1036
+ // Protect against re-entrancy.
1037
+ setTimeout(requestHostCallback, 0, cb, ms);
1038
+ } else {
1039
+ _callback = cb;
1040
+ setTimeout(_flushCallback, ms, true, ms);
1041
+ setTimeout(_flushCallback, maxSigned31BitInt, false, maxSigned31BitInt);
1042
+ }
1043
+ };
1044
+ cancelHostCallback = function () {
1045
+ _callback = null;
1046
+ };
1047
+ getFrameDeadline = function () {
1048
+ return Infinity;
1049
+ };
1050
+ getCurrentTime = function () {
1051
+ return _currentTime === -1 ? 0 : _currentTime;
1052
+ };
1053
+ } else {
1054
+ if (typeof console !== 'undefined') {
1055
+ // TODO: Remove fb.me link
1056
+ if (typeof localRequestAnimationFrame !== 'function') {
1057
+ console.error("This browser doesn't support requestAnimationFrame. " + 'Make sure that you load a ' + 'polyfill in older browsers. https://fb.me/react-polyfills');
1058
+ }
1059
+ if (typeof localCancelAnimationFrame !== 'function') {
1060
+ console.error("This browser doesn't support cancelAnimationFrame. " + 'Make sure that you load a ' + 'polyfill in older browsers. https://fb.me/react-polyfills');
1061
+ }
1062
+ }
1063
+
1064
+ var scheduledHostCallback = null;
1065
+ var isMessageEventScheduled = false;
1066
+ var timeoutTime = -1;
1067
+
1068
+ var isAnimationFrameScheduled = false;
1069
+
1070
+ var isFlushingHostCallback = false;
1071
+
1072
+ var frameDeadline = 0;
1073
+ // We start out assuming that we run at 30fps but then the heuristic tracking
1074
+ // will adjust this value to a faster fps if we get more frequent animation
1075
+ // frames.
1076
+ var previousFrameTime = 33;
1077
+ var activeFrameTime = 33;
798
1078
 
799
- // NOTE: we intentionally wait to update the nextSoonestTimeoutTime until
800
- // after successfully calling any timed out callbacks.
801
- nextSoonestTimeoutTime = updatedNextSoonestTimeoutTime;
1079
+ getFrameDeadline = function () {
1080
+ return frameDeadline;
802
1081
  };
803
1082
 
804
1083
  // We use the postMessage trick to defer idle work until after the repaint.
@@ -807,29 +1086,44 @@ if (!canUseDOM) {
807
1086
  if (event.source !== window || event.data !== messageKey) {
808
1087
  return;
809
1088
  }
810
- isIdleScheduled = false;
811
1089
 
812
- if (headOfPendingCallbacksLinkedList === null) {
813
- return;
814
- }
1090
+ isMessageEventScheduled = false;
815
1091
 
816
- // First call anything which has timed out, until we have caught up.
817
- callTimedOutCallbacks();
1092
+ var prevScheduledCallback = scheduledHostCallback;
1093
+ var prevTimeoutTime = timeoutTime;
1094
+ scheduledHostCallback = null;
1095
+ timeoutTime = -1;
818
1096
 
819
- var currentTime = now();
820
- // Next, as long as we have idle time, try calling more callbacks.
821
- while (frameDeadline - currentTime > 0 && headOfPendingCallbacksLinkedList !== null) {
822
- var latestCallbackConfig = headOfPendingCallbacksLinkedList;
823
- frameDeadlineObject.didTimeout = false;
824
- // callUnsafely will remove it from the head of the linked list
825
- callUnsafely(latestCallbackConfig, frameDeadlineObject);
826
- currentTime = now();
1097
+ var currentTime = getCurrentTime();
1098
+
1099
+ var didTimeout = false;
1100
+ if (frameDeadline - currentTime <= 0) {
1101
+ // There's no time left in this idle period. Check if the callback has
1102
+ // a timeout and whether it's been exceeded.
1103
+ if (prevTimeoutTime !== -1 && prevTimeoutTime <= currentTime) {
1104
+ // Exceeded the timeout. Invoke the callback even though there's no
1105
+ // time left.
1106
+ didTimeout = true;
1107
+ } else {
1108
+ // No timeout.
1109
+ if (!isAnimationFrameScheduled) {
1110
+ // Schedule another animation callback so we retry later.
1111
+ isAnimationFrameScheduled = true;
1112
+ requestAnimationFrameWithTimeout(animationTick);
1113
+ }
1114
+ // Exit without invoking the callback.
1115
+ scheduledHostCallback = prevScheduledCallback;
1116
+ timeoutTime = prevTimeoutTime;
1117
+ return;
1118
+ }
827
1119
  }
828
- if (headOfPendingCallbacksLinkedList !== null) {
829
- if (!isAnimationFrameScheduled) {
830
- // Schedule another animation callback so we retry later.
831
- isAnimationFrameScheduled = true;
832
- scheduleAnimationFrameWithFallbackSupport(animationTick);
1120
+
1121
+ if (prevScheduledCallback !== null) {
1122
+ isFlushingHostCallback = true;
1123
+ try {
1124
+ prevScheduledCallback(didTimeout);
1125
+ } finally {
1126
+ isFlushingHostCallback = false;
833
1127
  }
834
1128
  }
835
1129
  };
@@ -838,12 +1132,27 @@ if (!canUseDOM) {
838
1132
  window.addEventListener('message', idleTick, false);
839
1133
 
840
1134
  var animationTick = function (rafTime) {
841
- isAnimationFrameScheduled = false;
1135
+ if (scheduledHostCallback !== null) {
1136
+ // Eagerly schedule the next animation callback at the beginning of the
1137
+ // frame. If the scheduler queue is not empty at the end of the frame, it
1138
+ // will continue flushing inside that callback. If the queue *is* empty,
1139
+ // then it will exit immediately. Posting the callback at the start of the
1140
+ // frame ensures it's fired within the earliest possible frame. If we
1141
+ // waited until the end of the frame to post the callback, we risk the
1142
+ // browser skipping a frame and not firing the callback until the frame
1143
+ // after that.
1144
+ requestAnimationFrameWithTimeout(animationTick);
1145
+ } else {
1146
+ // No pending work. Exit.
1147
+ isAnimationFrameScheduled = false;
1148
+ return;
1149
+ }
1150
+
842
1151
  var nextFrameTime = rafTime - frameDeadline + activeFrameTime;
843
1152
  if (nextFrameTime < activeFrameTime && previousFrameTime < activeFrameTime) {
844
1153
  if (nextFrameTime < 8) {
845
1154
  // Defensive coding. We don't support higher frame rates than 120hz.
846
- // If we get lower than that, it is probably a bug.
1155
+ // If the calculated frame time gets lower than 8, it is probably a bug.
847
1156
  nextFrameTime = 8;
848
1157
  }
849
1158
  // If one frame goes long, then the next one can be short to catch up.
@@ -858,115 +1167,32 @@ if (!canUseDOM) {
858
1167
  previousFrameTime = nextFrameTime;
859
1168
  }
860
1169
  frameDeadline = rafTime + activeFrameTime;
861
- if (!isIdleScheduled) {
862
- isIdleScheduled = true;
1170
+ if (!isMessageEventScheduled) {
1171
+ isMessageEventScheduled = true;
863
1172
  window.postMessage(messageKey, '*');
864
1173
  }
865
1174
  };
866
1175
 
867
- scheduleWork = function (callback, options) /* CallbackConfigType */{
868
- var timeoutTime = -1;
869
- if (options != null && typeof options.timeout === 'number') {
870
- timeoutTime = now() + options.timeout;
871
- }
872
- if (nextSoonestTimeoutTime === -1 || timeoutTime !== -1 && timeoutTime < nextSoonestTimeoutTime) {
873
- nextSoonestTimeoutTime = timeoutTime;
874
- }
875
-
876
- var scheduledCallbackConfig = {
877
- scheduledCallback: callback,
878
- timeoutTime: timeoutTime,
879
- prev: null,
880
- next: null
881
- };
882
- if (headOfPendingCallbacksLinkedList === null) {
883
- // Make this callback the head and tail of our list
884
- headOfPendingCallbacksLinkedList = scheduledCallbackConfig;
885
- tailOfPendingCallbacksLinkedList = scheduledCallbackConfig;
886
- } else {
887
- // Add latest callback as the new tail of the list
888
- scheduledCallbackConfig.prev = tailOfPendingCallbacksLinkedList;
889
- // renaming for clarity
890
- var oldTailOfPendingCallbacksLinkedList = tailOfPendingCallbacksLinkedList;
891
- if (oldTailOfPendingCallbacksLinkedList !== null) {
892
- oldTailOfPendingCallbacksLinkedList.next = scheduledCallbackConfig;
893
- }
894
- tailOfPendingCallbacksLinkedList = scheduledCallbackConfig;
895
- }
896
-
897
- if (!isAnimationFrameScheduled) {
1176
+ requestHostCallback = function (callback, absoluteTimeout) {
1177
+ scheduledHostCallback = callback;
1178
+ timeoutTime = absoluteTimeout;
1179
+ if (isFlushingHostCallback || absoluteTimeout < 0) {
1180
+ // Don't wait for the next frame. Continue working ASAP, in a new event.
1181
+ window.postMessage(messageKey, '*');
1182
+ } else if (!isAnimationFrameScheduled) {
898
1183
  // If rAF didn't already schedule one, we need to schedule a frame.
899
1184
  // TODO: If this rAF doesn't materialize because the browser throttles, we
900
- // might want to still have setTimeout trigger scheduleWork as a backup to ensure
1185
+ // might want to still have setTimeout trigger rIC as a backup to ensure
901
1186
  // that we keep performing work.
902
1187
  isAnimationFrameScheduled = true;
903
- scheduleAnimationFrameWithFallbackSupport(animationTick);
1188
+ requestAnimationFrameWithTimeout(animationTick);
904
1189
  }
905
- return scheduledCallbackConfig;
906
1190
  };
907
1191
 
908
- cancelScheduledWork = function (callbackConfig /* CallbackConfigType */
909
- ) {
910
- if (callbackConfig.prev === null && headOfPendingCallbacksLinkedList !== callbackConfig) {
911
- // this callbackConfig has already been cancelled.
912
- // cancelScheduledWork should be idempotent, a no-op after first call.
913
- return;
914
- }
915
-
916
- /**
917
- * There are four possible cases:
918
- * - Head/nodeToRemove/Tail -> null
919
- * In this case we set Head and Tail to null.
920
- * - Head -> ... middle nodes... -> Tail/nodeToRemove
921
- * In this case we point the middle.next to null and put middle as the new
922
- * Tail.
923
- * - Head/nodeToRemove -> ...middle nodes... -> Tail
924
- * In this case we point the middle.prev at null and move the Head to
925
- * middle.
926
- * - Head -> ... ?some nodes ... -> nodeToRemove -> ... ?some nodes ... -> Tail
927
- * In this case we point the Head.next to the Tail and the Tail.prev to
928
- * the Head.
929
- */
930
- var next = callbackConfig.next;
931
- var prev = callbackConfig.prev;
932
- callbackConfig.next = null;
933
- callbackConfig.prev = null;
934
- if (next !== null) {
935
- // we have a next
936
-
937
- if (prev !== null) {
938
- // we have a prev
939
-
940
- // callbackConfig is somewhere in the middle of a list of 3 or more nodes.
941
- prev.next = next;
942
- next.prev = prev;
943
- return;
944
- } else {
945
- // there is a next but not a previous one;
946
- // callbackConfig is the head of a list of 2 or more other nodes.
947
- next.prev = null;
948
- headOfPendingCallbacksLinkedList = next;
949
- return;
950
- }
951
- } else {
952
- // there is no next callback config; this must the tail of the list
953
-
954
- if (prev !== null) {
955
- // we have a prev
956
-
957
- // callbackConfig is the tail of a list of 2 or more other nodes.
958
- prev.next = null;
959
- tailOfPendingCallbacksLinkedList = prev;
960
- return;
961
- } else {
962
- // there is no previous callback config;
963
- // callbackConfig is the only thing in the linked list,
964
- // so both head and tail point to it.
965
- headOfPendingCallbacksLinkedList = null;
966
- tailOfPendingCallbacksLinkedList = null;
967
- return;
968
- }
969
- }
1192
+ cancelHostCallback = function () {
1193
+ scheduledHostCallback = null;
1194
+ isMessageEventScheduled = false;
1195
+ timeoutTime = -1;
970
1196
  };
971
1197
  }
972
1198
 
@@ -976,16 +1202,16 @@ var DEFAULT_THREAD_ID = 0;
976
1202
  var interactionIDCounter = 0;
977
1203
  var threadIDCounter = 0;
978
1204
 
979
- // Set of currently tracked interactions.
1205
+ // Set of currently traced interactions.
980
1206
  // Interactions "stack"–
981
- // Meaning that newly tracked interactions are appended to the previously active set.
1207
+ // Meaning that newly traced interactions are appended to the previously active set.
982
1208
  // When an interaction goes out of scope, the previous set (if any) is restored.
983
1209
  var interactionsRef = null;
984
1210
 
985
1211
  // Listener(s) to notify when interactions begin and end.
986
1212
  var subscriberRef = null;
987
1213
 
988
- if (enableSchedulerTracking) {
1214
+ if (enableSchedulerTracing) {
989
1215
  interactionsRef = {
990
1216
  current: new Set()
991
1217
  };
@@ -995,7 +1221,7 @@ if (enableSchedulerTracking) {
995
1221
  }
996
1222
 
997
1223
  function unstable_clear(callback) {
998
- if (!enableSchedulerTracking) {
1224
+ if (!enableSchedulerTracing) {
999
1225
  return callback();
1000
1226
  }
1001
1227
 
@@ -1010,7 +1236,7 @@ function unstable_clear(callback) {
1010
1236
  }
1011
1237
 
1012
1238
  function unstable_getCurrent() {
1013
- if (!enableSchedulerTracking) {
1239
+ if (!enableSchedulerTracing) {
1014
1240
  return null;
1015
1241
  } else {
1016
1242
  return interactionsRef.current;
@@ -1021,10 +1247,10 @@ function unstable_getThreadID() {
1021
1247
  return ++threadIDCounter;
1022
1248
  }
1023
1249
 
1024
- function unstable_track(name, timestamp, callback) {
1250
+ function unstable_trace(name, timestamp, callback) {
1025
1251
  var threadID = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : DEFAULT_THREAD_ID;
1026
1252
 
1027
- if (!enableSchedulerTracking) {
1253
+ if (!enableSchedulerTracing) {
1028
1254
  return callback();
1029
1255
  }
1030
1256
 
@@ -1037,7 +1263,7 @@ function unstable_track(name, timestamp, callback) {
1037
1263
 
1038
1264
  var prevInteractions = interactionsRef.current;
1039
1265
 
1040
- // Tracked interactions should stack/accumulate.
1266
+ // Traced interactions should stack/accumulate.
1041
1267
  // To do that, clone the current interactions.
1042
1268
  // The previous set will be restored upon completion.
1043
1269
  var interactions = new Set(prevInteractions);
@@ -1049,7 +1275,7 @@ function unstable_track(name, timestamp, callback) {
1049
1275
 
1050
1276
  try {
1051
1277
  if (subscriber !== null) {
1052
- subscriber.onInteractionTracked(interaction);
1278
+ subscriber.onInteractionTraced(interaction);
1053
1279
  }
1054
1280
  } finally {
1055
1281
  try {
@@ -1085,7 +1311,7 @@ function unstable_track(name, timestamp, callback) {
1085
1311
  function unstable_wrap(callback) {
1086
1312
  var threadID = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : DEFAULT_THREAD_ID;
1087
1313
 
1088
- if (!enableSchedulerTracking) {
1314
+ if (!enableSchedulerTracing) {
1089
1315
  return callback;
1090
1316
  }
1091
1317
 
@@ -1176,18 +1402,18 @@ function unstable_wrap(callback) {
1176
1402
  }
1177
1403
 
1178
1404
  var subscribers = null;
1179
- if (enableSchedulerTracking) {
1405
+ if (enableSchedulerTracing) {
1180
1406
  subscribers = new Set();
1181
1407
  }
1182
1408
 
1183
1409
  function unstable_subscribe(subscriber) {
1184
- if (enableSchedulerTracking) {
1410
+ if (enableSchedulerTracing) {
1185
1411
  subscribers.add(subscriber);
1186
1412
 
1187
1413
  if (subscribers.size === 1) {
1188
1414
  subscriberRef.current = {
1189
1415
  onInteractionScheduledWorkCompleted: onInteractionScheduledWorkCompleted,
1190
- onInteractionTracked: onInteractionTracked,
1416
+ onInteractionTraced: onInteractionTraced,
1191
1417
  onWorkCanceled: onWorkCanceled,
1192
1418
  onWorkScheduled: onWorkScheduled,
1193
1419
  onWorkStarted: onWorkStarted,
@@ -1198,7 +1424,7 @@ function unstable_subscribe(subscriber) {
1198
1424
  }
1199
1425
 
1200
1426
  function unstable_unsubscribe(subscriber) {
1201
- if (enableSchedulerTracking) {
1427
+ if (enableSchedulerTracing) {
1202
1428
  subscribers.delete(subscriber);
1203
1429
 
1204
1430
  if (subscribers.size === 0) {
@@ -1207,13 +1433,13 @@ function unstable_unsubscribe(subscriber) {
1207
1433
  }
1208
1434
  }
1209
1435
 
1210
- function onInteractionTracked(interaction) {
1436
+ function onInteractionTraced(interaction) {
1211
1437
  var didCatchError = false;
1212
1438
  var caughtError = null;
1213
1439
 
1214
1440
  subscribers.forEach(function (subscriber) {
1215
1441
  try {
1216
- subscriber.onInteractionTracked(interaction);
1442
+ subscriber.onInteractionTraced(interaction);
1217
1443
  } catch (error) {
1218
1444
  if (!didCatchError) {
1219
1445
  didCatchError = true;
@@ -1396,8 +1622,8 @@ function getComponentName(type) {
1396
1622
  return type;
1397
1623
  }
1398
1624
  switch (type) {
1399
- case REACT_ASYNC_MODE_TYPE:
1400
- return 'AsyncMode';
1625
+ case REACT_CONCURRENT_MODE_TYPE:
1626
+ return 'ConcurrentMode';
1401
1627
  case REACT_FRAGMENT_TYPE:
1402
1628
  return 'Fragment';
1403
1629
  case REACT_PORTAL_TYPE:
@@ -1478,19 +1704,22 @@ var ReactSharedInternals = {
1478
1704
  // This re-export is only required for UMD bundles;
1479
1705
  // CJS bundles use the shared NPM package.
1480
1706
  objectAssign(ReactSharedInternals, {
1481
- Schedule: {
1482
- unstable_cancelScheduledWork: cancelScheduledWork,
1483
- unstable_now: now,
1484
- unstable_scheduleWork: scheduleWork
1707
+ Scheduler: {
1708
+ unstable_cancelCallback: unstable_cancelCallback,
1709
+ unstable_now: getCurrentTime,
1710
+ unstable_scheduleCallback: unstable_scheduleCallback,
1711
+ unstable_runWithPriority: unstable_runWithPriority,
1712
+ unstable_wrapCallback: unstable_wrapCallback,
1713
+ unstable_getCurrentPriorityLevel: unstable_getCurrentPriorityLevel
1485
1714
  },
1486
- ScheduleTracking: {
1715
+ SchedulerTracing: {
1487
1716
  __interactionsRef: interactionsRef,
1488
1717
  __subscriberRef: subscriberRef,
1489
1718
  unstable_clear: unstable_clear,
1490
1719
  unstable_getCurrent: unstable_getCurrent,
1491
1720
  unstable_getThreadID: unstable_getThreadID,
1492
1721
  unstable_subscribe: unstable_subscribe,
1493
- unstable_track: unstable_track,
1722
+ unstable_trace: unstable_trace,
1494
1723
  unstable_unsubscribe: unstable_unsubscribe,
1495
1724
  unstable_wrap: unstable_wrap
1496
1725
  }
@@ -2251,10 +2480,28 @@ function forwardRef(render) {
2251
2480
  };
2252
2481
  }
2253
2482
 
2483
+ function pure(render, compare) {
2484
+ {
2485
+ if (typeof render !== 'function') {
2486
+ warningWithoutStack$1(false, 'pure: The first argument must be a function component. Instead ' + 'received: %s', render === null ? 'null' : typeof render);
2487
+ } else {
2488
+ var prototype = render.prototype;
2489
+ if (prototype && prototype.isReactComponent) {
2490
+ warningWithoutStack$1(false, 'pure: The first argument must be a function component. Classes ' + 'are not supported. Use React.PureComponent instead.');
2491
+ }
2492
+ }
2493
+ }
2494
+ return {
2495
+ $$typeof: REACT_PURE_TYPE,
2496
+ render: render,
2497
+ compare: compare === undefined ? null : compare
2498
+ };
2499
+ }
2500
+
2254
2501
  function isValidElementType(type) {
2255
2502
  return typeof type === 'string' || typeof type === 'function' ||
2256
2503
  // Note: its typeof might be other than 'symbol' or 'number' if it's a polyfill.
2257
- type === REACT_FRAGMENT_TYPE || type === REACT_ASYNC_MODE_TYPE || type === REACT_PROFILER_TYPE || type === REACT_STRICT_MODE_TYPE || type === REACT_PLACEHOLDER_TYPE || typeof type === 'object' && type !== null && (typeof type.then === 'function' || type.$$typeof === REACT_PROVIDER_TYPE || type.$$typeof === REACT_CONTEXT_TYPE || type.$$typeof === REACT_FORWARD_REF_TYPE);
2504
+ type === REACT_FRAGMENT_TYPE || type === REACT_CONCURRENT_MODE_TYPE || type === REACT_PROFILER_TYPE || type === REACT_STRICT_MODE_TYPE || type === REACT_PLACEHOLDER_TYPE || typeof type === 'object' && type !== null && (typeof type.then === 'function' || type.$$typeof === REACT_PURE_TYPE || type.$$typeof === REACT_PROVIDER_TYPE || type.$$typeof === REACT_CONTEXT_TYPE || type.$$typeof === REACT_FORWARD_REF_TYPE);
2258
2505
  }
2259
2506
 
2260
2507
  /**
@@ -2507,7 +2754,7 @@ function validatePropTypes(element) {
2507
2754
  var name = void 0,
2508
2755
  propTypes = void 0;
2509
2756
  if (typeof type === 'function') {
2510
- // Class or functional component
2757
+ // Class or function component
2511
2758
  name = type.displayName || type.name;
2512
2759
  propTypes = type.propTypes;
2513
2760
  } else if (typeof type === 'object' && type !== null && type.$$typeof === REACT_FORWARD_REF_TYPE) {
@@ -2659,10 +2906,11 @@ var React = {
2659
2906
 
2660
2907
  createContext: createContext,
2661
2908
  forwardRef: forwardRef,
2909
+ pure: pure,
2662
2910
 
2663
2911
  Fragment: REACT_FRAGMENT_TYPE,
2664
2912
  StrictMode: REACT_STRICT_MODE_TYPE,
2665
- unstable_AsyncMode: REACT_ASYNC_MODE_TYPE,
2913
+ unstable_ConcurrentMode: REACT_CONCURRENT_MODE_TYPE,
2666
2914
  unstable_Profiler: REACT_PROFILER_TYPE,
2667
2915
 
2668
2916
  createElement: createElementWithValidation,