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,99 +0,0 @@
1
- /**
2
- * @providesModule TouchHistoryMath
3
- */
4
-
5
- 'use strict';
6
-
7
- var TouchHistoryMath = {
8
- /**
9
- * This code is optimized and not intended to look beautiful. This allows
10
- * computing of touch centroids that have moved after `touchesChangedAfter`
11
- * timeStamp. You can compute the current centroid involving all touches
12
- * moves after `touchesChangedAfter`, or you can compute the previous
13
- * centroid of all touches that were moved after `touchesChangedAfter`.
14
- *
15
- * @param {TouchHistoryMath} touchHistory Standard Responder touch track
16
- * data.
17
- * @param {number} touchesChangedAfter timeStamp after which moved touches
18
- * are considered "actively moving" - not just "active".
19
- * @param {boolean} isXAxis Consider `x` dimension vs. `y` dimension.
20
- * @param {boolean} ofCurrent Compute current centroid for actively moving
21
- * touches vs. previous centroid of now actively moving touches.
22
- * @return {number} value of centroid in specified dimension.
23
- */
24
- centroidDimension: function (touchHistory, touchesChangedAfter, isXAxis, ofCurrent) {
25
- var touchBank = touchHistory.touchBank;
26
- var total = 0;
27
- var count = 0;
28
-
29
- var oneTouchData = touchHistory.numberActiveTouches === 1 ? touchHistory.touchBank[touchHistory.indexOfSingleActiveTouch] : null;
30
-
31
- if (oneTouchData !== null) {
32
- if (oneTouchData.touchActive && oneTouchData.currentTimeStamp > touchesChangedAfter) {
33
- total += ofCurrent && isXAxis ? oneTouchData.currentPageX : ofCurrent && !isXAxis ? oneTouchData.currentPageY : !ofCurrent && isXAxis ? oneTouchData.previousPageX : oneTouchData.previousPageY;
34
- count = 1;
35
- }
36
- } else {
37
- for (var i = 0; i < touchBank.length; i++) {
38
- var touchTrack = touchBank[i];
39
- if (touchTrack !== null && touchTrack !== undefined && touchTrack.touchActive && touchTrack.currentTimeStamp >= touchesChangedAfter) {
40
- var toAdd; // Yuck, program temporarily in invalid state.
41
- if (ofCurrent && isXAxis) {
42
- toAdd = touchTrack.currentPageX;
43
- } else if (ofCurrent && !isXAxis) {
44
- toAdd = touchTrack.currentPageY;
45
- } else if (!ofCurrent && isXAxis) {
46
- toAdd = touchTrack.previousPageX;
47
- } else {
48
- toAdd = touchTrack.previousPageY;
49
- }
50
- total += toAdd;
51
- count++;
52
- }
53
- }
54
- }
55
- return count > 0 ? total / count : TouchHistoryMath.noCentroid;
56
- },
57
-
58
- currentCentroidXOfTouchesChangedAfter: function (touchHistory, touchesChangedAfter) {
59
- return TouchHistoryMath.centroidDimension(touchHistory, touchesChangedAfter, true, // isXAxis
60
- true // ofCurrent
61
- );
62
- },
63
-
64
- currentCentroidYOfTouchesChangedAfter: function (touchHistory, touchesChangedAfter) {
65
- return TouchHistoryMath.centroidDimension(touchHistory, touchesChangedAfter, false, // isXAxis
66
- true // ofCurrent
67
- );
68
- },
69
-
70
- previousCentroidXOfTouchesChangedAfter: function (touchHistory, touchesChangedAfter) {
71
- return TouchHistoryMath.centroidDimension(touchHistory, touchesChangedAfter, true, // isXAxis
72
- false // ofCurrent
73
- );
74
- },
75
-
76
- previousCentroidYOfTouchesChangedAfter: function (touchHistory, touchesChangedAfter) {
77
- return TouchHistoryMath.centroidDimension(touchHistory, touchesChangedAfter, false, // isXAxis
78
- false // ofCurrent
79
- );
80
- },
81
-
82
- currentCentroidX: function (touchHistory) {
83
- return TouchHistoryMath.centroidDimension(touchHistory, 0, // touchesChangedAfter
84
- true, // isXAxis
85
- true // ofCurrent
86
- );
87
- },
88
-
89
- currentCentroidY: function (touchHistory) {
90
- return TouchHistoryMath.centroidDimension(touchHistory, 0, // touchesChangedAfter
91
- false, // isXAxis
92
- true // ofCurrent
93
- );
94
- },
95
-
96
- noCentroid: -1
97
- };
98
-
99
- module.exports = TouchHistoryMath;
@@ -1,233 +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 Transaction
10
- */
11
-
12
- 'use strict';
13
-
14
- var _prodInvariant = require('./reactProdInvariant');
15
-
16
- var invariant = require('fbjs/lib/invariant');
17
-
18
- /**
19
- * `Transaction` creates a black box that is able to wrap any method such that
20
- * certain invariants are maintained before and after the method is invoked
21
- * (Even if an exception is thrown while invoking the wrapped method). Whoever
22
- * instantiates a transaction can provide enforcers of the invariants at
23
- * creation time. The `Transaction` class itself will supply one additional
24
- * automatic invariant for you - the invariant that any transaction instance
25
- * should not be run while it is already being run. You would typically create a
26
- * single instance of a `Transaction` for reuse multiple times, that potentially
27
- * is used to wrap several different methods. Wrappers are extremely simple -
28
- * they only require implementing two methods.
29
- *
30
- * <pre>
31
- * wrappers (injected at creation time)
32
- * + +
33
- * | |
34
- * +-----------------|--------|--------------+
35
- * | v | |
36
- * | +---------------+ | |
37
- * | +--| wrapper1 |---|----+ |
38
- * | | +---------------+ v | |
39
- * | | +-------------+ | |
40
- * | | +----| wrapper2 |--------+ |
41
- * | | | +-------------+ | | |
42
- * | | | | | |
43
- * | v v v v | wrapper
44
- * | +---+ +---+ +---------+ +---+ +---+ | invariants
45
- * perform(anyMethod) | | | | | | | | | | | | maintained
46
- * +----------------->|-|---|-|---|-->|anyMethod|---|---|-|---|-|-------->
47
- * | | | | | | | | | | | |
48
- * | | | | | | | | | | | |
49
- * | | | | | | | | | | | |
50
- * | +---+ +---+ +---------+ +---+ +---+ |
51
- * | initialize close |
52
- * +-----------------------------------------+
53
- * </pre>
54
- *
55
- * Use cases:
56
- * - Preserving the input selection ranges before/after reconciliation.
57
- * Restoring selection even in the event of an unexpected error.
58
- * - Deactivating events while rearranging the DOM, preventing blurs/focuses,
59
- * while guaranteeing that afterwards, the event system is reactivated.
60
- * - Flushing a queue of collected DOM mutations to the main UI thread after a
61
- * reconciliation takes place in a worker thread.
62
- * - Invoking any collected `componentDidUpdate` callbacks after rendering new
63
- * content.
64
- * - (Future use case): Wrapping particular flushes of the `ReactWorker` queue
65
- * to preserve the `scrollTop` (an automatic scroll aware DOM).
66
- * - (Future use case): Layout calculations before and after DOM updates.
67
- *
68
- * Transactional plugin API:
69
- * - A module that has an `initialize` method that returns any precomputation.
70
- * - and a `close` method that accepts the precomputation. `close` is invoked
71
- * when the wrapped process is completed, or has failed.
72
- *
73
- * @param {Array<TransactionalWrapper>} transactionWrapper Wrapper modules
74
- * that implement `initialize` and `close`.
75
- * @return {Transaction} Single transaction for reuse in thread.
76
- *
77
- * @class Transaction
78
- */
79
- var Mixin = {
80
- /**
81
- * Sets up this instance so that it is prepared for collecting metrics. Does
82
- * so such that this setup method may be used on an instance that is already
83
- * initialized, in a way that does not consume additional memory upon reuse.
84
- * That can be useful if you decide to make your subclass of this mixin a
85
- * "PooledClass".
86
- */
87
- reinitializeTransaction: function () {
88
- this.transactionWrappers = this.getTransactionWrappers();
89
- if (this.wrapperInitData) {
90
- this.wrapperInitData.length = 0;
91
- } else {
92
- this.wrapperInitData = [];
93
- }
94
- this._isInTransaction = false;
95
- },
96
-
97
- _isInTransaction: false,
98
-
99
- /**
100
- * @abstract
101
- * @return {Array<TransactionWrapper>} Array of transaction wrappers.
102
- */
103
- getTransactionWrappers: null,
104
-
105
- isInTransaction: function () {
106
- return !!this._isInTransaction;
107
- },
108
-
109
- /**
110
- * Executes the function within a safety window. Use this for the top level
111
- * methods that result in large amounts of computation/mutations that would
112
- * need to be safety checked. The optional arguments helps prevent the need
113
- * to bind in many cases.
114
- *
115
- * @param {function} method Member of scope to call.
116
- * @param {Object} scope Scope to invoke from.
117
- * @param {Object?=} a Argument to pass to the method.
118
- * @param {Object?=} b Argument to pass to the method.
119
- * @param {Object?=} c Argument to pass to the method.
120
- * @param {Object?=} d Argument to pass to the method.
121
- * @param {Object?=} e Argument to pass to the method.
122
- * @param {Object?=} f Argument to pass to the method.
123
- *
124
- * @return {*} Return value from `method`.
125
- */
126
- perform: function (method, scope, a, b, c, d, e, f) {
127
- !!this.isInTransaction() ? process.env.NODE_ENV !== 'production' ? invariant(false, 'Transaction.perform(...): Cannot initialize a transaction when there is already an outstanding transaction.') : _prodInvariant('27') : void 0;
128
- var errorThrown;
129
- var ret;
130
- try {
131
- this._isInTransaction = true;
132
- // Catching errors makes debugging more difficult, so we start with
133
- // errorThrown set to true before setting it to false after calling
134
- // close -- if it's still set to true in the finally block, it means
135
- // one of these calls threw.
136
- errorThrown = true;
137
- this.initializeAll(0);
138
- ret = method.call(scope, a, b, c, d, e, f);
139
- errorThrown = false;
140
- } finally {
141
- try {
142
- if (errorThrown) {
143
- // If `method` throws, prefer to show that stack trace over any thrown
144
- // by invoking `closeAll`.
145
- try {
146
- this.closeAll(0);
147
- } catch (err) {}
148
- } else {
149
- // Since `method` didn't throw, we don't want to silence the exception
150
- // here.
151
- this.closeAll(0);
152
- }
153
- } finally {
154
- this._isInTransaction = false;
155
- }
156
- }
157
- return ret;
158
- },
159
-
160
- initializeAll: function (startIndex) {
161
- var transactionWrappers = this.transactionWrappers;
162
- for (var i = startIndex; i < transactionWrappers.length; i++) {
163
- var wrapper = transactionWrappers[i];
164
- try {
165
- // Catching errors makes debugging more difficult, so we start with the
166
- // OBSERVED_ERROR state before overwriting it with the real return value
167
- // of initialize -- if it's still set to OBSERVED_ERROR in the finally
168
- // block, it means wrapper.initialize threw.
169
- this.wrapperInitData[i] = Transaction.OBSERVED_ERROR;
170
- this.wrapperInitData[i] = wrapper.initialize ? wrapper.initialize.call(this) : null;
171
- } finally {
172
- if (this.wrapperInitData[i] === Transaction.OBSERVED_ERROR) {
173
- // The initializer for wrapper i threw an error; initialize the
174
- // remaining wrappers but silence any exceptions from them to ensure
175
- // that the first error is the one to bubble up.
176
- try {
177
- this.initializeAll(i + 1);
178
- } catch (err) {}
179
- }
180
- }
181
- }
182
- },
183
-
184
- /**
185
- * Invokes each of `this.transactionWrappers.close[i]` functions, passing into
186
- * them the respective return values of `this.transactionWrappers.init[i]`
187
- * (`close`rs that correspond to initializers that failed will not be
188
- * invoked).
189
- */
190
- closeAll: function (startIndex) {
191
- !this.isInTransaction() ? process.env.NODE_ENV !== 'production' ? invariant(false, 'Transaction.closeAll(): Cannot close transaction when none are open.') : _prodInvariant('28') : void 0;
192
- var transactionWrappers = this.transactionWrappers;
193
- for (var i = startIndex; i < transactionWrappers.length; i++) {
194
- var wrapper = transactionWrappers[i];
195
- var initData = this.wrapperInitData[i];
196
- var errorThrown;
197
- try {
198
- // Catching errors makes debugging more difficult, so we start with
199
- // errorThrown set to true before setting it to false after calling
200
- // close -- if it's still set to true in the finally block, it means
201
- // wrapper.close threw.
202
- errorThrown = true;
203
- if (initData !== Transaction.OBSERVED_ERROR && wrapper.close) {
204
- wrapper.close.call(this, initData);
205
- }
206
- errorThrown = false;
207
- } finally {
208
- if (errorThrown) {
209
- // The closer for wrapper i threw an error; close the remaining
210
- // wrappers but silence any exceptions from them to ensure that the
211
- // first error is the one to bubble up.
212
- try {
213
- this.closeAll(i + 1);
214
- } catch (e) {}
215
- }
216
- }
217
- }
218
- this.wrapperInitData.length = 0;
219
- }
220
- };
221
-
222
- var Transaction = {
223
-
224
- Mixin: Mixin,
225
-
226
- /**
227
- * Token to look for to determine if an error occurred.
228
- */
229
- OBSERVED_ERROR: {}
230
-
231
- };
232
-
233
- module.exports = Transaction;
@@ -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 ViewportMetrics
10
- */
11
-
12
- 'use strict';
13
-
14
- var ViewportMetrics = {
15
-
16
- currentScrollLeft: 0,
17
-
18
- currentScrollTop: 0,
19
-
20
- refreshScrollValues: function (scrollPosition) {
21
- ViewportMetrics.currentScrollLeft = scrollPosition.x;
22
- ViewportMetrics.currentScrollTop = scrollPosition.y;
23
- }
24
-
25
- };
26
-
27
- module.exports = ViewportMetrics;
package/lib/accumulate.js DELETED
@@ -1,46 +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 accumulate
10
- *
11
- */
12
-
13
- 'use strict';
14
-
15
- var _prodInvariant = require('./reactProdInvariant');
16
-
17
- var invariant = require('fbjs/lib/invariant');
18
-
19
- /**
20
- * Accumulates items that must not be null or undefined.
21
- *
22
- * This is used to conserve memory by avoiding array allocations.
23
- *
24
- * @return {*|array<*>} An accumulation of items.
25
- */
26
- function accumulate(current, next) {
27
- !(next != null) ? process.env.NODE_ENV !== 'production' ? invariant(false, 'accumulate(...): Accumulated items must be not be null or undefined.') : _prodInvariant('29') : void 0;
28
-
29
- if (current == null) {
30
- return next;
31
- }
32
-
33
- // Both are not empty. Warning: Never call x.concat(y) when you are not
34
- // certain that x is an Array (x could be a string with concat method).
35
- if (Array.isArray(current)) {
36
- return current.concat(next);
37
- }
38
-
39
- if (Array.isArray(next)) {
40
- return [current].concat(next);
41
- }
42
-
43
- return [current, next];
44
- }
45
-
46
- module.exports = accumulate;
@@ -1,58 +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 accumulateInto
10
- *
11
- */
12
-
13
- 'use strict';
14
-
15
- var _prodInvariant = require('./reactProdInvariant');
16
-
17
- var invariant = require('fbjs/lib/invariant');
18
-
19
- /**
20
- * Accumulates items that must not be null or undefined into the first one. This
21
- * is used to conserve memory by avoiding array allocations, and thus sacrifices
22
- * API cleanness. Since `current` can be null before being passed in and not
23
- * null after this function, make sure to assign it back to `current`:
24
- *
25
- * `a = accumulateInto(a, b);`
26
- *
27
- * This API should be sparingly used. Try `accumulate` for something cleaner.
28
- *
29
- * @return {*|array<*>} An accumulation of items.
30
- */
31
-
32
- function accumulateInto(current, next) {
33
- !(next != null) ? process.env.NODE_ENV !== 'production' ? invariant(false, 'accumulateInto(...): Accumulated items must not be null or undefined.') : _prodInvariant('30') : void 0;
34
-
35
- if (current == null) {
36
- return next;
37
- }
38
-
39
- // Both are not empty. Warning: Never call x.concat(y) when you are not
40
- // certain that x is an Array (x could be a string with concat method).
41
- if (Array.isArray(current)) {
42
- if (Array.isArray(next)) {
43
- current.push.apply(current, next);
44
- return current;
45
- }
46
- current.push(next);
47
- return current;
48
- }
49
-
50
- if (Array.isArray(next)) {
51
- // A bit too dangerous to mutate `next`.
52
- return [current].concat(next);
53
- }
54
-
55
- return [current, next];
56
- }
57
-
58
- module.exports = accumulateInto;