react-dom 16.4.0-alpha.7926752 → 16.5.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.
@@ -1,4 +1,4 @@
1
- /** @license React v16.4.0-alpha.7926752
1
+ /** @license React v16.5.0
2
2
  * react-dom-unstable-native-dependencies.development.js
3
3
  *
4
4
  * Copyright (c) 2013-present, Facebook, Inc.
@@ -16,18 +16,53 @@ if (process.env.NODE_ENV !== "production") {
16
16
  'use strict';
17
17
 
18
18
  var ReactDOM = require('react-dom');
19
- var invariant = require('fbjs/lib/invariant');
20
- var warning = require('fbjs/lib/warning');
21
19
  var _assign = require('object-assign');
22
- var emptyFunction = require('fbjs/lib/emptyFunction');
23
20
 
24
21
  /**
25
- * WARNING: DO NOT manually require this module.
26
- * This is a replacement for `invariant(...)` used by the error code system
27
- * and will _only_ be required by the corresponding babel pass.
28
- * It always throws.
22
+ * Use invariant() to assert state which your program assumes to be true.
23
+ *
24
+ * Provide sprintf-style format (only %s is supported) and arguments
25
+ * to provide information about what broke and what you were
26
+ * expecting.
27
+ *
28
+ * The invariant message will be stripped in production, but the invariant
29
+ * will remain to ensure logic does not differ in production.
29
30
  */
30
31
 
32
+ var validateFormat = function () {};
33
+
34
+ {
35
+ validateFormat = function (format) {
36
+ if (format === undefined) {
37
+ throw new Error('invariant requires an error message argument');
38
+ }
39
+ };
40
+ }
41
+
42
+ function invariant(condition, format, a, b, c, d, e, f) {
43
+ validateFormat(format);
44
+
45
+ if (!condition) {
46
+ var error = void 0;
47
+ if (format === undefined) {
48
+ error = new Error('Minified exception occurred; use the non-minified dev environment ' + 'for the full error message and additional helpful warnings.');
49
+ } else {
50
+ var args = [a, b, c, d, e, f];
51
+ var argIndex = 0;
52
+ error = new Error(format.replace(/%s/g, function () {
53
+ return args[argIndex++];
54
+ }));
55
+ error.name = 'Invariant Violation';
56
+ }
57
+
58
+ error.framesToPop = 1; // we don't care about invariant's own frame
59
+ throw error;
60
+ }
61
+ }
62
+
63
+ // Relying on the `invariant()` implementation lets us
64
+ // preserve the format and params in the www builds.
65
+
31
66
  {
32
67
  // In DEV mode, we swap out invokeGuardedCallback for a special version
33
68
  // that plays more nicely with the browser's DevTools. The idea is to preserve
@@ -57,31 +92,93 @@ var emptyFunction = require('fbjs/lib/emptyFunction');
57
92
  }
58
93
  }
59
94
 
60
- var getFiberCurrentPropsFromNode = null;
61
- var getInstanceFromNode = null;
62
- var getNodeFromInstance = null;
95
+ /**
96
+ * Call a function while guarding against errors that happens within it.
97
+ * Returns an error if it throws, otherwise null.
98
+ *
99
+ * In production, this is implemented using a try-catch. The reason we don't
100
+ * use a try-catch directly is so that we can swap out a different
101
+ * implementation in DEV mode.
102
+ *
103
+ * @param {String} name of the guard to use for logging or debugging
104
+ * @param {Function} func The function to invoke
105
+ * @param {*} context The context to use when calling the function
106
+ * @param {...*} args Arguments for function
107
+ */
63
108
 
64
- var injection = {
65
- injectComponentTree: function (Injected) {
66
- getFiberCurrentPropsFromNode = Injected.getFiberCurrentPropsFromNode;
67
- getInstanceFromNode = Injected.getInstanceFromNode;
68
- getNodeFromInstance = Injected.getNodeFromInstance;
69
109
 
70
- {
71
- warning(getNodeFromInstance && getInstanceFromNode, 'EventPluginUtils.injection.injectComponentTree(...): Injected ' + 'module is missing getNodeFromInstance or getInstanceFromNode.');
110
+ /**
111
+ * Same as invokeGuardedCallback, but instead of returning an error, it stores
112
+ * it in a global so it can be rethrown by `rethrowCaughtError` later.
113
+ * TODO: See if caughtError and rethrowError can be unified.
114
+ *
115
+ * @param {String} name of the guard to use for logging or debugging
116
+ * @param {Function} func The function to invoke
117
+ * @param {*} context The context to use when calling the function
118
+ * @param {...*} args Arguments for function
119
+ */
120
+
121
+
122
+ /**
123
+ * During execution of guarded functions we will capture the first error which
124
+ * we will rethrow to be handled by the top level error handler.
125
+ */
126
+
127
+ /**
128
+ * Similar to invariant but only logs a warning if the condition is not met.
129
+ * This can be used to log issues in development environments in critical
130
+ * paths. Removing the logging code for production environments will keep the
131
+ * same logic and follow the same code paths.
132
+ */
133
+
134
+ var warningWithoutStack = function () {};
135
+
136
+ {
137
+ warningWithoutStack = function (condition, format) {
138
+ for (var _len = arguments.length, args = Array(_len > 2 ? _len - 2 : 0), _key = 2; _key < _len; _key++) {
139
+ args[_key - 2] = arguments[_key];
72
140
  }
73
- }
74
- };
75
141
 
76
- function isEndish(topLevelType) {
77
- return topLevelType === 'topMouseUp' || topLevelType === 'topTouchEnd' || topLevelType === 'topTouchCancel';
78
- }
142
+ if (format === undefined) {
143
+ throw new Error('`warningWithoutStack(condition, format, ...args)` requires a warning ' + 'message argument');
144
+ }
145
+ if (condition) {
146
+ return;
147
+ }
148
+ if (typeof console !== 'undefined') {
149
+ var _console;
79
150
 
80
- function isMoveish(topLevelType) {
81
- return topLevelType === 'topMouseMove' || topLevelType === 'topTouchMove';
151
+ var stringArgs = args.map(function (item) {
152
+ return '' + item;
153
+ });
154
+ (_console = console).error.apply(_console, ['Warning: ' + format].concat(stringArgs));
155
+ }
156
+ try {
157
+ // --- Welcome to debugging React ---
158
+ // This error was thrown as a convenience so that you can use this stack
159
+ // to find the callsite that caused this warning to fire.
160
+ var argIndex = 0;
161
+ var message = 'Warning: ' + format.replace(/%s/g, function () {
162
+ return args[argIndex++];
163
+ });
164
+ throw new Error(message);
165
+ } catch (x) {}
166
+ };
82
167
  }
83
- function isStartish(topLevelType) {
84
- return topLevelType === 'topMouseDown' || topLevelType === 'topTouchStart';
168
+
169
+ var warningWithoutStack$1 = warningWithoutStack;
170
+
171
+ var getFiberCurrentPropsFromNode$1 = null;
172
+ var getInstanceFromNode$1 = null;
173
+ var getNodeFromInstance$1 = null;
174
+
175
+ function setComponentTree(getFiberCurrentPropsFromNodeImpl, getInstanceFromNodeImpl, getNodeFromInstanceImpl) {
176
+ getFiberCurrentPropsFromNode$1 = getFiberCurrentPropsFromNodeImpl;
177
+ getInstanceFromNode$1 = getInstanceFromNodeImpl;
178
+ getNodeFromInstance$1 = getNodeFromInstanceImpl;
179
+ {
180
+ !(getNodeFromInstance$1 && getInstanceFromNode$1) ? warningWithoutStack$1(false, 'EventPluginUtils.setComponentTree(...): Injected ' + 'module is missing getNodeFromInstance or getInstanceFromNode.') : void 0;
181
+ }
85
182
  }
86
183
 
87
184
  var validateEventDispatches = void 0;
@@ -96,7 +193,7 @@ var validateEventDispatches = void 0;
96
193
  var instancesIsArr = Array.isArray(dispatchInstances);
97
194
  var instancesLen = instancesIsArr ? dispatchInstances.length : dispatchInstances ? 1 : 0;
98
195
 
99
- warning(instancesIsArr === listenersIsArr && instancesLen === listenersLen, 'EventPluginUtils: Invalid `event`.');
196
+ !(instancesIsArr === listenersIsArr && instancesLen === listenersLen) ? warningWithoutStack$1(false, 'EventPluginUtils: Invalid `event`.') : void 0;
100
197
  };
101
198
  }
102
199
 
@@ -162,7 +259,7 @@ function executeDirectDispatch(event) {
162
259
  var dispatchListener = event._dispatchListeners;
163
260
  var dispatchInstance = event._dispatchInstances;
164
261
  !!Array.isArray(dispatchListener) ? invariant(false, 'executeDirectDispatch(...): Invalid `event`.') : void 0;
165
- event.currentTarget = dispatchListener ? getNodeFromInstance(dispatchInstance) : null;
262
+ event.currentTarget = dispatchListener ? getNodeFromInstance$1(dispatchInstance) : null;
166
263
  var res = dispatchListener ? dispatchListener(event) : null;
167
264
  event.currentTarget = null;
168
265
  event._dispatchListeners = null;
@@ -179,15 +276,13 @@ function hasDispatches(event) {
179
276
  }
180
277
 
181
278
  // Before we know whether it is functional or class
182
-
183
-
184
279
  // Root of a host tree. Could be nested inside another node.
185
280
  // A subtree. Could be an entry point to a different renderer.
186
- var HostComponent = 5;
281
+ var HostComponent = 7;
187
282
 
188
283
  function getParent(inst) {
189
284
  do {
190
- inst = inst['return'];
285
+ inst = inst.return;
191
286
  // TODO: If this is a HostRoot we might want to bail out.
192
287
  // That is depending on if we want nested subtrees (layers) to bubble
193
288
  // events to their parent. We could also go through parentNode on the
@@ -462,7 +557,7 @@ function getListener(inst, registrationName) {
462
557
  // Work in progress (ex: onload events in incremental mode).
463
558
  return null;
464
559
  }
465
- var props = getFiberCurrentPropsFromNode(stateNode);
560
+ var props = getFiberCurrentPropsFromNode$1(stateNode);
466
561
  if (!props) {
467
562
  // Work in progress.
468
563
  return null;
@@ -502,7 +597,7 @@ function listenerAtPhase(inst, event, propagationPhase) {
502
597
  */
503
598
  function accumulateDirectionalDispatches(inst, phase, event) {
504
599
  {
505
- warning(inst, 'Dispatching inst must not be null');
600
+ !inst ? warningWithoutStack$1(false, 'Dispatching inst must not be null') : void 0;
506
601
  }
507
602
  var listener = listenerAtPhase(inst, event, phase);
508
603
  if (listener) {
@@ -578,11 +673,8 @@ function accumulateDirectDispatches(events) {
578
673
 
579
674
  /* eslint valid-typeof: 0 */
580
675
 
581
- var didWarnForAddedNewProperty = false;
582
676
  var EVENT_POOL_SIZE = 10;
583
677
 
584
- var shouldBeReleasedProperties = ['dispatchConfig', '_targetInst', 'nativeEvent', 'isDefaultPrevented', 'isPropagationStopped', '_dispatchListeners', '_dispatchInstances'];
585
-
586
678
  /**
587
679
  * @interface Event
588
680
  * @see http://www.w3.org/TR/DOM-Level-3-Events/
@@ -591,7 +683,9 @@ var EventInterface = {
591
683
  type: null,
592
684
  target: null,
593
685
  // currentTarget is set when dispatching; no use in copying it here
594
- currentTarget: emptyFunction.thatReturnsNull,
686
+ currentTarget: function () {
687
+ return null;
688
+ },
595
689
  eventPhase: null,
596
690
  bubbles: null,
597
691
  cancelable: null,
@@ -602,6 +696,14 @@ var EventInterface = {
602
696
  isTrusted: null
603
697
  };
604
698
 
699
+ function functionThatReturnsTrue() {
700
+ return true;
701
+ }
702
+
703
+ function functionThatReturnsFalse() {
704
+ return false;
705
+ }
706
+
605
707
  /**
606
708
  * Synthetic events are dispatched by event plugins, typically in response to a
607
709
  * top-level event delegation handler.
@@ -626,6 +728,8 @@ function SyntheticEvent(dispatchConfig, targetInst, nativeEvent, nativeEventTarg
626
728
  delete this.nativeEvent;
627
729
  delete this.preventDefault;
628
730
  delete this.stopPropagation;
731
+ delete this.isDefaultPrevented;
732
+ delete this.isPropagationStopped;
629
733
  }
630
734
 
631
735
  this.dispatchConfig = dispatchConfig;
@@ -654,11 +758,11 @@ function SyntheticEvent(dispatchConfig, targetInst, nativeEvent, nativeEventTarg
654
758
 
655
759
  var defaultPrevented = nativeEvent.defaultPrevented != null ? nativeEvent.defaultPrevented : nativeEvent.returnValue === false;
656
760
  if (defaultPrevented) {
657
- this.isDefaultPrevented = emptyFunction.thatReturnsTrue;
761
+ this.isDefaultPrevented = functionThatReturnsTrue;
658
762
  } else {
659
- this.isDefaultPrevented = emptyFunction.thatReturnsFalse;
763
+ this.isDefaultPrevented = functionThatReturnsFalse;
660
764
  }
661
- this.isPropagationStopped = emptyFunction.thatReturnsFalse;
765
+ this.isPropagationStopped = functionThatReturnsFalse;
662
766
  return this;
663
767
  }
664
768
 
@@ -675,7 +779,7 @@ _assign(SyntheticEvent.prototype, {
675
779
  } else if (typeof event.returnValue !== 'unknown') {
676
780
  event.returnValue = false;
677
781
  }
678
- this.isDefaultPrevented = emptyFunction.thatReturnsTrue;
782
+ this.isDefaultPrevented = functionThatReturnsTrue;
679
783
  },
680
784
 
681
785
  stopPropagation: function () {
@@ -695,7 +799,7 @@ _assign(SyntheticEvent.prototype, {
695
799
  event.cancelBubble = true;
696
800
  }
697
801
 
698
- this.isPropagationStopped = emptyFunction.thatReturnsTrue;
802
+ this.isPropagationStopped = functionThatReturnsTrue;
699
803
  },
700
804
 
701
805
  /**
@@ -704,7 +808,7 @@ _assign(SyntheticEvent.prototype, {
704
808
  * won't be added back into the pool.
705
809
  */
706
810
  persist: function () {
707
- this.isPersistent = emptyFunction.thatReturnsTrue;
811
+ this.isPersistent = functionThatReturnsTrue;
708
812
  },
709
813
 
710
814
  /**
@@ -712,7 +816,7 @@ _assign(SyntheticEvent.prototype, {
712
816
  *
713
817
  * @return {boolean} True if this should not be released, false otherwise.
714
818
  */
715
- isPersistent: emptyFunction.thatReturnsFalse,
819
+ isPersistent: functionThatReturnsFalse,
716
820
 
717
821
  /**
718
822
  * `PooledClass` looks for `destructor` on each instance it releases.
@@ -724,13 +828,19 @@ _assign(SyntheticEvent.prototype, {
724
828
  Object.defineProperty(this, propName, getPooledWarningPropertyDefinition(propName, Interface[propName]));
725
829
  }
726
830
  }
727
- for (var i = 0; i < shouldBeReleasedProperties.length; i++) {
728
- this[shouldBeReleasedProperties[i]] = null;
729
- }
831
+ this.dispatchConfig = null;
832
+ this._targetInst = null;
833
+ this.nativeEvent = null;
834
+ this.isDefaultPrevented = functionThatReturnsFalse;
835
+ this.isPropagationStopped = functionThatReturnsFalse;
836
+ this._dispatchListeners = null;
837
+ this._dispatchInstances = null;
730
838
  {
731
839
  Object.defineProperty(this, 'nativeEvent', getPooledWarningPropertyDefinition('nativeEvent', null));
732
- Object.defineProperty(this, 'preventDefault', getPooledWarningPropertyDefinition('preventDefault', emptyFunction));
733
- Object.defineProperty(this, 'stopPropagation', getPooledWarningPropertyDefinition('stopPropagation', emptyFunction));
840
+ Object.defineProperty(this, 'isDefaultPrevented', getPooledWarningPropertyDefinition('isDefaultPrevented', functionThatReturnsFalse));
841
+ Object.defineProperty(this, 'isPropagationStopped', getPooledWarningPropertyDefinition('isPropagationStopped', functionThatReturnsFalse));
842
+ Object.defineProperty(this, 'preventDefault', getPooledWarningPropertyDefinition('preventDefault', function () {}));
843
+ Object.defineProperty(this, 'stopPropagation', getPooledWarningPropertyDefinition('stopPropagation', function () {}));
734
844
  }
735
845
  }
736
846
  });
@@ -761,38 +871,6 @@ SyntheticEvent.extend = function (Interface) {
761
871
  return Class;
762
872
  };
763
873
 
764
- /** Proxying after everything set on SyntheticEvent
765
- * to resolve Proxy issue on some WebKit browsers
766
- * in which some Event properties are set to undefined (GH#10010)
767
- */
768
- {
769
- var isProxySupported = typeof Proxy === 'function' &&
770
- // https://github.com/facebook/react/issues/12011
771
- !Object.isSealed(new Proxy({}, {}));
772
-
773
- if (isProxySupported) {
774
- /*eslint-disable no-func-assign */
775
- SyntheticEvent = new Proxy(SyntheticEvent, {
776
- construct: function (target, args) {
777
- return this.apply(target, Object.create(target.prototype), args);
778
- },
779
- apply: function (constructor, that, args) {
780
- return new Proxy(constructor.apply(that, args), {
781
- set: function (target, prop, value) {
782
- if (prop !== 'isPersistent' && !target.constructor.Interface.hasOwnProperty(prop) && shouldBeReleasedProperties.indexOf(prop) === -1) {
783
- warning(didWarnForAddedNewProperty || target.isPersistent(), "This synthetic event is reused for performance reasons. If you're " + "seeing this, you're adding a new property in the synthetic event object. " + 'The property is never released. See ' + 'https://fb.me/react-event-pooling for more information.');
784
- didWarnForAddedNewProperty = true;
785
- }
786
- target[prop] = value;
787
- return true;
788
- }
789
- });
790
- }
791
- });
792
- /*eslint-enable no-func-assign */
793
- }
794
- }
795
-
796
874
  addEventPoolingTo(SyntheticEvent);
797
875
 
798
876
  /**
@@ -825,7 +903,7 @@ function getPooledWarningPropertyDefinition(propName, getVal) {
825
903
 
826
904
  function warn(action, result) {
827
905
  var warningCondition = false;
828
- warning(warningCondition, "This synthetic event is reused for performance reasons. If you're seeing this, " + "you're %s `%s` on a released/nullified synthetic event. %s. " + 'If you must keep the original synthetic event around, use event.persist(). ' + 'See https://fb.me/react-event-pooling for more information.', action, propName, result);
906
+ !warningCondition ? warningWithoutStack$1(false, "This synthetic event is reused for performance reasons. If you're seeing this, " + "you're %s `%s` on a released/nullified synthetic event. %s. " + 'If you must keep the original synthetic event around, use event.persist(). ' + 'See https://fb.me/react-event-pooling for more information.', action, propName, result) : void 0;
829
907
  }
830
908
  }
831
909
 
@@ -841,7 +919,7 @@ function getPooledEvent(dispatchConfig, targetInst, nativeEvent, nativeInst) {
841
919
 
842
920
  function releasePooledEvent(event) {
843
921
  var EventConstructor = this;
844
- !(event instanceof EventConstructor) ? invariant(false, 'Trying to release an event instance into a pool of a different type.') : void 0;
922
+ !(event instanceof EventConstructor) ? invariant(false, 'Trying to release an event instance into a pool of a different type.') : void 0;
845
923
  event.destructor();
846
924
  if (EventConstructor.eventPool.length < EVENT_POOL_SIZE) {
847
925
  EventConstructor.eventPool.push(event);
@@ -854,19 +932,46 @@ function addEventPoolingTo(EventConstructor) {
854
932
  EventConstructor.release = releasePooledEvent;
855
933
  }
856
934
 
857
- var SyntheticEvent$1 = SyntheticEvent;
858
-
859
935
  /**
860
936
  * `touchHistory` isn't actually on the native event, but putting it in the
861
937
  * interface will ensure that it is cleaned up when pooled/destroyed. The
862
938
  * `ResponderEventPlugin` will populate it appropriately.
863
939
  */
864
- var ResponderSyntheticEvent = SyntheticEvent$1.extend({
940
+ var ResponderSyntheticEvent = SyntheticEvent.extend({
865
941
  touchHistory: function (nativeEvent) {
866
942
  return null; // Actually doesn't even look at the native event.
867
943
  }
868
944
  });
869
945
 
946
+ // Note: ideally these would be imported from DOMTopLevelEventTypes,
947
+ // but our build system currently doesn't let us do that from a fork.
948
+
949
+ var TOP_TOUCH_START = 'touchstart';
950
+ var TOP_TOUCH_MOVE = 'touchmove';
951
+ var TOP_TOUCH_END = 'touchend';
952
+ var TOP_TOUCH_CANCEL = 'touchcancel';
953
+ var TOP_SCROLL = 'scroll';
954
+ var TOP_SELECTION_CHANGE = 'selectionchange';
955
+ var TOP_MOUSE_DOWN = 'mousedown';
956
+ var TOP_MOUSE_MOVE = 'mousemove';
957
+ var TOP_MOUSE_UP = 'mouseup';
958
+
959
+ function isStartish(topLevelType) {
960
+ return topLevelType === TOP_TOUCH_START || topLevelType === TOP_MOUSE_DOWN;
961
+ }
962
+
963
+ function isMoveish(topLevelType) {
964
+ return topLevelType === TOP_TOUCH_MOVE || topLevelType === TOP_MOUSE_MOVE;
965
+ }
966
+
967
+ function isEndish(topLevelType) {
968
+ return topLevelType === TOP_TOUCH_END || topLevelType === TOP_TOUCH_CANCEL || topLevelType === TOP_MOUSE_UP;
969
+ }
970
+
971
+ var startDependencies = [TOP_TOUCH_START, TOP_MOUSE_DOWN];
972
+ var moveDependencies = [TOP_TOUCH_MOVE, TOP_MOUSE_MOVE];
973
+ var endDependencies = [TOP_TOUCH_CANCEL, TOP_TOUCH_END, TOP_MOUSE_UP];
974
+
870
975
  /**
871
976
  * Tracks the position and time of each active touch by `touch.identifier`. We
872
977
  * should typically only see IDs in the range of 1-20 because IDs get recycled
@@ -930,7 +1035,7 @@ function getTouchIdentifier(_ref) {
930
1035
 
931
1036
  !(identifier != null) ? invariant(false, 'Touch object is missing identifier.') : void 0;
932
1037
  {
933
- warning(identifier <= MAX_TOUCH_BANK, 'Touch identifier %s is greater than maximum supported %s which causes ' + 'performance issues backfilling array locations for all of the indices.', identifier, MAX_TOUCH_BANK);
1038
+ !(identifier <= MAX_TOUCH_BANK) ? warningWithoutStack$1(false, 'Touch identifier %s is greater than maximum supported %s which causes ' + 'performance issues backfilling array locations for all of the indices.', identifier, MAX_TOUCH_BANK) : void 0;
934
1039
  }
935
1040
  return identifier;
936
1041
  }
@@ -1018,7 +1123,7 @@ var ResponderTouchHistoryStore = {
1018
1123
  }
1019
1124
  {
1020
1125
  var activeRecord = touchBank[touchHistory.indexOfSingleActiveTouch];
1021
- warning(activeRecord != null && activeRecord.touchActive, 'Cannot find single active touch.');
1126
+ !(activeRecord != null && activeRecord.touchActive) ? warningWithoutStack$1(false, 'Cannot find single active touch.') : void 0;
1022
1127
  }
1023
1128
  }
1024
1129
  }
@@ -1067,11 +1172,6 @@ var responderInst = null;
1067
1172
  */
1068
1173
  var trackedTouchCount = 0;
1069
1174
 
1070
- /**
1071
- * Last reported number of active touches.
1072
- */
1073
- var previousActiveTouches = 0;
1074
-
1075
1175
  var changeResponder = function (nextResponderInst, blockHostResponder) {
1076
1176
  var oldResponderInst = responderInst;
1077
1177
  responderInst = nextResponderInst;
@@ -1089,7 +1189,8 @@ var eventTypes = {
1089
1189
  phasedRegistrationNames: {
1090
1190
  bubbled: 'onStartShouldSetResponder',
1091
1191
  captured: 'onStartShouldSetResponderCapture'
1092
- }
1192
+ },
1193
+ dependencies: startDependencies
1093
1194
  },
1094
1195
 
1095
1196
  /**
@@ -1105,7 +1206,8 @@ var eventTypes = {
1105
1206
  phasedRegistrationNames: {
1106
1207
  bubbled: 'onScrollShouldSetResponder',
1107
1208
  captured: 'onScrollShouldSetResponderCapture'
1108
- }
1209
+ },
1210
+ dependencies: [TOP_SCROLL]
1109
1211
  },
1110
1212
 
1111
1213
  /**
@@ -1119,7 +1221,8 @@ var eventTypes = {
1119
1221
  phasedRegistrationNames: {
1120
1222
  bubbled: 'onSelectionChangeShouldSetResponder',
1121
1223
  captured: 'onSelectionChangeShouldSetResponderCapture'
1122
- }
1224
+ },
1225
+ dependencies: [TOP_SELECTION_CHANGE]
1123
1226
  },
1124
1227
 
1125
1228
  /**
@@ -1130,22 +1233,45 @@ var eventTypes = {
1130
1233
  phasedRegistrationNames: {
1131
1234
  bubbled: 'onMoveShouldSetResponder',
1132
1235
  captured: 'onMoveShouldSetResponderCapture'
1133
- }
1236
+ },
1237
+ dependencies: moveDependencies
1134
1238
  },
1135
1239
 
1136
1240
  /**
1137
1241
  * Direct responder events dispatched directly to responder. Do not bubble.
1138
1242
  */
1139
- responderStart: { registrationName: 'onResponderStart' },
1140
- responderMove: { registrationName: 'onResponderMove' },
1141
- responderEnd: { registrationName: 'onResponderEnd' },
1142
- responderRelease: { registrationName: 'onResponderRelease' },
1243
+ responderStart: {
1244
+ registrationName: 'onResponderStart',
1245
+ dependencies: startDependencies
1246
+ },
1247
+ responderMove: {
1248
+ registrationName: 'onResponderMove',
1249
+ dependencies: moveDependencies
1250
+ },
1251
+ responderEnd: {
1252
+ registrationName: 'onResponderEnd',
1253
+ dependencies: endDependencies
1254
+ },
1255
+ responderRelease: {
1256
+ registrationName: 'onResponderRelease',
1257
+ dependencies: endDependencies
1258
+ },
1143
1259
  responderTerminationRequest: {
1144
- registrationName: 'onResponderTerminationRequest'
1260
+ registrationName: 'onResponderTerminationRequest',
1261
+ dependencies: []
1262
+ },
1263
+ responderGrant: {
1264
+ registrationName: 'onResponderGrant',
1265
+ dependencies: []
1266
+ },
1267
+ responderReject: {
1268
+ registrationName: 'onResponderReject',
1269
+ dependencies: []
1145
1270
  },
1146
- responderGrant: { registrationName: 'onResponderGrant' },
1147
- responderReject: { registrationName: 'onResponderReject' },
1148
- responderTerminate: { registrationName: 'onResponderTerminate' }
1271
+ responderTerminate: {
1272
+ registrationName: 'onResponderTerminate',
1273
+ dependencies: []
1274
+ }
1149
1275
  };
1150
1276
 
1151
1277
  /**
@@ -1339,7 +1465,7 @@ to return true:wantsResponderID| |
1339
1465
  */
1340
1466
 
1341
1467
  function setResponderAndExtractTransfer(topLevelType, targetInst, nativeEvent, nativeEventTarget) {
1342
- var shouldSetEventType = isStartish(topLevelType) ? eventTypes.startShouldSetResponder : isMoveish(topLevelType) ? eventTypes.moveShouldSetResponder : topLevelType === 'topSelectionChange' ? eventTypes.selectionChangeShouldSetResponder : eventTypes.scrollShouldSetResponder;
1468
+ var shouldSetEventType = isStartish(topLevelType) ? eventTypes.startShouldSetResponder : isMoveish(topLevelType) ? eventTypes.moveShouldSetResponder : topLevelType === TOP_SELECTION_CHANGE ? eventTypes.selectionChangeShouldSetResponder : eventTypes.scrollShouldSetResponder;
1343
1469
 
1344
1470
  // TODO: stop one short of the current responder.
1345
1471
  var bubbleShouldSetFrom = !responderInst ? targetInst : getLowestCommonAncestor(responderInst, targetInst);
@@ -1411,7 +1537,7 @@ function canTriggerTransfer(topLevelType, topLevelInst, nativeEvent) {
1411
1537
  // responderIgnoreScroll: We are trying to migrate away from specifically
1412
1538
  // tracking native scroll events here and responderIgnoreScroll indicates we
1413
1539
  // will send topTouchCancel to handle canceling touch events instead
1414
- topLevelType === 'topScroll' && !nativeEvent.responderIgnoreScroll || trackedTouchCount > 0 && topLevelType === 'topSelectionChange' || isStartish(topLevelType) || isMoveish(topLevelType));
1540
+ topLevelType === TOP_SCROLL && !nativeEvent.responderIgnoreScroll || trackedTouchCount > 0 && topLevelType === TOP_SELECTION_CHANGE || isStartish(topLevelType) || isMoveish(topLevelType));
1415
1541
  }
1416
1542
 
1417
1543
  /**
@@ -1431,7 +1557,7 @@ function noResponderTouches(nativeEvent) {
1431
1557
  var target = activeTouch.target;
1432
1558
  if (target !== null && target !== undefined && target !== 0) {
1433
1559
  // Is the original touch location inside of the current responder?
1434
- var targetInst = getInstanceFromNode(target);
1560
+ var targetInst = getInstanceFromNode$1(target);
1435
1561
  if (isAncestor(responderInst, targetInst)) {
1436
1562
  return false;
1437
1563
  }
@@ -1490,7 +1616,7 @@ var ResponderEventPlugin = {
1490
1616
  extracted = accumulate(extracted, gesture);
1491
1617
  }
1492
1618
 
1493
- var isResponderTerminate = responderInst && topLevelType === 'topTouchCancel';
1619
+ var isResponderTerminate = responderInst && topLevelType === TOP_TOUCH_CANCEL;
1494
1620
  var isResponderRelease = responderInst && !isResponderTerminate && isEndish(topLevelType) && noResponderTouches(nativeEvent);
1495
1621
  var finalTouch = isResponderTerminate ? eventTypes.responderTerminate : isResponderRelease ? eventTypes.responderRelease : null;
1496
1622
  if (finalTouch) {
@@ -1501,17 +1627,10 @@ var ResponderEventPlugin = {
1501
1627
  changeResponder(null);
1502
1628
  }
1503
1629
 
1504
- var numberActiveTouches = ResponderTouchHistoryStore.touchHistory.numberActiveTouches;
1505
- if (ResponderEventPlugin.GlobalInteractionHandler && numberActiveTouches !== previousActiveTouches) {
1506
- ResponderEventPlugin.GlobalInteractionHandler.onChange(numberActiveTouches);
1507
- }
1508
- previousActiveTouches = numberActiveTouches;
1509
-
1510
1630
  return extracted;
1511
1631
  },
1512
1632
 
1513
1633
  GlobalResponderHandler: null,
1514
- GlobalInteractionHandler: null,
1515
1634
 
1516
1635
  injection: {
1517
1636
  /**
@@ -1521,24 +1640,23 @@ var ResponderEventPlugin = {
1521
1640
  */
1522
1641
  injectGlobalResponderHandler: function (GlobalResponderHandler) {
1523
1642
  ResponderEventPlugin.GlobalResponderHandler = GlobalResponderHandler;
1524
- },
1525
-
1526
- /**
1527
- * @param {{onChange: (numberActiveTouches) => void} GlobalInteractionHandler
1528
- * Object that handles any change in the number of active touches.
1529
- */
1530
- injectGlobalInteractionHandler: function (GlobalInteractionHandler) {
1531
- ResponderEventPlugin.GlobalInteractionHandler = GlobalInteractionHandler;
1532
1643
  }
1533
1644
  }
1534
1645
  };
1535
1646
 
1536
1647
  // This is used by react-native-web.
1537
- var injectComponentTree = injection.injectComponentTree;
1648
+ function injectComponentTree(ComponentTree) {
1649
+ setComponentTree(ComponentTree.getFiberCurrentPropsFromNode, ComponentTree.getInstanceFromNode, ComponentTree.getNodeFromInstance);
1650
+ }
1651
+
1538
1652
  // Inject react-dom's ComponentTree into this module.
1539
- var ReactDOMComponentTree = ReactDOM.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactDOMComponentTree;
1653
+ // Keep in sync with ReactDOM.js and ReactTestUtils.js:
1654
+ var _ReactDOM$__SECRET_IN = ReactDOM.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.Events;
1655
+ var getInstanceFromNode = _ReactDOM$__SECRET_IN[0];
1656
+ var getNodeFromInstance = _ReactDOM$__SECRET_IN[1];
1657
+ var getFiberCurrentPropsFromNode = _ReactDOM$__SECRET_IN[2];
1540
1658
 
1541
- injectComponentTree(ReactDOMComponentTree);
1659
+ setComponentTree(getFiberCurrentPropsFromNode, getInstanceFromNode, getNodeFromInstance);
1542
1660
 
1543
1661
  var ReactDOMUnstableNativeDependencies = Object.freeze({
1544
1662
  injectComponentTree: injectComponentTree,