react 15.3.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 (189) hide show
  1. package/dist/react-with-addons.js +3898 -21383
  2. package/dist/react-with-addons.min.js +3 -6
  3. package/dist/react.js +2672 -19494
  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 -13
  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 +5 -2
  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/traverseAllChildren.js +11 -2
  33. package/lib/update.js +6 -7
  34. package/package.json +1 -1
  35. package/lib/AutoFocusUtils.js +0 -24
  36. package/lib/BeforeInputEventPlugin.js +0 -390
  37. package/lib/CSSProperty.js +0 -148
  38. package/lib/CSSPropertyOperations.js +0 -205
  39. package/lib/CallbackQueue.js +0 -106
  40. package/lib/ChangeEventPlugin.js +0 -325
  41. package/lib/DOMChildrenOperations.js +0 -194
  42. package/lib/DOMLazyTree.js +0 -118
  43. package/lib/DOMProperty.js +0 -206
  44. package/lib/DOMPropertyOperations.js +0 -221
  45. package/lib/Danger.js +0 -48
  46. package/lib/DefaultEventPluginOrder.js +0 -27
  47. package/lib/DisabledInputUtils.js +0 -50
  48. package/lib/EnterLeaveEventPlugin.js +0 -105
  49. package/lib/EventConstants.js +0 -97
  50. package/lib/EventPluginHub.js +0 -251
  51. package/lib/EventPluginRegistry.js +0 -247
  52. package/lib/EventPluginUtils.js +0 -229
  53. package/lib/EventPropagators.js +0 -137
  54. package/lib/FallbackCompositionState.js +0 -95
  55. package/lib/HTMLDOMPropertyConfig.js +0 -212
  56. package/lib/LinkedValueUtils.js +0 -136
  57. package/lib/NativeMethodsMixin.js +0 -167
  58. package/lib/ReactBrowserEventEmitter.js +0 -330
  59. package/lib/ReactChildReconciler.js +0 -154
  60. package/lib/ReactChildrenMutationWarningHook.js +0 -54
  61. package/lib/ReactComponentBrowserEnvironment.js +0 -30
  62. package/lib/ReactComponentEnvironment.js +0 -45
  63. package/lib/ReactComponentTreeTestUtils.js +0 -87
  64. package/lib/ReactCompositeComponent.js +0 -904
  65. package/lib/ReactDOM.js +0 -110
  66. package/lib/ReactDOMButton.js +0 -24
  67. package/lib/ReactDOMComponent.js +0 -1006
  68. package/lib/ReactDOMComponentTree.js +0 -188
  69. package/lib/ReactDOMContainerInfo.js +0 -33
  70. package/lib/ReactDOMEmptyComponent.js +0 -60
  71. package/lib/ReactDOMFiber.js +0 -76
  72. package/lib/ReactDOMIDOperations.js +0 -34
  73. package/lib/ReactDOMInput.js +0 -269
  74. package/lib/ReactDOMNullInputValuePropHook.js +0 -43
  75. package/lib/ReactDOMOption.js +0 -123
  76. package/lib/ReactDOMSelect.js +0 -201
  77. package/lib/ReactDOMSelection.js +0 -212
  78. package/lib/ReactDOMServer.js +0 -26
  79. package/lib/ReactDOMTextComponent.js +0 -164
  80. package/lib/ReactDOMTextarea.js +0 -155
  81. package/lib/ReactDOMTreeTraversal.js +0 -136
  82. package/lib/ReactDOMUnknownPropertyHook.js +0 -112
  83. package/lib/ReactDebugTool.js +0 -301
  84. package/lib/ReactDefaultBatchingStrategy.js +0 -68
  85. package/lib/ReactDefaultInjection.js +0 -84
  86. package/lib/ReactEmptyComponent.js +0 -30
  87. package/lib/ReactErrorUtils.js +0 -76
  88. package/lib/ReactEventEmitterMixin.js +0 -33
  89. package/lib/ReactEventListener.js +0 -157
  90. package/lib/ReactFeatureFlags.js +0 -22
  91. package/lib/ReactHostComponent.js +0 -76
  92. package/lib/ReactHostOperationHistoryHook.js +0 -37
  93. package/lib/ReactInjection.js +0 -36
  94. package/lib/ReactInputSelection.js +0 -124
  95. package/lib/ReactInstanceHandles.js +0 -302
  96. package/lib/ReactInstanceMap.js +0 -48
  97. package/lib/ReactInstrumentation.js +0 -21
  98. package/lib/ReactInvalidSetStateWarningHook.js +0 -36
  99. package/lib/ReactMarkupChecksum.js +0 -50
  100. package/lib/ReactMount.js +0 -534
  101. package/lib/ReactMultiChild.js +0 -451
  102. package/lib/ReactMultiChildUpdateTypes.js +0 -32
  103. package/lib/ReactNative.js +0 -71
  104. package/lib/ReactNativeAttributePayload.js +0 -371
  105. package/lib/ReactNativeBaseComponent.js +0 -198
  106. package/lib/ReactNativeBridgeEventPlugin.js +0 -60
  107. package/lib/ReactNativeComponentEnvironment.js +0 -31
  108. package/lib/ReactNativeComponentTree.js +0 -68
  109. package/lib/ReactNativeContainerInfo.js +0 -21
  110. package/lib/ReactNativeDOMIDOperations.js +0 -79
  111. package/lib/ReactNativeDefaultInjection.js +0 -101
  112. package/lib/ReactNativeEventEmitter.js +0 -191
  113. package/lib/ReactNativeEventPluginOrder.js +0 -16
  114. package/lib/ReactNativeGlobalResponderHandler.js +0 -25
  115. package/lib/ReactNativeMount.js +0 -193
  116. package/lib/ReactNativePropRegistry.js +0 -52
  117. package/lib/ReactNativeReconcileTransaction.js +0 -129
  118. package/lib/ReactNativeTagHandles.js +0 -56
  119. package/lib/ReactNativeTextComponent.js +0 -71
  120. package/lib/ReactNativeTreeTraversal.js +0 -127
  121. package/lib/ReactNodeTypes.js +0 -40
  122. package/lib/ReactNoop.js +0 -173
  123. package/lib/ReactOwner.js +0 -94
  124. package/lib/ReactPerf.js +0 -494
  125. package/lib/ReactReconcileTransaction.js +0 -178
  126. package/lib/ReactReconciler.js +0 -168
  127. package/lib/ReactRef.js +0 -80
  128. package/lib/ReactServerBatchingStrategy.js +0 -22
  129. package/lib/ReactServerRendering.js +0 -90
  130. package/lib/ReactServerRenderingTransaction.js +0 -90
  131. package/lib/ReactServerUpdateQueue.js +0 -141
  132. package/lib/ReactSimpleEmptyComponent.js +0 -37
  133. package/lib/ReactTestMount.js +0 -126
  134. package/lib/ReactTestReconcileTransaction.js +0 -121
  135. package/lib/ReactTestRenderer.js +0 -144
  136. package/lib/ReactTestUtils.js +0 -518
  137. package/lib/ReactUpdateQueue.js +0 -226
  138. package/lib/ReactUpdates.js +0 -251
  139. package/lib/ResponderEventPlugin.js +0 -510
  140. package/lib/ResponderSyntheticEvent.js +0 -39
  141. package/lib/ResponderTouchHistoryStore.js +0 -184
  142. package/lib/SVGDOMPropertyConfig.js +0 -302
  143. package/lib/SelectEventPlugin.js +0 -196
  144. package/lib/SimpleEventPlugin.js +0 -635
  145. package/lib/SyntheticAnimationEvent.js +0 -39
  146. package/lib/SyntheticClipboardEvent.js +0 -38
  147. package/lib/SyntheticCompositionEvent.js +0 -36
  148. package/lib/SyntheticDragEvent.js +0 -36
  149. package/lib/SyntheticEvent.js +0 -268
  150. package/lib/SyntheticFocusEvent.js +0 -36
  151. package/lib/SyntheticInputEvent.js +0 -37
  152. package/lib/SyntheticKeyboardEvent.js +0 -84
  153. package/lib/SyntheticMouseEvent.js +0 -72
  154. package/lib/SyntheticTouchEvent.js +0 -45
  155. package/lib/SyntheticTransitionEvent.js +0 -39
  156. package/lib/SyntheticUIEvent.js +0 -59
  157. package/lib/SyntheticWheelEvent.js +0 -54
  158. package/lib/TapEventPlugin.js +0 -110
  159. package/lib/TouchHistoryMath.js +0 -99
  160. package/lib/Transaction.js +0 -233
  161. package/lib/ViewportMetrics.js +0 -27
  162. package/lib/accumulate.js +0 -46
  163. package/lib/accumulateInto.js +0 -58
  164. package/lib/adler32.js +0 -44
  165. package/lib/createMicrosoftUnsafeLocalFunction.js +0 -32
  166. package/lib/createReactNativeComponentClass.js +0 -42
  167. package/lib/dangerousStyleValue.js +0 -79
  168. package/lib/escapeTextContentForBrowser.js +0 -123
  169. package/lib/findDOMNode.js +0 -60
  170. package/lib/findNodeHandle.js +0 -91
  171. package/lib/forEachAccumulated.js +0 -31
  172. package/lib/getEventCharCode.js +0 -50
  173. package/lib/getEventKey.js +0 -102
  174. package/lib/getEventModifierState.js +0 -43
  175. package/lib/getEventTarget.js +0 -35
  176. package/lib/getHostComponentFromComposite.js +0 -30
  177. package/lib/getNodeForCharacterOffset.js +0 -74
  178. package/lib/getTestDocument.js +0 -21
  179. package/lib/getTextContentAccessor.js +0 -33
  180. package/lib/getVendorPrefixedEventName.js +0 -101
  181. package/lib/instantiateReactComponent.js +0 -119
  182. package/lib/isEventSupported.js +0 -60
  183. package/lib/isTextInputElement.js +0 -51
  184. package/lib/quoteAttributeValueForBrowser.js +0 -26
  185. package/lib/reactComponentExpect.js +0 -217
  186. package/lib/setInnerHTML.js +0 -98
  187. package/lib/setTextContent.js +0 -48
  188. package/lib/shouldUpdateReactComponent.js +0 -42
  189. package/lib/validateDOMNesting.js +0 -382
package/lib/Danger.js DELETED
@@ -1,48 +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 Danger
10
- */
11
-
12
- 'use strict';
13
-
14
- var _prodInvariant = require('./reactProdInvariant');
15
-
16
- var DOMLazyTree = require('./DOMLazyTree');
17
- var ExecutionEnvironment = require('fbjs/lib/ExecutionEnvironment');
18
-
19
- var createNodesFromMarkup = require('fbjs/lib/createNodesFromMarkup');
20
- var emptyFunction = require('fbjs/lib/emptyFunction');
21
- var invariant = require('fbjs/lib/invariant');
22
-
23
- var Danger = {
24
-
25
- /**
26
- * Replaces a node with a string of markup at its current position within its
27
- * parent. The markup must render into a single root node.
28
- *
29
- * @param {DOMElement} oldChild Child node to replace.
30
- * @param {string} markup Markup to render in place of the child node.
31
- * @internal
32
- */
33
- dangerouslyReplaceNodeWithMarkup: function (oldChild, markup) {
34
- !ExecutionEnvironment.canUseDOM ? process.env.NODE_ENV !== 'production' ? invariant(false, 'dangerouslyReplaceNodeWithMarkup(...): Cannot render markup in a worker thread. Make sure `window` and `document` are available globally before requiring React when unit testing or use ReactDOMServer.renderToString() for server rendering.') : _prodInvariant('56') : void 0;
35
- !markup ? process.env.NODE_ENV !== 'production' ? invariant(false, 'dangerouslyReplaceNodeWithMarkup(...): Missing markup.') : _prodInvariant('57') : void 0;
36
- !(oldChild.nodeName !== 'HTML') ? process.env.NODE_ENV !== 'production' ? invariant(false, 'dangerouslyReplaceNodeWithMarkup(...): Cannot replace markup of the <html> node. This is because browser quirks make this unreliable and/or slow. If you want to render to the root you must use server rendering. See ReactDOMServer.renderToString().') : _prodInvariant('58') : void 0;
37
-
38
- if (typeof markup === 'string') {
39
- var newChild = createNodesFromMarkup(markup, emptyFunction)[0];
40
- oldChild.parentNode.replaceChild(newChild, oldChild);
41
- } else {
42
- DOMLazyTree.replaceChildWithTree(oldChild, markup);
43
- }
44
- }
45
-
46
- };
47
-
48
- module.exports = Danger;
@@ -1,27 +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 DefaultEventPluginOrder
10
- */
11
-
12
- 'use strict';
13
-
14
- var keyOf = require('fbjs/lib/keyOf');
15
-
16
- /**
17
- * Module that is injectable into `EventPluginHub`, that specifies a
18
- * deterministic ordering of `EventPlugin`s. A convenient way to reason about
19
- * plugins, without having to package every one of them. This is better than
20
- * having plugins be ordered in the same order that they are injected because
21
- * that ordering would be influenced by the packaging order.
22
- * `ResponderEventPlugin` must occur before `SimpleEventPlugin` so that
23
- * preventing default on events is convenient in `SimpleEventPlugin` handlers.
24
- */
25
- var DefaultEventPluginOrder = [keyOf({ ResponderEventPlugin: null }), keyOf({ SimpleEventPlugin: null }), keyOf({ TapEventPlugin: null }), keyOf({ EnterLeaveEventPlugin: null }), keyOf({ ChangeEventPlugin: null }), keyOf({ SelectEventPlugin: null }), keyOf({ BeforeInputEventPlugin: null })];
26
-
27
- module.exports = DefaultEventPluginOrder;
@@ -1,50 +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 DisabledInputUtils
10
- */
11
-
12
- 'use strict';
13
-
14
- var disableableMouseListenerNames = {
15
- onClick: true,
16
- onDoubleClick: true,
17
- onMouseDown: true,
18
- onMouseMove: true,
19
- onMouseUp: true,
20
-
21
- onClickCapture: true,
22
- onDoubleClickCapture: true,
23
- onMouseDownCapture: true,
24
- onMouseMoveCapture: true,
25
- onMouseUpCapture: true
26
- };
27
-
28
- /**
29
- * Implements a host component that does not receive mouse events
30
- * when `disabled` is set.
31
- */
32
- var DisabledInputUtils = {
33
- getHostProps: function (inst, props) {
34
- if (!props.disabled) {
35
- return props;
36
- }
37
-
38
- // Copy the props, except the mouse listeners
39
- var hostProps = {};
40
- for (var key in props) {
41
- if (!disableableMouseListenerNames[key] && props.hasOwnProperty(key)) {
42
- hostProps[key] = props[key];
43
- }
44
- }
45
-
46
- return hostProps;
47
- }
48
- };
49
-
50
- module.exports = DisabledInputUtils;
@@ -1,105 +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 EnterLeaveEventPlugin
10
- */
11
-
12
- 'use strict';
13
-
14
- var EventConstants = require('./EventConstants');
15
- var EventPropagators = require('./EventPropagators');
16
- var ReactDOMComponentTree = require('./ReactDOMComponentTree');
17
- var SyntheticMouseEvent = require('./SyntheticMouseEvent');
18
-
19
- var keyOf = require('fbjs/lib/keyOf');
20
-
21
- var topLevelTypes = EventConstants.topLevelTypes;
22
-
23
- var eventTypes = {
24
- mouseEnter: {
25
- registrationName: keyOf({ onMouseEnter: null }),
26
- dependencies: [topLevelTypes.topMouseOut, topLevelTypes.topMouseOver]
27
- },
28
- mouseLeave: {
29
- registrationName: keyOf({ onMouseLeave: null }),
30
- dependencies: [topLevelTypes.topMouseOut, topLevelTypes.topMouseOver]
31
- }
32
- };
33
-
34
- var EnterLeaveEventPlugin = {
35
-
36
- eventTypes: eventTypes,
37
-
38
- /**
39
- * For almost every interaction we care about, there will be both a top-level
40
- * `mouseover` and `mouseout` event that occurs. Only use `mouseout` so that
41
- * we do not extract duplicate events. However, moving the mouse into the
42
- * browser from outside will not fire a `mouseout` event. In this case, we use
43
- * the `mouseover` top-level event.
44
- */
45
- extractEvents: function (topLevelType, targetInst, nativeEvent, nativeEventTarget) {
46
- if (topLevelType === topLevelTypes.topMouseOver && (nativeEvent.relatedTarget || nativeEvent.fromElement)) {
47
- return null;
48
- }
49
- if (topLevelType !== topLevelTypes.topMouseOut && topLevelType !== topLevelTypes.topMouseOver) {
50
- // Must not be a mouse in or mouse out - ignoring.
51
- return null;
52
- }
53
-
54
- var win;
55
- if (nativeEventTarget.window === nativeEventTarget) {
56
- // `nativeEventTarget` is probably a window object.
57
- win = nativeEventTarget;
58
- } else {
59
- // TODO: Figure out why `ownerDocument` is sometimes undefined in IE8.
60
- var doc = nativeEventTarget.ownerDocument;
61
- if (doc) {
62
- win = doc.defaultView || doc.parentWindow;
63
- } else {
64
- win = window;
65
- }
66
- }
67
-
68
- var from;
69
- var to;
70
- if (topLevelType === topLevelTypes.topMouseOut) {
71
- from = targetInst;
72
- var related = nativeEvent.relatedTarget || nativeEvent.toElement;
73
- to = related ? ReactDOMComponentTree.getClosestInstanceFromNode(related) : null;
74
- } else {
75
- // Moving to a node from outside the window.
76
- from = null;
77
- to = targetInst;
78
- }
79
-
80
- if (from === to) {
81
- // Nothing pertains to our managed components.
82
- return null;
83
- }
84
-
85
- var fromNode = from == null ? win : ReactDOMComponentTree.getNodeFromInstance(from);
86
- var toNode = to == null ? win : ReactDOMComponentTree.getNodeFromInstance(to);
87
-
88
- var leave = SyntheticMouseEvent.getPooled(eventTypes.mouseLeave, from, nativeEvent, nativeEventTarget);
89
- leave.type = 'mouseleave';
90
- leave.target = fromNode;
91
- leave.relatedTarget = toNode;
92
-
93
- var enter = SyntheticMouseEvent.getPooled(eventTypes.mouseEnter, to, nativeEvent, nativeEventTarget);
94
- enter.type = 'mouseenter';
95
- enter.target = toNode;
96
- enter.relatedTarget = fromNode;
97
-
98
- EventPropagators.accumulateEnterLeaveDispatches(leave, enter, from, to);
99
-
100
- return [leave, enter];
101
- }
102
-
103
- };
104
-
105
- module.exports = EnterLeaveEventPlugin;
@@ -1,97 +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 EventConstants
10
- */
11
-
12
- 'use strict';
13
-
14
- var keyMirror = require('fbjs/lib/keyMirror');
15
-
16
- var PropagationPhases = keyMirror({ bubbled: null, captured: null });
17
-
18
- /**
19
- * Types of raw signals from the browser caught at the top level.
20
- */
21
- var topLevelTypes = keyMirror({
22
- topAbort: null,
23
- topAnimationEnd: null,
24
- topAnimationIteration: null,
25
- topAnimationStart: null,
26
- topBlur: null,
27
- topCanPlay: null,
28
- topCanPlayThrough: null,
29
- topChange: null,
30
- topClick: null,
31
- topCompositionEnd: null,
32
- topCompositionStart: null,
33
- topCompositionUpdate: null,
34
- topContextMenu: null,
35
- topCopy: null,
36
- topCut: null,
37
- topDoubleClick: null,
38
- topDrag: null,
39
- topDragEnd: null,
40
- topDragEnter: null,
41
- topDragExit: null,
42
- topDragLeave: null,
43
- topDragOver: null,
44
- topDragStart: null,
45
- topDrop: null,
46
- topDurationChange: null,
47
- topEmptied: null,
48
- topEncrypted: null,
49
- topEnded: null,
50
- topError: null,
51
- topFocus: null,
52
- topInput: null,
53
- topInvalid: null,
54
- topKeyDown: null,
55
- topKeyPress: null,
56
- topKeyUp: null,
57
- topLoad: null,
58
- topLoadedData: null,
59
- topLoadedMetadata: null,
60
- topLoadStart: null,
61
- topMouseDown: null,
62
- topMouseMove: null,
63
- topMouseOut: null,
64
- topMouseOver: null,
65
- topMouseUp: null,
66
- topPaste: null,
67
- topPause: null,
68
- topPlay: null,
69
- topPlaying: null,
70
- topProgress: null,
71
- topRateChange: null,
72
- topReset: null,
73
- topScroll: null,
74
- topSeeked: null,
75
- topSeeking: null,
76
- topSelectionChange: null,
77
- topStalled: null,
78
- topSubmit: null,
79
- topSuspend: null,
80
- topTextInput: null,
81
- topTimeUpdate: null,
82
- topTouchCancel: null,
83
- topTouchEnd: null,
84
- topTouchMove: null,
85
- topTouchStart: null,
86
- topTransitionEnd: null,
87
- topVolumeChange: null,
88
- topWaiting: null,
89
- topWheel: null
90
- });
91
-
92
- var EventConstants = {
93
- topLevelTypes: topLevelTypes,
94
- PropagationPhases: PropagationPhases
95
- };
96
-
97
- module.exports = EventConstants;
@@ -1,251 +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 EventPluginHub
10
- */
11
-
12
- 'use strict';
13
-
14
- var _prodInvariant = require('./reactProdInvariant');
15
-
16
- var EventPluginRegistry = require('./EventPluginRegistry');
17
- var EventPluginUtils = require('./EventPluginUtils');
18
- var ReactErrorUtils = require('./ReactErrorUtils');
19
-
20
- var accumulateInto = require('./accumulateInto');
21
- var forEachAccumulated = require('./forEachAccumulated');
22
- var invariant = require('fbjs/lib/invariant');
23
-
24
- /**
25
- * Internal store for event listeners
26
- */
27
- var listenerBank = {};
28
-
29
- /**
30
- * Internal queue of events that have accumulated their dispatches and are
31
- * waiting to have their dispatches executed.
32
- */
33
- var eventQueue = null;
34
-
35
- /**
36
- * Dispatches an event and releases it back into the pool, unless persistent.
37
- *
38
- * @param {?object} event Synthetic event to be dispatched.
39
- * @param {boolean} simulated If the event is simulated (changes exn behavior)
40
- * @private
41
- */
42
- var executeDispatchesAndRelease = function (event, simulated) {
43
- if (event) {
44
- EventPluginUtils.executeDispatchesInOrder(event, simulated);
45
-
46
- if (!event.isPersistent()) {
47
- event.constructor.release(event);
48
- }
49
- }
50
- };
51
- var executeDispatchesAndReleaseSimulated = function (e) {
52
- return executeDispatchesAndRelease(e, true);
53
- };
54
- var executeDispatchesAndReleaseTopLevel = function (e) {
55
- return executeDispatchesAndRelease(e, false);
56
- };
57
-
58
- var getDictionaryKey = function (inst) {
59
- // Prevents V8 performance issue:
60
- // https://github.com/facebook/react/pull/7232
61
- return '.' + inst._rootNodeID;
62
- };
63
-
64
- /**
65
- * This is a unified interface for event plugins to be installed and configured.
66
- *
67
- * Event plugins can implement the following properties:
68
- *
69
- * `extractEvents` {function(string, DOMEventTarget, string, object): *}
70
- * Required. When a top-level event is fired, this method is expected to
71
- * extract synthetic events that will in turn be queued and dispatched.
72
- *
73
- * `eventTypes` {object}
74
- * Optional, plugins that fire events must publish a mapping of registration
75
- * names that are used to register listeners. Values of this mapping must
76
- * be objects that contain `registrationName` or `phasedRegistrationNames`.
77
- *
78
- * `executeDispatch` {function(object, function, string)}
79
- * Optional, allows plugins to override how an event gets dispatched. By
80
- * default, the listener is simply invoked.
81
- *
82
- * Each plugin that is injected into `EventsPluginHub` is immediately operable.
83
- *
84
- * @public
85
- */
86
- var EventPluginHub = {
87
-
88
- /**
89
- * Methods for injecting dependencies.
90
- */
91
- injection: {
92
-
93
- /**
94
- * @param {array} InjectedEventPluginOrder
95
- * @public
96
- */
97
- injectEventPluginOrder: EventPluginRegistry.injectEventPluginOrder,
98
-
99
- /**
100
- * @param {object} injectedNamesToPlugins Map from names to plugin modules.
101
- */
102
- injectEventPluginsByName: EventPluginRegistry.injectEventPluginsByName
103
-
104
- },
105
-
106
- /**
107
- * Stores `listener` at `listenerBank[registrationName][key]`. Is idempotent.
108
- *
109
- * @param {object} inst The instance, which is the source of events.
110
- * @param {string} registrationName Name of listener (e.g. `onClick`).
111
- * @param {function} listener The callback to store.
112
- */
113
- putListener: function (inst, registrationName, listener) {
114
- !(typeof listener === 'function') ? process.env.NODE_ENV !== 'production' ? invariant(false, 'Expected %s listener to be a function, instead got type %s', registrationName, typeof listener) : _prodInvariant('94', registrationName, typeof listener) : void 0;
115
-
116
- var key = getDictionaryKey(inst);
117
- var bankForRegistrationName = listenerBank[registrationName] || (listenerBank[registrationName] = {});
118
- bankForRegistrationName[key] = listener;
119
-
120
- var PluginModule = EventPluginRegistry.registrationNameModules[registrationName];
121
- if (PluginModule && PluginModule.didPutListener) {
122
- PluginModule.didPutListener(inst, registrationName, listener);
123
- }
124
- },
125
-
126
- /**
127
- * @param {object} inst The instance, which is the source of events.
128
- * @param {string} registrationName Name of listener (e.g. `onClick`).
129
- * @return {?function} The stored callback.
130
- */
131
- getListener: function (inst, registrationName) {
132
- var bankForRegistrationName = listenerBank[registrationName];
133
- var key = getDictionaryKey(inst);
134
- return bankForRegistrationName && bankForRegistrationName[key];
135
- },
136
-
137
- /**
138
- * Deletes a listener from the registration bank.
139
- *
140
- * @param {object} inst The instance, which is the source of events.
141
- * @param {string} registrationName Name of listener (e.g. `onClick`).
142
- */
143
- deleteListener: function (inst, registrationName) {
144
- var PluginModule = EventPluginRegistry.registrationNameModules[registrationName];
145
- if (PluginModule && PluginModule.willDeleteListener) {
146
- PluginModule.willDeleteListener(inst, registrationName);
147
- }
148
-
149
- var bankForRegistrationName = listenerBank[registrationName];
150
- // TODO: This should never be null -- when is it?
151
- if (bankForRegistrationName) {
152
- var key = getDictionaryKey(inst);
153
- delete bankForRegistrationName[key];
154
- }
155
- },
156
-
157
- /**
158
- * Deletes all listeners for the DOM element with the supplied ID.
159
- *
160
- * @param {object} inst The instance, which is the source of events.
161
- */
162
- deleteAllListeners: function (inst) {
163
- var key = getDictionaryKey(inst);
164
- for (var registrationName in listenerBank) {
165
- if (!listenerBank.hasOwnProperty(registrationName)) {
166
- continue;
167
- }
168
-
169
- if (!listenerBank[registrationName][key]) {
170
- continue;
171
- }
172
-
173
- var PluginModule = EventPluginRegistry.registrationNameModules[registrationName];
174
- if (PluginModule && PluginModule.willDeleteListener) {
175
- PluginModule.willDeleteListener(inst, registrationName);
176
- }
177
-
178
- delete listenerBank[registrationName][key];
179
- }
180
- },
181
-
182
- /**
183
- * Allows registered plugins an opportunity to extract events from top-level
184
- * native browser events.
185
- *
186
- * @return {*} An accumulation of synthetic events.
187
- * @internal
188
- */
189
- extractEvents: function (topLevelType, targetInst, nativeEvent, nativeEventTarget) {
190
- var events;
191
- var plugins = EventPluginRegistry.plugins;
192
- for (var i = 0; i < plugins.length; i++) {
193
- // Not every plugin in the ordering may be loaded at runtime.
194
- var possiblePlugin = plugins[i];
195
- if (possiblePlugin) {
196
- var extractedEvents = possiblePlugin.extractEvents(topLevelType, targetInst, nativeEvent, nativeEventTarget);
197
- if (extractedEvents) {
198
- events = accumulateInto(events, extractedEvents);
199
- }
200
- }
201
- }
202
- return events;
203
- },
204
-
205
- /**
206
- * Enqueues a synthetic event that should be dispatched when
207
- * `processEventQueue` is invoked.
208
- *
209
- * @param {*} events An accumulation of synthetic events.
210
- * @internal
211
- */
212
- enqueueEvents: function (events) {
213
- if (events) {
214
- eventQueue = accumulateInto(eventQueue, events);
215
- }
216
- },
217
-
218
- /**
219
- * Dispatches all synthetic events on the event queue.
220
- *
221
- * @internal
222
- */
223
- processEventQueue: function (simulated) {
224
- // Set `eventQueue` to null before processing it so that we can tell if more
225
- // events get enqueued while processing.
226
- var processingEventQueue = eventQueue;
227
- eventQueue = null;
228
- if (simulated) {
229
- forEachAccumulated(processingEventQueue, executeDispatchesAndReleaseSimulated);
230
- } else {
231
- forEachAccumulated(processingEventQueue, executeDispatchesAndReleaseTopLevel);
232
- }
233
- !!eventQueue ? process.env.NODE_ENV !== 'production' ? invariant(false, 'processEventQueue(): Additional events were enqueued while processing an event queue. Support for this has not yet been implemented.') : _prodInvariant('95') : void 0;
234
- // This would be a good time to rethrow if any of the event handlers threw.
235
- ReactErrorUtils.rethrowCaughtError();
236
- },
237
-
238
- /**
239
- * These are needed for tests only. Do not use!
240
- */
241
- __purge: function () {
242
- listenerBank = {};
243
- },
244
-
245
- __getListenerBank: function () {
246
- return listenerBank;
247
- }
248
-
249
- };
250
-
251
- module.exports = EventPluginHub;