react 0.14.0-beta1 → 0.14.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/addons.js +8 -3
- package/dist/react-with-addons.js +5048 -4095
- package/dist/react-with-addons.min.js +6 -6
- package/dist/react.js +4555 -3729
- package/dist/react.min.js +6 -5
- package/lib/AutoFocusUtils.js +3 -3
- package/lib/BeforeInputEventPlugin.js +13 -13
- package/lib/CSSProperty.js +18 -3
- package/lib/CSSPropertyOperations.js +27 -14
- package/lib/CallbackQueue.js +4 -4
- package/lib/ChangeEventPlugin.js +15 -14
- package/lib/DOMChildrenOperations.js +22 -7
- package/lib/DOMProperty.js +8 -8
- package/lib/DOMPropertyOperations.js +23 -10
- package/lib/Danger.js +21 -16
- package/lib/DefaultEventPluginOrder.js +2 -2
- package/lib/EnterLeaveEventPlugin.js +18 -10
- package/lib/EventConstants.js +23 -1
- package/lib/EventPluginHub.js +29 -21
- package/lib/EventPluginRegistry.js +8 -8
- package/lib/EventPluginUtils.js +34 -38
- package/lib/EventPropagators.js +8 -8
- package/lib/FallbackCompositionState.js +9 -3
- package/lib/HTMLDOMPropertyConfig.js +24 -4
- 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 +3 -5
- package/lib/React.js +18 -7
- package/lib/ReactBrowserComponentMixin.js +4 -4
- package/lib/ReactBrowserEventEmitter.js +36 -7
- package/lib/ReactCSSTransitionGroup.js +35 -9
- package/lib/ReactCSSTransitionGroupChild.js +48 -30
- package/lib/ReactChildReconciler.js +24 -19
- package/lib/ReactChildren.js +72 -32
- package/lib/ReactClass.js +46 -46
- package/lib/ReactComponent.js +18 -16
- package/lib/ReactComponentBrowserEnvironment.js +2 -2
- package/lib/ReactComponentEnvironment.js +2 -2
- package/lib/ReactComponentWithPureRenderMixin.js +1 -1
- package/lib/ReactCompositeComponent.js +95 -44
- package/lib/ReactDOM.js +74 -159
- package/lib/ReactDOMComponent.js +235 -93
- package/lib/ReactDOMFactories.js +177 -0
- package/lib/{emptyObject.js → ReactDOMFeatureFlags.js} +6 -8
- package/lib/ReactDOMIDOperations.js +8 -81
- package/lib/ReactDOMInput.js +18 -9
- package/lib/ReactDOMOption.js +7 -7
- package/lib/ReactDOMSelect.js +9 -9
- package/lib/ReactDOMSelection.js +19 -3
- package/lib/ReactDOMServer.js +5 -3
- package/lib/ReactDOMTextComponent.js +33 -20
- package/lib/ReactDOMTextarea.js +14 -12
- package/lib/ReactDefaultBatchingStrategy.js +4 -4
- package/lib/ReactDefaultInjection.js +23 -25
- package/lib/ReactDefaultPerf.js +17 -11
- package/lib/ReactDefaultPerfAnalysis.js +13 -12
- package/lib/ReactElement.js +85 -39
- package/lib/ReactElementValidator.js +47 -90
- package/lib/ReactEmptyComponent.js +26 -62
- package/lib/ReactEmptyComponentRegistry.js +48 -0
- package/lib/ReactErrorUtils.js +53 -9
- package/lib/ReactEventEmitterMixin.js +2 -2
- package/lib/ReactEventListener.js +33 -21
- package/lib/ReactFragment.js +27 -118
- package/lib/ReactInjection.js +10 -12
- package/lib/ReactInputSelection.js +4 -4
- package/lib/ReactInstanceHandles.js +10 -11
- package/lib/ReactIsomorphic.js +15 -11
- package/lib/ReactLink.js +2 -2
- package/lib/ReactMarkupChecksum.js +6 -2
- package/lib/ReactMount.js +186 -85
- package/lib/ReactMultiChild.js +119 -25
- 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 +38 -9
- package/lib/ReactReconcileTransaction.js +10 -8
- package/lib/ReactReconciler.js +5 -6
- package/lib/ReactRef.js +14 -2
- package/lib/ReactServerBatchingStrategy.js +5 -5
- package/lib/ReactServerRendering.js +12 -12
- package/lib/ReactServerRenderingTransaction.js +6 -5
- package/lib/ReactTestUtils.js +47 -39
- package/lib/ReactTransitionChildMapping.js +3 -6
- package/lib/ReactTransitionEvents.js +1 -1
- package/lib/ReactTransitionGroup.js +5 -6
- package/lib/ReactUpdateQueue.js +19 -19
- package/lib/ReactUpdates.js +15 -15
- package/lib/{performance.js → ReactVersion.js} +3 -12
- package/lib/ReactWithAddons.js +24 -15
- 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 +19 -9
- package/lib/SimpleEventPlugin.js +198 -43
- package/lib/SyntheticClipboardEvent.js +1 -1
- package/lib/SyntheticCompositionEvent.js +1 -1
- package/lib/SyntheticDragEvent.js +1 -1
- package/lib/SyntheticEvent.js +18 -4
- 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 +7 -7
- 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 +7 -6
- package/lib/findDOMNode.js +9 -9
- package/lib/flattenChildren.js +4 -4
- package/lib/getEventKey.js +1 -1
- package/lib/{isTextNode.js → getTestDocument.js} +7 -11
- package/lib/getTextContentAccessor.js +1 -1
- package/lib/instantiateReactComponent.js +15 -17
- package/lib/isEventSupported.js +1 -1
- package/lib/onlyChild.js +3 -3
- package/lib/quoteAttributeValueForBrowser.js +1 -1
- package/lib/reactComponentExpect.js +216 -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/shouldUpdateReactComponent.js +12 -8
- package/lib/sliceChildren.js +34 -0
- package/lib/traverseAllChildren.js +25 -18
- 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 -51
- package/dist/JSXTransformer.js +0 -17588
- 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/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/joinClasses.js +0 -39
- package/lib/keyMirror.js +0 -48
- package/lib/keyOf.js +0 -35
- package/lib/mapObject.js +0 -51
- package/lib/memoizeStringOnly.js +0 -31
- 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,18 +11,21 @@
|
|
|
11
11
|
|
|
12
12
|
'use strict';
|
|
13
13
|
|
|
14
|
-
var EventConstants = require(
|
|
15
|
-
var EventPropagators = require(
|
|
16
|
-
var
|
|
17
|
-
var
|
|
14
|
+
var EventConstants = require('./EventConstants');
|
|
15
|
+
var EventPropagators = require('./EventPropagators');
|
|
16
|
+
var ExecutionEnvironment = require('fbjs/lib/ExecutionEnvironment');
|
|
17
|
+
var ReactInputSelection = require('./ReactInputSelection');
|
|
18
|
+
var SyntheticEvent = require('./SyntheticEvent');
|
|
18
19
|
|
|
19
|
-
var getActiveElement = require(
|
|
20
|
-
var isTextInputElement = require(
|
|
21
|
-
var keyOf = require(
|
|
22
|
-
var shallowEqual = require(
|
|
20
|
+
var getActiveElement = require('fbjs/lib/getActiveElement');
|
|
21
|
+
var isTextInputElement = require('./isTextInputElement');
|
|
22
|
+
var keyOf = require('fbjs/lib/keyOf');
|
|
23
|
+
var shallowEqual = require('fbjs/lib/shallowEqual');
|
|
23
24
|
|
|
24
25
|
var topLevelTypes = EventConstants.topLevelTypes;
|
|
25
26
|
|
|
27
|
+
var skipSelectionChangeEvent = ExecutionEnvironment.canUseDOM && 'documentMode' in document && document.documentMode <= 11;
|
|
28
|
+
|
|
26
29
|
var eventTypes = {
|
|
27
30
|
select: {
|
|
28
31
|
phasedRegistrationNames: {
|
|
@@ -167,12 +170,19 @@ var SelectEventPlugin = {
|
|
|
167
170
|
return constructSelectEvent(nativeEvent, nativeEventTarget);
|
|
168
171
|
|
|
169
172
|
// Chrome and IE fire non-standard event when selection is changed (and
|
|
170
|
-
// sometimes when it hasn't).
|
|
173
|
+
// sometimes when it hasn't). IE's event fires out of order with respect
|
|
174
|
+
// to key and input events on deletion, so we discard it.
|
|
175
|
+
//
|
|
171
176
|
// Firefox doesn't support selectionchange, so check selection status
|
|
172
177
|
// after each key entry. The selection changes after keydown and before
|
|
173
178
|
// keyup, but we check on keydown as well in the case of holding down a
|
|
174
179
|
// key, when multiple keydown events are fired but only one keyup is.
|
|
180
|
+
// This is also our approach for IE handling, for the reason above.
|
|
175
181
|
case topLevelTypes.topSelectionChange:
|
|
182
|
+
if (skipSelectionChangeEvent) {
|
|
183
|
+
break;
|
|
184
|
+
}
|
|
185
|
+
// falls through
|
|
176
186
|
case topLevelTypes.topKeyDown:
|
|
177
187
|
case topLevelTypes.topKeyUp:
|
|
178
188
|
return constructSelectEvent(nativeEvent, nativeEventTarget);
|
package/lib/SimpleEventPlugin.js
CHANGED
|
@@ -11,36 +11,52 @@
|
|
|
11
11
|
|
|
12
12
|
'use strict';
|
|
13
13
|
|
|
14
|
-
var EventConstants = require(
|
|
15
|
-
var EventListener = require(
|
|
16
|
-
var
|
|
17
|
-
var
|
|
18
|
-
var
|
|
19
|
-
var
|
|
20
|
-
var
|
|
21
|
-
var
|
|
22
|
-
var
|
|
23
|
-
var
|
|
24
|
-
var
|
|
25
|
-
var
|
|
26
|
-
var
|
|
27
|
-
var SyntheticWheelEvent = require("./SyntheticWheelEvent");
|
|
14
|
+
var EventConstants = require('./EventConstants');
|
|
15
|
+
var EventListener = require('fbjs/lib/EventListener');
|
|
16
|
+
var EventPropagators = require('./EventPropagators');
|
|
17
|
+
var ReactMount = require('./ReactMount');
|
|
18
|
+
var SyntheticClipboardEvent = require('./SyntheticClipboardEvent');
|
|
19
|
+
var SyntheticEvent = require('./SyntheticEvent');
|
|
20
|
+
var SyntheticFocusEvent = require('./SyntheticFocusEvent');
|
|
21
|
+
var SyntheticKeyboardEvent = require('./SyntheticKeyboardEvent');
|
|
22
|
+
var SyntheticMouseEvent = require('./SyntheticMouseEvent');
|
|
23
|
+
var SyntheticDragEvent = require('./SyntheticDragEvent');
|
|
24
|
+
var SyntheticTouchEvent = require('./SyntheticTouchEvent');
|
|
25
|
+
var SyntheticUIEvent = require('./SyntheticUIEvent');
|
|
26
|
+
var SyntheticWheelEvent = require('./SyntheticWheelEvent');
|
|
28
27
|
|
|
29
|
-
var emptyFunction = require(
|
|
30
|
-
var getEventCharCode = require(
|
|
31
|
-
var invariant = require(
|
|
32
|
-
var keyOf = require(
|
|
33
|
-
var warning = require("./warning");
|
|
28
|
+
var emptyFunction = require('fbjs/lib/emptyFunction');
|
|
29
|
+
var getEventCharCode = require('./getEventCharCode');
|
|
30
|
+
var invariant = require('fbjs/lib/invariant');
|
|
31
|
+
var keyOf = require('fbjs/lib/keyOf');
|
|
34
32
|
|
|
35
33
|
var topLevelTypes = EventConstants.topLevelTypes;
|
|
36
34
|
|
|
37
35
|
var eventTypes = {
|
|
36
|
+
abort: {
|
|
37
|
+
phasedRegistrationNames: {
|
|
38
|
+
bubbled: keyOf({ onAbort: true }),
|
|
39
|
+
captured: keyOf({ onAbortCapture: true })
|
|
40
|
+
}
|
|
41
|
+
},
|
|
38
42
|
blur: {
|
|
39
43
|
phasedRegistrationNames: {
|
|
40
44
|
bubbled: keyOf({ onBlur: true }),
|
|
41
45
|
captured: keyOf({ onBlurCapture: true })
|
|
42
46
|
}
|
|
43
47
|
},
|
|
48
|
+
canPlay: {
|
|
49
|
+
phasedRegistrationNames: {
|
|
50
|
+
bubbled: keyOf({ onCanPlay: true }),
|
|
51
|
+
captured: keyOf({ onCanPlayCapture: true })
|
|
52
|
+
}
|
|
53
|
+
},
|
|
54
|
+
canPlayThrough: {
|
|
55
|
+
phasedRegistrationNames: {
|
|
56
|
+
bubbled: keyOf({ onCanPlayThrough: true }),
|
|
57
|
+
captured: keyOf({ onCanPlayThroughCapture: true })
|
|
58
|
+
}
|
|
59
|
+
},
|
|
44
60
|
click: {
|
|
45
61
|
phasedRegistrationNames: {
|
|
46
62
|
bubbled: keyOf({ onClick: true }),
|
|
@@ -119,6 +135,36 @@ var eventTypes = {
|
|
|
119
135
|
captured: keyOf({ onDropCapture: true })
|
|
120
136
|
}
|
|
121
137
|
},
|
|
138
|
+
durationChange: {
|
|
139
|
+
phasedRegistrationNames: {
|
|
140
|
+
bubbled: keyOf({ onDurationChange: true }),
|
|
141
|
+
captured: keyOf({ onDurationChangeCapture: true })
|
|
142
|
+
}
|
|
143
|
+
},
|
|
144
|
+
emptied: {
|
|
145
|
+
phasedRegistrationNames: {
|
|
146
|
+
bubbled: keyOf({ onEmptied: true }),
|
|
147
|
+
captured: keyOf({ onEmptiedCapture: true })
|
|
148
|
+
}
|
|
149
|
+
},
|
|
150
|
+
encrypted: {
|
|
151
|
+
phasedRegistrationNames: {
|
|
152
|
+
bubbled: keyOf({ onEncrypted: true }),
|
|
153
|
+
captured: keyOf({ onEncryptedCapture: true })
|
|
154
|
+
}
|
|
155
|
+
},
|
|
156
|
+
ended: {
|
|
157
|
+
phasedRegistrationNames: {
|
|
158
|
+
bubbled: keyOf({ onEnded: true }),
|
|
159
|
+
captured: keyOf({ onEndedCapture: true })
|
|
160
|
+
}
|
|
161
|
+
},
|
|
162
|
+
error: {
|
|
163
|
+
phasedRegistrationNames: {
|
|
164
|
+
bubbled: keyOf({ onError: true }),
|
|
165
|
+
captured: keyOf({ onErrorCapture: true })
|
|
166
|
+
}
|
|
167
|
+
},
|
|
122
168
|
focus: {
|
|
123
169
|
phasedRegistrationNames: {
|
|
124
170
|
bubbled: keyOf({ onFocus: true }),
|
|
@@ -155,10 +201,22 @@ var eventTypes = {
|
|
|
155
201
|
captured: keyOf({ onLoadCapture: true })
|
|
156
202
|
}
|
|
157
203
|
},
|
|
158
|
-
|
|
204
|
+
loadedData: {
|
|
159
205
|
phasedRegistrationNames: {
|
|
160
|
-
bubbled: keyOf({
|
|
161
|
-
captured: keyOf({
|
|
206
|
+
bubbled: keyOf({ onLoadedData: true }),
|
|
207
|
+
captured: keyOf({ onLoadedDataCapture: true })
|
|
208
|
+
}
|
|
209
|
+
},
|
|
210
|
+
loadedMetadata: {
|
|
211
|
+
phasedRegistrationNames: {
|
|
212
|
+
bubbled: keyOf({ onLoadedMetadata: true }),
|
|
213
|
+
captured: keyOf({ onLoadedMetadataCapture: true })
|
|
214
|
+
}
|
|
215
|
+
},
|
|
216
|
+
loadStart: {
|
|
217
|
+
phasedRegistrationNames: {
|
|
218
|
+
bubbled: keyOf({ onLoadStart: true }),
|
|
219
|
+
captured: keyOf({ onLoadStartCapture: true })
|
|
162
220
|
}
|
|
163
221
|
},
|
|
164
222
|
// Note: We do not allow listening to mouseOver events. Instead, use the
|
|
@@ -199,6 +257,36 @@ var eventTypes = {
|
|
|
199
257
|
captured: keyOf({ onPasteCapture: true })
|
|
200
258
|
}
|
|
201
259
|
},
|
|
260
|
+
pause: {
|
|
261
|
+
phasedRegistrationNames: {
|
|
262
|
+
bubbled: keyOf({ onPause: true }),
|
|
263
|
+
captured: keyOf({ onPauseCapture: true })
|
|
264
|
+
}
|
|
265
|
+
},
|
|
266
|
+
play: {
|
|
267
|
+
phasedRegistrationNames: {
|
|
268
|
+
bubbled: keyOf({ onPlay: true }),
|
|
269
|
+
captured: keyOf({ onPlayCapture: true })
|
|
270
|
+
}
|
|
271
|
+
},
|
|
272
|
+
playing: {
|
|
273
|
+
phasedRegistrationNames: {
|
|
274
|
+
bubbled: keyOf({ onPlaying: true }),
|
|
275
|
+
captured: keyOf({ onPlayingCapture: true })
|
|
276
|
+
}
|
|
277
|
+
},
|
|
278
|
+
progress: {
|
|
279
|
+
phasedRegistrationNames: {
|
|
280
|
+
bubbled: keyOf({ onProgress: true }),
|
|
281
|
+
captured: keyOf({ onProgressCapture: true })
|
|
282
|
+
}
|
|
283
|
+
},
|
|
284
|
+
rateChange: {
|
|
285
|
+
phasedRegistrationNames: {
|
|
286
|
+
bubbled: keyOf({ onRateChange: true }),
|
|
287
|
+
captured: keyOf({ onRateChangeCapture: true })
|
|
288
|
+
}
|
|
289
|
+
},
|
|
202
290
|
reset: {
|
|
203
291
|
phasedRegistrationNames: {
|
|
204
292
|
bubbled: keyOf({ onReset: true }),
|
|
@@ -211,12 +299,42 @@ var eventTypes = {
|
|
|
211
299
|
captured: keyOf({ onScrollCapture: true })
|
|
212
300
|
}
|
|
213
301
|
},
|
|
302
|
+
seeked: {
|
|
303
|
+
phasedRegistrationNames: {
|
|
304
|
+
bubbled: keyOf({ onSeeked: true }),
|
|
305
|
+
captured: keyOf({ onSeekedCapture: true })
|
|
306
|
+
}
|
|
307
|
+
},
|
|
308
|
+
seeking: {
|
|
309
|
+
phasedRegistrationNames: {
|
|
310
|
+
bubbled: keyOf({ onSeeking: true }),
|
|
311
|
+
captured: keyOf({ onSeekingCapture: true })
|
|
312
|
+
}
|
|
313
|
+
},
|
|
314
|
+
stalled: {
|
|
315
|
+
phasedRegistrationNames: {
|
|
316
|
+
bubbled: keyOf({ onStalled: true }),
|
|
317
|
+
captured: keyOf({ onStalledCapture: true })
|
|
318
|
+
}
|
|
319
|
+
},
|
|
214
320
|
submit: {
|
|
215
321
|
phasedRegistrationNames: {
|
|
216
322
|
bubbled: keyOf({ onSubmit: true }),
|
|
217
323
|
captured: keyOf({ onSubmitCapture: true })
|
|
218
324
|
}
|
|
219
325
|
},
|
|
326
|
+
suspend: {
|
|
327
|
+
phasedRegistrationNames: {
|
|
328
|
+
bubbled: keyOf({ onSuspend: true }),
|
|
329
|
+
captured: keyOf({ onSuspendCapture: true })
|
|
330
|
+
}
|
|
331
|
+
},
|
|
332
|
+
timeUpdate: {
|
|
333
|
+
phasedRegistrationNames: {
|
|
334
|
+
bubbled: keyOf({ onTimeUpdate: true }),
|
|
335
|
+
captured: keyOf({ onTimeUpdateCapture: true })
|
|
336
|
+
}
|
|
337
|
+
},
|
|
220
338
|
touchCancel: {
|
|
221
339
|
phasedRegistrationNames: {
|
|
222
340
|
bubbled: keyOf({ onTouchCancel: true }),
|
|
@@ -241,6 +359,18 @@ var eventTypes = {
|
|
|
241
359
|
captured: keyOf({ onTouchStartCapture: true })
|
|
242
360
|
}
|
|
243
361
|
},
|
|
362
|
+
volumeChange: {
|
|
363
|
+
phasedRegistrationNames: {
|
|
364
|
+
bubbled: keyOf({ onVolumeChange: true }),
|
|
365
|
+
captured: keyOf({ onVolumeChangeCapture: true })
|
|
366
|
+
}
|
|
367
|
+
},
|
|
368
|
+
waiting: {
|
|
369
|
+
phasedRegistrationNames: {
|
|
370
|
+
bubbled: keyOf({ onWaiting: true }),
|
|
371
|
+
captured: keyOf({ onWaitingCapture: true })
|
|
372
|
+
}
|
|
373
|
+
},
|
|
244
374
|
wheel: {
|
|
245
375
|
phasedRegistrationNames: {
|
|
246
376
|
bubbled: keyOf({ onWheel: true }),
|
|
@@ -250,7 +380,10 @@ var eventTypes = {
|
|
|
250
380
|
};
|
|
251
381
|
|
|
252
382
|
var topLevelEventsToDispatchConfig = {
|
|
383
|
+
topAbort: eventTypes.abort,
|
|
253
384
|
topBlur: eventTypes.blur,
|
|
385
|
+
topCanPlay: eventTypes.canPlay,
|
|
386
|
+
topCanPlayThrough: eventTypes.canPlayThrough,
|
|
254
387
|
topClick: eventTypes.click,
|
|
255
388
|
topContextMenu: eventTypes.contextMenu,
|
|
256
389
|
topCopy: eventTypes.copy,
|
|
@@ -264,6 +397,10 @@ var topLevelEventsToDispatchConfig = {
|
|
|
264
397
|
topDragOver: eventTypes.dragOver,
|
|
265
398
|
topDragStart: eventTypes.dragStart,
|
|
266
399
|
topDrop: eventTypes.drop,
|
|
400
|
+
topDurationChange: eventTypes.durationChange,
|
|
401
|
+
topEmptied: eventTypes.emptied,
|
|
402
|
+
topEncrypted: eventTypes.encrypted,
|
|
403
|
+
topEnded: eventTypes.ended,
|
|
267
404
|
topError: eventTypes.error,
|
|
268
405
|
topFocus: eventTypes.focus,
|
|
269
406
|
topInput: eventTypes.input,
|
|
@@ -271,19 +408,34 @@ var topLevelEventsToDispatchConfig = {
|
|
|
271
408
|
topKeyPress: eventTypes.keyPress,
|
|
272
409
|
topKeyUp: eventTypes.keyUp,
|
|
273
410
|
topLoad: eventTypes.load,
|
|
411
|
+
topLoadedData: eventTypes.loadedData,
|
|
412
|
+
topLoadedMetadata: eventTypes.loadedMetadata,
|
|
413
|
+
topLoadStart: eventTypes.loadStart,
|
|
274
414
|
topMouseDown: eventTypes.mouseDown,
|
|
275
415
|
topMouseMove: eventTypes.mouseMove,
|
|
276
416
|
topMouseOut: eventTypes.mouseOut,
|
|
277
417
|
topMouseOver: eventTypes.mouseOver,
|
|
278
418
|
topMouseUp: eventTypes.mouseUp,
|
|
279
419
|
topPaste: eventTypes.paste,
|
|
420
|
+
topPause: eventTypes.pause,
|
|
421
|
+
topPlay: eventTypes.play,
|
|
422
|
+
topPlaying: eventTypes.playing,
|
|
423
|
+
topProgress: eventTypes.progress,
|
|
424
|
+
topRateChange: eventTypes.rateChange,
|
|
280
425
|
topReset: eventTypes.reset,
|
|
281
426
|
topScroll: eventTypes.scroll,
|
|
427
|
+
topSeeked: eventTypes.seeked,
|
|
428
|
+
topSeeking: eventTypes.seeking,
|
|
429
|
+
topStalled: eventTypes.stalled,
|
|
282
430
|
topSubmit: eventTypes.submit,
|
|
431
|
+
topSuspend: eventTypes.suspend,
|
|
432
|
+
topTimeUpdate: eventTypes.timeUpdate,
|
|
283
433
|
topTouchCancel: eventTypes.touchCancel,
|
|
284
434
|
topTouchEnd: eventTypes.touchEnd,
|
|
285
435
|
topTouchMove: eventTypes.touchMove,
|
|
286
436
|
topTouchStart: eventTypes.touchStart,
|
|
437
|
+
topVolumeChange: eventTypes.volumeChange,
|
|
438
|
+
topWaiting: eventTypes.waiting,
|
|
287
439
|
topWheel: eventTypes.wheel
|
|
288
440
|
};
|
|
289
441
|
|
|
@@ -298,25 +450,6 @@ var SimpleEventPlugin = {
|
|
|
298
450
|
|
|
299
451
|
eventTypes: eventTypes,
|
|
300
452
|
|
|
301
|
-
/**
|
|
302
|
-
* Same as the default implementation, except cancels the event when return
|
|
303
|
-
* value is false. This behavior will be disabled in a future release.
|
|
304
|
-
*
|
|
305
|
-
* @param {object} event Event to be dispatched.
|
|
306
|
-
* @param {function} listener Application-level callback.
|
|
307
|
-
* @param {string} domID DOM ID to pass to the callback.
|
|
308
|
-
*/
|
|
309
|
-
executeDispatch: function (event, listener, domID) {
|
|
310
|
-
var returnValue = EventPluginUtils.executeDispatch(event, listener, domID);
|
|
311
|
-
|
|
312
|
-
'production' !== process.env.NODE_ENV ? 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
|
-
|
|
314
|
-
if (returnValue === false) {
|
|
315
|
-
event.stopPropagation();
|
|
316
|
-
event.preventDefault();
|
|
317
|
-
}
|
|
318
|
-
},
|
|
319
|
-
|
|
320
453
|
/**
|
|
321
454
|
* @param {string} topLevelType Record from `EventConstants`.
|
|
322
455
|
* @param {DOMEventTarget} topLevelTarget The listening component root node.
|
|
@@ -332,11 +465,33 @@ var SimpleEventPlugin = {
|
|
|
332
465
|
}
|
|
333
466
|
var EventConstructor;
|
|
334
467
|
switch (topLevelType) {
|
|
468
|
+
case topLevelTypes.topAbort:
|
|
469
|
+
case topLevelTypes.topCanPlay:
|
|
470
|
+
case topLevelTypes.topCanPlayThrough:
|
|
471
|
+
case topLevelTypes.topDurationChange:
|
|
472
|
+
case topLevelTypes.topEmptied:
|
|
473
|
+
case topLevelTypes.topEncrypted:
|
|
474
|
+
case topLevelTypes.topEnded:
|
|
475
|
+
case topLevelTypes.topError:
|
|
335
476
|
case topLevelTypes.topInput:
|
|
336
477
|
case topLevelTypes.topLoad:
|
|
337
|
-
case topLevelTypes.
|
|
478
|
+
case topLevelTypes.topLoadedData:
|
|
479
|
+
case topLevelTypes.topLoadedMetadata:
|
|
480
|
+
case topLevelTypes.topLoadStart:
|
|
481
|
+
case topLevelTypes.topPause:
|
|
482
|
+
case topLevelTypes.topPlay:
|
|
483
|
+
case topLevelTypes.topPlaying:
|
|
484
|
+
case topLevelTypes.topProgress:
|
|
485
|
+
case topLevelTypes.topRateChange:
|
|
338
486
|
case topLevelTypes.topReset:
|
|
487
|
+
case topLevelTypes.topSeeked:
|
|
488
|
+
case topLevelTypes.topSeeking:
|
|
489
|
+
case topLevelTypes.topStalled:
|
|
339
490
|
case topLevelTypes.topSubmit:
|
|
491
|
+
case topLevelTypes.topSuspend:
|
|
492
|
+
case topLevelTypes.topTimeUpdate:
|
|
493
|
+
case topLevelTypes.topVolumeChange:
|
|
494
|
+
case topLevelTypes.topWaiting:
|
|
340
495
|
// HTML Events
|
|
341
496
|
// @see http://www.w3.org/TR/html5/index.html#events-0
|
|
342
497
|
EventConstructor = SyntheticEvent;
|
|
@@ -401,7 +556,7 @@ var SimpleEventPlugin = {
|
|
|
401
556
|
EventConstructor = SyntheticClipboardEvent;
|
|
402
557
|
break;
|
|
403
558
|
}
|
|
404
|
-
!EventConstructor ?
|
|
559
|
+
!EventConstructor ? process.env.NODE_ENV !== 'production' ? invariant(false, 'SimpleEventPlugin: Unhandled event type, `%s`.', topLevelType) : invariant(false) : undefined;
|
|
405
560
|
var event = EventConstructor.getPooled(dispatchConfig, topLevelTargetID, nativeEvent, nativeEventTarget);
|
|
406
561
|
EventPropagators.accumulateTwoPhaseDispatches(event);
|
|
407
562
|
return event;
|