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,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;