react-dom 16.11.0 → 16.14.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/build-info.json +5 -5
- package/cjs/react-dom-server.browser.development.js +331 -596
- package/cjs/react-dom-server.browser.production.min.js +37 -37
- package/cjs/react-dom-server.node.development.js +330 -595
- package/cjs/react-dom-server.node.production.min.js +38 -38
- package/cjs/react-dom-test-utils.development.js +171 -326
- package/cjs/react-dom-test-utils.production.min.js +17 -17
- 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 +190 -305
- package/cjs/react-dom-unstable-native-dependencies.production.min.js +23 -27
- package/cjs/react-dom.development.js +9554 -12269
- package/cjs/react-dom.production.min.js +280 -278
- package/cjs/react-dom.profiling.min.js +285 -282
- package/package.json +30 -25
- package/umd/react-dom-server.browser.development.js +3320 -3596
- package/umd/react-dom-server.browser.production.min.js +35 -35
- package/umd/react-dom-test-utils.development.js +1200 -1355
- 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 +1333 -1449
- package/umd/react-dom-unstable-native-dependencies.production.min.js +21 -22
- package/umd/react-dom.development.js +19871 -22597
- package/umd/react-dom.production.min.js +229 -231
- package/umd/react-dom.profiling.min.js +237 -239
|
@@ -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,119 +16,74 @@ 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
|
-
* to provide information about what broke and what you were
|
|
30
|
-
* expecting.
|
|
31
|
-
*
|
|
32
|
-
* The invariant message will be stripped in production, but the invariant
|
|
33
|
-
* will remain to ensure logic does not differ in production.
|
|
34
|
-
*/
|
|
35
|
-
|
|
36
|
-
{
|
|
37
|
-
// In DEV mode, we swap out invokeGuardedCallback for a special version
|
|
38
|
-
// that plays more nicely with the browser's DevTools. The idea is to preserve
|
|
39
|
-
// "Pause on exceptions" behavior. Because React wraps all user-provided
|
|
40
|
-
// functions in invokeGuardedCallback, and the production version of
|
|
41
|
-
// invokeGuardedCallback uses a try-catch, all user exceptions are treated
|
|
42
|
-
// like caught exceptions, and the DevTools won't pause unless the developer
|
|
43
|
-
// takes the extra step of enabling pause on caught exceptions. This is
|
|
44
|
-
// unintuitive, though, because even though React has caught the error, from
|
|
45
|
-
// the developer's perspective, the error is uncaught.
|
|
46
|
-
//
|
|
47
|
-
// To preserve the expected "Pause on exceptions" behavior, we don't use a
|
|
48
|
-
// try-catch in DEV. Instead, we synchronously dispatch a fake event to a fake
|
|
49
|
-
// DOM node, and call the user-provided callback from inside an event handler
|
|
50
|
-
// for that fake event. If the callback throws, the error is "captured" using
|
|
51
|
-
// a global event handler. But because the error happens in a different
|
|
52
|
-
// event loop context, it does not interrupt the normal program flow.
|
|
53
|
-
// Effectively, this gives us try-catch behavior without actually using
|
|
54
|
-
// try-catch. Neat!
|
|
55
|
-
// Check that the browser supports the APIs we need to implement our special
|
|
56
|
-
// DEV version of invokeGuardedCallback
|
|
57
|
-
if (typeof window !== 'undefined' && typeof window.dispatchEvent === 'function' && typeof document !== 'undefined' && typeof document.createEvent === 'function') {
|
|
58
|
-
var fakeNode = document.createElement('react');
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
}
|
|
26
|
+
if (!ReactSharedInternals.hasOwnProperty('ReactCurrentDispatcher')) {
|
|
27
|
+
ReactSharedInternals.ReactCurrentDispatcher = {
|
|
28
|
+
current: null
|
|
29
|
+
};
|
|
62
30
|
}
|
|
63
31
|
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
* use a try-catch directly is so that we can swap out a different
|
|
70
|
-
* implementation in DEV mode.
|
|
71
|
-
*
|
|
72
|
-
* @param {String} name of the guard to use for logging or debugging
|
|
73
|
-
* @param {Function} func The function to invoke
|
|
74
|
-
* @param {*} context The context to use when calling the function
|
|
75
|
-
* @param {...*} args Arguments for function
|
|
76
|
-
*/
|
|
77
|
-
|
|
32
|
+
if (!ReactSharedInternals.hasOwnProperty('ReactCurrentBatchConfig')) {
|
|
33
|
+
ReactSharedInternals.ReactCurrentBatchConfig = {
|
|
34
|
+
suspense: null
|
|
35
|
+
};
|
|
36
|
+
}
|
|
78
37
|
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
*
|
|
84
|
-
* @param {String} name of the guard to use for logging or debugging
|
|
85
|
-
* @param {Function} func The function to invoke
|
|
86
|
-
* @param {*} context The context to use when calling the function
|
|
87
|
-
* @param {...*} args Arguments for function
|
|
88
|
-
*/
|
|
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.
|
|
89
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
|
+
}
|
|
90
48
|
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
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
|
+
}
|
|
95
57
|
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
* paths. Removing the logging code for production environments will keep the
|
|
100
|
-
* same logic and follow the same code paths.
|
|
101
|
-
*/
|
|
102
|
-
var warningWithoutStack = function () {};
|
|
58
|
+
printWarning('error', format, args);
|
|
59
|
+
}
|
|
60
|
+
}
|
|
103
61
|
|
|
104
|
-
{
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
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;
|
|
109
67
|
|
|
110
|
-
if (
|
|
111
|
-
|
|
112
|
-
|
|
68
|
+
if (!hasExistingStack) {
|
|
69
|
+
var ReactDebugCurrentFrame = ReactSharedInternals.ReactDebugCurrentFrame;
|
|
70
|
+
var stack = ReactDebugCurrentFrame.getStackAddendum();
|
|
113
71
|
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
72
|
+
if (stack !== '') {
|
|
73
|
+
format += '%s';
|
|
74
|
+
args = args.concat([stack]);
|
|
75
|
+
}
|
|
117
76
|
}
|
|
118
77
|
|
|
119
|
-
|
|
120
|
-
return;
|
|
121
|
-
}
|
|
78
|
+
var argsWithFormat = args.map(function (item) {
|
|
79
|
+
return '' + item;
|
|
80
|
+
}); // Careful: RN currently depends on this prefix
|
|
122
81
|
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
});
|
|
127
|
-
argsWithFormat.unshift('Warning: ' + format); // We intentionally don't use spread (or .apply) directly because it
|
|
128
|
-
// breaks IE9: https://github.com/facebook/react/issues/13610
|
|
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
|
|
129
85
|
|
|
130
|
-
|
|
131
|
-
}
|
|
86
|
+
Function.prototype.apply.call(console[level], console, argsWithFormat);
|
|
132
87
|
|
|
133
88
|
try {
|
|
134
89
|
// --- Welcome to debugging React ---
|
|
@@ -140,21 +95,47 @@ var warningWithoutStack = function () {};
|
|
|
140
95
|
});
|
|
141
96
|
throw new Error(message);
|
|
142
97
|
} catch (x) {}
|
|
143
|
-
}
|
|
98
|
+
}
|
|
144
99
|
}
|
|
145
100
|
|
|
146
|
-
|
|
101
|
+
{
|
|
102
|
+
// In DEV mode, we swap out invokeGuardedCallback for a special version
|
|
103
|
+
// that plays more nicely with the browser's DevTools. The idea is to preserve
|
|
104
|
+
// "Pause on exceptions" behavior. Because React wraps all user-provided
|
|
105
|
+
// functions in invokeGuardedCallback, and the production version of
|
|
106
|
+
// invokeGuardedCallback uses a try-catch, all user exceptions are treated
|
|
107
|
+
// like caught exceptions, and the DevTools won't pause unless the developer
|
|
108
|
+
// takes the extra step of enabling pause on caught exceptions. This is
|
|
109
|
+
// unintuitive, though, because even though React has caught the error, from
|
|
110
|
+
// the developer's perspective, the error is uncaught.
|
|
111
|
+
//
|
|
112
|
+
// To preserve the expected "Pause on exceptions" behavior, we don't use a
|
|
113
|
+
// try-catch in DEV. Instead, we synchronously dispatch a fake event to a fake
|
|
114
|
+
// DOM node, and call the user-provided callback from inside an event handler
|
|
115
|
+
// for that fake event. If the callback throws, the error is "captured" using
|
|
116
|
+
// a global event handler. But because the error happens in a different
|
|
117
|
+
// event loop context, it does not interrupt the normal program flow.
|
|
118
|
+
// Effectively, this gives us try-catch behavior without actually using
|
|
119
|
+
// try-catch. Neat!
|
|
120
|
+
// Check that the browser supports the APIs we need to implement our special
|
|
121
|
+
// DEV version of invokeGuardedCallback
|
|
122
|
+
if (typeof window !== 'undefined' && typeof window.dispatchEvent === 'function' && typeof document !== 'undefined' && typeof document.createEvent === 'function') {
|
|
123
|
+
var fakeNode = document.createElement('react');
|
|
124
|
+
}
|
|
125
|
+
}
|
|
147
126
|
|
|
148
|
-
var getFiberCurrentPropsFromNode
|
|
149
|
-
var getInstanceFromNode
|
|
150
|
-
var getNodeFromInstance
|
|
127
|
+
var getFiberCurrentPropsFromNode = null;
|
|
128
|
+
var getInstanceFromNode = null;
|
|
129
|
+
var getNodeFromInstance = null;
|
|
151
130
|
function setComponentTree(getFiberCurrentPropsFromNodeImpl, getInstanceFromNodeImpl, getNodeFromInstanceImpl) {
|
|
152
|
-
getFiberCurrentPropsFromNode
|
|
153
|
-
getInstanceFromNode
|
|
154
|
-
getNodeFromInstance
|
|
131
|
+
getFiberCurrentPropsFromNode = getFiberCurrentPropsFromNodeImpl;
|
|
132
|
+
getInstanceFromNode = getInstanceFromNodeImpl;
|
|
133
|
+
getNodeFromInstance = getNodeFromInstanceImpl;
|
|
155
134
|
|
|
156
135
|
{
|
|
157
|
-
|
|
136
|
+
if (!getNodeFromInstance || !getInstanceFromNode) {
|
|
137
|
+
error('EventPluginUtils.setComponentTree(...): Injected ' + 'module is missing getNodeFromInstance or getInstanceFromNode.');
|
|
138
|
+
}
|
|
158
139
|
}
|
|
159
140
|
}
|
|
160
141
|
var validateEventDispatches;
|
|
@@ -167,23 +148,12 @@ var validateEventDispatches;
|
|
|
167
148
|
var listenersLen = listenersIsArr ? dispatchListeners.length : dispatchListeners ? 1 : 0;
|
|
168
149
|
var instancesIsArr = Array.isArray(dispatchInstances);
|
|
169
150
|
var instancesLen = instancesIsArr ? dispatchInstances.length : dispatchInstances ? 1 : 0;
|
|
170
|
-
|
|
151
|
+
|
|
152
|
+
if (instancesIsArr !== listenersIsArr || instancesLen !== listenersLen) {
|
|
153
|
+
error('EventPluginUtils: Invalid `event`.');
|
|
154
|
+
}
|
|
171
155
|
};
|
|
172
156
|
}
|
|
173
|
-
/**
|
|
174
|
-
* Dispatch the event to the listener.
|
|
175
|
-
* @param {SyntheticEvent} event SyntheticEvent to handle
|
|
176
|
-
* @param {function} listener Application-level callback
|
|
177
|
-
* @param {*} inst Internal component instance
|
|
178
|
-
*/
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
/**
|
|
183
|
-
* Standard/simple iteration through an event's collected dispatches.
|
|
184
|
-
*/
|
|
185
|
-
|
|
186
|
-
|
|
187
157
|
/**
|
|
188
158
|
* Standard/simple iteration through an event's collected dispatches, but stops
|
|
189
159
|
* at the first dispatch execution returning true, and returns that id.
|
|
@@ -250,11 +220,11 @@ function executeDirectDispatch(event) {
|
|
|
250
220
|
|
|
251
221
|
if (!!Array.isArray(dispatchListener)) {
|
|
252
222
|
{
|
|
253
|
-
throw Error("executeDirectDispatch(...): Invalid `event`.");
|
|
223
|
+
throw Error( "executeDirectDispatch(...): Invalid `event`." );
|
|
254
224
|
}
|
|
255
225
|
}
|
|
256
226
|
|
|
257
|
-
event.currentTarget = dispatchListener ? getNodeFromInstance
|
|
227
|
+
event.currentTarget = dispatchListener ? getNodeFromInstance(dispatchInstance) : null;
|
|
258
228
|
var res = dispatchListener ? dispatchListener(event) : null;
|
|
259
229
|
event.currentTarget = null;
|
|
260
230
|
event._dispatchListeners = null;
|
|
@@ -270,12 +240,6 @@ function hasDispatches(event) {
|
|
|
270
240
|
return !!event._dispatchListeners;
|
|
271
241
|
}
|
|
272
242
|
|
|
273
|
-
// Before we know whether it is function or class
|
|
274
|
-
|
|
275
|
-
// Root of a host tree. Could be nested inside another node.
|
|
276
|
-
|
|
277
|
-
// A subtree. Could be an entry point to a different renderer.
|
|
278
|
-
|
|
279
243
|
var HostComponent = 5;
|
|
280
244
|
|
|
281
245
|
function getParent(inst) {
|
|
@@ -382,71 +346,69 @@ function traverseTwoPhase(inst, fn, arg) {
|
|
|
382
346
|
fn(path[i], 'bubbled', arg);
|
|
383
347
|
}
|
|
384
348
|
}
|
|
385
|
-
/**
|
|
386
|
-
* Traverses the ID hierarchy and invokes the supplied `cb` on any IDs that
|
|
387
|
-
* should would receive a `mouseEnter` or `mouseLeave` event.
|
|
388
|
-
*
|
|
389
|
-
* Does not invoke the callback on the nearest common ancestor because nothing
|
|
390
|
-
* "entered" or "left" that element.
|
|
391
|
-
*/
|
|
392
|
-
|
|
393
|
-
/**
|
|
394
|
-
* Registers plugins so that they can extract and dispatch events.
|
|
395
|
-
*
|
|
396
|
-
* @see {EventPluginHub}
|
|
397
|
-
*/
|
|
398
|
-
|
|
399
|
-
/**
|
|
400
|
-
* Ordered list of injected plugins.
|
|
401
|
-
*/
|
|
402
349
|
|
|
350
|
+
function isInteractive(tag) {
|
|
351
|
+
return tag === 'button' || tag === 'input' || tag === 'select' || tag === 'textarea';
|
|
352
|
+
}
|
|
403
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));
|
|
404
368
|
|
|
369
|
+
default:
|
|
370
|
+
return false;
|
|
371
|
+
}
|
|
372
|
+
}
|
|
405
373
|
/**
|
|
406
|
-
*
|
|
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.
|
|
407
377
|
*/
|
|
408
378
|
|
|
409
379
|
|
|
410
|
-
|
|
411
|
-
|
|
412
|
-
|
|
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
|
|
413
383
|
|
|
384
|
+
var stateNode = inst.stateNode;
|
|
414
385
|
|
|
415
|
-
|
|
416
|
-
|
|
417
|
-
|
|
386
|
+
if (!stateNode) {
|
|
387
|
+
// Work in progress (ex: onload events in incremental mode).
|
|
388
|
+
return null;
|
|
389
|
+
}
|
|
418
390
|
|
|
391
|
+
var props = getFiberCurrentPropsFromNode(stateNode);
|
|
419
392
|
|
|
420
|
-
|
|
421
|
-
|
|
422
|
-
|
|
423
|
-
|
|
424
|
-
* @type {Object}
|
|
425
|
-
*/
|
|
393
|
+
if (!props) {
|
|
394
|
+
// Work in progress.
|
|
395
|
+
return null;
|
|
396
|
+
}
|
|
426
397
|
|
|
427
|
-
|
|
398
|
+
listener = props[registrationName];
|
|
428
399
|
|
|
429
|
-
|
|
430
|
-
|
|
431
|
-
|
|
432
|
-
* always deterministic regardless of packaging, on-the-fly injection, etc.
|
|
433
|
-
*
|
|
434
|
-
* @param {array} InjectedEventPluginOrder
|
|
435
|
-
* @internal
|
|
436
|
-
* @see {EventPluginHub.injection.injectEventPluginOrder}
|
|
437
|
-
*/
|
|
400
|
+
if (shouldPreventMouseEvent(registrationName, inst.type, props)) {
|
|
401
|
+
return null;
|
|
402
|
+
}
|
|
438
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
|
+
}
|
|
439
409
|
|
|
440
|
-
|
|
441
|
-
|
|
442
|
-
* in the ordering injected by `injectEventPluginOrder`.
|
|
443
|
-
*
|
|
444
|
-
* Plugins can be injected as part of page initialization or on-the-fly.
|
|
445
|
-
*
|
|
446
|
-
* @param {object} injectedNamesToPlugins Map from names to plugin modules.
|
|
447
|
-
* @internal
|
|
448
|
-
* @see {EventPluginHub.injection.injectEventPluginsByName}
|
|
449
|
-
*/
|
|
410
|
+
return listener;
|
|
411
|
+
}
|
|
450
412
|
|
|
451
413
|
/**
|
|
452
414
|
* Accumulates items that must not be null or undefined into the first one. This
|
|
@@ -464,7 +426,7 @@ function traverseTwoPhase(inst, fn, arg) {
|
|
|
464
426
|
function accumulateInto(current, next) {
|
|
465
427
|
if (!(next != null)) {
|
|
466
428
|
{
|
|
467
|
-
throw Error("accumulateInto(...): Accumulated items must not be null or undefined.");
|
|
429
|
+
throw Error( "accumulateInto(...): Accumulated items must not be null or undefined." );
|
|
468
430
|
}
|
|
469
431
|
}
|
|
470
432
|
|
|
@@ -509,96 +471,6 @@ function forEachAccumulated(arr, cb, scope) {
|
|
|
509
471
|
}
|
|
510
472
|
}
|
|
511
473
|
|
|
512
|
-
function isInteractive(tag) {
|
|
513
|
-
return tag === 'button' || tag === 'input' || tag === 'select' || tag === 'textarea';
|
|
514
|
-
}
|
|
515
|
-
|
|
516
|
-
function shouldPreventMouseEvent(name, type, props) {
|
|
517
|
-
switch (name) {
|
|
518
|
-
case 'onClick':
|
|
519
|
-
case 'onClickCapture':
|
|
520
|
-
case 'onDoubleClick':
|
|
521
|
-
case 'onDoubleClickCapture':
|
|
522
|
-
case 'onMouseDown':
|
|
523
|
-
case 'onMouseDownCapture':
|
|
524
|
-
case 'onMouseMove':
|
|
525
|
-
case 'onMouseMoveCapture':
|
|
526
|
-
case 'onMouseUp':
|
|
527
|
-
case 'onMouseUpCapture':
|
|
528
|
-
return !!(props.disabled && isInteractive(type));
|
|
529
|
-
|
|
530
|
-
default:
|
|
531
|
-
return false;
|
|
532
|
-
}
|
|
533
|
-
}
|
|
534
|
-
/**
|
|
535
|
-
* This is a unified interface for event plugins to be installed and configured.
|
|
536
|
-
*
|
|
537
|
-
* Event plugins can implement the following properties:
|
|
538
|
-
*
|
|
539
|
-
* `extractEvents` {function(string, DOMEventTarget, string, object): *}
|
|
540
|
-
* Required. When a top-level event is fired, this method is expected to
|
|
541
|
-
* extract synthetic events that will in turn be queued and dispatched.
|
|
542
|
-
*
|
|
543
|
-
* `eventTypes` {object}
|
|
544
|
-
* Optional, plugins that fire events must publish a mapping of registration
|
|
545
|
-
* names that are used to register listeners. Values of this mapping must
|
|
546
|
-
* be objects that contain `registrationName` or `phasedRegistrationNames`.
|
|
547
|
-
*
|
|
548
|
-
* `executeDispatch` {function(object, function, string)}
|
|
549
|
-
* Optional, allows plugins to override how an event gets dispatched. By
|
|
550
|
-
* default, the listener is simply invoked.
|
|
551
|
-
*
|
|
552
|
-
* Each plugin that is injected into `EventsPluginHub` is immediately operable.
|
|
553
|
-
*
|
|
554
|
-
* @public
|
|
555
|
-
*/
|
|
556
|
-
|
|
557
|
-
/**
|
|
558
|
-
* Methods for injecting dependencies.
|
|
559
|
-
*/
|
|
560
|
-
|
|
561
|
-
|
|
562
|
-
|
|
563
|
-
/**
|
|
564
|
-
* @param {object} inst The instance, which is the source of events.
|
|
565
|
-
* @param {string} registrationName Name of listener (e.g. `onClick`).
|
|
566
|
-
* @return {?function} The stored callback.
|
|
567
|
-
*/
|
|
568
|
-
|
|
569
|
-
function getListener(inst, registrationName) {
|
|
570
|
-
var listener; // TODO: shouldPreventMouseEvent is DOM-specific and definitely should not
|
|
571
|
-
// live here; needs to be moved to a better place soon
|
|
572
|
-
|
|
573
|
-
var stateNode = inst.stateNode;
|
|
574
|
-
|
|
575
|
-
if (!stateNode) {
|
|
576
|
-
// Work in progress (ex: onload events in incremental mode).
|
|
577
|
-
return null;
|
|
578
|
-
}
|
|
579
|
-
|
|
580
|
-
var props = getFiberCurrentPropsFromNode$1(stateNode);
|
|
581
|
-
|
|
582
|
-
if (!props) {
|
|
583
|
-
// Work in progress.
|
|
584
|
-
return null;
|
|
585
|
-
}
|
|
586
|
-
|
|
587
|
-
listener = props[registrationName];
|
|
588
|
-
|
|
589
|
-
if (shouldPreventMouseEvent(registrationName, inst.type, props)) {
|
|
590
|
-
return null;
|
|
591
|
-
}
|
|
592
|
-
|
|
593
|
-
if (!(!listener || typeof listener === 'function')) {
|
|
594
|
-
{
|
|
595
|
-
throw Error("Expected `" + registrationName + "` listener to be a function, instead got a value of `" + typeof listener + "` type.");
|
|
596
|
-
}
|
|
597
|
-
}
|
|
598
|
-
|
|
599
|
-
return listener;
|
|
600
|
-
}
|
|
601
|
-
|
|
602
474
|
/**
|
|
603
475
|
* Some event types have a notion of different registration names for different
|
|
604
476
|
* "phases" of propagation. This finds listeners by a given phase.
|
|
@@ -627,7 +499,9 @@ function listenerAtPhase(inst, event, propagationPhase) {
|
|
|
627
499
|
|
|
628
500
|
function accumulateDirectionalDispatches(inst, phase, event) {
|
|
629
501
|
{
|
|
630
|
-
|
|
502
|
+
if (!inst) {
|
|
503
|
+
error('Dispatching inst must not be null');
|
|
504
|
+
}
|
|
631
505
|
}
|
|
632
506
|
|
|
633
507
|
var listener = listenerAtPhase(inst, event, phase);
|
|
@@ -700,12 +574,10 @@ function accumulateTwoPhaseDispatches(events) {
|
|
|
700
574
|
function accumulateTwoPhaseDispatchesSkipTarget(events) {
|
|
701
575
|
forEachAccumulated(events, accumulateTwoPhaseDispatchesSingleSkipTarget);
|
|
702
576
|
}
|
|
703
|
-
|
|
704
577
|
function accumulateDirectDispatches(events) {
|
|
705
578
|
forEachAccumulated(events, accumulateDirectDispatchesSingle);
|
|
706
579
|
}
|
|
707
580
|
|
|
708
|
-
/* eslint valid-typeof: 0 */
|
|
709
581
|
var EVENT_POOL_SIZE = 10;
|
|
710
582
|
/**
|
|
711
583
|
* @interface Event
|
|
@@ -947,8 +819,9 @@ function getPooledWarningPropertyDefinition(propName, getVal) {
|
|
|
947
819
|
}
|
|
948
820
|
|
|
949
821
|
function warn(action, result) {
|
|
950
|
-
|
|
951
|
-
|
|
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
|
+
}
|
|
952
825
|
}
|
|
953
826
|
}
|
|
954
827
|
|
|
@@ -969,7 +842,7 @@ function releasePooledEvent(event) {
|
|
|
969
842
|
|
|
970
843
|
if (!(event instanceof EventConstructor)) {
|
|
971
844
|
{
|
|
972
|
-
throw Error("Trying to release an event instance into a pool of a different type.");
|
|
845
|
+
throw Error( "Trying to release an event instance into a pool of a different type." );
|
|
973
846
|
}
|
|
974
847
|
}
|
|
975
848
|
|
|
@@ -1085,12 +958,14 @@ function getTouchIdentifier(_ref) {
|
|
|
1085
958
|
|
|
1086
959
|
if (!(identifier != null)) {
|
|
1087
960
|
{
|
|
1088
|
-
throw Error("Touch object is missing identifier.");
|
|
961
|
+
throw Error( "Touch object is missing identifier." );
|
|
1089
962
|
}
|
|
1090
963
|
}
|
|
1091
964
|
|
|
1092
965
|
{
|
|
1093
|
-
|
|
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
|
+
}
|
|
1094
969
|
}
|
|
1095
970
|
|
|
1096
971
|
return identifier;
|
|
@@ -1122,7 +997,9 @@ function recordTouchMove(touch) {
|
|
|
1122
997
|
touchRecord.currentTimeStamp = timestampForTouch(touch);
|
|
1123
998
|
touchHistory.mostRecentTimeStamp = timestampForTouch(touch);
|
|
1124
999
|
} else {
|
|
1125
|
-
|
|
1000
|
+
{
|
|
1001
|
+
warn('Cannot record touch move without a touch start.\n' + 'Touch Move: %s\n' + 'Touch Bank: %s', printTouch(touch), printTouchBank());
|
|
1002
|
+
}
|
|
1126
1003
|
}
|
|
1127
1004
|
}
|
|
1128
1005
|
|
|
@@ -1139,7 +1016,9 @@ function recordTouchEnd(touch) {
|
|
|
1139
1016
|
touchRecord.currentTimeStamp = timestampForTouch(touch);
|
|
1140
1017
|
touchHistory.mostRecentTimeStamp = timestampForTouch(touch);
|
|
1141
1018
|
} else {
|
|
1142
|
-
|
|
1019
|
+
{
|
|
1020
|
+
warn('Cannot record touch end without a touch start.\n' + 'Touch End: %s\n' + 'Touch Bank: %s', printTouch(touch), printTouchBank());
|
|
1021
|
+
}
|
|
1143
1022
|
}
|
|
1144
1023
|
}
|
|
1145
1024
|
|
|
@@ -1189,7 +1068,10 @@ var ResponderTouchHistoryStore = {
|
|
|
1189
1068
|
|
|
1190
1069
|
{
|
|
1191
1070
|
var activeRecord = touchBank[touchHistory.indexOfSingleActiveTouch];
|
|
1192
|
-
|
|
1071
|
+
|
|
1072
|
+
if (activeRecord == null || !activeRecord.touchActive) {
|
|
1073
|
+
error('Cannot find single active touch.');
|
|
1074
|
+
}
|
|
1193
1075
|
}
|
|
1194
1076
|
}
|
|
1195
1077
|
}
|
|
@@ -1208,7 +1090,7 @@ var ResponderTouchHistoryStore = {
|
|
|
1208
1090
|
function accumulate(current, next) {
|
|
1209
1091
|
if (!(next != null)) {
|
|
1210
1092
|
{
|
|
1211
|
-
throw Error("accumulate(...): Accumulated items must not be null or undefined.");
|
|
1093
|
+
throw Error( "accumulate(...): Accumulated items must not be null or undefined." );
|
|
1212
1094
|
}
|
|
1213
1095
|
}
|
|
1214
1096
|
|
|
@@ -1475,7 +1357,7 @@ to return true:wantsResponderID| |
|
|
|
1475
1357
|
+ + */
|
|
1476
1358
|
|
|
1477
1359
|
/**
|
|
1478
|
-
* A note about event ordering in the `
|
|
1360
|
+
* A note about event ordering in the `EventPluginRegistry`.
|
|
1479
1361
|
*
|
|
1480
1362
|
* Suppose plugins are injected in the following order:
|
|
1481
1363
|
*
|
|
@@ -1494,7 +1376,7 @@ to return true:wantsResponderID| |
|
|
|
1494
1376
|
* - When returned from `extractEvents`, deferred-dispatched events contain an
|
|
1495
1377
|
* "accumulation" of deferred dispatches.
|
|
1496
1378
|
* - These deferred dispatches are accumulated/collected before they are
|
|
1497
|
-
* returned, but processed at a later time by the `
|
|
1379
|
+
* returned, but processed at a later time by the `EventPluginRegistry` (hence the
|
|
1498
1380
|
* name deferred).
|
|
1499
1381
|
*
|
|
1500
1382
|
* In the process of returning their deferred-dispatched events, event plugins
|
|
@@ -1518,9 +1400,9 @@ to return true:wantsResponderID| |
|
|
|
1518
1400
|
* - `R`s on-demand events (if any) (dispatched by `R` on-demand)
|
|
1519
1401
|
* - `S`s on-demand events (if any) (dispatched by `S` on-demand)
|
|
1520
1402
|
* - `C`s on-demand events (if any) (dispatched by `C` on-demand)
|
|
1521
|
-
* - `R`s extracted events (if any) (dispatched by `
|
|
1522
|
-
* - `S`s extracted events (if any) (dispatched by `
|
|
1523
|
-
* - `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`)
|
|
1524
1406
|
*
|
|
1525
1407
|
* In the case of `ResponderEventPlugin`: If the `startShouldSetResponder`
|
|
1526
1408
|
* on-demand dispatch returns `true` (and some other details are satisfied) the
|
|
@@ -1529,9 +1411,9 @@ to return true:wantsResponderID| |
|
|
|
1529
1411
|
* will appear as follows:
|
|
1530
1412
|
*
|
|
1531
1413
|
* - `startShouldSetResponder` (`ResponderEventPlugin` dispatches on-demand)
|
|
1532
|
-
* - `touchStartCapture` (`
|
|
1533
|
-
* - `touchStart` (`
|
|
1534
|
-
* - `responderGrant/Reject` (`
|
|
1414
|
+
* - `touchStartCapture` (`EventPluginRegistry` dispatches as usual)
|
|
1415
|
+
* - `touchStart` (`EventPluginRegistry` dispatches as usual)
|
|
1416
|
+
* - `responderGrant/Reject` (`EventPluginRegistry` dispatches as usual)
|
|
1535
1417
|
*/
|
|
1536
1418
|
|
|
1537
1419
|
function setResponderAndExtractTransfer(topLevelType, targetInst, nativeEvent, nativeEventTarget) {
|
|
@@ -1635,7 +1517,7 @@ function noResponderTouches(nativeEvent) {
|
|
|
1635
1517
|
|
|
1636
1518
|
if (target !== null && target !== undefined && target !== 0) {
|
|
1637
1519
|
// Is the original touch location inside of the current responder?
|
|
1638
|
-
var targetInst = getInstanceFromNode
|
|
1520
|
+
var targetInst = getInstanceFromNode(target);
|
|
1639
1521
|
|
|
1640
1522
|
if (isAncestor(responderInst, targetInst)) {
|
|
1641
1523
|
return false;
|
|
@@ -1665,7 +1547,10 @@ var ResponderEventPlugin = {
|
|
|
1665
1547
|
if (trackedTouchCount >= 0) {
|
|
1666
1548
|
trackedTouchCount -= 1;
|
|
1667
1549
|
} else {
|
|
1668
|
-
|
|
1550
|
+
{
|
|
1551
|
+
warn('Ended a touch event which was not counted in `trackedTouchCount`.');
|
|
1552
|
+
}
|
|
1553
|
+
|
|
1669
1554
|
return null;
|
|
1670
1555
|
}
|
|
1671
1556
|
}
|
|
@@ -1723,18 +1608,18 @@ var ResponderEventPlugin = {
|
|
|
1723
1608
|
|
|
1724
1609
|
// Keep in sync with ReactDOM.js, ReactTestUtils.js, and ReactTestUtilsAct.js:
|
|
1725
1610
|
|
|
1726
|
-
var _ReactDOM$__SECRET_IN = ReactDOM.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.Events
|
|
1727
|
-
|
|
1728
|
-
|
|
1729
|
-
|
|
1730
|
-
|
|
1731
|
-
setComponentTree(getFiberCurrentPropsFromNode, getInstanceFromNode, getNodeFromInstance);
|
|
1732
|
-
|
|
1733
|
-
|
|
1734
|
-
|
|
1735
|
-
|
|
1736
|
-
|
|
1737
|
-
|
|
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
|
|
1738
1623
|
});
|
|
1739
1624
|
|
|
1740
1625
|
var unstableNativeDependencies = ReactDOMUnstableNativeDependencies;
|