react-dom 16.10.2 → 16.13.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 +411 -729
- package/cjs/react-dom-server.browser.production.min.js +41 -41
- package/cjs/react-dom-server.node.development.js +406 -720
- package/cjs/react-dom-server.node.production.min.js +40 -40
- package/cjs/react-dom-test-utils.development.js +200 -393
- package/cjs/react-dom-test-utils.production.min.js +22 -22
- package/cjs/react-dom-unstable-fizz.browser.development.js +11 -25
- package/cjs/react-dom-unstable-fizz.browser.production.min.js +3 -3
- package/cjs/react-dom-unstable-fizz.node.development.js +24 -27
- package/cjs/react-dom-unstable-fizz.node.production.min.js +4 -3
- package/cjs/react-dom-unstable-native-dependencies.development.js +203 -338
- package/cjs/react-dom-unstable-native-dependencies.production.min.js +23 -27
- package/cjs/react-dom.development.js +10451 -13365
- package/cjs/react-dom.production.min.js +280 -281
- package/cjs/react-dom.profiling.min.js +285 -285
- package/package.json +3 -3
- package/umd/react-dom-server.browser.development.js +3310 -3639
- package/umd/react-dom-server.browser.production.min.js +38 -38
- package/umd/react-dom-test-utils.development.js +1181 -1374
- package/umd/react-dom-test-utils.production.min.js +23 -23
- package/umd/react-dom-unstable-fizz.browser.development.js +105 -119
- package/umd/react-dom-unstable-fizz.browser.production.min.js +3 -3
- package/umd/react-dom-unstable-native-dependencies.development.js +1326 -1462
- package/umd/react-dom-unstable-native-dependencies.production.min.js +21 -22
- package/umd/react-dom.development.js +19905 -22830
- package/umd/react-dom.production.min.js +229 -234
- package/umd/react-dom.profiling.min.js +237 -241
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/** @license React v16.
|
|
1
|
+
/** @license React v16.13.1
|
|
2
2
|
* react-dom-unstable-native-dependencies.development.js
|
|
3
3
|
*
|
|
4
4
|
* Copyright (c) Facebook, Inc. and its affiliates.
|
|
@@ -16,30 +16,87 @@ if (process.env.NODE_ENV !== "production") {
|
|
|
16
16
|
'use strict';
|
|
17
17
|
|
|
18
18
|
var ReactDOM = require('react-dom');
|
|
19
|
+
var React = require('react');
|
|
19
20
|
var _assign = require('object-assign');
|
|
20
21
|
|
|
21
|
-
//
|
|
22
|
-
//
|
|
23
|
-
//
|
|
22
|
+
var ReactSharedInternals = React.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED; // Prevent newer renderers from RTE when used with older react package versions.
|
|
23
|
+
// Current owner and dispatcher used to share the same ref,
|
|
24
|
+
// but PR #14548 split them out to better support the react-debug-tools package.
|
|
24
25
|
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
error.name = 'Invariant Violation';
|
|
30
|
-
return error;
|
|
26
|
+
if (!ReactSharedInternals.hasOwnProperty('ReactCurrentDispatcher')) {
|
|
27
|
+
ReactSharedInternals.ReactCurrentDispatcher = {
|
|
28
|
+
current: null
|
|
29
|
+
};
|
|
31
30
|
}
|
|
32
31
|
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
32
|
+
if (!ReactSharedInternals.hasOwnProperty('ReactCurrentBatchConfig')) {
|
|
33
|
+
ReactSharedInternals.ReactCurrentBatchConfig = {
|
|
34
|
+
suspense: null
|
|
35
|
+
};
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
// by calls to these methods by a Babel plugin.
|
|
39
|
+
//
|
|
40
|
+
// In PROD (or in packages without access to React internals),
|
|
41
|
+
// they are left as they are instead.
|
|
42
|
+
|
|
43
|
+
function warn(format) {
|
|
44
|
+
{
|
|
45
|
+
for (var _len = arguments.length, args = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {
|
|
46
|
+
args[_key - 1] = arguments[_key];
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
printWarning('warn', format, args);
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
function error(format) {
|
|
53
|
+
{
|
|
54
|
+
for (var _len2 = arguments.length, args = new Array(_len2 > 1 ? _len2 - 1 : 0), _key2 = 1; _key2 < _len2; _key2++) {
|
|
55
|
+
args[_key2 - 1] = arguments[_key2];
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
printWarning('error', format, args);
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
function printWarning(level, format, args) {
|
|
63
|
+
// When changing this logic, you might want to also
|
|
64
|
+
// update consoleWithStackDev.www.js as well.
|
|
65
|
+
{
|
|
66
|
+
var hasExistingStack = args.length > 0 && typeof args[args.length - 1] === 'string' && args[args.length - 1].indexOf('\n in') === 0;
|
|
67
|
+
|
|
68
|
+
if (!hasExistingStack) {
|
|
69
|
+
var ReactDebugCurrentFrame = ReactSharedInternals.ReactDebugCurrentFrame;
|
|
70
|
+
var stack = ReactDebugCurrentFrame.getStackAddendum();
|
|
71
|
+
|
|
72
|
+
if (stack !== '') {
|
|
73
|
+
format += '%s';
|
|
74
|
+
args = args.concat([stack]);
|
|
75
|
+
}
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
var argsWithFormat = args.map(function (item) {
|
|
79
|
+
return '' + item;
|
|
80
|
+
}); // Careful: RN currently depends on this prefix
|
|
81
|
+
|
|
82
|
+
argsWithFormat.unshift('Warning: ' + format); // We intentionally don't use spread (or .apply) directly because it
|
|
83
|
+
// breaks IE9: https://github.com/facebook/react/issues/13610
|
|
84
|
+
// eslint-disable-next-line react-internal/no-production-logging
|
|
85
|
+
|
|
86
|
+
Function.prototype.apply.call(console[level], console, argsWithFormat);
|
|
87
|
+
|
|
88
|
+
try {
|
|
89
|
+
// --- Welcome to debugging React ---
|
|
90
|
+
// This error was thrown as a convenience so that you can use this stack
|
|
91
|
+
// to find the callsite that caused this warning to fire.
|
|
92
|
+
var argIndex = 0;
|
|
93
|
+
var message = 'Warning: ' + format.replace(/%s/g, function () {
|
|
94
|
+
return args[argIndex++];
|
|
95
|
+
});
|
|
96
|
+
throw new Error(message);
|
|
97
|
+
} catch (x) {}
|
|
98
|
+
}
|
|
99
|
+
}
|
|
43
100
|
|
|
44
101
|
{
|
|
45
102
|
// In DEV mode, we swap out invokeGuardedCallback for a special version
|
|
@@ -64,105 +121,21 @@ function ReactError(error) {
|
|
|
64
121
|
// DEV version of invokeGuardedCallback
|
|
65
122
|
if (typeof window !== 'undefined' && typeof window.dispatchEvent === 'function' && typeof document !== 'undefined' && typeof document.createEvent === 'function') {
|
|
66
123
|
var fakeNode = document.createElement('react');
|
|
67
|
-
|
|
68
|
-
|
|
69
124
|
}
|
|
70
125
|
}
|
|
71
126
|
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
*
|
|
76
|
-
* In production, this is implemented using a try-catch. The reason we don't
|
|
77
|
-
* use a try-catch directly is so that we can swap out a different
|
|
78
|
-
* implementation in DEV mode.
|
|
79
|
-
*
|
|
80
|
-
* @param {String} name of the guard to use for logging or debugging
|
|
81
|
-
* @param {Function} func The function to invoke
|
|
82
|
-
* @param {*} context The context to use when calling the function
|
|
83
|
-
* @param {...*} args Arguments for function
|
|
84
|
-
*/
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
/**
|
|
88
|
-
* Same as invokeGuardedCallback, but instead of returning an error, it stores
|
|
89
|
-
* it in a global so it can be rethrown by `rethrowCaughtError` later.
|
|
90
|
-
* TODO: See if caughtError and rethrowError can be unified.
|
|
91
|
-
*
|
|
92
|
-
* @param {String} name of the guard to use for logging or debugging
|
|
93
|
-
* @param {Function} func The function to invoke
|
|
94
|
-
* @param {*} context The context to use when calling the function
|
|
95
|
-
* @param {...*} args Arguments for function
|
|
96
|
-
*/
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
/**
|
|
100
|
-
* During execution of guarded functions we will capture the first error which
|
|
101
|
-
* we will rethrow to be handled by the top level error handler.
|
|
102
|
-
*/
|
|
103
|
-
|
|
104
|
-
/**
|
|
105
|
-
* Similar to invariant but only logs a warning if the condition is not met.
|
|
106
|
-
* This can be used to log issues in development environments in critical
|
|
107
|
-
* paths. Removing the logging code for production environments will keep the
|
|
108
|
-
* same logic and follow the same code paths.
|
|
109
|
-
*/
|
|
110
|
-
var warningWithoutStack = function () {};
|
|
111
|
-
|
|
112
|
-
{
|
|
113
|
-
warningWithoutStack = function (condition, format) {
|
|
114
|
-
for (var _len = arguments.length, args = new Array(_len > 2 ? _len - 2 : 0), _key = 2; _key < _len; _key++) {
|
|
115
|
-
args[_key - 2] = arguments[_key];
|
|
116
|
-
}
|
|
117
|
-
|
|
118
|
-
if (format === undefined) {
|
|
119
|
-
throw new Error('`warningWithoutStack(condition, format, ...args)` requires a warning ' + 'message argument');
|
|
120
|
-
}
|
|
121
|
-
|
|
122
|
-
if (args.length > 8) {
|
|
123
|
-
// Check before the condition to catch violations early.
|
|
124
|
-
throw new Error('warningWithoutStack() currently supports at most 8 arguments.');
|
|
125
|
-
}
|
|
126
|
-
|
|
127
|
-
if (condition) {
|
|
128
|
-
return;
|
|
129
|
-
}
|
|
130
|
-
|
|
131
|
-
if (typeof console !== 'undefined') {
|
|
132
|
-
var argsWithFormat = args.map(function (item) {
|
|
133
|
-
return '' + item;
|
|
134
|
-
});
|
|
135
|
-
argsWithFormat.unshift('Warning: ' + format); // We intentionally don't use spread (or .apply) directly because it
|
|
136
|
-
// breaks IE9: https://github.com/facebook/react/issues/13610
|
|
137
|
-
|
|
138
|
-
Function.prototype.apply.call(console.error, console, argsWithFormat);
|
|
139
|
-
}
|
|
140
|
-
|
|
141
|
-
try {
|
|
142
|
-
// --- Welcome to debugging React ---
|
|
143
|
-
// This error was thrown as a convenience so that you can use this stack
|
|
144
|
-
// to find the callsite that caused this warning to fire.
|
|
145
|
-
var argIndex = 0;
|
|
146
|
-
var message = 'Warning: ' + format.replace(/%s/g, function () {
|
|
147
|
-
return args[argIndex++];
|
|
148
|
-
});
|
|
149
|
-
throw new Error(message);
|
|
150
|
-
} catch (x) {}
|
|
151
|
-
};
|
|
152
|
-
}
|
|
153
|
-
|
|
154
|
-
var warningWithoutStack$1 = warningWithoutStack;
|
|
155
|
-
|
|
156
|
-
var getFiberCurrentPropsFromNode$1 = null;
|
|
157
|
-
var getInstanceFromNode$1 = null;
|
|
158
|
-
var getNodeFromInstance$1 = null;
|
|
127
|
+
var getFiberCurrentPropsFromNode = null;
|
|
128
|
+
var getInstanceFromNode = null;
|
|
129
|
+
var getNodeFromInstance = null;
|
|
159
130
|
function setComponentTree(getFiberCurrentPropsFromNodeImpl, getInstanceFromNodeImpl, getNodeFromInstanceImpl) {
|
|
160
|
-
getFiberCurrentPropsFromNode
|
|
161
|
-
getInstanceFromNode
|
|
162
|
-
getNodeFromInstance
|
|
131
|
+
getFiberCurrentPropsFromNode = getFiberCurrentPropsFromNodeImpl;
|
|
132
|
+
getInstanceFromNode = getInstanceFromNodeImpl;
|
|
133
|
+
getNodeFromInstance = getNodeFromInstanceImpl;
|
|
163
134
|
|
|
164
135
|
{
|
|
165
|
-
|
|
136
|
+
if (!getNodeFromInstance || !getInstanceFromNode) {
|
|
137
|
+
error('EventPluginUtils.setComponentTree(...): Injected ' + 'module is missing getNodeFromInstance or getInstanceFromNode.');
|
|
138
|
+
}
|
|
166
139
|
}
|
|
167
140
|
}
|
|
168
141
|
var validateEventDispatches;
|
|
@@ -175,23 +148,12 @@ var validateEventDispatches;
|
|
|
175
148
|
var listenersLen = listenersIsArr ? dispatchListeners.length : dispatchListeners ? 1 : 0;
|
|
176
149
|
var instancesIsArr = Array.isArray(dispatchInstances);
|
|
177
150
|
var instancesLen = instancesIsArr ? dispatchInstances.length : dispatchInstances ? 1 : 0;
|
|
178
|
-
|
|
151
|
+
|
|
152
|
+
if (instancesIsArr !== listenersIsArr || instancesLen !== listenersLen) {
|
|
153
|
+
error('EventPluginUtils: Invalid `event`.');
|
|
154
|
+
}
|
|
179
155
|
};
|
|
180
156
|
}
|
|
181
|
-
/**
|
|
182
|
-
* Dispatch the event to the listener.
|
|
183
|
-
* @param {SyntheticEvent} event SyntheticEvent to handle
|
|
184
|
-
* @param {function} listener Application-level callback
|
|
185
|
-
* @param {*} inst Internal component instance
|
|
186
|
-
*/
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
/**
|
|
191
|
-
* Standard/simple iteration through an event's collected dispatches.
|
|
192
|
-
*/
|
|
193
|
-
|
|
194
|
-
|
|
195
157
|
/**
|
|
196
158
|
* Standard/simple iteration through an event's collected dispatches, but stops
|
|
197
159
|
* at the first dispatch execution returning true, and returns that id.
|
|
@@ -256,15 +218,13 @@ function executeDirectDispatch(event) {
|
|
|
256
218
|
var dispatchListener = event._dispatchListeners;
|
|
257
219
|
var dispatchInstance = event._dispatchInstances;
|
|
258
220
|
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
throw ReactError(Error("executeDirectDispatch(...): Invalid `event`."));
|
|
263
|
-
}
|
|
221
|
+
if (!!Array.isArray(dispatchListener)) {
|
|
222
|
+
{
|
|
223
|
+
throw Error( "executeDirectDispatch(...): Invalid `event`." );
|
|
264
224
|
}
|
|
265
|
-
}
|
|
225
|
+
}
|
|
266
226
|
|
|
267
|
-
event.currentTarget = dispatchListener ? getNodeFromInstance
|
|
227
|
+
event.currentTarget = dispatchListener ? getNodeFromInstance(dispatchInstance) : null;
|
|
268
228
|
var res = dispatchListener ? dispatchListener(event) : null;
|
|
269
229
|
event.currentTarget = null;
|
|
270
230
|
event._dispatchListeners = null;
|
|
@@ -280,12 +240,6 @@ function hasDispatches(event) {
|
|
|
280
240
|
return !!event._dispatchListeners;
|
|
281
241
|
}
|
|
282
242
|
|
|
283
|
-
// Before we know whether it is function or class
|
|
284
|
-
|
|
285
|
-
// Root of a host tree. Could be nested inside another node.
|
|
286
|
-
|
|
287
|
-
// A subtree. Could be an entry point to a different renderer.
|
|
288
|
-
|
|
289
243
|
var HostComponent = 5;
|
|
290
244
|
|
|
291
245
|
function getParent(inst) {
|
|
@@ -392,71 +346,69 @@ function traverseTwoPhase(inst, fn, arg) {
|
|
|
392
346
|
fn(path[i], 'bubbled', arg);
|
|
393
347
|
}
|
|
394
348
|
}
|
|
395
|
-
/**
|
|
396
|
-
* Traverses the ID hierarchy and invokes the supplied `cb` on any IDs that
|
|
397
|
-
* should would receive a `mouseEnter` or `mouseLeave` event.
|
|
398
|
-
*
|
|
399
|
-
* Does not invoke the callback on the nearest common ancestor because nothing
|
|
400
|
-
* "entered" or "left" that element.
|
|
401
|
-
*/
|
|
402
|
-
|
|
403
|
-
/**
|
|
404
|
-
* Registers plugins so that they can extract and dispatch events.
|
|
405
|
-
*
|
|
406
|
-
* @see {EventPluginHub}
|
|
407
|
-
*/
|
|
408
|
-
|
|
409
|
-
/**
|
|
410
|
-
* Ordered list of injected plugins.
|
|
411
|
-
*/
|
|
412
349
|
|
|
350
|
+
function isInteractive(tag) {
|
|
351
|
+
return tag === 'button' || tag === 'input' || tag === 'select' || tag === 'textarea';
|
|
352
|
+
}
|
|
413
353
|
|
|
354
|
+
function shouldPreventMouseEvent(name, type, props) {
|
|
355
|
+
switch (name) {
|
|
356
|
+
case 'onClick':
|
|
357
|
+
case 'onClickCapture':
|
|
358
|
+
case 'onDoubleClick':
|
|
359
|
+
case 'onDoubleClickCapture':
|
|
360
|
+
case 'onMouseDown':
|
|
361
|
+
case 'onMouseDownCapture':
|
|
362
|
+
case 'onMouseMove':
|
|
363
|
+
case 'onMouseMoveCapture':
|
|
364
|
+
case 'onMouseUp':
|
|
365
|
+
case 'onMouseUpCapture':
|
|
366
|
+
case 'onMouseEnter':
|
|
367
|
+
return !!(props.disabled && isInteractive(type));
|
|
414
368
|
|
|
369
|
+
default:
|
|
370
|
+
return false;
|
|
371
|
+
}
|
|
372
|
+
}
|
|
415
373
|
/**
|
|
416
|
-
*
|
|
374
|
+
* @param {object} inst The instance, which is the source of events.
|
|
375
|
+
* @param {string} registrationName Name of listener (e.g. `onClick`).
|
|
376
|
+
* @return {?function} The stored callback.
|
|
417
377
|
*/
|
|
418
378
|
|
|
419
379
|
|
|
420
|
-
|
|
421
|
-
|
|
422
|
-
|
|
380
|
+
function getListener(inst, registrationName) {
|
|
381
|
+
var listener; // TODO: shouldPreventMouseEvent is DOM-specific and definitely should not
|
|
382
|
+
// live here; needs to be moved to a better place soon
|
|
423
383
|
|
|
384
|
+
var stateNode = inst.stateNode;
|
|
424
385
|
|
|
425
|
-
|
|
426
|
-
|
|
427
|
-
|
|
386
|
+
if (!stateNode) {
|
|
387
|
+
// Work in progress (ex: onload events in incremental mode).
|
|
388
|
+
return null;
|
|
389
|
+
}
|
|
428
390
|
|
|
391
|
+
var props = getFiberCurrentPropsFromNode(stateNode);
|
|
429
392
|
|
|
430
|
-
|
|
431
|
-
|
|
432
|
-
|
|
433
|
-
|
|
434
|
-
* @type {Object}
|
|
435
|
-
*/
|
|
393
|
+
if (!props) {
|
|
394
|
+
// Work in progress.
|
|
395
|
+
return null;
|
|
396
|
+
}
|
|
436
397
|
|
|
437
|
-
|
|
398
|
+
listener = props[registrationName];
|
|
438
399
|
|
|
439
|
-
|
|
440
|
-
|
|
441
|
-
|
|
442
|
-
* always deterministic regardless of packaging, on-the-fly injection, etc.
|
|
443
|
-
*
|
|
444
|
-
* @param {array} InjectedEventPluginOrder
|
|
445
|
-
* @internal
|
|
446
|
-
* @see {EventPluginHub.injection.injectEventPluginOrder}
|
|
447
|
-
*/
|
|
400
|
+
if (shouldPreventMouseEvent(registrationName, inst.type, props)) {
|
|
401
|
+
return null;
|
|
402
|
+
}
|
|
448
403
|
|
|
404
|
+
if (!(!listener || typeof listener === 'function')) {
|
|
405
|
+
{
|
|
406
|
+
throw Error( "Expected `" + registrationName + "` listener to be a function, instead got a value of `" + typeof listener + "` type." );
|
|
407
|
+
}
|
|
408
|
+
}
|
|
449
409
|
|
|
450
|
-
|
|
451
|
-
|
|
452
|
-
* in the ordering injected by `injectEventPluginOrder`.
|
|
453
|
-
*
|
|
454
|
-
* Plugins can be injected as part of page initialization or on-the-fly.
|
|
455
|
-
*
|
|
456
|
-
* @param {object} injectedNamesToPlugins Map from names to plugin modules.
|
|
457
|
-
* @internal
|
|
458
|
-
* @see {EventPluginHub.injection.injectEventPluginsByName}
|
|
459
|
-
*/
|
|
410
|
+
return listener;
|
|
411
|
+
}
|
|
460
412
|
|
|
461
413
|
/**
|
|
462
414
|
* Accumulates items that must not be null or undefined into the first one. This
|
|
@@ -472,13 +424,11 @@ function traverseTwoPhase(inst, fn, arg) {
|
|
|
472
424
|
*/
|
|
473
425
|
|
|
474
426
|
function accumulateInto(current, next) {
|
|
475
|
-
(
|
|
476
|
-
|
|
477
|
-
|
|
478
|
-
throw ReactError(Error("accumulateInto(...): Accumulated items must not be null or undefined."));
|
|
479
|
-
}
|
|
427
|
+
if (!(next != null)) {
|
|
428
|
+
{
|
|
429
|
+
throw Error( "accumulateInto(...): Accumulated items must not be null or undefined." );
|
|
480
430
|
}
|
|
481
|
-
}
|
|
431
|
+
}
|
|
482
432
|
|
|
483
433
|
if (current == null) {
|
|
484
434
|
return next;
|
|
@@ -521,98 +471,6 @@ function forEachAccumulated(arr, cb, scope) {
|
|
|
521
471
|
}
|
|
522
472
|
}
|
|
523
473
|
|
|
524
|
-
function isInteractive(tag) {
|
|
525
|
-
return tag === 'button' || tag === 'input' || tag === 'select' || tag === 'textarea';
|
|
526
|
-
}
|
|
527
|
-
|
|
528
|
-
function shouldPreventMouseEvent(name, type, props) {
|
|
529
|
-
switch (name) {
|
|
530
|
-
case 'onClick':
|
|
531
|
-
case 'onClickCapture':
|
|
532
|
-
case 'onDoubleClick':
|
|
533
|
-
case 'onDoubleClickCapture':
|
|
534
|
-
case 'onMouseDown':
|
|
535
|
-
case 'onMouseDownCapture':
|
|
536
|
-
case 'onMouseMove':
|
|
537
|
-
case 'onMouseMoveCapture':
|
|
538
|
-
case 'onMouseUp':
|
|
539
|
-
case 'onMouseUpCapture':
|
|
540
|
-
return !!(props.disabled && isInteractive(type));
|
|
541
|
-
|
|
542
|
-
default:
|
|
543
|
-
return false;
|
|
544
|
-
}
|
|
545
|
-
}
|
|
546
|
-
/**
|
|
547
|
-
* This is a unified interface for event plugins to be installed and configured.
|
|
548
|
-
*
|
|
549
|
-
* Event plugins can implement the following properties:
|
|
550
|
-
*
|
|
551
|
-
* `extractEvents` {function(string, DOMEventTarget, string, object): *}
|
|
552
|
-
* Required. When a top-level event is fired, this method is expected to
|
|
553
|
-
* extract synthetic events that will in turn be queued and dispatched.
|
|
554
|
-
*
|
|
555
|
-
* `eventTypes` {object}
|
|
556
|
-
* Optional, plugins that fire events must publish a mapping of registration
|
|
557
|
-
* names that are used to register listeners. Values of this mapping must
|
|
558
|
-
* be objects that contain `registrationName` or `phasedRegistrationNames`.
|
|
559
|
-
*
|
|
560
|
-
* `executeDispatch` {function(object, function, string)}
|
|
561
|
-
* Optional, allows plugins to override how an event gets dispatched. By
|
|
562
|
-
* default, the listener is simply invoked.
|
|
563
|
-
*
|
|
564
|
-
* Each plugin that is injected into `EventsPluginHub` is immediately operable.
|
|
565
|
-
*
|
|
566
|
-
* @public
|
|
567
|
-
*/
|
|
568
|
-
|
|
569
|
-
/**
|
|
570
|
-
* Methods for injecting dependencies.
|
|
571
|
-
*/
|
|
572
|
-
|
|
573
|
-
|
|
574
|
-
|
|
575
|
-
/**
|
|
576
|
-
* @param {object} inst The instance, which is the source of events.
|
|
577
|
-
* @param {string} registrationName Name of listener (e.g. `onClick`).
|
|
578
|
-
* @return {?function} The stored callback.
|
|
579
|
-
*/
|
|
580
|
-
|
|
581
|
-
function getListener(inst, registrationName) {
|
|
582
|
-
var listener; // TODO: shouldPreventMouseEvent is DOM-specific and definitely should not
|
|
583
|
-
// live here; needs to be moved to a better place soon
|
|
584
|
-
|
|
585
|
-
var stateNode = inst.stateNode;
|
|
586
|
-
|
|
587
|
-
if (!stateNode) {
|
|
588
|
-
// Work in progress (ex: onload events in incremental mode).
|
|
589
|
-
return null;
|
|
590
|
-
}
|
|
591
|
-
|
|
592
|
-
var props = getFiberCurrentPropsFromNode$1(stateNode);
|
|
593
|
-
|
|
594
|
-
if (!props) {
|
|
595
|
-
// Work in progress.
|
|
596
|
-
return null;
|
|
597
|
-
}
|
|
598
|
-
|
|
599
|
-
listener = props[registrationName];
|
|
600
|
-
|
|
601
|
-
if (shouldPreventMouseEvent(registrationName, inst.type, props)) {
|
|
602
|
-
return null;
|
|
603
|
-
}
|
|
604
|
-
|
|
605
|
-
(function () {
|
|
606
|
-
if (!(!listener || typeof listener === 'function')) {
|
|
607
|
-
{
|
|
608
|
-
throw ReactError(Error("Expected `" + registrationName + "` listener to be a function, instead got a value of `" + typeof listener + "` type."));
|
|
609
|
-
}
|
|
610
|
-
}
|
|
611
|
-
})();
|
|
612
|
-
|
|
613
|
-
return listener;
|
|
614
|
-
}
|
|
615
|
-
|
|
616
474
|
/**
|
|
617
475
|
* Some event types have a notion of different registration names for different
|
|
618
476
|
* "phases" of propagation. This finds listeners by a given phase.
|
|
@@ -641,7 +499,9 @@ function listenerAtPhase(inst, event, propagationPhase) {
|
|
|
641
499
|
|
|
642
500
|
function accumulateDirectionalDispatches(inst, phase, event) {
|
|
643
501
|
{
|
|
644
|
-
|
|
502
|
+
if (!inst) {
|
|
503
|
+
error('Dispatching inst must not be null');
|
|
504
|
+
}
|
|
645
505
|
}
|
|
646
506
|
|
|
647
507
|
var listener = listenerAtPhase(inst, event, phase);
|
|
@@ -714,12 +574,10 @@ function accumulateTwoPhaseDispatches(events) {
|
|
|
714
574
|
function accumulateTwoPhaseDispatchesSkipTarget(events) {
|
|
715
575
|
forEachAccumulated(events, accumulateTwoPhaseDispatchesSingleSkipTarget);
|
|
716
576
|
}
|
|
717
|
-
|
|
718
577
|
function accumulateDirectDispatches(events) {
|
|
719
578
|
forEachAccumulated(events, accumulateDirectDispatchesSingle);
|
|
720
579
|
}
|
|
721
580
|
|
|
722
|
-
/* eslint valid-typeof: 0 */
|
|
723
581
|
var EVENT_POOL_SIZE = 10;
|
|
724
582
|
/**
|
|
725
583
|
* @interface Event
|
|
@@ -961,8 +819,9 @@ function getPooledWarningPropertyDefinition(propName, getVal) {
|
|
|
961
819
|
}
|
|
962
820
|
|
|
963
821
|
function warn(action, result) {
|
|
964
|
-
|
|
965
|
-
|
|
822
|
+
{
|
|
823
|
+
error("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);
|
|
824
|
+
}
|
|
966
825
|
}
|
|
967
826
|
}
|
|
968
827
|
|
|
@@ -981,13 +840,11 @@ function getPooledEvent(dispatchConfig, targetInst, nativeEvent, nativeInst) {
|
|
|
981
840
|
function releasePooledEvent(event) {
|
|
982
841
|
var EventConstructor = this;
|
|
983
842
|
|
|
984
|
-
(
|
|
985
|
-
|
|
986
|
-
|
|
987
|
-
throw ReactError(Error("Trying to release an event instance into a pool of a different type."));
|
|
988
|
-
}
|
|
843
|
+
if (!(event instanceof EventConstructor)) {
|
|
844
|
+
{
|
|
845
|
+
throw Error( "Trying to release an event instance into a pool of a different type." );
|
|
989
846
|
}
|
|
990
|
-
}
|
|
847
|
+
}
|
|
991
848
|
|
|
992
849
|
event.destructor();
|
|
993
850
|
|
|
@@ -1099,16 +956,16 @@ function resetTouchRecord(touchRecord, touch) {
|
|
|
1099
956
|
function getTouchIdentifier(_ref) {
|
|
1100
957
|
var identifier = _ref.identifier;
|
|
1101
958
|
|
|
1102
|
-
(
|
|
1103
|
-
|
|
1104
|
-
|
|
1105
|
-
throw ReactError(Error("Touch object is missing identifier."));
|
|
1106
|
-
}
|
|
959
|
+
if (!(identifier != null)) {
|
|
960
|
+
{
|
|
961
|
+
throw Error( "Touch object is missing identifier." );
|
|
1107
962
|
}
|
|
1108
|
-
}
|
|
963
|
+
}
|
|
1109
964
|
|
|
1110
965
|
{
|
|
1111
|
-
|
|
966
|
+
if (identifier > MAX_TOUCH_BANK) {
|
|
967
|
+
error('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);
|
|
968
|
+
}
|
|
1112
969
|
}
|
|
1113
970
|
|
|
1114
971
|
return identifier;
|
|
@@ -1140,7 +997,9 @@ function recordTouchMove(touch) {
|
|
|
1140
997
|
touchRecord.currentTimeStamp = timestampForTouch(touch);
|
|
1141
998
|
touchHistory.mostRecentTimeStamp = timestampForTouch(touch);
|
|
1142
999
|
} else {
|
|
1143
|
-
|
|
1000
|
+
{
|
|
1001
|
+
warn('Cannot record touch move without a touch start.\n' + 'Touch Move: %s\n' + 'Touch Bank: %s', printTouch(touch), printTouchBank());
|
|
1002
|
+
}
|
|
1144
1003
|
}
|
|
1145
1004
|
}
|
|
1146
1005
|
|
|
@@ -1157,7 +1016,9 @@ function recordTouchEnd(touch) {
|
|
|
1157
1016
|
touchRecord.currentTimeStamp = timestampForTouch(touch);
|
|
1158
1017
|
touchHistory.mostRecentTimeStamp = timestampForTouch(touch);
|
|
1159
1018
|
} else {
|
|
1160
|
-
|
|
1019
|
+
{
|
|
1020
|
+
warn('Cannot record touch end without a touch start.\n' + 'Touch End: %s\n' + 'Touch Bank: %s', printTouch(touch), printTouchBank());
|
|
1021
|
+
}
|
|
1161
1022
|
}
|
|
1162
1023
|
}
|
|
1163
1024
|
|
|
@@ -1207,7 +1068,10 @@ var ResponderTouchHistoryStore = {
|
|
|
1207
1068
|
|
|
1208
1069
|
{
|
|
1209
1070
|
var activeRecord = touchBank[touchHistory.indexOfSingleActiveTouch];
|
|
1210
|
-
|
|
1071
|
+
|
|
1072
|
+
if (activeRecord == null || !activeRecord.touchActive) {
|
|
1073
|
+
error('Cannot find single active touch.');
|
|
1074
|
+
}
|
|
1211
1075
|
}
|
|
1212
1076
|
}
|
|
1213
1077
|
}
|
|
@@ -1224,13 +1088,11 @@ var ResponderTouchHistoryStore = {
|
|
|
1224
1088
|
*/
|
|
1225
1089
|
|
|
1226
1090
|
function accumulate(current, next) {
|
|
1227
|
-
(
|
|
1228
|
-
|
|
1229
|
-
|
|
1230
|
-
throw ReactError(Error("accumulate(...): Accumulated items must not be null or undefined."));
|
|
1231
|
-
}
|
|
1091
|
+
if (!(next != null)) {
|
|
1092
|
+
{
|
|
1093
|
+
throw Error( "accumulate(...): Accumulated items must not be null or undefined." );
|
|
1232
1094
|
}
|
|
1233
|
-
}
|
|
1095
|
+
}
|
|
1234
1096
|
|
|
1235
1097
|
if (current == null) {
|
|
1236
1098
|
return next;
|
|
@@ -1495,7 +1357,7 @@ to return true:wantsResponderID| |
|
|
|
1495
1357
|
+ + */
|
|
1496
1358
|
|
|
1497
1359
|
/**
|
|
1498
|
-
* A note about event ordering in the `
|
|
1360
|
+
* A note about event ordering in the `EventPluginRegistry`.
|
|
1499
1361
|
*
|
|
1500
1362
|
* Suppose plugins are injected in the following order:
|
|
1501
1363
|
*
|
|
@@ -1514,7 +1376,7 @@ to return true:wantsResponderID| |
|
|
|
1514
1376
|
* - When returned from `extractEvents`, deferred-dispatched events contain an
|
|
1515
1377
|
* "accumulation" of deferred dispatches.
|
|
1516
1378
|
* - These deferred dispatches are accumulated/collected before they are
|
|
1517
|
-
* returned, but processed at a later time by the `
|
|
1379
|
+
* returned, but processed at a later time by the `EventPluginRegistry` (hence the
|
|
1518
1380
|
* name deferred).
|
|
1519
1381
|
*
|
|
1520
1382
|
* In the process of returning their deferred-dispatched events, event plugins
|
|
@@ -1538,9 +1400,9 @@ to return true:wantsResponderID| |
|
|
|
1538
1400
|
* - `R`s on-demand events (if any) (dispatched by `R` on-demand)
|
|
1539
1401
|
* - `S`s on-demand events (if any) (dispatched by `S` on-demand)
|
|
1540
1402
|
* - `C`s on-demand events (if any) (dispatched by `C` on-demand)
|
|
1541
|
-
* - `R`s extracted events (if any) (dispatched by `
|
|
1542
|
-
* - `S`s extracted events (if any) (dispatched by `
|
|
1543
|
-
* - `C`s extracted events (if any) (dispatched by `
|
|
1403
|
+
* - `R`s extracted events (if any) (dispatched by `EventPluginRegistry`)
|
|
1404
|
+
* - `S`s extracted events (if any) (dispatched by `EventPluginRegistry`)
|
|
1405
|
+
* - `C`s extracted events (if any) (dispatched by `EventPluginRegistry`)
|
|
1544
1406
|
*
|
|
1545
1407
|
* In the case of `ResponderEventPlugin`: If the `startShouldSetResponder`
|
|
1546
1408
|
* on-demand dispatch returns `true` (and some other details are satisfied) the
|
|
@@ -1549,9 +1411,9 @@ to return true:wantsResponderID| |
|
|
|
1549
1411
|
* will appear as follows:
|
|
1550
1412
|
*
|
|
1551
1413
|
* - `startShouldSetResponder` (`ResponderEventPlugin` dispatches on-demand)
|
|
1552
|
-
* - `touchStartCapture` (`
|
|
1553
|
-
* - `touchStart` (`
|
|
1554
|
-
* - `responderGrant/Reject` (`
|
|
1414
|
+
* - `touchStartCapture` (`EventPluginRegistry` dispatches as usual)
|
|
1415
|
+
* - `touchStart` (`EventPluginRegistry` dispatches as usual)
|
|
1416
|
+
* - `responderGrant/Reject` (`EventPluginRegistry` dispatches as usual)
|
|
1555
1417
|
*/
|
|
1556
1418
|
|
|
1557
1419
|
function setResponderAndExtractTransfer(topLevelType, targetInst, nativeEvent, nativeEventTarget) {
|
|
@@ -1655,7 +1517,7 @@ function noResponderTouches(nativeEvent) {
|
|
|
1655
1517
|
|
|
1656
1518
|
if (target !== null && target !== undefined && target !== 0) {
|
|
1657
1519
|
// Is the original touch location inside of the current responder?
|
|
1658
|
-
var targetInst = getInstanceFromNode
|
|
1520
|
+
var targetInst = getInstanceFromNode(target);
|
|
1659
1521
|
|
|
1660
1522
|
if (isAncestor(responderInst, targetInst)) {
|
|
1661
1523
|
return false;
|
|
@@ -1685,7 +1547,10 @@ var ResponderEventPlugin = {
|
|
|
1685
1547
|
if (trackedTouchCount >= 0) {
|
|
1686
1548
|
trackedTouchCount -= 1;
|
|
1687
1549
|
} else {
|
|
1688
|
-
|
|
1550
|
+
{
|
|
1551
|
+
warn('Ended a touch event which was not counted in `trackedTouchCount`.');
|
|
1552
|
+
}
|
|
1553
|
+
|
|
1689
1554
|
return null;
|
|
1690
1555
|
}
|
|
1691
1556
|
}
|
|
@@ -1743,18 +1608,18 @@ var ResponderEventPlugin = {
|
|
|
1743
1608
|
|
|
1744
1609
|
// Keep in sync with ReactDOM.js, ReactTestUtils.js, and ReactTestUtilsAct.js:
|
|
1745
1610
|
|
|
1746
|
-
var _ReactDOM$__SECRET_IN = ReactDOM.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.Events
|
|
1747
|
-
|
|
1748
|
-
|
|
1749
|
-
|
|
1750
|
-
|
|
1751
|
-
setComponentTree(getFiberCurrentPropsFromNode, getInstanceFromNode, getNodeFromInstance);
|
|
1752
|
-
|
|
1753
|
-
|
|
1754
|
-
|
|
1755
|
-
|
|
1756
|
-
|
|
1757
|
-
|
|
1611
|
+
var _ReactDOM$__SECRET_IN = ReactDOM.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.Events,
|
|
1612
|
+
getInstanceFromNode$1 = _ReactDOM$__SECRET_IN[0],
|
|
1613
|
+
getNodeFromInstance$1 = _ReactDOM$__SECRET_IN[1],
|
|
1614
|
+
getFiberCurrentPropsFromNode$1 = _ReactDOM$__SECRET_IN[2],
|
|
1615
|
+
injectEventPluginsByName = _ReactDOM$__SECRET_IN[3];
|
|
1616
|
+
setComponentTree(getFiberCurrentPropsFromNode$1, getInstanceFromNode$1, getNodeFromInstance$1);
|
|
1617
|
+
|
|
1618
|
+
var ReactDOMUnstableNativeDependencies = /*#__PURE__*/Object.freeze({
|
|
1619
|
+
__proto__: null,
|
|
1620
|
+
ResponderEventPlugin: ResponderEventPlugin,
|
|
1621
|
+
ResponderTouchHistoryStore: ResponderTouchHistoryStore,
|
|
1622
|
+
injectEventPluginsByName: injectEventPluginsByName
|
|
1758
1623
|
});
|
|
1759
1624
|
|
|
1760
1625
|
var unstableNativeDependencies = ReactDOMUnstableNativeDependencies;
|