react 15.1.0 → 15.2.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 (124) hide show
  1. package/dist/react-with-addons.js +2685 -1842
  2. package/dist/react-with-addons.min.js +6 -6
  3. package/dist/react.js +2400 -1691
  4. package/dist/react.min.js +6 -6
  5. package/lib/CSSPropertyOperations.js +1 -1
  6. package/lib/CallbackQueue.js +3 -2
  7. package/lib/DOMChildrenOperations.js +9 -9
  8. package/lib/DOMLazyTree.js +3 -2
  9. package/lib/DOMProperty.js +5 -12
  10. package/lib/DOMPropertyOperations.js +21 -15
  11. package/lib/Danger.js +5 -101
  12. package/lib/DisabledInputUtils.js +5 -5
  13. package/lib/EventPluginHub.js +8 -2
  14. package/lib/EventPluginRegistry.js +13 -7
  15. package/lib/EventPluginUtils.js +3 -1
  16. package/lib/HTMLDOMPropertyConfig.js +1 -2
  17. package/lib/KeyEscapeUtils.js +2 -1
  18. package/lib/LinkedValueUtils.js +5 -3
  19. package/lib/NativeMethodsMixin.js +6 -4
  20. package/lib/PooledClass.js +4 -2
  21. package/lib/React.js +1 -1
  22. package/lib/ReactCSSTransitionGroupChild.js +15 -8
  23. package/lib/ReactChildReconciler.js +17 -8
  24. package/lib/ReactClass.js +14 -13
  25. package/lib/ReactComponent.js +3 -6
  26. package/lib/ReactComponentEnvironment.js +3 -1
  27. package/lib/ReactComponentTreeDevtool.js +89 -16
  28. package/lib/ReactComponentTreeTestUtils.js +87 -0
  29. package/lib/ReactCompositeComponent.js +87 -117
  30. package/lib/ReactDOM.js +2 -2
  31. package/lib/ReactDOMButton.js +2 -2
  32. package/lib/ReactDOMComponent.js +130 -76
  33. package/lib/ReactDOMComponentTree.js +23 -21
  34. package/lib/ReactDOMDebugTool.js +17 -11
  35. package/lib/ReactDOMEmptyComponent.js +9 -9
  36. package/lib/ReactDOMFactories.js +1 -1
  37. package/lib/ReactDOMFiber.js +78 -0
  38. package/lib/ReactDOMInput.js +64 -26
  39. package/lib/ReactDOMInstrumentation.js +7 -2
  40. package/lib/ReactDOMNullInputValuePropDevtool.js +43 -0
  41. package/lib/ReactDOMOption.js +40 -26
  42. package/lib/ReactDOMSelect.js +3 -16
  43. package/lib/ReactDOMTextComponent.js +21 -20
  44. package/lib/ReactDOMTextarea.js +59 -46
  45. package/lib/ReactDOMTreeTraversal.js +18 -16
  46. package/lib/ReactDOMUnknownPropertyDevtool.js +65 -17
  47. package/lib/ReactDebugTool.js +148 -95
  48. package/lib/ReactDefaultInjection.js +2 -2
  49. package/lib/ReactElement.js +64 -25
  50. package/lib/ReactElementValidator.js +26 -81
  51. package/lib/ReactEventListener.js +2 -2
  52. package/lib/ReactFeatureFlags.js +1 -0
  53. package/lib/ReactFragment.js +3 -1
  54. package/lib/{ReactNativeComponent.js → ReactHostComponent.js} +10 -29
  55. package/lib/{ReactNativeOperationHistoryDevtool.js → ReactHostOperationHistoryDevtool.js} +5 -5
  56. package/lib/ReactInjection.js +2 -2
  57. package/lib/ReactInstanceHandles.js +8 -6
  58. package/lib/ReactInstrumentation.js +7 -2
  59. package/lib/ReactMount.js +38 -32
  60. package/lib/ReactMultiChild.js +38 -11
  61. package/lib/ReactNativeAttributePayload.js +5 -2
  62. package/lib/ReactNativeBaseComponent.js +7 -7
  63. package/lib/ReactNativeBridgeEventPlugin.js +1 -1
  64. package/lib/ReactNativeComponentTree.js +8 -6
  65. package/lib/ReactNativeDOMIDOperations.js +1 -2
  66. package/lib/ReactNativeDefaultInjection.js +9 -7
  67. package/lib/ReactNativeGlobalResponderHandler.js +1 -1
  68. package/lib/ReactNativeMount.js +3 -14
  69. package/lib/ReactNativeReconcileTransaction.js +16 -0
  70. package/lib/ReactNativeTagHandles.js +3 -1
  71. package/lib/ReactNativeTextComponent.js +10 -9
  72. package/lib/ReactNativeTreeTraversal.js +11 -11
  73. package/lib/ReactNodeTypes.js +6 -3
  74. package/lib/ReactNoop.js +173 -0
  75. package/lib/ReactNoopUpdateQueue.js +6 -5
  76. package/lib/ReactOwner.js +4 -2
  77. package/lib/ReactPerf.js +83 -7
  78. package/lib/ReactPropTypes.js +23 -0
  79. package/lib/ReactReconcileTransaction.js +17 -1
  80. package/lib/ReactReconciler.js +12 -7
  81. package/lib/ReactServerRendering.js +5 -7
  82. package/lib/ReactServerRenderingTransaction.js +17 -0
  83. package/lib/ReactServerUpdateQueue.js +141 -0
  84. package/lib/ReactSimpleEmptyComponent.js +4 -4
  85. package/lib/ReactTestMount.js +115 -0
  86. package/lib/ReactTestReconcileTransaction.js +108 -0
  87. package/lib/ReactTestRenderer.js +133 -0
  88. package/lib/ReactTestUtils.js +17 -10
  89. package/lib/ReactTransitionChildMapping.js +7 -1
  90. package/lib/ReactTransitionGroup.js +41 -6
  91. package/lib/ReactUpdateQueue.js +13 -3
  92. package/lib/ReactUpdates.js +10 -18
  93. package/lib/ReactVersion.js +1 -1
  94. package/lib/ResponderEventPlugin.js +9 -7
  95. package/lib/ResponderTouchHistoryStore.js +99 -95
  96. package/lib/SimpleEventPlugin.js +3 -1
  97. package/lib/SyntheticEvent.js +2 -3
  98. package/lib/SyntheticUIEvent.js +1 -1
  99. package/lib/Transaction.js +4 -2
  100. package/lib/accumulate.js +17 -15
  101. package/lib/accumulateInto.js +11 -12
  102. package/lib/adler32.js +1 -0
  103. package/lib/checkReactTypeSpec.js +73 -0
  104. package/lib/createReactNativeComponentClass.js +2 -2
  105. package/lib/dangerousStyleValue.js +3 -1
  106. package/lib/deprecated.js +7 -1
  107. package/lib/escapeTextContentForBrowser.js +96 -12
  108. package/lib/findDOMNode.js +6 -4
  109. package/lib/findNodeHandle.js +5 -3
  110. package/lib/flattenChildren.js +22 -10
  111. package/lib/forEachAccumulated.js +3 -2
  112. package/lib/{getNativeComponentFromComposite.js → getHostComponentFromComposite.js} +4 -4
  113. package/lib/getIteratorFn.js +1 -0
  114. package/lib/instantiateReactComponent.js +21 -19
  115. package/lib/isTextInputElement.js +11 -1
  116. package/lib/onlyChild.js +3 -1
  117. package/lib/reactComponentExpect.js +3 -3
  118. package/lib/reactProdInvariant.js +39 -0
  119. package/lib/setInnerHTML.js +17 -1
  120. package/lib/setTextContent.js +8 -0
  121. package/lib/traverseAllChildren.js +3 -1
  122. package/lib/update.js +12 -11
  123. package/package.json +2 -2
  124. package/lib/MetaMatchers.js +0 -118
@@ -11,7 +11,8 @@
11
11
 
12
12
  'use strict';
13
13
 
14
- var _assign = require('object-assign');
14
+ var _prodInvariant = require('./reactProdInvariant'),
15
+ _assign = require('object-assign');
15
16
 
16
17
  var EventConstants = require('./EventConstants');
17
18
  var EventPluginHub = require('./EventPluginHub');
@@ -25,6 +26,8 @@ var ReactElement = require('./ReactElement');
25
26
  var ReactBrowserEventEmitter = require('./ReactBrowserEventEmitter');
26
27
  var ReactCompositeComponent = require('./ReactCompositeComponent');
27
28
  var ReactInstanceMap = require('./ReactInstanceMap');
29
+ var ReactInstrumentation = require('./ReactInstrumentation');
30
+ var ReactReconciler = require('./ReactReconciler');
28
31
  var ReactUpdates = require('./ReactUpdates');
29
32
  var SyntheticEvent = require('./SyntheticEvent');
30
33
 
@@ -146,7 +149,7 @@ var ReactTestUtils = {
146
149
  if (!inst) {
147
150
  return [];
148
151
  }
149
- !ReactTestUtils.isCompositeComponent(inst) ? process.env.NODE_ENV !== 'production' ? invariant(false, 'findAllInRenderedTree(...): instance must be a composite component') : invariant(false) : void 0;
152
+ !ReactTestUtils.isCompositeComponent(inst) ? process.env.NODE_ENV !== 'production' ? invariant(false, 'findAllInRenderedTree(...): instance must be a composite component') : _prodInvariant('10') : void 0;
150
153
  return findAllInRenderedTreeInternal(ReactInstanceMap.get(inst), test);
151
154
  },
152
155
 
@@ -166,7 +169,7 @@ var ReactTestUtils = {
166
169
  var classList = className.split(/\s+/);
167
170
 
168
171
  if (!Array.isArray(classNames)) {
169
- !(classNames !== undefined) ? process.env.NODE_ENV !== 'production' ? invariant(false, 'TestUtils.scryRenderedDOMComponentsWithClass expects a ' + 'className as a second argument.') : invariant(false) : void 0;
172
+ !(classNames !== undefined) ? process.env.NODE_ENV !== 'production' ? invariant(false, 'TestUtils.scryRenderedDOMComponentsWithClass expects a className as a second argument.') : _prodInvariant('11') : void 0;
170
173
  classNames = classNames.split(/\s+/);
171
174
  }
172
175
  return classNames.every(function (name) {
@@ -328,7 +331,7 @@ NoopInternalComponent.prototype = {
328
331
  this._currentElement = element;
329
332
  },
330
333
 
331
- getNativeNode: function () {
334
+ getHostNode: function () {
332
335
  return undefined;
333
336
  },
334
337
 
@@ -340,7 +343,11 @@ NoopInternalComponent.prototype = {
340
343
  };
341
344
 
342
345
  var ShallowComponentWrapper = function (element) {
346
+ // TODO: Consolidate with instantiateReactComponent
343
347
  this._debugID = nextDebugID++;
348
+ var displayName = element.type.displayName || element.type.name || 'Unknown';
349
+ ReactInstrumentation.debugTool.onSetDisplayName(this._debugID, displayName);
350
+
344
351
  this.construct(element);
345
352
  };
346
353
  _assign(ShallowComponentWrapper.prototype, ReactCompositeComponent.Mixin, {
@@ -358,8 +365,8 @@ ReactShallowRenderer.prototype.render = function (element, context) {
358
365
  // conjunction with an inline-requires transform.
359
366
  ReactDefaultInjection.inject();
360
367
 
361
- !ReactElement.isValidElement(element) ? process.env.NODE_ENV !== 'production' ? invariant(false, 'ReactShallowRenderer render(): Invalid component element.%s', typeof element === 'function' ? ' Instead of passing a component class, make sure to instantiate ' + 'it by passing it to React.createElement.' : '') : invariant(false) : void 0;
362
- !(typeof element.type !== 'string') ? process.env.NODE_ENV !== 'production' ? invariant(false, 'ReactShallowRenderer render(): Shallow rendering works only with custom ' + 'components, not primitives (%s). Instead of calling `.render(el)` and ' + 'inspecting the rendered output, look at `el.props` directly instead.', element.type) : invariant(false) : void 0;
368
+ !ReactElement.isValidElement(element) ? process.env.NODE_ENV !== 'production' ? invariant(false, 'ReactShallowRenderer render(): Invalid component element.%s', typeof element === 'function' ? ' Instead of passing a component class, make sure to instantiate ' + 'it by passing it to React.createElement.' : '') : _prodInvariant('12', typeof element === 'function' ? ' Instead of passing a component class, make sure to instantiate ' + 'it by passing it to React.createElement.' : '') : void 0;
369
+ !(typeof element.type !== 'string') ? process.env.NODE_ENV !== 'production' ? invariant(false, 'ReactShallowRenderer render(): Shallow rendering works only with custom components, not primitives (%s). Instead of calling `.render(el)` and inspecting the rendered output, look at `el.props` directly instead.', element.type) : _prodInvariant('13', element.type) : void 0;
363
370
 
364
371
  if (!context) {
365
372
  context = emptyObject;
@@ -381,16 +388,16 @@ ReactShallowRenderer.prototype.getRenderOutput = function () {
381
388
 
382
389
  ReactShallowRenderer.prototype.unmount = function () {
383
390
  if (this._instance) {
384
- this._instance.unmountComponent(false);
391
+ ReactReconciler.unmountComponent(this._instance, false);
385
392
  }
386
393
  };
387
394
 
388
395
  ReactShallowRenderer.prototype._render = function (element, transaction, context) {
389
396
  if (this._instance) {
390
- this._instance.receiveComponent(element, transaction, context);
397
+ ReactReconciler.receiveComponent(this._instance, element, transaction, context);
391
398
  } else {
392
399
  var instance = new ShallowComponentWrapper(element);
393
- instance.mountComponent(transaction, null, null, context);
400
+ ReactReconciler.mountComponent(instance, transaction, null, null, context);
394
401
  this._instance = instance;
395
402
  }
396
403
  };
@@ -406,7 +413,7 @@ ReactShallowRenderer.prototype._render = function (element, transaction, context
406
413
  function makeSimulator(eventType) {
407
414
  return function (domComponentOrNode, eventData) {
408
415
  var node;
409
- !!React.isValidElement(domComponentOrNode) ? process.env.NODE_ENV !== 'production' ? invariant(false, 'TestUtils.Simulate expects a component instance and not a ReactElement.' + 'TestUtils.Simulate will not work if you are using shallow rendering.') : invariant(false) : void 0;
416
+ !!React.isValidElement(domComponentOrNode) ? process.env.NODE_ENV !== 'production' ? invariant(false, 'TestUtils.Simulate expects a component instance and not a ReactElement.TestUtils.Simulate will not work if you are using shallow rendering.') : _prodInvariant('14') : void 0;
410
417
  if (ReactTestUtils.isDOMComponent(domComponentOrNode)) {
411
418
  node = findDOMNode(domComponentOrNode);
412
419
  } else if (domComponentOrNode.tagName) {
@@ -19,12 +19,18 @@ var ReactTransitionChildMapping = {
19
19
  * simple syntactic sugar around flattenChildren().
20
20
  *
21
21
  * @param {*} children `this.props.children`
22
+ * @param {number=} selfDebugID Optional debugID of the current internal instance.
22
23
  * @return {object} Mapping of key to child
23
24
  */
24
- getChildMapping: function (children) {
25
+ getChildMapping: function (children, selfDebugID) {
25
26
  if (!children) {
26
27
  return children;
27
28
  }
29
+
30
+ if (process.env.NODE_ENV !== 'production') {
31
+ return flattenChildren(children, selfDebugID);
32
+ }
33
+
28
34
  return flattenChildren(children);
29
35
  },
30
36
 
@@ -14,12 +14,13 @@
14
14
  var _assign = require('object-assign');
15
15
 
16
16
  var React = require('./React');
17
+ var ReactInstanceMap = require('./ReactInstanceMap');
17
18
  var ReactTransitionChildMapping = require('./ReactTransitionChildMapping');
18
19
 
19
20
  var emptyFunction = require('fbjs/lib/emptyFunction');
20
21
 
21
22
  /**
22
- * A basis for animatins. When children are declaratively added or removed,
23
+ * A basis for animations. When children are declaratively added or removed,
23
24
  * special lifecycle hooks are called.
24
25
  * See https://facebook.github.io/react/docs/animation.html#low-level-api-reacttransitiongroup
25
26
  */
@@ -40,6 +41,7 @@ var ReactTransitionGroup = React.createClass({
40
41
 
41
42
  getInitialState: function () {
42
43
  return {
44
+ // TODO: can we get useful debug information to show at this point?
43
45
  children: ReactTransitionChildMapping.getChildMapping(this.props.children)
44
46
  };
45
47
  },
@@ -60,7 +62,12 @@ var ReactTransitionGroup = React.createClass({
60
62
  },
61
63
 
62
64
  componentWillReceiveProps: function (nextProps) {
63
- var nextChildMapping = ReactTransitionChildMapping.getChildMapping(nextProps.children);
65
+ var nextChildMapping;
66
+ if (process.env.NODE_ENV !== 'production') {
67
+ nextChildMapping = ReactTransitionChildMapping.getChildMapping(nextProps.children, ReactInstanceMap.get(this)._debugID);
68
+ } else {
69
+ nextChildMapping = ReactTransitionChildMapping.getChildMapping(nextProps.children);
70
+ }
64
71
  var prevChildMapping = this.state.children;
65
72
 
66
73
  this.setState({
@@ -116,7 +123,12 @@ var ReactTransitionGroup = React.createClass({
116
123
 
117
124
  delete this.currentlyTransitioningKeys[key];
118
125
 
119
- var currentChildMapping = ReactTransitionChildMapping.getChildMapping(this.props.children);
126
+ var currentChildMapping;
127
+ if (process.env.NODE_ENV !== 'production') {
128
+ currentChildMapping = ReactTransitionChildMapping.getChildMapping(this.props.children, ReactInstanceMap.get(this)._debugID);
129
+ } else {
130
+ currentChildMapping = ReactTransitionChildMapping.getChildMapping(this.props.children);
131
+ }
120
132
 
121
133
  if (!currentChildMapping || !currentChildMapping.hasOwnProperty(key)) {
122
134
  // This was removed before it had fully appeared. Remove it.
@@ -144,7 +156,12 @@ var ReactTransitionGroup = React.createClass({
144
156
 
145
157
  delete this.currentlyTransitioningKeys[key];
146
158
 
147
- var currentChildMapping = ReactTransitionChildMapping.getChildMapping(this.props.children);
159
+ var currentChildMapping;
160
+ if (process.env.NODE_ENV !== 'production') {
161
+ currentChildMapping = ReactTransitionChildMapping.getChildMapping(this.props.children, ReactInstanceMap.get(this)._debugID);
162
+ } else {
163
+ currentChildMapping = ReactTransitionChildMapping.getChildMapping(this.props.children);
164
+ }
148
165
 
149
166
  if (!currentChildMapping || !currentChildMapping.hasOwnProperty(key)) {
150
167
  // This was removed before it had fully entered. Remove it.
@@ -175,7 +192,12 @@ var ReactTransitionGroup = React.createClass({
175
192
 
176
193
  delete this.currentlyTransitioningKeys[key];
177
194
 
178
- var currentChildMapping = ReactTransitionChildMapping.getChildMapping(this.props.children);
195
+ var currentChildMapping;
196
+ if (process.env.NODE_ENV !== 'production') {
197
+ currentChildMapping = ReactTransitionChildMapping.getChildMapping(this.props.children, ReactInstanceMap.get(this)._debugID);
198
+ } else {
199
+ currentChildMapping = ReactTransitionChildMapping.getChildMapping(this.props.children);
200
+ }
179
201
 
180
202
  if (currentChildMapping && currentChildMapping.hasOwnProperty(key)) {
181
203
  // This entered again before it fully left. Add it again.
@@ -204,7 +226,20 @@ var ReactTransitionGroup = React.createClass({
204
226
  childrenToRender.push(React.cloneElement(this.props.childFactory(child), { ref: key, key: key }));
205
227
  }
206
228
  }
207
- return React.createElement(this.props.component, this.props, childrenToRender);
229
+
230
+ // Do not forward ReactTransitionGroup props to primitive DOM nodes
231
+ var props = _assign({}, this.props);
232
+ delete props.transitionLeave;
233
+ delete props.transitionName;
234
+ delete props.transitionAppear;
235
+ delete props.transitionEnter;
236
+ delete props.childFactory;
237
+ delete props.transitionLeaveTimeout;
238
+ delete props.transitionEnterTimeout;
239
+ delete props.transitionAppearTimeout;
240
+ delete props.component;
241
+
242
+ return React.createElement(this.props.component, props, childrenToRender);
208
243
  }
209
244
  });
210
245
 
@@ -11,8 +11,11 @@
11
11
 
12
12
  'use strict';
13
13
 
14
+ var _prodInvariant = require('./reactProdInvariant');
15
+
14
16
  var ReactCurrentOwner = require('./ReactCurrentOwner');
15
17
  var ReactInstanceMap = require('./ReactInstanceMap');
18
+ var ReactInstrumentation = require('./ReactInstrumentation');
16
19
  var ReactUpdates = require('./ReactUpdates');
17
20
 
18
21
  var invariant = require('fbjs/lib/invariant');
@@ -189,6 +192,11 @@ var ReactUpdateQueue = {
189
192
  * @internal
190
193
  */
191
194
  enqueueSetState: function (publicInstance, partialState) {
195
+ if (process.env.NODE_ENV !== 'production') {
196
+ ReactInstrumentation.debugTool.onSetState();
197
+ process.env.NODE_ENV !== 'production' ? warning(partialState != null, 'setState(...): You passed an undefined or null state object; ' + 'instead, use forceUpdate().') : void 0;
198
+ }
199
+
192
200
  var internalInstance = getInternalInstanceReadyForUpdate(publicInstance, 'setState');
193
201
 
194
202
  if (!internalInstance) {
@@ -201,13 +209,15 @@ var ReactUpdateQueue = {
201
209
  enqueueUpdate(internalInstance);
202
210
  },
203
211
 
204
- enqueueElementInternal: function (internalInstance, newElement) {
205
- internalInstance._pendingElement = newElement;
212
+ enqueueElementInternal: function (internalInstance, nextElement, nextContext) {
213
+ internalInstance._pendingElement = nextElement;
214
+ // TODO: introduce _pendingContext instead of setting it directly.
215
+ internalInstance._context = nextContext;
206
216
  enqueueUpdate(internalInstance);
207
217
  },
208
218
 
209
219
  validateCallback: function (callback, callerName) {
210
- !(!callback || typeof callback === 'function') ? process.env.NODE_ENV !== 'production' ? invariant(false, '%s(...): Expected the last optional `callback` argument to be a ' + 'function. Instead received: %s.', callerName, formatUnexpectedArgument(callback)) : invariant(false) : void 0;
220
+ !(!callback || typeof callback === 'function') ? process.env.NODE_ENV !== 'production' ? invariant(false, '%s(...): Expected the last optional `callback` argument to be a function. Instead received: %s.', callerName, formatUnexpectedArgument(callback)) : _prodInvariant('122', callerName, formatUnexpectedArgument(callback)) : void 0;
211
221
  }
212
222
 
213
223
  };
@@ -11,12 +11,12 @@
11
11
 
12
12
  'use strict';
13
13
 
14
- var _assign = require('object-assign');
14
+ var _prodInvariant = require('./reactProdInvariant'),
15
+ _assign = require('object-assign');
15
16
 
16
17
  var CallbackQueue = require('./CallbackQueue');
17
18
  var PooledClass = require('./PooledClass');
18
19
  var ReactFeatureFlags = require('./ReactFeatureFlags');
19
- var ReactInstrumentation = require('./ReactInstrumentation');
20
20
  var ReactReconciler = require('./ReactReconciler');
21
21
  var Transaction = require('./Transaction');
22
22
 
@@ -30,7 +30,7 @@ var asapEnqueued = false;
30
30
  var batchingStrategy = null;
31
31
 
32
32
  function ensureInjected() {
33
- !(ReactUpdates.ReactReconcileTransaction && batchingStrategy) ? process.env.NODE_ENV !== 'production' ? invariant(false, 'ReactUpdates: must inject a reconcile transaction class and batching ' + 'strategy') : invariant(false) : void 0;
33
+ !(ReactUpdates.ReactReconcileTransaction && batchingStrategy) ? process.env.NODE_ENV !== 'production' ? invariant(false, 'ReactUpdates: must inject a reconcile transaction class and batching strategy') : _prodInvariant('123') : void 0;
34
34
  }
35
35
 
36
36
  var NESTED_UPDATES = {
@@ -111,7 +111,7 @@ function mountOrderComparator(c1, c2) {
111
111
 
112
112
  function runBatchedUpdates(transaction) {
113
113
  var len = transaction.dirtyComponentsLength;
114
- !(len === dirtyComponents.length) ? process.env.NODE_ENV !== 'production' ? invariant(false, 'Expected flush transaction\'s stored dirty-components length (%s) to ' + 'match dirty-components array length (%s).', len, dirtyComponents.length) : invariant(false) : void 0;
114
+ !(len === dirtyComponents.length) ? process.env.NODE_ENV !== 'production' ? invariant(false, 'Expected flush transaction\'s stored dirty-components length (%s) to match dirty-components array length (%s).', len, dirtyComponents.length) : _prodInvariant('124', len, dirtyComponents.length) : void 0;
115
115
 
116
116
  // Since reconciling a component higher in the owner hierarchy usually (not
117
117
  // always -- see shouldComponentUpdate()) will reconcile children, reconcile
@@ -163,10 +163,6 @@ function runBatchedUpdates(transaction) {
163
163
  }
164
164
 
165
165
  var flushBatchedUpdates = function () {
166
- if (process.env.NODE_ENV !== 'production') {
167
- ReactInstrumentation.debugTool.onBeginFlush();
168
- }
169
-
170
166
  // ReactUpdatesFlushTransaction's wrappers will clear the dirtyComponents
171
167
  // array and perform any updates enqueued by mount-ready handlers (i.e.,
172
168
  // componentDidUpdate) but we need to check here too in order to catch
@@ -186,10 +182,6 @@ var flushBatchedUpdates = function () {
186
182
  CallbackQueue.release(queue);
187
183
  }
188
184
  }
189
-
190
- if (process.env.NODE_ENV !== 'production') {
191
- ReactInstrumentation.debugTool.onEndFlush();
192
- }
193
185
  };
194
186
 
195
187
  /**
@@ -202,7 +194,7 @@ function enqueueUpdate(component) {
202
194
  // Various parts of our code (such as ReactCompositeComponent's
203
195
  // _renderValidatedComponent) assume that calls to render aren't nested;
204
196
  // verify that that's the case. (This is called by each top-level update
205
- // function, like setProps, setState, forceUpdate, etc.; creation and
197
+ // function, like setState, forceUpdate, etc.; creation and
206
198
  // destruction of top-level components is guarded in ReactMount.)
207
199
 
208
200
  if (!batchingStrategy.isBatchingUpdates) {
@@ -221,21 +213,21 @@ function enqueueUpdate(component) {
221
213
  * if no updates are currently being performed.
222
214
  */
223
215
  function asap(callback, context) {
224
- !batchingStrategy.isBatchingUpdates ? process.env.NODE_ENV !== 'production' ? invariant(false, 'ReactUpdates.asap: Can\'t enqueue an asap callback in a context where' + 'updates are not being batched.') : invariant(false) : void 0;
216
+ !batchingStrategy.isBatchingUpdates ? process.env.NODE_ENV !== 'production' ? invariant(false, 'ReactUpdates.asap: Can\'t enqueue an asap callback in a context whereupdates are not being batched.') : _prodInvariant('125') : void 0;
225
217
  asapCallbackQueue.enqueue(callback, context);
226
218
  asapEnqueued = true;
227
219
  }
228
220
 
229
221
  var ReactUpdatesInjection = {
230
222
  injectReconcileTransaction: function (ReconcileTransaction) {
231
- !ReconcileTransaction ? process.env.NODE_ENV !== 'production' ? invariant(false, 'ReactUpdates: must provide a reconcile transaction class') : invariant(false) : void 0;
223
+ !ReconcileTransaction ? process.env.NODE_ENV !== 'production' ? invariant(false, 'ReactUpdates: must provide a reconcile transaction class') : _prodInvariant('126') : void 0;
232
224
  ReactUpdates.ReactReconcileTransaction = ReconcileTransaction;
233
225
  },
234
226
 
235
227
  injectBatchingStrategy: function (_batchingStrategy) {
236
- !_batchingStrategy ? process.env.NODE_ENV !== 'production' ? invariant(false, 'ReactUpdates: must provide a batching strategy') : invariant(false) : void 0;
237
- !(typeof _batchingStrategy.batchedUpdates === 'function') ? process.env.NODE_ENV !== 'production' ? invariant(false, 'ReactUpdates: must provide a batchedUpdates() function') : invariant(false) : void 0;
238
- !(typeof _batchingStrategy.isBatchingUpdates === 'boolean') ? process.env.NODE_ENV !== 'production' ? invariant(false, 'ReactUpdates: must provide an isBatchingUpdates boolean attribute') : invariant(false) : void 0;
228
+ !_batchingStrategy ? process.env.NODE_ENV !== 'production' ? invariant(false, 'ReactUpdates: must provide a batching strategy') : _prodInvariant('127') : void 0;
229
+ !(typeof _batchingStrategy.batchedUpdates === 'function') ? process.env.NODE_ENV !== 'production' ? invariant(false, 'ReactUpdates: must provide a batchedUpdates() function') : _prodInvariant('128') : void 0;
230
+ !(typeof _batchingStrategy.isBatchingUpdates === 'boolean') ? process.env.NODE_ENV !== 'production' ? invariant(false, 'ReactUpdates: must provide an isBatchingUpdates boolean attribute') : _prodInvariant('129') : void 0;
239
231
  batchingStrategy = _batchingStrategy;
240
232
  }
241
233
  };
@@ -11,4 +11,4 @@
11
11
 
12
12
  'use strict';
13
13
 
14
- module.exports = '15.1.0';
14
+ module.exports = '15.2.1';
@@ -11,6 +11,8 @@
11
11
 
12
12
  'use strict';
13
13
 
14
+ var _prodInvariant = require('./reactProdInvariant');
15
+
14
16
  var EventConstants = require('./EventConstants');
15
17
  var EventPluginUtils = require('./EventPluginUtils');
16
18
  var EventPropagators = require('./EventPropagators');
@@ -45,11 +47,11 @@ var trackedTouchCount = 0;
45
47
  */
46
48
  var previousActiveTouches = 0;
47
49
 
48
- var changeResponder = function (nextResponderInst, blockNativeResponder) {
50
+ var changeResponder = function (nextResponderInst, blockHostResponder) {
49
51
  var oldResponderInst = responderInst;
50
52
  responderInst = nextResponderInst;
51
53
  if (ResponderEventPlugin.GlobalResponderHandler !== null) {
52
- ResponderEventPlugin.GlobalResponderHandler.onChange(oldResponderInst, nextResponderInst, blockNativeResponder);
54
+ ResponderEventPlugin.GlobalResponderHandler.onChange(oldResponderInst, nextResponderInst, blockHostResponder);
53
55
  }
54
56
  };
55
57
 
@@ -342,7 +344,7 @@ function setResponderAndExtractTransfer(topLevelType, targetInst, nativeEvent, n
342
344
  grantEvent.touchHistory = ResponderTouchHistoryStore.touchHistory;
343
345
 
344
346
  EventPropagators.accumulateDirectDispatches(grantEvent);
345
- var blockNativeResponder = executeDirectDispatch(grantEvent) === true;
347
+ var blockHostResponder = executeDirectDispatch(grantEvent) === true;
346
348
  if (responderInst) {
347
349
 
348
350
  var terminationRequestEvent = ResponderSyntheticEvent.getPooled(eventTypes.responderTerminationRequest, responderInst, nativeEvent, nativeEventTarget);
@@ -358,7 +360,7 @@ function setResponderAndExtractTransfer(topLevelType, targetInst, nativeEvent, n
358
360
  terminateEvent.touchHistory = ResponderTouchHistoryStore.touchHistory;
359
361
  EventPropagators.accumulateDirectDispatches(terminateEvent);
360
362
  extracted = accumulate(extracted, [grantEvent, terminateEvent]);
361
- changeResponder(wantsResponderInst, blockNativeResponder);
363
+ changeResponder(wantsResponderInst, blockHostResponder);
362
364
  } else {
363
365
  var rejectEvent = ResponderSyntheticEvent.getPooled(eventTypes.responderReject, wantsResponderInst, nativeEvent, nativeEventTarget);
364
366
  rejectEvent.touchHistory = ResponderTouchHistoryStore.touchHistory;
@@ -367,7 +369,7 @@ function setResponderAndExtractTransfer(topLevelType, targetInst, nativeEvent, n
367
369
  }
368
370
  } else {
369
371
  extracted = accumulate(extracted, grantEvent);
370
- changeResponder(wantsResponderInst, blockNativeResponder);
372
+ changeResponder(wantsResponderInst, blockHostResponder);
371
373
  }
372
374
  return extracted;
373
375
  }
@@ -433,10 +435,10 @@ var ResponderEventPlugin = {
433
435
  trackedTouchCount += 1;
434
436
  } else if (isEndish(topLevelType)) {
435
437
  trackedTouchCount -= 1;
436
- !(trackedTouchCount >= 0) ? process.env.NODE_ENV !== 'production' ? invariant(false, 'Ended a touch event which was not counted in trackedTouchCount.') : invariant(false) : void 0;
438
+ !(trackedTouchCount >= 0) ? process.env.NODE_ENV !== 'production' ? invariant(false, 'Ended a touch event which was not counted in trackedTouchCount.') : _prodInvariant('132') : void 0;
437
439
  }
438
440
 
439
- ResponderTouchHistoryStore.recordTouchTrack(topLevelType, nativeEvent, nativeEventTarget);
441
+ ResponderTouchHistoryStore.recordTouchTrack(topLevelType, nativeEvent);
440
442
 
441
443
  var extracted = canTriggerTransfer(topLevelType, targetInst, nativeEvent) ? setResponderAndExtractTransfer(topLevelType, targetInst, nativeEvent, nativeEventTarget) : null;
442
444
  // Responder may or may not have transferred on a new touch start/move.
@@ -7,37 +7,32 @@
7
7
  * of patent rights can be found in the PATENTS file in the same directory.
8
8
  *
9
9
  * @providesModule ResponderTouchHistoryStore
10
+ *
10
11
  */
11
12
 
12
13
  'use strict';
13
14
 
15
+ var _prodInvariant = require('./reactProdInvariant');
16
+
14
17
  var EventPluginUtils = require('./EventPluginUtils');
15
18
 
16
19
  var invariant = require('fbjs/lib/invariant');
20
+ var warning = require('fbjs/lib/warning');
17
21
 
22
+ var isEndish = EventPluginUtils.isEndish;
18
23
  var isMoveish = EventPluginUtils.isMoveish;
19
24
  var isStartish = EventPluginUtils.isStartish;
20
- var isEndish = EventPluginUtils.isEndish;
21
-
22
- var MAX_TOUCH_BANK = 20;
23
25
 
24
26
  /**
25
- * Touch position/time tracking information by touchID. Typically, we'll only
26
- * see IDs with a range of 1-20 (they are recycled when touches end and then
27
- * start again). This data is commonly needed by many different interaction
28
- * logic modules so precomputing it is very helpful to do once.
29
- * Each touch object in `touchBank` is of the following form:
30
- * { touchActive: boolean,
31
- * startTimeStamp: number,
32
- * startPageX: number,
33
- * startPageY: number,
34
- * currentPageX: number,
35
- * currentPageY: number,
36
- * currentTimeStamp: number
37
- * }
27
+ * Tracks the position and time of each active touch by `touch.identifier`. We
28
+ * should typically only see IDs in the range of 1-20 because IDs get recycled
29
+ * when touches end and start again.
38
30
  */
31
+
32
+ var MAX_TOUCH_BANK = 20;
33
+ var touchBank = [];
39
34
  var touchHistory = {
40
- touchBank: [],
35
+ touchBank: touchBank,
41
36
  numberActiveTouches: 0,
42
37
  // If there is only one active touch, we remember its location. This prevents
43
38
  // us having to loop through all of the touches all the time in the most
@@ -46,24 +41,23 @@ var touchHistory = {
46
41
  mostRecentTimeStamp: 0
47
42
  };
48
43
 
49
- var timestampForTouch = function (touch) {
44
+ function timestampForTouch(touch) {
50
45
  // The legacy internal implementation provides "timeStamp", which has been
51
46
  // renamed to "timestamp". Let both work for now while we iron it out
52
47
  // TODO (evv): rename timeStamp to timestamp in internal code
53
48
  return touch.timeStamp || touch.timestamp;
54
- };
49
+ }
55
50
 
56
51
  /**
57
52
  * TODO: Instead of making gestures recompute filtered velocity, we could
58
53
  * include a built in velocity computation that can be reused globally.
59
- * @param {Touch} touch Native touch object.
60
54
  */
61
- var initializeTouchData = function (touch) {
55
+ function createTouchRecord(touch) {
62
56
  return {
63
57
  touchActive: true,
64
- startTimeStamp: timestampForTouch(touch),
65
58
  startPageX: touch.pageX,
66
59
  startPageY: touch.pageY,
60
+ startTimeStamp: timestampForTouch(touch),
67
61
  currentPageX: touch.pageX,
68
62
  currentPageY: touch.pageY,
69
63
  currentTimeStamp: timestampForTouch(touch),
@@ -71,91 +65,101 @@ var initializeTouchData = function (touch) {
71
65
  previousPageY: touch.pageY,
72
66
  previousTimeStamp: timestampForTouch(touch)
73
67
  };
74
- };
75
-
76
- var reinitializeTouchTrack = function (touchTrack, touch) {
77
- touchTrack.touchActive = true;
78
- touchTrack.startTimeStamp = timestampForTouch(touch);
79
- touchTrack.startPageX = touch.pageX;
80
- touchTrack.startPageY = touch.pageY;
81
- touchTrack.currentPageX = touch.pageX;
82
- touchTrack.currentPageY = touch.pageY;
83
- touchTrack.currentTimeStamp = timestampForTouch(touch);
84
- touchTrack.previousPageX = touch.pageX;
85
- touchTrack.previousPageY = touch.pageY;
86
- touchTrack.previousTimeStamp = timestampForTouch(touch);
87
- };
88
-
89
- var validateTouch = function (touch) {
90
- var identifier = touch.identifier;
91
- !(identifier != null) ? process.env.NODE_ENV !== 'production' ? invariant(false, 'Touch object is missing identifier') : invariant(false) : void 0;
92
- if (identifier > MAX_TOUCH_BANK) {
93
- console.warn('Touch identifier ' + identifier + ' is greater than maximum ' + 'supported ' + MAX_TOUCH_BANK + ' which causes performance issues ' + 'backfilling array locations for all of the indices.');
94
- }
95
- };
96
-
97
- var recordStartTouchData = function (touch) {
98
- var touchBank = touchHistory.touchBank;
99
- var identifier = touch.identifier;
100
- var touchTrack = touchBank[identifier];
101
- if (process.env.NODE_ENV !== 'production') {
102
- validateTouch(touch);
103
- }
104
- if (touchTrack) {
105
- reinitializeTouchTrack(touchTrack, touch);
68
+ }
69
+
70
+ function resetTouchRecord(touchRecord, touch) {
71
+ touchRecord.touchActive = true;
72
+ touchRecord.startPageX = touch.pageX;
73
+ touchRecord.startPageY = touch.pageY;
74
+ touchRecord.startTimeStamp = timestampForTouch(touch);
75
+ touchRecord.currentPageX = touch.pageX;
76
+ touchRecord.currentPageY = touch.pageY;
77
+ touchRecord.currentTimeStamp = timestampForTouch(touch);
78
+ touchRecord.previousPageX = touch.pageX;
79
+ touchRecord.previousPageY = touch.pageY;
80
+ touchRecord.previousTimeStamp = timestampForTouch(touch);
81
+ }
82
+
83
+ function getTouchIdentifier(_ref) {
84
+ var identifier = _ref.identifier;
85
+
86
+ !(identifier != null) ? process.env.NODE_ENV !== 'production' ? invariant(false, 'Touch object is missing identifier.') : _prodInvariant('138') : void 0;
87
+ process.env.NODE_ENV !== 'production' ? warning(identifier <= MAX_TOUCH_BANK, 'Touch identifier %s is greater than maximum supported %s which causes ' + 'performance issues backfilling array locations for all of the indices.', identifier, MAX_TOUCH_BANK) : void 0;
88
+ return identifier;
89
+ }
90
+
91
+ function recordTouchStart(touch) {
92
+ var identifier = getTouchIdentifier(touch);
93
+ var touchRecord = touchBank[identifier];
94
+ if (touchRecord) {
95
+ resetTouchRecord(touchRecord, touch);
106
96
  } else {
107
- touchBank[touch.identifier] = initializeTouchData(touch);
97
+ touchBank[identifier] = createTouchRecord(touch);
108
98
  }
109
99
  touchHistory.mostRecentTimeStamp = timestampForTouch(touch);
110
- };
111
-
112
- var recordMoveTouchData = function (touch) {
113
- var touchBank = touchHistory.touchBank;
114
- var touchTrack = touchBank[touch.identifier];
115
- if (process.env.NODE_ENV !== 'production') {
116
- validateTouch(touch);
117
- !touchTrack ? process.env.NODE_ENV !== 'production' ? invariant(false, 'Touch data should have been recorded on start') : invariant(false) : void 0;
100
+ }
101
+
102
+ function recordTouchMove(touch) {
103
+ var touchRecord = touchBank[getTouchIdentifier(touch)];
104
+ if (touchRecord) {
105
+ touchRecord.touchActive = true;
106
+ touchRecord.previousPageX = touchRecord.currentPageX;
107
+ touchRecord.previousPageY = touchRecord.currentPageY;
108
+ touchRecord.previousTimeStamp = touchRecord.currentTimeStamp;
109
+ touchRecord.currentPageX = touch.pageX;
110
+ touchRecord.currentPageY = touch.pageY;
111
+ touchRecord.currentTimeStamp = timestampForTouch(touch);
112
+ touchHistory.mostRecentTimeStamp = timestampForTouch(touch);
113
+ } else {
114
+ console.error('Cannot record touch move without a touch start.\n' + 'Touch Move: %s\n', 'Touch Bank: %s', printTouch(touch), printTouchBank());
118
115
  }
119
- touchTrack.touchActive = true;
120
- touchTrack.previousPageX = touchTrack.currentPageX;
121
- touchTrack.previousPageY = touchTrack.currentPageY;
122
- touchTrack.previousTimeStamp = touchTrack.currentTimeStamp;
123
- touchTrack.currentPageX = touch.pageX;
124
- touchTrack.currentPageY = touch.pageY;
125
- touchTrack.currentTimeStamp = timestampForTouch(touch);
126
- touchHistory.mostRecentTimeStamp = timestampForTouch(touch);
127
- };
128
-
129
- var recordEndTouchData = function (touch) {
130
- var touchBank = touchHistory.touchBank;
131
- var touchTrack = touchBank[touch.identifier];
132
- if (process.env.NODE_ENV !== 'production') {
133
- validateTouch(touch);
134
- !touchTrack ? process.env.NODE_ENV !== 'production' ? invariant(false, 'Touch data should have been recorded on start') : invariant(false) : void 0;
116
+ }
117
+
118
+ function recordTouchEnd(touch) {
119
+ var touchRecord = touchBank[getTouchIdentifier(touch)];
120
+ if (touchRecord) {
121
+ touchRecord.touchActive = false;
122
+ touchRecord.previousPageX = touchRecord.currentPageX;
123
+ touchRecord.previousPageY = touchRecord.currentPageY;
124
+ touchRecord.previousTimeStamp = touchRecord.currentTimeStamp;
125
+ touchRecord.currentPageX = touch.pageX;
126
+ touchRecord.currentPageY = touch.pageY;
127
+ touchRecord.currentTimeStamp = timestampForTouch(touch);
128
+ touchHistory.mostRecentTimeStamp = timestampForTouch(touch);
129
+ } else {
130
+ console.error('Cannot record touch end without a touch start.\n' + 'Touch End: %s\n', 'Touch Bank: %s', printTouch(touch), printTouchBank());
135
131
  }
136
- touchTrack.previousPageX = touchTrack.currentPageX;
137
- touchTrack.previousPageY = touchTrack.currentPageY;
138
- touchTrack.previousTimeStamp = touchTrack.currentTimeStamp;
139
- touchTrack.currentPageX = touch.pageX;
140
- touchTrack.currentPageY = touch.pageY;
141
- touchTrack.currentTimeStamp = timestampForTouch(touch);
142
- touchTrack.touchActive = false;
143
- touchHistory.mostRecentTimeStamp = timestampForTouch(touch);
144
- };
132
+ }
133
+
134
+ function printTouch(touch) {
135
+ return JSON.stringify({
136
+ identifier: touch.identifier,
137
+ pageX: touch.pageX,
138
+ pageY: touch.pageY,
139
+ timestamp: timestampForTouch(touch)
140
+ });
141
+ }
142
+
143
+ function printTouchBank() {
144
+ var printed = JSON.stringify(touchBank.slice(0, MAX_TOUCH_BANK));
145
+ if (touchBank.length > MAX_TOUCH_BANK) {
146
+ printed += ' (original size: ' + touchBank.length + ')';
147
+ }
148
+ return printed;
149
+ }
145
150
 
146
151
  var ResponderTouchHistoryStore = {
147
152
  recordTouchTrack: function (topLevelType, nativeEvent) {
148
- var touchBank = touchHistory.touchBank;
149
153
  if (isMoveish(topLevelType)) {
150
- nativeEvent.changedTouches.forEach(recordMoveTouchData);
154
+ nativeEvent.changedTouches.forEach(recordTouchMove);
151
155
  } else if (isStartish(topLevelType)) {
152
- nativeEvent.changedTouches.forEach(recordStartTouchData);
156
+ nativeEvent.changedTouches.forEach(recordTouchStart);
153
157
  touchHistory.numberActiveTouches = nativeEvent.touches.length;
154
158
  if (touchHistory.numberActiveTouches === 1) {
155
159
  touchHistory.indexOfSingleActiveTouch = nativeEvent.touches[0].identifier;
156
160
  }
157
161
  } else if (isEndish(topLevelType)) {
158
- nativeEvent.changedTouches.forEach(recordEndTouchData);
162
+ nativeEvent.changedTouches.forEach(recordTouchEnd);
159
163
  touchHistory.numberActiveTouches = nativeEvent.touches.length;
160
164
  if (touchHistory.numberActiveTouches === 1) {
161
165
  for (var i = 0; i < touchBank.length; i++) {
@@ -166,14 +170,14 @@ var ResponderTouchHistoryStore = {
166
170
  }
167
171
  }
168
172
  if (process.env.NODE_ENV !== 'production') {
169
- var activeTouchData = touchBank[touchHistory.indexOfSingleActiveTouch];
170
- var foundActive = activeTouchData != null && !!activeTouchData.touchActive;
171
- !foundActive ? process.env.NODE_ENV !== 'production' ? invariant(false, 'Cannot find single active touch') : invariant(false) : void 0;
173
+ var activeRecord = touchBank[touchHistory.indexOfSingleActiveTouch];
174
+ process.env.NODE_ENV !== 'production' ? warning(activeRecord != null && activeRecord.touchActive, 'Cannot find single active touch.') : void 0;
172
175
  }
173
176
  }
174
177
  }
175
178
  },
176
179
 
180
+
177
181
  touchHistory: touchHistory
178
182
  };
179
183