react-dom 17.0.0-rc.1 → 17.0.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/build-info.json +5 -5
- package/cjs/react-dom-server.browser.development.js +5 -5
- package/cjs/react-dom-server.browser.production.min.js +2 -2
- package/cjs/react-dom-server.node.development.js +5 -5
- package/cjs/react-dom-server.node.production.min.js +2 -2
- package/cjs/react-dom-test-utils.development.js +271 -138
- package/cjs/react-dom-test-utils.production.min.js +36 -33
- package/cjs/react-dom.development.js +747 -579
- package/cjs/react-dom.production.min.js +230 -231
- package/cjs/react-dom.profiling.min.js +258 -257
- package/package.json +3 -3
- package/umd/react-dom-server.browser.development.js +5 -5
- package/umd/react-dom-server.browser.production.min.js +3 -3
- package/umd/react-dom-test-utils.development.js +271 -138
- package/umd/react-dom-test-utils.production.min.js +27 -25
- package/umd/react-dom.development.js +747 -579
- package/umd/react-dom.production.min.js +232 -232
- package/umd/react-dom.profiling.min.js +241 -243
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/** @license React
|
|
1
|
+
/** @license React v17.0.1
|
|
2
2
|
* react-dom-test-utils.development.js
|
|
3
3
|
*
|
|
4
4
|
* Copyright (c) Facebook, Inc. and its affiliates.
|
|
@@ -137,8 +137,8 @@
|
|
|
137
137
|
var HostText = 6;
|
|
138
138
|
|
|
139
139
|
// Don't change these two values. They're used by React Dev Tools.
|
|
140
|
-
var
|
|
141
|
-
/*
|
|
140
|
+
var NoFlags =
|
|
141
|
+
/* */
|
|
142
142
|
0;
|
|
143
143
|
|
|
144
144
|
var Placement =
|
|
@@ -161,7 +161,7 @@
|
|
|
161
161
|
do {
|
|
162
162
|
node = nextNode;
|
|
163
163
|
|
|
164
|
-
if ((node.
|
|
164
|
+
if ((node.flags & (Placement | Hydrating)) !== NoFlags) {
|
|
165
165
|
// This is an insertion or in-progress hydration. The nearest possible
|
|
166
166
|
// mounted fiber is the parent but we need to continue to figure out
|
|
167
167
|
// if that one is still mounted.
|
|
@@ -406,136 +406,144 @@
|
|
|
406
406
|
return 0;
|
|
407
407
|
}
|
|
408
408
|
|
|
409
|
-
/**
|
|
410
|
-
* @interface Event
|
|
411
|
-
* @see http://www.w3.org/TR/DOM-Level-3-Events/
|
|
412
|
-
*/
|
|
413
|
-
var EventInterface = {
|
|
414
|
-
eventPhase: 0,
|
|
415
|
-
bubbles: 0,
|
|
416
|
-
cancelable: 0,
|
|
417
|
-
timeStamp: function (event) {
|
|
418
|
-
return event.timeStamp || Date.now();
|
|
419
|
-
},
|
|
420
|
-
defaultPrevented: 0,
|
|
421
|
-
isTrusted: 0
|
|
422
|
-
};
|
|
423
|
-
|
|
424
409
|
function functionThatReturnsTrue() {
|
|
425
410
|
return true;
|
|
426
411
|
}
|
|
427
412
|
|
|
428
413
|
function functionThatReturnsFalse() {
|
|
429
414
|
return false;
|
|
430
|
-
}
|
|
431
|
-
|
|
432
|
-
* Synthetic events are dispatched by event plugins, typically in response to a
|
|
433
|
-
* top-level event delegation handler.
|
|
434
|
-
*
|
|
435
|
-
* These systems should generally use pooling to reduce the frequency of garbage
|
|
436
|
-
* collection. The system should check `isPersistent` to determine whether the
|
|
437
|
-
* event should be released into the pool after being dispatched. Users that
|
|
438
|
-
* need a persisted event should invoke `persist`.
|
|
439
|
-
*
|
|
440
|
-
* Synthetic events (and subclasses) implement the DOM Level 3 Events API by
|
|
441
|
-
* normalizing browser quirks. Subclasses do not necessarily have to implement a
|
|
442
|
-
* DOM interface; custom application-specific events can also subclass this.
|
|
443
|
-
*/
|
|
415
|
+
} // This is intentionally a factory so that we have different returned constructors.
|
|
416
|
+
// If we had a single constructor, it would be megamorphic and engines would deopt.
|
|
444
417
|
|
|
445
418
|
|
|
446
|
-
function
|
|
447
|
-
|
|
448
|
-
|
|
449
|
-
|
|
450
|
-
|
|
451
|
-
|
|
452
|
-
|
|
453
|
-
|
|
419
|
+
function createSyntheticEvent(Interface) {
|
|
420
|
+
/**
|
|
421
|
+
* Synthetic events are dispatched by event plugins, typically in response to a
|
|
422
|
+
* top-level event delegation handler.
|
|
423
|
+
*
|
|
424
|
+
* These systems should generally use pooling to reduce the frequency of garbage
|
|
425
|
+
* collection. The system should check `isPersistent` to determine whether the
|
|
426
|
+
* event should be released into the pool after being dispatched. Users that
|
|
427
|
+
* need a persisted event should invoke `persist`.
|
|
428
|
+
*
|
|
429
|
+
* Synthetic events (and subclasses) implement the DOM Level 3 Events API by
|
|
430
|
+
* normalizing browser quirks. Subclasses do not necessarily have to implement a
|
|
431
|
+
* DOM interface; custom application-specific events can also subclass this.
|
|
432
|
+
*/
|
|
433
|
+
function SyntheticBaseEvent(reactName, reactEventType, targetInst, nativeEvent, nativeEventTarget) {
|
|
434
|
+
this._reactName = reactName;
|
|
435
|
+
this._targetInst = targetInst;
|
|
436
|
+
this.type = reactEventType;
|
|
437
|
+
this.nativeEvent = nativeEvent;
|
|
438
|
+
this.target = nativeEventTarget;
|
|
439
|
+
this.currentTarget = null;
|
|
440
|
+
|
|
441
|
+
for (var _propName in Interface) {
|
|
442
|
+
if (!Interface.hasOwnProperty(_propName)) {
|
|
443
|
+
continue;
|
|
444
|
+
}
|
|
454
445
|
|
|
455
|
-
|
|
456
|
-
|
|
457
|
-
|
|
446
|
+
var normalize = Interface[_propName];
|
|
447
|
+
|
|
448
|
+
if (normalize) {
|
|
449
|
+
this[_propName] = normalize(nativeEvent);
|
|
450
|
+
} else {
|
|
451
|
+
this[_propName] = nativeEvent[_propName];
|
|
452
|
+
}
|
|
458
453
|
}
|
|
459
454
|
|
|
460
|
-
var
|
|
455
|
+
var defaultPrevented = nativeEvent.defaultPrevented != null ? nativeEvent.defaultPrevented : nativeEvent.returnValue === false;
|
|
461
456
|
|
|
462
|
-
if (
|
|
463
|
-
this
|
|
457
|
+
if (defaultPrevented) {
|
|
458
|
+
this.isDefaultPrevented = functionThatReturnsTrue;
|
|
464
459
|
} else {
|
|
465
|
-
this
|
|
460
|
+
this.isDefaultPrevented = functionThatReturnsFalse;
|
|
466
461
|
}
|
|
467
|
-
}
|
|
468
|
-
|
|
469
|
-
var defaultPrevented = nativeEvent.defaultPrevented != null ? nativeEvent.defaultPrevented : nativeEvent.returnValue === false;
|
|
470
462
|
|
|
471
|
-
|
|
472
|
-
this
|
|
473
|
-
} else {
|
|
474
|
-
this.isDefaultPrevented = functionThatReturnsFalse;
|
|
463
|
+
this.isPropagationStopped = functionThatReturnsFalse;
|
|
464
|
+
return this;
|
|
475
465
|
}
|
|
476
466
|
|
|
477
|
-
|
|
478
|
-
|
|
479
|
-
|
|
467
|
+
_assign(SyntheticBaseEvent.prototype, {
|
|
468
|
+
preventDefault: function () {
|
|
469
|
+
this.defaultPrevented = true;
|
|
470
|
+
var event = this.nativeEvent;
|
|
480
471
|
|
|
481
|
-
|
|
482
|
-
|
|
483
|
-
|
|
484
|
-
var event = this.nativeEvent;
|
|
472
|
+
if (!event) {
|
|
473
|
+
return;
|
|
474
|
+
}
|
|
485
475
|
|
|
486
|
-
|
|
487
|
-
|
|
488
|
-
|
|
476
|
+
if (event.preventDefault) {
|
|
477
|
+
event.preventDefault(); // $FlowFixMe - flow is not aware of `unknown` in IE
|
|
478
|
+
} else if (typeof event.returnValue !== 'unknown') {
|
|
479
|
+
event.returnValue = false;
|
|
480
|
+
}
|
|
489
481
|
|
|
490
|
-
|
|
491
|
-
|
|
492
|
-
|
|
493
|
-
event
|
|
494
|
-
}
|
|
482
|
+
this.isDefaultPrevented = functionThatReturnsTrue;
|
|
483
|
+
},
|
|
484
|
+
stopPropagation: function () {
|
|
485
|
+
var event = this.nativeEvent;
|
|
495
486
|
|
|
496
|
-
|
|
497
|
-
|
|
498
|
-
|
|
499
|
-
var event = this.nativeEvent;
|
|
487
|
+
if (!event) {
|
|
488
|
+
return;
|
|
489
|
+
}
|
|
500
490
|
|
|
501
|
-
|
|
502
|
-
|
|
503
|
-
|
|
491
|
+
if (event.stopPropagation) {
|
|
492
|
+
event.stopPropagation(); // $FlowFixMe - flow is not aware of `unknown` in IE
|
|
493
|
+
} else if (typeof event.cancelBubble !== 'unknown') {
|
|
494
|
+
// The ChangeEventPlugin registers a "propertychange" event for
|
|
495
|
+
// IE. This event does not support bubbling or cancelling, and
|
|
496
|
+
// any references to cancelBubble throw "Member not found". A
|
|
497
|
+
// typeof check of "unknown" circumvents this issue (and is also
|
|
498
|
+
// IE specific).
|
|
499
|
+
event.cancelBubble = true;
|
|
500
|
+
}
|
|
504
501
|
|
|
505
|
-
|
|
506
|
-
|
|
507
|
-
|
|
508
|
-
|
|
509
|
-
|
|
510
|
-
|
|
511
|
-
|
|
512
|
-
|
|
513
|
-
|
|
514
|
-
}
|
|
502
|
+
this.isPropagationStopped = functionThatReturnsTrue;
|
|
503
|
+
},
|
|
504
|
+
|
|
505
|
+
/**
|
|
506
|
+
* We release all dispatched `SyntheticEvent`s after each event loop, adding
|
|
507
|
+
* them back into the pool. This allows a way to hold onto a reference that
|
|
508
|
+
* won't be added back into the pool.
|
|
509
|
+
*/
|
|
510
|
+
persist: function () {// Modern event system doesn't use pooling.
|
|
511
|
+
},
|
|
512
|
+
|
|
513
|
+
/**
|
|
514
|
+
* Checks if this event should be released back into the pool.
|
|
515
|
+
*
|
|
516
|
+
* @return {boolean} True if this should not be released, false otherwise.
|
|
517
|
+
*/
|
|
518
|
+
isPersistent: functionThatReturnsTrue
|
|
519
|
+
});
|
|
515
520
|
|
|
516
|
-
|
|
517
|
-
|
|
521
|
+
return SyntheticBaseEvent;
|
|
522
|
+
}
|
|
523
|
+
/**
|
|
524
|
+
* @interface Event
|
|
525
|
+
* @see http://www.w3.org/TR/DOM-Level-3-Events/
|
|
526
|
+
*/
|
|
518
527
|
|
|
519
|
-
/**
|
|
520
|
-
* We release all dispatched `SyntheticEvent`s after each event loop, adding
|
|
521
|
-
* them back into the pool. This allows a way to hold onto a reference that
|
|
522
|
-
* won't be added back into the pool.
|
|
523
|
-
*/
|
|
524
|
-
persist: function () {// Modern event system doesn't use pooling.
|
|
525
|
-
},
|
|
526
528
|
|
|
527
|
-
|
|
528
|
-
|
|
529
|
-
|
|
530
|
-
|
|
531
|
-
|
|
532
|
-
|
|
533
|
-
|
|
529
|
+
var EventInterface = {
|
|
530
|
+
eventPhase: 0,
|
|
531
|
+
bubbles: 0,
|
|
532
|
+
cancelable: 0,
|
|
533
|
+
timeStamp: function (event) {
|
|
534
|
+
return event.timeStamp || Date.now();
|
|
535
|
+
},
|
|
536
|
+
defaultPrevented: 0,
|
|
537
|
+
isTrusted: 0
|
|
538
|
+
};
|
|
539
|
+
var SyntheticEvent = createSyntheticEvent(EventInterface);
|
|
534
540
|
|
|
535
541
|
var UIEventInterface = _assign({}, EventInterface, {
|
|
536
542
|
view: 0,
|
|
537
543
|
detail: 0
|
|
538
544
|
});
|
|
545
|
+
|
|
546
|
+
var SyntheticUIEvent = createSyntheticEvent(UIEventInterface);
|
|
539
547
|
var lastMovementX;
|
|
540
548
|
var lastMovementY;
|
|
541
549
|
var lastMouseEvent;
|
|
@@ -596,6 +604,8 @@
|
|
|
596
604
|
return lastMovementY;
|
|
597
605
|
}
|
|
598
606
|
});
|
|
607
|
+
|
|
608
|
+
var SyntheticMouseEvent = createSyntheticEvent(MouseEventInterface);
|
|
599
609
|
/**
|
|
600
610
|
* @interface DragEvent
|
|
601
611
|
* @see http://www.w3.org/TR/DOM-Level-3-Events/
|
|
@@ -604,6 +614,8 @@
|
|
|
604
614
|
var DragEventInterface = _assign({}, MouseEventInterface, {
|
|
605
615
|
dataTransfer: 0
|
|
606
616
|
});
|
|
617
|
+
|
|
618
|
+
var SyntheticDragEvent = createSyntheticEvent(DragEventInterface);
|
|
607
619
|
/**
|
|
608
620
|
* @interface FocusEvent
|
|
609
621
|
* @see http://www.w3.org/TR/DOM-Level-3-Events/
|
|
@@ -612,6 +624,8 @@
|
|
|
612
624
|
var FocusEventInterface = _assign({}, UIEventInterface, {
|
|
613
625
|
relatedTarget: 0
|
|
614
626
|
});
|
|
627
|
+
|
|
628
|
+
var SyntheticFocusEvent = createSyntheticEvent(FocusEventInterface);
|
|
615
629
|
/**
|
|
616
630
|
* @interface Event
|
|
617
631
|
* @see http://www.w3.org/TR/css3-animations/#AnimationEvent-interface
|
|
@@ -623,6 +637,8 @@
|
|
|
623
637
|
elapsedTime: 0,
|
|
624
638
|
pseudoElement: 0
|
|
625
639
|
});
|
|
640
|
+
|
|
641
|
+
var SyntheticAnimationEvent = createSyntheticEvent(AnimationEventInterface);
|
|
626
642
|
/**
|
|
627
643
|
* @interface Event
|
|
628
644
|
* @see http://www.w3.org/TR/clipboard-apis/
|
|
@@ -633,6 +649,8 @@
|
|
|
633
649
|
return 'clipboardData' in event ? event.clipboardData : window.clipboardData;
|
|
634
650
|
}
|
|
635
651
|
});
|
|
652
|
+
|
|
653
|
+
var SyntheticClipboardEvent = createSyntheticEvent(ClipboardEventInterface);
|
|
636
654
|
/**
|
|
637
655
|
* @interface Event
|
|
638
656
|
* @see http://www.w3.org/TR/DOM-Level-3-Events/#events-compositionevents
|
|
@@ -641,6 +659,8 @@
|
|
|
641
659
|
var CompositionEventInterface = _assign({}, EventInterface, {
|
|
642
660
|
data: 0
|
|
643
661
|
});
|
|
662
|
+
|
|
663
|
+
var SyntheticCompositionEvent = createSyntheticEvent(CompositionEventInterface);
|
|
644
664
|
/**
|
|
645
665
|
* Normalization of deprecated HTML5 `key` values
|
|
646
666
|
* @see https://developer.mozilla.org/en-US/docs/Web/API/KeyboardEvent#Key_names
|
|
@@ -824,6 +844,8 @@
|
|
|
824
844
|
return 0;
|
|
825
845
|
}
|
|
826
846
|
});
|
|
847
|
+
|
|
848
|
+
var SyntheticKeyboardEvent = createSyntheticEvent(KeyboardEventInterface);
|
|
827
849
|
/**
|
|
828
850
|
* @interface PointerEvent
|
|
829
851
|
* @see http://www.w3.org/TR/pointerevents/
|
|
@@ -841,6 +863,8 @@
|
|
|
841
863
|
pointerType: 0,
|
|
842
864
|
isPrimary: 0
|
|
843
865
|
});
|
|
866
|
+
|
|
867
|
+
var SyntheticPointerEvent = createSyntheticEvent(PointerEventInterface);
|
|
844
868
|
/**
|
|
845
869
|
* @interface TouchEvent
|
|
846
870
|
* @see http://www.w3.org/TR/touch-events/
|
|
@@ -856,6 +880,8 @@
|
|
|
856
880
|
shiftKey: 0,
|
|
857
881
|
getModifierState: getEventModifierState
|
|
858
882
|
});
|
|
883
|
+
|
|
884
|
+
var SyntheticTouchEvent = createSyntheticEvent(TouchEventInterface);
|
|
859
885
|
/**
|
|
860
886
|
* @interface Event
|
|
861
887
|
* @see http://www.w3.org/TR/2009/WD-css3-transitions-20090320/#transition-events-
|
|
@@ -867,6 +893,8 @@
|
|
|
867
893
|
elapsedTime: 0,
|
|
868
894
|
pseudoElement: 0
|
|
869
895
|
});
|
|
896
|
+
|
|
897
|
+
var SyntheticTransitionEvent = createSyntheticEvent(TransitionEventInterface);
|
|
870
898
|
/**
|
|
871
899
|
* @interface WheelEvent
|
|
872
900
|
* @see http://www.w3.org/TR/DOM-Level-3-Events/
|
|
@@ -890,6 +918,8 @@
|
|
|
890
918
|
deltaMode: 0
|
|
891
919
|
});
|
|
892
920
|
|
|
921
|
+
var SyntheticWheelEvent = createSyntheticEvent(WheelEventInterface);
|
|
922
|
+
|
|
893
923
|
/**
|
|
894
924
|
* HTML nodeType values that represent the type of the node
|
|
895
925
|
*/
|
|
@@ -953,21 +983,24 @@
|
|
|
953
983
|
unstable_forceFrameRate = _ReactInternals$Sched.unstable_forceFrameRate,
|
|
954
984
|
unstable_flushAllWithoutAsserting = _ReactInternals$Sched.unstable_flushAllWithoutAsserting;
|
|
955
985
|
|
|
956
|
-
var
|
|
957
|
-
|
|
958
|
-
|
|
959
|
-
|
|
960
|
-
|
|
961
|
-
getFiberCurrentPropsFromNode = _ReactDOM$__SECRET_IN[2],
|
|
962
|
-
enqueueStateRestore = _ReactDOM$__SECRET_IN[3],
|
|
963
|
-
restoreStateIfNeeded = _ReactDOM$__SECRET_IN[4],
|
|
986
|
+
var EventInternals = ReactDOM.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.Events; // const getInstanceFromNode = EventInternals[0];
|
|
987
|
+
// const getNodeFromInstance = EventInternals[1];
|
|
988
|
+
// const getFiberCurrentPropsFromNode = EventInternals[2];
|
|
989
|
+
// const enqueueStateRestore = EventInternals[3];
|
|
990
|
+
// const restoreStateIfNeeded = EventInternals[4];
|
|
964
991
|
|
|
965
|
-
|
|
966
|
-
|
|
967
|
-
IsThisRendererActing = _ReactDOM$__SECRET_IN[6];
|
|
992
|
+
var flushPassiveEffects = EventInternals[5];
|
|
993
|
+
var IsThisRendererActing = EventInternals[6];
|
|
968
994
|
var batchedUpdates = ReactDOM.unstable_batchedUpdates;
|
|
969
|
-
var IsSomeRendererActing = ReactSharedInternals.IsSomeRendererActing; //
|
|
970
|
-
//
|
|
995
|
+
var IsSomeRendererActing = ReactSharedInternals.IsSomeRendererActing; // This is the public version of `ReactTestUtils.act`. It is implemented in
|
|
996
|
+
// "userspace" (i.e. not the reconciler), so that it doesn't add to the
|
|
997
|
+
// production bundle size.
|
|
998
|
+
// TODO: Remove this implementation of `act` in favor of the one exported by
|
|
999
|
+
// the reconciler. To do this, we must first drop support for `act` in
|
|
1000
|
+
// production mode.
|
|
1001
|
+
// TODO: Remove support for the mock scheduler build, which was only added for
|
|
1002
|
+
// the purposes of internal testing. Internal tests should use
|
|
1003
|
+
// `unstable_concurrentAct` instead.
|
|
971
1004
|
|
|
972
1005
|
var isSchedulerMocked = typeof unstable_flushAllWithoutAsserting === 'function';
|
|
973
1006
|
|
|
@@ -999,7 +1032,6 @@
|
|
|
999
1032
|
|
|
1000
1033
|
|
|
1001
1034
|
var actingUpdatesScopeDepth = 0;
|
|
1002
|
-
|
|
1003
1035
|
function act(callback) {
|
|
1004
1036
|
|
|
1005
1037
|
var previousActingUpdatesScopeDepth = actingUpdatesScopeDepth;
|
|
@@ -1112,6 +1144,114 @@
|
|
|
1112
1144
|
}
|
|
1113
1145
|
}
|
|
1114
1146
|
|
|
1147
|
+
var EventInternals$1 = ReactDOM.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.Events; // const getInstanceFromNode = EventInternals[0];
|
|
1148
|
+
// const getNodeFromInstance = EventInternals[1];
|
|
1149
|
+
// const getFiberCurrentPropsFromNode = EventInternals[2];
|
|
1150
|
+
// const enqueueStateRestore = EventInternals[3];
|
|
1151
|
+
// const restoreStateIfNeeded = EventInternals[4];
|
|
1152
|
+
// const flushPassiveEffects = EventInternals[5];
|
|
1153
|
+
|
|
1154
|
+
var IsThisRendererActing$1 = EventInternals$1[6];
|
|
1155
|
+
var batchedUpdates$1 = ReactDOM.unstable_batchedUpdates;
|
|
1156
|
+
var IsSomeRendererActing$1 = ReactSharedInternals.IsSomeRendererActing; // This version of `act` is only used by our tests. Unlike the public version
|
|
1157
|
+
// of `act`, it's designed to work identically in both production and
|
|
1158
|
+
// development. It may have slightly different behavior from the public
|
|
1159
|
+
// version, too, since our constraints in our test suite are not the same as
|
|
1160
|
+
// those of developers using React — we're testing React itself, as opposed to
|
|
1161
|
+
// building an app with React.
|
|
1162
|
+
|
|
1163
|
+
var actingUpdatesScopeDepth$1 = 0;
|
|
1164
|
+
function unstable_concurrentAct(scope) {
|
|
1165
|
+
if (unstable_flushAllWithoutAsserting === undefined) {
|
|
1166
|
+
throw Error('This version of `act` requires a special mock build of Scheduler.');
|
|
1167
|
+
}
|
|
1168
|
+
|
|
1169
|
+
if (setTimeout._isMockFunction !== true) {
|
|
1170
|
+
throw Error("This version of `act` requires Jest's timer mocks " + '(i.e. jest.useFakeTimers).');
|
|
1171
|
+
}
|
|
1172
|
+
|
|
1173
|
+
var previousActingUpdatesScopeDepth = actingUpdatesScopeDepth$1;
|
|
1174
|
+
var previousIsSomeRendererActing = IsSomeRendererActing$1.current;
|
|
1175
|
+
var previousIsThisRendererActing = IsThisRendererActing$1.current;
|
|
1176
|
+
IsSomeRendererActing$1.current = true;
|
|
1177
|
+
IsThisRendererActing$1.current = true;
|
|
1178
|
+
actingUpdatesScopeDepth$1++;
|
|
1179
|
+
|
|
1180
|
+
var unwind = function () {
|
|
1181
|
+
actingUpdatesScopeDepth$1--;
|
|
1182
|
+
IsSomeRendererActing$1.current = previousIsSomeRendererActing;
|
|
1183
|
+
IsThisRendererActing$1.current = previousIsThisRendererActing;
|
|
1184
|
+
|
|
1185
|
+
{
|
|
1186
|
+
if (actingUpdatesScopeDepth$1 > previousActingUpdatesScopeDepth) {
|
|
1187
|
+
// if it's _less than_ previousActingUpdatesScopeDepth, then we can
|
|
1188
|
+
// assume the 'other' one has warned
|
|
1189
|
+
error('You seem to have overlapping act() calls, this is not supported. ' + 'Be sure to await previous act() calls before making a new one. ');
|
|
1190
|
+
}
|
|
1191
|
+
}
|
|
1192
|
+
}; // TODO: This would be way simpler if 1) we required a promise to be
|
|
1193
|
+
// returned and 2) we could use async/await. Since it's only our used in
|
|
1194
|
+
// our test suite, we should be able to.
|
|
1195
|
+
|
|
1196
|
+
|
|
1197
|
+
try {
|
|
1198
|
+
var thenable = batchedUpdates$1(scope);
|
|
1199
|
+
|
|
1200
|
+
if (typeof thenable === 'object' && thenable !== null && typeof thenable.then === 'function') {
|
|
1201
|
+
return {
|
|
1202
|
+
then: function (resolve, reject) {
|
|
1203
|
+
thenable.then(function () {
|
|
1204
|
+
flushActWork(function () {
|
|
1205
|
+
unwind();
|
|
1206
|
+
resolve();
|
|
1207
|
+
}, function (error) {
|
|
1208
|
+
unwind();
|
|
1209
|
+
reject(error);
|
|
1210
|
+
});
|
|
1211
|
+
}, function (error) {
|
|
1212
|
+
unwind();
|
|
1213
|
+
reject(error);
|
|
1214
|
+
});
|
|
1215
|
+
}
|
|
1216
|
+
};
|
|
1217
|
+
} else {
|
|
1218
|
+
try {
|
|
1219
|
+
// TODO: Let's not support non-async scopes at all in our tests. Need to
|
|
1220
|
+
// migrate existing tests.
|
|
1221
|
+
var didFlushWork;
|
|
1222
|
+
|
|
1223
|
+
do {
|
|
1224
|
+
didFlushWork = unstable_flushAllWithoutAsserting();
|
|
1225
|
+
} while (didFlushWork);
|
|
1226
|
+
} finally {
|
|
1227
|
+
unwind();
|
|
1228
|
+
}
|
|
1229
|
+
}
|
|
1230
|
+
} catch (error) {
|
|
1231
|
+
unwind();
|
|
1232
|
+
throw error;
|
|
1233
|
+
}
|
|
1234
|
+
}
|
|
1235
|
+
|
|
1236
|
+
function flushActWork(resolve, reject) {
|
|
1237
|
+
// Flush suspended fallbacks
|
|
1238
|
+
// $FlowFixMe: Flow doesn't know about global Jest object
|
|
1239
|
+
jest.runOnlyPendingTimers();
|
|
1240
|
+
enqueueTask(function () {
|
|
1241
|
+
try {
|
|
1242
|
+
var didFlushWork = unstable_flushAllWithoutAsserting();
|
|
1243
|
+
|
|
1244
|
+
if (didFlushWork) {
|
|
1245
|
+
flushActWork(resolve, reject);
|
|
1246
|
+
} else {
|
|
1247
|
+
resolve();
|
|
1248
|
+
}
|
|
1249
|
+
} catch (error) {
|
|
1250
|
+
reject(error);
|
|
1251
|
+
}
|
|
1252
|
+
});
|
|
1253
|
+
}
|
|
1254
|
+
|
|
1115
1255
|
function invokeGuardedCallbackProd(name, func, context, a, b, c, d, e, f) {
|
|
1116
1256
|
var funcArgs = Array.prototype.slice.call(arguments, 3);
|
|
1117
1257
|
|
|
@@ -1363,22 +1503,14 @@
|
|
|
1363
1503
|
}
|
|
1364
1504
|
}
|
|
1365
1505
|
|
|
1366
|
-
var
|
|
1367
|
-
|
|
1368
|
-
|
|
1369
|
-
|
|
1370
|
-
|
|
1371
|
-
|
|
1372
|
-
|
|
1373
|
-
|
|
1374
|
-
enqueueStateRestore$1 = _ReactDOM$__SECRET_IN$1[3],
|
|
1375
|
-
restoreStateIfNeeded$1 = _ReactDOM$__SECRET_IN$1[4],
|
|
1376
|
-
|
|
1377
|
-
/* eslint-disable no-unused-vars */
|
|
1378
|
-
flushPassiveEffects$1 = _ReactDOM$__SECRET_IN$1[5],
|
|
1379
|
-
IsThisRendererActing$1
|
|
1380
|
-
/* eslint-enable no-unused-vars */
|
|
1381
|
-
= _ReactDOM$__SECRET_IN$1[6];
|
|
1506
|
+
var EventInternals$2 = ReactDOM.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.Events;
|
|
1507
|
+
var getInstanceFromNode = EventInternals$2[0];
|
|
1508
|
+
var getNodeFromInstance = EventInternals$2[1];
|
|
1509
|
+
var getFiberCurrentPropsFromNode = EventInternals$2[2];
|
|
1510
|
+
var enqueueStateRestore = EventInternals$2[3];
|
|
1511
|
+
var restoreStateIfNeeded = EventInternals$2[4]; // const flushPassiveEffects = EventInternals[5];
|
|
1512
|
+
// TODO: This is related to `act`, not events. Move to separate key?
|
|
1513
|
+
// const IsThisRendererActing = EventInternals[6];
|
|
1382
1514
|
|
|
1383
1515
|
function Event(suffix) {}
|
|
1384
1516
|
|
|
@@ -1699,7 +1831,7 @@
|
|
|
1699
1831
|
|
|
1700
1832
|
function executeDispatch(event, listener, inst) {
|
|
1701
1833
|
var type = event.type || 'unknown-event';
|
|
1702
|
-
event.currentTarget = getNodeFromInstance
|
|
1834
|
+
event.currentTarget = getNodeFromInstance(inst);
|
|
1703
1835
|
invokeGuardedCallbackAndCatchFirstError(type, listener, undefined, event);
|
|
1704
1836
|
event.currentTarget = null;
|
|
1705
1837
|
}
|
|
@@ -1825,7 +1957,7 @@
|
|
|
1825
1957
|
return null;
|
|
1826
1958
|
}
|
|
1827
1959
|
|
|
1828
|
-
var props = getFiberCurrentPropsFromNode
|
|
1960
|
+
var props = getFiberCurrentPropsFromNode(stateNode);
|
|
1829
1961
|
|
|
1830
1962
|
if (!props) {
|
|
1831
1963
|
// Work in progress.
|
|
@@ -1944,7 +2076,7 @@
|
|
|
1944
2076
|
var fakeNativeEvent = new Event();
|
|
1945
2077
|
fakeNativeEvent.target = domNode;
|
|
1946
2078
|
fakeNativeEvent.type = eventType.toLowerCase();
|
|
1947
|
-
var targetInst = getInstanceFromNode
|
|
2079
|
+
var targetInst = getInstanceFromNode(domNode);
|
|
1948
2080
|
var event = new SyntheticEvent(reactName, fakeNativeEvent.type, targetInst, fakeNativeEvent, domNode); // Since we aren't using pooling, always persist the event. This will make
|
|
1949
2081
|
// sure it's marked and won't warn when setting additional properties.
|
|
1950
2082
|
|
|
@@ -1961,11 +2093,11 @@
|
|
|
1961
2093
|
ReactDOM.unstable_batchedUpdates(function () {
|
|
1962
2094
|
// Normally extractEvent enqueues a state restore, but we'll just always
|
|
1963
2095
|
// do that since we're by-passing it here.
|
|
1964
|
-
enqueueStateRestore
|
|
2096
|
+
enqueueStateRestore(domNode);
|
|
1965
2097
|
executeDispatchesAndRelease(event);
|
|
1966
2098
|
rethrowCaughtError();
|
|
1967
2099
|
});
|
|
1968
|
-
restoreStateIfNeeded
|
|
2100
|
+
restoreStateIfNeeded();
|
|
1969
2101
|
};
|
|
1970
2102
|
} // A one-time snapshot with no plans to update. We'll probably want to deprecate Simulate API.
|
|
1971
2103
|
|
|
@@ -1999,5 +2131,6 @@
|
|
|
1999
2131
|
exports.scryRenderedDOMComponentsWithClass = scryRenderedDOMComponentsWithClass;
|
|
2000
2132
|
exports.scryRenderedDOMComponentsWithTag = scryRenderedDOMComponentsWithTag;
|
|
2001
2133
|
exports.traverseTwoPhase = traverseTwoPhase;
|
|
2134
|
+
exports.unstable_concurrentAct = unstable_concurrentAct;
|
|
2002
2135
|
|
|
2003
2136
|
})));
|