@samitouri / QOS-React / commits / 125d1a19a2

Move event things around (#19433)

* Put all synthetic events in one file * Inline other helpers * Remove Modern from filenames

Dan Abramov committed Jul 22, 2020 at 22:12 UTC 125d1a19a211c51d5ee52ec0c1cc1f538eb44d5c
29 files changed +441 -594
packages/react-dom/src/client/ReactDOMComponent.js
+1 -1
@@ -89,7 +89,7 @@ import {
89 listenToReactEvent,
90 mediaEventTypes,
91 listenToNonDelegatedEvent,
92 -} from '../events/DOMModernPluginEventSystem';
92 +} from '../events/DOMPluginEventSystem';
93 import {getEventListenerMap} from './ReactDOMComponentTree';
94 import {
95 TOP_LOAD,
packages/react-dom/src/client/ReactDOMEventHandle.js
+1 -1
@@ -25,7 +25,7 @@ import {ELEMENT_NODE, COMMENT_NODE} from '../shared/HTMLNodeType';
25 import {
26 listenToNativeEvent,
27 addEventTypeToDispatchConfig,
28 -} from '../events/DOMModernPluginEventSystem';
28 +} from '../events/DOMPluginEventSystem';
29
30 import {HostRoot, HostPortal} from 'react-reconciler/src/ReactWorkTags';
31 import {
packages/react-dom/src/client/ReactDOMHostConfig.js
+1 -1
@@ -80,7 +80,7 @@ import {
80 } from 'shared/ReactFeatureFlags';
81 import {HostComponent, HostText} from 'react-reconciler/src/ReactWorkTags';
82 import {TOP_BEFORE_BLUR, TOP_AFTER_BLUR} from '../events/DOMTopLevelEventTypes';
83 -import {listenToReactEvent} from '../events/DOMModernPluginEventSystem';
83 +import {listenToReactEvent} from '../events/DOMPluginEventSystem';
84
85 export type Type = string;
86 export type Props = {
packages/react-dom/src/events/DOMPluginEventSystem.js renamed
+20 -20
@@ -99,11 +99,11 @@ import {
99 } from './EventListener';
100 import {removeTrappedEventListener} from './DeprecatedDOMEventResponderSystem';
101 import {topLevelEventsToReactNames} from './DOMEventProperties';
102 -import * as ModernBeforeInputEventPlugin from './plugins/ModernBeforeInputEventPlugin';
103 -import * as ModernChangeEventPlugin from './plugins/ModernChangeEventPlugin';
104 -import * as ModernEnterLeaveEventPlugin from './plugins/ModernEnterLeaveEventPlugin';
105 -import * as ModernSelectEventPlugin from './plugins/ModernSelectEventPlugin';
106 -import * as ModernSimpleEventPlugin from './plugins/ModernSimpleEventPlugin';
102 +import * as BeforeInputEventPlugin from './plugins/BeforeInputEventPlugin';
103 +import * as ChangeEventPlugin from './plugins/ChangeEventPlugin';
104 +import * as EnterLeaveEventPlugin from './plugins/EnterLeaveEventPlugin';
105 +import * as SelectEventPlugin from './plugins/SelectEventPlugin';
106 +import * as SimpleEventPlugin from './plugins/SimpleEventPlugin';
107
108 type DispatchListener = {|
109 instance: null | Fiber,
@@ -119,11 +119,11 @@ type DispatchEntry = {|
119 export type DispatchQueue = Array<DispatchEntry>;
120
121 // TODO: remove top-level side effect.
122 -ModernSimpleEventPlugin.registerEvents();
123 -ModernEnterLeaveEventPlugin.registerEvents();
124 -ModernChangeEventPlugin.registerEvents();
125 -ModernSelectEventPlugin.registerEvents();
126 -ModernBeforeInputEventPlugin.registerEvents();
122 +SimpleEventPlugin.registerEvents();
123 +EnterLeaveEventPlugin.registerEvents();
124 +ChangeEventPlugin.registerEvents();
125 +SelectEventPlugin.registerEvents();
126 +BeforeInputEventPlugin.registerEvents();
127
128 function extractEvents(
129 dispatchQueue: DispatchQueue,
@@ -140,7 +140,7 @@ function extractEvents(
140 // should probably be inlined somewhere and have its logic
141 // be core the to event system. This would potentially allow
142 // us to ship builds of React without the polyfilled plugins below.
143 - ModernSimpleEventPlugin.extractEvents(
143 + SimpleEventPlugin.extractEvents(
144 dispatchQueue,
145 topLevelType,
146 targetInst,
@@ -169,7 +169,7 @@ function extractEvents(
169 // that might cause other unknown side-effects that we
170 // can't forsee right now.
171 if (shouldProcessPolyfillPlugins) {
172 - ModernEnterLeaveEventPlugin.extractEvents(
172 + EnterLeaveEventPlugin.extractEvents(
173 dispatchQueue,
174 topLevelType,
175 targetInst,
@@ -178,7 +178,7 @@ function extractEvents(
178 eventSystemFlags,
179 targetContainer,
180 );
181 - ModernChangeEventPlugin.extractEvents(
181 + ChangeEventPlugin.extractEvents(
182 dispatchQueue,
183 topLevelType,
184 targetInst,
@@ -187,7 +187,7 @@ function extractEvents(
187 eventSystemFlags,
188 targetContainer,
189 );
190 - ModernSelectEventPlugin.extractEvents(
190 + SelectEventPlugin.extractEvents(
191 dispatchQueue,
192 topLevelType,
193 targetInst,
@@ -196,7 +196,7 @@ function extractEvents(
196 eventSystemFlags,
197 targetContainer,
198 );
199 - ModernBeforeInputEventPlugin.extractEvents(
199 + BeforeInputEventPlugin.extractEvents(
200 dispatchQueue,
201 topLevelType,
202 targetInst,
@@ -297,7 +297,7 @@ export function processDispatchQueue(
297 for (let i = 0; i < dispatchQueue.length; i++) {
298 const {event, listeners} = dispatchQueue[i];
299 processDispatchQueueItemsInOrder(event, listeners, inCapturePhase);
300 - // Modern event system doesn't use pooling.
300 + // event system doesn't use pooling.
301 }
302 // This would be a good time to rethrow if any of the event handlers threw.
303 rethrowCaughtError();
@@ -816,9 +816,9 @@ export function accumulateSinglePhaseListeners(
816 }
817
818 // We should only use this function for:
819 -// - ModernBeforeInputEventPlugin
820 -// - ModernChangeEventPlugin
821 -// - ModernSelectEventPlugin
819 +// - BeforeInputEventPlugin
820 +// - ChangeEventPlugin
821 +// - SelectEventPlugin
822 // This is because we only process these plugins
823 // in the bubble phase, so we need to accumulate two
824 // phase event listeners (via emulation).
@@ -969,7 +969,7 @@ function accumulateEnterLeaveListenersForEvent(
969 }
970
971 // We should only use this function for:
972 -// - ModernEnterLeaveEventPlugin
972 +// - EnterLeaveEventPlugin
973 // This is because we only process this plugin
974 // in the bubble phase, so we need to accumulate two
975 // phase event listeners.
packages/react-dom/src/events/ReactDOMEventListener.js
+1 -1
@@ -51,7 +51,7 @@ import {
51 DiscreteEvent,
52 } from 'shared/ReactTypes';
53 import {getEventPriorityForPluginSystem} from './DOMEventProperties';
54 -import {dispatchEventForPluginEventSystem} from './DOMModernPluginEventSystem';
54 +import {dispatchEventForPluginEventSystem} from './DOMPluginEventSystem';
55 import {
56 flushDiscreteUpdatesIfNeeded,
57 discreteUpdates,
packages/react-dom/src/events/ReactDOMEventReplaying.js
+1 -1
@@ -128,7 +128,7 @@ import {
128 TOP_FOCUS_OUT,
129 } from './DOMTopLevelEventTypes';
130 import {IS_REPLAYED} from './EventSystemFlags';
131 -import {listenToNativeEvent} from './DOMModernPluginEventSystem';
131 +import {listenToNativeEvent} from './DOMPluginEventSystem';
132 import {addResponderEventSystemEvent} from './DeprecatedDOMEventResponderSystem';
133
134 type QueuedReplayableEvent = {|
packages/react-dom/src/events/SyntheticAnimationEvent.js deleted
-21
@@ -1,21 +0,0 @@
1 -/**
2 - * Copyright (c) Facebook, Inc. and its affiliates.
3 - *
4 - * This source code is licensed under the MIT license found in the
5 - * LICENSE file in the root directory of this source tree.
6 - */
7 -
8 -import SyntheticEvent from '../events/SyntheticEvent';
9 -
10 -/**
11 - * @interface Event
12 - * @see http://www.w3.org/TR/css3-animations/#AnimationEvent-interface
13 - * @see https://developer.mozilla.org/en-US/docs/Web/API/AnimationEvent
14 - */
15 -const SyntheticAnimationEvent = SyntheticEvent.extend({
16 - animationName: null,
17 - elapsedTime: null,
18 - pseudoElement: null,
19 -});
20 -
21 -export default SyntheticAnimationEvent;
packages/react-dom/src/events/SyntheticClipboardEvent.js deleted
-22
@@ -1,22 +0,0 @@
1 -/**
2 - * Copyright (c) Facebook, Inc. and its affiliates.
3 - *
4 - * This source code is licensed under the MIT license found in the
5 - * LICENSE file in the root directory of this source tree.
6 - */
7 -
8 -import SyntheticEvent from '../events/SyntheticEvent';
9 -
10 -/**
11 - * @interface Event
12 - * @see http://www.w3.org/TR/clipboard-apis/
13 - */
14 -const SyntheticClipboardEvent = SyntheticEvent.extend({
15 - clipboardData: function(event) {
16 - return 'clipboardData' in event
17 - ? event.clipboardData
18 - : window.clipboardData;
19 - },
20 -});
21 -
22 -export default SyntheticClipboardEvent;
packages/react-dom/src/events/SyntheticCompositionEvent.js deleted
-18
@@ -1,18 +0,0 @@
1 -/**
2 - * Copyright (c) Facebook, Inc. and its affiliates.
3 - *
4 - * This source code is licensed under the MIT license found in the
5 - * LICENSE file in the root directory of this source tree.
6 - */
7 -
8 -import SyntheticEvent from '../events/SyntheticEvent';
9 -
10 -/**
11 - * @interface Event
12 - * @see http://www.w3.org/TR/DOM-Level-3-Events/#events-compositionevents
13 - */
14 -const SyntheticCompositionEvent = SyntheticEvent.extend({
15 - data: null,
16 -});
17 -
18 -export default SyntheticCompositionEvent;
packages/react-dom/src/events/SyntheticDragEvent.js deleted
-18
@@ -1,18 +0,0 @@
1 -/**
2 - * Copyright (c) Facebook, Inc. and its affiliates.
3 - *
4 - * This source code is licensed under the MIT license found in the
5 - * LICENSE file in the root directory of this source tree.
6 - */
7 -
8 -import SyntheticMouseEvent from './SyntheticMouseEvent';
9 -
10 -/**
11 - * @interface DragEvent
12 - * @see http://www.w3.org/TR/DOM-Level-3-Events/
13 - */
14 -const SyntheticDragEvent = SyntheticMouseEvent.extend({
15 - dataTransfer: null,
16 -});
17 -
18 -export default SyntheticDragEvent;
packages/react-dom/src/events/SyntheticEvent.js
+385 -2
@@ -7,6 +7,8 @@
7
8 /* eslint valid-typeof: 0 */
9
10 +import getEventCharCode from './getEventCharCode';
11 +
12 /**
13 * @interface Event
14 * @see http://www.w3.org/TR/DOM-Level-3-Events/
@@ -49,7 +51,12 @@ function functionThatReturnsFalse() {
51 * normalizing browser quirks. Subclasses do not necessarily have to implement a
52 * DOM interface; custom application-specific events can also subclass this.
53 */
52 -function SyntheticEvent(reactName, targetInst, nativeEvent, nativeEventTarget) {
54 +export function SyntheticEvent(
55 + reactName,
56 + targetInst,
57 + nativeEvent,
58 + nativeEventTarget,
59 +) {
60 this._reactName = reactName;
61 this._targetInst = targetInst;
62 this.nativeEvent = nativeEvent;
@@ -162,4 +169,380 @@ SyntheticEvent.extend = function(Interface) {
169 return Class;
170 };
171
165 -export default SyntheticEvent;
172 +export const SyntheticUIEvent = SyntheticEvent.extend({
173 + view: null,
174 + detail: null,
175 +});
176 +
177 +let previousScreenX = 0;
178 +let previousScreenY = 0;
179 +// Use flags to signal movementX/Y has already been set
180 +let isMovementXSet = false;
181 +let isMovementYSet = false;
182 +
183 +/**
184 + * @interface MouseEvent
185 + * @see http://www.w3.org/TR/DOM-Level-3-Events/
186 + */
187 +export const SyntheticMouseEvent = SyntheticUIEvent.extend({
188 + screenX: null,
189 + screenY: null,
190 + clientX: null,
191 + clientY: null,
192 + pageX: null,
193 + pageY: null,
194 + ctrlKey: null,
195 + shiftKey: null,
196 + altKey: null,
197 + metaKey: null,
198 + getModifierState: getEventModifierState,
199 + button: null,
200 + buttons: null,
201 + relatedTarget: function(event) {
202 + return (
203 + event.relatedTarget ||
204 + (event.fromElement === event.srcElement
205 + ? event.toElement
206 + : event.fromElement)
207 + );
208 + },
209 + movementX: function(event) {
210 + if ('movementX' in event) {
211 + return event.movementX;
212 + }
213 +
214 + const screenX = previousScreenX;
215 + previousScreenX = event.screenX;
216 +
217 + if (!isMovementXSet) {
218 + isMovementXSet = true;
219 + return 0;
220 + }
221 +
222 + return event.type === 'mousemove' ? event.screenX - screenX : 0;
223 + },
224 + movementY: function(event) {
225 + if ('movementY' in event) {
226 + return event.movementY;
227 + }
228 +
229 + const screenY = previousScreenY;
230 + previousScreenY = event.screenY;
231 +
232 + if (!isMovementYSet) {
233 + isMovementYSet = true;
234 + return 0;
235 + }
236 +
237 + return event.type === 'mousemove' ? event.screenY - screenY : 0;
238 + },
239 +});
240 +
241 +/**
242 + * @interface DragEvent
243 + * @see http://www.w3.org/TR/DOM-Level-3-Events/
244 + */
245 +export const SyntheticDragEvent = SyntheticMouseEvent.extend({
246 + dataTransfer: null,
247 +});
248 +
249 +/**
250 + * @interface FocusEvent
251 + * @see http://www.w3.org/TR/DOM-Level-3-Events/
252 + */
253 +export const SyntheticFocusEvent = SyntheticUIEvent.extend({
254 + relatedTarget: null,
255 +});
256 +
257 +/**
258 + * @interface Event
259 + * @see http://www.w3.org/TR/css3-animations/#AnimationEvent-interface
260 + * @see https://developer.mozilla.org/en-US/docs/Web/API/AnimationEvent
261 + */
262 +export const SyntheticAnimationEvent = SyntheticEvent.extend({
263 + animationName: null,
264 + elapsedTime: null,
265 + pseudoElement: null,
266 +});
267 +
268 +/**
269 + * @interface Event
270 + * @see http://www.w3.org/TR/clipboard-apis/
271 + */
272 +export const SyntheticClipboardEvent = SyntheticEvent.extend({
273 + clipboardData: function(event) {
274 + return 'clipboardData' in event
275 + ? event.clipboardData
276 + : window.clipboardData;
277 + },
278 +});
279 +
280 +/**
281 + * @interface Event
282 + * @see http://www.w3.org/TR/DOM-Level-3-Events/#events-compositionevents
283 + */
284 +export const SyntheticCompositionEvent = SyntheticEvent.extend({
285 + data: null,
286 +});
287 +
288 +/**
289 + * @interface Event
290 + * @see http://www.w3.org/TR/2013/WD-DOM-Level-3-Events-20131105
291 + * /#events-inputevents
292 + */
293 +export const SyntheticInputEvent = SyntheticEvent.extend({
294 + data: null,
295 +});
296 +
297 +/**
298 + * Normalization of deprecated HTML5 `key` values
299 + * @see https://developer.mozilla.org/en-US/docs/Web/API/KeyboardEvent#Key_names
300 + */
301 +const normalizeKey = {
302 + Esc: 'Escape',
303 + Spacebar: ' ',
304 + Left: 'ArrowLeft',
305 + Up: 'ArrowUp',
306 + Right: 'ArrowRight',
307 + Down: 'ArrowDown',
308 + Del: 'Delete',
309 + Win: 'OS',
310 + Menu: 'ContextMenu',
311 + Apps: 'ContextMenu',
312 + Scroll: 'ScrollLock',
313 + MozPrintableKey: 'Unidentified',
314 +};
315 +
316 +/**
317 + * Translation from legacy `keyCode` to HTML5 `key`
318 + * Only special keys supported, all others depend on keyboard layout or browser
319 + * @see https://developer.mozilla.org/en-US/docs/Web/API/KeyboardEvent#Key_names
320 + */
321 +const translateToKey = {
322 + '8': 'Backspace',
323 + '9': 'Tab',
324 + '12': 'Clear',
325 + '13': 'Enter',
326 + '16': 'Shift',
327 + '17': 'Control',
328 + '18': 'Alt',
329 + '19': 'Pause',
330 + '20': 'CapsLock',
331 + '27': 'Escape',
332 + '32': ' ',
333 + '33': 'PageUp',
334 + '34': 'PageDown',
335 + '35': 'End',
336 + '36': 'Home',
337 + '37': 'ArrowLeft',
338 + '38': 'ArrowUp',
339 + '39': 'ArrowRight',
340 + '40': 'ArrowDown',
341 + '45': 'Insert',
342 + '46': 'Delete',
343 + '112': 'F1',
344 + '113': 'F2',
345 + '114': 'F3',
346 + '115': 'F4',
347 + '116': 'F5',
348 + '117': 'F6',
349 + '118': 'F7',
350 + '119': 'F8',
351 + '120': 'F9',
352 + '121': 'F10',
353 + '122': 'F11',
354 + '123': 'F12',
355 + '144': 'NumLock',
356 + '145': 'ScrollLock',
357 + '224': 'Meta',
358 +};
359 +
360 +/**
361 + * @param {object} nativeEvent Native browser event.
362 + * @return {string} Normalized `key` property.
363 + */
364 +function getEventKey(nativeEvent) {
365 + if (nativeEvent.key) {
366 + // Normalize inconsistent values reported by browsers due to
367 + // implementations of a working draft specification.
368 +
369 + // FireFox implements `key` but returns `MozPrintableKey` for all
370 + // printable characters (normalized to `Unidentified`), ignore it.
371 + const key = normalizeKey[nativeEvent.key] || nativeEvent.key;
372 + if (key !== 'Unidentified') {
373 + return key;
374 + }
375 + }
376 +
377 + // Browser does not implement `key`, polyfill as much of it as we can.
378 + if (nativeEvent.type === 'keypress') {
379 + const charCode = getEventCharCode(nativeEvent);
380 +
381 + // The enter-key is technically both printable and non-printable and can
382 + // thus be captured by `keypress`, no other non-printable key should.
383 + return charCode === 13 ? 'Enter' : String.fromCharCode(charCode);
384 + }
385 + if (nativeEvent.type === 'keydown' || nativeEvent.type === 'keyup') {
386 + // While user keyboard layout determines the actual meaning of each
387 + // `keyCode` value, almost all function keys have a universal value.
388 + return translateToKey[nativeEvent.keyCode] || 'Unidentified';
389 + }
390 + return '';
391 +}
392 +
393 +/**
394 + * Translation from modifier key to the associated property in the event.
395 + * @see http://www.w3.org/TR/DOM-Level-3-Events/#keys-Modifiers
396 + */
397 +const modifierKeyToProp = {
398 + Alt: 'altKey',
399 + Control: 'ctrlKey',
400 + Meta: 'metaKey',
401 + Shift: 'shiftKey',
402 +};
403 +
404 +// Older browsers (Safari <= 10, iOS Safari <= 10.2) do not support
405 +// getModifierState. If getModifierState is not supported, we map it to a set of
406 +// modifier keys exposed by the event. In this case, Lock-keys are not supported.
407 +function modifierStateGetter(keyArg) {
408 + const syntheticEvent = this;
409 + const nativeEvent = syntheticEvent.nativeEvent;
410 + if (nativeEvent.getModifierState) {
411 + return nativeEvent.getModifierState(keyArg);
412 + }
413 + const keyProp = modifierKeyToProp[keyArg];
414 + return keyProp ? !!nativeEvent[keyProp] : false;
415 +}
416 +
417 +function getEventModifierState(nativeEvent) {
418 + return modifierStateGetter;
419 +}
420 +
421 +/**
422 + * @interface KeyboardEvent
423 + * @see http://www.w3.org/TR/DOM-Level-3-Events/
424 + */
425 +export const SyntheticKeyboardEvent = SyntheticUIEvent.extend({
426 + key: getEventKey,
427 + code: null,
428 + location: null,
429 + ctrlKey: null,
430 + shiftKey: null,
431 + altKey: null,
432 + metaKey: null,
433 + repeat: null,
434 + locale: null,
435 + getModifierState: getEventModifierState,
436 + // Legacy Interface
437 + charCode: function(event) {
438 + // `charCode` is the result of a KeyPress event and represents the value of
439 + // the actual printable character.
440 +
441 + // KeyPress is deprecated, but its replacement is not yet final and not
442 + // implemented in any major browser. Only KeyPress has charCode.
443 + if (event.type === 'keypress') {
444 + return getEventCharCode(event);
445 + }
446 + return 0;
447 + },
448 + keyCode: function(event) {
449 + // `keyCode` is the result of a KeyDown/Up event and represents the value of
450 + // physical keyboard key.
451 +
452 + // The actual meaning of the value depends on the users' keyboard layout
453 + // which cannot be detected. Assuming that it is a US keyboard layout
454 + // provides a surprisingly accurate mapping for US and European users.
455 + // Due to this, it is left to the user to implement at this time.
456 + if (event.type === 'keydown' || event.type === 'keyup') {
457 + return event.keyCode;
458 + }
459 + return 0;
460 + },
461 + which: function(event) {
462 + // `which` is an alias for either `keyCode` or `charCode` depending on the
463 + // type of the event.
464 + if (event.type === 'keypress') {
465 + return getEventCharCode(event);
466 + }
467 + if (event.type === 'keydown' || event.type === 'keyup') {
468 + return event.keyCode;
469 + }
470 + return 0;
471 + },
472 +});
473 +
474 +/**
475 + * @interface PointerEvent
476 + * @see http://www.w3.org/TR/pointerevents/
477 + */
478 +export const SyntheticPointerEvent = SyntheticMouseEvent.extend({
479 + pointerId: null,
480 + width: null,
481 + height: null,
482 + pressure: null,
483 + tangentialPressure: null,
484 + tiltX: null,
485 + tiltY: null,
486 + twist: null,
487 + pointerType: null,
488 + isPrimary: null,
489 +});
490 +
491 +/**
492 + * @interface TouchEvent
493 + * @see http://www.w3.org/TR/touch-events/
494 + */
495 +export const SyntheticTouchEvent = SyntheticUIEvent.extend({
496 + touches: null,
497 + targetTouches: null,
498 + changedTouches: null,
499 + altKey: null,
500 + metaKey: null,
501 + ctrlKey: null,
502 + shiftKey: null,
503 + getModifierState: getEventModifierState,
504 +});
505 +
506 +/**
507 + * @interface Event
508 + * @see http://www.w3.org/TR/2009/WD-css3-transitions-20090320/#transition-events-
509 + * @see https://developer.mozilla.org/en-US/docs/Web/API/TransitionEvent
510 + */
511 +export const SyntheticTransitionEvent = SyntheticEvent.extend({
512 + propertyName: null,
513 + elapsedTime: null,
514 + pseudoElement: null,
515 +});
516 +
517 +/**
518 + * @interface WheelEvent
519 + * @see http://www.w3.org/TR/DOM-Level-3-Events/
520 + */
521 +export const SyntheticWheelEvent = SyntheticMouseEvent.extend({
522 + deltaX(event) {
523 + return 'deltaX' in event
524 + ? event.deltaX
525 + : // Fallback to `wheelDeltaX` for Webkit and normalize (right is positive).
526 + 'wheelDeltaX' in event
527 + ? -event.wheelDeltaX
528 + : 0;
529 + },
530 + deltaY(event) {
531 + return 'deltaY' in event
532 + ? event.deltaY
533 + : // Fallback to `wheelDeltaY` for Webkit and normalize (down is positive).
534 + 'wheelDeltaY' in event
535 + ? -event.wheelDeltaY
536 + : // Fallback to `wheelDelta` for IE<9 and normalize (down is positive).
537 + 'wheelDelta' in event
538 + ? -event.wheelDelta
539 + : 0;
540 + },
541 + deltaZ: null,
542 +
543 + // Browsers without "deltaMode" is reporting in raw wheel delta where one
544 + // notch on the scroll is always +/- 120, roughly equivalent to pixels.
545 + // A good approximation of DOM_DELTA_LINE (1) is 5% of viewport size or
546 + // ~40 pixels, for DOM_DELTA_SCREEN (2) it is 87.5% of viewport size.
547 + deltaMode: null,
548 +});
packages/react-dom/src/events/SyntheticFocusEvent.js deleted
-18
@@ -1,18 +0,0 @@
1 -/**
2 - * Copyright (c) Facebook, Inc. and its affiliates.
3 - *
4 - * This source code is licensed under the MIT license found in the
5 - * LICENSE file in the root directory of this source tree.
6 - */
7 -
8 -import SyntheticUIEvent from './SyntheticUIEvent';
9 -
10 -/**
11 - * @interface FocusEvent
12 - * @see http://www.w3.org/TR/DOM-Level-3-Events/
13 - */
14 -const SyntheticFocusEvent = SyntheticUIEvent.extend({
15 - relatedTarget: null,
16 -});
17 -
18 -export default SyntheticFocusEvent;
packages/react-dom/src/events/SyntheticInputEvent.js deleted
-19
@@ -1,19 +0,0 @@
1 -/**
2 - * Copyright (c) Facebook, Inc. and its affiliates.
3 - *
4 - * This source code is licensed under the MIT license found in the
5 - * LICENSE file in the root directory of this source tree.
6 - */
7 -
8 -import SyntheticEvent from '../events/SyntheticEvent';
9 -
10 -/**
11 - * @interface Event
12 - * @see http://www.w3.org/TR/2013/WD-DOM-Level-3-Events-20131105
13 - * /#events-inputevents
14 - */
15 -const SyntheticInputEvent = SyntheticEvent.extend({
16 - data: null,
17 -});
18 -
19 -export default SyntheticInputEvent;
packages/react-dom/src/events/SyntheticKeyboardEvent.js deleted
-66
@@ -1,66 +0,0 @@
1 -/**
2 - * Copyright (c) Facebook, Inc. and its affiliates.
3 - *
4 - * This source code is licensed under the MIT license found in the
5 - * LICENSE file in the root directory of this source tree.
6 - */
7 -
8 -import SyntheticUIEvent from './SyntheticUIEvent';
9 -import getEventCharCode from './getEventCharCode';
10 -import getEventKey from './getEventKey';
11 -import getEventModifierState from './getEventModifierState';
12 -
13 -/**
14 - * @interface KeyboardEvent
15 - * @see http://www.w3.org/TR/DOM-Level-3-Events/
16 - */
17 -const SyntheticKeyboardEvent = SyntheticUIEvent.extend({
18 - key: getEventKey,
19 - code: null,
20 - location: null,
21 - ctrlKey: null,
22 - shiftKey: null,
23 - altKey: null,
24 - metaKey: null,
25 - repeat: null,
26 - locale: null,
27 - getModifierState: getEventModifierState,
28 - // Legacy Interface
29 - charCode: function(event) {
30 - // `charCode` is the result of a KeyPress event and represents the value of
31 - // the actual printable character.
32 -
33 - // KeyPress is deprecated, but its replacement is not yet final and not
34 - // implemented in any major browser. Only KeyPress has charCode.
35 - if (event.type === 'keypress') {
36 - return getEventCharCode(event);
37 - }
38 - return 0;
39 - },
40 - keyCode: function(event) {
41 - // `keyCode` is the result of a KeyDown/Up event and represents the value of
42 - // physical keyboard key.
43 -
44 - // The actual meaning of the value depends on the users' keyboard layout
45 - // which cannot be detected. Assuming that it is a US keyboard layout
46 - // provides a surprisingly accurate mapping for US and European users.
47 - // Due to this, it is left to the user to implement at this time.
48 - if (event.type === 'keydown' || event.type === 'keyup') {
49 - return event.keyCode;
50 - }
51 - return 0;
52 - },
53 - which: function(event) {
54 - // `which` is an alias for either `keyCode` or `charCode` depending on the
55 - // type of the event.
56 - if (event.type === 'keypress') {
57 - return getEventCharCode(event);
58 - }
59 - if (event.type === 'keydown' || event.type === 'keyup') {
60 - return event.keyCode;
61 - }
62 - return 0;
63 - },
64 -});
65 -
66 -export default SyntheticKeyboardEvent;
packages/react-dom/src/events/SyntheticMouseEvent.js deleted
-75
@@ -1,75 +0,0 @@
1 -/**
2 - * Copyright (c) Facebook, Inc. and its affiliates.
3 - *
4 - * This source code is licensed under the MIT license found in the
5 - * LICENSE file in the root directory of this source tree.
6 - */
7 -
8 -import SyntheticUIEvent from './SyntheticUIEvent';
9 -import getEventModifierState from './getEventModifierState';
10 -
11 -let previousScreenX = 0;
12 -let previousScreenY = 0;
13 -// Use flags to signal movementX/Y has already been set
14 -let isMovementXSet = false;
15 -let isMovementYSet = false;
16 -
17 -/**
18 - * @interface MouseEvent
19 - * @see http://www.w3.org/TR/DOM-Level-3-Events/
20 - */
21 -const SyntheticMouseEvent = SyntheticUIEvent.extend({
22 - screenX: null,
23 - screenY: null,
24 - clientX: null,
25 - clientY: null,
26 - pageX: null,
27 - pageY: null,
28 - ctrlKey: null,
29 - shiftKey: null,
30 - altKey: null,
31 - metaKey: null,
32 - getModifierState: getEventModifierState,
33 - button: null,
34 - buttons: null,
35 - relatedTarget: function(event) {
36 - return (
37 - event.relatedTarget ||
38 - (event.fromElement === event.srcElement
39 - ? event.toElement
40 - : event.fromElement)
41 - );
42 - },
43 - movementX: function(event) {
44 - if ('movementX' in event) {
45 - return event.movementX;
46 - }
47 -
48 - const screenX = previousScreenX;
49 - previousScreenX = event.screenX;
50 -
51 - if (!isMovementXSet) {
52 - isMovementXSet = true;
53 - return 0;
54 - }
55 -
56 - return event.type === 'mousemove' ? event.screenX - screenX : 0;
57 - },
58 - movementY: function(event) {
59 - if ('movementY' in event) {
60 - return event.movementY;
61 - }
62 -
63 - const screenY = previousScreenY;
64 - previousScreenY = event.screenY;
65 -
66 - if (!isMovementYSet) {
67 - isMovementYSet = true;
68 - return 0;
69 - }
70 -
71 - return event.type === 'mousemove' ? event.screenY - screenY : 0;
72 - },
73 -});
74 -
75 -export default SyntheticMouseEvent;
packages/react-dom/src/events/SyntheticPointerEvent.js deleted
-27
@@ -1,27 +0,0 @@
1 -/**
2 - * Copyright (c) Facebook, Inc. and its affiliates.
3 - *
4 - * This source code is licensed under the MIT license found in the
5 - * LICENSE file in the root directory of this source tree.
6 - */
7 -
8 -import SyntheticMouseEvent from './SyntheticMouseEvent';
9 -
10 -/**
11 - * @interface PointerEvent
12 - * @see http://www.w3.org/TR/pointerevents/
13 - */
14 -const SyntheticPointerEvent = SyntheticMouseEvent.extend({
15 - pointerId: null,
16 - width: null,
17 - height: null,
18 - pressure: null,
19 - tangentialPressure: null,
20 - tiltX: null,
21 - tiltY: null,
22 - twist: null,
23 - pointerType: null,
24 - isPrimary: null,
25 -});
26 -
27 -export default SyntheticPointerEvent;
packages/react-dom/src/events/SyntheticTouchEvent.js deleted
-26
@@ -1,26 +0,0 @@
1 -/**
2 - * Copyright (c) Facebook, Inc. and its affiliates.
3 - *
4 - * This source code is licensed under the MIT license found in the
5 - * LICENSE file in the root directory of this source tree.
6 - */
7 -
8 -import SyntheticUIEvent from './SyntheticUIEvent';
9 -import getEventModifierState from './getEventModifierState';
10 -
11 -/**
12 - * @interface TouchEvent
13 - * @see http://www.w3.org/TR/touch-events/
14 - */
15 -const SyntheticTouchEvent = SyntheticUIEvent.extend({
16 - touches: null,
17 - targetTouches: null,
18 - changedTouches: null,
19 - altKey: null,
20 - metaKey: null,
21 - ctrlKey: null,
22 - shiftKey: null,
23 - getModifierState: getEventModifierState,
24 -});
25 -
26 -export default SyntheticTouchEvent;
packages/react-dom/src/events/SyntheticTransitionEvent.js deleted
-21
@@ -1,21 +0,0 @@
1 -/**
2 - * Copyright (c) Facebook, Inc. and its affiliates.
3 - *
4 - * This source code is licensed under the MIT license found in the
5 - * LICENSE file in the root directory of this source tree.
6 - */
7 -
8 -import SyntheticEvent from '../events/SyntheticEvent';
9 -
10 -/**
11 - * @interface Event
12 - * @see http://www.w3.org/TR/2009/WD-css3-transitions-20090320/#transition-events-
13 - * @see https://developer.mozilla.org/en-US/docs/Web/API/TransitionEvent
14 - */
15 -const SyntheticTransitionEvent = SyntheticEvent.extend({
16 - propertyName: null,
17 - elapsedTime: null,
18 - pseudoElement: null,
19 -});
20 -
21 -export default SyntheticTransitionEvent;
packages/react-dom/src/events/SyntheticUIEvent.js deleted
-15
@@ -1,15 +0,0 @@
1 -/**
2 - * Copyright (c) Facebook, Inc. and its affiliates.
3 - *
4 - * This source code is licensed under the MIT license found in the
5 - * LICENSE file in the root directory of this source tree.
6 - */
7 -
8 -import SyntheticEvent from '../events/SyntheticEvent';
9 -
10 -const SyntheticUIEvent = SyntheticEvent.extend({
11 - view: null,
12 - detail: null,
13 -});
14 -
15 -export default SyntheticUIEvent;
packages/react-dom/src/events/SyntheticWheelEvent.js deleted
-43
@@ -1,43 +0,0 @@
1 -/**
2 - * Copyright (c) Facebook, Inc. and its affiliates.
3 - *
4 - * This source code is licensed under the MIT license found in the
5 - * LICENSE file in the root directory of this source tree.
6 - */
7 -
8 -import SyntheticMouseEvent from './SyntheticMouseEvent';
9 -
10 -/**
11 - * @interface WheelEvent
12 - * @see http://www.w3.org/TR/DOM-Level-3-Events/
13 - */
14 -const SyntheticWheelEvent = SyntheticMouseEvent.extend({
15 - deltaX(event) {
16 - return 'deltaX' in event
17 - ? event.deltaX
18 - : // Fallback to `wheelDeltaX` for Webkit and normalize (right is positive).
19 - 'wheelDeltaX' in event
20 - ? -event.wheelDeltaX
21 - : 0;
22 - },
23 - deltaY(event) {
24 - return 'deltaY' in event
25 - ? event.deltaY
26 - : // Fallback to `wheelDeltaY` for Webkit and normalize (down is positive).
27 - 'wheelDeltaY' in event
28 - ? -event.wheelDeltaY
29 - : // Fallback to `wheelDelta` for IE<9 and normalize (down is positive).
30 - 'wheelDelta' in event
31 - ? -event.wheelDelta
32 - : 0;
33 - },
34 - deltaZ: null,
35 -
36 - // Browsers without "deltaMode" is reporting in raw wheel delta where one
37 - // notch on the scroll is always +/- 120, roughly equivalent to pixels.
38 - // A good approximation of DOM_DELTA_LINE (1) is 5% of viewport size or
39 - // ~40 pixels, for DOM_DELTA_SCREEN (2) it is 87.5% of viewport size.
40 - deltaMode: null,
41 -});
42 -
43 -export default SyntheticWheelEvent;
packages/react-dom/src/events/__tests__/DOMPluginEventSystem-test.internal.js renamed
+1 -1
@@ -49,7 +49,7 @@ function endNativeEventListenerClearDown() {
49 });
50 }
51
52 -describe('DOMModernPluginEventSystem', () => {
52 +describe('DOMPluginEventSystem', () => {
53 let container;
54
55 function withEnableLegacyFBSupport(enableLegacyFBSupport) {
packages/react-dom/src/events/getEventKey.js deleted
-108
@@ -1,108 +0,0 @@
1 -/**
2 - * Copyright (c) Facebook, Inc. and its affiliates.
3 - *
4 - * This source code is licensed under the MIT license found in the
5 - * LICENSE file in the root directory of this source tree.
6 - *
7 - * @flow
8 - */
9 -
10 -import getEventCharCode from './getEventCharCode';
11 -
12 -/**
13 - * Normalization of deprecated HTML5 `key` values
14 - * @see https://developer.mozilla.org/en-US/docs/Web/API/KeyboardEvent#Key_names
15 - */
16 -const normalizeKey = {
17 - Esc: 'Escape',
18 - Spacebar: ' ',
19 - Left: 'ArrowLeft',
20 - Up: 'ArrowUp',
21 - Right: 'ArrowRight',
22 - Down: 'ArrowDown',
23 - Del: 'Delete',
24 - Win: 'OS',
25 - Menu: 'ContextMenu',
26 - Apps: 'ContextMenu',
27 - Scroll: 'ScrollLock',
28 - MozPrintableKey: 'Unidentified',
29 -};
30 -
31 -/**
32 - * Translation from legacy `keyCode` to HTML5 `key`
33 - * Only special keys supported, all others depend on keyboard layout or browser
34 - * @see https://developer.mozilla.org/en-US/docs/Web/API/KeyboardEvent#Key_names
35 - */
36 -const translateToKey = {
37 - '8': 'Backspace',
38 - '9': 'Tab',
39 - '12': 'Clear',
40 - '13': 'Enter',
41 - '16': 'Shift',
42 - '17': 'Control',
43 - '18': 'Alt',
44 - '19': 'Pause',
45 - '20': 'CapsLock',
46 - '27': 'Escape',
47 - '32': ' ',
48 - '33': 'PageUp',
49 - '34': 'PageDown',
50 - '35': 'End',
51 - '36': 'Home',
52 - '37': 'ArrowLeft',
53 - '38': 'ArrowUp',
54 - '39': 'ArrowRight',
55 - '40': 'ArrowDown',
56 - '45': 'Insert',
57 - '46': 'Delete',
58 - '112': 'F1',
59 - '113': 'F2',
60 - '114': 'F3',
61 - '115': 'F4',
62 - '116': 'F5',
63 - '117': 'F6',
64 - '118': 'F7',
65 - '119': 'F8',
66 - '120': 'F9',
67 - '121': 'F10',
68 - '122': 'F11',
69 - '123': 'F12',
70 - '144': 'NumLock',
71 - '145': 'ScrollLock',
72 - '224': 'Meta',
73 -};
74 -
75 -/**
76 - * @param {object} nativeEvent Native browser event.
77 - * @return {string} Normalized `key` property.
78 - */
79 -function getEventKey(nativeEvent: KeyboardEvent): string {
80 - if (nativeEvent.key) {
81 - // Normalize inconsistent values reported by browsers due to
82 - // implementations of a working draft specification.
83 -
84 - // FireFox implements `key` but returns `MozPrintableKey` for all
85 - // printable characters (normalized to `Unidentified`), ignore it.
86 - const key = normalizeKey[nativeEvent.key] || nativeEvent.key;
87 - if (key !== 'Unidentified') {
88 - return key;
89 - }
90 - }
91 -
92 - // Browser does not implement `key`, polyfill as much of it as we can.
93 - if (nativeEvent.type === 'keypress') {
94 - const charCode = getEventCharCode(nativeEvent);
95 -
96 - // The enter-key is technically both printable and non-printable and can
97 - // thus be captured by `keypress`, no other non-printable key should.
98 - return charCode === 13 ? 'Enter' : String.fromCharCode(charCode);
99 - }
100 - if (nativeEvent.type === 'keydown' || nativeEvent.type === 'keyup') {
101 - // While user keyboard layout determines the actual meaning of each
102 - // `keyCode` value, almost all function keys have a universal value.
103 - return translateToKey[nativeEvent.keyCode] || 'Unidentified';
104 - }
105 - return '';
106 -}
107 -
108 -export default getEventKey;
packages/react-dom/src/events/getEventModifierState.js deleted
-43
@@ -1,43 +0,0 @@
1 -/**
2 - * Copyright (c) Facebook, Inc. and its affiliates.
3 - *
4 - * This source code is licensed under the MIT license found in the
5 - * LICENSE file in the root directory of this source tree.
6 - *
7 - * @flow
8 - */
9 -
10 -/**
11 - * Translation from modifier key to the associated property in the event.
12 - * @see http://www.w3.org/TR/DOM-Level-3-Events/#keys-Modifiers
13 - */
14 -
15 -import type {AnyNativeEvent} from '../events/PluginModuleType';
16 -
17 -const modifierKeyToProp = {
18 - Alt: 'altKey',
19 - Control: 'ctrlKey',
20 - Meta: 'metaKey',
21 - Shift: 'shiftKey',
22 -};
23 -
24 -// Older browsers (Safari <= 10, iOS Safari <= 10.2) do not support
25 -// getModifierState. If getModifierState is not supported, we map it to a set of
26 -// modifier keys exposed by the event. In this case, Lock-keys are not supported.
27 -function modifierStateGetter(keyArg: string): boolean {
28 - const syntheticEvent = this;
29 - const nativeEvent = syntheticEvent.nativeEvent;
30 - if (nativeEvent.getModifierState) {
31 - return nativeEvent.getModifierState(keyArg);
32 - }
33 - const keyProp = modifierKeyToProp[keyArg];
34 - return keyProp ? !!nativeEvent[keyProp] : false;
35 -}
36 -
37 -function getEventModifierState(
38 - nativeEvent: AnyNativeEvent,
39 -): (keyArg: string) => boolean {
40 - return modifierStateGetter;
41 -}
42 -
43 -export default getEventModifierState;
packages/react-dom/src/events/plugins/BeforeInputEventPlugin.js renamed
+5 -3
@@ -27,9 +27,11 @@ import {
27 initialize as FallbackCompositionStateInitialize,
28 reset as FallbackCompositionStateReset,
29 } from '../FallbackCompositionState';
30 -import SyntheticCompositionEvent from '../SyntheticCompositionEvent';
31 -import SyntheticInputEvent from '../SyntheticInputEvent';
32 -import {accumulateTwoPhaseListeners} from '../DOMModernPluginEventSystem';
30 +import {
31 + SyntheticCompositionEvent,
32 + SyntheticInputEvent,
33 +} from '../SyntheticEvent';
34 +import {accumulateTwoPhaseListeners} from '../DOMPluginEventSystem';
35
36 const END_KEYCODES = [9, 13, 27, 32]; // Tab, Return, Esc, Space
37 const START_KEYCODE = 229;
packages/react-dom/src/events/plugins/ChangeEventPlugin.js renamed
+3 -3
@@ -8,11 +8,11 @@
8 */
9 import type {AnyNativeEvent} from '../PluginModuleType';
10 import type {TopLevelType} from '../TopLevelEventTypes';
11 -import type {DispatchQueue} from '../DOMModernPluginEventSystem';
11 +import type {DispatchQueue} from '../DOMPluginEventSystem';
12 import type {EventSystemFlags} from '../EventSystemFlags';
13
14 import {registerTwoPhaseEvent} from '../EventRegistry';
15 -import SyntheticEvent from '../SyntheticEvent';
15 +import {SyntheticEvent} from '../SyntheticEvent';
16 import isTextInputElement from '../isTextInputElement';
17 import {canUseDOM} from 'shared/ExecutionEnvironment';
18
@@ -38,7 +38,7 @@ import {batchedUpdates} from '../ReactDOMUpdateBatching';
38 import {
39 processDispatchQueue,
40 accumulateTwoPhaseListeners,
41 -} from '../DOMModernPluginEventSystem';
41 +} from '../DOMPluginEventSystem';
42
43 function registerEvents() {
44 registerTwoPhaseEvent('onChange', [
packages/react-dom/src/events/plugins/EnterLeaveEventPlugin.js renamed
+2 -3
@@ -13,13 +13,12 @@ import {
13 TOP_POINTER_OVER,
14 } from '../DOMTopLevelEventTypes';
15 import {IS_REPLAYED} from 'react-dom/src/events/EventSystemFlags';
16 -import SyntheticMouseEvent from '../SyntheticMouseEvent';
17 -import SyntheticPointerEvent from '../SyntheticPointerEvent';
16 +import {SyntheticMouseEvent, SyntheticPointerEvent} from '../SyntheticEvent';
17 import {
18 getClosestInstanceFromNode,
19 getNodeFromInstance,
20 } from '../../client/ReactDOMComponentTree';
22 -import {accumulateEnterLeaveTwoPhaseListeners} from '../DOMModernPluginEventSystem';
21 +import {accumulateEnterLeaveTwoPhaseListeners} from '../DOMPluginEventSystem';
22
23 import {HostComponent, HostText} from 'react-reconciler/src/ReactWorkTags';
24 import {getNearestMountedFiber} from 'react-reconciler/src/ReactFiberTreeReflection';
packages/react-dom/src/events/plugins/SelectEventPlugin.js renamed
+2 -2
@@ -6,7 +6,7 @@
6 */
7
8 import {canUseDOM} from 'shared/ExecutionEnvironment';
9 -import SyntheticEvent from '../../events/SyntheticEvent';
9 +import {SyntheticEvent} from '../../events/SyntheticEvent';
10 import isTextInputElement from '../isTextInputElement';
11 import shallowEqual from 'shared/shallowEqual';
12
@@ -29,7 +29,7 @@ import {
29 } from '../../client/ReactDOMComponentTree';
30 import {hasSelectionCapabilities} from '../../client/ReactInputSelection';
31 import {DOCUMENT_NODE} from '../../shared/HTMLNodeType';
32 -import {accumulateTwoPhaseListeners} from '../DOMModernPluginEventSystem';
32 +import {accumulateTwoPhaseListeners} from '../DOMPluginEventSystem';
33
34 const skipSelectionChangeEvent =
35 canUseDOM && 'documentMode' in document && document.documentMode <= 11;
packages/react-dom/src/events/plugins/SimpleEventPlugin.js renamed
+17 -14
@@ -10,10 +10,23 @@
10 import type {TopLevelType} from '../../events/TopLevelEventTypes';
11 import type {Fiber} from 'react-reconciler/src/ReactInternalTypes';
12 import type {AnyNativeEvent} from '../../events/PluginModuleType';
13 -import type {DispatchQueue} from '../DOMModernPluginEventSystem';
13 +import type {DispatchQueue} from '../DOMPluginEventSystem';
14 import type {EventSystemFlags} from '../EventSystemFlags';
15
16 -import SyntheticEvent from '../../events/SyntheticEvent';
16 +import {
17 + SyntheticEvent,
18 + SyntheticAnimationEvent,
19 + SyntheticClipboardEvent,
20 + SyntheticFocusEvent,
21 + SyntheticKeyboardEvent,
22 + SyntheticMouseEvent,
23 + SyntheticPointerEvent,
24 + SyntheticDragEvent,
25 + SyntheticTouchEvent,
26 + SyntheticTransitionEvent,
27 + SyntheticUIEvent,
28 + SyntheticWheelEvent,
29 +} from '../../events/SyntheticEvent';
30
31 import * as DOMTopLevelEventTypes from '../DOMTopLevelEventTypes';
32 import {
@@ -23,19 +36,9 @@ import {
36 import {
37 accumulateSinglePhaseListeners,
38 accumulateEventHandleNonManagedNodeListeners,
26 -} from '../DOMModernPluginEventSystem';
39 +} from '../DOMPluginEventSystem';
40 import {IS_EVENT_HANDLE_NON_MANAGED_NODE} from '../EventSystemFlags';
28 -import SyntheticAnimationEvent from '../SyntheticAnimationEvent';
29 -import SyntheticClipboardEvent from '../SyntheticClipboardEvent';
30 -import SyntheticFocusEvent from '../SyntheticFocusEvent';
31 -import SyntheticKeyboardEvent from '../SyntheticKeyboardEvent';
32 -import SyntheticMouseEvent from '../SyntheticMouseEvent';
33 -import SyntheticPointerEvent from '../SyntheticPointerEvent';
34 -import SyntheticDragEvent from '../SyntheticDragEvent';
35 -import SyntheticTouchEvent from '../SyntheticTouchEvent';
36 -import SyntheticTransitionEvent from '../SyntheticTransitionEvent';
37 -import SyntheticUIEvent from '../SyntheticUIEvent';
38 -import SyntheticWheelEvent from '../SyntheticWheelEvent';
41 +
42 import getEventCharCode from '../getEventCharCode';
43 import {IS_CAPTURE_PHASE} from '../EventSystemFlags';
44
packages/react-dom/src/test-utils/ReactTestUtils.js
+1 -1
@@ -15,7 +15,7 @@ import {
15 HostComponent,
16 HostText,
17 } from 'react-reconciler/src/ReactWorkTags';
18 -import SyntheticEvent from '../events/SyntheticEvent';
18 +import {SyntheticEvent} from '../events/SyntheticEvent';
19 import invariant from 'shared/invariant';
20 import {ELEMENT_NODE} from '../shared/HTMLNodeType';
21 import act from './ReactTestUtilsAct';