react 15.3.2 → 15.4.0-rc.4
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/dist/react-with-addons.js +3864 -21390
- package/dist/react-with-addons.min.js +3 -6
- package/dist/react.js +2639 -19486
- package/dist/react.min.js +2 -6
- package/lib/KeyEscapeUtils.js +0 -1
- package/lib/LinkedStateMixin.js +1 -3
- package/lib/PooledClass.js +3 -1
- package/lib/React.js +0 -1
- package/lib/ReactAddonsDOMDependencies.js +35 -0
- package/lib/ReactAddonsDOMDependenciesUMDShim.js +31 -0
- package/lib/ReactCSSTransitionGroup.js +60 -43
- package/lib/ReactCSSTransitionGroupChild.js +2 -3
- package/lib/ReactChildren.js +0 -1
- package/lib/ReactClass.js +38 -54
- package/lib/ReactComponent.js +0 -1
- package/lib/ReactComponentTreeDevtool.js +0 -1
- package/lib/ReactComponentTreeHook.js +84 -101
- package/lib/{DOMNamespaces.js → ReactComponentTreeHookUMDShim.js} +4 -7
- package/lib/ReactComponentWithPureRenderMixin.js +0 -1
- package/lib/ReactCurrentOwner.js +1 -2
- package/lib/{renderSubtreeIntoContainer.js → ReactCurrentOwnerUMDShim.js} +5 -4
- package/lib/ReactDOMFactories.js +0 -1
- package/lib/ReactElement.js +6 -14
- package/lib/ReactElementSymbol.js +19 -0
- package/lib/{ReactDOMComponentFlags.js → ReactElementType.js} +3 -9
- package/lib/ReactElementValidator.js +1 -3
- package/lib/ReactFragment.js +0 -1
- package/lib/ReactLink.js +0 -1
- package/lib/ReactNoopUpdateQueue.js +0 -1
- package/lib/ReactPropTypeLocationNames.js +1 -1
- package/lib/ReactPropTypeLocations.js +2 -12
- package/lib/ReactPropTypes.js +5 -3
- package/lib/ReactPropTypesSecret.js +1 -1
- package/lib/ReactPureComponent.js +0 -1
- package/lib/ReactStateSetters.js +0 -1
- package/lib/ReactTransitionChildMapping.js +0 -1
- package/lib/ReactTransitionEvents.js +1 -2
- package/lib/ReactTransitionGroup.js +145 -142
- package/lib/ReactUMDEntry.js +11 -6
- package/lib/{ReactDOMFeatureFlags.js → ReactUMDShim.js} +3 -6
- package/lib/ReactVersion.js +1 -2
- package/lib/ReactWithAddons.js +15 -3
- package/lib/ReactWithAddonsUMDEntry.js +11 -6
- package/lib/canDefineProperty.js +2 -1
- package/lib/checkReactTypeSpec.js +0 -1
- package/lib/deprecated.js +0 -1
- package/lib/flattenChildren.js +0 -1
- package/lib/getIteratorFn.js +0 -1
- package/lib/onlyChild.js +0 -1
- package/lib/reactProdInvariant.js +0 -1
- package/lib/shallowCompare.js +1 -2
- package/lib/sliceChildren.js +0 -1
- package/lib/traverseAllChildren.js +11 -3
- package/lib/update.js +6 -8
- package/package.json +1 -1
- package/lib/AutoFocusUtils.js +0 -24
- package/lib/BeforeInputEventPlugin.js +0 -390
- package/lib/CSSProperty.js +0 -148
- package/lib/CSSPropertyOperations.js +0 -205
- package/lib/CallbackQueue.js +0 -106
- package/lib/ChangeEventPlugin.js +0 -325
- package/lib/DOMChildrenOperations.js +0 -194
- package/lib/DOMLazyTree.js +0 -118
- package/lib/DOMProperty.js +0 -206
- package/lib/DOMPropertyOperations.js +0 -221
- package/lib/Danger.js +0 -48
- package/lib/DefaultEventPluginOrder.js +0 -27
- package/lib/DisabledInputUtils.js +0 -50
- package/lib/EnterLeaveEventPlugin.js +0 -105
- package/lib/EventConstants.js +0 -97
- package/lib/EventPluginHub.js +0 -251
- package/lib/EventPluginRegistry.js +0 -247
- package/lib/EventPluginUtils.js +0 -229
- package/lib/EventPropagators.js +0 -137
- package/lib/FallbackCompositionState.js +0 -95
- package/lib/HTMLDOMPropertyConfig.js +0 -212
- package/lib/LinkedValueUtils.js +0 -136
- package/lib/NativeMethodsMixin.js +0 -167
- package/lib/ReactBrowserEventEmitter.js +0 -330
- package/lib/ReactChildReconciler.js +0 -154
- package/lib/ReactChildrenMutationWarningHook.js +0 -54
- package/lib/ReactComponentBrowserEnvironment.js +0 -30
- package/lib/ReactComponentEnvironment.js +0 -45
- package/lib/ReactComponentTreeTestUtils.js +0 -87
- package/lib/ReactCompositeComponent.js +0 -904
- package/lib/ReactDOM.js +0 -110
- package/lib/ReactDOMButton.js +0 -24
- package/lib/ReactDOMComponent.js +0 -1006
- package/lib/ReactDOMComponentTree.js +0 -188
- package/lib/ReactDOMContainerInfo.js +0 -33
- package/lib/ReactDOMEmptyComponent.js +0 -60
- package/lib/ReactDOMFiber.js +0 -76
- package/lib/ReactDOMIDOperations.js +0 -34
- package/lib/ReactDOMInput.js +0 -269
- package/lib/ReactDOMNullInputValuePropHook.js +0 -43
- package/lib/ReactDOMOption.js +0 -123
- package/lib/ReactDOMSelect.js +0 -201
- package/lib/ReactDOMSelection.js +0 -212
- package/lib/ReactDOMServer.js +0 -26
- package/lib/ReactDOMTextComponent.js +0 -164
- package/lib/ReactDOMTextarea.js +0 -155
- package/lib/ReactDOMTreeTraversal.js +0 -136
- package/lib/ReactDOMUnknownPropertyHook.js +0 -112
- package/lib/ReactDebugTool.js +0 -301
- package/lib/ReactDefaultBatchingStrategy.js +0 -68
- package/lib/ReactDefaultInjection.js +0 -84
- package/lib/ReactEmptyComponent.js +0 -30
- package/lib/ReactErrorUtils.js +0 -76
- package/lib/ReactEventEmitterMixin.js +0 -33
- package/lib/ReactEventListener.js +0 -157
- package/lib/ReactFeatureFlags.js +0 -22
- package/lib/ReactHostComponent.js +0 -76
- package/lib/ReactHostOperationHistoryHook.js +0 -37
- package/lib/ReactInjection.js +0 -36
- package/lib/ReactInputSelection.js +0 -124
- package/lib/ReactInstanceHandles.js +0 -302
- package/lib/ReactInstanceMap.js +0 -48
- package/lib/ReactInstrumentation.js +0 -21
- package/lib/ReactInvalidSetStateWarningHook.js +0 -36
- package/lib/ReactMarkupChecksum.js +0 -50
- package/lib/ReactMount.js +0 -534
- package/lib/ReactMultiChild.js +0 -451
- package/lib/ReactMultiChildUpdateTypes.js +0 -32
- package/lib/ReactNative.js +0 -71
- package/lib/ReactNativeAttributePayload.js +0 -371
- package/lib/ReactNativeBaseComponent.js +0 -198
- package/lib/ReactNativeBridgeEventPlugin.js +0 -60
- package/lib/ReactNativeComponentEnvironment.js +0 -31
- package/lib/ReactNativeComponentTree.js +0 -68
- package/lib/ReactNativeContainerInfo.js +0 -21
- package/lib/ReactNativeDOMIDOperations.js +0 -79
- package/lib/ReactNativeDefaultInjection.js +0 -101
- package/lib/ReactNativeEventEmitter.js +0 -191
- package/lib/ReactNativeEventPluginOrder.js +0 -16
- package/lib/ReactNativeGlobalResponderHandler.js +0 -25
- package/lib/ReactNativeMount.js +0 -193
- package/lib/ReactNativePropRegistry.js +0 -52
- package/lib/ReactNativeReconcileTransaction.js +0 -129
- package/lib/ReactNativeTagHandles.js +0 -56
- package/lib/ReactNativeTextComponent.js +0 -71
- package/lib/ReactNativeTreeTraversal.js +0 -127
- package/lib/ReactNodeTypes.js +0 -40
- package/lib/ReactNoop.js +0 -173
- package/lib/ReactOwner.js +0 -94
- package/lib/ReactPerf.js +0 -494
- package/lib/ReactReconcileTransaction.js +0 -178
- package/lib/ReactReconciler.js +0 -168
- package/lib/ReactRef.js +0 -80
- package/lib/ReactServerBatchingStrategy.js +0 -22
- package/lib/ReactServerRendering.js +0 -90
- package/lib/ReactServerRenderingTransaction.js +0 -90
- package/lib/ReactServerUpdateQueue.js +0 -141
- package/lib/ReactSimpleEmptyComponent.js +0 -37
- package/lib/ReactTestMount.js +0 -126
- package/lib/ReactTestReconcileTransaction.js +0 -121
- package/lib/ReactTestRenderer.js +0 -144
- package/lib/ReactTestUtils.js +0 -518
- package/lib/ReactUpdateQueue.js +0 -226
- package/lib/ReactUpdates.js +0 -251
- package/lib/ResponderEventPlugin.js +0 -510
- package/lib/ResponderSyntheticEvent.js +0 -39
- package/lib/ResponderTouchHistoryStore.js +0 -184
- package/lib/SVGDOMPropertyConfig.js +0 -302
- package/lib/SelectEventPlugin.js +0 -196
- package/lib/SimpleEventPlugin.js +0 -635
- package/lib/SyntheticAnimationEvent.js +0 -39
- package/lib/SyntheticClipboardEvent.js +0 -38
- package/lib/SyntheticCompositionEvent.js +0 -36
- package/lib/SyntheticDragEvent.js +0 -36
- package/lib/SyntheticEvent.js +0 -268
- package/lib/SyntheticFocusEvent.js +0 -36
- package/lib/SyntheticInputEvent.js +0 -37
- package/lib/SyntheticKeyboardEvent.js +0 -84
- package/lib/SyntheticMouseEvent.js +0 -72
- package/lib/SyntheticTouchEvent.js +0 -45
- package/lib/SyntheticTransitionEvent.js +0 -39
- package/lib/SyntheticUIEvent.js +0 -59
- package/lib/SyntheticWheelEvent.js +0 -54
- package/lib/TapEventPlugin.js +0 -110
- package/lib/TouchHistoryMath.js +0 -99
- package/lib/Transaction.js +0 -233
- package/lib/ViewportMetrics.js +0 -27
- package/lib/accumulate.js +0 -46
- package/lib/accumulateInto.js +0 -58
- package/lib/adler32.js +0 -44
- package/lib/createMicrosoftUnsafeLocalFunction.js +0 -32
- package/lib/createReactNativeComponentClass.js +0 -42
- package/lib/dangerousStyleValue.js +0 -79
- package/lib/escapeTextContentForBrowser.js +0 -123
- package/lib/findDOMNode.js +0 -60
- package/lib/findNodeHandle.js +0 -91
- package/lib/forEachAccumulated.js +0 -31
- package/lib/getEventCharCode.js +0 -50
- package/lib/getEventKey.js +0 -102
- package/lib/getEventModifierState.js +0 -43
- package/lib/getEventTarget.js +0 -35
- package/lib/getHostComponentFromComposite.js +0 -30
- package/lib/getNodeForCharacterOffset.js +0 -74
- package/lib/getTestDocument.js +0 -21
- package/lib/getTextContentAccessor.js +0 -33
- package/lib/getVendorPrefixedEventName.js +0 -101
- package/lib/instantiateReactComponent.js +0 -119
- package/lib/isEventSupported.js +0 -60
- package/lib/isTextInputElement.js +0 -51
- package/lib/quoteAttributeValueForBrowser.js +0 -26
- package/lib/reactComponentExpect.js +0 -217
- package/lib/setInnerHTML.js +0 -98
- package/lib/setTextContent.js +0 -48
- package/lib/shouldUpdateReactComponent.js +0 -42
- package/lib/validateDOMNesting.js +0 -382
package/lib/SelectEventPlugin.js
DELETED
|
@@ -1,196 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Copyright 2013-present, Facebook, Inc.
|
|
3
|
-
* All rights reserved.
|
|
4
|
-
*
|
|
5
|
-
* This source code is licensed under the BSD-style license found in the
|
|
6
|
-
* LICENSE file in the root directory of this source tree. An additional grant
|
|
7
|
-
* of patent rights can be found in the PATENTS file in the same directory.
|
|
8
|
-
*
|
|
9
|
-
* @providesModule SelectEventPlugin
|
|
10
|
-
*/
|
|
11
|
-
|
|
12
|
-
'use strict';
|
|
13
|
-
|
|
14
|
-
var EventConstants = require('./EventConstants');
|
|
15
|
-
var EventPropagators = require('./EventPropagators');
|
|
16
|
-
var ExecutionEnvironment = require('fbjs/lib/ExecutionEnvironment');
|
|
17
|
-
var ReactDOMComponentTree = require('./ReactDOMComponentTree');
|
|
18
|
-
var ReactInputSelection = require('./ReactInputSelection');
|
|
19
|
-
var SyntheticEvent = require('./SyntheticEvent');
|
|
20
|
-
|
|
21
|
-
var getActiveElement = require('fbjs/lib/getActiveElement');
|
|
22
|
-
var isTextInputElement = require('./isTextInputElement');
|
|
23
|
-
var keyOf = require('fbjs/lib/keyOf');
|
|
24
|
-
var shallowEqual = require('fbjs/lib/shallowEqual');
|
|
25
|
-
|
|
26
|
-
var topLevelTypes = EventConstants.topLevelTypes;
|
|
27
|
-
|
|
28
|
-
var skipSelectionChangeEvent = ExecutionEnvironment.canUseDOM && 'documentMode' in document && document.documentMode <= 11;
|
|
29
|
-
|
|
30
|
-
var eventTypes = {
|
|
31
|
-
select: {
|
|
32
|
-
phasedRegistrationNames: {
|
|
33
|
-
bubbled: keyOf({ onSelect: null }),
|
|
34
|
-
captured: keyOf({ onSelectCapture: null })
|
|
35
|
-
},
|
|
36
|
-
dependencies: [topLevelTypes.topBlur, topLevelTypes.topContextMenu, topLevelTypes.topFocus, topLevelTypes.topKeyDown, topLevelTypes.topKeyUp, topLevelTypes.topMouseDown, topLevelTypes.topMouseUp, topLevelTypes.topSelectionChange]
|
|
37
|
-
}
|
|
38
|
-
};
|
|
39
|
-
|
|
40
|
-
var activeElement = null;
|
|
41
|
-
var activeElementInst = null;
|
|
42
|
-
var lastSelection = null;
|
|
43
|
-
var mouseDown = false;
|
|
44
|
-
|
|
45
|
-
// Track whether a listener exists for this plugin. If none exist, we do
|
|
46
|
-
// not extract events. See #3639.
|
|
47
|
-
var hasListener = false;
|
|
48
|
-
var ON_SELECT_KEY = keyOf({ onSelect: null });
|
|
49
|
-
|
|
50
|
-
/**
|
|
51
|
-
* Get an object which is a unique representation of the current selection.
|
|
52
|
-
*
|
|
53
|
-
* The return value will not be consistent across nodes or browsers, but
|
|
54
|
-
* two identical selections on the same node will return identical objects.
|
|
55
|
-
*
|
|
56
|
-
* @param {DOMElement} node
|
|
57
|
-
* @return {object}
|
|
58
|
-
*/
|
|
59
|
-
function getSelection(node) {
|
|
60
|
-
if ('selectionStart' in node && ReactInputSelection.hasSelectionCapabilities(node)) {
|
|
61
|
-
return {
|
|
62
|
-
start: node.selectionStart,
|
|
63
|
-
end: node.selectionEnd
|
|
64
|
-
};
|
|
65
|
-
} else if (window.getSelection) {
|
|
66
|
-
var selection = window.getSelection();
|
|
67
|
-
return {
|
|
68
|
-
anchorNode: selection.anchorNode,
|
|
69
|
-
anchorOffset: selection.anchorOffset,
|
|
70
|
-
focusNode: selection.focusNode,
|
|
71
|
-
focusOffset: selection.focusOffset
|
|
72
|
-
};
|
|
73
|
-
} else if (document.selection) {
|
|
74
|
-
var range = document.selection.createRange();
|
|
75
|
-
return {
|
|
76
|
-
parentElement: range.parentElement(),
|
|
77
|
-
text: range.text,
|
|
78
|
-
top: range.boundingTop,
|
|
79
|
-
left: range.boundingLeft
|
|
80
|
-
};
|
|
81
|
-
}
|
|
82
|
-
}
|
|
83
|
-
|
|
84
|
-
/**
|
|
85
|
-
* Poll selection to see whether it's changed.
|
|
86
|
-
*
|
|
87
|
-
* @param {object} nativeEvent
|
|
88
|
-
* @return {?SyntheticEvent}
|
|
89
|
-
*/
|
|
90
|
-
function constructSelectEvent(nativeEvent, nativeEventTarget) {
|
|
91
|
-
// Ensure we have the right element, and that the user is not dragging a
|
|
92
|
-
// selection (this matches native `select` event behavior). In HTML5, select
|
|
93
|
-
// fires only on input and textarea thus if there's no focused element we
|
|
94
|
-
// won't dispatch.
|
|
95
|
-
if (mouseDown || activeElement == null || activeElement !== getActiveElement()) {
|
|
96
|
-
return null;
|
|
97
|
-
}
|
|
98
|
-
|
|
99
|
-
// Only fire when selection has actually changed.
|
|
100
|
-
var currentSelection = getSelection(activeElement);
|
|
101
|
-
if (!lastSelection || !shallowEqual(lastSelection, currentSelection)) {
|
|
102
|
-
lastSelection = currentSelection;
|
|
103
|
-
|
|
104
|
-
var syntheticEvent = SyntheticEvent.getPooled(eventTypes.select, activeElementInst, nativeEvent, nativeEventTarget);
|
|
105
|
-
|
|
106
|
-
syntheticEvent.type = 'select';
|
|
107
|
-
syntheticEvent.target = activeElement;
|
|
108
|
-
|
|
109
|
-
EventPropagators.accumulateTwoPhaseDispatches(syntheticEvent);
|
|
110
|
-
|
|
111
|
-
return syntheticEvent;
|
|
112
|
-
}
|
|
113
|
-
|
|
114
|
-
return null;
|
|
115
|
-
}
|
|
116
|
-
|
|
117
|
-
/**
|
|
118
|
-
* This plugin creates an `onSelect` event that normalizes select events
|
|
119
|
-
* across form elements.
|
|
120
|
-
*
|
|
121
|
-
* Supported elements are:
|
|
122
|
-
* - input (see `isTextInputElement`)
|
|
123
|
-
* - textarea
|
|
124
|
-
* - contentEditable
|
|
125
|
-
*
|
|
126
|
-
* This differs from native browser implementations in the following ways:
|
|
127
|
-
* - Fires on contentEditable fields as well as inputs.
|
|
128
|
-
* - Fires for collapsed selection.
|
|
129
|
-
* - Fires after user input.
|
|
130
|
-
*/
|
|
131
|
-
var SelectEventPlugin = {
|
|
132
|
-
|
|
133
|
-
eventTypes: eventTypes,
|
|
134
|
-
|
|
135
|
-
extractEvents: function (topLevelType, targetInst, nativeEvent, nativeEventTarget) {
|
|
136
|
-
if (!hasListener) {
|
|
137
|
-
return null;
|
|
138
|
-
}
|
|
139
|
-
|
|
140
|
-
var targetNode = targetInst ? ReactDOMComponentTree.getNodeFromInstance(targetInst) : window;
|
|
141
|
-
|
|
142
|
-
switch (topLevelType) {
|
|
143
|
-
// Track the input node that has focus.
|
|
144
|
-
case topLevelTypes.topFocus:
|
|
145
|
-
if (isTextInputElement(targetNode) || targetNode.contentEditable === 'true') {
|
|
146
|
-
activeElement = targetNode;
|
|
147
|
-
activeElementInst = targetInst;
|
|
148
|
-
lastSelection = null;
|
|
149
|
-
}
|
|
150
|
-
break;
|
|
151
|
-
case topLevelTypes.topBlur:
|
|
152
|
-
activeElement = null;
|
|
153
|
-
activeElementInst = null;
|
|
154
|
-
lastSelection = null;
|
|
155
|
-
break;
|
|
156
|
-
|
|
157
|
-
// Don't fire the event while the user is dragging. This matches the
|
|
158
|
-
// semantics of the native select event.
|
|
159
|
-
case topLevelTypes.topMouseDown:
|
|
160
|
-
mouseDown = true;
|
|
161
|
-
break;
|
|
162
|
-
case topLevelTypes.topContextMenu:
|
|
163
|
-
case topLevelTypes.topMouseUp:
|
|
164
|
-
mouseDown = false;
|
|
165
|
-
return constructSelectEvent(nativeEvent, nativeEventTarget);
|
|
166
|
-
|
|
167
|
-
// Chrome and IE fire non-standard event when selection is changed (and
|
|
168
|
-
// sometimes when it hasn't). IE's event fires out of order with respect
|
|
169
|
-
// to key and input events on deletion, so we discard it.
|
|
170
|
-
//
|
|
171
|
-
// Firefox doesn't support selectionchange, so check selection status
|
|
172
|
-
// after each key entry. The selection changes after keydown and before
|
|
173
|
-
// keyup, but we check on keydown as well in the case of holding down a
|
|
174
|
-
// key, when multiple keydown events are fired but only one keyup is.
|
|
175
|
-
// This is also our approach for IE handling, for the reason above.
|
|
176
|
-
case topLevelTypes.topSelectionChange:
|
|
177
|
-
if (skipSelectionChangeEvent) {
|
|
178
|
-
break;
|
|
179
|
-
}
|
|
180
|
-
// falls through
|
|
181
|
-
case topLevelTypes.topKeyDown:
|
|
182
|
-
case topLevelTypes.topKeyUp:
|
|
183
|
-
return constructSelectEvent(nativeEvent, nativeEventTarget);
|
|
184
|
-
}
|
|
185
|
-
|
|
186
|
-
return null;
|
|
187
|
-
},
|
|
188
|
-
|
|
189
|
-
didPutListener: function (inst, registrationName, listener) {
|
|
190
|
-
if (registrationName === ON_SELECT_KEY) {
|
|
191
|
-
hasListener = true;
|
|
192
|
-
}
|
|
193
|
-
}
|
|
194
|
-
};
|
|
195
|
-
|
|
196
|
-
module.exports = SelectEventPlugin;
|
package/lib/SimpleEventPlugin.js
DELETED
|
@@ -1,635 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Copyright 2013-present, Facebook, Inc.
|
|
3
|
-
* All rights reserved.
|
|
4
|
-
*
|
|
5
|
-
* This source code is licensed under the BSD-style license found in the
|
|
6
|
-
* LICENSE file in the root directory of this source tree. An additional grant
|
|
7
|
-
* of patent rights can be found in the PATENTS file in the same directory.
|
|
8
|
-
*
|
|
9
|
-
* @providesModule SimpleEventPlugin
|
|
10
|
-
*/
|
|
11
|
-
|
|
12
|
-
'use strict';
|
|
13
|
-
|
|
14
|
-
var _prodInvariant = require('./reactProdInvariant');
|
|
15
|
-
|
|
16
|
-
var EventConstants = require('./EventConstants');
|
|
17
|
-
var EventListener = require('fbjs/lib/EventListener');
|
|
18
|
-
var EventPropagators = require('./EventPropagators');
|
|
19
|
-
var ReactDOMComponentTree = require('./ReactDOMComponentTree');
|
|
20
|
-
var SyntheticAnimationEvent = require('./SyntheticAnimationEvent');
|
|
21
|
-
var SyntheticClipboardEvent = require('./SyntheticClipboardEvent');
|
|
22
|
-
var SyntheticEvent = require('./SyntheticEvent');
|
|
23
|
-
var SyntheticFocusEvent = require('./SyntheticFocusEvent');
|
|
24
|
-
var SyntheticKeyboardEvent = require('./SyntheticKeyboardEvent');
|
|
25
|
-
var SyntheticMouseEvent = require('./SyntheticMouseEvent');
|
|
26
|
-
var SyntheticDragEvent = require('./SyntheticDragEvent');
|
|
27
|
-
var SyntheticTouchEvent = require('./SyntheticTouchEvent');
|
|
28
|
-
var SyntheticTransitionEvent = require('./SyntheticTransitionEvent');
|
|
29
|
-
var SyntheticUIEvent = require('./SyntheticUIEvent');
|
|
30
|
-
var SyntheticWheelEvent = require('./SyntheticWheelEvent');
|
|
31
|
-
|
|
32
|
-
var emptyFunction = require('fbjs/lib/emptyFunction');
|
|
33
|
-
var getEventCharCode = require('./getEventCharCode');
|
|
34
|
-
var invariant = require('fbjs/lib/invariant');
|
|
35
|
-
var keyOf = require('fbjs/lib/keyOf');
|
|
36
|
-
|
|
37
|
-
var topLevelTypes = EventConstants.topLevelTypes;
|
|
38
|
-
|
|
39
|
-
var eventTypes = {
|
|
40
|
-
abort: {
|
|
41
|
-
phasedRegistrationNames: {
|
|
42
|
-
bubbled: keyOf({ onAbort: true }),
|
|
43
|
-
captured: keyOf({ onAbortCapture: true })
|
|
44
|
-
}
|
|
45
|
-
},
|
|
46
|
-
animationEnd: {
|
|
47
|
-
phasedRegistrationNames: {
|
|
48
|
-
bubbled: keyOf({ onAnimationEnd: true }),
|
|
49
|
-
captured: keyOf({ onAnimationEndCapture: true })
|
|
50
|
-
}
|
|
51
|
-
},
|
|
52
|
-
animationIteration: {
|
|
53
|
-
phasedRegistrationNames: {
|
|
54
|
-
bubbled: keyOf({ onAnimationIteration: true }),
|
|
55
|
-
captured: keyOf({ onAnimationIterationCapture: true })
|
|
56
|
-
}
|
|
57
|
-
},
|
|
58
|
-
animationStart: {
|
|
59
|
-
phasedRegistrationNames: {
|
|
60
|
-
bubbled: keyOf({ onAnimationStart: true }),
|
|
61
|
-
captured: keyOf({ onAnimationStartCapture: true })
|
|
62
|
-
}
|
|
63
|
-
},
|
|
64
|
-
blur: {
|
|
65
|
-
phasedRegistrationNames: {
|
|
66
|
-
bubbled: keyOf({ onBlur: true }),
|
|
67
|
-
captured: keyOf({ onBlurCapture: true })
|
|
68
|
-
}
|
|
69
|
-
},
|
|
70
|
-
canPlay: {
|
|
71
|
-
phasedRegistrationNames: {
|
|
72
|
-
bubbled: keyOf({ onCanPlay: true }),
|
|
73
|
-
captured: keyOf({ onCanPlayCapture: true })
|
|
74
|
-
}
|
|
75
|
-
},
|
|
76
|
-
canPlayThrough: {
|
|
77
|
-
phasedRegistrationNames: {
|
|
78
|
-
bubbled: keyOf({ onCanPlayThrough: true }),
|
|
79
|
-
captured: keyOf({ onCanPlayThroughCapture: true })
|
|
80
|
-
}
|
|
81
|
-
},
|
|
82
|
-
click: {
|
|
83
|
-
phasedRegistrationNames: {
|
|
84
|
-
bubbled: keyOf({ onClick: true }),
|
|
85
|
-
captured: keyOf({ onClickCapture: true })
|
|
86
|
-
}
|
|
87
|
-
},
|
|
88
|
-
contextMenu: {
|
|
89
|
-
phasedRegistrationNames: {
|
|
90
|
-
bubbled: keyOf({ onContextMenu: true }),
|
|
91
|
-
captured: keyOf({ onContextMenuCapture: true })
|
|
92
|
-
}
|
|
93
|
-
},
|
|
94
|
-
copy: {
|
|
95
|
-
phasedRegistrationNames: {
|
|
96
|
-
bubbled: keyOf({ onCopy: true }),
|
|
97
|
-
captured: keyOf({ onCopyCapture: true })
|
|
98
|
-
}
|
|
99
|
-
},
|
|
100
|
-
cut: {
|
|
101
|
-
phasedRegistrationNames: {
|
|
102
|
-
bubbled: keyOf({ onCut: true }),
|
|
103
|
-
captured: keyOf({ onCutCapture: true })
|
|
104
|
-
}
|
|
105
|
-
},
|
|
106
|
-
doubleClick: {
|
|
107
|
-
phasedRegistrationNames: {
|
|
108
|
-
bubbled: keyOf({ onDoubleClick: true }),
|
|
109
|
-
captured: keyOf({ onDoubleClickCapture: true })
|
|
110
|
-
}
|
|
111
|
-
},
|
|
112
|
-
drag: {
|
|
113
|
-
phasedRegistrationNames: {
|
|
114
|
-
bubbled: keyOf({ onDrag: true }),
|
|
115
|
-
captured: keyOf({ onDragCapture: true })
|
|
116
|
-
}
|
|
117
|
-
},
|
|
118
|
-
dragEnd: {
|
|
119
|
-
phasedRegistrationNames: {
|
|
120
|
-
bubbled: keyOf({ onDragEnd: true }),
|
|
121
|
-
captured: keyOf({ onDragEndCapture: true })
|
|
122
|
-
}
|
|
123
|
-
},
|
|
124
|
-
dragEnter: {
|
|
125
|
-
phasedRegistrationNames: {
|
|
126
|
-
bubbled: keyOf({ onDragEnter: true }),
|
|
127
|
-
captured: keyOf({ onDragEnterCapture: true })
|
|
128
|
-
}
|
|
129
|
-
},
|
|
130
|
-
dragExit: {
|
|
131
|
-
phasedRegistrationNames: {
|
|
132
|
-
bubbled: keyOf({ onDragExit: true }),
|
|
133
|
-
captured: keyOf({ onDragExitCapture: true })
|
|
134
|
-
}
|
|
135
|
-
},
|
|
136
|
-
dragLeave: {
|
|
137
|
-
phasedRegistrationNames: {
|
|
138
|
-
bubbled: keyOf({ onDragLeave: true }),
|
|
139
|
-
captured: keyOf({ onDragLeaveCapture: true })
|
|
140
|
-
}
|
|
141
|
-
},
|
|
142
|
-
dragOver: {
|
|
143
|
-
phasedRegistrationNames: {
|
|
144
|
-
bubbled: keyOf({ onDragOver: true }),
|
|
145
|
-
captured: keyOf({ onDragOverCapture: true })
|
|
146
|
-
}
|
|
147
|
-
},
|
|
148
|
-
dragStart: {
|
|
149
|
-
phasedRegistrationNames: {
|
|
150
|
-
bubbled: keyOf({ onDragStart: true }),
|
|
151
|
-
captured: keyOf({ onDragStartCapture: true })
|
|
152
|
-
}
|
|
153
|
-
},
|
|
154
|
-
drop: {
|
|
155
|
-
phasedRegistrationNames: {
|
|
156
|
-
bubbled: keyOf({ onDrop: true }),
|
|
157
|
-
captured: keyOf({ onDropCapture: true })
|
|
158
|
-
}
|
|
159
|
-
},
|
|
160
|
-
durationChange: {
|
|
161
|
-
phasedRegistrationNames: {
|
|
162
|
-
bubbled: keyOf({ onDurationChange: true }),
|
|
163
|
-
captured: keyOf({ onDurationChangeCapture: true })
|
|
164
|
-
}
|
|
165
|
-
},
|
|
166
|
-
emptied: {
|
|
167
|
-
phasedRegistrationNames: {
|
|
168
|
-
bubbled: keyOf({ onEmptied: true }),
|
|
169
|
-
captured: keyOf({ onEmptiedCapture: true })
|
|
170
|
-
}
|
|
171
|
-
},
|
|
172
|
-
encrypted: {
|
|
173
|
-
phasedRegistrationNames: {
|
|
174
|
-
bubbled: keyOf({ onEncrypted: true }),
|
|
175
|
-
captured: keyOf({ onEncryptedCapture: true })
|
|
176
|
-
}
|
|
177
|
-
},
|
|
178
|
-
ended: {
|
|
179
|
-
phasedRegistrationNames: {
|
|
180
|
-
bubbled: keyOf({ onEnded: true }),
|
|
181
|
-
captured: keyOf({ onEndedCapture: true })
|
|
182
|
-
}
|
|
183
|
-
},
|
|
184
|
-
error: {
|
|
185
|
-
phasedRegistrationNames: {
|
|
186
|
-
bubbled: keyOf({ onError: true }),
|
|
187
|
-
captured: keyOf({ onErrorCapture: true })
|
|
188
|
-
}
|
|
189
|
-
},
|
|
190
|
-
focus: {
|
|
191
|
-
phasedRegistrationNames: {
|
|
192
|
-
bubbled: keyOf({ onFocus: true }),
|
|
193
|
-
captured: keyOf({ onFocusCapture: true })
|
|
194
|
-
}
|
|
195
|
-
},
|
|
196
|
-
input: {
|
|
197
|
-
phasedRegistrationNames: {
|
|
198
|
-
bubbled: keyOf({ onInput: true }),
|
|
199
|
-
captured: keyOf({ onInputCapture: true })
|
|
200
|
-
}
|
|
201
|
-
},
|
|
202
|
-
invalid: {
|
|
203
|
-
phasedRegistrationNames: {
|
|
204
|
-
bubbled: keyOf({ onInvalid: true }),
|
|
205
|
-
captured: keyOf({ onInvalidCapture: true })
|
|
206
|
-
}
|
|
207
|
-
},
|
|
208
|
-
keyDown: {
|
|
209
|
-
phasedRegistrationNames: {
|
|
210
|
-
bubbled: keyOf({ onKeyDown: true }),
|
|
211
|
-
captured: keyOf({ onKeyDownCapture: true })
|
|
212
|
-
}
|
|
213
|
-
},
|
|
214
|
-
keyPress: {
|
|
215
|
-
phasedRegistrationNames: {
|
|
216
|
-
bubbled: keyOf({ onKeyPress: true }),
|
|
217
|
-
captured: keyOf({ onKeyPressCapture: true })
|
|
218
|
-
}
|
|
219
|
-
},
|
|
220
|
-
keyUp: {
|
|
221
|
-
phasedRegistrationNames: {
|
|
222
|
-
bubbled: keyOf({ onKeyUp: true }),
|
|
223
|
-
captured: keyOf({ onKeyUpCapture: true })
|
|
224
|
-
}
|
|
225
|
-
},
|
|
226
|
-
load: {
|
|
227
|
-
phasedRegistrationNames: {
|
|
228
|
-
bubbled: keyOf({ onLoad: true }),
|
|
229
|
-
captured: keyOf({ onLoadCapture: true })
|
|
230
|
-
}
|
|
231
|
-
},
|
|
232
|
-
loadedData: {
|
|
233
|
-
phasedRegistrationNames: {
|
|
234
|
-
bubbled: keyOf({ onLoadedData: true }),
|
|
235
|
-
captured: keyOf({ onLoadedDataCapture: true })
|
|
236
|
-
}
|
|
237
|
-
},
|
|
238
|
-
loadedMetadata: {
|
|
239
|
-
phasedRegistrationNames: {
|
|
240
|
-
bubbled: keyOf({ onLoadedMetadata: true }),
|
|
241
|
-
captured: keyOf({ onLoadedMetadataCapture: true })
|
|
242
|
-
}
|
|
243
|
-
},
|
|
244
|
-
loadStart: {
|
|
245
|
-
phasedRegistrationNames: {
|
|
246
|
-
bubbled: keyOf({ onLoadStart: true }),
|
|
247
|
-
captured: keyOf({ onLoadStartCapture: true })
|
|
248
|
-
}
|
|
249
|
-
},
|
|
250
|
-
// Note: We do not allow listening to mouseOver events. Instead, use the
|
|
251
|
-
// onMouseEnter/onMouseLeave created by `EnterLeaveEventPlugin`.
|
|
252
|
-
mouseDown: {
|
|
253
|
-
phasedRegistrationNames: {
|
|
254
|
-
bubbled: keyOf({ onMouseDown: true }),
|
|
255
|
-
captured: keyOf({ onMouseDownCapture: true })
|
|
256
|
-
}
|
|
257
|
-
},
|
|
258
|
-
mouseMove: {
|
|
259
|
-
phasedRegistrationNames: {
|
|
260
|
-
bubbled: keyOf({ onMouseMove: true }),
|
|
261
|
-
captured: keyOf({ onMouseMoveCapture: true })
|
|
262
|
-
}
|
|
263
|
-
},
|
|
264
|
-
mouseOut: {
|
|
265
|
-
phasedRegistrationNames: {
|
|
266
|
-
bubbled: keyOf({ onMouseOut: true }),
|
|
267
|
-
captured: keyOf({ onMouseOutCapture: true })
|
|
268
|
-
}
|
|
269
|
-
},
|
|
270
|
-
mouseOver: {
|
|
271
|
-
phasedRegistrationNames: {
|
|
272
|
-
bubbled: keyOf({ onMouseOver: true }),
|
|
273
|
-
captured: keyOf({ onMouseOverCapture: true })
|
|
274
|
-
}
|
|
275
|
-
},
|
|
276
|
-
mouseUp: {
|
|
277
|
-
phasedRegistrationNames: {
|
|
278
|
-
bubbled: keyOf({ onMouseUp: true }),
|
|
279
|
-
captured: keyOf({ onMouseUpCapture: true })
|
|
280
|
-
}
|
|
281
|
-
},
|
|
282
|
-
paste: {
|
|
283
|
-
phasedRegistrationNames: {
|
|
284
|
-
bubbled: keyOf({ onPaste: true }),
|
|
285
|
-
captured: keyOf({ onPasteCapture: true })
|
|
286
|
-
}
|
|
287
|
-
},
|
|
288
|
-
pause: {
|
|
289
|
-
phasedRegistrationNames: {
|
|
290
|
-
bubbled: keyOf({ onPause: true }),
|
|
291
|
-
captured: keyOf({ onPauseCapture: true })
|
|
292
|
-
}
|
|
293
|
-
},
|
|
294
|
-
play: {
|
|
295
|
-
phasedRegistrationNames: {
|
|
296
|
-
bubbled: keyOf({ onPlay: true }),
|
|
297
|
-
captured: keyOf({ onPlayCapture: true })
|
|
298
|
-
}
|
|
299
|
-
},
|
|
300
|
-
playing: {
|
|
301
|
-
phasedRegistrationNames: {
|
|
302
|
-
bubbled: keyOf({ onPlaying: true }),
|
|
303
|
-
captured: keyOf({ onPlayingCapture: true })
|
|
304
|
-
}
|
|
305
|
-
},
|
|
306
|
-
progress: {
|
|
307
|
-
phasedRegistrationNames: {
|
|
308
|
-
bubbled: keyOf({ onProgress: true }),
|
|
309
|
-
captured: keyOf({ onProgressCapture: true })
|
|
310
|
-
}
|
|
311
|
-
},
|
|
312
|
-
rateChange: {
|
|
313
|
-
phasedRegistrationNames: {
|
|
314
|
-
bubbled: keyOf({ onRateChange: true }),
|
|
315
|
-
captured: keyOf({ onRateChangeCapture: true })
|
|
316
|
-
}
|
|
317
|
-
},
|
|
318
|
-
reset: {
|
|
319
|
-
phasedRegistrationNames: {
|
|
320
|
-
bubbled: keyOf({ onReset: true }),
|
|
321
|
-
captured: keyOf({ onResetCapture: true })
|
|
322
|
-
}
|
|
323
|
-
},
|
|
324
|
-
scroll: {
|
|
325
|
-
phasedRegistrationNames: {
|
|
326
|
-
bubbled: keyOf({ onScroll: true }),
|
|
327
|
-
captured: keyOf({ onScrollCapture: true })
|
|
328
|
-
}
|
|
329
|
-
},
|
|
330
|
-
seeked: {
|
|
331
|
-
phasedRegistrationNames: {
|
|
332
|
-
bubbled: keyOf({ onSeeked: true }),
|
|
333
|
-
captured: keyOf({ onSeekedCapture: true })
|
|
334
|
-
}
|
|
335
|
-
},
|
|
336
|
-
seeking: {
|
|
337
|
-
phasedRegistrationNames: {
|
|
338
|
-
bubbled: keyOf({ onSeeking: true }),
|
|
339
|
-
captured: keyOf({ onSeekingCapture: true })
|
|
340
|
-
}
|
|
341
|
-
},
|
|
342
|
-
stalled: {
|
|
343
|
-
phasedRegistrationNames: {
|
|
344
|
-
bubbled: keyOf({ onStalled: true }),
|
|
345
|
-
captured: keyOf({ onStalledCapture: true })
|
|
346
|
-
}
|
|
347
|
-
},
|
|
348
|
-
submit: {
|
|
349
|
-
phasedRegistrationNames: {
|
|
350
|
-
bubbled: keyOf({ onSubmit: true }),
|
|
351
|
-
captured: keyOf({ onSubmitCapture: true })
|
|
352
|
-
}
|
|
353
|
-
},
|
|
354
|
-
suspend: {
|
|
355
|
-
phasedRegistrationNames: {
|
|
356
|
-
bubbled: keyOf({ onSuspend: true }),
|
|
357
|
-
captured: keyOf({ onSuspendCapture: true })
|
|
358
|
-
}
|
|
359
|
-
},
|
|
360
|
-
timeUpdate: {
|
|
361
|
-
phasedRegistrationNames: {
|
|
362
|
-
bubbled: keyOf({ onTimeUpdate: true }),
|
|
363
|
-
captured: keyOf({ onTimeUpdateCapture: true })
|
|
364
|
-
}
|
|
365
|
-
},
|
|
366
|
-
touchCancel: {
|
|
367
|
-
phasedRegistrationNames: {
|
|
368
|
-
bubbled: keyOf({ onTouchCancel: true }),
|
|
369
|
-
captured: keyOf({ onTouchCancelCapture: true })
|
|
370
|
-
}
|
|
371
|
-
},
|
|
372
|
-
touchEnd: {
|
|
373
|
-
phasedRegistrationNames: {
|
|
374
|
-
bubbled: keyOf({ onTouchEnd: true }),
|
|
375
|
-
captured: keyOf({ onTouchEndCapture: true })
|
|
376
|
-
}
|
|
377
|
-
},
|
|
378
|
-
touchMove: {
|
|
379
|
-
phasedRegistrationNames: {
|
|
380
|
-
bubbled: keyOf({ onTouchMove: true }),
|
|
381
|
-
captured: keyOf({ onTouchMoveCapture: true })
|
|
382
|
-
}
|
|
383
|
-
},
|
|
384
|
-
touchStart: {
|
|
385
|
-
phasedRegistrationNames: {
|
|
386
|
-
bubbled: keyOf({ onTouchStart: true }),
|
|
387
|
-
captured: keyOf({ onTouchStartCapture: true })
|
|
388
|
-
}
|
|
389
|
-
},
|
|
390
|
-
transitionEnd: {
|
|
391
|
-
phasedRegistrationNames: {
|
|
392
|
-
bubbled: keyOf({ onTransitionEnd: true }),
|
|
393
|
-
captured: keyOf({ onTransitionEndCapture: true })
|
|
394
|
-
}
|
|
395
|
-
},
|
|
396
|
-
volumeChange: {
|
|
397
|
-
phasedRegistrationNames: {
|
|
398
|
-
bubbled: keyOf({ onVolumeChange: true }),
|
|
399
|
-
captured: keyOf({ onVolumeChangeCapture: true })
|
|
400
|
-
}
|
|
401
|
-
},
|
|
402
|
-
waiting: {
|
|
403
|
-
phasedRegistrationNames: {
|
|
404
|
-
bubbled: keyOf({ onWaiting: true }),
|
|
405
|
-
captured: keyOf({ onWaitingCapture: true })
|
|
406
|
-
}
|
|
407
|
-
},
|
|
408
|
-
wheel: {
|
|
409
|
-
phasedRegistrationNames: {
|
|
410
|
-
bubbled: keyOf({ onWheel: true }),
|
|
411
|
-
captured: keyOf({ onWheelCapture: true })
|
|
412
|
-
}
|
|
413
|
-
}
|
|
414
|
-
};
|
|
415
|
-
|
|
416
|
-
var topLevelEventsToDispatchConfig = {
|
|
417
|
-
topAbort: eventTypes.abort,
|
|
418
|
-
topAnimationEnd: eventTypes.animationEnd,
|
|
419
|
-
topAnimationIteration: eventTypes.animationIteration,
|
|
420
|
-
topAnimationStart: eventTypes.animationStart,
|
|
421
|
-
topBlur: eventTypes.blur,
|
|
422
|
-
topCanPlay: eventTypes.canPlay,
|
|
423
|
-
topCanPlayThrough: eventTypes.canPlayThrough,
|
|
424
|
-
topClick: eventTypes.click,
|
|
425
|
-
topContextMenu: eventTypes.contextMenu,
|
|
426
|
-
topCopy: eventTypes.copy,
|
|
427
|
-
topCut: eventTypes.cut,
|
|
428
|
-
topDoubleClick: eventTypes.doubleClick,
|
|
429
|
-
topDrag: eventTypes.drag,
|
|
430
|
-
topDragEnd: eventTypes.dragEnd,
|
|
431
|
-
topDragEnter: eventTypes.dragEnter,
|
|
432
|
-
topDragExit: eventTypes.dragExit,
|
|
433
|
-
topDragLeave: eventTypes.dragLeave,
|
|
434
|
-
topDragOver: eventTypes.dragOver,
|
|
435
|
-
topDragStart: eventTypes.dragStart,
|
|
436
|
-
topDrop: eventTypes.drop,
|
|
437
|
-
topDurationChange: eventTypes.durationChange,
|
|
438
|
-
topEmptied: eventTypes.emptied,
|
|
439
|
-
topEncrypted: eventTypes.encrypted,
|
|
440
|
-
topEnded: eventTypes.ended,
|
|
441
|
-
topError: eventTypes.error,
|
|
442
|
-
topFocus: eventTypes.focus,
|
|
443
|
-
topInput: eventTypes.input,
|
|
444
|
-
topInvalid: eventTypes.invalid,
|
|
445
|
-
topKeyDown: eventTypes.keyDown,
|
|
446
|
-
topKeyPress: eventTypes.keyPress,
|
|
447
|
-
topKeyUp: eventTypes.keyUp,
|
|
448
|
-
topLoad: eventTypes.load,
|
|
449
|
-
topLoadedData: eventTypes.loadedData,
|
|
450
|
-
topLoadedMetadata: eventTypes.loadedMetadata,
|
|
451
|
-
topLoadStart: eventTypes.loadStart,
|
|
452
|
-
topMouseDown: eventTypes.mouseDown,
|
|
453
|
-
topMouseMove: eventTypes.mouseMove,
|
|
454
|
-
topMouseOut: eventTypes.mouseOut,
|
|
455
|
-
topMouseOver: eventTypes.mouseOver,
|
|
456
|
-
topMouseUp: eventTypes.mouseUp,
|
|
457
|
-
topPaste: eventTypes.paste,
|
|
458
|
-
topPause: eventTypes.pause,
|
|
459
|
-
topPlay: eventTypes.play,
|
|
460
|
-
topPlaying: eventTypes.playing,
|
|
461
|
-
topProgress: eventTypes.progress,
|
|
462
|
-
topRateChange: eventTypes.rateChange,
|
|
463
|
-
topReset: eventTypes.reset,
|
|
464
|
-
topScroll: eventTypes.scroll,
|
|
465
|
-
topSeeked: eventTypes.seeked,
|
|
466
|
-
topSeeking: eventTypes.seeking,
|
|
467
|
-
topStalled: eventTypes.stalled,
|
|
468
|
-
topSubmit: eventTypes.submit,
|
|
469
|
-
topSuspend: eventTypes.suspend,
|
|
470
|
-
topTimeUpdate: eventTypes.timeUpdate,
|
|
471
|
-
topTouchCancel: eventTypes.touchCancel,
|
|
472
|
-
topTouchEnd: eventTypes.touchEnd,
|
|
473
|
-
topTouchMove: eventTypes.touchMove,
|
|
474
|
-
topTouchStart: eventTypes.touchStart,
|
|
475
|
-
topTransitionEnd: eventTypes.transitionEnd,
|
|
476
|
-
topVolumeChange: eventTypes.volumeChange,
|
|
477
|
-
topWaiting: eventTypes.waiting,
|
|
478
|
-
topWheel: eventTypes.wheel
|
|
479
|
-
};
|
|
480
|
-
|
|
481
|
-
for (var type in topLevelEventsToDispatchConfig) {
|
|
482
|
-
topLevelEventsToDispatchConfig[type].dependencies = [type];
|
|
483
|
-
}
|
|
484
|
-
|
|
485
|
-
var ON_CLICK_KEY = keyOf({ onClick: null });
|
|
486
|
-
var onClickListeners = {};
|
|
487
|
-
|
|
488
|
-
function getDictionaryKey(inst) {
|
|
489
|
-
// Prevents V8 performance issue:
|
|
490
|
-
// https://github.com/facebook/react/pull/7232
|
|
491
|
-
return '.' + inst._rootNodeID;
|
|
492
|
-
}
|
|
493
|
-
|
|
494
|
-
var SimpleEventPlugin = {
|
|
495
|
-
|
|
496
|
-
eventTypes: eventTypes,
|
|
497
|
-
|
|
498
|
-
extractEvents: function (topLevelType, targetInst, nativeEvent, nativeEventTarget) {
|
|
499
|
-
var dispatchConfig = topLevelEventsToDispatchConfig[topLevelType];
|
|
500
|
-
if (!dispatchConfig) {
|
|
501
|
-
return null;
|
|
502
|
-
}
|
|
503
|
-
var EventConstructor;
|
|
504
|
-
switch (topLevelType) {
|
|
505
|
-
case topLevelTypes.topAbort:
|
|
506
|
-
case topLevelTypes.topCanPlay:
|
|
507
|
-
case topLevelTypes.topCanPlayThrough:
|
|
508
|
-
case topLevelTypes.topDurationChange:
|
|
509
|
-
case topLevelTypes.topEmptied:
|
|
510
|
-
case topLevelTypes.topEncrypted:
|
|
511
|
-
case topLevelTypes.topEnded:
|
|
512
|
-
case topLevelTypes.topError:
|
|
513
|
-
case topLevelTypes.topInput:
|
|
514
|
-
case topLevelTypes.topInvalid:
|
|
515
|
-
case topLevelTypes.topLoad:
|
|
516
|
-
case topLevelTypes.topLoadedData:
|
|
517
|
-
case topLevelTypes.topLoadedMetadata:
|
|
518
|
-
case topLevelTypes.topLoadStart:
|
|
519
|
-
case topLevelTypes.topPause:
|
|
520
|
-
case topLevelTypes.topPlay:
|
|
521
|
-
case topLevelTypes.topPlaying:
|
|
522
|
-
case topLevelTypes.topProgress:
|
|
523
|
-
case topLevelTypes.topRateChange:
|
|
524
|
-
case topLevelTypes.topReset:
|
|
525
|
-
case topLevelTypes.topSeeked:
|
|
526
|
-
case topLevelTypes.topSeeking:
|
|
527
|
-
case topLevelTypes.topStalled:
|
|
528
|
-
case topLevelTypes.topSubmit:
|
|
529
|
-
case topLevelTypes.topSuspend:
|
|
530
|
-
case topLevelTypes.topTimeUpdate:
|
|
531
|
-
case topLevelTypes.topVolumeChange:
|
|
532
|
-
case topLevelTypes.topWaiting:
|
|
533
|
-
// HTML Events
|
|
534
|
-
// @see http://www.w3.org/TR/html5/index.html#events-0
|
|
535
|
-
EventConstructor = SyntheticEvent;
|
|
536
|
-
break;
|
|
537
|
-
case topLevelTypes.topKeyPress:
|
|
538
|
-
// Firefox creates a keypress event for function keys too. This removes
|
|
539
|
-
// the unwanted keypress events. Enter is however both printable and
|
|
540
|
-
// non-printable. One would expect Tab to be as well (but it isn't).
|
|
541
|
-
if (getEventCharCode(nativeEvent) === 0) {
|
|
542
|
-
return null;
|
|
543
|
-
}
|
|
544
|
-
/* falls through */
|
|
545
|
-
case topLevelTypes.topKeyDown:
|
|
546
|
-
case topLevelTypes.topKeyUp:
|
|
547
|
-
EventConstructor = SyntheticKeyboardEvent;
|
|
548
|
-
break;
|
|
549
|
-
case topLevelTypes.topBlur:
|
|
550
|
-
case topLevelTypes.topFocus:
|
|
551
|
-
EventConstructor = SyntheticFocusEvent;
|
|
552
|
-
break;
|
|
553
|
-
case topLevelTypes.topClick:
|
|
554
|
-
// Firefox creates a click event on right mouse clicks. This removes the
|
|
555
|
-
// unwanted click events.
|
|
556
|
-
if (nativeEvent.button === 2) {
|
|
557
|
-
return null;
|
|
558
|
-
}
|
|
559
|
-
/* falls through */
|
|
560
|
-
case topLevelTypes.topContextMenu:
|
|
561
|
-
case topLevelTypes.topDoubleClick:
|
|
562
|
-
case topLevelTypes.topMouseDown:
|
|
563
|
-
case topLevelTypes.topMouseMove:
|
|
564
|
-
case topLevelTypes.topMouseOut:
|
|
565
|
-
case topLevelTypes.topMouseOver:
|
|
566
|
-
case topLevelTypes.topMouseUp:
|
|
567
|
-
EventConstructor = SyntheticMouseEvent;
|
|
568
|
-
break;
|
|
569
|
-
case topLevelTypes.topDrag:
|
|
570
|
-
case topLevelTypes.topDragEnd:
|
|
571
|
-
case topLevelTypes.topDragEnter:
|
|
572
|
-
case topLevelTypes.topDragExit:
|
|
573
|
-
case topLevelTypes.topDragLeave:
|
|
574
|
-
case topLevelTypes.topDragOver:
|
|
575
|
-
case topLevelTypes.topDragStart:
|
|
576
|
-
case topLevelTypes.topDrop:
|
|
577
|
-
EventConstructor = SyntheticDragEvent;
|
|
578
|
-
break;
|
|
579
|
-
case topLevelTypes.topTouchCancel:
|
|
580
|
-
case topLevelTypes.topTouchEnd:
|
|
581
|
-
case topLevelTypes.topTouchMove:
|
|
582
|
-
case topLevelTypes.topTouchStart:
|
|
583
|
-
EventConstructor = SyntheticTouchEvent;
|
|
584
|
-
break;
|
|
585
|
-
case topLevelTypes.topAnimationEnd:
|
|
586
|
-
case topLevelTypes.topAnimationIteration:
|
|
587
|
-
case topLevelTypes.topAnimationStart:
|
|
588
|
-
EventConstructor = SyntheticAnimationEvent;
|
|
589
|
-
break;
|
|
590
|
-
case topLevelTypes.topTransitionEnd:
|
|
591
|
-
EventConstructor = SyntheticTransitionEvent;
|
|
592
|
-
break;
|
|
593
|
-
case topLevelTypes.topScroll:
|
|
594
|
-
EventConstructor = SyntheticUIEvent;
|
|
595
|
-
break;
|
|
596
|
-
case topLevelTypes.topWheel:
|
|
597
|
-
EventConstructor = SyntheticWheelEvent;
|
|
598
|
-
break;
|
|
599
|
-
case topLevelTypes.topCopy:
|
|
600
|
-
case topLevelTypes.topCut:
|
|
601
|
-
case topLevelTypes.topPaste:
|
|
602
|
-
EventConstructor = SyntheticClipboardEvent;
|
|
603
|
-
break;
|
|
604
|
-
}
|
|
605
|
-
!EventConstructor ? process.env.NODE_ENV !== 'production' ? invariant(false, 'SimpleEventPlugin: Unhandled event type, `%s`.', topLevelType) : _prodInvariant('86', topLevelType) : void 0;
|
|
606
|
-
var event = EventConstructor.getPooled(dispatchConfig, targetInst, nativeEvent, nativeEventTarget);
|
|
607
|
-
EventPropagators.accumulateTwoPhaseDispatches(event);
|
|
608
|
-
return event;
|
|
609
|
-
},
|
|
610
|
-
|
|
611
|
-
didPutListener: function (inst, registrationName, listener) {
|
|
612
|
-
// Mobile Safari does not fire properly bubble click events on
|
|
613
|
-
// non-interactive elements, which means delegated click listeners do not
|
|
614
|
-
// fire. The workaround for this bug involves attaching an empty click
|
|
615
|
-
// listener on the target node.
|
|
616
|
-
if (registrationName === ON_CLICK_KEY) {
|
|
617
|
-
var key = getDictionaryKey(inst);
|
|
618
|
-
var node = ReactDOMComponentTree.getNodeFromInstance(inst);
|
|
619
|
-
if (!onClickListeners[key]) {
|
|
620
|
-
onClickListeners[key] = EventListener.listen(node, 'click', emptyFunction);
|
|
621
|
-
}
|
|
622
|
-
}
|
|
623
|
-
},
|
|
624
|
-
|
|
625
|
-
willDeleteListener: function (inst, registrationName) {
|
|
626
|
-
if (registrationName === ON_CLICK_KEY) {
|
|
627
|
-
var key = getDictionaryKey(inst);
|
|
628
|
-
onClickListeners[key].remove();
|
|
629
|
-
delete onClickListeners[key];
|
|
630
|
-
}
|
|
631
|
-
}
|
|
632
|
-
|
|
633
|
-
};
|
|
634
|
-
|
|
635
|
-
module.exports = SimpleEventPlugin;
|