react 15.3.1-rc.2 → 15.4.0-rc.1

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 (190) hide show
  1. package/dist/react-with-addons.js +3961 -21387
  2. package/dist/react-with-addons.min.js +3 -6
  3. package/dist/react.js +2701 -19464
  4. package/dist/react.min.js +2 -6
  5. package/lib/LinkedStateMixin.js +1 -2
  6. package/lib/PooledClass.js +3 -0
  7. package/lib/ReactAddonsDOMDependencies.js +36 -0
  8. package/lib/ReactAddonsDOMDependenciesUMDShim.js +32 -0
  9. package/lib/ReactCSSTransitionGroup.js +60 -42
  10. package/lib/ReactCSSTransitionGroupChild.js +2 -2
  11. package/lib/ReactClass.js +38 -53
  12. package/lib/ReactComponentTreeHook.js +84 -100
  13. package/lib/{DOMNamespaces.js → ReactComponentTreeHookUMDShim.js} +5 -7
  14. package/lib/ReactCurrentOwner.js +1 -1
  15. package/lib/{renderSubtreeIntoContainer.js → ReactCurrentOwnerUMDShim.js} +6 -4
  16. package/lib/ReactElement.js +6 -29
  17. package/lib/ReactElementSymbol.js +20 -0
  18. package/lib/{ReactDOMComponentFlags.js → ReactElementType.js} +4 -9
  19. package/lib/ReactElementValidator.js +1 -2
  20. package/lib/ReactPropTypeLocationNames.js +1 -0
  21. package/lib/ReactPropTypeLocations.js +2 -11
  22. package/lib/ReactPropTypes.js +30 -13
  23. package/lib/ReactPropTypesSecret.js +1 -0
  24. package/lib/ReactTransitionEvents.js +1 -1
  25. package/lib/ReactTransitionGroup.js +145 -141
  26. package/lib/ReactUMDEntry.js +11 -5
  27. package/lib/{ReactDOMFeatureFlags.js → ReactUMDShim.js} +4 -6
  28. package/lib/ReactVersion.js +1 -1
  29. package/lib/ReactWithAddons.js +15 -2
  30. package/lib/ReactWithAddonsUMDEntry.js +11 -5
  31. package/lib/canDefineProperty.js +2 -0
  32. package/lib/onlyChild.js +1 -1
  33. package/lib/traverseAllChildren.js +11 -2
  34. package/lib/update.js +6 -7
  35. package/package.json +2 -2
  36. package/lib/AutoFocusUtils.js +0 -24
  37. package/lib/BeforeInputEventPlugin.js +0 -388
  38. package/lib/CSSProperty.js +0 -148
  39. package/lib/CSSPropertyOperations.js +0 -205
  40. package/lib/CallbackQueue.js +0 -106
  41. package/lib/ChangeEventPlugin.js +0 -325
  42. package/lib/DOMChildrenOperations.js +0 -194
  43. package/lib/DOMLazyTree.js +0 -118
  44. package/lib/DOMProperty.js +0 -206
  45. package/lib/DOMPropertyOperations.js +0 -221
  46. package/lib/Danger.js +0 -48
  47. package/lib/DefaultEventPluginOrder.js +0 -27
  48. package/lib/DisabledInputUtils.js +0 -50
  49. package/lib/EnterLeaveEventPlugin.js +0 -105
  50. package/lib/EventConstants.js +0 -97
  51. package/lib/EventPluginHub.js +0 -251
  52. package/lib/EventPluginRegistry.js +0 -247
  53. package/lib/EventPluginUtils.js +0 -229
  54. package/lib/EventPropagators.js +0 -137
  55. package/lib/FallbackCompositionState.js +0 -95
  56. package/lib/HTMLDOMPropertyConfig.js +0 -209
  57. package/lib/LinkedValueUtils.js +0 -136
  58. package/lib/NativeMethodsMixin.js +0 -167
  59. package/lib/ReactBrowserEventEmitter.js +0 -317
  60. package/lib/ReactChildReconciler.js +0 -154
  61. package/lib/ReactChildrenMutationWarningHook.js +0 -54
  62. package/lib/ReactComponentBrowserEnvironment.js +0 -30
  63. package/lib/ReactComponentEnvironment.js +0 -45
  64. package/lib/ReactComponentTreeTestUtils.js +0 -87
  65. package/lib/ReactCompositeComponent.js +0 -920
  66. package/lib/ReactDOM.js +0 -110
  67. package/lib/ReactDOMButton.js +0 -24
  68. package/lib/ReactDOMComponent.js +0 -1005
  69. package/lib/ReactDOMComponentTree.js +0 -188
  70. package/lib/ReactDOMContainerInfo.js +0 -33
  71. package/lib/ReactDOMEmptyComponent.js +0 -60
  72. package/lib/ReactDOMFiber.js +0 -78
  73. package/lib/ReactDOMIDOperations.js +0 -34
  74. package/lib/ReactDOMInput.js +0 -269
  75. package/lib/ReactDOMNullInputValuePropHook.js +0 -43
  76. package/lib/ReactDOMOption.js +0 -123
  77. package/lib/ReactDOMSelect.js +0 -201
  78. package/lib/ReactDOMSelection.js +0 -212
  79. package/lib/ReactDOMServer.js +0 -26
  80. package/lib/ReactDOMTextComponent.js +0 -164
  81. package/lib/ReactDOMTextarea.js +0 -155
  82. package/lib/ReactDOMTreeTraversal.js +0 -136
  83. package/lib/ReactDOMUnknownPropertyHook.js +0 -112
  84. package/lib/ReactDebugTool.js +0 -307
  85. package/lib/ReactDefaultBatchingStrategy.js +0 -68
  86. package/lib/ReactDefaultInjection.js +0 -84
  87. package/lib/ReactEmptyComponent.js +0 -30
  88. package/lib/ReactErrorUtils.js +0 -76
  89. package/lib/ReactEventEmitterMixin.js +0 -33
  90. package/lib/ReactEventListener.js +0 -157
  91. package/lib/ReactFeatureFlags.js +0 -22
  92. package/lib/ReactHostComponent.js +0 -76
  93. package/lib/ReactHostOperationHistoryHook.js +0 -37
  94. package/lib/ReactInjection.js +0 -36
  95. package/lib/ReactInputSelection.js +0 -124
  96. package/lib/ReactInstanceHandles.js +0 -302
  97. package/lib/ReactInstanceMap.js +0 -48
  98. package/lib/ReactInstrumentation.js +0 -21
  99. package/lib/ReactInvalidSetStateWarningHook.js +0 -36
  100. package/lib/ReactMarkupChecksum.js +0 -50
  101. package/lib/ReactMount.js +0 -495
  102. package/lib/ReactMultiChild.js +0 -451
  103. package/lib/ReactMultiChildUpdateTypes.js +0 -32
  104. package/lib/ReactNative.js +0 -71
  105. package/lib/ReactNativeAttributePayload.js +0 -371
  106. package/lib/ReactNativeBaseComponent.js +0 -198
  107. package/lib/ReactNativeBridgeEventPlugin.js +0 -60
  108. package/lib/ReactNativeComponentEnvironment.js +0 -31
  109. package/lib/ReactNativeComponentTree.js +0 -68
  110. package/lib/ReactNativeContainerInfo.js +0 -21
  111. package/lib/ReactNativeDOMIDOperations.js +0 -79
  112. package/lib/ReactNativeDefaultInjection.js +0 -101
  113. package/lib/ReactNativeEventEmitter.js +0 -191
  114. package/lib/ReactNativeEventPluginOrder.js +0 -16
  115. package/lib/ReactNativeGlobalResponderHandler.js +0 -25
  116. package/lib/ReactNativeMount.js +0 -193
  117. package/lib/ReactNativePropRegistry.js +0 -52
  118. package/lib/ReactNativeReconcileTransaction.js +0 -116
  119. package/lib/ReactNativeTagHandles.js +0 -56
  120. package/lib/ReactNativeTextComponent.js +0 -71
  121. package/lib/ReactNativeTreeTraversal.js +0 -127
  122. package/lib/ReactNodeTypes.js +0 -40
  123. package/lib/ReactNoop.js +0 -173
  124. package/lib/ReactOwner.js +0 -94
  125. package/lib/ReactPerf.js +0 -494
  126. package/lib/ReactReconcileTransaction.js +0 -178
  127. package/lib/ReactReconciler.js +0 -168
  128. package/lib/ReactRef.js +0 -80
  129. package/lib/ReactServerBatchingStrategy.js +0 -22
  130. package/lib/ReactServerRendering.js +0 -90
  131. package/lib/ReactServerRenderingTransaction.js +0 -90
  132. package/lib/ReactServerUpdateQueue.js +0 -141
  133. package/lib/ReactSimpleEmptyComponent.js +0 -37
  134. package/lib/ReactTestMount.js +0 -123
  135. package/lib/ReactTestReconcileTransaction.js +0 -108
  136. package/lib/ReactTestRenderer.js +0 -144
  137. package/lib/ReactTestUtils.js +0 -518
  138. package/lib/ReactUpdateQueue.js +0 -226
  139. package/lib/ReactUpdates.js +0 -251
  140. package/lib/ResponderEventPlugin.js +0 -510
  141. package/lib/ResponderSyntheticEvent.js +0 -39
  142. package/lib/ResponderTouchHistoryStore.js +0 -184
  143. package/lib/SVGDOMPropertyConfig.js +0 -302
  144. package/lib/SelectEventPlugin.js +0 -196
  145. package/lib/SimpleEventPlugin.js +0 -635
  146. package/lib/SyntheticAnimationEvent.js +0 -39
  147. package/lib/SyntheticClipboardEvent.js +0 -38
  148. package/lib/SyntheticCompositionEvent.js +0 -36
  149. package/lib/SyntheticDragEvent.js +0 -36
  150. package/lib/SyntheticEvent.js +0 -267
  151. package/lib/SyntheticFocusEvent.js +0 -36
  152. package/lib/SyntheticInputEvent.js +0 -37
  153. package/lib/SyntheticKeyboardEvent.js +0 -84
  154. package/lib/SyntheticMouseEvent.js +0 -72
  155. package/lib/SyntheticTouchEvent.js +0 -45
  156. package/lib/SyntheticTransitionEvent.js +0 -39
  157. package/lib/SyntheticUIEvent.js +0 -59
  158. package/lib/SyntheticWheelEvent.js +0 -54
  159. package/lib/TapEventPlugin.js +0 -110
  160. package/lib/TouchHistoryMath.js +0 -99
  161. package/lib/Transaction.js +0 -233
  162. package/lib/ViewportMetrics.js +0 -27
  163. package/lib/accumulate.js +0 -46
  164. package/lib/accumulateInto.js +0 -58
  165. package/lib/adler32.js +0 -44
  166. package/lib/createMicrosoftUnsafeLocalFunction.js +0 -32
  167. package/lib/createReactNativeComponentClass.js +0 -42
  168. package/lib/dangerousStyleValue.js +0 -79
  169. package/lib/escapeTextContentForBrowser.js +0 -122
  170. package/lib/findDOMNode.js +0 -60
  171. package/lib/findNodeHandle.js +0 -91
  172. package/lib/forEachAccumulated.js +0 -31
  173. package/lib/getEventCharCode.js +0 -50
  174. package/lib/getEventKey.js +0 -102
  175. package/lib/getEventModifierState.js +0 -43
  176. package/lib/getEventTarget.js +0 -35
  177. package/lib/getHostComponentFromComposite.js +0 -30
  178. package/lib/getNodeForCharacterOffset.js +0 -74
  179. package/lib/getTestDocument.js +0 -21
  180. package/lib/getTextContentAccessor.js +0 -33
  181. package/lib/getVendorPrefixedEventName.js +0 -101
  182. package/lib/instantiateReactComponent.js +0 -119
  183. package/lib/isEventSupported.js +0 -60
  184. package/lib/isTextInputElement.js +0 -51
  185. package/lib/quoteAttributeValueForBrowser.js +0 -26
  186. package/lib/reactComponentExpect.js +0 -217
  187. package/lib/setInnerHTML.js +0 -98
  188. package/lib/setTextContent.js +0 -48
  189. package/lib/shouldUpdateReactComponent.js +0 -42
  190. package/lib/validateDOMNesting.js +0 -369
@@ -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,317 +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
- * Listens to window scroll and resize events. We cache scroll values so that
295
- * application code can access them without triggering reflows.
296
- *
297
- * ViewportMetrics is only used by SyntheticMouse/TouchEvent and only when
298
- * pageX/pageY isn't supported (legacy browsers).
299
- *
300
- * NOTE: Scroll events do not bubble.
301
- *
302
- * @see http://www.quirksmode.org/dom/events/scroll.html
303
- */
304
- ensureScrollValueMonitoring: function () {
305
- if (hasEventPageXY === undefined) {
306
- hasEventPageXY = document.createEvent && 'pageX' in document.createEvent('MouseEvent');
307
- }
308
- if (!hasEventPageXY && !isMonitoringScrollValue) {
309
- var refresh = ViewportMetrics.refreshScrollValues;
310
- ReactBrowserEventEmitter.ReactEventListener.monitorScrollValue(refresh);
311
- isMonitoringScrollValue = true;
312
- }
313
- }
314
-
315
- });
316
-
317
- module.exports = ReactBrowserEventEmitter;