react-dom 16.4.2 → 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 +474 -181
- package/cjs/react-dom-server.browser.production.min.js +33 -31
- package/cjs/react-dom-server.node.development.js +474 -181
- package/cjs/react-dom-server.node.production.min.js +36 -34
- package/cjs/react-dom-test-utils.development.js +260 -102
- package/cjs/react-dom-test-utils.production.min.js +23 -23
- package/cjs/react-dom-unstable-native-dependencies.development.js +180 -82
- package/cjs/react-dom-unstable-native-dependencies.production.min.js +28 -27
- package/cjs/react-dom.development.js +3431 -2774
- package/cjs/react-dom.production.min.js +224 -228
- package/cjs/react-dom.profiling.min.js +233 -230
- package/package.json +4 -3
- package/profiling.js +38 -0
- package/umd/react-dom-server.browser.development.js +449 -447
- package/umd/react-dom-server.browser.production.min.js +29 -30
- package/umd/react-dom-test-utils.development.js +201 -225
- package/umd/react-dom-test-utils.production.min.js +21 -21
- package/umd/react-dom-unstable-native-dependencies.development.js +112 -163
- package/umd/react-dom-unstable-native-dependencies.production.min.js +23 -23
- package/umd/react-dom.development.js +3419 -3217
- package/umd/react-dom.production.min.js +184 -188
|
@@ -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,16 +15,6 @@
|
|
|
15
15
|
(global.ReactDOMUnstableNativeDependencies = factory(global.ReactDOM,global.React));
|
|
16
16
|
}(this, (function (ReactDOM,React) { 'use strict';
|
|
17
17
|
|
|
18
|
-
/**
|
|
19
|
-
* Copyright (c) 2013-present, Facebook, Inc.
|
|
20
|
-
*
|
|
21
|
-
* This source code is licensed under the MIT license found in the
|
|
22
|
-
* LICENSE file in the root directory of this source tree.
|
|
23
|
-
*
|
|
24
|
-
*/
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
18
|
/**
|
|
29
19
|
* Use invariant() to assert state which your program assumes to be true.
|
|
30
20
|
*
|
|
@@ -36,10 +26,10 @@
|
|
|
36
26
|
* will remain to ensure logic does not differ in production.
|
|
37
27
|
*/
|
|
38
28
|
|
|
39
|
-
var validateFormat = function
|
|
29
|
+
var validateFormat = function () {};
|
|
40
30
|
|
|
41
31
|
{
|
|
42
|
-
validateFormat = function
|
|
32
|
+
validateFormat = function (format) {
|
|
43
33
|
if (format === undefined) {
|
|
44
34
|
throw new Error('invariant requires an error message argument');
|
|
45
35
|
}
|
|
@@ -50,7 +40,7 @@ function invariant(condition, format, a, b, c, d, e, f) {
|
|
|
50
40
|
validateFormat(format);
|
|
51
41
|
|
|
52
42
|
if (!condition) {
|
|
53
|
-
var error;
|
|
43
|
+
var error = void 0;
|
|
54
44
|
if (format === undefined) {
|
|
55
45
|
error = new Error('Minified exception occurred; use the non-minified dev environment ' + 'for the full error message and additional helpful warnings.');
|
|
56
46
|
} else {
|
|
@@ -67,10 +57,8 @@ function invariant(condition, format, a, b, c, d, e, f) {
|
|
|
67
57
|
}
|
|
68
58
|
}
|
|
69
59
|
|
|
70
|
-
var invariant_1 = invariant;
|
|
71
|
-
|
|
72
60
|
// Relying on the `invariant()` implementation lets us
|
|
73
|
-
//
|
|
61
|
+
// preserve the format and params in the www builds.
|
|
74
62
|
|
|
75
63
|
{
|
|
76
64
|
// In DEV mode, we swap out invokeGuardedCallback for a special version
|
|
@@ -102,52 +90,37 @@ var invariant_1 = invariant;
|
|
|
102
90
|
}
|
|
103
91
|
|
|
104
92
|
/**
|
|
105
|
-
*
|
|
93
|
+
* Call a function while guarding against errors that happens within it.
|
|
94
|
+
* Returns an error if it throws, otherwise null.
|
|
106
95
|
*
|
|
107
|
-
*
|
|
108
|
-
*
|
|
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.
|
|
109
99
|
*
|
|
110
|
-
*
|
|
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
|
|
111
104
|
*/
|
|
112
105
|
|
|
113
|
-
function makeEmptyFunction(arg) {
|
|
114
|
-
return function () {
|
|
115
|
-
return arg;
|
|
116
|
-
};
|
|
117
|
-
}
|
|
118
106
|
|
|
119
107
|
/**
|
|
120
|
-
*
|
|
121
|
-
*
|
|
122
|
-
*
|
|
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
|
|
123
116
|
*/
|
|
124
|
-
var emptyFunction = function emptyFunction() {};
|
|
125
117
|
|
|
126
|
-
emptyFunction.thatReturns = makeEmptyFunction;
|
|
127
|
-
emptyFunction.thatReturnsFalse = makeEmptyFunction(false);
|
|
128
|
-
emptyFunction.thatReturnsTrue = makeEmptyFunction(true);
|
|
129
|
-
emptyFunction.thatReturnsNull = makeEmptyFunction(null);
|
|
130
|
-
emptyFunction.thatReturnsThis = function () {
|
|
131
|
-
return this;
|
|
132
|
-
};
|
|
133
|
-
emptyFunction.thatReturnsArgument = function (arg) {
|
|
134
|
-
return arg;
|
|
135
|
-
};
|
|
136
|
-
|
|
137
|
-
var emptyFunction_1 = emptyFunction;
|
|
138
118
|
|
|
139
119
|
/**
|
|
140
|
-
*
|
|
141
|
-
*
|
|
142
|
-
* This source code is licensed under the MIT license found in the
|
|
143
|
-
* LICENSE file in the root directory of this source tree.
|
|
144
|
-
*
|
|
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.
|
|
145
122
|
*/
|
|
146
123
|
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
124
|
/**
|
|
152
125
|
* Similar to invariant but only logs a warning if the condition is not met.
|
|
153
126
|
* This can be used to log issues in development environments in critical
|
|
@@ -155,65 +128,55 @@ var emptyFunction_1 = emptyFunction;
|
|
|
155
128
|
* same logic and follow the same code paths.
|
|
156
129
|
*/
|
|
157
130
|
|
|
158
|
-
var
|
|
131
|
+
var warningWithoutStack = function () {};
|
|
159
132
|
|
|
160
133
|
{
|
|
161
|
-
|
|
162
|
-
for (var _len = arguments.length, args = Array(_len >
|
|
163
|
-
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];
|
|
164
137
|
}
|
|
165
138
|
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
139
|
+
if (format === undefined) {
|
|
140
|
+
throw new Error('`warningWithoutStack(condition, format, ...args)` requires a warning ' + 'message argument');
|
|
141
|
+
}
|
|
142
|
+
if (condition) {
|
|
143
|
+
return;
|
|
144
|
+
}
|
|
170
145
|
if (typeof console !== 'undefined') {
|
|
171
|
-
|
|
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));
|
|
172
152
|
}
|
|
173
153
|
try {
|
|
174
154
|
// --- Welcome to debugging React ---
|
|
175
155
|
// This error was thrown as a convenience so that you can use this stack
|
|
176
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
|
+
});
|
|
177
161
|
throw new Error(message);
|
|
178
162
|
} catch (x) {}
|
|
179
163
|
};
|
|
180
|
-
|
|
181
|
-
warning = function warning(condition, format) {
|
|
182
|
-
if (format === undefined) {
|
|
183
|
-
throw new Error('`warning(condition, format, ...args)` requires a warning ' + 'message argument');
|
|
184
|
-
}
|
|
185
|
-
|
|
186
|
-
if (format.indexOf('Failed Composite propType: ') === 0) {
|
|
187
|
-
return; // Ignore CompositeComponent proptype check.
|
|
188
|
-
}
|
|
189
|
-
|
|
190
|
-
if (!condition) {
|
|
191
|
-
for (var _len2 = arguments.length, args = Array(_len2 > 2 ? _len2 - 2 : 0), _key2 = 2; _key2 < _len2; _key2++) {
|
|
192
|
-
args[_key2 - 2] = arguments[_key2];
|
|
193
|
-
}
|
|
194
|
-
|
|
195
|
-
printWarning.apply(undefined, [format].concat(args));
|
|
196
|
-
}
|
|
197
|
-
};
|
|
198
164
|
}
|
|
199
165
|
|
|
200
|
-
var
|
|
201
|
-
|
|
202
|
-
var getFiberCurrentPropsFromNode = null;
|
|
203
|
-
var getInstanceFromNode = null;
|
|
204
|
-
var getNodeFromInstance = null;
|
|
166
|
+
var warningWithoutStack$1 = warningWithoutStack;
|
|
205
167
|
|
|
206
|
-
var
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
getInstanceFromNode = Injected.getInstanceFromNode;
|
|
210
|
-
getNodeFromInstance = Injected.getNodeFromInstance;
|
|
168
|
+
var getFiberCurrentPropsFromNode$1 = null;
|
|
169
|
+
var getInstanceFromNode$1 = null;
|
|
170
|
+
var getNodeFromInstance$1 = null;
|
|
211
171
|
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
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;
|
|
215
178
|
}
|
|
216
|
-
}
|
|
179
|
+
}
|
|
217
180
|
|
|
218
181
|
var validateEventDispatches = void 0;
|
|
219
182
|
{
|
|
@@ -227,7 +190,7 @@ var validateEventDispatches = void 0;
|
|
|
227
190
|
var instancesIsArr = Array.isArray(dispatchInstances);
|
|
228
191
|
var instancesLen = instancesIsArr ? dispatchInstances.length : dispatchInstances ? 1 : 0;
|
|
229
192
|
|
|
230
|
-
!(instancesIsArr === listenersIsArr && instancesLen === listenersLen) ?
|
|
193
|
+
!(instancesIsArr === listenersIsArr && instancesLen === listenersLen) ? warningWithoutStack$1(false, 'EventPluginUtils: Invalid `event`.') : void 0;
|
|
231
194
|
};
|
|
232
195
|
}
|
|
233
196
|
|
|
@@ -292,8 +255,8 @@ function executeDirectDispatch(event) {
|
|
|
292
255
|
}
|
|
293
256
|
var dispatchListener = event._dispatchListeners;
|
|
294
257
|
var dispatchInstance = event._dispatchInstances;
|
|
295
|
-
!!Array.isArray(dispatchListener) ?
|
|
296
|
-
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;
|
|
297
260
|
var res = dispatchListener ? dispatchListener(event) : null;
|
|
298
261
|
event.currentTarget = null;
|
|
299
262
|
event._dispatchListeners = null;
|
|
@@ -310,11 +273,9 @@ function hasDispatches(event) {
|
|
|
310
273
|
}
|
|
311
274
|
|
|
312
275
|
// Before we know whether it is functional or class
|
|
313
|
-
|
|
314
|
-
|
|
315
276
|
// Root of a host tree. Could be nested inside another node.
|
|
316
277
|
// A subtree. Could be an entry point to a different renderer.
|
|
317
|
-
var HostComponent =
|
|
278
|
+
var HostComponent = 7;
|
|
318
279
|
|
|
319
280
|
function getParent(inst) {
|
|
320
281
|
do {
|
|
@@ -486,7 +447,7 @@ function traverseTwoPhase(inst, fn, arg) {
|
|
|
486
447
|
*/
|
|
487
448
|
|
|
488
449
|
function accumulateInto(current, next) {
|
|
489
|
-
!(next != null) ?
|
|
450
|
+
!(next != null) ? invariant(false, 'accumulateInto(...): Accumulated items must not be null or undefined.') : void 0;
|
|
490
451
|
|
|
491
452
|
if (current == null) {
|
|
492
453
|
return next;
|
|
@@ -593,7 +554,7 @@ function getListener(inst, registrationName) {
|
|
|
593
554
|
// Work in progress (ex: onload events in incremental mode).
|
|
594
555
|
return null;
|
|
595
556
|
}
|
|
596
|
-
var props = getFiberCurrentPropsFromNode(stateNode);
|
|
557
|
+
var props = getFiberCurrentPropsFromNode$1(stateNode);
|
|
597
558
|
if (!props) {
|
|
598
559
|
// Work in progress.
|
|
599
560
|
return null;
|
|
@@ -602,7 +563,7 @@ function getListener(inst, registrationName) {
|
|
|
602
563
|
if (shouldPreventMouseEvent(registrationName, inst.type, props)) {
|
|
603
564
|
return null;
|
|
604
565
|
}
|
|
605
|
-
!(!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;
|
|
606
567
|
return listener;
|
|
607
568
|
}
|
|
608
569
|
|
|
@@ -633,7 +594,7 @@ function listenerAtPhase(inst, event, propagationPhase) {
|
|
|
633
594
|
*/
|
|
634
595
|
function accumulateDirectionalDispatches(inst, phase, event) {
|
|
635
596
|
{
|
|
636
|
-
!inst ?
|
|
597
|
+
!inst ? warningWithoutStack$1(false, 'Dispatching inst must not be null') : void 0;
|
|
637
598
|
}
|
|
638
599
|
var listener = listenerAtPhase(inst, event, phase);
|
|
639
600
|
if (listener) {
|
|
@@ -713,11 +674,8 @@ var _assign = ReactInternals.assign;
|
|
|
713
674
|
|
|
714
675
|
/* eslint valid-typeof: 0 */
|
|
715
676
|
|
|
716
|
-
var didWarnForAddedNewProperty = false;
|
|
717
677
|
var EVENT_POOL_SIZE = 10;
|
|
718
678
|
|
|
719
|
-
var shouldBeReleasedProperties = ['dispatchConfig', '_targetInst', 'nativeEvent', 'isDefaultPrevented', 'isPropagationStopped', '_dispatchListeners', '_dispatchInstances'];
|
|
720
|
-
|
|
721
679
|
/**
|
|
722
680
|
* @interface Event
|
|
723
681
|
* @see http://www.w3.org/TR/DOM-Level-3-Events/
|
|
@@ -726,7 +684,9 @@ var EventInterface = {
|
|
|
726
684
|
type: null,
|
|
727
685
|
target: null,
|
|
728
686
|
// currentTarget is set when dispatching; no use in copying it here
|
|
729
|
-
currentTarget:
|
|
687
|
+
currentTarget: function () {
|
|
688
|
+
return null;
|
|
689
|
+
},
|
|
730
690
|
eventPhase: null,
|
|
731
691
|
bubbles: null,
|
|
732
692
|
cancelable: null,
|
|
@@ -737,6 +697,14 @@ var EventInterface = {
|
|
|
737
697
|
isTrusted: null
|
|
738
698
|
};
|
|
739
699
|
|
|
700
|
+
function functionThatReturnsTrue() {
|
|
701
|
+
return true;
|
|
702
|
+
}
|
|
703
|
+
|
|
704
|
+
function functionThatReturnsFalse() {
|
|
705
|
+
return false;
|
|
706
|
+
}
|
|
707
|
+
|
|
740
708
|
/**
|
|
741
709
|
* Synthetic events are dispatched by event plugins, typically in response to a
|
|
742
710
|
* top-level event delegation handler.
|
|
@@ -761,6 +729,8 @@ function SyntheticEvent(dispatchConfig, targetInst, nativeEvent, nativeEventTarg
|
|
|
761
729
|
delete this.nativeEvent;
|
|
762
730
|
delete this.preventDefault;
|
|
763
731
|
delete this.stopPropagation;
|
|
732
|
+
delete this.isDefaultPrevented;
|
|
733
|
+
delete this.isPropagationStopped;
|
|
764
734
|
}
|
|
765
735
|
|
|
766
736
|
this.dispatchConfig = dispatchConfig;
|
|
@@ -789,11 +759,11 @@ function SyntheticEvent(dispatchConfig, targetInst, nativeEvent, nativeEventTarg
|
|
|
789
759
|
|
|
790
760
|
var defaultPrevented = nativeEvent.defaultPrevented != null ? nativeEvent.defaultPrevented : nativeEvent.returnValue === false;
|
|
791
761
|
if (defaultPrevented) {
|
|
792
|
-
this.isDefaultPrevented =
|
|
762
|
+
this.isDefaultPrevented = functionThatReturnsTrue;
|
|
793
763
|
} else {
|
|
794
|
-
this.isDefaultPrevented =
|
|
764
|
+
this.isDefaultPrevented = functionThatReturnsFalse;
|
|
795
765
|
}
|
|
796
|
-
this.isPropagationStopped =
|
|
766
|
+
this.isPropagationStopped = functionThatReturnsFalse;
|
|
797
767
|
return this;
|
|
798
768
|
}
|
|
799
769
|
|
|
@@ -810,7 +780,7 @@ _assign(SyntheticEvent.prototype, {
|
|
|
810
780
|
} else if (typeof event.returnValue !== 'unknown') {
|
|
811
781
|
event.returnValue = false;
|
|
812
782
|
}
|
|
813
|
-
this.isDefaultPrevented =
|
|
783
|
+
this.isDefaultPrevented = functionThatReturnsTrue;
|
|
814
784
|
},
|
|
815
785
|
|
|
816
786
|
stopPropagation: function () {
|
|
@@ -830,7 +800,7 @@ _assign(SyntheticEvent.prototype, {
|
|
|
830
800
|
event.cancelBubble = true;
|
|
831
801
|
}
|
|
832
802
|
|
|
833
|
-
this.isPropagationStopped =
|
|
803
|
+
this.isPropagationStopped = functionThatReturnsTrue;
|
|
834
804
|
},
|
|
835
805
|
|
|
836
806
|
/**
|
|
@@ -839,7 +809,7 @@ _assign(SyntheticEvent.prototype, {
|
|
|
839
809
|
* won't be added back into the pool.
|
|
840
810
|
*/
|
|
841
811
|
persist: function () {
|
|
842
|
-
this.isPersistent =
|
|
812
|
+
this.isPersistent = functionThatReturnsTrue;
|
|
843
813
|
},
|
|
844
814
|
|
|
845
815
|
/**
|
|
@@ -847,7 +817,7 @@ _assign(SyntheticEvent.prototype, {
|
|
|
847
817
|
*
|
|
848
818
|
* @return {boolean} True if this should not be released, false otherwise.
|
|
849
819
|
*/
|
|
850
|
-
isPersistent:
|
|
820
|
+
isPersistent: functionThatReturnsFalse,
|
|
851
821
|
|
|
852
822
|
/**
|
|
853
823
|
* `PooledClass` looks for `destructor` on each instance it releases.
|
|
@@ -859,13 +829,19 @@ _assign(SyntheticEvent.prototype, {
|
|
|
859
829
|
Object.defineProperty(this, propName, getPooledWarningPropertyDefinition(propName, Interface[propName]));
|
|
860
830
|
}
|
|
861
831
|
}
|
|
862
|
-
|
|
863
|
-
|
|
864
|
-
|
|
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;
|
|
865
839
|
{
|
|
866
840
|
Object.defineProperty(this, 'nativeEvent', getPooledWarningPropertyDefinition('nativeEvent', null));
|
|
867
|
-
Object.defineProperty(this, '
|
|
868
|
-
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 () {}));
|
|
869
845
|
}
|
|
870
846
|
}
|
|
871
847
|
});
|
|
@@ -896,38 +872,6 @@ SyntheticEvent.extend = function (Interface) {
|
|
|
896
872
|
return Class;
|
|
897
873
|
};
|
|
898
874
|
|
|
899
|
-
/** Proxying after everything set on SyntheticEvent
|
|
900
|
-
* to resolve Proxy issue on some WebKit browsers
|
|
901
|
-
* in which some Event properties are set to undefined (GH#10010)
|
|
902
|
-
*/
|
|
903
|
-
{
|
|
904
|
-
var isProxySupported = typeof Proxy === 'function' &&
|
|
905
|
-
// https://github.com/facebook/react/issues/12011
|
|
906
|
-
!Object.isSealed(new Proxy({}, {}));
|
|
907
|
-
|
|
908
|
-
if (isProxySupported) {
|
|
909
|
-
/*eslint-disable no-func-assign */
|
|
910
|
-
SyntheticEvent = new Proxy(SyntheticEvent, {
|
|
911
|
-
construct: function (target, args) {
|
|
912
|
-
return this.apply(target, Object.create(target.prototype), args);
|
|
913
|
-
},
|
|
914
|
-
apply: function (constructor, that, args) {
|
|
915
|
-
return new Proxy(constructor.apply(that, args), {
|
|
916
|
-
set: function (target, prop, value) {
|
|
917
|
-
if (prop !== 'isPersistent' && !target.constructor.Interface.hasOwnProperty(prop) && shouldBeReleasedProperties.indexOf(prop) === -1) {
|
|
918
|
-
!(didWarnForAddedNewProperty || target.isPersistent()) ? warning_1(false, "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.') : void 0;
|
|
919
|
-
didWarnForAddedNewProperty = true;
|
|
920
|
-
}
|
|
921
|
-
target[prop] = value;
|
|
922
|
-
return true;
|
|
923
|
-
}
|
|
924
|
-
});
|
|
925
|
-
}
|
|
926
|
-
});
|
|
927
|
-
/*eslint-enable no-func-assign */
|
|
928
|
-
}
|
|
929
|
-
}
|
|
930
|
-
|
|
931
875
|
addEventPoolingTo(SyntheticEvent);
|
|
932
876
|
|
|
933
877
|
/**
|
|
@@ -960,7 +904,7 @@ function getPooledWarningPropertyDefinition(propName, getVal) {
|
|
|
960
904
|
|
|
961
905
|
function warn(action, result) {
|
|
962
906
|
var warningCondition = false;
|
|
963
|
-
!warningCondition ?
|
|
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;
|
|
964
908
|
}
|
|
965
909
|
}
|
|
966
910
|
|
|
@@ -976,7 +920,7 @@ function getPooledEvent(dispatchConfig, targetInst, nativeEvent, nativeInst) {
|
|
|
976
920
|
|
|
977
921
|
function releasePooledEvent(event) {
|
|
978
922
|
var EventConstructor = this;
|
|
979
|
-
!(event instanceof EventConstructor) ?
|
|
923
|
+
!(event instanceof EventConstructor) ? invariant(false, 'Trying to release an event instance into a pool of a different type.') : void 0;
|
|
980
924
|
event.destructor();
|
|
981
925
|
if (EventConstructor.eventPool.length < EVENT_POOL_SIZE) {
|
|
982
926
|
EventConstructor.eventPool.push(event);
|
|
@@ -989,14 +933,12 @@ function addEventPoolingTo(EventConstructor) {
|
|
|
989
933
|
EventConstructor.release = releasePooledEvent;
|
|
990
934
|
}
|
|
991
935
|
|
|
992
|
-
var SyntheticEvent$1 = SyntheticEvent;
|
|
993
|
-
|
|
994
936
|
/**
|
|
995
937
|
* `touchHistory` isn't actually on the native event, but putting it in the
|
|
996
938
|
* interface will ensure that it is cleaned up when pooled/destroyed. The
|
|
997
939
|
* `ResponderEventPlugin` will populate it appropriately.
|
|
998
940
|
*/
|
|
999
|
-
var ResponderSyntheticEvent = SyntheticEvent
|
|
941
|
+
var ResponderSyntheticEvent = SyntheticEvent.extend({
|
|
1000
942
|
touchHistory: function (nativeEvent) {
|
|
1001
943
|
return null; // Actually doesn't even look at the native event.
|
|
1002
944
|
}
|
|
@@ -1092,9 +1034,9 @@ function resetTouchRecord(touchRecord, touch) {
|
|
|
1092
1034
|
function getTouchIdentifier(_ref) {
|
|
1093
1035
|
var identifier = _ref.identifier;
|
|
1094
1036
|
|
|
1095
|
-
!(identifier != null) ?
|
|
1037
|
+
!(identifier != null) ? invariant(false, 'Touch object is missing identifier.') : void 0;
|
|
1096
1038
|
{
|
|
1097
|
-
!(identifier <= MAX_TOUCH_BANK) ?
|
|
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;
|
|
1098
1040
|
}
|
|
1099
1041
|
return identifier;
|
|
1100
1042
|
}
|
|
@@ -1182,7 +1124,7 @@ var ResponderTouchHistoryStore = {
|
|
|
1182
1124
|
}
|
|
1183
1125
|
{
|
|
1184
1126
|
var activeRecord = touchBank[touchHistory.indexOfSingleActiveTouch];
|
|
1185
|
-
!(activeRecord != null && activeRecord.touchActive) ?
|
|
1127
|
+
!(activeRecord != null && activeRecord.touchActive) ? warningWithoutStack$1(false, 'Cannot find single active touch.') : void 0;
|
|
1186
1128
|
}
|
|
1187
1129
|
}
|
|
1188
1130
|
}
|
|
@@ -1200,7 +1142,7 @@ var ResponderTouchHistoryStore = {
|
|
|
1200
1142
|
* @return {*|array<*>} An accumulation of items.
|
|
1201
1143
|
*/
|
|
1202
1144
|
function accumulate(current, next) {
|
|
1203
|
-
!(next != null) ?
|
|
1145
|
+
!(next != null) ? invariant(false, 'accumulate(...): Accumulated items must be not be null or undefined.') : void 0;
|
|
1204
1146
|
|
|
1205
1147
|
if (current == null) {
|
|
1206
1148
|
return next;
|
|
@@ -1616,7 +1558,7 @@ function noResponderTouches(nativeEvent) {
|
|
|
1616
1558
|
var target = activeTouch.target;
|
|
1617
1559
|
if (target !== null && target !== undefined && target !== 0) {
|
|
1618
1560
|
// Is the original touch location inside of the current responder?
|
|
1619
|
-
var targetInst = getInstanceFromNode(target);
|
|
1561
|
+
var targetInst = getInstanceFromNode$1(target);
|
|
1620
1562
|
if (isAncestor(responderInst, targetInst)) {
|
|
1621
1563
|
return false;
|
|
1622
1564
|
}
|
|
@@ -1704,11 +1646,18 @@ var ResponderEventPlugin = {
|
|
|
1704
1646
|
};
|
|
1705
1647
|
|
|
1706
1648
|
// This is used by react-native-web.
|
|
1707
|
-
|
|
1649
|
+
function injectComponentTree(ComponentTree) {
|
|
1650
|
+
setComponentTree(ComponentTree.getFiberCurrentPropsFromNode, ComponentTree.getInstanceFromNode, ComponentTree.getNodeFromInstance);
|
|
1651
|
+
}
|
|
1652
|
+
|
|
1708
1653
|
// Inject react-dom's ComponentTree into this module.
|
|
1709
|
-
|
|
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];
|
|
1710
1659
|
|
|
1711
|
-
|
|
1660
|
+
setComponentTree(getFiberCurrentPropsFromNode, getInstanceFromNode, getNodeFromInstance);
|
|
1712
1661
|
|
|
1713
1662
|
var ReactDOMUnstableNativeDependencies = Object.freeze({
|
|
1714
1663
|
injectComponentTree: injectComponentTree,
|