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,84 +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 ReactDefaultInjection
10
- */
11
-
12
- 'use strict';
13
-
14
- var BeforeInputEventPlugin = require('./BeforeInputEventPlugin');
15
- var ChangeEventPlugin = require('./ChangeEventPlugin');
16
- var DefaultEventPluginOrder = require('./DefaultEventPluginOrder');
17
- var EnterLeaveEventPlugin = require('./EnterLeaveEventPlugin');
18
- var HTMLDOMPropertyConfig = require('./HTMLDOMPropertyConfig');
19
- var ReactComponentBrowserEnvironment = require('./ReactComponentBrowserEnvironment');
20
- var ReactDOMComponent = require('./ReactDOMComponent');
21
- var ReactDOMComponentTree = require('./ReactDOMComponentTree');
22
- var ReactDOMEmptyComponent = require('./ReactDOMEmptyComponent');
23
- var ReactDOMTreeTraversal = require('./ReactDOMTreeTraversal');
24
- var ReactDOMTextComponent = require('./ReactDOMTextComponent');
25
- var ReactDefaultBatchingStrategy = require('./ReactDefaultBatchingStrategy');
26
- var ReactEventListener = require('./ReactEventListener');
27
- var ReactInjection = require('./ReactInjection');
28
- var ReactReconcileTransaction = require('./ReactReconcileTransaction');
29
- var SVGDOMPropertyConfig = require('./SVGDOMPropertyConfig');
30
- var SelectEventPlugin = require('./SelectEventPlugin');
31
- var SimpleEventPlugin = require('./SimpleEventPlugin');
32
-
33
- var alreadyInjected = false;
34
-
35
- function inject() {
36
- if (alreadyInjected) {
37
- // TODO: This is currently true because these injections are shared between
38
- // the client and the server package. They should be built independently
39
- // and not share any injection state. Then this problem will be solved.
40
- return;
41
- }
42
- alreadyInjected = true;
43
-
44
- ReactInjection.EventEmitter.injectReactEventListener(ReactEventListener);
45
-
46
- /**
47
- * Inject modules for resolving DOM hierarchy and plugin ordering.
48
- */
49
- ReactInjection.EventPluginHub.injectEventPluginOrder(DefaultEventPluginOrder);
50
- ReactInjection.EventPluginUtils.injectComponentTree(ReactDOMComponentTree);
51
- ReactInjection.EventPluginUtils.injectTreeTraversal(ReactDOMTreeTraversal);
52
-
53
- /**
54
- * Some important event plugins included by default (without having to require
55
- * them).
56
- */
57
- ReactInjection.EventPluginHub.injectEventPluginsByName({
58
- SimpleEventPlugin: SimpleEventPlugin,
59
- EnterLeaveEventPlugin: EnterLeaveEventPlugin,
60
- ChangeEventPlugin: ChangeEventPlugin,
61
- SelectEventPlugin: SelectEventPlugin,
62
- BeforeInputEventPlugin: BeforeInputEventPlugin
63
- });
64
-
65
- ReactInjection.HostComponent.injectGenericComponentClass(ReactDOMComponent);
66
-
67
- ReactInjection.HostComponent.injectTextComponentClass(ReactDOMTextComponent);
68
-
69
- ReactInjection.DOMProperty.injectDOMPropertyConfig(HTMLDOMPropertyConfig);
70
- ReactInjection.DOMProperty.injectDOMPropertyConfig(SVGDOMPropertyConfig);
71
-
72
- ReactInjection.EmptyComponent.injectEmptyComponentFactory(function (instantiate) {
73
- return new ReactDOMEmptyComponent(instantiate);
74
- });
75
-
76
- ReactInjection.Updates.injectReconcileTransaction(ReactReconcileTransaction);
77
- ReactInjection.Updates.injectBatchingStrategy(ReactDefaultBatchingStrategy);
78
-
79
- ReactInjection.Component.injectEnvironment(ReactComponentBrowserEnvironment);
80
- }
81
-
82
- module.exports = {
83
- inject: inject
84
- };
@@ -1,30 +0,0 @@
1
- /**
2
- * Copyright 2014-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 ReactEmptyComponent
10
- */
11
-
12
- 'use strict';
13
-
14
- var emptyComponentFactory;
15
-
16
- var ReactEmptyComponentInjection = {
17
- injectEmptyComponentFactory: function (factory) {
18
- emptyComponentFactory = factory;
19
- }
20
- };
21
-
22
- var ReactEmptyComponent = {
23
- create: function (instantiate) {
24
- return emptyComponentFactory(instantiate);
25
- }
26
- };
27
-
28
- ReactEmptyComponent.injection = ReactEmptyComponentInjection;
29
-
30
- module.exports = ReactEmptyComponent;
@@ -1,76 +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 ReactErrorUtils
10
- */
11
-
12
- 'use strict';
13
-
14
- var caughtError = null;
15
-
16
- /**
17
- * Call a function while guarding against errors that happens within it.
18
- *
19
- * @param {?String} name of the guard to use for logging or debugging
20
- * @param {Function} func The function to invoke
21
- * @param {*} a First argument
22
- * @param {*} b Second argument
23
- */
24
- function invokeGuardedCallback(name, func, a, b) {
25
- try {
26
- return func(a, b);
27
- } catch (x) {
28
- if (caughtError === null) {
29
- caughtError = x;
30
- }
31
- return undefined;
32
- }
33
- }
34
-
35
- var ReactErrorUtils = {
36
- invokeGuardedCallback: invokeGuardedCallback,
37
-
38
- /**
39
- * Invoked by ReactTestUtils.Simulate so that any errors thrown by the event
40
- * handler are sure to be rethrown by rethrowCaughtError.
41
- */
42
- invokeGuardedCallbackWithCatch: invokeGuardedCallback,
43
-
44
- /**
45
- * During execution of guarded functions we will capture the first error which
46
- * we will rethrow to be handled by the top level error handler.
47
- */
48
- rethrowCaughtError: function () {
49
- if (caughtError) {
50
- var error = caughtError;
51
- caughtError = null;
52
- throw error;
53
- }
54
- }
55
- };
56
-
57
- if (process.env.NODE_ENV !== 'production') {
58
- /**
59
- * To help development we can get better devtools integration by simulating a
60
- * real browser event.
61
- */
62
- if (typeof window !== 'undefined' && typeof window.dispatchEvent === 'function' && typeof document !== 'undefined' && typeof document.createEvent === 'function') {
63
- var fakeNode = document.createElement('react');
64
- ReactErrorUtils.invokeGuardedCallback = function (name, func, a, b) {
65
- var boundFunc = func.bind(null, a, b);
66
- var evtType = 'react-' + name;
67
- fakeNode.addEventListener(evtType, boundFunc, false);
68
- var evt = document.createEvent('Event');
69
- evt.initEvent(evtType, false, false);
70
- fakeNode.dispatchEvent(evt);
71
- fakeNode.removeEventListener(evtType, boundFunc, false);
72
- };
73
- }
74
- }
75
-
76
- module.exports = ReactErrorUtils;
@@ -1,33 +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 ReactEventEmitterMixin
10
- */
11
-
12
- 'use strict';
13
-
14
- var EventPluginHub = require('./EventPluginHub');
15
-
16
- function runEventQueueInBatch(events) {
17
- EventPluginHub.enqueueEvents(events);
18
- EventPluginHub.processEventQueue(false);
19
- }
20
-
21
- var ReactEventEmitterMixin = {
22
-
23
- /**
24
- * Streams a fired top-level event to `EventPluginHub` where plugins have the
25
- * opportunity to create `ReactEvent`s to be dispatched.
26
- */
27
- handleTopLevel: function (topLevelType, targetInst, nativeEvent, nativeEventTarget) {
28
- var events = EventPluginHub.extractEvents(topLevelType, targetInst, nativeEvent, nativeEventTarget);
29
- runEventQueueInBatch(events);
30
- }
31
- };
32
-
33
- module.exports = ReactEventEmitterMixin;
@@ -1,157 +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 ReactEventListener
10
- */
11
-
12
- 'use strict';
13
-
14
- var _assign = require('object-assign');
15
-
16
- var EventListener = require('fbjs/lib/EventListener');
17
- var ExecutionEnvironment = require('fbjs/lib/ExecutionEnvironment');
18
- var PooledClass = require('./PooledClass');
19
- var ReactDOMComponentTree = require('./ReactDOMComponentTree');
20
- var ReactUpdates = require('./ReactUpdates');
21
-
22
- var getEventTarget = require('./getEventTarget');
23
- var getUnboundedScrollPosition = require('fbjs/lib/getUnboundedScrollPosition');
24
-
25
- /**
26
- * Find the deepest React component completely containing the root of the
27
- * passed-in instance (for use when entire React trees are nested within each
28
- * other). If React trees are not nested, returns null.
29
- */
30
- function findParent(inst) {
31
- // TODO: It may be a good idea to cache this to prevent unnecessary DOM
32
- // traversal, but caching is difficult to do correctly without using a
33
- // mutation observer to listen for all DOM changes.
34
- while (inst._hostParent) {
35
- inst = inst._hostParent;
36
- }
37
- var rootNode = ReactDOMComponentTree.getNodeFromInstance(inst);
38
- var container = rootNode.parentNode;
39
- return ReactDOMComponentTree.getClosestInstanceFromNode(container);
40
- }
41
-
42
- // Used to store ancestor hierarchy in top level callback
43
- function TopLevelCallbackBookKeeping(topLevelType, nativeEvent) {
44
- this.topLevelType = topLevelType;
45
- this.nativeEvent = nativeEvent;
46
- this.ancestors = [];
47
- }
48
- _assign(TopLevelCallbackBookKeeping.prototype, {
49
- destructor: function () {
50
- this.topLevelType = null;
51
- this.nativeEvent = null;
52
- this.ancestors.length = 0;
53
- }
54
- });
55
- PooledClass.addPoolingTo(TopLevelCallbackBookKeeping, PooledClass.twoArgumentPooler);
56
-
57
- function handleTopLevelImpl(bookKeeping) {
58
- var nativeEventTarget = getEventTarget(bookKeeping.nativeEvent);
59
- var targetInst = ReactDOMComponentTree.getClosestInstanceFromNode(nativeEventTarget);
60
-
61
- // Loop through the hierarchy, in case there's any nested components.
62
- // It's important that we build the array of ancestors before calling any
63
- // event handlers, because event handlers can modify the DOM, leading to
64
- // inconsistencies with ReactMount's node cache. See #1105.
65
- var ancestor = targetInst;
66
- do {
67
- bookKeeping.ancestors.push(ancestor);
68
- ancestor = ancestor && findParent(ancestor);
69
- } while (ancestor);
70
-
71
- for (var i = 0; i < bookKeeping.ancestors.length; i++) {
72
- targetInst = bookKeeping.ancestors[i];
73
- ReactEventListener._handleTopLevel(bookKeeping.topLevelType, targetInst, bookKeeping.nativeEvent, getEventTarget(bookKeeping.nativeEvent));
74
- }
75
- }
76
-
77
- function scrollValueMonitor(cb) {
78
- var scrollPosition = getUnboundedScrollPosition(window);
79
- cb(scrollPosition);
80
- }
81
-
82
- var ReactEventListener = {
83
- _enabled: true,
84
- _handleTopLevel: null,
85
-
86
- WINDOW_HANDLE: ExecutionEnvironment.canUseDOM ? window : null,
87
-
88
- setHandleTopLevel: function (handleTopLevel) {
89
- ReactEventListener._handleTopLevel = handleTopLevel;
90
- },
91
-
92
- setEnabled: function (enabled) {
93
- ReactEventListener._enabled = !!enabled;
94
- },
95
-
96
- isEnabled: function () {
97
- return ReactEventListener._enabled;
98
- },
99
-
100
- /**
101
- * Traps top-level events by using event bubbling.
102
- *
103
- * @param {string} topLevelType Record from `EventConstants`.
104
- * @param {string} handlerBaseName Event name (e.g. "click").
105
- * @param {object} handle Element on which to attach listener.
106
- * @return {?object} An object with a remove function which will forcefully
107
- * remove the listener.
108
- * @internal
109
- */
110
- trapBubbledEvent: function (topLevelType, handlerBaseName, handle) {
111
- var element = handle;
112
- if (!element) {
113
- return null;
114
- }
115
- return EventListener.listen(element, handlerBaseName, ReactEventListener.dispatchEvent.bind(null, topLevelType));
116
- },
117
-
118
- /**
119
- * Traps a top-level event by using event capturing.
120
- *
121
- * @param {string} topLevelType Record from `EventConstants`.
122
- * @param {string} handlerBaseName Event name (e.g. "click").
123
- * @param {object} handle Element on which to attach listener.
124
- * @return {?object} An object with a remove function which will forcefully
125
- * remove the listener.
126
- * @internal
127
- */
128
- trapCapturedEvent: function (topLevelType, handlerBaseName, handle) {
129
- var element = handle;
130
- if (!element) {
131
- return null;
132
- }
133
- return EventListener.capture(element, handlerBaseName, ReactEventListener.dispatchEvent.bind(null, topLevelType));
134
- },
135
-
136
- monitorScrollValue: function (refresh) {
137
- var callback = scrollValueMonitor.bind(null, refresh);
138
- EventListener.listen(window, 'scroll', callback);
139
- },
140
-
141
- dispatchEvent: function (topLevelType, nativeEvent) {
142
- if (!ReactEventListener._enabled) {
143
- return;
144
- }
145
-
146
- var bookKeeping = TopLevelCallbackBookKeeping.getPooled(topLevelType, nativeEvent);
147
- try {
148
- // Event queue being processed in the same cycle allows
149
- // `preventDefault`.
150
- ReactUpdates.batchedUpdates(handleTopLevelImpl, bookKeeping);
151
- } finally {
152
- TopLevelCallbackBookKeeping.release(bookKeeping);
153
- }
154
- }
155
- };
156
-
157
- module.exports = ReactEventListener;
@@ -1,22 +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 ReactFeatureFlags
10
- *
11
- */
12
-
13
- 'use strict';
14
-
15
- var ReactFeatureFlags = {
16
- // When true, call console.time() before and .timeEnd() after each top-level
17
- // render (both initial renders and updates). Useful when looking at prod-mode
18
- // timeline profiles in Chrome, for example.
19
- logTopLevelRenders: false
20
- };
21
-
22
- module.exports = ReactFeatureFlags;
@@ -1,76 +0,0 @@
1
- /**
2
- * Copyright 2014-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 ReactHostComponent
10
- */
11
-
12
- 'use strict';
13
-
14
- var _prodInvariant = require('./reactProdInvariant'),
15
- _assign = require('object-assign');
16
-
17
- var invariant = require('fbjs/lib/invariant');
18
-
19
- var genericComponentClass = null;
20
- // This registry keeps track of wrapper classes around host tags.
21
- var tagToComponentClass = {};
22
- var textComponentClass = null;
23
-
24
- var ReactHostComponentInjection = {
25
- // This accepts a class that receives the tag string. This is a catch all
26
- // that can render any kind of tag.
27
- injectGenericComponentClass: function (componentClass) {
28
- genericComponentClass = componentClass;
29
- },
30
- // This accepts a text component class that takes the text string to be
31
- // rendered as props.
32
- injectTextComponentClass: function (componentClass) {
33
- textComponentClass = componentClass;
34
- },
35
- // This accepts a keyed object with classes as values. Each key represents a
36
- // tag. That particular tag will use this class instead of the generic one.
37
- injectComponentClasses: function (componentClasses) {
38
- _assign(tagToComponentClass, componentClasses);
39
- }
40
- };
41
-
42
- /**
43
- * Get a host internal component class for a specific tag.
44
- *
45
- * @param {ReactElement} element The element to create.
46
- * @return {function} The internal class constructor function.
47
- */
48
- function createInternalComponent(element) {
49
- !genericComponentClass ? process.env.NODE_ENV !== 'production' ? invariant(false, 'There is no registered component for the tag %s', element.type) : _prodInvariant('111', element.type) : void 0;
50
- return new genericComponentClass(element);
51
- }
52
-
53
- /**
54
- * @param {ReactText} text
55
- * @return {ReactComponent}
56
- */
57
- function createInstanceForText(text) {
58
- return new textComponentClass(text);
59
- }
60
-
61
- /**
62
- * @param {ReactComponent} component
63
- * @return {boolean}
64
- */
65
- function isTextComponent(component) {
66
- return component instanceof textComponentClass;
67
- }
68
-
69
- var ReactHostComponent = {
70
- createInternalComponent: createInternalComponent,
71
- createInstanceForText: createInstanceForText,
72
- isTextComponent: isTextComponent,
73
- injection: ReactHostComponentInjection
74
- };
75
-
76
- module.exports = ReactHostComponent;