react 16.6.0-alpha.400d197 → 16.6.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -4,7 +4,7 @@
4
4
  "keywords": [
5
5
  "react"
6
6
  ],
7
- "version": "16.6.0-alpha.400d197",
7
+ "version": "16.6.1",
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
- "scheduler": "^0.10.0-alpha.400d197"
27
+ "scheduler": "^0.11.0"
28
28
  },
29
29
  "browserify": {
30
30
  "transform": [
@@ -1,4 +1,4 @@
1
- /** @license React v16.6.0-alpha.400d197
1
+ /** @license React v16.6.1
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.6.0-alpha.400d197';
20
+ var ReactVersion = '16.6.1';
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,10 +30,12 @@ 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
+
33
34
  var REACT_CONCURRENT_MODE_TYPE = hasSymbol ? Symbol.for('react.concurrent_mode') : 0xeacf;
34
35
  var REACT_FORWARD_REF_TYPE = hasSymbol ? Symbol.for('react.forward_ref') : 0xead0;
35
- var REACT_PLACEHOLDER_TYPE = hasSymbol ? Symbol.for('react.placeholder') : 0xead1;
36
- var REACT_PURE_TYPE = hasSymbol ? Symbol.for('react.pure') : 0xead3;
36
+ var REACT_SUSPENSE_TYPE = hasSymbol ? Symbol.for('react.suspense') : 0xead1;
37
+ var REACT_MEMO_TYPE = hasSymbol ? Symbol.for('react.memo') : 0xead3;
38
+ var REACT_LAZY_TYPE = hasSymbol ? Symbol.for('react.lazy') : 0xead4;
37
39
 
38
40
  var MAYBE_ITERATOR_SYMBOL = typeof Symbol === 'function' && Symbol.iterator;
39
41
  var FAUX_ITERATOR_SYMBOL = '@@iterator';
@@ -49,12 +51,7 @@ function getIteratorFn(maybeIterable) {
49
51
  return null;
50
52
  }
51
53
 
52
- // Exports ReactDOM.createRoot
53
-
54
-
55
- // Suspense
56
- var enableSuspense = false;
57
- var enableHooks_DEPRECATED = false;
54
+ var enableHooks = false;
58
55
  // Helps identify side effects in begin-phase lifecycle hooks and setState reducers:
59
56
 
60
57
 
@@ -86,6 +83,11 @@ var enableSchedulerTracing = true;
86
83
  // React Fire: prevent the value and checked attributes from syncing
87
84
  // with their related DOM properties
88
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 = false;
90
+
89
91
  /*
90
92
  object-assign
91
93
  (c) Sindre Sorhus
@@ -301,63 +303,24 @@ var warningWithoutStack = function () {};
301
303
  return;
302
304
  }
303
305
  if (typeof console !== 'undefined') {
304
- var _args$map = args.map(function (item) {
306
+ var argsWithFormat = args.map(function (item) {
305
307
  return '' + item;
306
- }),
307
- a = _args$map[0],
308
- b = _args$map[1],
309
- c = _args$map[2],
310
- d = _args$map[3],
311
- e = _args$map[4],
312
- f = _args$map[5],
313
- g = _args$map[6],
314
- h = _args$map[7];
315
-
316
- var message = 'Warning: ' + format;
317
-
318
- // We intentionally don't use spread (or .apply) because it breaks IE9:
319
- // https://github.com/facebook/react/issues/13610
320
- switch (args.length) {
321
- case 0:
322
- console.error(message);
323
- break;
324
- case 1:
325
- console.error(message, a);
326
- break;
327
- case 2:
328
- console.error(message, a, b);
329
- break;
330
- case 3:
331
- console.error(message, a, b, c);
332
- break;
333
- case 4:
334
- console.error(message, a, b, c, d);
335
- break;
336
- case 5:
337
- console.error(message, a, b, c, d, e);
338
- break;
339
- case 6:
340
- console.error(message, a, b, c, d, e, f);
341
- break;
342
- case 7:
343
- console.error(message, a, b, c, d, e, f, g);
344
- break;
345
- case 8:
346
- console.error(message, a, b, c, d, e, f, g, h);
347
- break;
348
- default:
349
- throw new Error('warningWithoutStack() currently supports at most 8 arguments.');
350
- }
308
+ });
309
+ argsWithFormat.unshift('Warning: ' + format);
310
+
311
+ // We intentionally don't use spread (or .apply) directly because it
312
+ // breaks IE9: https://github.com/facebook/react/issues/13610
313
+ Function.prototype.apply.call(console.error, console, argsWithFormat);
351
314
  }
352
315
  try {
353
316
  // --- Welcome to debugging React ---
354
317
  // This error was thrown as a convenience so that you can use this stack
355
318
  // to find the callsite that caused this warning to fire.
356
319
  var argIndex = 0;
357
- var _message = 'Warning: ' + format.replace(/%s/g, function () {
320
+ var message = 'Warning: ' + format.replace(/%s/g, function () {
358
321
  return args[argIndex++];
359
322
  });
360
- throw new Error(_message);
323
+ throw new Error(message);
361
324
  } catch (x) {}
362
325
  };
363
326
  }
@@ -575,9 +538,9 @@ function createRef() {
575
538
 
576
539
  // TODO: Use symbols?
577
540
  var ImmediatePriority = 1;
578
- var InteractivePriority = 2;
541
+ var UserBlockingPriority = 2;
579
542
  var NormalPriority = 3;
580
- var WheneverPriority = 4;
543
+ var IdlePriority = 4;
581
544
 
582
545
  // Max 31 bit integer. The max integer size in V8 for 32-bit systems.
583
546
  // Math.pow(2, 30) - 1
@@ -587,14 +550,15 @@ var maxSigned31BitInt = 1073741823;
587
550
  // Times out immediately
588
551
  var IMMEDIATE_PRIORITY_TIMEOUT = -1;
589
552
  // Eventually times out
590
- var INTERACTIVE_PRIORITY_TIMEOUT = 250;
553
+ var USER_BLOCKING_PRIORITY = 250;
591
554
  var NORMAL_PRIORITY_TIMEOUT = 5000;
592
555
  // Never times out
593
- var WHENEVER_PRIORITY_TIMEOUT = maxSigned31BitInt;
556
+ var IDLE_PRIORITY = maxSigned31BitInt;
594
557
 
595
558
  // Callbacks are stored as a circular, doubly linked list.
596
559
  var firstCallbackNode = null;
597
560
 
561
+ var currentDidTimeout = false;
598
562
  var currentPriorityLevel = NormalPriority;
599
563
  var currentEventStartTime = -1;
600
564
  var currentExpirationTime = -1;
@@ -606,35 +570,6 @@ var isHostCallbackScheduled = false;
606
570
 
607
571
  var hasNativePerformanceNow = typeof performance === 'object' && typeof performance.now === 'function';
608
572
 
609
- var timeRemaining;
610
- if (hasNativePerformanceNow) {
611
- timeRemaining = function () {
612
- if (firstCallbackNode !== null && firstCallbackNode.expirationTime < currentExpirationTime) {
613
- // A higher priority callback was scheduled. Yield so we can switch to
614
- // working on that.
615
- return 0;
616
- }
617
- // We assume that if we have a performance timer that the rAF callback
618
- // gets a performance timer value. Not sure if this is always true.
619
- var remaining = getFrameDeadline() - performance.now();
620
- return remaining > 0 ? remaining : 0;
621
- };
622
- } else {
623
- timeRemaining = function () {
624
- // Fallback to Date.now()
625
- if (firstCallbackNode !== null && firstCallbackNode.expirationTime < currentExpirationTime) {
626
- return 0;
627
- }
628
- var remaining = getFrameDeadline() - Date.now();
629
- return remaining > 0 ? remaining : 0;
630
- };
631
- }
632
-
633
- var deadlineObject = {
634
- timeRemaining: timeRemaining,
635
- didTimeout: false
636
- };
637
-
638
573
  function ensureHostCallbackIsScheduled() {
639
574
  if (isExecutingCallback) {
640
575
  // Don't schedule work yet; wait until the next time we yield.
@@ -679,7 +614,7 @@ function flushFirstCallback() {
679
614
  currentExpirationTime = expirationTime;
680
615
  var continuationCallback;
681
616
  try {
682
- continuationCallback = callback(deadlineObject);
617
+ continuationCallback = callback();
683
618
  } finally {
684
619
  currentPriorityLevel = previousPriorityLevel;
685
620
  currentExpirationTime = previousExpirationTime;
@@ -723,7 +658,7 @@ function flushFirstCallback() {
723
658
  } else if (nextAfterContinuation === firstCallbackNode) {
724
659
  // The new callback is the highest priority callback in the list.
725
660
  firstCallbackNode = continuationNode;
726
- ensureHostCallbackIsScheduled(firstCallbackNode);
661
+ ensureHostCallbackIsScheduled();
727
662
  }
728
663
 
729
664
  var previous = nextAfterContinuation.previous;
@@ -739,7 +674,6 @@ function flushImmediateWork() {
739
674
  // Confirm we've exited the outer most event handler
740
675
  currentEventStartTime === -1 && firstCallbackNode !== null && firstCallbackNode.priorityLevel === ImmediatePriority) {
741
676
  isExecutingCallback = true;
742
- deadlineObject.didTimeout = true;
743
677
  try {
744
678
  do {
745
679
  flushFirstCallback();
@@ -750,7 +684,7 @@ function flushImmediateWork() {
750
684
  isExecutingCallback = false;
751
685
  if (firstCallbackNode !== null) {
752
686
  // There's still work remaining. Request another callback.
753
- ensureHostCallbackIsScheduled(firstCallbackNode);
687
+ ensureHostCallbackIsScheduled();
754
688
  } else {
755
689
  isHostCallbackScheduled = false;
756
690
  }
@@ -760,7 +694,8 @@ function flushImmediateWork() {
760
694
 
761
695
  function flushWork(didTimeout) {
762
696
  isExecutingCallback = true;
763
- deadlineObject.didTimeout = didTimeout;
697
+ var previousDidTimeout = currentDidTimeout;
698
+ currentDidTimeout = didTimeout;
764
699
  try {
765
700
  if (didTimeout) {
766
701
  // Flush all the expired callbacks without yielding.
@@ -782,14 +717,15 @@ function flushWork(didTimeout) {
782
717
  if (firstCallbackNode !== null) {
783
718
  do {
784
719
  flushFirstCallback();
785
- } while (firstCallbackNode !== null && getFrameDeadline() - getCurrentTime() > 0);
720
+ } while (firstCallbackNode !== null && !shouldYieldToHost());
786
721
  }
787
722
  }
788
723
  } finally {
789
724
  isExecutingCallback = false;
725
+ currentDidTimeout = previousDidTimeout;
790
726
  if (firstCallbackNode !== null) {
791
727
  // There's still work remaining. Request another callback.
792
- ensureHostCallbackIsScheduled(firstCallbackNode);
728
+ ensureHostCallbackIsScheduled();
793
729
  } else {
794
730
  isHostCallbackScheduled = false;
795
731
  }
@@ -801,9 +737,9 @@ function flushWork(didTimeout) {
801
737
  function unstable_runWithPriority(priorityLevel, eventHandler) {
802
738
  switch (priorityLevel) {
803
739
  case ImmediatePriority:
804
- case InteractivePriority:
740
+ case UserBlockingPriority:
805
741
  case NormalPriority:
806
- case WheneverPriority:
742
+ case IdlePriority:
807
743
  break;
808
744
  default:
809
745
  priorityLevel = NormalPriority;
@@ -856,11 +792,11 @@ function unstable_scheduleCallback(callback, deprecated_options) {
856
792
  case ImmediatePriority:
857
793
  expirationTime = startTime + IMMEDIATE_PRIORITY_TIMEOUT;
858
794
  break;
859
- case InteractivePriority:
860
- expirationTime = startTime + INTERACTIVE_PRIORITY_TIMEOUT;
795
+ case UserBlockingPriority:
796
+ expirationTime = startTime + USER_BLOCKING_PRIORITY;
861
797
  break;
862
- case WheneverPriority:
863
- expirationTime = startTime + WHENEVER_PRIORITY_TIMEOUT;
798
+ case IdlePriority:
799
+ expirationTime = startTime + IDLE_PRIORITY;
864
800
  break;
865
801
  case NormalPriority:
866
802
  default:
@@ -882,7 +818,7 @@ function unstable_scheduleCallback(callback, deprecated_options) {
882
818
  if (firstCallbackNode === null) {
883
819
  // This is the first callback in the list.
884
820
  firstCallbackNode = newNode.next = newNode.previous = newNode;
885
- ensureHostCallbackIsScheduled(firstCallbackNode);
821
+ ensureHostCallbackIsScheduled();
886
822
  } else {
887
823
  var next = null;
888
824
  var node = firstCallbackNode;
@@ -902,7 +838,7 @@ function unstable_scheduleCallback(callback, deprecated_options) {
902
838
  } else if (next === firstCallbackNode) {
903
839
  // The new callback has the earliest expiration in the entire list.
904
840
  firstCallbackNode = newNode;
905
- ensureHostCallbackIsScheduled(firstCallbackNode);
841
+ ensureHostCallbackIsScheduled();
906
842
  }
907
843
 
908
844
  var previous = next.previous;
@@ -941,6 +877,10 @@ function unstable_getCurrentPriorityLevel() {
941
877
  return currentPriorityLevel;
942
878
  }
943
879
 
880
+ function unstable_shouldYield() {
881
+ return !currentDidTimeout && (firstCallbackNode !== null && firstCallbackNode.expirationTime < currentExpirationTime || shouldYieldToHost());
882
+ }
883
+
944
884
  // The remaining code is essentially a polyfill for requestIdleCallback. It
945
885
  // works by scheduling a requestAnimationFrame, storing the time for the start
946
886
  // of the frame, then scheduling a postMessage which gets scheduled after paint.
@@ -1003,14 +943,14 @@ if (hasNativePerformanceNow) {
1003
943
 
1004
944
  var requestHostCallback;
1005
945
  var cancelHostCallback;
1006
- var getFrameDeadline;
946
+ var shouldYieldToHost;
1007
947
 
1008
948
  if (typeof window !== 'undefined' && window._schedMock) {
1009
949
  // Dynamic injection, only for testing purposes.
1010
950
  var impl = window._schedMock;
1011
951
  requestHostCallback = impl[0];
1012
952
  cancelHostCallback = impl[1];
1013
- getFrameDeadline = impl[2];
953
+ shouldYieldToHost = impl[2];
1014
954
  } else if (
1015
955
  // If Scheduler runs in a non-DOM environment, it falls back to a naive
1016
956
  // implementation using setTimeout.
@@ -1045,8 +985,8 @@ typeof window.addEventListener !== 'function') {
1045
985
  cancelHostCallback = function () {
1046
986
  _callback = null;
1047
987
  };
1048
- getFrameDeadline = function () {
1049
- return Infinity;
988
+ shouldYieldToHost = function () {
989
+ return false;
1050
990
  };
1051
991
  getCurrentTime = function () {
1052
992
  return _currentTime === -1 ? 0 : _currentTime;
@@ -1062,13 +1002,13 @@ typeof window.addEventListener !== 'function') {
1062
1002
  }
1063
1003
  }
1064
1004
 
1065
- var scheduledCallback = null;
1066
- var isIdleScheduled = false;
1005
+ var scheduledHostCallback = null;
1006
+ var isMessageEventScheduled = false;
1067
1007
  var timeoutTime = -1;
1068
1008
 
1069
1009
  var isAnimationFrameScheduled = false;
1070
1010
 
1071
- var isPerformingIdleWork = false;
1011
+ var isFlushingHostCallback = false;
1072
1012
 
1073
1013
  var frameDeadline = 0;
1074
1014
  // We start out assuming that we run at 30fps but then the heuristic tracking
@@ -1077,8 +1017,8 @@ typeof window.addEventListener !== 'function') {
1077
1017
  var previousFrameTime = 33;
1078
1018
  var activeFrameTime = 33;
1079
1019
 
1080
- getFrameDeadline = function () {
1081
- return frameDeadline;
1020
+ shouldYieldToHost = function () {
1021
+ return frameDeadline <= getCurrentTime();
1082
1022
  };
1083
1023
 
1084
1024
  // We use the postMessage trick to defer idle work until after the repaint.
@@ -1088,7 +1028,12 @@ typeof window.addEventListener !== 'function') {
1088
1028
  return;
1089
1029
  }
1090
1030
 
1091
- isIdleScheduled = false;
1031
+ isMessageEventScheduled = false;
1032
+
1033
+ var prevScheduledCallback = scheduledHostCallback;
1034
+ var prevTimeoutTime = timeoutTime;
1035
+ scheduledHostCallback = null;
1036
+ timeoutTime = -1;
1092
1037
 
1093
1038
  var currentTime = getCurrentTime();
1094
1039
 
@@ -1096,7 +1041,7 @@ typeof window.addEventListener !== 'function') {
1096
1041
  if (frameDeadline - currentTime <= 0) {
1097
1042
  // There's no time left in this idle period. Check if the callback has
1098
1043
  // a timeout and whether it's been exceeded.
1099
- if (timeoutTime !== -1 && timeoutTime <= currentTime) {
1044
+ if (prevTimeoutTime !== -1 && prevTimeoutTime <= currentTime) {
1100
1045
  // Exceeded the timeout. Invoke the callback even though there's no
1101
1046
  // time left.
1102
1047
  didTimeout = true;
@@ -1108,19 +1053,18 @@ typeof window.addEventListener !== 'function') {
1108
1053
  requestAnimationFrameWithTimeout(animationTick);
1109
1054
  }
1110
1055
  // Exit without invoking the callback.
1056
+ scheduledHostCallback = prevScheduledCallback;
1057
+ timeoutTime = prevTimeoutTime;
1111
1058
  return;
1112
1059
  }
1113
1060
  }
1114
1061
 
1115
- timeoutTime = -1;
1116
- var callback = scheduledCallback;
1117
- scheduledCallback = null;
1118
- if (callback !== null) {
1119
- isPerformingIdleWork = true;
1062
+ if (prevScheduledCallback !== null) {
1063
+ isFlushingHostCallback = true;
1120
1064
  try {
1121
- callback(didTimeout);
1065
+ prevScheduledCallback(didTimeout);
1122
1066
  } finally {
1123
- isPerformingIdleWork = false;
1067
+ isFlushingHostCallback = false;
1124
1068
  }
1125
1069
  }
1126
1070
  };
@@ -1129,7 +1073,22 @@ typeof window.addEventListener !== 'function') {
1129
1073
  window.addEventListener('message', idleTick, false);
1130
1074
 
1131
1075
  var animationTick = function (rafTime) {
1132
- isAnimationFrameScheduled = false;
1076
+ if (scheduledHostCallback !== null) {
1077
+ // Eagerly schedule the next animation callback at the beginning of the
1078
+ // frame. If the scheduler queue is not empty at the end of the frame, it
1079
+ // will continue flushing inside that callback. If the queue *is* empty,
1080
+ // then it will exit immediately. Posting the callback at the start of the
1081
+ // frame ensures it's fired within the earliest possible frame. If we
1082
+ // waited until the end of the frame to post the callback, we risk the
1083
+ // browser skipping a frame and not firing the callback until the frame
1084
+ // after that.
1085
+ requestAnimationFrameWithTimeout(animationTick);
1086
+ } else {
1087
+ // No pending work. Exit.
1088
+ isAnimationFrameScheduled = false;
1089
+ return;
1090
+ }
1091
+
1133
1092
  var nextFrameTime = rafTime - frameDeadline + activeFrameTime;
1134
1093
  if (nextFrameTime < activeFrameTime && previousFrameTime < activeFrameTime) {
1135
1094
  if (nextFrameTime < 8) {
@@ -1149,16 +1108,16 @@ typeof window.addEventListener !== 'function') {
1149
1108
  previousFrameTime = nextFrameTime;
1150
1109
  }
1151
1110
  frameDeadline = rafTime + activeFrameTime;
1152
- if (!isIdleScheduled) {
1153
- isIdleScheduled = true;
1111
+ if (!isMessageEventScheduled) {
1112
+ isMessageEventScheduled = true;
1154
1113
  window.postMessage(messageKey, '*');
1155
1114
  }
1156
1115
  };
1157
1116
 
1158
1117
  requestHostCallback = function (callback, absoluteTimeout) {
1159
- scheduledCallback = callback;
1118
+ scheduledHostCallback = callback;
1160
1119
  timeoutTime = absoluteTimeout;
1161
- if (isPerformingIdleWork || absoluteTimeout < 0) {
1120
+ if (isFlushingHostCallback || absoluteTimeout < 0) {
1162
1121
  // Don't wait for the next frame. Continue working ASAP, in a new event.
1163
1122
  window.postMessage(messageKey, '*');
1164
1123
  } else if (!isAnimationFrameScheduled) {
@@ -1172,8 +1131,8 @@ typeof window.addEventListener !== 'function') {
1172
1131
  };
1173
1132
 
1174
1133
  cancelHostCallback = function () {
1175
- scheduledCallback = null;
1176
- isIdleScheduled = false;
1134
+ scheduledHostCallback = null;
1135
+ isMessageEventScheduled = false;
1177
1136
  timeoutTime = -1;
1178
1137
  };
1179
1138
  }
@@ -1581,10 +1540,13 @@ var describeComponentFrame = function (name, source, ownerName) {
1581
1540
  var Resolved = 1;
1582
1541
 
1583
1542
 
1543
+ function refineResolvedLazyComponent(lazyComponent) {
1544
+ return lazyComponent._status === Resolved ? lazyComponent._result : null;
1545
+ }
1584
1546
 
1585
-
1586
- function refineResolvedThenable(thenable) {
1587
- return thenable._reactStatus === Resolved ? thenable._reactResult : null;
1547
+ function getWrappedName(outerType, innerType, wrapperName) {
1548
+ var functionName = innerType.displayName || innerType.name || '';
1549
+ return outerType.displayName || (functionName !== '' ? wrapperName + '(' + functionName + ')' : wrapperName);
1588
1550
  }
1589
1551
 
1590
1552
  function getComponentName(type) {
@@ -1614,8 +1576,8 @@ function getComponentName(type) {
1614
1576
  return 'Profiler';
1615
1577
  case REACT_STRICT_MODE_TYPE:
1616
1578
  return 'StrictMode';
1617
- case REACT_PLACEHOLDER_TYPE:
1618
- return 'Placeholder';
1579
+ case REACT_SUSPENSE_TYPE:
1580
+ return 'Suspense';
1619
1581
  }
1620
1582
  if (typeof type === 'object') {
1621
1583
  switch (type.$$typeof) {
@@ -1624,16 +1586,17 @@ function getComponentName(type) {
1624
1586
  case REACT_PROVIDER_TYPE:
1625
1587
  return 'Context.Provider';
1626
1588
  case REACT_FORWARD_REF_TYPE:
1627
- var renderFn = type.render;
1628
- var functionName = renderFn.displayName || renderFn.name || '';
1629
- return type.displayName || (functionName !== '' ? 'ForwardRef(' + functionName + ')' : 'ForwardRef');
1630
- }
1631
- if (typeof type.then === 'function') {
1632
- var thenable = type;
1633
- var resolvedThenable = refineResolvedThenable(thenable);
1634
- if (resolvedThenable) {
1635
- return getComponentName(resolvedThenable);
1636
- }
1589
+ return getWrappedName(type, type.render, 'ForwardRef');
1590
+ case REACT_MEMO_TYPE:
1591
+ return getComponentName(type.type);
1592
+ case REACT_LAZY_TYPE:
1593
+ {
1594
+ var thenable = type;
1595
+ var resolvedThenable = refineResolvedLazyComponent(thenable);
1596
+ if (resolvedThenable) {
1597
+ return getComponentName(resolvedThenable);
1598
+ }
1599
+ }
1637
1600
  }
1638
1601
  }
1639
1602
  return null;
@@ -1688,6 +1651,7 @@ var ReactSharedInternals = {
1688
1651
  objectAssign(ReactSharedInternals, {
1689
1652
  Scheduler: {
1690
1653
  unstable_cancelCallback: unstable_cancelCallback,
1654
+ unstable_shouldYield: unstable_shouldYield,
1691
1655
  unstable_now: getCurrentTime,
1692
1656
  unstable_scheduleCallback: unstable_scheduleCallback,
1693
1657
  unstable_runWithPriority: unstable_runWithPriority,
@@ -2377,12 +2341,6 @@ function onlyChild(children) {
2377
2341
  return children;
2378
2342
  }
2379
2343
 
2380
- function readContext(context, observedBits) {
2381
- var dispatcher = ReactCurrentOwner.currentDispatcher;
2382
- !(dispatcher !== null) ? invariant(false, 'Context.unstable_read(): Context can only be read while React is rendering, e.g. inside the render method or getDerivedStateFromProps.') : void 0;
2383
- return dispatcher.readContext(context, observedBits);
2384
- }
2385
-
2386
2344
  function createContext(defaultValue, calculateChangedBits) {
2387
2345
  if (calculateChangedBits === undefined) {
2388
2346
  calculateChangedBits = null;
@@ -2404,16 +2362,69 @@ function createContext(defaultValue, calculateChangedBits) {
2404
2362
  _currentValue2: defaultValue,
2405
2363
  // These are circular
2406
2364
  Provider: null,
2407
- Consumer: null,
2408
- unstable_read: null
2365
+ Consumer: null
2409
2366
  };
2410
2367
 
2411
2368
  context.Provider = {
2412
2369
  $$typeof: REACT_PROVIDER_TYPE,
2413
2370
  _context: context
2414
2371
  };
2415
- context.Consumer = context;
2416
- context.unstable_read = readContext.bind(null, context);
2372
+
2373
+ var hasWarnedAboutUsingNestedContextConsumers = false;
2374
+ var hasWarnedAboutUsingConsumerProvider = false;
2375
+
2376
+ {
2377
+ // A separate object, but proxies back to the original context object for
2378
+ // backwards compatibility. It has a different $$typeof, so we can properly
2379
+ // warn for the incorrect usage of Context as a Consumer.
2380
+ var Consumer = {
2381
+ $$typeof: REACT_CONTEXT_TYPE,
2382
+ _context: context,
2383
+ _calculateChangedBits: context._calculateChangedBits
2384
+ };
2385
+ // $FlowFixMe: Flow complains about not setting a value, which is intentional here
2386
+ Object.defineProperties(Consumer, {
2387
+ Provider: {
2388
+ get: function () {
2389
+ if (!hasWarnedAboutUsingConsumerProvider) {
2390
+ hasWarnedAboutUsingConsumerProvider = true;
2391
+ warning$1(false, 'Rendering <Context.Consumer.Provider> is not supported and will be removed in ' + 'a future major release. Did you mean to render <Context.Provider> instead?');
2392
+ }
2393
+ return context.Provider;
2394
+ },
2395
+ set: function (_Provider) {
2396
+ context.Provider = _Provider;
2397
+ }
2398
+ },
2399
+ _currentValue: {
2400
+ get: function () {
2401
+ return context._currentValue;
2402
+ },
2403
+ set: function (_currentValue) {
2404
+ context._currentValue = _currentValue;
2405
+ }
2406
+ },
2407
+ _currentValue2: {
2408
+ get: function () {
2409
+ return context._currentValue2;
2410
+ },
2411
+ set: function (_currentValue2) {
2412
+ context._currentValue2 = _currentValue2;
2413
+ }
2414
+ },
2415
+ Consumer: {
2416
+ get: function () {
2417
+ if (!hasWarnedAboutUsingNestedContextConsumers) {
2418
+ hasWarnedAboutUsingNestedContextConsumers = true;
2419
+ warning$1(false, 'Rendering <Context.Consumer.Consumer> is not supported and will be removed in ' + 'a future major release. Did you mean to render <Context.Consumer> instead?');
2420
+ }
2421
+ return context.Consumer;
2422
+ }
2423
+ }
2424
+ });
2425
+ // $FlowFixMe: Flow complains about missing properties because it doesn't understand defineProperty
2426
+ context.Consumer = Consumer;
2427
+ }
2417
2428
 
2418
2429
  {
2419
2430
  context._currentRenderer = null;
@@ -2424,26 +2435,20 @@ function createContext(defaultValue, calculateChangedBits) {
2424
2435
  }
2425
2436
 
2426
2437
  function lazy(ctor) {
2427
- var thenable = null;
2428
2438
  return {
2429
- then: function (resolve, reject) {
2430
- if (thenable === null) {
2431
- // Lazily create thenable by wrapping in an extra thenable.
2432
- thenable = ctor();
2433
- ctor = null;
2434
- }
2435
- return thenable.then(resolve, reject);
2436
- },
2437
-
2439
+ $$typeof: REACT_LAZY_TYPE,
2440
+ _ctor: ctor,
2438
2441
  // React uses these fields to store the result.
2439
- _reactStatus: -1,
2440
- _reactResult: null
2442
+ _status: -1,
2443
+ _result: null
2441
2444
  };
2442
2445
  }
2443
2446
 
2444
2447
  function forwardRef(render) {
2445
2448
  {
2446
- if (typeof render !== 'function') {
2449
+ if (render != null && render.$$typeof === REACT_MEMO_TYPE) {
2450
+ warningWithoutStack$1(false, 'forwardRef requires a render function but received a `memo` ' + 'component. Instead of forwardRef(memo(...)), use ' + 'memo(forwardRef(...)).');
2451
+ } else if (typeof render !== 'function') {
2447
2452
  warningWithoutStack$1(false, 'forwardRef requires a render function but was given %s.', render === null ? 'null' : typeof render);
2448
2453
  } else {
2449
2454
  !(
@@ -2462,33 +2467,47 @@ function forwardRef(render) {
2462
2467
  };
2463
2468
  }
2464
2469
 
2465
- function pure(render, compare) {
2470
+ function isValidElementType(type) {
2471
+ return typeof type === 'string' || typeof type === 'function' ||
2472
+ // Note: its typeof might be other than 'symbol' or 'number' if it's a polyfill.
2473
+ type === REACT_FRAGMENT_TYPE || type === REACT_CONCURRENT_MODE_TYPE || type === REACT_PROFILER_TYPE || type === REACT_STRICT_MODE_TYPE || type === REACT_SUSPENSE_TYPE || typeof type === 'object' && type !== null && (type.$$typeof === REACT_LAZY_TYPE || type.$$typeof === REACT_MEMO_TYPE || type.$$typeof === REACT_PROVIDER_TYPE || type.$$typeof === REACT_CONTEXT_TYPE || type.$$typeof === REACT_FORWARD_REF_TYPE);
2474
+ }
2475
+
2476
+ function memo(type, compare) {
2466
2477
  {
2467
- if (typeof render !== 'function') {
2468
- warningWithoutStack$1(false, 'pure: The first argument must be a function component. Instead ' + 'received: %s', render === null ? 'null' : typeof render);
2469
- } else {
2470
- var prototype = render.prototype;
2471
- if (prototype && prototype.isReactComponent) {
2472
- warningWithoutStack$1(false, 'pure: The first argument must be a function component. Classes ' + 'are not supported. Use React.PureComponent instead.');
2473
- }
2478
+ if (!isValidElementType(type)) {
2479
+ warningWithoutStack$1(false, 'memo: The first argument must be a component. Instead ' + 'received: %s', type === null ? 'null' : typeof type);
2474
2480
  }
2475
2481
  }
2476
2482
  return {
2477
- $$typeof: REACT_PURE_TYPE,
2478
- render: render,
2483
+ $$typeof: REACT_MEMO_TYPE,
2484
+ type: type,
2479
2485
  compare: compare === undefined ? null : compare
2480
2486
  };
2481
2487
  }
2482
2488
 
2483
2489
  function resolveDispatcher() {
2484
2490
  var dispatcher = ReactCurrentOwner.currentDispatcher;
2485
- !(dispatcher !== null) ? invariant(false, 'Hooks can only be called inside the body of a functional component.') : void 0;
2491
+ !(dispatcher !== null) ? invariant(false, 'Hooks can only be called inside the body of a function component.') : void 0;
2486
2492
  return dispatcher;
2487
2493
  }
2488
2494
 
2489
- function useContext(context, observedBits) {
2495
+ function useContext(Context, observedBits) {
2490
2496
  var dispatcher = resolveDispatcher();
2491
- return dispatcher.useContext(context, observedBits);
2497
+ {
2498
+ // TODO: add a more generic warning for invalid values.
2499
+ if (Context._context !== undefined) {
2500
+ var realContext = Context._context;
2501
+ // Don't deduplicate because this legitimately causes bugs
2502
+ // and nobody should be using this in existing code.
2503
+ if (realContext.Consumer === Context) {
2504
+ warning$1(false, 'Calling useContext(Context.Consumer) is not supported, may cause bugs, and will be ' + 'removed in a future major release. Did you mean to call useContext(Context) instead?');
2505
+ } else if (realContext.Provider === Context) {
2506
+ warning$1(false, 'Calling useContext(Context.Provider) is not supported. ' + 'Did you mean to call useContext(Context) instead?');
2507
+ }
2508
+ }
2509
+ }
2510
+ return dispatcher.useContext(Context, observedBits);
2492
2511
  }
2493
2512
 
2494
2513
  function useState(initialState) {
@@ -2531,15 +2550,9 @@ function useMemo(create, inputs) {
2531
2550
  return dispatcher.useMemo(create, inputs);
2532
2551
  }
2533
2552
 
2534
- function useAPI(ref, create, inputs) {
2553
+ function useImperativeMethods(ref, create, inputs) {
2535
2554
  var dispatcher = resolveDispatcher();
2536
- return dispatcher.useAPI(ref, create, inputs);
2537
- }
2538
-
2539
- function isValidElementType(type) {
2540
- return typeof type === 'string' || typeof type === 'function' ||
2541
- // Note: its typeof might be other than 'symbol' or 'number' if it's a polyfill.
2542
- 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);
2555
+ return dispatcher.useImperativeMethods(ref, create, inputs);
2543
2556
  }
2544
2557
 
2545
2558
  /**
@@ -2944,12 +2957,12 @@ var React = {
2944
2957
 
2945
2958
  createContext: createContext,
2946
2959
  forwardRef: forwardRef,
2947
- pure: pure,
2960
+ lazy: lazy,
2961
+ memo: memo,
2948
2962
 
2949
2963
  Fragment: REACT_FRAGMENT_TYPE,
2950
2964
  StrictMode: REACT_STRICT_MODE_TYPE,
2951
- unstable_ConcurrentMode: REACT_CONCURRENT_MODE_TYPE,
2952
- unstable_Profiler: REACT_PROFILER_TYPE,
2965
+ Suspense: REACT_SUSPENSE_TYPE,
2953
2966
 
2954
2967
  createElement: createElementWithValidation,
2955
2968
  cloneElement: cloneElementWithValidation,
@@ -2961,16 +2974,19 @@ var React = {
2961
2974
  __SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED: ReactSharedInternals
2962
2975
  };
2963
2976
 
2964
- if (enableSuspense) {
2965
- React.Placeholder = REACT_PLACEHOLDER_TYPE;
2966
- React.lazy = lazy;
2977
+ if (enableStableConcurrentModeAPIs) {
2978
+ React.ConcurrentMode = REACT_CONCURRENT_MODE_TYPE;
2979
+ React.Profiler = REACT_PROFILER_TYPE;
2980
+ } else {
2981
+ React.unstable_ConcurrentMode = REACT_CONCURRENT_MODE_TYPE;
2982
+ React.unstable_Profiler = REACT_PROFILER_TYPE;
2967
2983
  }
2968
2984
 
2969
- if (enableHooks_DEPRECATED) {
2970
- React.useAPI = useAPI;
2985
+ if (enableHooks) {
2971
2986
  React.useCallback = useCallback;
2972
2987
  React.useContext = useContext;
2973
2988
  React.useEffect = useEffect;
2989
+ React.useImperativeMethods = useImperativeMethods;
2974
2990
  React.useLayoutEffect = useLayoutEffect;
2975
2991
  React.useMemo = useMemo;
2976
2992
  React.useMutationEffect = useMutationEffect;