react 0.14.0-beta1 → 0.14.0-beta2
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/addons.js +5 -2
- package/dist/JSXTransformer.js +588 -227
- package/dist/react-with-addons.js +3118 -2707
- package/dist/react-with-addons.min.js +6 -6
- package/dist/react.js +3713 -3317
- package/dist/react.min.js +6 -5
- package/lib/AutoFocusUtils.js +3 -3
- package/lib/BeforeInputEventPlugin.js +13 -13
- package/lib/CSSProperty.js +3 -0
- package/lib/CSSPropertyOperations.js +13 -13
- package/lib/CallbackQueue.js +4 -4
- package/lib/ChangeEventPlugin.js +12 -12
- package/lib/DOMChildrenOperations.js +10 -6
- package/lib/DOMProperty.js +8 -8
- package/lib/DOMPropertyOperations.js +9 -9
- package/lib/Danger.js +14 -14
- package/lib/DefaultEventPluginOrder.js +2 -2
- package/lib/EnterLeaveEventPlugin.js +5 -5
- package/lib/EventConstants.js +23 -1
- package/lib/EventPluginHub.js +11 -11
- package/lib/EventPluginRegistry.js +8 -8
- package/lib/EventPluginUtils.js +11 -11
- package/lib/EventPropagators.js +7 -7
- package/lib/FallbackCompositionState.js +3 -3
- package/lib/HTMLDOMPropertyConfig.js +4 -2
- package/lib/LinkedStateMixin.js +2 -2
- package/lib/LinkedValueUtils.js +8 -8
- package/lib/MetaMatchers.js +118 -0
- package/lib/OrderedMap.js +453 -0
- package/lib/PooledClass.js +2 -2
- package/lib/React.js +6 -6
- package/lib/ReactBrowserComponentMixin.js +4 -4
- package/lib/ReactBrowserEventEmitter.js +30 -7
- package/lib/ReactCSSTransitionGroup.js +16 -5
- package/lib/ReactCSSTransitionGroupChild.js +12 -11
- package/lib/ReactChildReconciler.js +25 -18
- package/lib/ReactChildren.js +6 -6
- package/lib/ReactClass.js +42 -42
- package/lib/ReactComponent.js +13 -13
- package/lib/ReactComponentBrowserEnvironment.js +2 -2
- package/lib/ReactComponentEnvironment.js +2 -2
- package/lib/ReactComponentWithPureRenderMixin.js +1 -1
- package/lib/ReactCompositeComponent.js +38 -38
- package/lib/ReactDOM.js +72 -159
- package/lib/ReactDOMComponent.js +104 -60
- package/lib/ReactDOMFactories.js +177 -0
- package/lib/ReactDOMIDOperations.js +10 -24
- package/lib/ReactDOMInput.js +8 -8
- package/lib/ReactDOMOption.js +7 -7
- package/lib/ReactDOMSelect.js +8 -8
- package/lib/ReactDOMSelection.js +3 -3
- package/lib/ReactDOMServer.js +2 -2
- package/lib/ReactDOMTextComponent.js +11 -11
- package/lib/ReactDOMTextarea.js +11 -11
- package/lib/ReactDefaultBatchingStrategy.js +4 -4
- package/lib/ReactDefaultInjection.js +24 -24
- package/lib/ReactDefaultPerf.js +7 -7
- package/lib/ReactDefaultPerfAnalysis.js +6 -9
- package/lib/ReactElement.js +4 -4
- package/lib/ReactElementValidator.js +21 -21
- package/lib/ReactEmptyComponent.js +4 -4
- package/lib/ReactEventEmitterMixin.js +1 -1
- package/lib/ReactEventListener.js +19 -14
- package/lib/ReactFragment.js +11 -11
- package/lib/ReactInjection.js +11 -11
- package/lib/ReactInputSelection.js +4 -4
- package/lib/ReactInstanceHandles.js +10 -11
- package/lib/ReactIsomorphic.js +11 -11
- package/lib/ReactLink.js +1 -1
- package/lib/ReactMarkupChecksum.js +6 -2
- package/lib/ReactMount.js +68 -48
- package/lib/ReactMultiChild.js +83 -22
- package/lib/ReactMultiChildUpdateTypes.js +2 -1
- package/lib/ReactNativeComponent.js +3 -3
- package/lib/ReactNoopUpdateQueue.js +3 -3
- package/lib/ReactOwner.js +3 -3
- package/lib/ReactPerf.js +2 -2
- package/lib/ReactPropTransferer.js +3 -3
- package/lib/ReactPropTypeLocationNames.js +1 -1
- package/lib/ReactPropTypeLocations.js +1 -1
- package/lib/ReactPropTypes.js +34 -8
- package/lib/ReactReconcileTransaction.js +6 -6
- package/lib/ReactReconciler.js +12 -12
- package/lib/ReactRef.js +1 -1
- package/lib/ReactServerBatchingStrategy.js +5 -5
- package/lib/ReactServerRendering.js +12 -12
- package/lib/ReactServerRenderingTransaction.js +5 -5
- package/lib/ReactTestUtils.js +26 -27
- package/lib/ReactTransitionChildMapping.js +2 -2
- package/lib/ReactTransitionEvents.js +1 -1
- package/lib/ReactTransitionGroup.js +5 -6
- package/lib/ReactUpdateQueue.js +17 -17
- package/lib/ReactUpdates.js +14 -14
- package/lib/ReactWithAddons.js +14 -14
- package/lib/ResponderEventPlugin.js +514 -0
- package/lib/ResponderSyntheticEvent.js +40 -0
- package/lib/ResponderTouchHistoryStore.js +180 -0
- package/lib/SVGDOMPropertyConfig.js +1 -1
- package/lib/SelectEventPlugin.js +9 -9
- package/lib/SimpleEventPlugin.js +201 -25
- package/lib/SyntheticClipboardEvent.js +1 -1
- package/lib/SyntheticCompositionEvent.js +1 -1
- package/lib/SyntheticDragEvent.js +1 -1
- package/lib/SyntheticEvent.js +3 -3
- package/lib/SyntheticFocusEvent.js +1 -1
- package/lib/SyntheticInputEvent.js +1 -1
- package/lib/SyntheticKeyboardEvent.js +4 -4
- package/lib/SyntheticMouseEvent.js +3 -3
- package/lib/SyntheticTouchEvent.js +2 -2
- package/lib/SyntheticUIEvent.js +2 -2
- package/lib/SyntheticWheelEvent.js +1 -1
- package/lib/TapEventPlugin.js +119 -0
- package/lib/Transaction.js +6 -6
- package/lib/accumulate.js +44 -0
- package/lib/accumulateInto.js +2 -2
- package/lib/adler32.js +19 -7
- package/lib/cloneWithProps.js +11 -6
- package/lib/createHierarchyRenderer.js +85 -0
- package/lib/dangerousStyleValue.js +1 -1
- package/lib/deprecated.js +4 -4
- package/lib/findDOMNode.js +9 -9
- package/lib/flattenChildren.js +4 -4
- package/lib/getEventKey.js +1 -1
- package/lib/getTestDocument.js +28 -0
- package/lib/getTextContentAccessor.js +1 -1
- package/lib/instantiateReactComponent.js +12 -12
- package/lib/isEventSupported.js +1 -1
- package/lib/onlyChild.js +3 -3
- package/lib/quoteAttributeValueForBrowser.js +1 -1
- package/lib/reactComponentExpect.js +210 -0
- package/lib/renderSubtreeIntoContainer.js +1 -1
- package/lib/setInnerHTML.js +1 -1
- package/lib/setTextContent.js +3 -3
- package/lib/shallowCompare.js +1 -1
- package/lib/sliceChildren.js +51 -0
- package/lib/traverseAllChildren.js +14 -13
- package/lib/update.js +13 -13
- package/lib/validateDOMNesting.js +6 -6
- package/lib/webcomponents.js +6379 -0
- package/package.json +4 -6
- package/react.js +1 -1
- package/lib/CSSCore.js +0 -97
- package/lib/EventListener.js +0 -84
- package/lib/ExecutionEnvironment.js +0 -38
- package/lib/ReactDOMClient.js +0 -90
- package/lib/camelize.js +0 -32
- package/lib/camelizeStyleName.js +0 -40
- package/lib/containsNode.js +0 -55
- package/lib/createArrayFromMixed.js +0 -85
- package/lib/createNodesFromMarkup.js +0 -84
- package/lib/emptyFunction.js +0 -38
- package/lib/emptyObject.js +0 -20
- package/lib/focusNode.js +0 -26
- package/lib/getActiveElement.js +0 -29
- package/lib/getMarkupWrap.js +0 -93
- package/lib/getUnboundedScrollPosition.js +0 -38
- package/lib/hyphenate.js +0 -33
- package/lib/hyphenateStyleName.js +0 -39
- package/lib/invariant.js +0 -49
- package/lib/isNode.js +0 -23
- package/lib/isTextNode.js +0 -25
- package/lib/keyMirror.js +0 -48
- package/lib/keyOf.js +0 -35
- package/lib/mapObject.js +0 -51
- package/lib/performance.js +0 -23
- package/lib/performanceNow.js +0 -28
- package/lib/shallowEqual.js +0 -48
- package/lib/toArray.js +0 -57
- package/lib/warning.js +0 -57
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright 2013-2015, 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 ResponderSyntheticEvent
|
|
10
|
+
* @typechecks static-only
|
|
11
|
+
*/
|
|
12
|
+
|
|
13
|
+
'use strict';
|
|
14
|
+
|
|
15
|
+
var SyntheticEvent = require('./SyntheticEvent');
|
|
16
|
+
|
|
17
|
+
/**
|
|
18
|
+
* `touchHistory` isn't actually on the native event, but putting it in the
|
|
19
|
+
* interface will ensure that it is cleaned up when pooled/destroyed. The
|
|
20
|
+
* `ResponderEventPlugin` will populate it appropriately.
|
|
21
|
+
*/
|
|
22
|
+
var ResponderEventInterface = {
|
|
23
|
+
touchHistory: function (nativeEvent) {
|
|
24
|
+
return null; // Actually doesn't even look at the native event.
|
|
25
|
+
}
|
|
26
|
+
};
|
|
27
|
+
|
|
28
|
+
/**
|
|
29
|
+
* @param {object} dispatchConfig Configuration used to dispatch this event.
|
|
30
|
+
* @param {string} dispatchMarker Marker identifying the event target.
|
|
31
|
+
* @param {object} nativeEvent Native event.
|
|
32
|
+
* @extends {SyntheticEvent}
|
|
33
|
+
*/
|
|
34
|
+
function ResponderSyntheticEvent(dispatchConfig, dispatchMarker, nativeEvent, nativeEventTarget) {
|
|
35
|
+
SyntheticEvent.call(this, dispatchConfig, dispatchMarker, nativeEvent, nativeEventTarget);
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
SyntheticEvent.augmentClass(ResponderSyntheticEvent, ResponderEventInterface);
|
|
39
|
+
|
|
40
|
+
module.exports = ResponderSyntheticEvent;
|
|
@@ -0,0 +1,180 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright 2013-2015, 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 ResponderTouchHistoryStore
|
|
10
|
+
*/
|
|
11
|
+
|
|
12
|
+
'use strict';
|
|
13
|
+
|
|
14
|
+
var EventPluginUtils = require('./EventPluginUtils');
|
|
15
|
+
|
|
16
|
+
var invariant = require('fbjs/lib/invariant');
|
|
17
|
+
|
|
18
|
+
var isMoveish = EventPluginUtils.isMoveish;
|
|
19
|
+
var isStartish = EventPluginUtils.isStartish;
|
|
20
|
+
var isEndish = EventPluginUtils.isEndish;
|
|
21
|
+
|
|
22
|
+
var MAX_TOUCH_BANK = 20;
|
|
23
|
+
|
|
24
|
+
/**
|
|
25
|
+
* Touch position/time tracking information by touchID. Typically, we'll only
|
|
26
|
+
* see IDs with a range of 1-20 (they are recycled when touches end and then
|
|
27
|
+
* start again). This data is commonly needed by many different interaction
|
|
28
|
+
* logic modules so precomputing it is very helpful to do once.
|
|
29
|
+
* Each touch object in `touchBank` is of the following form:
|
|
30
|
+
* { touchActive: boolean,
|
|
31
|
+
* startTimeStamp: number,
|
|
32
|
+
* startPageX: number,
|
|
33
|
+
* startPageY: number,
|
|
34
|
+
* currentPageX: number,
|
|
35
|
+
* currentPageY: number,
|
|
36
|
+
* currentTimeStamp: number
|
|
37
|
+
* }
|
|
38
|
+
*/
|
|
39
|
+
var touchHistory = {
|
|
40
|
+
touchBank: [],
|
|
41
|
+
numberActiveTouches: 0,
|
|
42
|
+
// If there is only one active touch, we remember its location. This prevents
|
|
43
|
+
// us having to loop through all of the touches all the time in the most
|
|
44
|
+
// common case.
|
|
45
|
+
indexOfSingleActiveTouch: -1,
|
|
46
|
+
mostRecentTimeStamp: 0
|
|
47
|
+
};
|
|
48
|
+
|
|
49
|
+
var timestampForTouch = function (touch) {
|
|
50
|
+
// The legacy internal implementation provides "timeStamp", which has been
|
|
51
|
+
// renamed to "timestamp". Let both work for now while we iron it out
|
|
52
|
+
// TODO (evv): rename timeStamp to timestamp in internal code
|
|
53
|
+
return touch.timeStamp || touch.timestamp;
|
|
54
|
+
};
|
|
55
|
+
|
|
56
|
+
/**
|
|
57
|
+
* TODO: Instead of making gestures recompute filtered velocity, we could
|
|
58
|
+
* include a built in velocity computation that can be reused globally.
|
|
59
|
+
* @param {Touch} touch Native touch object.
|
|
60
|
+
*/
|
|
61
|
+
var initializeTouchData = function (touch) {
|
|
62
|
+
return {
|
|
63
|
+
touchActive: true,
|
|
64
|
+
startTimeStamp: timestampForTouch(touch),
|
|
65
|
+
startPageX: touch.pageX,
|
|
66
|
+
startPageY: touch.pageY,
|
|
67
|
+
currentPageX: touch.pageX,
|
|
68
|
+
currentPageY: touch.pageY,
|
|
69
|
+
currentTimeStamp: timestampForTouch(touch),
|
|
70
|
+
previousPageX: touch.pageX,
|
|
71
|
+
previousPageY: touch.pageY,
|
|
72
|
+
previousTimeStamp: timestampForTouch(touch)
|
|
73
|
+
};
|
|
74
|
+
};
|
|
75
|
+
|
|
76
|
+
var reinitializeTouchTrack = function (touchTrack, touch) {
|
|
77
|
+
touchTrack.touchActive = true;
|
|
78
|
+
touchTrack.startTimeStamp = timestampForTouch(touch);
|
|
79
|
+
touchTrack.startPageX = touch.pageX;
|
|
80
|
+
touchTrack.startPageY = touch.pageY;
|
|
81
|
+
touchTrack.currentPageX = touch.pageX;
|
|
82
|
+
touchTrack.currentPageY = touch.pageY;
|
|
83
|
+
touchTrack.currentTimeStamp = timestampForTouch(touch);
|
|
84
|
+
touchTrack.previousPageX = touch.pageX;
|
|
85
|
+
touchTrack.previousPageY = touch.pageY;
|
|
86
|
+
touchTrack.previousTimeStamp = timestampForTouch(touch);
|
|
87
|
+
};
|
|
88
|
+
|
|
89
|
+
var validateTouch = function (touch) {
|
|
90
|
+
var identifier = touch.identifier;
|
|
91
|
+
!(identifier != null) ? process.env.NODE_ENV !== 'production' ? invariant(false, 'Touch object is missing identifier') : invariant(false) : undefined;
|
|
92
|
+
if (identifier > MAX_TOUCH_BANK) {
|
|
93
|
+
console.warn('Touch identifier ' + identifier + ' is greater than maximum ' + 'supported ' + MAX_TOUCH_BANK + ' which causes performance issues ' + 'backfilling array locations for all of the indices.');
|
|
94
|
+
}
|
|
95
|
+
};
|
|
96
|
+
|
|
97
|
+
var recordStartTouchData = function (touch) {
|
|
98
|
+
var touchBank = touchHistory.touchBank;
|
|
99
|
+
var identifier = touch.identifier;
|
|
100
|
+
var touchTrack = touchBank[identifier];
|
|
101
|
+
if (process.env.NODE_ENV !== 'production') {
|
|
102
|
+
validateTouch(touch);
|
|
103
|
+
}
|
|
104
|
+
if (touchTrack) {
|
|
105
|
+
reinitializeTouchTrack(touchTrack, touch);
|
|
106
|
+
} else {
|
|
107
|
+
touchBank[touch.identifier] = initializeTouchData(touch);
|
|
108
|
+
}
|
|
109
|
+
touchHistory.mostRecentTimeStamp = timestampForTouch(touch);
|
|
110
|
+
};
|
|
111
|
+
|
|
112
|
+
var recordMoveTouchData = function (touch) {
|
|
113
|
+
var touchBank = touchHistory.touchBank;
|
|
114
|
+
var touchTrack = touchBank[touch.identifier];
|
|
115
|
+
if (process.env.NODE_ENV !== 'production') {
|
|
116
|
+
validateTouch(touch);
|
|
117
|
+
!touchTrack ? process.env.NODE_ENV !== 'production' ? invariant(false, 'Touch data should have been recorded on start') : invariant(false) : undefined;
|
|
118
|
+
}
|
|
119
|
+
touchTrack.touchActive = true;
|
|
120
|
+
touchTrack.previousPageX = touchTrack.currentPageX;
|
|
121
|
+
touchTrack.previousPageY = touchTrack.currentPageY;
|
|
122
|
+
touchTrack.previousTimeStamp = touchTrack.currentTimeStamp;
|
|
123
|
+
touchTrack.currentPageX = touch.pageX;
|
|
124
|
+
touchTrack.currentPageY = touch.pageY;
|
|
125
|
+
touchTrack.currentTimeStamp = timestampForTouch(touch);
|
|
126
|
+
touchHistory.mostRecentTimeStamp = timestampForTouch(touch);
|
|
127
|
+
};
|
|
128
|
+
|
|
129
|
+
var recordEndTouchData = function (touch) {
|
|
130
|
+
var touchBank = touchHistory.touchBank;
|
|
131
|
+
var touchTrack = touchBank[touch.identifier];
|
|
132
|
+
if (process.env.NODE_ENV !== 'production') {
|
|
133
|
+
validateTouch(touch);
|
|
134
|
+
!touchTrack ? process.env.NODE_ENV !== 'production' ? invariant(false, 'Touch data should have been recorded on start') : invariant(false) : undefined;
|
|
135
|
+
}
|
|
136
|
+
touchTrack.previousPageX = touchTrack.currentPageX;
|
|
137
|
+
touchTrack.previousPageY = touchTrack.currentPageY;
|
|
138
|
+
touchTrack.previousTimeStamp = touchTrack.currentTimeStamp;
|
|
139
|
+
touchTrack.currentPageX = touch.pageX;
|
|
140
|
+
touchTrack.currentPageY = touch.pageY;
|
|
141
|
+
touchTrack.currentTimeStamp = timestampForTouch(touch);
|
|
142
|
+
touchTrack.touchActive = false;
|
|
143
|
+
touchHistory.mostRecentTimeStamp = timestampForTouch(touch);
|
|
144
|
+
};
|
|
145
|
+
|
|
146
|
+
var ResponderTouchHistoryStore = {
|
|
147
|
+
recordTouchTrack: function (topLevelType, nativeEvent) {
|
|
148
|
+
var touchBank = touchHistory.touchBank;
|
|
149
|
+
if (isMoveish(topLevelType)) {
|
|
150
|
+
nativeEvent.changedTouches.forEach(recordMoveTouchData);
|
|
151
|
+
} else if (isStartish(topLevelType)) {
|
|
152
|
+
nativeEvent.changedTouches.forEach(recordStartTouchData);
|
|
153
|
+
touchHistory.numberActiveTouches = nativeEvent.touches.length;
|
|
154
|
+
if (touchHistory.numberActiveTouches === 1) {
|
|
155
|
+
touchHistory.indexOfSingleActiveTouch = nativeEvent.touches[0].identifier;
|
|
156
|
+
}
|
|
157
|
+
} else if (isEndish(topLevelType)) {
|
|
158
|
+
nativeEvent.changedTouches.forEach(recordEndTouchData);
|
|
159
|
+
touchHistory.numberActiveTouches = nativeEvent.touches.length;
|
|
160
|
+
if (touchHistory.numberActiveTouches === 1) {
|
|
161
|
+
for (var i = 0; i < touchBank.length; i++) {
|
|
162
|
+
var touchTrackToCheck = touchBank[i];
|
|
163
|
+
if (touchTrackToCheck != null && touchTrackToCheck.touchActive) {
|
|
164
|
+
touchHistory.indexOfSingleActiveTouch = i;
|
|
165
|
+
break;
|
|
166
|
+
}
|
|
167
|
+
}
|
|
168
|
+
if (process.env.NODE_ENV !== 'production') {
|
|
169
|
+
var activeTouchData = touchBank[touchHistory.indexOfSingleActiveTouch];
|
|
170
|
+
var foundActive = activeTouchData != null && !!activeTouchData.touchActive;
|
|
171
|
+
!foundActive ? process.env.NODE_ENV !== 'production' ? invariant(false, 'Cannot find single active touch') : invariant(false) : undefined;
|
|
172
|
+
}
|
|
173
|
+
}
|
|
174
|
+
}
|
|
175
|
+
},
|
|
176
|
+
|
|
177
|
+
touchHistory: touchHistory
|
|
178
|
+
};
|
|
179
|
+
|
|
180
|
+
module.exports = ResponderTouchHistoryStore;
|
package/lib/SelectEventPlugin.js
CHANGED
|
@@ -11,15 +11,15 @@
|
|
|
11
11
|
|
|
12
12
|
'use strict';
|
|
13
13
|
|
|
14
|
-
var EventConstants = require(
|
|
15
|
-
var EventPropagators = require(
|
|
16
|
-
var ReactInputSelection = require(
|
|
17
|
-
var SyntheticEvent = require(
|
|
18
|
-
|
|
19
|
-
var getActiveElement = require(
|
|
20
|
-
var isTextInputElement = require(
|
|
21
|
-
var keyOf = require(
|
|
22
|
-
var shallowEqual = require(
|
|
14
|
+
var EventConstants = require('./EventConstants');
|
|
15
|
+
var EventPropagators = require('./EventPropagators');
|
|
16
|
+
var ReactInputSelection = require('./ReactInputSelection');
|
|
17
|
+
var SyntheticEvent = require('./SyntheticEvent');
|
|
18
|
+
|
|
19
|
+
var getActiveElement = require('fbjs/lib/getActiveElement');
|
|
20
|
+
var isTextInputElement = require('./isTextInputElement');
|
|
21
|
+
var keyOf = require('fbjs/lib/keyOf');
|
|
22
|
+
var shallowEqual = require('fbjs/lib/shallowEqual');
|
|
23
23
|
|
|
24
24
|
var topLevelTypes = EventConstants.topLevelTypes;
|
|
25
25
|
|
package/lib/SimpleEventPlugin.js
CHANGED
|
@@ -11,36 +11,54 @@
|
|
|
11
11
|
|
|
12
12
|
'use strict';
|
|
13
13
|
|
|
14
|
-
var EventConstants = require(
|
|
15
|
-
var EventListener = require(
|
|
16
|
-
var EventPluginUtils = require(
|
|
17
|
-
var EventPropagators = require(
|
|
18
|
-
var ReactMount = require(
|
|
19
|
-
var SyntheticClipboardEvent = require(
|
|
20
|
-
var SyntheticEvent = require(
|
|
21
|
-
var SyntheticFocusEvent = require(
|
|
22
|
-
var SyntheticKeyboardEvent = require(
|
|
23
|
-
var SyntheticMouseEvent = require(
|
|
24
|
-
var SyntheticDragEvent = require(
|
|
25
|
-
var SyntheticTouchEvent = require(
|
|
26
|
-
var SyntheticUIEvent = require(
|
|
27
|
-
var SyntheticWheelEvent = require(
|
|
14
|
+
var EventConstants = require('./EventConstants');
|
|
15
|
+
var EventListener = require('fbjs/lib/EventListener');
|
|
16
|
+
var EventPluginUtils = require('./EventPluginUtils');
|
|
17
|
+
var EventPropagators = require('./EventPropagators');
|
|
18
|
+
var ReactMount = require('./ReactMount');
|
|
19
|
+
var SyntheticClipboardEvent = require('./SyntheticClipboardEvent');
|
|
20
|
+
var SyntheticEvent = require('./SyntheticEvent');
|
|
21
|
+
var SyntheticFocusEvent = require('./SyntheticFocusEvent');
|
|
22
|
+
var SyntheticKeyboardEvent = require('./SyntheticKeyboardEvent');
|
|
23
|
+
var SyntheticMouseEvent = require('./SyntheticMouseEvent');
|
|
24
|
+
var SyntheticDragEvent = require('./SyntheticDragEvent');
|
|
25
|
+
var SyntheticTouchEvent = require('./SyntheticTouchEvent');
|
|
26
|
+
var SyntheticUIEvent = require('./SyntheticUIEvent');
|
|
27
|
+
var SyntheticWheelEvent = require('./SyntheticWheelEvent');
|
|
28
28
|
|
|
29
|
-
var emptyFunction = require(
|
|
30
|
-
var getEventCharCode = require(
|
|
31
|
-
var invariant = require(
|
|
32
|
-
var keyOf = require(
|
|
33
|
-
var warning = require(
|
|
29
|
+
var emptyFunction = require('fbjs/lib/emptyFunction');
|
|
30
|
+
var getEventCharCode = require('./getEventCharCode');
|
|
31
|
+
var invariant = require('fbjs/lib/invariant');
|
|
32
|
+
var keyOf = require('fbjs/lib/keyOf');
|
|
33
|
+
var warning = require('fbjs/lib/warning');
|
|
34
34
|
|
|
35
35
|
var topLevelTypes = EventConstants.topLevelTypes;
|
|
36
36
|
|
|
37
37
|
var eventTypes = {
|
|
38
|
+
abort: {
|
|
39
|
+
phasedRegistrationNames: {
|
|
40
|
+
bubbled: keyOf({ onAbort: true }),
|
|
41
|
+
captured: keyOf({ onAbortCapture: true })
|
|
42
|
+
}
|
|
43
|
+
},
|
|
38
44
|
blur: {
|
|
39
45
|
phasedRegistrationNames: {
|
|
40
46
|
bubbled: keyOf({ onBlur: true }),
|
|
41
47
|
captured: keyOf({ onBlurCapture: true })
|
|
42
48
|
}
|
|
43
49
|
},
|
|
50
|
+
canPlay: {
|
|
51
|
+
phasedRegistrationNames: {
|
|
52
|
+
bubbled: keyOf({ onCanPlay: true }),
|
|
53
|
+
captured: keyOf({ onCanPlayCapture: true })
|
|
54
|
+
}
|
|
55
|
+
},
|
|
56
|
+
canPlayThrough: {
|
|
57
|
+
phasedRegistrationNames: {
|
|
58
|
+
bubbled: keyOf({ onCanPlayThrough: true }),
|
|
59
|
+
captured: keyOf({ onCanPlayThroughCapture: true })
|
|
60
|
+
}
|
|
61
|
+
},
|
|
44
62
|
click: {
|
|
45
63
|
phasedRegistrationNames: {
|
|
46
64
|
bubbled: keyOf({ onClick: true }),
|
|
@@ -119,6 +137,30 @@ var eventTypes = {
|
|
|
119
137
|
captured: keyOf({ onDropCapture: true })
|
|
120
138
|
}
|
|
121
139
|
},
|
|
140
|
+
durationChange: {
|
|
141
|
+
phasedRegistrationNames: {
|
|
142
|
+
bubbled: keyOf({ onDurationChange: true }),
|
|
143
|
+
captured: keyOf({ onDurationChangeCapture: true })
|
|
144
|
+
}
|
|
145
|
+
},
|
|
146
|
+
emptied: {
|
|
147
|
+
phasedRegistrationNames: {
|
|
148
|
+
bubbled: keyOf({ onEmptied: true }),
|
|
149
|
+
captured: keyOf({ onEmptiedCapture: true })
|
|
150
|
+
}
|
|
151
|
+
},
|
|
152
|
+
ended: {
|
|
153
|
+
phasedRegistrationNames: {
|
|
154
|
+
bubbled: keyOf({ onEnded: true }),
|
|
155
|
+
captured: keyOf({ onEndedCapture: true })
|
|
156
|
+
}
|
|
157
|
+
},
|
|
158
|
+
error: {
|
|
159
|
+
phasedRegistrationNames: {
|
|
160
|
+
bubbled: keyOf({ onError: true }),
|
|
161
|
+
captured: keyOf({ onErrorCapture: true })
|
|
162
|
+
}
|
|
163
|
+
},
|
|
122
164
|
focus: {
|
|
123
165
|
phasedRegistrationNames: {
|
|
124
166
|
bubbled: keyOf({ onFocus: true }),
|
|
@@ -155,10 +197,22 @@ var eventTypes = {
|
|
|
155
197
|
captured: keyOf({ onLoadCapture: true })
|
|
156
198
|
}
|
|
157
199
|
},
|
|
158
|
-
|
|
200
|
+
loadedData: {
|
|
159
201
|
phasedRegistrationNames: {
|
|
160
|
-
bubbled: keyOf({
|
|
161
|
-
captured: keyOf({
|
|
202
|
+
bubbled: keyOf({ onLoadedData: true }),
|
|
203
|
+
captured: keyOf({ onLoadedDataCapture: true })
|
|
204
|
+
}
|
|
205
|
+
},
|
|
206
|
+
loadedMetadata: {
|
|
207
|
+
phasedRegistrationNames: {
|
|
208
|
+
bubbled: keyOf({ onLoadedMetadata: true }),
|
|
209
|
+
captured: keyOf({ onLoadedMetadataCapture: true })
|
|
210
|
+
}
|
|
211
|
+
},
|
|
212
|
+
loadStart: {
|
|
213
|
+
phasedRegistrationNames: {
|
|
214
|
+
bubbled: keyOf({ onLoadStart: true }),
|
|
215
|
+
captured: keyOf({ onLoadStartCapture: true })
|
|
162
216
|
}
|
|
163
217
|
},
|
|
164
218
|
// Note: We do not allow listening to mouseOver events. Instead, use the
|
|
@@ -193,12 +247,48 @@ var eventTypes = {
|
|
|
193
247
|
captured: keyOf({ onMouseUpCapture: true })
|
|
194
248
|
}
|
|
195
249
|
},
|
|
250
|
+
onEncrypted: {
|
|
251
|
+
phasedRegistrationNames: {
|
|
252
|
+
bubbled: keyOf({ onEncrypted: true }),
|
|
253
|
+
captured: keyOf({ onEncryptedCapture: true })
|
|
254
|
+
}
|
|
255
|
+
},
|
|
196
256
|
paste: {
|
|
197
257
|
phasedRegistrationNames: {
|
|
198
258
|
bubbled: keyOf({ onPaste: true }),
|
|
199
259
|
captured: keyOf({ onPasteCapture: true })
|
|
200
260
|
}
|
|
201
261
|
},
|
|
262
|
+
pause: {
|
|
263
|
+
phasedRegistrationNames: {
|
|
264
|
+
bubbled: keyOf({ onPause: true }),
|
|
265
|
+
captured: keyOf({ onPauseCapture: true })
|
|
266
|
+
}
|
|
267
|
+
},
|
|
268
|
+
play: {
|
|
269
|
+
phasedRegistrationNames: {
|
|
270
|
+
bubbled: keyOf({ onPlay: true }),
|
|
271
|
+
captured: keyOf({ onPlayCapture: true })
|
|
272
|
+
}
|
|
273
|
+
},
|
|
274
|
+
playing: {
|
|
275
|
+
phasedRegistrationNames: {
|
|
276
|
+
bubbled: keyOf({ onPlaying: true }),
|
|
277
|
+
captured: keyOf({ onPlayingCapture: true })
|
|
278
|
+
}
|
|
279
|
+
},
|
|
280
|
+
progress: {
|
|
281
|
+
phasedRegistrationNames: {
|
|
282
|
+
bubbled: keyOf({ onProgress: true }),
|
|
283
|
+
captured: keyOf({ onProgressCapture: true })
|
|
284
|
+
}
|
|
285
|
+
},
|
|
286
|
+
rateChange: {
|
|
287
|
+
phasedRegistrationNames: {
|
|
288
|
+
bubbled: keyOf({ onRateChange: true }),
|
|
289
|
+
captured: keyOf({ onRateChangeCapture: true })
|
|
290
|
+
}
|
|
291
|
+
},
|
|
202
292
|
reset: {
|
|
203
293
|
phasedRegistrationNames: {
|
|
204
294
|
bubbled: keyOf({ onReset: true }),
|
|
@@ -211,12 +301,42 @@ var eventTypes = {
|
|
|
211
301
|
captured: keyOf({ onScrollCapture: true })
|
|
212
302
|
}
|
|
213
303
|
},
|
|
304
|
+
seeked: {
|
|
305
|
+
phasedRegistrationNames: {
|
|
306
|
+
bubbled: keyOf({ onSeeked: true }),
|
|
307
|
+
captured: keyOf({ onSeekedCapture: true })
|
|
308
|
+
}
|
|
309
|
+
},
|
|
310
|
+
seeking: {
|
|
311
|
+
phasedRegistrationNames: {
|
|
312
|
+
bubbled: keyOf({ onSeeking: true }),
|
|
313
|
+
captured: keyOf({ onSeekingCapture: true })
|
|
314
|
+
}
|
|
315
|
+
},
|
|
316
|
+
stalled: {
|
|
317
|
+
phasedRegistrationNames: {
|
|
318
|
+
bubbled: keyOf({ onStalled: true }),
|
|
319
|
+
captured: keyOf({ onStalledCapture: true })
|
|
320
|
+
}
|
|
321
|
+
},
|
|
214
322
|
submit: {
|
|
215
323
|
phasedRegistrationNames: {
|
|
216
324
|
bubbled: keyOf({ onSubmit: true }),
|
|
217
325
|
captured: keyOf({ onSubmitCapture: true })
|
|
218
326
|
}
|
|
219
327
|
},
|
|
328
|
+
suspend: {
|
|
329
|
+
phasedRegistrationNames: {
|
|
330
|
+
bubbled: keyOf({ onSuspend: true }),
|
|
331
|
+
captured: keyOf({ onSuspendCapture: true })
|
|
332
|
+
}
|
|
333
|
+
},
|
|
334
|
+
timeUpdate: {
|
|
335
|
+
phasedRegistrationNames: {
|
|
336
|
+
bubbled: keyOf({ onTimeUpdate: true }),
|
|
337
|
+
captured: keyOf({ onTimeUpdateCapture: true })
|
|
338
|
+
}
|
|
339
|
+
},
|
|
220
340
|
touchCancel: {
|
|
221
341
|
phasedRegistrationNames: {
|
|
222
342
|
bubbled: keyOf({ onTouchCancel: true }),
|
|
@@ -241,6 +361,18 @@ var eventTypes = {
|
|
|
241
361
|
captured: keyOf({ onTouchStartCapture: true })
|
|
242
362
|
}
|
|
243
363
|
},
|
|
364
|
+
volumeChange: {
|
|
365
|
+
phasedRegistrationNames: {
|
|
366
|
+
bubbled: keyOf({ onVolumeChange: true }),
|
|
367
|
+
captured: keyOf({ onVolumeChangeCapture: true })
|
|
368
|
+
}
|
|
369
|
+
},
|
|
370
|
+
waiting: {
|
|
371
|
+
phasedRegistrationNames: {
|
|
372
|
+
bubbled: keyOf({ onWaiting: true }),
|
|
373
|
+
captured: keyOf({ onWaitingCapture: true })
|
|
374
|
+
}
|
|
375
|
+
},
|
|
244
376
|
wheel: {
|
|
245
377
|
phasedRegistrationNames: {
|
|
246
378
|
bubbled: keyOf({ onWheel: true }),
|
|
@@ -250,7 +382,10 @@ var eventTypes = {
|
|
|
250
382
|
};
|
|
251
383
|
|
|
252
384
|
var topLevelEventsToDispatchConfig = {
|
|
385
|
+
topAbort: eventTypes.abort,
|
|
253
386
|
topBlur: eventTypes.blur,
|
|
387
|
+
topCanPlay: eventTypes.canPlay,
|
|
388
|
+
topCanPlayThrough: eventTypes.canPlayThrough,
|
|
254
389
|
topClick: eventTypes.click,
|
|
255
390
|
topContextMenu: eventTypes.contextMenu,
|
|
256
391
|
topCopy: eventTypes.copy,
|
|
@@ -264,6 +399,9 @@ var topLevelEventsToDispatchConfig = {
|
|
|
264
399
|
topDragOver: eventTypes.dragOver,
|
|
265
400
|
topDragStart: eventTypes.dragStart,
|
|
266
401
|
topDrop: eventTypes.drop,
|
|
402
|
+
topDurationChange: eventTypes.durationChange,
|
|
403
|
+
topEmptied: eventTypes.emptied,
|
|
404
|
+
topEnded: eventTypes.ended,
|
|
267
405
|
topError: eventTypes.error,
|
|
268
406
|
topFocus: eventTypes.focus,
|
|
269
407
|
topInput: eventTypes.input,
|
|
@@ -271,19 +409,35 @@ var topLevelEventsToDispatchConfig = {
|
|
|
271
409
|
topKeyPress: eventTypes.keyPress,
|
|
272
410
|
topKeyUp: eventTypes.keyUp,
|
|
273
411
|
topLoad: eventTypes.load,
|
|
412
|
+
topLoadedData: eventTypes.loadedData,
|
|
413
|
+
topLoadedMetadata: eventTypes.loadedMetadata,
|
|
414
|
+
topLoadStart: eventTypes.loadStart,
|
|
274
415
|
topMouseDown: eventTypes.mouseDown,
|
|
275
416
|
topMouseMove: eventTypes.mouseMove,
|
|
276
417
|
topMouseOut: eventTypes.mouseOut,
|
|
277
418
|
topMouseOver: eventTypes.mouseOver,
|
|
278
419
|
topMouseUp: eventTypes.mouseUp,
|
|
420
|
+
topOnEncrypted: eventTypes.onEncrypted,
|
|
421
|
+
topPause: eventTypes.pause,
|
|
279
422
|
topPaste: eventTypes.paste,
|
|
423
|
+
topPlay: eventTypes.play,
|
|
424
|
+
topPlaying: eventTypes.playing,
|
|
425
|
+
topProgress: eventTypes.progress,
|
|
426
|
+
topRateChange: eventTypes.rateChange,
|
|
280
427
|
topReset: eventTypes.reset,
|
|
428
|
+
topSeeked: eventTypes.seeked,
|
|
429
|
+
topSeeking: eventTypes.seeking,
|
|
281
430
|
topScroll: eventTypes.scroll,
|
|
431
|
+
topStalled: eventTypes.stalled,
|
|
282
432
|
topSubmit: eventTypes.submit,
|
|
433
|
+
topSuspend: eventTypes.suspend,
|
|
434
|
+
topTimeUpdate: eventTypes.timeUpdate,
|
|
283
435
|
topTouchCancel: eventTypes.touchCancel,
|
|
284
436
|
topTouchEnd: eventTypes.touchEnd,
|
|
285
437
|
topTouchMove: eventTypes.touchMove,
|
|
286
438
|
topTouchStart: eventTypes.touchStart,
|
|
439
|
+
topVolumeChange: eventTypes.volumeChange,
|
|
440
|
+
topWaiting: eventTypes.waiting,
|
|
287
441
|
topWheel: eventTypes.wheel
|
|
288
442
|
};
|
|
289
443
|
|
|
@@ -309,7 +463,7 @@ var SimpleEventPlugin = {
|
|
|
309
463
|
executeDispatch: function (event, listener, domID) {
|
|
310
464
|
var returnValue = EventPluginUtils.executeDispatch(event, listener, domID);
|
|
311
465
|
|
|
312
|
-
|
|
466
|
+
process.env.NODE_ENV !== 'production' ? warning(typeof returnValue !== 'boolean', 'Returning `false` from an event handler is deprecated and will be ' + 'ignored in a future release. Instead, manually call ' + 'e.stopPropagation() or e.preventDefault(), as appropriate.') : undefined;
|
|
313
467
|
|
|
314
468
|
if (returnValue === false) {
|
|
315
469
|
event.stopPropagation();
|
|
@@ -332,11 +486,33 @@ var SimpleEventPlugin = {
|
|
|
332
486
|
}
|
|
333
487
|
var EventConstructor;
|
|
334
488
|
switch (topLevelType) {
|
|
489
|
+
case topLevelTypes.topAbort:
|
|
490
|
+
case topLevelTypes.topCanPlay:
|
|
491
|
+
case topLevelTypes.topCanPlayThrough:
|
|
492
|
+
case topLevelTypes.topDurationChange:
|
|
493
|
+
case topLevelTypes.topEmptied:
|
|
494
|
+
case topLevelTypes.topEnded:
|
|
495
|
+
case topLevelTypes.topError:
|
|
335
496
|
case topLevelTypes.topInput:
|
|
336
497
|
case topLevelTypes.topLoad:
|
|
337
|
-
case topLevelTypes.
|
|
498
|
+
case topLevelTypes.topLoadedData:
|
|
499
|
+
case topLevelTypes.topLoadedMetadata:
|
|
500
|
+
case topLevelTypes.topLoadStart:
|
|
501
|
+
case topLevelTypes.topOnEncrypted:
|
|
502
|
+
case topLevelTypes.topPause:
|
|
503
|
+
case topLevelTypes.topPlay:
|
|
504
|
+
case topLevelTypes.topPlaying:
|
|
505
|
+
case topLevelTypes.topProgress:
|
|
506
|
+
case topLevelTypes.topRateChange:
|
|
338
507
|
case topLevelTypes.topReset:
|
|
508
|
+
case topLevelTypes.topSeeked:
|
|
509
|
+
case topLevelTypes.topSeeking:
|
|
510
|
+
case topLevelTypes.topStalled:
|
|
339
511
|
case topLevelTypes.topSubmit:
|
|
512
|
+
case topLevelTypes.topSuspend:
|
|
513
|
+
case topLevelTypes.topTimeUpdate:
|
|
514
|
+
case topLevelTypes.topVolumeChange:
|
|
515
|
+
case topLevelTypes.topWaiting:
|
|
340
516
|
// HTML Events
|
|
341
517
|
// @see http://www.w3.org/TR/html5/index.html#events-0
|
|
342
518
|
EventConstructor = SyntheticEvent;
|
|
@@ -401,7 +577,7 @@ var SimpleEventPlugin = {
|
|
|
401
577
|
EventConstructor = SyntheticClipboardEvent;
|
|
402
578
|
break;
|
|
403
579
|
}
|
|
404
|
-
!EventConstructor ?
|
|
580
|
+
!EventConstructor ? process.env.NODE_ENV !== 'production' ? invariant(false, 'SimpleEventPlugin: Unhandled event type, `%s`.', topLevelType) : invariant(false) : undefined;
|
|
405
581
|
var event = EventConstructor.getPooled(dispatchConfig, topLevelTargetID, nativeEvent, nativeEventTarget);
|
|
406
582
|
EventPropagators.accumulateTwoPhaseDispatches(event);
|
|
407
583
|
return event;
|