react 15.3.2-rc.1 → 15.4.0-rc.3

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.
Files changed (209) hide show
  1. package/dist/react-with-addons.js +3863 -21388
  2. package/dist/react-with-addons.min.js +3 -6
  3. package/dist/react.js +2639 -19486
  4. package/dist/react.min.js +2 -6
  5. package/lib/KeyEscapeUtils.js +0 -1
  6. package/lib/LinkedStateMixin.js +1 -3
  7. package/lib/PooledClass.js +3 -1
  8. package/lib/React.js +0 -1
  9. package/lib/ReactAddonsDOMDependencies.js +35 -0
  10. package/lib/ReactAddonsDOMDependenciesUMDShim.js +31 -0
  11. package/lib/ReactCSSTransitionGroup.js +60 -43
  12. package/lib/ReactCSSTransitionGroupChild.js +2 -3
  13. package/lib/ReactChildren.js +0 -1
  14. package/lib/ReactClass.js +38 -54
  15. package/lib/ReactComponent.js +0 -1
  16. package/lib/ReactComponentTreeDevtool.js +0 -1
  17. package/lib/ReactComponentTreeHook.js +84 -101
  18. package/lib/{DOMNamespaces.js → ReactComponentTreeHookUMDShim.js} +4 -7
  19. package/lib/ReactComponentWithPureRenderMixin.js +0 -1
  20. package/lib/ReactCurrentOwner.js +1 -2
  21. package/lib/{renderSubtreeIntoContainer.js → ReactCurrentOwnerUMDShim.js} +5 -4
  22. package/lib/ReactDOMFactories.js +0 -1
  23. package/lib/ReactElement.js +6 -14
  24. package/lib/ReactElementSymbol.js +19 -0
  25. package/lib/{ReactDOMComponentFlags.js → ReactElementType.js} +3 -9
  26. package/lib/ReactElementValidator.js +1 -3
  27. package/lib/ReactFragment.js +0 -1
  28. package/lib/ReactLink.js +0 -1
  29. package/lib/ReactNoopUpdateQueue.js +0 -1
  30. package/lib/ReactPropTypeLocationNames.js +1 -1
  31. package/lib/ReactPropTypeLocations.js +2 -12
  32. package/lib/ReactPropTypes.js +5 -3
  33. package/lib/ReactPropTypesSecret.js +1 -1
  34. package/lib/ReactPureComponent.js +0 -1
  35. package/lib/ReactStateSetters.js +0 -1
  36. package/lib/ReactTransitionChildMapping.js +0 -1
  37. package/lib/ReactTransitionEvents.js +1 -2
  38. package/lib/ReactTransitionGroup.js +145 -142
  39. package/lib/ReactUMDEntry.js +11 -6
  40. package/lib/{ReactDOMFeatureFlags.js → ReactUMDShim.js} +3 -6
  41. package/lib/ReactVersion.js +1 -2
  42. package/lib/ReactWithAddons.js +15 -3
  43. package/lib/ReactWithAddonsUMDEntry.js +11 -6
  44. package/lib/canDefineProperty.js +2 -1
  45. package/lib/checkReactTypeSpec.js +0 -1
  46. package/lib/deprecated.js +0 -1
  47. package/lib/flattenChildren.js +0 -1
  48. package/lib/getIteratorFn.js +0 -1
  49. package/lib/onlyChild.js +0 -1
  50. package/lib/reactProdInvariant.js +0 -1
  51. package/lib/sliceChildren.js +0 -1
  52. package/lib/traverseAllChildren.js +11 -3
  53. package/lib/update.js +6 -8
  54. package/package.json +1 -1
  55. package/lib/AutoFocusUtils.js +0 -24
  56. package/lib/BeforeInputEventPlugin.js +0 -390
  57. package/lib/CSSProperty.js +0 -148
  58. package/lib/CSSPropertyOperations.js +0 -205
  59. package/lib/CallbackQueue.js +0 -106
  60. package/lib/ChangeEventPlugin.js +0 -325
  61. package/lib/DOMChildrenOperations.js +0 -194
  62. package/lib/DOMLazyTree.js +0 -118
  63. package/lib/DOMProperty.js +0 -206
  64. package/lib/DOMPropertyOperations.js +0 -221
  65. package/lib/Danger.js +0 -48
  66. package/lib/DefaultEventPluginOrder.js +0 -27
  67. package/lib/DisabledInputUtils.js +0 -50
  68. package/lib/EnterLeaveEventPlugin.js +0 -105
  69. package/lib/EventConstants.js +0 -97
  70. package/lib/EventPluginHub.js +0 -251
  71. package/lib/EventPluginRegistry.js +0 -247
  72. package/lib/EventPluginUtils.js +0 -229
  73. package/lib/EventPropagators.js +0 -137
  74. package/lib/FallbackCompositionState.js +0 -95
  75. package/lib/HTMLDOMPropertyConfig.js +0 -212
  76. package/lib/LinkedValueUtils.js +0 -136
  77. package/lib/NativeMethodsMixin.js +0 -167
  78. package/lib/ReactBrowserEventEmitter.js +0 -330
  79. package/lib/ReactChildReconciler.js +0 -154
  80. package/lib/ReactChildrenMutationWarningHook.js +0 -54
  81. package/lib/ReactComponentBrowserEnvironment.js +0 -30
  82. package/lib/ReactComponentEnvironment.js +0 -45
  83. package/lib/ReactComponentTreeTestUtils.js +0 -87
  84. package/lib/ReactCompositeComponent.js +0 -904
  85. package/lib/ReactDOM.js +0 -110
  86. package/lib/ReactDOMButton.js +0 -24
  87. package/lib/ReactDOMComponent.js +0 -1006
  88. package/lib/ReactDOMComponentTree.js +0 -188
  89. package/lib/ReactDOMContainerInfo.js +0 -33
  90. package/lib/ReactDOMEmptyComponent.js +0 -60
  91. package/lib/ReactDOMFiber.js +0 -76
  92. package/lib/ReactDOMIDOperations.js +0 -34
  93. package/lib/ReactDOMInput.js +0 -269
  94. package/lib/ReactDOMNullInputValuePropHook.js +0 -43
  95. package/lib/ReactDOMOption.js +0 -123
  96. package/lib/ReactDOMSelect.js +0 -201
  97. package/lib/ReactDOMSelection.js +0 -212
  98. package/lib/ReactDOMServer.js +0 -26
  99. package/lib/ReactDOMTextComponent.js +0 -164
  100. package/lib/ReactDOMTextarea.js +0 -155
  101. package/lib/ReactDOMTreeTraversal.js +0 -136
  102. package/lib/ReactDOMUnknownPropertyHook.js +0 -112
  103. package/lib/ReactDebugTool.js +0 -301
  104. package/lib/ReactDefaultBatchingStrategy.js +0 -68
  105. package/lib/ReactDefaultInjection.js +0 -84
  106. package/lib/ReactEmptyComponent.js +0 -30
  107. package/lib/ReactErrorUtils.js +0 -76
  108. package/lib/ReactEventEmitterMixin.js +0 -33
  109. package/lib/ReactEventListener.js +0 -157
  110. package/lib/ReactFeatureFlags.js +0 -22
  111. package/lib/ReactHostComponent.js +0 -76
  112. package/lib/ReactHostOperationHistoryHook.js +0 -37
  113. package/lib/ReactInjection.js +0 -36
  114. package/lib/ReactInputSelection.js +0 -124
  115. package/lib/ReactInstanceHandles.js +0 -302
  116. package/lib/ReactInstanceMap.js +0 -48
  117. package/lib/ReactInstrumentation.js +0 -21
  118. package/lib/ReactInvalidSetStateWarningHook.js +0 -36
  119. package/lib/ReactMarkupChecksum.js +0 -50
  120. package/lib/ReactMount.js +0 -534
  121. package/lib/ReactMultiChild.js +0 -451
  122. package/lib/ReactMultiChildUpdateTypes.js +0 -32
  123. package/lib/ReactNative.js +0 -71
  124. package/lib/ReactNativeAttributePayload.js +0 -371
  125. package/lib/ReactNativeBaseComponent.js +0 -198
  126. package/lib/ReactNativeBridgeEventPlugin.js +0 -60
  127. package/lib/ReactNativeComponentEnvironment.js +0 -31
  128. package/lib/ReactNativeComponentTree.js +0 -68
  129. package/lib/ReactNativeContainerInfo.js +0 -21
  130. package/lib/ReactNativeDOMIDOperations.js +0 -79
  131. package/lib/ReactNativeDefaultInjection.js +0 -101
  132. package/lib/ReactNativeEventEmitter.js +0 -191
  133. package/lib/ReactNativeEventPluginOrder.js +0 -16
  134. package/lib/ReactNativeGlobalResponderHandler.js +0 -25
  135. package/lib/ReactNativeMount.js +0 -193
  136. package/lib/ReactNativePropRegistry.js +0 -52
  137. package/lib/ReactNativeReconcileTransaction.js +0 -129
  138. package/lib/ReactNativeTagHandles.js +0 -56
  139. package/lib/ReactNativeTextComponent.js +0 -71
  140. package/lib/ReactNativeTreeTraversal.js +0 -127
  141. package/lib/ReactNodeTypes.js +0 -40
  142. package/lib/ReactNoop.js +0 -173
  143. package/lib/ReactOwner.js +0 -94
  144. package/lib/ReactPerf.js +0 -494
  145. package/lib/ReactReconcileTransaction.js +0 -178
  146. package/lib/ReactReconciler.js +0 -168
  147. package/lib/ReactRef.js +0 -80
  148. package/lib/ReactServerBatchingStrategy.js +0 -22
  149. package/lib/ReactServerRendering.js +0 -90
  150. package/lib/ReactServerRenderingTransaction.js +0 -90
  151. package/lib/ReactServerUpdateQueue.js +0 -141
  152. package/lib/ReactSimpleEmptyComponent.js +0 -37
  153. package/lib/ReactTestMount.js +0 -126
  154. package/lib/ReactTestReconcileTransaction.js +0 -121
  155. package/lib/ReactTestRenderer.js +0 -144
  156. package/lib/ReactTestUtils.js +0 -518
  157. package/lib/ReactUpdateQueue.js +0 -226
  158. package/lib/ReactUpdates.js +0 -251
  159. package/lib/ResponderEventPlugin.js +0 -510
  160. package/lib/ResponderSyntheticEvent.js +0 -39
  161. package/lib/ResponderTouchHistoryStore.js +0 -184
  162. package/lib/SVGDOMPropertyConfig.js +0 -302
  163. package/lib/SelectEventPlugin.js +0 -196
  164. package/lib/SimpleEventPlugin.js +0 -635
  165. package/lib/SyntheticAnimationEvent.js +0 -39
  166. package/lib/SyntheticClipboardEvent.js +0 -38
  167. package/lib/SyntheticCompositionEvent.js +0 -36
  168. package/lib/SyntheticDragEvent.js +0 -36
  169. package/lib/SyntheticEvent.js +0 -268
  170. package/lib/SyntheticFocusEvent.js +0 -36
  171. package/lib/SyntheticInputEvent.js +0 -37
  172. package/lib/SyntheticKeyboardEvent.js +0 -84
  173. package/lib/SyntheticMouseEvent.js +0 -72
  174. package/lib/SyntheticTouchEvent.js +0 -45
  175. package/lib/SyntheticTransitionEvent.js +0 -39
  176. package/lib/SyntheticUIEvent.js +0 -59
  177. package/lib/SyntheticWheelEvent.js +0 -54
  178. package/lib/TapEventPlugin.js +0 -110
  179. package/lib/TouchHistoryMath.js +0 -99
  180. package/lib/Transaction.js +0 -233
  181. package/lib/ViewportMetrics.js +0 -27
  182. package/lib/accumulate.js +0 -46
  183. package/lib/accumulateInto.js +0 -58
  184. package/lib/adler32.js +0 -44
  185. package/lib/createMicrosoftUnsafeLocalFunction.js +0 -32
  186. package/lib/createReactNativeComponentClass.js +0 -42
  187. package/lib/dangerousStyleValue.js +0 -79
  188. package/lib/escapeTextContentForBrowser.js +0 -123
  189. package/lib/findDOMNode.js +0 -60
  190. package/lib/findNodeHandle.js +0 -91
  191. package/lib/forEachAccumulated.js +0 -31
  192. package/lib/getEventCharCode.js +0 -50
  193. package/lib/getEventKey.js +0 -102
  194. package/lib/getEventModifierState.js +0 -43
  195. package/lib/getEventTarget.js +0 -35
  196. package/lib/getHostComponentFromComposite.js +0 -30
  197. package/lib/getNodeForCharacterOffset.js +0 -74
  198. package/lib/getTestDocument.js +0 -21
  199. package/lib/getTextContentAccessor.js +0 -33
  200. package/lib/getVendorPrefixedEventName.js +0 -101
  201. package/lib/instantiateReactComponent.js +0 -119
  202. package/lib/isEventSupported.js +0 -60
  203. package/lib/isTextInputElement.js +0 -51
  204. package/lib/quoteAttributeValueForBrowser.js +0 -26
  205. package/lib/reactComponentExpect.js +0 -217
  206. package/lib/setInnerHTML.js +0 -98
  207. package/lib/setTextContent.js +0 -48
  208. package/lib/shouldUpdateReactComponent.js +0 -42
  209. package/lib/validateDOMNesting.js +0 -382
@@ -1,167 +0,0 @@
1
- /**
2
- * Copyright (c) 2015-present, Facebook, Inc.
3
- * All rights reserved.
4
- *
5
- * This source code is licensed under the BSD-style license found in the
6
- * LICENSE file in the root directory of this source tree. An additional grant
7
- * of patent rights can be found in the PATENTS file in the same directory.
8
- *
9
- * @providesModule NativeMethodsMixin
10
- *
11
- */
12
- 'use strict';
13
-
14
- var _prodInvariant = require('./reactProdInvariant');
15
-
16
- var ReactNativeAttributePayload = require('./ReactNativeAttributePayload');
17
- var TextInputState = require('react-native/lib/TextInputState');
18
- var UIManager = require('react-native/lib/UIManager');
19
-
20
- var findNodeHandle = require('./findNodeHandle');
21
- var invariant = require('fbjs/lib/invariant');
22
-
23
- function warnForStyleProps(props, validAttributes) {
24
- for (var key in validAttributes.style) {
25
- if (!(validAttributes[key] || props[key] === undefined)) {
26
- console.error('You are setting the style `{ ' + key + ': ... }` as a prop. You ' + 'should nest it in a style object. ' + 'E.g. `{ style: { ' + key + ': ... } }`');
27
- }
28
- }
29
- }
30
-
31
- /**
32
- * `NativeMethodsMixin` provides methods to access the underlying native
33
- * component directly. This can be useful in cases when you want to focus
34
- * a view or measure its on-screen dimensions, for example.
35
- *
36
- * The methods described here are available on most of the default components
37
- * provided by React Native. Note, however, that they are *not* available on
38
- * composite components that aren't directly backed by a native view. This will
39
- * generally include most components that you define in your own app. For more
40
- * information, see [Direct
41
- * Manipulation](docs/direct-manipulation.html).
42
- */
43
- var NativeMethodsMixin = {
44
- /**
45
- * Determines the location on screen, width, and height of the given view and
46
- * returns the values via an async callback. If successful, the callback will
47
- * be called with the following arguments:
48
- *
49
- * - x
50
- * - y
51
- * - width
52
- * - height
53
- * - pageX
54
- * - pageY
55
- *
56
- * Note that these measurements are not available until after the rendering
57
- * has been completed in native. If you need the measurements as soon as
58
- * possible, consider using the [`onLayout`
59
- * prop](docs/view.html#onlayout) instead.
60
- */
61
- measure: function (callback) {
62
- UIManager.measure(findNodeHandle(this), mountSafeCallback(this, callback));
63
- },
64
-
65
- /**
66
- * Determines the location of the given view in the window and returns the
67
- * values via an async callback. If the React root view is embedded in
68
- * another native view, this will give you the absolute coordinates. If
69
- * successful, the callback will be called with the following
70
- * arguments:
71
- *
72
- * - x
73
- * - y
74
- * - width
75
- * - height
76
- *
77
- * Note that these measurements are not available until after the rendering
78
- * has been completed in native.
79
- */
80
- measureInWindow: function (callback) {
81
- UIManager.measureInWindow(findNodeHandle(this), mountSafeCallback(this, callback));
82
- },
83
-
84
- /**
85
- * Like [`measure()`](#measure), but measures the view relative an ancestor,
86
- * specified as `relativeToNativeNode`. This means that the returned x, y
87
- * are relative to the origin x, y of the ancestor view.
88
- *
89
- * As always, to obtain a native node handle for a component, you can use
90
- * `React.findNodeHandle(component)`.
91
- */
92
- measureLayout: function (relativeToNativeNode, onSuccess, onFail /* currently unused */
93
- ) {
94
- UIManager.measureLayout(findNodeHandle(this), relativeToNativeNode, mountSafeCallback(this, onFail), mountSafeCallback(this, onSuccess));
95
- },
96
-
97
- /**
98
- * This function sends props straight to native. They will not participate in
99
- * future diff process - this means that if you do not include them in the
100
- * next render, they will remain active (see [Direct
101
- * Manipulation](docs/direct-manipulation.html)).
102
- */
103
- setNativeProps: function (nativeProps) {
104
- if (process.env.NODE_ENV !== 'production') {
105
- warnForStyleProps(nativeProps, this.viewConfig.validAttributes);
106
- }
107
-
108
- var updatePayload = ReactNativeAttributePayload.create(nativeProps, this.viewConfig.validAttributes);
109
-
110
- UIManager.updateView(findNodeHandle(this), this.viewConfig.uiViewClassName, updatePayload);
111
- },
112
-
113
- /**
114
- * Requests focus for the given input or view. The exact behavior triggered
115
- * will depend on the platform and type of view.
116
- */
117
- focus: function () {
118
- TextInputState.focusTextInput(findNodeHandle(this));
119
- },
120
-
121
- /**
122
- * Removes focus from an input or view. This is the opposite of `focus()`.
123
- */
124
- blur: function () {
125
- TextInputState.blurTextInput(findNodeHandle(this));
126
- }
127
- };
128
-
129
- function throwOnStylesProp(component, props) {
130
- if (props.styles !== undefined) {
131
- var owner = component._owner || null;
132
- var name = component.constructor.displayName;
133
- var msg = '`styles` is not a supported property of `' + name + '`, did ' + 'you mean `style` (singular)?';
134
- if (owner && owner.constructor && owner.constructor.displayName) {
135
- msg += '\n\nCheck the `' + owner.constructor.displayName + '` parent ' + ' component.';
136
- }
137
- throw new Error(msg);
138
- }
139
- }
140
- if (process.env.NODE_ENV !== 'production') {
141
- // hide this from Flow since we can't define these properties outside of
142
- // __DEV__ without actually implementing them (setting them to undefined
143
- // isn't allowed by ReactClass)
144
- var NativeMethodsMixin_DEV = NativeMethodsMixin;
145
- !(!NativeMethodsMixin_DEV.componentWillMount && !NativeMethodsMixin_DEV.componentWillReceiveProps) ? process.env.NODE_ENV !== 'production' ? invariant(false, 'Do not override existing functions.') : _prodInvariant('16') : void 0;
146
- NativeMethodsMixin_DEV.componentWillMount = function () {
147
- throwOnStylesProp(this, this.props);
148
- };
149
- NativeMethodsMixin_DEV.componentWillReceiveProps = function (newProps) {
150
- throwOnStylesProp(this, newProps);
151
- };
152
- }
153
-
154
- /**
155
- * In the future, we should cleanup callbacks by cancelling them instead of
156
- * using this.
157
- */
158
- function mountSafeCallback(context, callback) {
159
- return function () {
160
- if (!callback || context.isMounted && !context.isMounted()) {
161
- return undefined;
162
- }
163
- return callback.apply(context, arguments);
164
- };
165
- }
166
-
167
- module.exports = NativeMethodsMixin;
@@ -1,330 +0,0 @@
1
- /**
2
- * Copyright 2013-present, Facebook, Inc.
3
- * All rights reserved.
4
- *
5
- * This source code is licensed under the BSD-style license found in the
6
- * LICENSE file in the root directory of this source tree. An additional grant
7
- * of patent rights can be found in the PATENTS file in the same directory.
8
- *
9
- * @providesModule ReactBrowserEventEmitter
10
- */
11
-
12
- 'use strict';
13
-
14
- var _assign = require('object-assign');
15
-
16
- var EventConstants = require('./EventConstants');
17
- var EventPluginRegistry = require('./EventPluginRegistry');
18
- var ReactEventEmitterMixin = require('./ReactEventEmitterMixin');
19
- var ViewportMetrics = require('./ViewportMetrics');
20
-
21
- var getVendorPrefixedEventName = require('./getVendorPrefixedEventName');
22
- var isEventSupported = require('./isEventSupported');
23
-
24
- /**
25
- * Summary of `ReactBrowserEventEmitter` event handling:
26
- *
27
- * - Top-level delegation is used to trap most native browser events. This
28
- * may only occur in the main thread and is the responsibility of
29
- * ReactEventListener, which is injected and can therefore support pluggable
30
- * event sources. This is the only work that occurs in the main thread.
31
- *
32
- * - We normalize and de-duplicate events to account for browser quirks. This
33
- * may be done in the worker thread.
34
- *
35
- * - Forward these native events (with the associated top-level type used to
36
- * trap it) to `EventPluginHub`, which in turn will ask plugins if they want
37
- * to extract any synthetic events.
38
- *
39
- * - The `EventPluginHub` will then process each event by annotating them with
40
- * "dispatches", a sequence of listeners and IDs that care about that event.
41
- *
42
- * - The `EventPluginHub` then dispatches the events.
43
- *
44
- * Overview of React and the event system:
45
- *
46
- * +------------+ .
47
- * | DOM | .
48
- * +------------+ .
49
- * | .
50
- * v .
51
- * +------------+ .
52
- * | ReactEvent | .
53
- * | Listener | .
54
- * +------------+ . +-----------+
55
- * | . +--------+|SimpleEvent|
56
- * | . | |Plugin |
57
- * +-----|------+ . v +-----------+
58
- * | | | . +--------------+ +------------+
59
- * | +-----------.--->|EventPluginHub| | Event |
60
- * | | . | | +-----------+ | Propagators|
61
- * | ReactEvent | . | | |TapEvent | |------------|
62
- * | Emitter | . | |<---+|Plugin | |other plugin|
63
- * | | . | | +-----------+ | utilities |
64
- * | +-----------.--->| | +------------+
65
- * | | | . +--------------+
66
- * +-----|------+ . ^ +-----------+
67
- * | . | |Enter/Leave|
68
- * + . +-------+|Plugin |
69
- * +-------------+ . +-----------+
70
- * | application | .
71
- * |-------------| .
72
- * | | .
73
- * | | .
74
- * +-------------+ .
75
- * .
76
- * React Core . General Purpose Event Plugin System
77
- */
78
-
79
- var hasEventPageXY;
80
- var alreadyListeningTo = {};
81
- var isMonitoringScrollValue = false;
82
- var reactTopListenersCounter = 0;
83
-
84
- // For events like 'submit' which don't consistently bubble (which we trap at a
85
- // lower node than `document`), binding at `document` would cause duplicate
86
- // events so we don't include them here
87
- var topEventMapping = {
88
- topAbort: 'abort',
89
- topAnimationEnd: getVendorPrefixedEventName('animationend') || 'animationend',
90
- topAnimationIteration: getVendorPrefixedEventName('animationiteration') || 'animationiteration',
91
- topAnimationStart: getVendorPrefixedEventName('animationstart') || 'animationstart',
92
- topBlur: 'blur',
93
- topCanPlay: 'canplay',
94
- topCanPlayThrough: 'canplaythrough',
95
- topChange: 'change',
96
- topClick: 'click',
97
- topCompositionEnd: 'compositionend',
98
- topCompositionStart: 'compositionstart',
99
- topCompositionUpdate: 'compositionupdate',
100
- topContextMenu: 'contextmenu',
101
- topCopy: 'copy',
102
- topCut: 'cut',
103
- topDoubleClick: 'dblclick',
104
- topDrag: 'drag',
105
- topDragEnd: 'dragend',
106
- topDragEnter: 'dragenter',
107
- topDragExit: 'dragexit',
108
- topDragLeave: 'dragleave',
109
- topDragOver: 'dragover',
110
- topDragStart: 'dragstart',
111
- topDrop: 'drop',
112
- topDurationChange: 'durationchange',
113
- topEmptied: 'emptied',
114
- topEncrypted: 'encrypted',
115
- topEnded: 'ended',
116
- topError: 'error',
117
- topFocus: 'focus',
118
- topInput: 'input',
119
- topKeyDown: 'keydown',
120
- topKeyPress: 'keypress',
121
- topKeyUp: 'keyup',
122
- topLoadedData: 'loadeddata',
123
- topLoadedMetadata: 'loadedmetadata',
124
- topLoadStart: 'loadstart',
125
- topMouseDown: 'mousedown',
126
- topMouseMove: 'mousemove',
127
- topMouseOut: 'mouseout',
128
- topMouseOver: 'mouseover',
129
- topMouseUp: 'mouseup',
130
- topPaste: 'paste',
131
- topPause: 'pause',
132
- topPlay: 'play',
133
- topPlaying: 'playing',
134
- topProgress: 'progress',
135
- topRateChange: 'ratechange',
136
- topScroll: 'scroll',
137
- topSeeked: 'seeked',
138
- topSeeking: 'seeking',
139
- topSelectionChange: 'selectionchange',
140
- topStalled: 'stalled',
141
- topSuspend: 'suspend',
142
- topTextInput: 'textInput',
143
- topTimeUpdate: 'timeupdate',
144
- topTouchCancel: 'touchcancel',
145
- topTouchEnd: 'touchend',
146
- topTouchMove: 'touchmove',
147
- topTouchStart: 'touchstart',
148
- topTransitionEnd: getVendorPrefixedEventName('transitionend') || 'transitionend',
149
- topVolumeChange: 'volumechange',
150
- topWaiting: 'waiting',
151
- topWheel: 'wheel'
152
- };
153
-
154
- /**
155
- * To ensure no conflicts with other potential React instances on the page
156
- */
157
- var topListenersIDKey = '_reactListenersID' + String(Math.random()).slice(2);
158
-
159
- function getListeningForDocument(mountAt) {
160
- // In IE8, `mountAt` is a host object and doesn't have `hasOwnProperty`
161
- // directly.
162
- if (!Object.prototype.hasOwnProperty.call(mountAt, topListenersIDKey)) {
163
- mountAt[topListenersIDKey] = reactTopListenersCounter++;
164
- alreadyListeningTo[mountAt[topListenersIDKey]] = {};
165
- }
166
- return alreadyListeningTo[mountAt[topListenersIDKey]];
167
- }
168
-
169
- /**
170
- * `ReactBrowserEventEmitter` is used to attach top-level event listeners. For
171
- * example:
172
- *
173
- * EventPluginHub.putListener('myID', 'onClick', myFunction);
174
- *
175
- * This would allocate a "registration" of `('onClick', myFunction)` on 'myID'.
176
- *
177
- * @internal
178
- */
179
- var ReactBrowserEventEmitter = _assign({}, ReactEventEmitterMixin, {
180
-
181
- /**
182
- * Injectable event backend
183
- */
184
- ReactEventListener: null,
185
-
186
- injection: {
187
- /**
188
- * @param {object} ReactEventListener
189
- */
190
- injectReactEventListener: function (ReactEventListener) {
191
- ReactEventListener.setHandleTopLevel(ReactBrowserEventEmitter.handleTopLevel);
192
- ReactBrowserEventEmitter.ReactEventListener = ReactEventListener;
193
- }
194
- },
195
-
196
- /**
197
- * Sets whether or not any created callbacks should be enabled.
198
- *
199
- * @param {boolean} enabled True if callbacks should be enabled.
200
- */
201
- setEnabled: function (enabled) {
202
- if (ReactBrowserEventEmitter.ReactEventListener) {
203
- ReactBrowserEventEmitter.ReactEventListener.setEnabled(enabled);
204
- }
205
- },
206
-
207
- /**
208
- * @return {boolean} True if callbacks are enabled.
209
- */
210
- isEnabled: function () {
211
- return !!(ReactBrowserEventEmitter.ReactEventListener && ReactBrowserEventEmitter.ReactEventListener.isEnabled());
212
- },
213
-
214
- /**
215
- * We listen for bubbled touch events on the document object.
216
- *
217
- * Firefox v8.01 (and possibly others) exhibited strange behavior when
218
- * mounting `onmousemove` events at some node that was not the document
219
- * element. The symptoms were that if your mouse is not moving over something
220
- * contained within that mount point (for example on the background) the
221
- * top-level listeners for `onmousemove` won't be called. However, if you
222
- * register the `mousemove` on the document object, then it will of course
223
- * catch all `mousemove`s. This along with iOS quirks, justifies restricting
224
- * top-level listeners to the document object only, at least for these
225
- * movement types of events and possibly all events.
226
- *
227
- * @see http://www.quirksmode.org/blog/archives/2010/09/click_event_del.html
228
- *
229
- * Also, `keyup`/`keypress`/`keydown` do not bubble to the window on IE, but
230
- * they bubble to document.
231
- *
232
- * @param {string} registrationName Name of listener (e.g. `onClick`).
233
- * @param {object} contentDocumentHandle Document which owns the container
234
- */
235
- listenTo: function (registrationName, contentDocumentHandle) {
236
- var mountAt = contentDocumentHandle;
237
- var isListening = getListeningForDocument(mountAt);
238
- var dependencies = EventPluginRegistry.registrationNameDependencies[registrationName];
239
-
240
- var topLevelTypes = EventConstants.topLevelTypes;
241
- for (var i = 0; i < dependencies.length; i++) {
242
- var dependency = dependencies[i];
243
- if (!(isListening.hasOwnProperty(dependency) && isListening[dependency])) {
244
- if (dependency === topLevelTypes.topWheel) {
245
- if (isEventSupported('wheel')) {
246
- ReactBrowserEventEmitter.ReactEventListener.trapBubbledEvent(topLevelTypes.topWheel, 'wheel', mountAt);
247
- } else if (isEventSupported('mousewheel')) {
248
- ReactBrowserEventEmitter.ReactEventListener.trapBubbledEvent(topLevelTypes.topWheel, 'mousewheel', mountAt);
249
- } else {
250
- // Firefox needs to capture a different mouse scroll event.
251
- // @see http://www.quirksmode.org/dom/events/tests/scroll.html
252
- ReactBrowserEventEmitter.ReactEventListener.trapBubbledEvent(topLevelTypes.topWheel, 'DOMMouseScroll', mountAt);
253
- }
254
- } else if (dependency === topLevelTypes.topScroll) {
255
-
256
- if (isEventSupported('scroll', true)) {
257
- ReactBrowserEventEmitter.ReactEventListener.trapCapturedEvent(topLevelTypes.topScroll, 'scroll', mountAt);
258
- } else {
259
- ReactBrowserEventEmitter.ReactEventListener.trapBubbledEvent(topLevelTypes.topScroll, 'scroll', ReactBrowserEventEmitter.ReactEventListener.WINDOW_HANDLE);
260
- }
261
- } else if (dependency === topLevelTypes.topFocus || dependency === topLevelTypes.topBlur) {
262
-
263
- if (isEventSupported('focus', true)) {
264
- ReactBrowserEventEmitter.ReactEventListener.trapCapturedEvent(topLevelTypes.topFocus, 'focus', mountAt);
265
- ReactBrowserEventEmitter.ReactEventListener.trapCapturedEvent(topLevelTypes.topBlur, 'blur', mountAt);
266
- } else if (isEventSupported('focusin')) {
267
- // IE has `focusin` and `focusout` events which bubble.
268
- // @see http://www.quirksmode.org/blog/archives/2008/04/delegating_the.html
269
- ReactBrowserEventEmitter.ReactEventListener.trapBubbledEvent(topLevelTypes.topFocus, 'focusin', mountAt);
270
- ReactBrowserEventEmitter.ReactEventListener.trapBubbledEvent(topLevelTypes.topBlur, 'focusout', mountAt);
271
- }
272
-
273
- // to make sure blur and focus event listeners are only attached once
274
- isListening[topLevelTypes.topBlur] = true;
275
- isListening[topLevelTypes.topFocus] = true;
276
- } else if (topEventMapping.hasOwnProperty(dependency)) {
277
- ReactBrowserEventEmitter.ReactEventListener.trapBubbledEvent(dependency, topEventMapping[dependency], mountAt);
278
- }
279
-
280
- isListening[dependency] = true;
281
- }
282
- }
283
- },
284
-
285
- trapBubbledEvent: function (topLevelType, handlerBaseName, handle) {
286
- return ReactBrowserEventEmitter.ReactEventListener.trapBubbledEvent(topLevelType, handlerBaseName, handle);
287
- },
288
-
289
- trapCapturedEvent: function (topLevelType, handlerBaseName, handle) {
290
- return ReactBrowserEventEmitter.ReactEventListener.trapCapturedEvent(topLevelType, handlerBaseName, handle);
291
- },
292
-
293
- /**
294
- * Protect against document.createEvent() returning null
295
- * Some popup blocker extensions appear to do this:
296
- * https://github.com/facebook/react/issues/6887
297
- */
298
- supportsEventPageXY: function () {
299
- if (!document.createEvent) {
300
- return false;
301
- }
302
- var ev = document.createEvent('MouseEvent');
303
- return ev != null && 'pageX' in ev;
304
- },
305
-
306
- /**
307
- * Listens to window scroll and resize events. We cache scroll values so that
308
- * application code can access them without triggering reflows.
309
- *
310
- * ViewportMetrics is only used by SyntheticMouse/TouchEvent and only when
311
- * pageX/pageY isn't supported (legacy browsers).
312
- *
313
- * NOTE: Scroll events do not bubble.
314
- *
315
- * @see http://www.quirksmode.org/dom/events/scroll.html
316
- */
317
- ensureScrollValueMonitoring: function () {
318
- if (hasEventPageXY === undefined) {
319
- hasEventPageXY = ReactBrowserEventEmitter.supportsEventPageXY();
320
- }
321
- if (!hasEventPageXY && !isMonitoringScrollValue) {
322
- var refresh = ViewportMetrics.refreshScrollValues;
323
- ReactBrowserEventEmitter.ReactEventListener.monitorScrollValue(refresh);
324
- isMonitoringScrollValue = true;
325
- }
326
- }
327
-
328
- });
329
-
330
- module.exports = ReactBrowserEventEmitter;