react 0.8.0 → 0.10.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/README.md +0 -8
- package/addons.js +0 -3
- package/lib/AutoFocusMixin.js +32 -0
- package/lib/CSSCore.js +23 -22
- package/lib/CSSProperty.js +32 -1
- package/lib/CSSPropertyOperations.js +1 -1
- package/lib/ChangeEventPlugin.js +27 -5
- package/lib/ClientReactRootIndex.js +30 -0
- package/lib/CompositionEventPlugin.js +58 -10
- package/lib/DOMChildrenOperations.js +39 -3
- package/lib/DOMProperty.js +9 -5
- package/lib/DOMPropertyOperations.js +21 -8
- package/lib/Danger.js +9 -8
- package/lib/DefaultDOMPropertyConfig.js +23 -14
- package/lib/DefaultEventPluginOrder.js +1 -1
- package/lib/EnterLeaveEventPlugin.js +38 -5
- package/lib/EventConstants.js +4 -1
- package/lib/EventListener.js +42 -34
- package/lib/EventPluginHub.js +118 -13
- package/lib/EventPluginRegistry.js +62 -18
- package/lib/EventPluginUtils.js +33 -4
- package/lib/EventPropagators.js +7 -43
- package/lib/ExecutionEnvironment.js +4 -1
- package/lib/LinkedStateMixin.js +1 -1
- package/lib/LinkedValueUtils.js +160 -0
- package/lib/MobileSafariClickEventPlugin.js +1 -1
- package/lib/PooledClass.js +7 -1
- package/lib/React.js +30 -4
- package/lib/ReactBrowserComponentMixin.js +42 -0
- package/lib/ReactCSSTransitionGroup.js +65 -0
- package/lib/{ReactTransitionableChild.js → ReactCSSTransitionGroupChild.js} +22 -36
- package/lib/ReactChildren.js +4 -4
- package/lib/ReactComponent.js +163 -83
- package/lib/ReactComponentBrowserEnvironment.js +55 -71
- package/lib/ReactCompositeComponent.js +686 -119
- package/lib/ReactContext.js +67 -0
- package/lib/ReactCurrentOwner.js +1 -1
- package/lib/ReactDOM.js +19 -6
- package/lib/ReactDOMButton.js +6 -1
- package/lib/ReactDOMComponent.js +66 -24
- package/lib/ReactDOMForm.js +13 -3
- package/lib/ReactDOMIDOperations.js +106 -61
- package/lib/ReactDOMImg.js +61 -0
- package/lib/ReactDOMInput.js +28 -15
- package/lib/ReactDOMOption.js +13 -8
- package/lib/ReactDOMSelect.js +38 -18
- package/lib/ReactDOMSelection.js +1 -1
- package/lib/ReactDOMTextarea.js +19 -11
- package/lib/ReactDefaultBatchingStrategy.js +1 -1
- package/lib/ReactDefaultInjection.js +60 -26
- package/lib/ReactDefaultPerf.js +208 -371
- package/lib/ReactDefaultPerfAnalysis.js +199 -0
- package/lib/ReactErrorUtils.js +6 -15
- package/lib/ReactEventEmitter.js +144 -146
- package/lib/ReactEventEmitterMixin.js +1 -33
- package/lib/ReactEventTopLevelCallback.js +75 -15
- package/lib/ReactInjection.js +43 -0
- package/lib/ReactInputSelection.js +3 -2
- package/lib/ReactInstanceHandles.js +36 -20
- package/lib/ReactLink.js +2 -2
- package/lib/ReactMarkupChecksum.js +1 -1
- package/lib/ReactMount.js +136 -104
- package/lib/ReactMountReady.js +2 -2
- package/lib/ReactMultiChild.js +40 -49
- package/lib/ReactMultiChildUpdateTypes.js +3 -1
- package/lib/ReactOwner.js +17 -4
- package/lib/ReactPerf.js +6 -9
- package/lib/ReactPropTransferer.js +41 -22
- package/lib/ReactPropTypeLocationNames.js +31 -0
- package/lib/{ReactComponentEnvironment.js → ReactPropTypeLocations.js} +11 -6
- package/lib/ReactPropTypes.js +249 -48
- package/lib/ReactPutListenerQueue.js +61 -0
- package/lib/ReactReconcileTransaction.js +28 -7
- package/lib/ReactRootIndex.js +36 -0
- package/lib/ReactServerRendering.js +46 -19
- package/lib/ReactServerRenderingTransaction.js +116 -0
- package/lib/ReactStateSetters.js +1 -1
- package/lib/ReactTestUtils.js +394 -0
- package/lib/ReactTextComponent.js +33 -6
- package/lib/{ReactTransitionKeySet.js → ReactTransitionChildMapping.js} +43 -48
- package/lib/ReactTransitionEvents.js +1 -1
- package/lib/ReactTransitionGroup.js +133 -58
- package/lib/ReactUpdates.js +15 -12
- package/lib/ReactWithAddons.js +15 -3
- package/lib/SelectEventPlugin.js +23 -40
- package/lib/ServerReactRootIndex.js +36 -0
- package/lib/SimpleEventPlugin.js +55 -7
- package/lib/SyntheticClipboardEvent.js +8 -2
- package/lib/SyntheticCompositionEvent.js +1 -1
- package/lib/SyntheticDragEvent.js +44 -0
- package/lib/SyntheticEvent.js +3 -2
- package/lib/SyntheticFocusEvent.js +1 -1
- package/lib/SyntheticKeyboardEvent.js +5 -3
- package/lib/SyntheticMouseEvent.js +1 -1
- package/lib/SyntheticTouchEvent.js +1 -1
- package/lib/SyntheticUIEvent.js +1 -1
- package/lib/SyntheticWheelEvent.js +11 -8
- package/lib/Transaction.js +62 -37
- package/lib/ViewportMetrics.js +1 -1
- package/lib/accumulate.js +1 -1
- package/lib/adler32.js +1 -1
- package/lib/cloneWithProps.js +59 -0
- package/lib/containsNode.js +1 -1
- package/lib/copyProperties.js +1 -1
- package/lib/createArrayFrom.js +11 -14
- package/lib/createFullPageComponent.js +63 -0
- package/lib/createNodesFromMarkup.js +1 -1
- package/lib/createObjectFrom.js +1 -1
- package/lib/cx.js +3 -3
- package/lib/dangerousStyleValue.js +1 -1
- package/lib/emptyFunction.js +1 -1
- package/lib/emptyObject.js +27 -0
- package/lib/escapeTextForBrowser.js +1 -1
- package/lib/flattenChildren.js +6 -3
- package/lib/focusNode.js +33 -0
- package/lib/forEachAccumulated.js +1 -1
- package/lib/getActiveElement.js +5 -4
- package/lib/getEventKey.js +85 -0
- package/lib/getEventTarget.js +1 -1
- package/lib/getMarkupWrap.js +11 -1
- package/lib/getNodeForCharacterOffset.js +1 -1
- package/lib/getReactRootElementInContainer.js +1 -1
- package/lib/getTextContentAccessor.js +6 -4
- package/lib/getUnboundedScrollPosition.js +3 -3
- package/lib/hyphenate.js +1 -1
- package/lib/instantiateReactComponent.js +70 -0
- package/lib/invariant.js +20 -12
- package/lib/isEventSupported.js +8 -12
- package/lib/isNode.js +2 -2
- package/lib/isTextInputElement.js +1 -1
- package/lib/isTextNode.js +1 -1
- package/lib/joinClasses.js +1 -1
- package/lib/keyMirror.js +1 -1
- package/lib/keyOf.js +1 -1
- package/lib/memoizeStringOnly.js +1 -1
- package/lib/merge.js +1 -1
- package/lib/mergeHelpers.js +6 -7
- package/lib/mergeInto.js +1 -1
- package/lib/mixInto.js +1 -1
- package/lib/monitorCodeUse.js +37 -0
- package/lib/objMap.js +1 -1
- package/lib/objMapKeyVal.js +1 -1
- package/lib/onlyChild.js +43 -0
- package/lib/performanceNow.js +1 -1
- package/lib/shallowEqual.js +1 -1
- package/lib/shouldUpdateReactComponent.js +61 -0
- package/lib/toArray.js +75 -0
- package/lib/traverseAllChildren.js +72 -9
- package/lib/update.js +159 -0
- package/lib/warning.js +48 -0
- package/package.json +3 -3
- package/react.js +0 -3
- package/ReactJSErrors.js +0 -40
- package/lib/$.js +0 -46
- package/lib/CallbackRegistry.js +0 -91
- package/lib/LinkedValueMixin.js +0 -68
- package/lib/ex.js +0 -49
- package/lib/filterAttributes.js +0 -45
- package/lib/ge.js +0 -76
- package/lib/mutateHTMLNodeWithMarkup.js +0 -100
package/lib/ReactUpdates.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* Copyright 2013 Facebook, Inc.
|
|
2
|
+
* Copyright 2013-2014 Facebook, Inc.
|
|
3
3
|
*
|
|
4
4
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
5
5
|
* you may not use this file except in compliance with the License.
|
|
@@ -18,6 +18,8 @@
|
|
|
18
18
|
|
|
19
19
|
"use strict";
|
|
20
20
|
|
|
21
|
+
var ReactPerf = require("./ReactPerf");
|
|
22
|
+
|
|
21
23
|
var invariant = require("./invariant");
|
|
22
24
|
|
|
23
25
|
var dirtyComponents = [];
|
|
@@ -75,17 +77,18 @@ function clearDirtyComponents() {
|
|
|
75
77
|
dirtyComponents.length = 0;
|
|
76
78
|
}
|
|
77
79
|
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
80
|
+
var flushBatchedUpdates = ReactPerf.measure(
|
|
81
|
+
'ReactUpdates',
|
|
82
|
+
'flushBatchedUpdates',
|
|
83
|
+
function() {
|
|
84
|
+
// Run these in separate functions so the JIT can optimize
|
|
85
|
+
try {
|
|
86
|
+
runBatchedUpdates();
|
|
87
|
+
} finally {
|
|
88
|
+
clearDirtyComponents();
|
|
89
|
+
}
|
|
87
90
|
}
|
|
88
|
-
|
|
91
|
+
);
|
|
89
92
|
|
|
90
93
|
/**
|
|
91
94
|
* Mark a component as needing a rerender, adding an optional callback to a
|
|
@@ -102,7 +105,7 @@ function enqueueUpdate(component, callback) {
|
|
|
102
105
|
|
|
103
106
|
if (!batchingStrategy.isBatchingUpdates) {
|
|
104
107
|
component.performUpdateIfNecessary();
|
|
105
|
-
callback && callback();
|
|
108
|
+
callback && callback.call(component);
|
|
106
109
|
return;
|
|
107
110
|
}
|
|
108
111
|
|
package/lib/ReactWithAddons.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* Copyright 2013 Facebook, Inc.
|
|
2
|
+
* Copyright 2013-2014 Facebook, Inc.
|
|
3
3
|
*
|
|
4
4
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
5
5
|
* you may not use this file except in compliance with the License.
|
|
@@ -27,15 +27,27 @@
|
|
|
27
27
|
|
|
28
28
|
var LinkedStateMixin = require("./LinkedStateMixin");
|
|
29
29
|
var React = require("./React");
|
|
30
|
+
var ReactCSSTransitionGroup = require("./ReactCSSTransitionGroup");
|
|
30
31
|
var ReactTransitionGroup = require("./ReactTransitionGroup");
|
|
32
|
+
var ReactCSSTransitionGroup = require("./ReactCSSTransitionGroup");
|
|
31
33
|
|
|
32
34
|
var cx = require("./cx");
|
|
35
|
+
var cloneWithProps = require("./cloneWithProps");
|
|
36
|
+
var update = require("./update");
|
|
33
37
|
|
|
34
38
|
React.addons = {
|
|
35
|
-
classSet: cx,
|
|
36
39
|
LinkedStateMixin: LinkedStateMixin,
|
|
37
|
-
|
|
40
|
+
CSSTransitionGroup: ReactCSSTransitionGroup,
|
|
41
|
+
TransitionGroup: ReactTransitionGroup,
|
|
42
|
+
|
|
43
|
+
classSet: cx,
|
|
44
|
+
cloneWithProps: cloneWithProps,
|
|
45
|
+
update: update
|
|
38
46
|
};
|
|
39
47
|
|
|
48
|
+
if ("production" !== process.env.NODE_ENV) {
|
|
49
|
+
React.addons.TestUtils = require("./ReactTestUtils");
|
|
50
|
+
}
|
|
51
|
+
|
|
40
52
|
module.exports = React;
|
|
41
53
|
|
package/lib/SelectEventPlugin.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* Copyright 2013 Facebook, Inc.
|
|
2
|
+
* Copyright 2013-2014 Facebook, Inc.
|
|
3
3
|
*
|
|
4
4
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
5
5
|
* you may not use this file except in compliance with the License.
|
|
@@ -19,9 +19,7 @@
|
|
|
19
19
|
"use strict";
|
|
20
20
|
|
|
21
21
|
var EventConstants = require("./EventConstants");
|
|
22
|
-
var EventPluginHub = require("./EventPluginHub");
|
|
23
22
|
var EventPropagators = require("./EventPropagators");
|
|
24
|
-
var ExecutionEnvironment = require("./ExecutionEnvironment");
|
|
25
23
|
var ReactInputSelection = require("./ReactInputSelection");
|
|
26
24
|
var SyntheticEvent = require("./SyntheticEvent");
|
|
27
25
|
|
|
@@ -37,19 +35,21 @@ var eventTypes = {
|
|
|
37
35
|
phasedRegistrationNames: {
|
|
38
36
|
bubbled: keyOf({onSelect: null}),
|
|
39
37
|
captured: keyOf({onSelectCapture: null})
|
|
40
|
-
}
|
|
38
|
+
},
|
|
39
|
+
dependencies: [
|
|
40
|
+
topLevelTypes.topBlur,
|
|
41
|
+
topLevelTypes.topContextMenu,
|
|
42
|
+
topLevelTypes.topFocus,
|
|
43
|
+
topLevelTypes.topKeyDown,
|
|
44
|
+
topLevelTypes.topMouseDown,
|
|
45
|
+
topLevelTypes.topMouseUp,
|
|
46
|
+
topLevelTypes.topSelectionChange
|
|
47
|
+
]
|
|
41
48
|
}
|
|
42
49
|
};
|
|
43
50
|
|
|
44
|
-
var useSelectionChange = false;
|
|
45
|
-
|
|
46
|
-
if (ExecutionEnvironment.canUseDOM) {
|
|
47
|
-
useSelectionChange = 'onselectionchange' in document;
|
|
48
|
-
}
|
|
49
|
-
|
|
50
51
|
var activeElement = null;
|
|
51
52
|
var activeElementID = null;
|
|
52
|
-
var activeNativeEvent = null;
|
|
53
53
|
var lastSelection = null;
|
|
54
54
|
var mouseDown = false;
|
|
55
55
|
|
|
@@ -96,8 +96,12 @@ function getSelection(node) {
|
|
|
96
96
|
*/
|
|
97
97
|
function constructSelectEvent(nativeEvent) {
|
|
98
98
|
// Ensure we have the right element, and that the user is not dragging a
|
|
99
|
-
// selection (this matches native `select` event behavior).
|
|
100
|
-
if
|
|
99
|
+
// selection (this matches native `select` event behavior). In HTML5, select
|
|
100
|
+
// fires only on input and textarea thus if there's no focused element we
|
|
101
|
+
// won't dispatch.
|
|
102
|
+
if (mouseDown ||
|
|
103
|
+
activeElement == null ||
|
|
104
|
+
activeElement != getActiveElement()) {
|
|
101
105
|
return;
|
|
102
106
|
}
|
|
103
107
|
|
|
@@ -121,24 +125,6 @@ function constructSelectEvent(nativeEvent) {
|
|
|
121
125
|
}
|
|
122
126
|
}
|
|
123
127
|
|
|
124
|
-
/**
|
|
125
|
-
* Handle deferred event. And manually dispatch synthetic events.
|
|
126
|
-
*/
|
|
127
|
-
function dispatchDeferredSelectEvent() {
|
|
128
|
-
if (!activeNativeEvent) {
|
|
129
|
-
return;
|
|
130
|
-
}
|
|
131
|
-
|
|
132
|
-
var syntheticEvent = constructSelectEvent(activeNativeEvent);
|
|
133
|
-
activeNativeEvent = null;
|
|
134
|
-
|
|
135
|
-
// Enqueue and process the abstract event manually.
|
|
136
|
-
if (syntheticEvent) {
|
|
137
|
-
EventPluginHub.enqueueEvents(syntheticEvent);
|
|
138
|
-
EventPluginHub.processEventQueue();
|
|
139
|
-
}
|
|
140
|
-
}
|
|
141
|
-
|
|
142
128
|
/**
|
|
143
129
|
* This plugin creates an `onSelect` event that normalizes select events
|
|
144
130
|
* across form elements.
|
|
@@ -199,17 +185,14 @@ var SelectEventPlugin = {
|
|
|
199
185
|
|
|
200
186
|
// Chrome and IE fire non-standard event when selection is changed (and
|
|
201
187
|
// sometimes when it hasn't).
|
|
202
|
-
case topLevelTypes.topSelectionChange:
|
|
203
|
-
return constructSelectEvent(nativeEvent);
|
|
204
|
-
|
|
205
188
|
// Firefox doesn't support selectionchange, so check selection status
|
|
206
|
-
// after each key entry.
|
|
189
|
+
// after each key entry. The selection changes after keydown and before
|
|
190
|
+
// keyup, but we check on keydown as well in the case of holding down a
|
|
191
|
+
// key, when multiple keydown events are fired but only one keyup is.
|
|
192
|
+
case topLevelTypes.topSelectionChange:
|
|
207
193
|
case topLevelTypes.topKeyDown:
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
setTimeout(dispatchDeferredSelectEvent, 0);
|
|
211
|
-
}
|
|
212
|
-
break;
|
|
194
|
+
case topLevelTypes.topKeyUp:
|
|
195
|
+
return constructSelectEvent(nativeEvent);
|
|
213
196
|
}
|
|
214
197
|
}
|
|
215
198
|
};
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright 2013-2014 Facebook, Inc.
|
|
3
|
+
*
|
|
4
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
5
|
+
* you may not use this file except in compliance with the License.
|
|
6
|
+
* You may obtain a copy of the License at
|
|
7
|
+
*
|
|
8
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
9
|
+
*
|
|
10
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
11
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
12
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
13
|
+
* See the License for the specific language governing permissions and
|
|
14
|
+
* limitations under the License.
|
|
15
|
+
*
|
|
16
|
+
* @providesModule ServerReactRootIndex
|
|
17
|
+
* @typechecks
|
|
18
|
+
*/
|
|
19
|
+
|
|
20
|
+
"use strict";
|
|
21
|
+
|
|
22
|
+
/**
|
|
23
|
+
* Size of the reactRoot ID space. We generate random numbers for React root
|
|
24
|
+
* IDs and if there's a collision the events and DOM update system will
|
|
25
|
+
* get confused. In the future we need a way to generate GUIDs but for
|
|
26
|
+
* now this will work on a smaller scale.
|
|
27
|
+
*/
|
|
28
|
+
var GLOBAL_MOUNT_POINT_MAX = Math.pow(2, 53);
|
|
29
|
+
|
|
30
|
+
var ServerReactRootIndex = {
|
|
31
|
+
createReactRootIndex: function() {
|
|
32
|
+
return Math.ceil(Math.random() * GLOBAL_MOUNT_POINT_MAX);
|
|
33
|
+
}
|
|
34
|
+
};
|
|
35
|
+
|
|
36
|
+
module.exports = ServerReactRootIndex;
|
package/lib/SimpleEventPlugin.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* Copyright 2013 Facebook, Inc.
|
|
2
|
+
* Copyright 2013-2014 Facebook, Inc.
|
|
3
3
|
*
|
|
4
4
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
5
5
|
* you may not use this file except in compliance with the License.
|
|
@@ -19,12 +19,14 @@
|
|
|
19
19
|
"use strict";
|
|
20
20
|
|
|
21
21
|
var EventConstants = require("./EventConstants");
|
|
22
|
+
var EventPluginUtils = require("./EventPluginUtils");
|
|
22
23
|
var EventPropagators = require("./EventPropagators");
|
|
23
24
|
var SyntheticClipboardEvent = require("./SyntheticClipboardEvent");
|
|
24
25
|
var SyntheticEvent = require("./SyntheticEvent");
|
|
25
26
|
var SyntheticFocusEvent = require("./SyntheticFocusEvent");
|
|
26
27
|
var SyntheticKeyboardEvent = require("./SyntheticKeyboardEvent");
|
|
27
28
|
var SyntheticMouseEvent = require("./SyntheticMouseEvent");
|
|
29
|
+
var SyntheticDragEvent = require("./SyntheticDragEvent");
|
|
28
30
|
var SyntheticTouchEvent = require("./SyntheticTouchEvent");
|
|
29
31
|
var SyntheticUIEvent = require("./SyntheticUIEvent");
|
|
30
32
|
var SyntheticWheelEvent = require("./SyntheticWheelEvent");
|
|
@@ -149,6 +151,18 @@ var eventTypes = {
|
|
|
149
151
|
captured: keyOf({onKeyUpCapture: true})
|
|
150
152
|
}
|
|
151
153
|
},
|
|
154
|
+
load: {
|
|
155
|
+
phasedRegistrationNames: {
|
|
156
|
+
bubbled: keyOf({onLoad: true}),
|
|
157
|
+
captured: keyOf({onLoadCapture: true})
|
|
158
|
+
}
|
|
159
|
+
},
|
|
160
|
+
error: {
|
|
161
|
+
phasedRegistrationNames: {
|
|
162
|
+
bubbled: keyOf({onError: true}),
|
|
163
|
+
captured: keyOf({onErrorCapture: true})
|
|
164
|
+
}
|
|
165
|
+
},
|
|
152
166
|
// Note: We do not allow listening to mouseOver events. Instead, use the
|
|
153
167
|
// onMouseEnter/onMouseLeave created by `EnterLeaveEventPlugin`.
|
|
154
168
|
mouseDown: {
|
|
@@ -163,6 +177,18 @@ var eventTypes = {
|
|
|
163
177
|
captured: keyOf({onMouseMoveCapture: true})
|
|
164
178
|
}
|
|
165
179
|
},
|
|
180
|
+
mouseOut: {
|
|
181
|
+
phasedRegistrationNames: {
|
|
182
|
+
bubbled: keyOf({onMouseOut: true}),
|
|
183
|
+
captured: keyOf({onMouseOutCapture: true})
|
|
184
|
+
}
|
|
185
|
+
},
|
|
186
|
+
mouseOver: {
|
|
187
|
+
phasedRegistrationNames: {
|
|
188
|
+
bubbled: keyOf({onMouseOver: true}),
|
|
189
|
+
captured: keyOf({onMouseOverCapture: true})
|
|
190
|
+
}
|
|
191
|
+
},
|
|
166
192
|
mouseUp: {
|
|
167
193
|
phasedRegistrationNames: {
|
|
168
194
|
bubbled: keyOf({onMouseUp: true}),
|
|
@@ -175,6 +201,12 @@ var eventTypes = {
|
|
|
175
201
|
captured: keyOf({onPasteCapture: true})
|
|
176
202
|
}
|
|
177
203
|
},
|
|
204
|
+
reset: {
|
|
205
|
+
phasedRegistrationNames: {
|
|
206
|
+
bubbled: keyOf({onReset: true}),
|
|
207
|
+
captured: keyOf({onResetCapture: true})
|
|
208
|
+
}
|
|
209
|
+
},
|
|
178
210
|
scroll: {
|
|
179
211
|
phasedRegistrationNames: {
|
|
180
212
|
bubbled: keyOf({onScroll: true}),
|
|
@@ -234,15 +266,20 @@ var topLevelEventsToDispatchConfig = {
|
|
|
234
266
|
topDragOver: eventTypes.dragOver,
|
|
235
267
|
topDragStart: eventTypes.dragStart,
|
|
236
268
|
topDrop: eventTypes.drop,
|
|
269
|
+
topError: eventTypes.error,
|
|
237
270
|
topFocus: eventTypes.focus,
|
|
238
271
|
topInput: eventTypes.input,
|
|
239
272
|
topKeyDown: eventTypes.keyDown,
|
|
240
273
|
topKeyPress: eventTypes.keyPress,
|
|
241
274
|
topKeyUp: eventTypes.keyUp,
|
|
275
|
+
topLoad: eventTypes.load,
|
|
242
276
|
topMouseDown: eventTypes.mouseDown,
|
|
243
277
|
topMouseMove: eventTypes.mouseMove,
|
|
278
|
+
topMouseOut: eventTypes.mouseOut,
|
|
279
|
+
topMouseOver: eventTypes.mouseOver,
|
|
244
280
|
topMouseUp: eventTypes.mouseUp,
|
|
245
281
|
topPaste: eventTypes.paste,
|
|
282
|
+
topReset: eventTypes.reset,
|
|
246
283
|
topScroll: eventTypes.scroll,
|
|
247
284
|
topSubmit: eventTypes.submit,
|
|
248
285
|
topTouchCancel: eventTypes.touchCancel,
|
|
@@ -252,6 +289,10 @@ var topLevelEventsToDispatchConfig = {
|
|
|
252
289
|
topWheel: eventTypes.wheel
|
|
253
290
|
};
|
|
254
291
|
|
|
292
|
+
for (var topLevelType in topLevelEventsToDispatchConfig) {
|
|
293
|
+
topLevelEventsToDispatchConfig[topLevelType].dependencies = [topLevelType];
|
|
294
|
+
}
|
|
295
|
+
|
|
255
296
|
var SimpleEventPlugin = {
|
|
256
297
|
|
|
257
298
|
eventTypes: eventTypes,
|
|
@@ -265,7 +306,7 @@ var SimpleEventPlugin = {
|
|
|
265
306
|
* @param {string} domID DOM ID to pass to the callback.
|
|
266
307
|
*/
|
|
267
308
|
executeDispatch: function(event, listener, domID) {
|
|
268
|
-
var returnValue =
|
|
309
|
+
var returnValue = EventPluginUtils.executeDispatch(event, listener, domID);
|
|
269
310
|
if (returnValue === false) {
|
|
270
311
|
event.stopPropagation();
|
|
271
312
|
event.preventDefault();
|
|
@@ -290,8 +331,11 @@ var SimpleEventPlugin = {
|
|
|
290
331
|
return null;
|
|
291
332
|
}
|
|
292
333
|
var EventConstructor;
|
|
293
|
-
switch(topLevelType) {
|
|
334
|
+
switch (topLevelType) {
|
|
294
335
|
case topLevelTypes.topInput:
|
|
336
|
+
case topLevelTypes.topLoad:
|
|
337
|
+
case topLevelTypes.topError:
|
|
338
|
+
case topLevelTypes.topReset:
|
|
295
339
|
case topLevelTypes.topSubmit:
|
|
296
340
|
// HTML Events
|
|
297
341
|
// @see http://www.w3.org/TR/html5/index.html#events-0
|
|
@@ -315,6 +359,13 @@ var SimpleEventPlugin = {
|
|
|
315
359
|
/* falls through */
|
|
316
360
|
case topLevelTypes.topContextMenu:
|
|
317
361
|
case topLevelTypes.topDoubleClick:
|
|
362
|
+
case topLevelTypes.topMouseDown:
|
|
363
|
+
case topLevelTypes.topMouseMove:
|
|
364
|
+
case topLevelTypes.topMouseOut:
|
|
365
|
+
case topLevelTypes.topMouseOver:
|
|
366
|
+
case topLevelTypes.topMouseUp:
|
|
367
|
+
EventConstructor = SyntheticMouseEvent;
|
|
368
|
+
break;
|
|
318
369
|
case topLevelTypes.topDrag:
|
|
319
370
|
case topLevelTypes.topDragEnd:
|
|
320
371
|
case topLevelTypes.topDragEnter:
|
|
@@ -323,10 +374,7 @@ var SimpleEventPlugin = {
|
|
|
323
374
|
case topLevelTypes.topDragOver:
|
|
324
375
|
case topLevelTypes.topDragStart:
|
|
325
376
|
case topLevelTypes.topDrop:
|
|
326
|
-
|
|
327
|
-
case topLevelTypes.topMouseMove:
|
|
328
|
-
case topLevelTypes.topMouseUp:
|
|
329
|
-
EventConstructor = SyntheticMouseEvent;
|
|
377
|
+
EventConstructor = SyntheticDragEvent;
|
|
330
378
|
break;
|
|
331
379
|
case topLevelTypes.topTouchCancel:
|
|
332
380
|
case topLevelTypes.topTouchEnd:
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* Copyright 2013 Facebook, Inc.
|
|
2
|
+
* Copyright 2013-2014 Facebook, Inc.
|
|
3
3
|
*
|
|
4
4
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
5
5
|
* you may not use this file except in compliance with the License.
|
|
@@ -26,7 +26,13 @@ var SyntheticEvent = require("./SyntheticEvent");
|
|
|
26
26
|
* @see http://www.w3.org/TR/clipboard-apis/
|
|
27
27
|
*/
|
|
28
28
|
var ClipboardEventInterface = {
|
|
29
|
-
clipboardData:
|
|
29
|
+
clipboardData: function(event) {
|
|
30
|
+
return (
|
|
31
|
+
'clipboardData' in event ?
|
|
32
|
+
event.clipboardData :
|
|
33
|
+
window.clipboardData
|
|
34
|
+
);
|
|
35
|
+
}
|
|
30
36
|
};
|
|
31
37
|
|
|
32
38
|
/**
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright 2013-2014 Facebook, Inc.
|
|
3
|
+
*
|
|
4
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
5
|
+
* you may not use this file except in compliance with the License.
|
|
6
|
+
* You may obtain a copy of the License at
|
|
7
|
+
*
|
|
8
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
9
|
+
*
|
|
10
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
11
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
12
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
13
|
+
* See the License for the specific language governing permissions and
|
|
14
|
+
* limitations under the License.
|
|
15
|
+
*
|
|
16
|
+
* @providesModule SyntheticDragEvent
|
|
17
|
+
* @typechecks static-only
|
|
18
|
+
*/
|
|
19
|
+
|
|
20
|
+
"use strict";
|
|
21
|
+
|
|
22
|
+
var SyntheticMouseEvent = require("./SyntheticMouseEvent");
|
|
23
|
+
|
|
24
|
+
/**
|
|
25
|
+
* @interface DragEvent
|
|
26
|
+
* @see http://www.w3.org/TR/DOM-Level-3-Events/
|
|
27
|
+
*/
|
|
28
|
+
var DragEventInterface = {
|
|
29
|
+
dataTransfer: null
|
|
30
|
+
};
|
|
31
|
+
|
|
32
|
+
/**
|
|
33
|
+
* @param {object} dispatchConfig Configuration used to dispatch this event.
|
|
34
|
+
* @param {string} dispatchMarker Marker identifying the event target.
|
|
35
|
+
* @param {object} nativeEvent Native browser event.
|
|
36
|
+
* @extends {SyntheticUIEvent}
|
|
37
|
+
*/
|
|
38
|
+
function SyntheticDragEvent(dispatchConfig, dispatchMarker, nativeEvent) {
|
|
39
|
+
SyntheticMouseEvent.call(this, dispatchConfig, dispatchMarker, nativeEvent);
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
SyntheticMouseEvent.augmentClass(SyntheticDragEvent, DragEventInterface);
|
|
43
|
+
|
|
44
|
+
module.exports = SyntheticDragEvent;
|