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.
- package/README.md +1 -1
- package/cjs/react-dom-server.browser.development.js +611 -263
- package/cjs/react-dom-server.browser.production.min.js +35 -33
- package/cjs/react-dom-server.node.development.js +611 -263
- package/cjs/react-dom-server.node.production.min.js +37 -35
- package/cjs/react-dom-test-utils.development.js +394 -241
- package/cjs/react-dom-test-utils.production.min.js +25 -26
- package/cjs/react-dom-unstable-native-dependencies.development.js +247 -129
- package/cjs/react-dom-unstable-native-dependencies.production.min.js +28 -28
- package/cjs/react-dom.development.js +12644 -11597
- package/cjs/react-dom.production.min.js +225 -245
- package/cjs/react-dom.profiling.min.js +245 -0
- package/package.json +5 -4
- package/profiling.js +38 -0
- package/umd/react-dom-server.browser.development.js +594 -537
- package/umd/react-dom-server.browser.production.min.js +29 -28
- package/umd/react-dom-test-utils.development.js +329 -358
- package/umd/react-dom-test-utils.production.min.js +21 -22
- package/umd/react-dom-unstable-native-dependencies.development.js +183 -214
- package/umd/react-dom-unstable-native-dependencies.production.min.js +23 -23
- package/umd/react-dom.development.js +12566 -11974
- package/umd/react-dom.production.min.js +184 -205
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/** @license React v16.
|
|
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.
|
|
@@ -15,23 +15,6 @@
|
|
|
15
15
|
(global.ReactDOMUnstableNativeDependencies = factory(global.ReactDOM,global.React));
|
|
16
16
|
}(this, (function (ReactDOM,React) { 'use strict';
|
|
17
17
|
|
|
18
|
-
/**
|
|
19
|
-
* WARNING: DO NOT manually require this module.
|
|
20
|
-
* This is a replacement for `invariant(...)` used by the error code system
|
|
21
|
-
* and will _only_ be required by the corresponding babel pass.
|
|
22
|
-
* It always throws.
|
|
23
|
-
*/
|
|
24
|
-
|
|
25
|
-
/**
|
|
26
|
-
* Copyright (c) 2013-present, Facebook, Inc.
|
|
27
|
-
*
|
|
28
|
-
* This source code is licensed under the MIT license found in the
|
|
29
|
-
* LICENSE file in the root directory of this source tree.
|
|
30
|
-
*
|
|
31
|
-
*/
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
18
|
/**
|
|
36
19
|
* Use invariant() to assert state which your program assumes to be true.
|
|
37
20
|
*
|
|
@@ -43,10 +26,10 @@
|
|
|
43
26
|
* will remain to ensure logic does not differ in production.
|
|
44
27
|
*/
|
|
45
28
|
|
|
46
|
-
var validateFormat = function
|
|
29
|
+
var validateFormat = function () {};
|
|
47
30
|
|
|
48
31
|
{
|
|
49
|
-
validateFormat = function
|
|
32
|
+
validateFormat = function (format) {
|
|
50
33
|
if (format === undefined) {
|
|
51
34
|
throw new Error('invariant requires an error message argument');
|
|
52
35
|
}
|
|
@@ -57,7 +40,7 @@ function invariant(condition, format, a, b, c, d, e, f) {
|
|
|
57
40
|
validateFormat(format);
|
|
58
41
|
|
|
59
42
|
if (!condition) {
|
|
60
|
-
var error;
|
|
43
|
+
var error = void 0;
|
|
61
44
|
if (format === undefined) {
|
|
62
45
|
error = new Error('Minified exception occurred; use the non-minified dev environment ' + 'for the full error message and additional helpful warnings.');
|
|
63
46
|
} else {
|
|
@@ -74,7 +57,8 @@ function invariant(condition, format, a, b, c, d, e, f) {
|
|
|
74
57
|
}
|
|
75
58
|
}
|
|
76
59
|
|
|
77
|
-
|
|
60
|
+
// Relying on the `invariant()` implementation lets us
|
|
61
|
+
// preserve the format and params in the www builds.
|
|
78
62
|
|
|
79
63
|
{
|
|
80
64
|
// In DEV mode, we swap out invokeGuardedCallback for a special version
|
|
@@ -106,52 +90,37 @@ var invariant_1 = invariant;
|
|
|
106
90
|
}
|
|
107
91
|
|
|
108
92
|
/**
|
|
109
|
-
*
|
|
93
|
+
* Call a function while guarding against errors that happens within it.
|
|
94
|
+
* Returns an error if it throws, otherwise null.
|
|
110
95
|
*
|
|
111
|
-
*
|
|
112
|
-
*
|
|
96
|
+
* In production, this is implemented using a try-catch. The reason we don't
|
|
97
|
+
* use a try-catch directly is so that we can swap out a different
|
|
98
|
+
* implementation in DEV mode.
|
|
113
99
|
*
|
|
114
|
-
*
|
|
100
|
+
* @param {String} name of the guard to use for logging or debugging
|
|
101
|
+
* @param {Function} func The function to invoke
|
|
102
|
+
* @param {*} context The context to use when calling the function
|
|
103
|
+
* @param {...*} args Arguments for function
|
|
115
104
|
*/
|
|
116
105
|
|
|
117
|
-
function makeEmptyFunction(arg) {
|
|
118
|
-
return function () {
|
|
119
|
-
return arg;
|
|
120
|
-
};
|
|
121
|
-
}
|
|
122
106
|
|
|
123
107
|
/**
|
|
124
|
-
*
|
|
125
|
-
*
|
|
126
|
-
*
|
|
108
|
+
* Same as invokeGuardedCallback, but instead of returning an error, it stores
|
|
109
|
+
* it in a global so it can be rethrown by `rethrowCaughtError` later.
|
|
110
|
+
* TODO: See if caughtError and rethrowError can be unified.
|
|
111
|
+
*
|
|
112
|
+
* @param {String} name of the guard to use for logging or debugging
|
|
113
|
+
* @param {Function} func The function to invoke
|
|
114
|
+
* @param {*} context The context to use when calling the function
|
|
115
|
+
* @param {...*} args Arguments for function
|
|
127
116
|
*/
|
|
128
|
-
var emptyFunction = function emptyFunction() {};
|
|
129
|
-
|
|
130
|
-
emptyFunction.thatReturns = makeEmptyFunction;
|
|
131
|
-
emptyFunction.thatReturnsFalse = makeEmptyFunction(false);
|
|
132
|
-
emptyFunction.thatReturnsTrue = makeEmptyFunction(true);
|
|
133
|
-
emptyFunction.thatReturnsNull = makeEmptyFunction(null);
|
|
134
|
-
emptyFunction.thatReturnsThis = function () {
|
|
135
|
-
return this;
|
|
136
|
-
};
|
|
137
|
-
emptyFunction.thatReturnsArgument = function (arg) {
|
|
138
|
-
return arg;
|
|
139
|
-
};
|
|
140
117
|
|
|
141
|
-
var emptyFunction_1 = emptyFunction;
|
|
142
118
|
|
|
143
119
|
/**
|
|
144
|
-
*
|
|
145
|
-
*
|
|
146
|
-
* This source code is licensed under the MIT license found in the
|
|
147
|
-
* LICENSE file in the root directory of this source tree.
|
|
148
|
-
*
|
|
120
|
+
* During execution of guarded functions we will capture the first error which
|
|
121
|
+
* we will rethrow to be handled by the top level error handler.
|
|
149
122
|
*/
|
|
150
123
|
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
124
|
/**
|
|
156
125
|
* Similar to invariant but only logs a warning if the condition is not met.
|
|
157
126
|
* This can be used to log issues in development environments in critical
|
|
@@ -159,75 +128,54 @@ var emptyFunction_1 = emptyFunction;
|
|
|
159
128
|
* same logic and follow the same code paths.
|
|
160
129
|
*/
|
|
161
130
|
|
|
162
|
-
var
|
|
131
|
+
var warningWithoutStack = function () {};
|
|
163
132
|
|
|
164
133
|
{
|
|
165
|
-
|
|
166
|
-
for (var _len = arguments.length, args = Array(_len >
|
|
167
|
-
args[_key -
|
|
134
|
+
warningWithoutStack = function (condition, format) {
|
|
135
|
+
for (var _len = arguments.length, args = Array(_len > 2 ? _len - 2 : 0), _key = 2; _key < _len; _key++) {
|
|
136
|
+
args[_key - 2] = arguments[_key];
|
|
168
137
|
}
|
|
169
138
|
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
139
|
+
if (format === undefined) {
|
|
140
|
+
throw new Error('`warningWithoutStack(condition, format, ...args)` requires a warning ' + 'message argument');
|
|
141
|
+
}
|
|
142
|
+
if (condition) {
|
|
143
|
+
return;
|
|
144
|
+
}
|
|
174
145
|
if (typeof console !== 'undefined') {
|
|
175
|
-
|
|
146
|
+
var _console;
|
|
147
|
+
|
|
148
|
+
var stringArgs = args.map(function (item) {
|
|
149
|
+
return '' + item;
|
|
150
|
+
});
|
|
151
|
+
(_console = console).error.apply(_console, ['Warning: ' + format].concat(stringArgs));
|
|
176
152
|
}
|
|
177
153
|
try {
|
|
178
154
|
// --- Welcome to debugging React ---
|
|
179
155
|
// This error was thrown as a convenience so that you can use this stack
|
|
180
156
|
// to find the callsite that caused this warning to fire.
|
|
157
|
+
var argIndex = 0;
|
|
158
|
+
var message = 'Warning: ' + format.replace(/%s/g, function () {
|
|
159
|
+
return args[argIndex++];
|
|
160
|
+
});
|
|
181
161
|
throw new Error(message);
|
|
182
162
|
} catch (x) {}
|
|
183
163
|
};
|
|
184
|
-
|
|
185
|
-
warning = function warning(condition, format) {
|
|
186
|
-
if (format === undefined) {
|
|
187
|
-
throw new Error('`warning(condition, format, ...args)` requires a warning ' + 'message argument');
|
|
188
|
-
}
|
|
189
|
-
|
|
190
|
-
if (format.indexOf('Failed Composite propType: ') === 0) {
|
|
191
|
-
return; // Ignore CompositeComponent proptype check.
|
|
192
|
-
}
|
|
193
|
-
|
|
194
|
-
if (!condition) {
|
|
195
|
-
for (var _len2 = arguments.length, args = Array(_len2 > 2 ? _len2 - 2 : 0), _key2 = 2; _key2 < _len2; _key2++) {
|
|
196
|
-
args[_key2 - 2] = arguments[_key2];
|
|
197
|
-
}
|
|
198
|
-
|
|
199
|
-
printWarning.apply(undefined, [format].concat(args));
|
|
200
|
-
}
|
|
201
|
-
};
|
|
202
164
|
}
|
|
203
165
|
|
|
204
|
-
var
|
|
205
|
-
|
|
206
|
-
var getFiberCurrentPropsFromNode = null;
|
|
207
|
-
var getInstanceFromNode = null;
|
|
208
|
-
var getNodeFromInstance = null;
|
|
166
|
+
var warningWithoutStack$1 = warningWithoutStack;
|
|
209
167
|
|
|
210
|
-
var
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
getInstanceFromNode = Injected.getInstanceFromNode;
|
|
214
|
-
getNodeFromInstance = Injected.getNodeFromInstance;
|
|
168
|
+
var getFiberCurrentPropsFromNode$1 = null;
|
|
169
|
+
var getInstanceFromNode$1 = null;
|
|
170
|
+
var getNodeFromInstance$1 = null;
|
|
215
171
|
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
172
|
+
function setComponentTree(getFiberCurrentPropsFromNodeImpl, getInstanceFromNodeImpl, getNodeFromInstanceImpl) {
|
|
173
|
+
getFiberCurrentPropsFromNode$1 = getFiberCurrentPropsFromNodeImpl;
|
|
174
|
+
getInstanceFromNode$1 = getInstanceFromNodeImpl;
|
|
175
|
+
getNodeFromInstance$1 = getNodeFromInstanceImpl;
|
|
176
|
+
{
|
|
177
|
+
!(getNodeFromInstance$1 && getInstanceFromNode$1) ? warningWithoutStack$1(false, 'EventPluginUtils.setComponentTree(...): Injected ' + 'module is missing getNodeFromInstance or getInstanceFromNode.') : void 0;
|
|
219
178
|
}
|
|
220
|
-
};
|
|
221
|
-
|
|
222
|
-
function isEndish(topLevelType) {
|
|
223
|
-
return topLevelType === 'topMouseUp' || topLevelType === 'topTouchEnd' || topLevelType === 'topTouchCancel';
|
|
224
|
-
}
|
|
225
|
-
|
|
226
|
-
function isMoveish(topLevelType) {
|
|
227
|
-
return topLevelType === 'topMouseMove' || topLevelType === 'topTouchMove';
|
|
228
|
-
}
|
|
229
|
-
function isStartish(topLevelType) {
|
|
230
|
-
return topLevelType === 'topMouseDown' || topLevelType === 'topTouchStart';
|
|
231
179
|
}
|
|
232
180
|
|
|
233
181
|
var validateEventDispatches = void 0;
|
|
@@ -242,7 +190,7 @@ var validateEventDispatches = void 0;
|
|
|
242
190
|
var instancesIsArr = Array.isArray(dispatchInstances);
|
|
243
191
|
var instancesLen = instancesIsArr ? dispatchInstances.length : dispatchInstances ? 1 : 0;
|
|
244
192
|
|
|
245
|
-
|
|
193
|
+
!(instancesIsArr === listenersIsArr && instancesLen === listenersLen) ? warningWithoutStack$1(false, 'EventPluginUtils: Invalid `event`.') : void 0;
|
|
246
194
|
};
|
|
247
195
|
}
|
|
248
196
|
|
|
@@ -307,8 +255,8 @@ function executeDirectDispatch(event) {
|
|
|
307
255
|
}
|
|
308
256
|
var dispatchListener = event._dispatchListeners;
|
|
309
257
|
var dispatchInstance = event._dispatchInstances;
|
|
310
|
-
!!Array.isArray(dispatchListener) ?
|
|
311
|
-
event.currentTarget = dispatchListener ? getNodeFromInstance(dispatchInstance) : null;
|
|
258
|
+
!!Array.isArray(dispatchListener) ? invariant(false, 'executeDirectDispatch(...): Invalid `event`.') : void 0;
|
|
259
|
+
event.currentTarget = dispatchListener ? getNodeFromInstance$1(dispatchInstance) : null;
|
|
312
260
|
var res = dispatchListener ? dispatchListener(event) : null;
|
|
313
261
|
event.currentTarget = null;
|
|
314
262
|
event._dispatchListeners = null;
|
|
@@ -325,15 +273,13 @@ function hasDispatches(event) {
|
|
|
325
273
|
}
|
|
326
274
|
|
|
327
275
|
// Before we know whether it is functional or class
|
|
328
|
-
|
|
329
|
-
|
|
330
276
|
// Root of a host tree. Could be nested inside another node.
|
|
331
277
|
// A subtree. Could be an entry point to a different renderer.
|
|
332
|
-
var HostComponent =
|
|
278
|
+
var HostComponent = 7;
|
|
333
279
|
|
|
334
280
|
function getParent(inst) {
|
|
335
281
|
do {
|
|
336
|
-
inst = inst
|
|
282
|
+
inst = inst.return;
|
|
337
283
|
// TODO: If this is a HostRoot we might want to bail out.
|
|
338
284
|
// That is depending on if we want nested subtrees (layers) to bubble
|
|
339
285
|
// events to their parent. We could also go through parentNode on the
|
|
@@ -501,7 +447,7 @@ function traverseTwoPhase(inst, fn, arg) {
|
|
|
501
447
|
*/
|
|
502
448
|
|
|
503
449
|
function accumulateInto(current, next) {
|
|
504
|
-
!(next != null) ?
|
|
450
|
+
!(next != null) ? invariant(false, 'accumulateInto(...): Accumulated items must not be null or undefined.') : void 0;
|
|
505
451
|
|
|
506
452
|
if (current == null) {
|
|
507
453
|
return next;
|
|
@@ -608,7 +554,7 @@ function getListener(inst, registrationName) {
|
|
|
608
554
|
// Work in progress (ex: onload events in incremental mode).
|
|
609
555
|
return null;
|
|
610
556
|
}
|
|
611
|
-
var props = getFiberCurrentPropsFromNode(stateNode);
|
|
557
|
+
var props = getFiberCurrentPropsFromNode$1(stateNode);
|
|
612
558
|
if (!props) {
|
|
613
559
|
// Work in progress.
|
|
614
560
|
return null;
|
|
@@ -617,7 +563,7 @@ function getListener(inst, registrationName) {
|
|
|
617
563
|
if (shouldPreventMouseEvent(registrationName, inst.type, props)) {
|
|
618
564
|
return null;
|
|
619
565
|
}
|
|
620
|
-
!(!listener || typeof listener === 'function') ?
|
|
566
|
+
!(!listener || typeof listener === 'function') ? invariant(false, 'Expected `%s` listener to be a function, instead got a value of `%s` type.', registrationName, typeof listener) : void 0;
|
|
621
567
|
return listener;
|
|
622
568
|
}
|
|
623
569
|
|
|
@@ -648,7 +594,7 @@ function listenerAtPhase(inst, event, propagationPhase) {
|
|
|
648
594
|
*/
|
|
649
595
|
function accumulateDirectionalDispatches(inst, phase, event) {
|
|
650
596
|
{
|
|
651
|
-
|
|
597
|
+
!inst ? warningWithoutStack$1(false, 'Dispatching inst must not be null') : void 0;
|
|
652
598
|
}
|
|
653
599
|
var listener = listenerAtPhase(inst, event, phase);
|
|
654
600
|
if (listener) {
|
|
@@ -728,11 +674,8 @@ var _assign = ReactInternals.assign;
|
|
|
728
674
|
|
|
729
675
|
/* eslint valid-typeof: 0 */
|
|
730
676
|
|
|
731
|
-
var didWarnForAddedNewProperty = false;
|
|
732
677
|
var EVENT_POOL_SIZE = 10;
|
|
733
678
|
|
|
734
|
-
var shouldBeReleasedProperties = ['dispatchConfig', '_targetInst', 'nativeEvent', 'isDefaultPrevented', 'isPropagationStopped', '_dispatchListeners', '_dispatchInstances'];
|
|
735
|
-
|
|
736
679
|
/**
|
|
737
680
|
* @interface Event
|
|
738
681
|
* @see http://www.w3.org/TR/DOM-Level-3-Events/
|
|
@@ -741,7 +684,9 @@ var EventInterface = {
|
|
|
741
684
|
type: null,
|
|
742
685
|
target: null,
|
|
743
686
|
// currentTarget is set when dispatching; no use in copying it here
|
|
744
|
-
currentTarget:
|
|
687
|
+
currentTarget: function () {
|
|
688
|
+
return null;
|
|
689
|
+
},
|
|
745
690
|
eventPhase: null,
|
|
746
691
|
bubbles: null,
|
|
747
692
|
cancelable: null,
|
|
@@ -752,6 +697,14 @@ var EventInterface = {
|
|
|
752
697
|
isTrusted: null
|
|
753
698
|
};
|
|
754
699
|
|
|
700
|
+
function functionThatReturnsTrue() {
|
|
701
|
+
return true;
|
|
702
|
+
}
|
|
703
|
+
|
|
704
|
+
function functionThatReturnsFalse() {
|
|
705
|
+
return false;
|
|
706
|
+
}
|
|
707
|
+
|
|
755
708
|
/**
|
|
756
709
|
* Synthetic events are dispatched by event plugins, typically in response to a
|
|
757
710
|
* top-level event delegation handler.
|
|
@@ -776,6 +729,8 @@ function SyntheticEvent(dispatchConfig, targetInst, nativeEvent, nativeEventTarg
|
|
|
776
729
|
delete this.nativeEvent;
|
|
777
730
|
delete this.preventDefault;
|
|
778
731
|
delete this.stopPropagation;
|
|
732
|
+
delete this.isDefaultPrevented;
|
|
733
|
+
delete this.isPropagationStopped;
|
|
779
734
|
}
|
|
780
735
|
|
|
781
736
|
this.dispatchConfig = dispatchConfig;
|
|
@@ -804,11 +759,11 @@ function SyntheticEvent(dispatchConfig, targetInst, nativeEvent, nativeEventTarg
|
|
|
804
759
|
|
|
805
760
|
var defaultPrevented = nativeEvent.defaultPrevented != null ? nativeEvent.defaultPrevented : nativeEvent.returnValue === false;
|
|
806
761
|
if (defaultPrevented) {
|
|
807
|
-
this.isDefaultPrevented =
|
|
762
|
+
this.isDefaultPrevented = functionThatReturnsTrue;
|
|
808
763
|
} else {
|
|
809
|
-
this.isDefaultPrevented =
|
|
764
|
+
this.isDefaultPrevented = functionThatReturnsFalse;
|
|
810
765
|
}
|
|
811
|
-
this.isPropagationStopped =
|
|
766
|
+
this.isPropagationStopped = functionThatReturnsFalse;
|
|
812
767
|
return this;
|
|
813
768
|
}
|
|
814
769
|
|
|
@@ -825,7 +780,7 @@ _assign(SyntheticEvent.prototype, {
|
|
|
825
780
|
} else if (typeof event.returnValue !== 'unknown') {
|
|
826
781
|
event.returnValue = false;
|
|
827
782
|
}
|
|
828
|
-
this.isDefaultPrevented =
|
|
783
|
+
this.isDefaultPrevented = functionThatReturnsTrue;
|
|
829
784
|
},
|
|
830
785
|
|
|
831
786
|
stopPropagation: function () {
|
|
@@ -845,7 +800,7 @@ _assign(SyntheticEvent.prototype, {
|
|
|
845
800
|
event.cancelBubble = true;
|
|
846
801
|
}
|
|
847
802
|
|
|
848
|
-
this.isPropagationStopped =
|
|
803
|
+
this.isPropagationStopped = functionThatReturnsTrue;
|
|
849
804
|
},
|
|
850
805
|
|
|
851
806
|
/**
|
|
@@ -854,7 +809,7 @@ _assign(SyntheticEvent.prototype, {
|
|
|
854
809
|
* won't be added back into the pool.
|
|
855
810
|
*/
|
|
856
811
|
persist: function () {
|
|
857
|
-
this.isPersistent =
|
|
812
|
+
this.isPersistent = functionThatReturnsTrue;
|
|
858
813
|
},
|
|
859
814
|
|
|
860
815
|
/**
|
|
@@ -862,7 +817,7 @@ _assign(SyntheticEvent.prototype, {
|
|
|
862
817
|
*
|
|
863
818
|
* @return {boolean} True if this should not be released, false otherwise.
|
|
864
819
|
*/
|
|
865
|
-
isPersistent:
|
|
820
|
+
isPersistent: functionThatReturnsFalse,
|
|
866
821
|
|
|
867
822
|
/**
|
|
868
823
|
* `PooledClass` looks for `destructor` on each instance it releases.
|
|
@@ -874,13 +829,19 @@ _assign(SyntheticEvent.prototype, {
|
|
|
874
829
|
Object.defineProperty(this, propName, getPooledWarningPropertyDefinition(propName, Interface[propName]));
|
|
875
830
|
}
|
|
876
831
|
}
|
|
877
|
-
|
|
878
|
-
|
|
879
|
-
|
|
832
|
+
this.dispatchConfig = null;
|
|
833
|
+
this._targetInst = null;
|
|
834
|
+
this.nativeEvent = null;
|
|
835
|
+
this.isDefaultPrevented = functionThatReturnsFalse;
|
|
836
|
+
this.isPropagationStopped = functionThatReturnsFalse;
|
|
837
|
+
this._dispatchListeners = null;
|
|
838
|
+
this._dispatchInstances = null;
|
|
880
839
|
{
|
|
881
840
|
Object.defineProperty(this, 'nativeEvent', getPooledWarningPropertyDefinition('nativeEvent', null));
|
|
882
|
-
Object.defineProperty(this, '
|
|
883
|
-
Object.defineProperty(this, '
|
|
841
|
+
Object.defineProperty(this, 'isDefaultPrevented', getPooledWarningPropertyDefinition('isDefaultPrevented', functionThatReturnsFalse));
|
|
842
|
+
Object.defineProperty(this, 'isPropagationStopped', getPooledWarningPropertyDefinition('isPropagationStopped', functionThatReturnsFalse));
|
|
843
|
+
Object.defineProperty(this, 'preventDefault', getPooledWarningPropertyDefinition('preventDefault', function () {}));
|
|
844
|
+
Object.defineProperty(this, 'stopPropagation', getPooledWarningPropertyDefinition('stopPropagation', function () {}));
|
|
884
845
|
}
|
|
885
846
|
}
|
|
886
847
|
});
|
|
@@ -911,38 +872,6 @@ SyntheticEvent.extend = function (Interface) {
|
|
|
911
872
|
return Class;
|
|
912
873
|
};
|
|
913
874
|
|
|
914
|
-
/** Proxying after everything set on SyntheticEvent
|
|
915
|
-
* to resolve Proxy issue on some WebKit browsers
|
|
916
|
-
* in which some Event properties are set to undefined (GH#10010)
|
|
917
|
-
*/
|
|
918
|
-
{
|
|
919
|
-
var isProxySupported = typeof Proxy === 'function' &&
|
|
920
|
-
// https://github.com/facebook/react/issues/12011
|
|
921
|
-
!Object.isSealed(new Proxy({}, {}));
|
|
922
|
-
|
|
923
|
-
if (isProxySupported) {
|
|
924
|
-
/*eslint-disable no-func-assign */
|
|
925
|
-
SyntheticEvent = new Proxy(SyntheticEvent, {
|
|
926
|
-
construct: function (target, args) {
|
|
927
|
-
return this.apply(target, Object.create(target.prototype), args);
|
|
928
|
-
},
|
|
929
|
-
apply: function (constructor, that, args) {
|
|
930
|
-
return new Proxy(constructor.apply(that, args), {
|
|
931
|
-
set: function (target, prop, value) {
|
|
932
|
-
if (prop !== 'isPersistent' && !target.constructor.Interface.hasOwnProperty(prop) && shouldBeReleasedProperties.indexOf(prop) === -1) {
|
|
933
|
-
warning_1(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.');
|
|
934
|
-
didWarnForAddedNewProperty = true;
|
|
935
|
-
}
|
|
936
|
-
target[prop] = value;
|
|
937
|
-
return true;
|
|
938
|
-
}
|
|
939
|
-
});
|
|
940
|
-
}
|
|
941
|
-
});
|
|
942
|
-
/*eslint-enable no-func-assign */
|
|
943
|
-
}
|
|
944
|
-
}
|
|
945
|
-
|
|
946
875
|
addEventPoolingTo(SyntheticEvent);
|
|
947
876
|
|
|
948
877
|
/**
|
|
@@ -975,7 +904,7 @@ function getPooledWarningPropertyDefinition(propName, getVal) {
|
|
|
975
904
|
|
|
976
905
|
function warn(action, result) {
|
|
977
906
|
var warningCondition = false;
|
|
978
|
-
|
|
907
|
+
!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;
|
|
979
908
|
}
|
|
980
909
|
}
|
|
981
910
|
|
|
@@ -991,7 +920,7 @@ function getPooledEvent(dispatchConfig, targetInst, nativeEvent, nativeInst) {
|
|
|
991
920
|
|
|
992
921
|
function releasePooledEvent(event) {
|
|
993
922
|
var EventConstructor = this;
|
|
994
|
-
!(event instanceof EventConstructor) ?
|
|
923
|
+
!(event instanceof EventConstructor) ? invariant(false, 'Trying to release an event instance into a pool of a different type.') : void 0;
|
|
995
924
|
event.destructor();
|
|
996
925
|
if (EventConstructor.eventPool.length < EVENT_POOL_SIZE) {
|
|
997
926
|
EventConstructor.eventPool.push(event);
|
|
@@ -1004,19 +933,46 @@ function addEventPoolingTo(EventConstructor) {
|
|
|
1004
933
|
EventConstructor.release = releasePooledEvent;
|
|
1005
934
|
}
|
|
1006
935
|
|
|
1007
|
-
var SyntheticEvent$1 = SyntheticEvent;
|
|
1008
|
-
|
|
1009
936
|
/**
|
|
1010
937
|
* `touchHistory` isn't actually on the native event, but putting it in the
|
|
1011
938
|
* interface will ensure that it is cleaned up when pooled/destroyed. The
|
|
1012
939
|
* `ResponderEventPlugin` will populate it appropriately.
|
|
1013
940
|
*/
|
|
1014
|
-
var ResponderSyntheticEvent = SyntheticEvent
|
|
941
|
+
var ResponderSyntheticEvent = SyntheticEvent.extend({
|
|
1015
942
|
touchHistory: function (nativeEvent) {
|
|
1016
943
|
return null; // Actually doesn't even look at the native event.
|
|
1017
944
|
}
|
|
1018
945
|
});
|
|
1019
946
|
|
|
947
|
+
// Note: ideally these would be imported from DOMTopLevelEventTypes,
|
|
948
|
+
// but our build system currently doesn't let us do that from a fork.
|
|
949
|
+
|
|
950
|
+
var TOP_TOUCH_START = 'touchstart';
|
|
951
|
+
var TOP_TOUCH_MOVE = 'touchmove';
|
|
952
|
+
var TOP_TOUCH_END = 'touchend';
|
|
953
|
+
var TOP_TOUCH_CANCEL = 'touchcancel';
|
|
954
|
+
var TOP_SCROLL = 'scroll';
|
|
955
|
+
var TOP_SELECTION_CHANGE = 'selectionchange';
|
|
956
|
+
var TOP_MOUSE_DOWN = 'mousedown';
|
|
957
|
+
var TOP_MOUSE_MOVE = 'mousemove';
|
|
958
|
+
var TOP_MOUSE_UP = 'mouseup';
|
|
959
|
+
|
|
960
|
+
function isStartish(topLevelType) {
|
|
961
|
+
return topLevelType === TOP_TOUCH_START || topLevelType === TOP_MOUSE_DOWN;
|
|
962
|
+
}
|
|
963
|
+
|
|
964
|
+
function isMoveish(topLevelType) {
|
|
965
|
+
return topLevelType === TOP_TOUCH_MOVE || topLevelType === TOP_MOUSE_MOVE;
|
|
966
|
+
}
|
|
967
|
+
|
|
968
|
+
function isEndish(topLevelType) {
|
|
969
|
+
return topLevelType === TOP_TOUCH_END || topLevelType === TOP_TOUCH_CANCEL || topLevelType === TOP_MOUSE_UP;
|
|
970
|
+
}
|
|
971
|
+
|
|
972
|
+
var startDependencies = [TOP_TOUCH_START, TOP_MOUSE_DOWN];
|
|
973
|
+
var moveDependencies = [TOP_TOUCH_MOVE, TOP_MOUSE_MOVE];
|
|
974
|
+
var endDependencies = [TOP_TOUCH_CANCEL, TOP_TOUCH_END, TOP_MOUSE_UP];
|
|
975
|
+
|
|
1020
976
|
/**
|
|
1021
977
|
* Tracks the position and time of each active touch by `touch.identifier`. We
|
|
1022
978
|
* should typically only see IDs in the range of 1-20 because IDs get recycled
|
|
@@ -1078,9 +1034,9 @@ function resetTouchRecord(touchRecord, touch) {
|
|
|
1078
1034
|
function getTouchIdentifier(_ref) {
|
|
1079
1035
|
var identifier = _ref.identifier;
|
|
1080
1036
|
|
|
1081
|
-
!(identifier != null) ?
|
|
1037
|
+
!(identifier != null) ? invariant(false, 'Touch object is missing identifier.') : void 0;
|
|
1082
1038
|
{
|
|
1083
|
-
|
|
1039
|
+
!(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;
|
|
1084
1040
|
}
|
|
1085
1041
|
return identifier;
|
|
1086
1042
|
}
|
|
@@ -1168,7 +1124,7 @@ var ResponderTouchHistoryStore = {
|
|
|
1168
1124
|
}
|
|
1169
1125
|
{
|
|
1170
1126
|
var activeRecord = touchBank[touchHistory.indexOfSingleActiveTouch];
|
|
1171
|
-
|
|
1127
|
+
!(activeRecord != null && activeRecord.touchActive) ? warningWithoutStack$1(false, 'Cannot find single active touch.') : void 0;
|
|
1172
1128
|
}
|
|
1173
1129
|
}
|
|
1174
1130
|
}
|
|
@@ -1186,7 +1142,7 @@ var ResponderTouchHistoryStore = {
|
|
|
1186
1142
|
* @return {*|array<*>} An accumulation of items.
|
|
1187
1143
|
*/
|
|
1188
1144
|
function accumulate(current, next) {
|
|
1189
|
-
!(next != null) ?
|
|
1145
|
+
!(next != null) ? invariant(false, 'accumulate(...): Accumulated items must be not be null or undefined.') : void 0;
|
|
1190
1146
|
|
|
1191
1147
|
if (current == null) {
|
|
1192
1148
|
return next;
|
|
@@ -1217,11 +1173,6 @@ var responderInst = null;
|
|
|
1217
1173
|
*/
|
|
1218
1174
|
var trackedTouchCount = 0;
|
|
1219
1175
|
|
|
1220
|
-
/**
|
|
1221
|
-
* Last reported number of active touches.
|
|
1222
|
-
*/
|
|
1223
|
-
var previousActiveTouches = 0;
|
|
1224
|
-
|
|
1225
1176
|
var changeResponder = function (nextResponderInst, blockHostResponder) {
|
|
1226
1177
|
var oldResponderInst = responderInst;
|
|
1227
1178
|
responderInst = nextResponderInst;
|
|
@@ -1239,7 +1190,8 @@ var eventTypes = {
|
|
|
1239
1190
|
phasedRegistrationNames: {
|
|
1240
1191
|
bubbled: 'onStartShouldSetResponder',
|
|
1241
1192
|
captured: 'onStartShouldSetResponderCapture'
|
|
1242
|
-
}
|
|
1193
|
+
},
|
|
1194
|
+
dependencies: startDependencies
|
|
1243
1195
|
},
|
|
1244
1196
|
|
|
1245
1197
|
/**
|
|
@@ -1255,7 +1207,8 @@ var eventTypes = {
|
|
|
1255
1207
|
phasedRegistrationNames: {
|
|
1256
1208
|
bubbled: 'onScrollShouldSetResponder',
|
|
1257
1209
|
captured: 'onScrollShouldSetResponderCapture'
|
|
1258
|
-
}
|
|
1210
|
+
},
|
|
1211
|
+
dependencies: [TOP_SCROLL]
|
|
1259
1212
|
},
|
|
1260
1213
|
|
|
1261
1214
|
/**
|
|
@@ -1269,7 +1222,8 @@ var eventTypes = {
|
|
|
1269
1222
|
phasedRegistrationNames: {
|
|
1270
1223
|
bubbled: 'onSelectionChangeShouldSetResponder',
|
|
1271
1224
|
captured: 'onSelectionChangeShouldSetResponderCapture'
|
|
1272
|
-
}
|
|
1225
|
+
},
|
|
1226
|
+
dependencies: [TOP_SELECTION_CHANGE]
|
|
1273
1227
|
},
|
|
1274
1228
|
|
|
1275
1229
|
/**
|
|
@@ -1280,22 +1234,45 @@ var eventTypes = {
|
|
|
1280
1234
|
phasedRegistrationNames: {
|
|
1281
1235
|
bubbled: 'onMoveShouldSetResponder',
|
|
1282
1236
|
captured: 'onMoveShouldSetResponderCapture'
|
|
1283
|
-
}
|
|
1237
|
+
},
|
|
1238
|
+
dependencies: moveDependencies
|
|
1284
1239
|
},
|
|
1285
1240
|
|
|
1286
1241
|
/**
|
|
1287
1242
|
* Direct responder events dispatched directly to responder. Do not bubble.
|
|
1288
1243
|
*/
|
|
1289
|
-
responderStart: {
|
|
1290
|
-
|
|
1291
|
-
|
|
1292
|
-
|
|
1244
|
+
responderStart: {
|
|
1245
|
+
registrationName: 'onResponderStart',
|
|
1246
|
+
dependencies: startDependencies
|
|
1247
|
+
},
|
|
1248
|
+
responderMove: {
|
|
1249
|
+
registrationName: 'onResponderMove',
|
|
1250
|
+
dependencies: moveDependencies
|
|
1251
|
+
},
|
|
1252
|
+
responderEnd: {
|
|
1253
|
+
registrationName: 'onResponderEnd',
|
|
1254
|
+
dependencies: endDependencies
|
|
1255
|
+
},
|
|
1256
|
+
responderRelease: {
|
|
1257
|
+
registrationName: 'onResponderRelease',
|
|
1258
|
+
dependencies: endDependencies
|
|
1259
|
+
},
|
|
1293
1260
|
responderTerminationRequest: {
|
|
1294
|
-
registrationName: 'onResponderTerminationRequest'
|
|
1261
|
+
registrationName: 'onResponderTerminationRequest',
|
|
1262
|
+
dependencies: []
|
|
1263
|
+
},
|
|
1264
|
+
responderGrant: {
|
|
1265
|
+
registrationName: 'onResponderGrant',
|
|
1266
|
+
dependencies: []
|
|
1295
1267
|
},
|
|
1296
|
-
|
|
1297
|
-
|
|
1298
|
-
|
|
1268
|
+
responderReject: {
|
|
1269
|
+
registrationName: 'onResponderReject',
|
|
1270
|
+
dependencies: []
|
|
1271
|
+
},
|
|
1272
|
+
responderTerminate: {
|
|
1273
|
+
registrationName: 'onResponderTerminate',
|
|
1274
|
+
dependencies: []
|
|
1275
|
+
}
|
|
1299
1276
|
};
|
|
1300
1277
|
|
|
1301
1278
|
/**
|
|
@@ -1489,7 +1466,7 @@ to return true:wantsResponderID| |
|
|
|
1489
1466
|
*/
|
|
1490
1467
|
|
|
1491
1468
|
function setResponderAndExtractTransfer(topLevelType, targetInst, nativeEvent, nativeEventTarget) {
|
|
1492
|
-
var shouldSetEventType = isStartish(topLevelType) ? eventTypes.startShouldSetResponder : isMoveish(topLevelType) ? eventTypes.moveShouldSetResponder : topLevelType ===
|
|
1469
|
+
var shouldSetEventType = isStartish(topLevelType) ? eventTypes.startShouldSetResponder : isMoveish(topLevelType) ? eventTypes.moveShouldSetResponder : topLevelType === TOP_SELECTION_CHANGE ? eventTypes.selectionChangeShouldSetResponder : eventTypes.scrollShouldSetResponder;
|
|
1493
1470
|
|
|
1494
1471
|
// TODO: stop one short of the current responder.
|
|
1495
1472
|
var bubbleShouldSetFrom = !responderInst ? targetInst : getLowestCommonAncestor(responderInst, targetInst);
|
|
@@ -1561,7 +1538,7 @@ function canTriggerTransfer(topLevelType, topLevelInst, nativeEvent) {
|
|
|
1561
1538
|
// responderIgnoreScroll: We are trying to migrate away from specifically
|
|
1562
1539
|
// tracking native scroll events here and responderIgnoreScroll indicates we
|
|
1563
1540
|
// will send topTouchCancel to handle canceling touch events instead
|
|
1564
|
-
topLevelType ===
|
|
1541
|
+
topLevelType === TOP_SCROLL && !nativeEvent.responderIgnoreScroll || trackedTouchCount > 0 && topLevelType === TOP_SELECTION_CHANGE || isStartish(topLevelType) || isMoveish(topLevelType));
|
|
1565
1542
|
}
|
|
1566
1543
|
|
|
1567
1544
|
/**
|
|
@@ -1581,7 +1558,7 @@ function noResponderTouches(nativeEvent) {
|
|
|
1581
1558
|
var target = activeTouch.target;
|
|
1582
1559
|
if (target !== null && target !== undefined && target !== 0) {
|
|
1583
1560
|
// Is the original touch location inside of the current responder?
|
|
1584
|
-
var targetInst = getInstanceFromNode(target);
|
|
1561
|
+
var targetInst = getInstanceFromNode$1(target);
|
|
1585
1562
|
if (isAncestor(responderInst, targetInst)) {
|
|
1586
1563
|
return false;
|
|
1587
1564
|
}
|
|
@@ -1640,7 +1617,7 @@ var ResponderEventPlugin = {
|
|
|
1640
1617
|
extracted = accumulate(extracted, gesture);
|
|
1641
1618
|
}
|
|
1642
1619
|
|
|
1643
|
-
var isResponderTerminate = responderInst && topLevelType ===
|
|
1620
|
+
var isResponderTerminate = responderInst && topLevelType === TOP_TOUCH_CANCEL;
|
|
1644
1621
|
var isResponderRelease = responderInst && !isResponderTerminate && isEndish(topLevelType) && noResponderTouches(nativeEvent);
|
|
1645
1622
|
var finalTouch = isResponderTerminate ? eventTypes.responderTerminate : isResponderRelease ? eventTypes.responderRelease : null;
|
|
1646
1623
|
if (finalTouch) {
|
|
@@ -1651,17 +1628,10 @@ var ResponderEventPlugin = {
|
|
|
1651
1628
|
changeResponder(null);
|
|
1652
1629
|
}
|
|
1653
1630
|
|
|
1654
|
-
var numberActiveTouches = ResponderTouchHistoryStore.touchHistory.numberActiveTouches;
|
|
1655
|
-
if (ResponderEventPlugin.GlobalInteractionHandler && numberActiveTouches !== previousActiveTouches) {
|
|
1656
|
-
ResponderEventPlugin.GlobalInteractionHandler.onChange(numberActiveTouches);
|
|
1657
|
-
}
|
|
1658
|
-
previousActiveTouches = numberActiveTouches;
|
|
1659
|
-
|
|
1660
1631
|
return extracted;
|
|
1661
1632
|
},
|
|
1662
1633
|
|
|
1663
1634
|
GlobalResponderHandler: null,
|
|
1664
|
-
GlobalInteractionHandler: null,
|
|
1665
1635
|
|
|
1666
1636
|
injection: {
|
|
1667
1637
|
/**
|
|
@@ -1671,24 +1641,23 @@ var ResponderEventPlugin = {
|
|
|
1671
1641
|
*/
|
|
1672
1642
|
injectGlobalResponderHandler: function (GlobalResponderHandler) {
|
|
1673
1643
|
ResponderEventPlugin.GlobalResponderHandler = GlobalResponderHandler;
|
|
1674
|
-
},
|
|
1675
|
-
|
|
1676
|
-
/**
|
|
1677
|
-
* @param {{onChange: (numberActiveTouches) => void} GlobalInteractionHandler
|
|
1678
|
-
* Object that handles any change in the number of active touches.
|
|
1679
|
-
*/
|
|
1680
|
-
injectGlobalInteractionHandler: function (GlobalInteractionHandler) {
|
|
1681
|
-
ResponderEventPlugin.GlobalInteractionHandler = GlobalInteractionHandler;
|
|
1682
1644
|
}
|
|
1683
1645
|
}
|
|
1684
1646
|
};
|
|
1685
1647
|
|
|
1686
1648
|
// This is used by react-native-web.
|
|
1687
|
-
|
|
1649
|
+
function injectComponentTree(ComponentTree) {
|
|
1650
|
+
setComponentTree(ComponentTree.getFiberCurrentPropsFromNode, ComponentTree.getInstanceFromNode, ComponentTree.getNodeFromInstance);
|
|
1651
|
+
}
|
|
1652
|
+
|
|
1688
1653
|
// Inject react-dom's ComponentTree into this module.
|
|
1689
|
-
|
|
1654
|
+
// Keep in sync with ReactDOM.js and ReactTestUtils.js:
|
|
1655
|
+
var _ReactDOM$__SECRET_IN = ReactDOM.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.Events;
|
|
1656
|
+
var getInstanceFromNode = _ReactDOM$__SECRET_IN[0];
|
|
1657
|
+
var getNodeFromInstance = _ReactDOM$__SECRET_IN[1];
|
|
1658
|
+
var getFiberCurrentPropsFromNode = _ReactDOM$__SECRET_IN[2];
|
|
1690
1659
|
|
|
1691
|
-
|
|
1660
|
+
setComponentTree(getFiberCurrentPropsFromNode, getInstanceFromNode, getNodeFromInstance);
|
|
1692
1661
|
|
|
1693
1662
|
var ReactDOMUnstableNativeDependencies = Object.freeze({
|
|
1694
1663
|
injectComponentTree: injectComponentTree,
|