react 16.7.0-alpha.0 → 16.8.0-alpha.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/build-info.json +8 -0
- package/cjs/react.development.js +102 -74
- package/cjs/react.production.min.js +16 -16
- package/package.json +54 -22
- package/umd/react.development.js +188 -148
- package/umd/react.production.min.js +26 -26
- package/umd/react.profiling.min.js +30 -30
package/umd/react.development.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/** @license React v16.
|
|
1
|
+
/** @license React v16.8.0-alpha.0
|
|
2
2
|
* react.development.js
|
|
3
3
|
*
|
|
4
4
|
* Copyright (c) Facebook, Inc. and its affiliates.
|
|
@@ -17,7 +17,7 @@
|
|
|
17
17
|
|
|
18
18
|
// TODO: this is special because it gets imported during build.
|
|
19
19
|
|
|
20
|
-
var ReactVersion = '16.
|
|
20
|
+
var ReactVersion = '16.8.0-alpha.0';
|
|
21
21
|
|
|
22
22
|
// The Symbol used to tag the ReactElement-like types. If there is no native Symbol
|
|
23
23
|
// nor polyfill, then a plain number is used for performance.
|
|
@@ -30,6 +30,7 @@ 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
36
|
var REACT_SUSPENSE_TYPE = hasSymbol ? Symbol.for('react.suspense') : 0xead1;
|
|
@@ -51,7 +52,6 @@ function getIteratorFn(maybeIterable) {
|
|
|
51
52
|
}
|
|
52
53
|
|
|
53
54
|
var enableHooks = true;
|
|
54
|
-
|
|
55
55
|
// Helps identify side effects in begin-phase lifecycle hooks and setState reducers:
|
|
56
56
|
|
|
57
57
|
|
|
@@ -74,6 +74,9 @@ var enableHooks = true;
|
|
|
74
74
|
// Trace which interactions trigger each commit.
|
|
75
75
|
var enableSchedulerTracing = true;
|
|
76
76
|
|
|
77
|
+
// Only used in www builds.
|
|
78
|
+
// TODO: true? Here it might just be false.
|
|
79
|
+
|
|
77
80
|
// Only used in www builds.
|
|
78
81
|
|
|
79
82
|
|
|
@@ -303,63 +306,24 @@ var warningWithoutStack = function () {};
|
|
|
303
306
|
return;
|
|
304
307
|
}
|
|
305
308
|
if (typeof console !== 'undefined') {
|
|
306
|
-
var
|
|
309
|
+
var argsWithFormat = args.map(function (item) {
|
|
307
310
|
return '' + item;
|
|
308
|
-
})
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
f = _args$map[5],
|
|
315
|
-
g = _args$map[6],
|
|
316
|
-
h = _args$map[7];
|
|
317
|
-
|
|
318
|
-
var message = 'Warning: ' + format;
|
|
319
|
-
|
|
320
|
-
// We intentionally don't use spread (or .apply) because it breaks IE9:
|
|
321
|
-
// https://github.com/facebook/react/issues/13610
|
|
322
|
-
switch (args.length) {
|
|
323
|
-
case 0:
|
|
324
|
-
console.error(message);
|
|
325
|
-
break;
|
|
326
|
-
case 1:
|
|
327
|
-
console.error(message, a);
|
|
328
|
-
break;
|
|
329
|
-
case 2:
|
|
330
|
-
console.error(message, a, b);
|
|
331
|
-
break;
|
|
332
|
-
case 3:
|
|
333
|
-
console.error(message, a, b, c);
|
|
334
|
-
break;
|
|
335
|
-
case 4:
|
|
336
|
-
console.error(message, a, b, c, d);
|
|
337
|
-
break;
|
|
338
|
-
case 5:
|
|
339
|
-
console.error(message, a, b, c, d, e);
|
|
340
|
-
break;
|
|
341
|
-
case 6:
|
|
342
|
-
console.error(message, a, b, c, d, e, f);
|
|
343
|
-
break;
|
|
344
|
-
case 7:
|
|
345
|
-
console.error(message, a, b, c, d, e, f, g);
|
|
346
|
-
break;
|
|
347
|
-
case 8:
|
|
348
|
-
console.error(message, a, b, c, d, e, f, g, h);
|
|
349
|
-
break;
|
|
350
|
-
default:
|
|
351
|
-
throw new Error('warningWithoutStack() currently supports at most 8 arguments.');
|
|
352
|
-
}
|
|
311
|
+
});
|
|
312
|
+
argsWithFormat.unshift('Warning: ' + format);
|
|
313
|
+
|
|
314
|
+
// We intentionally don't use spread (or .apply) directly because it
|
|
315
|
+
// breaks IE9: https://github.com/facebook/react/issues/13610
|
|
316
|
+
Function.prototype.apply.call(console.error, console, argsWithFormat);
|
|
353
317
|
}
|
|
354
318
|
try {
|
|
355
319
|
// --- Welcome to debugging React ---
|
|
356
320
|
// This error was thrown as a convenience so that you can use this stack
|
|
357
321
|
// to find the callsite that caused this warning to fire.
|
|
358
322
|
var argIndex = 0;
|
|
359
|
-
var
|
|
323
|
+
var message = 'Warning: ' + format.replace(/%s/g, function () {
|
|
360
324
|
return args[argIndex++];
|
|
361
325
|
});
|
|
362
|
-
throw new Error(
|
|
326
|
+
throw new Error(message);
|
|
363
327
|
} catch (x) {}
|
|
364
328
|
};
|
|
365
329
|
}
|
|
@@ -573,13 +537,16 @@ function createRef() {
|
|
|
573
537
|
return refObject;
|
|
574
538
|
}
|
|
575
539
|
|
|
540
|
+
var enableSchedulerDebugging$1 = false;
|
|
541
|
+
|
|
576
542
|
/* eslint-disable no-var */
|
|
577
543
|
|
|
578
544
|
// TODO: Use symbols?
|
|
579
545
|
var ImmediatePriority = 1;
|
|
580
546
|
var UserBlockingPriority = 2;
|
|
581
547
|
var NormalPriority = 3;
|
|
582
|
-
var
|
|
548
|
+
var LowPriority = 4;
|
|
549
|
+
var IdlePriority = 5;
|
|
583
550
|
|
|
584
551
|
// Max 31 bit integer. The max integer size in V8 for 32-bit systems.
|
|
585
552
|
// Math.pow(2, 30) - 1
|
|
@@ -591,12 +558,17 @@ var IMMEDIATE_PRIORITY_TIMEOUT = -1;
|
|
|
591
558
|
// Eventually times out
|
|
592
559
|
var USER_BLOCKING_PRIORITY = 250;
|
|
593
560
|
var NORMAL_PRIORITY_TIMEOUT = 5000;
|
|
561
|
+
var LOW_PRIORITY_TIMEOUT = 10000;
|
|
594
562
|
// Never times out
|
|
595
563
|
var IDLE_PRIORITY = maxSigned31BitInt;
|
|
596
564
|
|
|
597
565
|
// Callbacks are stored as a circular, doubly linked list.
|
|
598
566
|
var firstCallbackNode = null;
|
|
599
567
|
|
|
568
|
+
var currentDidTimeout = false;
|
|
569
|
+
// Pausing the scheduler is useful for debugging.
|
|
570
|
+
var isSchedulerPaused = false;
|
|
571
|
+
|
|
600
572
|
var currentPriorityLevel = NormalPriority;
|
|
601
573
|
var currentEventStartTime = -1;
|
|
602
574
|
var currentExpirationTime = -1;
|
|
@@ -608,35 +580,6 @@ var isHostCallbackScheduled = false;
|
|
|
608
580
|
|
|
609
581
|
var hasNativePerformanceNow = typeof performance === 'object' && typeof performance.now === 'function';
|
|
610
582
|
|
|
611
|
-
var timeRemaining;
|
|
612
|
-
if (hasNativePerformanceNow) {
|
|
613
|
-
timeRemaining = function () {
|
|
614
|
-
if (firstCallbackNode !== null && firstCallbackNode.expirationTime < currentExpirationTime) {
|
|
615
|
-
// A higher priority callback was scheduled. Yield so we can switch to
|
|
616
|
-
// working on that.
|
|
617
|
-
return 0;
|
|
618
|
-
}
|
|
619
|
-
// We assume that if we have a performance timer that the rAF callback
|
|
620
|
-
// gets a performance timer value. Not sure if this is always true.
|
|
621
|
-
var remaining = getFrameDeadline() - performance.now();
|
|
622
|
-
return remaining > 0 ? remaining : 0;
|
|
623
|
-
};
|
|
624
|
-
} else {
|
|
625
|
-
timeRemaining = function () {
|
|
626
|
-
// Fallback to Date.now()
|
|
627
|
-
if (firstCallbackNode !== null && firstCallbackNode.expirationTime < currentExpirationTime) {
|
|
628
|
-
return 0;
|
|
629
|
-
}
|
|
630
|
-
var remaining = getFrameDeadline() - Date.now();
|
|
631
|
-
return remaining > 0 ? remaining : 0;
|
|
632
|
-
};
|
|
633
|
-
}
|
|
634
|
-
|
|
635
|
-
var deadlineObject = {
|
|
636
|
-
timeRemaining: timeRemaining,
|
|
637
|
-
didTimeout: false
|
|
638
|
-
};
|
|
639
|
-
|
|
640
583
|
function ensureHostCallbackIsScheduled() {
|
|
641
584
|
if (isExecutingCallback) {
|
|
642
585
|
// Don't schedule work yet; wait until the next time we yield.
|
|
@@ -681,7 +624,7 @@ function flushFirstCallback() {
|
|
|
681
624
|
currentExpirationTime = expirationTime;
|
|
682
625
|
var continuationCallback;
|
|
683
626
|
try {
|
|
684
|
-
continuationCallback = callback(
|
|
627
|
+
continuationCallback = callback();
|
|
685
628
|
} finally {
|
|
686
629
|
currentPriorityLevel = previousPriorityLevel;
|
|
687
630
|
currentExpirationTime = previousExpirationTime;
|
|
@@ -741,7 +684,6 @@ function flushImmediateWork() {
|
|
|
741
684
|
// Confirm we've exited the outer most event handler
|
|
742
685
|
currentEventStartTime === -1 && firstCallbackNode !== null && firstCallbackNode.priorityLevel === ImmediatePriority) {
|
|
743
686
|
isExecutingCallback = true;
|
|
744
|
-
deadlineObject.didTimeout = true;
|
|
745
687
|
try {
|
|
746
688
|
do {
|
|
747
689
|
flushFirstCallback();
|
|
@@ -761,12 +703,20 @@ function flushImmediateWork() {
|
|
|
761
703
|
}
|
|
762
704
|
|
|
763
705
|
function flushWork(didTimeout) {
|
|
706
|
+
// Exit right away if we're currently paused
|
|
707
|
+
|
|
708
|
+
if (enableSchedulerDebugging$1 && isSchedulerPaused) {
|
|
709
|
+
return;
|
|
710
|
+
}
|
|
711
|
+
|
|
764
712
|
isExecutingCallback = true;
|
|
765
|
-
|
|
713
|
+
var previousDidTimeout = currentDidTimeout;
|
|
714
|
+
currentDidTimeout = didTimeout;
|
|
766
715
|
try {
|
|
767
716
|
if (didTimeout) {
|
|
768
717
|
// Flush all the expired callbacks without yielding.
|
|
769
|
-
while (firstCallbackNode !== null) {
|
|
718
|
+
while (firstCallbackNode !== null && !(enableSchedulerDebugging$1 && isSchedulerPaused)) {
|
|
719
|
+
// TODO Wrap i nfeature flag
|
|
770
720
|
// Read the current time. Flush all the callbacks that expire at or
|
|
771
721
|
// earlier than that time. Then read the current time again and repeat.
|
|
772
722
|
// This optimizes for as few performance.now calls as possible.
|
|
@@ -774,7 +724,7 @@ function flushWork(didTimeout) {
|
|
|
774
724
|
if (firstCallbackNode.expirationTime <= currentTime) {
|
|
775
725
|
do {
|
|
776
726
|
flushFirstCallback();
|
|
777
|
-
} while (firstCallbackNode !== null && firstCallbackNode.expirationTime <= currentTime);
|
|
727
|
+
} while (firstCallbackNode !== null && firstCallbackNode.expirationTime <= currentTime && !(enableSchedulerDebugging$1 && isSchedulerPaused));
|
|
778
728
|
continue;
|
|
779
729
|
}
|
|
780
730
|
break;
|
|
@@ -783,12 +733,16 @@ function flushWork(didTimeout) {
|
|
|
783
733
|
// Keep flushing callbacks until we run out of time in the frame.
|
|
784
734
|
if (firstCallbackNode !== null) {
|
|
785
735
|
do {
|
|
736
|
+
if (enableSchedulerDebugging$1 && isSchedulerPaused) {
|
|
737
|
+
break;
|
|
738
|
+
}
|
|
786
739
|
flushFirstCallback();
|
|
787
|
-
} while (firstCallbackNode !== null &&
|
|
740
|
+
} while (firstCallbackNode !== null && !shouldYieldToHost());
|
|
788
741
|
}
|
|
789
742
|
}
|
|
790
743
|
} finally {
|
|
791
744
|
isExecutingCallback = false;
|
|
745
|
+
currentDidTimeout = previousDidTimeout;
|
|
792
746
|
if (firstCallbackNode !== null) {
|
|
793
747
|
// There's still work remaining. Request another callback.
|
|
794
748
|
ensureHostCallbackIsScheduled();
|
|
@@ -805,6 +759,7 @@ function unstable_runWithPriority(priorityLevel, eventHandler) {
|
|
|
805
759
|
case ImmediatePriority:
|
|
806
760
|
case UserBlockingPriority:
|
|
807
761
|
case NormalPriority:
|
|
762
|
+
case LowPriority:
|
|
808
763
|
case IdlePriority:
|
|
809
764
|
break;
|
|
810
765
|
default:
|
|
@@ -864,6 +819,9 @@ function unstable_scheduleCallback(callback, deprecated_options) {
|
|
|
864
819
|
case IdlePriority:
|
|
865
820
|
expirationTime = startTime + IDLE_PRIORITY;
|
|
866
821
|
break;
|
|
822
|
+
case LowPriority:
|
|
823
|
+
expirationTime = startTime + LOW_PRIORITY_TIMEOUT;
|
|
824
|
+
break;
|
|
867
825
|
case NormalPriority:
|
|
868
826
|
default:
|
|
869
827
|
expirationTime = startTime + NORMAL_PRIORITY_TIMEOUT;
|
|
@@ -916,6 +874,21 @@ function unstable_scheduleCallback(callback, deprecated_options) {
|
|
|
916
874
|
return newNode;
|
|
917
875
|
}
|
|
918
876
|
|
|
877
|
+
function unstable_pauseExecution() {
|
|
878
|
+
isSchedulerPaused = true;
|
|
879
|
+
}
|
|
880
|
+
|
|
881
|
+
function unstable_continueExecution() {
|
|
882
|
+
isSchedulerPaused = false;
|
|
883
|
+
if (firstCallbackNode !== null) {
|
|
884
|
+
ensureHostCallbackIsScheduled();
|
|
885
|
+
}
|
|
886
|
+
}
|
|
887
|
+
|
|
888
|
+
function unstable_getFirstCallbackNode() {
|
|
889
|
+
return firstCallbackNode;
|
|
890
|
+
}
|
|
891
|
+
|
|
919
892
|
function unstable_cancelCallback(callbackNode) {
|
|
920
893
|
var next = callbackNode.next;
|
|
921
894
|
if (next === null) {
|
|
@@ -943,6 +916,10 @@ function unstable_getCurrentPriorityLevel() {
|
|
|
943
916
|
return currentPriorityLevel;
|
|
944
917
|
}
|
|
945
918
|
|
|
919
|
+
function unstable_shouldYield() {
|
|
920
|
+
return !currentDidTimeout && (firstCallbackNode !== null && firstCallbackNode.expirationTime < currentExpirationTime || shouldYieldToHost());
|
|
921
|
+
}
|
|
922
|
+
|
|
946
923
|
// The remaining code is essentially a polyfill for requestIdleCallback. It
|
|
947
924
|
// works by scheduling a requestAnimationFrame, storing the time for the start
|
|
948
925
|
// of the frame, then scheduling a postMessage which gets scheduled after paint.
|
|
@@ -1005,53 +982,54 @@ if (hasNativePerformanceNow) {
|
|
|
1005
982
|
|
|
1006
983
|
var requestHostCallback;
|
|
1007
984
|
var cancelHostCallback;
|
|
1008
|
-
var
|
|
985
|
+
var shouldYieldToHost;
|
|
1009
986
|
|
|
1010
|
-
|
|
987
|
+
var globalValue = null;
|
|
988
|
+
if (typeof window !== 'undefined') {
|
|
989
|
+
globalValue = window;
|
|
990
|
+
} else if (typeof global !== 'undefined') {
|
|
991
|
+
globalValue = global;
|
|
992
|
+
}
|
|
993
|
+
|
|
994
|
+
if (globalValue && globalValue._schedMock) {
|
|
1011
995
|
// Dynamic injection, only for testing purposes.
|
|
1012
|
-
var
|
|
1013
|
-
requestHostCallback =
|
|
1014
|
-
cancelHostCallback =
|
|
1015
|
-
|
|
996
|
+
var globalImpl = globalValue._schedMock;
|
|
997
|
+
requestHostCallback = globalImpl[0];
|
|
998
|
+
cancelHostCallback = globalImpl[1];
|
|
999
|
+
shouldYieldToHost = globalImpl[2];
|
|
1000
|
+
getCurrentTime = globalImpl[3];
|
|
1016
1001
|
} else if (
|
|
1017
1002
|
// If Scheduler runs in a non-DOM environment, it falls back to a naive
|
|
1018
1003
|
// implementation using setTimeout.
|
|
1019
1004
|
typeof window === 'undefined' ||
|
|
1020
|
-
//
|
|
1021
|
-
|
|
1022
|
-
|
|
1005
|
+
// Check if MessageChannel is supported, too.
|
|
1006
|
+
typeof MessageChannel !== 'function') {
|
|
1007
|
+
// If this accidentally gets imported in a non-browser environment, e.g. JavaScriptCore,
|
|
1008
|
+
// fallback to a naive implementation.
|
|
1023
1009
|
var _callback = null;
|
|
1024
|
-
var
|
|
1025
|
-
var _flushCallback = function (didTimeout, ms) {
|
|
1010
|
+
var _flushCallback = function (didTimeout) {
|
|
1026
1011
|
if (_callback !== null) {
|
|
1027
|
-
var cb = _callback;
|
|
1028
|
-
_callback = null;
|
|
1029
1012
|
try {
|
|
1030
|
-
|
|
1031
|
-
cb(didTimeout);
|
|
1013
|
+
_callback(didTimeout);
|
|
1032
1014
|
} finally {
|
|
1033
|
-
|
|
1015
|
+
_callback = null;
|
|
1034
1016
|
}
|
|
1035
1017
|
}
|
|
1036
1018
|
};
|
|
1037
1019
|
requestHostCallback = function (cb, ms) {
|
|
1038
|
-
if (
|
|
1020
|
+
if (_callback !== null) {
|
|
1039
1021
|
// Protect against re-entrancy.
|
|
1040
|
-
setTimeout(requestHostCallback, 0, cb
|
|
1022
|
+
setTimeout(requestHostCallback, 0, cb);
|
|
1041
1023
|
} else {
|
|
1042
1024
|
_callback = cb;
|
|
1043
|
-
setTimeout(_flushCallback,
|
|
1044
|
-
setTimeout(_flushCallback, maxSigned31BitInt, false, maxSigned31BitInt);
|
|
1025
|
+
setTimeout(_flushCallback, 0, false);
|
|
1045
1026
|
}
|
|
1046
1027
|
};
|
|
1047
1028
|
cancelHostCallback = function () {
|
|
1048
1029
|
_callback = null;
|
|
1049
1030
|
};
|
|
1050
|
-
|
|
1051
|
-
return
|
|
1052
|
-
};
|
|
1053
|
-
getCurrentTime = function () {
|
|
1054
|
-
return _currentTime === -1 ? 0 : _currentTime;
|
|
1031
|
+
shouldYieldToHost = function () {
|
|
1032
|
+
return false;
|
|
1055
1033
|
};
|
|
1056
1034
|
} else {
|
|
1057
1035
|
if (typeof console !== 'undefined') {
|
|
@@ -1079,17 +1057,14 @@ typeof window.addEventListener !== 'function') {
|
|
|
1079
1057
|
var previousFrameTime = 33;
|
|
1080
1058
|
var activeFrameTime = 33;
|
|
1081
1059
|
|
|
1082
|
-
|
|
1083
|
-
return frameDeadline;
|
|
1060
|
+
shouldYieldToHost = function () {
|
|
1061
|
+
return frameDeadline <= getCurrentTime();
|
|
1084
1062
|
};
|
|
1085
1063
|
|
|
1086
1064
|
// We use the postMessage trick to defer idle work until after the repaint.
|
|
1087
|
-
var
|
|
1088
|
-
var
|
|
1089
|
-
|
|
1090
|
-
return;
|
|
1091
|
-
}
|
|
1092
|
-
|
|
1065
|
+
var channel = new MessageChannel();
|
|
1066
|
+
var port = channel.port2;
|
|
1067
|
+
channel.port1.onmessage = function (event) {
|
|
1093
1068
|
isMessageEventScheduled = false;
|
|
1094
1069
|
|
|
1095
1070
|
var prevScheduledCallback = scheduledHostCallback;
|
|
@@ -1130,9 +1105,6 @@ typeof window.addEventListener !== 'function') {
|
|
|
1130
1105
|
}
|
|
1131
1106
|
}
|
|
1132
1107
|
};
|
|
1133
|
-
// Assumes that we have addEventListener in this environment. Might need
|
|
1134
|
-
// something better for old IE.
|
|
1135
|
-
window.addEventListener('message', idleTick, false);
|
|
1136
1108
|
|
|
1137
1109
|
var animationTick = function (rafTime) {
|
|
1138
1110
|
if (scheduledHostCallback !== null) {
|
|
@@ -1172,7 +1144,7 @@ typeof window.addEventListener !== 'function') {
|
|
|
1172
1144
|
frameDeadline = rafTime + activeFrameTime;
|
|
1173
1145
|
if (!isMessageEventScheduled) {
|
|
1174
1146
|
isMessageEventScheduled = true;
|
|
1175
|
-
|
|
1147
|
+
port.postMessage(undefined);
|
|
1176
1148
|
}
|
|
1177
1149
|
};
|
|
1178
1150
|
|
|
@@ -1181,7 +1153,7 @@ typeof window.addEventListener !== 'function') {
|
|
|
1181
1153
|
timeoutTime = absoluteTimeout;
|
|
1182
1154
|
if (isFlushingHostCallback || absoluteTimeout < 0) {
|
|
1183
1155
|
// Don't wait for the next frame. Continue working ASAP, in a new event.
|
|
1184
|
-
|
|
1156
|
+
port.postMessage(undefined);
|
|
1185
1157
|
} else if (!isAnimationFrameScheduled) {
|
|
1186
1158
|
// If rAF didn't already schedule one, we need to schedule a frame.
|
|
1187
1159
|
// TODO: If this rAF doesn't materialize because the browser throttles, we
|
|
@@ -1556,6 +1528,17 @@ function onWorkCanceled(interactions, threadID) {
|
|
|
1556
1528
|
}
|
|
1557
1529
|
}
|
|
1558
1530
|
|
|
1531
|
+
/**
|
|
1532
|
+
* Keeps track of the current dispatcher.
|
|
1533
|
+
*/
|
|
1534
|
+
var ReactCurrentDispatcher = {
|
|
1535
|
+
/**
|
|
1536
|
+
* @internal
|
|
1537
|
+
* @type {ReactComponent}
|
|
1538
|
+
*/
|
|
1539
|
+
current: null
|
|
1540
|
+
};
|
|
1541
|
+
|
|
1559
1542
|
/**
|
|
1560
1543
|
* Keeps track of the current owner.
|
|
1561
1544
|
*
|
|
@@ -1567,8 +1550,7 @@ var ReactCurrentOwner = {
|
|
|
1567
1550
|
* @internal
|
|
1568
1551
|
* @type {ReactComponent}
|
|
1569
1552
|
*/
|
|
1570
|
-
current: null
|
|
1571
|
-
currentDispatcher: null
|
|
1553
|
+
current: null
|
|
1572
1554
|
};
|
|
1573
1555
|
|
|
1574
1556
|
var BEFORE_SLASH_RE = /^(.*)[\\\/]/;
|
|
@@ -1699,6 +1681,7 @@ function setCurrentlyValidatingElement(element) {
|
|
|
1699
1681
|
}
|
|
1700
1682
|
|
|
1701
1683
|
var ReactSharedInternals = {
|
|
1684
|
+
ReactCurrentDispatcher: ReactCurrentDispatcher,
|
|
1702
1685
|
ReactCurrentOwner: ReactCurrentOwner,
|
|
1703
1686
|
// Used by renderers to avoid bundling object-assign twice in UMD bundles:
|
|
1704
1687
|
assign: objectAssign
|
|
@@ -1713,10 +1696,14 @@ var ReactSharedInternals = {
|
|
|
1713
1696
|
objectAssign(ReactSharedInternals, {
|
|
1714
1697
|
Scheduler: {
|
|
1715
1698
|
unstable_cancelCallback: unstable_cancelCallback,
|
|
1699
|
+
unstable_shouldYield: unstable_shouldYield,
|
|
1716
1700
|
unstable_now: getCurrentTime,
|
|
1717
1701
|
unstable_scheduleCallback: unstable_scheduleCallback,
|
|
1718
1702
|
unstable_runWithPriority: unstable_runWithPriority,
|
|
1719
1703
|
unstable_wrapCallback: unstable_wrapCallback,
|
|
1704
|
+
unstable_getFirstCallbackNode: unstable_getFirstCallbackNode,
|
|
1705
|
+
unstable_pauseExecution: unstable_pauseExecution,
|
|
1706
|
+
unstable_continueExecution: unstable_continueExecution,
|
|
1720
1707
|
unstable_getCurrentPriorityLevel: unstable_getCurrentPriorityLevel
|
|
1721
1708
|
},
|
|
1722
1709
|
SchedulerTracing: {
|
|
@@ -2421,6 +2408,9 @@ function createContext(defaultValue, calculateChangedBits) {
|
|
|
2421
2408
|
// Secondary renderers store their context values on separate fields.
|
|
2422
2409
|
_currentValue: defaultValue,
|
|
2423
2410
|
_currentValue2: defaultValue,
|
|
2411
|
+
// Used to track how many concurrent renderers this context currently
|
|
2412
|
+
// supports within in a single renderer. Such as parallel server rendering.
|
|
2413
|
+
_threadCount: 0,
|
|
2424
2414
|
// These are circular
|
|
2425
2415
|
Provider: null,
|
|
2426
2416
|
Consumer: null
|
|
@@ -2473,6 +2463,14 @@ function createContext(defaultValue, calculateChangedBits) {
|
|
|
2473
2463
|
context._currentValue2 = _currentValue2;
|
|
2474
2464
|
}
|
|
2475
2465
|
},
|
|
2466
|
+
_threadCount: {
|
|
2467
|
+
get: function () {
|
|
2468
|
+
return context._threadCount;
|
|
2469
|
+
},
|
|
2470
|
+
set: function (_threadCount) {
|
|
2471
|
+
context._threadCount = _threadCount;
|
|
2472
|
+
}
|
|
2473
|
+
},
|
|
2476
2474
|
Consumer: {
|
|
2477
2475
|
get: function () {
|
|
2478
2476
|
if (!hasWarnedAboutUsingNestedContextConsumers) {
|
|
@@ -2496,18 +2494,58 @@ function createContext(defaultValue, calculateChangedBits) {
|
|
|
2496
2494
|
}
|
|
2497
2495
|
|
|
2498
2496
|
function lazy(ctor) {
|
|
2499
|
-
|
|
2497
|
+
var lazyType = {
|
|
2500
2498
|
$$typeof: REACT_LAZY_TYPE,
|
|
2501
2499
|
_ctor: ctor,
|
|
2502
2500
|
// React uses these fields to store the result.
|
|
2503
2501
|
_status: -1,
|
|
2504
2502
|
_result: null
|
|
2505
2503
|
};
|
|
2504
|
+
|
|
2505
|
+
{
|
|
2506
|
+
// In production, this would just set it on the object.
|
|
2507
|
+
var defaultProps = void 0;
|
|
2508
|
+
var propTypes = void 0;
|
|
2509
|
+
Object.defineProperties(lazyType, {
|
|
2510
|
+
defaultProps: {
|
|
2511
|
+
configurable: true,
|
|
2512
|
+
get: function () {
|
|
2513
|
+
return defaultProps;
|
|
2514
|
+
},
|
|
2515
|
+
set: function (newDefaultProps) {
|
|
2516
|
+
warning$1(false, 'React.lazy(...): It is not supported to assign `defaultProps` to ' + 'a lazy component import. Either specify them where the component ' + 'is defined, or create a wrapping component around it.');
|
|
2517
|
+
defaultProps = newDefaultProps;
|
|
2518
|
+
// Match production behavior more closely:
|
|
2519
|
+
Object.defineProperty(lazyType, 'defaultProps', {
|
|
2520
|
+
enumerable: true
|
|
2521
|
+
});
|
|
2522
|
+
}
|
|
2523
|
+
},
|
|
2524
|
+
propTypes: {
|
|
2525
|
+
configurable: true,
|
|
2526
|
+
get: function () {
|
|
2527
|
+
return propTypes;
|
|
2528
|
+
},
|
|
2529
|
+
set: function (newPropTypes) {
|
|
2530
|
+
warning$1(false, 'React.lazy(...): It is not supported to assign `propTypes` to ' + 'a lazy component import. Either specify them where the component ' + 'is defined, or create a wrapping component around it.');
|
|
2531
|
+
propTypes = newPropTypes;
|
|
2532
|
+
// Match production behavior more closely:
|
|
2533
|
+
Object.defineProperty(lazyType, 'propTypes', {
|
|
2534
|
+
enumerable: true
|
|
2535
|
+
});
|
|
2536
|
+
}
|
|
2537
|
+
}
|
|
2538
|
+
});
|
|
2539
|
+
}
|
|
2540
|
+
|
|
2541
|
+
return lazyType;
|
|
2506
2542
|
}
|
|
2507
2543
|
|
|
2508
2544
|
function forwardRef(render) {
|
|
2509
2545
|
{
|
|
2510
|
-
if (
|
|
2546
|
+
if (render != null && render.$$typeof === REACT_MEMO_TYPE) {
|
|
2547
|
+
warningWithoutStack$1(false, 'forwardRef requires a render function but received a `memo` ' + 'component. Instead of forwardRef(memo(...)), use ' + 'memo(forwardRef(...)).');
|
|
2548
|
+
} else if (typeof render !== 'function') {
|
|
2511
2549
|
warningWithoutStack$1(false, 'forwardRef requires a render function but was given %s.', render === null ? 'null' : typeof render);
|
|
2512
2550
|
} else {
|
|
2513
2551
|
!(
|
|
@@ -2546,7 +2584,7 @@ function memo(type, compare) {
|
|
|
2546
2584
|
}
|
|
2547
2585
|
|
|
2548
2586
|
function resolveDispatcher() {
|
|
2549
|
-
var dispatcher =
|
|
2587
|
+
var dispatcher = ReactCurrentDispatcher.current;
|
|
2550
2588
|
!(dispatcher !== null) ? invariant(false, 'Hooks can only be called inside the body of a function component.') : void 0;
|
|
2551
2589
|
return dispatcher;
|
|
2552
2590
|
}
|
|
@@ -2589,11 +2627,6 @@ function useEffect(create, inputs) {
|
|
|
2589
2627
|
return dispatcher.useEffect(create, inputs);
|
|
2590
2628
|
}
|
|
2591
2629
|
|
|
2592
|
-
function useMutationEffect(create, inputs) {
|
|
2593
|
-
var dispatcher = resolveDispatcher();
|
|
2594
|
-
return dispatcher.useMutationEffect(create, inputs);
|
|
2595
|
-
}
|
|
2596
|
-
|
|
2597
2630
|
function useLayoutEffect(create, inputs) {
|
|
2598
2631
|
var dispatcher = resolveDispatcher();
|
|
2599
2632
|
return dispatcher.useLayoutEffect(create, inputs);
|
|
@@ -2805,7 +2838,7 @@ function validateExplicitKey(element, parentType) {
|
|
|
2805
2838
|
|
|
2806
2839
|
setCurrentlyValidatingElement(element);
|
|
2807
2840
|
{
|
|
2808
|
-
warning$1(false, 'Each child in
|
|
2841
|
+
warning$1(false, 'Each child in a list should have a unique "key" prop.' + '%s%s See https://fb.me/react-warning-keys for more information.', currentComponentErrorInfo, childOwner);
|
|
2809
2842
|
}
|
|
2810
2843
|
setCurrentlyValidatingElement(null);
|
|
2811
2844
|
}
|
|
@@ -2861,16 +2894,17 @@ function validateChildKeys(node, parentType) {
|
|
|
2861
2894
|
*/
|
|
2862
2895
|
function validatePropTypes(element) {
|
|
2863
2896
|
var type = element.type;
|
|
2864
|
-
|
|
2865
|
-
|
|
2897
|
+
if (type === null || type === undefined || typeof type === 'string') {
|
|
2898
|
+
return;
|
|
2899
|
+
}
|
|
2900
|
+
var name = getComponentName(type);
|
|
2901
|
+
var propTypes = void 0;
|
|
2866
2902
|
if (typeof type === 'function') {
|
|
2867
|
-
// Class or function component
|
|
2868
|
-
name = type.displayName || type.name;
|
|
2869
2903
|
propTypes = type.propTypes;
|
|
2870
|
-
} else if (typeof type === 'object' && type
|
|
2871
|
-
|
|
2872
|
-
|
|
2873
|
-
|
|
2904
|
+
} else if (typeof type === 'object' && (type.$$typeof === REACT_FORWARD_REF_TYPE ||
|
|
2905
|
+
// Note: Memo only checks outer props here.
|
|
2906
|
+
// Inner props are checked in the reconciler.
|
|
2907
|
+
type.$$typeof === REACT_MEMO_TYPE)) {
|
|
2874
2908
|
propTypes = type.propTypes;
|
|
2875
2909
|
} else {
|
|
2876
2910
|
return;
|
|
@@ -3030,15 +3064,22 @@ var React = {
|
|
|
3030
3064
|
|
|
3031
3065
|
version: ReactVersion,
|
|
3032
3066
|
|
|
3067
|
+
unstable_ConcurrentMode: REACT_CONCURRENT_MODE_TYPE,
|
|
3068
|
+
unstable_Profiler: REACT_PROFILER_TYPE,
|
|
3069
|
+
|
|
3033
3070
|
__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED: ReactSharedInternals
|
|
3034
3071
|
};
|
|
3035
3072
|
|
|
3073
|
+
// Note: some APIs are added with feature flags.
|
|
3074
|
+
// Make sure that stable builds for open source
|
|
3075
|
+
// don't modify the React object to avoid deopts.
|
|
3076
|
+
// Also let's not expose their names in stable builds.
|
|
3077
|
+
|
|
3036
3078
|
if (enableStableConcurrentModeAPIs) {
|
|
3037
3079
|
React.ConcurrentMode = REACT_CONCURRENT_MODE_TYPE;
|
|
3038
3080
|
React.Profiler = REACT_PROFILER_TYPE;
|
|
3039
|
-
|
|
3040
|
-
React.
|
|
3041
|
-
React.unstable_Profiler = REACT_PROFILER_TYPE;
|
|
3081
|
+
React.unstable_ConcurrentMode = undefined;
|
|
3082
|
+
React.unstable_Profiler = undefined;
|
|
3042
3083
|
}
|
|
3043
3084
|
|
|
3044
3085
|
if (enableHooks) {
|
|
@@ -3048,7 +3089,6 @@ if (enableHooks) {
|
|
|
3048
3089
|
React.useImperativeMethods = useImperativeMethods;
|
|
3049
3090
|
React.useLayoutEffect = useLayoutEffect;
|
|
3050
3091
|
React.useMemo = useMemo;
|
|
3051
|
-
React.useMutationEffect = useMutationEffect;
|
|
3052
3092
|
React.useReducer = useReducer;
|
|
3053
3093
|
React.useRef = useRef;
|
|
3054
3094
|
React.useState = useState;
|