react 15.2.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 (54) hide show
  1. package/dist/react-with-addons.js +1099 -999
  2. package/dist/react-with-addons.min.js +6 -7
  3. package/dist/react.js +1034 -935
  4. package/dist/react.min.js +6 -6
  5. package/lib/DOMProperty.js +0 -9
  6. package/lib/DOMPropertyOperations.js +4 -12
  7. package/lib/Danger.js +0 -98
  8. package/lib/KeyEscapeUtils.js +2 -1
  9. package/lib/PooledClass.js +1 -1
  10. package/lib/ReactChildReconciler.js +3 -3
  11. package/lib/ReactComponentTreeDevtool.js +0 -5
  12. package/lib/ReactCompositeComponent.js +23 -13
  13. package/lib/ReactDOMComponent.js +1 -1
  14. package/lib/ReactDOMDebugTool.js +11 -11
  15. package/lib/ReactDOMFiber.js +78 -0
  16. package/lib/ReactDOMInput.js +17 -15
  17. package/lib/ReactDOMInstrumentation.js +7 -2
  18. package/lib/ReactDOMNullInputValuePropDevtool.js +43 -0
  19. package/lib/ReactDOMSelect.js +0 -13
  20. package/lib/ReactDOMTextarea.js +0 -14
  21. package/lib/ReactDebugTool.js +75 -83
  22. package/lib/ReactFeatureFlags.js +1 -0
  23. package/lib/ReactInstrumentation.js +7 -2
  24. package/lib/ReactMount.js +15 -17
  25. package/lib/ReactMultiChild.js +8 -3
  26. package/lib/ReactNativeMount.js +2 -13
  27. package/lib/ReactNativeReconcileTransaction.js +16 -0
  28. package/lib/ReactNodeTypes.js +1 -0
  29. package/lib/ReactNoop.js +100 -3
  30. package/lib/ReactNoopUpdateQueue.js +6 -5
  31. package/lib/ReactReconcileTransaction.js +16 -0
  32. package/lib/ReactServerRendering.js +1 -5
  33. package/lib/ReactServerRenderingTransaction.js +17 -0
  34. package/lib/ReactServerUpdateQueue.js +141 -0
  35. package/lib/ReactTestMount.js +1 -12
  36. package/lib/ReactTestReconcileTransaction.js +8 -0
  37. package/lib/ReactTransitionGroup.js +1 -0
  38. package/lib/ReactUpdateQueue.js +4 -2
  39. package/lib/ReactUpdates.js +1 -10
  40. package/lib/ReactVersion.js +1 -1
  41. package/lib/ResponderEventPlugin.js +1 -1
  42. package/lib/ResponderTouchHistoryStore.js +97 -95
  43. package/lib/accumulate.js +14 -14
  44. package/lib/accumulateInto.js +8 -11
  45. package/lib/adler32.js +1 -0
  46. package/lib/checkReactTypeSpec.js +7 -5
  47. package/lib/deprecated.js +7 -1
  48. package/lib/flattenChildren.js +11 -8
  49. package/lib/forEachAccumulated.js +3 -2
  50. package/lib/getIteratorFn.js +1 -0
  51. package/lib/instantiateReactComponent.js +8 -7
  52. package/lib/isTextInputElement.js +11 -1
  53. package/lib/reactProdInvariant.js +1 -0
  54. package/package.json +1 -1
package/lib/accumulate.js CHANGED
@@ -7,6 +7,7 @@
7
7
  * of patent rights can be found in the PATENTS file in the same directory.
8
8
  *
9
9
  * @providesModule accumulate
10
+ *
10
11
  */
11
12
 
12
13
  'use strict';
@@ -24,23 +25,22 @@ var invariant = require('fbjs/lib/invariant');
24
25
  */
25
26
  function accumulate(current, next) {
26
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
+
27
29
  if (current == null) {
28
30
  return next;
29
- } else {
30
- // Both are not empty. Warning: Never call x.concat(y) when you are not
31
- // certain that x is an Array (x could be a string with concat method).
32
- var currentIsArray = Array.isArray(current);
33
- var nextIsArray = Array.isArray(next);
34
- if (currentIsArray) {
35
- return current.concat(next);
36
- } else {
37
- if (nextIsArray) {
38
- return [current].concat(next);
39
- } else {
40
- return [current, next];
41
- }
42
- }
43
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
44
  }
45
45
 
46
46
  module.exports = accumulate;
@@ -7,6 +7,7 @@
7
7
  * of patent rights can be found in the PATENTS file in the same directory.
8
8
  *
9
9
  * @providesModule accumulateInto
10
+ *
10
11
  */
11
12
 
12
13
  'use strict';
@@ -16,7 +17,6 @@ var _prodInvariant = require('./reactProdInvariant');
16
17
  var invariant = require('fbjs/lib/invariant');
17
18
 
18
19
  /**
19
- *
20
20
  * Accumulates items that must not be null or undefined into the first one. This
21
21
  * is used to conserve memory by avoiding array allocations, and thus sacrifices
22
22
  * API cleanness. Since `current` can be null before being passed in and not
@@ -31,26 +31,23 @@ var invariant = require('fbjs/lib/invariant');
31
31
 
32
32
  function accumulateInto(current, next) {
33
33
  !(next != null) ? process.env.NODE_ENV !== 'production' ? invariant(false, 'accumulateInto(...): Accumulated items must not be null or undefined.') : _prodInvariant('30') : void 0;
34
+
34
35
  if (current == null) {
35
36
  return next;
36
37
  }
37
38
 
38
39
  // Both are not empty. Warning: Never call x.concat(y) when you are not
39
40
  // certain that x is an Array (x could be a string with concat method).
40
- var currentIsArray = Array.isArray(current);
41
- var nextIsArray = Array.isArray(next);
42
-
43
- if (currentIsArray && nextIsArray) {
44
- current.push.apply(current, next);
45
- return current;
46
- }
47
-
48
- if (currentIsArray) {
41
+ if (Array.isArray(current)) {
42
+ if (Array.isArray(next)) {
43
+ current.push.apply(current, next);
44
+ return current;
45
+ }
49
46
  current.push(next);
50
47
  return current;
51
48
  }
52
49
 
53
- if (nextIsArray) {
50
+ if (Array.isArray(next)) {
54
51
  // A bit too dangerous to mutate `next`.
55
52
  return [current].concat(next);
56
53
  }
package/lib/adler32.js CHANGED
@@ -7,6 +7,7 @@
7
7
  * of patent rights can be found in the PATENTS file in the same directory.
8
8
  *
9
9
  * @providesModule adler32
10
+ *
10
11
  */
11
12
 
12
13
  'use strict';
@@ -13,7 +13,6 @@
13
13
 
14
14
  var _prodInvariant = require('./reactProdInvariant');
15
15
 
16
- var ReactComponentTreeDevtool = require('./ReactComponentTreeDevtool');
17
16
  var ReactPropTypeLocationNames = require('./ReactPropTypeLocationNames');
18
17
 
19
18
  var invariant = require('fbjs/lib/invariant');
@@ -56,10 +55,13 @@ function checkReactTypeSpec(typeSpecs, values, location, componentName, element,
56
55
 
57
56
  var componentStackInfo = '';
58
57
 
59
- if (debugID !== null) {
60
- componentStackInfo = ReactComponentTreeDevtool.getStackAddendumByID(debugID);
61
- } else if (element !== null) {
62
- componentStackInfo = ReactComponentTreeDevtool.getCurrentStackAddendum(element);
58
+ if (process.env.NODE_ENV !== 'production') {
59
+ var ReactComponentTreeDevtool = require('./ReactComponentTreeDevtool');
60
+ if (debugID !== null) {
61
+ componentStackInfo = ReactComponentTreeDevtool.getStackAddendumByID(debugID);
62
+ } else if (element !== null) {
63
+ componentStackInfo = ReactComponentTreeDevtool.getCurrentStackAddendum(element);
64
+ }
63
65
  }
64
66
 
65
67
  process.env.NODE_ENV !== 'production' ? warning(false, 'Failed %s type: %s%s', location, error.message, componentStackInfo) : void 0;
package/lib/deprecated.js CHANGED
@@ -7,6 +7,7 @@
7
7
  * of patent rights can be found in the PATENTS file in the same directory.
8
8
  *
9
9
  * @providesModule deprecated
10
+ *
10
11
  */
11
12
 
12
13
  'use strict';
@@ -42,7 +43,12 @@ function deprecated(fnName, newModule, newPackage, ctx, fn) {
42
43
  };
43
44
  // We need to make sure all properties of the original fn are copied over.
44
45
  // In particular, this is needed to support PropTypes
45
- return _assign(newFn, fn);
46
+ _assign(newFn, fn);
47
+
48
+ // Flow is not smart enough to figure out that newFn is of the same type as
49
+ // fn. Since we don't want to lose out the type of the function, casting
50
+ // to any and force flow to use T.
51
+ return newFn;
46
52
  }
47
53
 
48
54
  return fn;
@@ -7,11 +7,11 @@
7
7
  * of patent rights can be found in the PATENTS file in the same directory.
8
8
  *
9
9
  * @providesModule flattenChildren
10
+ *
10
11
  */
11
12
 
12
13
  'use strict';
13
14
 
14
- var ReactComponentTreeDevtool = require('./ReactComponentTreeDevtool');
15
15
  var KeyEscapeUtils = require('./KeyEscapeUtils');
16
16
  var traverseAllChildren = require('./traverseAllChildren');
17
17
  var warning = require('fbjs/lib/warning');
@@ -24,13 +24,16 @@ var warning = require('fbjs/lib/warning');
24
24
  */
25
25
  function flattenSingleChildIntoContext(traverseContext, child, name, selfDebugID) {
26
26
  // We found a component instance.
27
- var result = traverseContext;
28
- var keyUnique = result[name] === undefined;
29
- if (process.env.NODE_ENV !== 'production') {
30
- process.env.NODE_ENV !== 'production' ? warning(keyUnique, 'flattenChildren(...): Encountered two children with the same key, ' + '`%s`. Child keys must be unique; when two children share a key, only ' + 'the first child will be used.%s', KeyEscapeUtils.unescape(name), ReactComponentTreeDevtool.getStackAddendumByID(selfDebugID)) : void 0;
31
- }
32
- if (keyUnique && child != null) {
33
- result[name] = child;
27
+ if (traverseContext && typeof traverseContext === 'object') {
28
+ var result = traverseContext;
29
+ var keyUnique = result[name] === undefined;
30
+ if (process.env.NODE_ENV !== 'production') {
31
+ var ReactComponentTreeDevtool = require('./ReactComponentTreeDevtool');
32
+ process.env.NODE_ENV !== 'production' ? warning(keyUnique, 'flattenChildren(...): Encountered two children with the same key, ' + '`%s`. Child keys must be unique; when two children share a key, only ' + 'the first child will be used.%s', KeyEscapeUtils.unescape(name), ReactComponentTreeDevtool.getStackAddendumByID(selfDebugID)) : void 0;
33
+ }
34
+ if (keyUnique && child != null) {
35
+ result[name] = child;
36
+ }
34
37
  }
35
38
  }
36
39
 
@@ -7,6 +7,7 @@
7
7
  * of patent rights can be found in the PATENTS file in the same directory.
8
8
  *
9
9
  * @providesModule forEachAccumulated
10
+ *
10
11
  */
11
12
 
12
13
  'use strict';
@@ -19,12 +20,12 @@
19
20
  * allocate an array).
20
21
  */
21
22
 
22
- var forEachAccumulated = function (arr, cb, scope) {
23
+ function forEachAccumulated(arr, cb, scope) {
23
24
  if (Array.isArray(arr)) {
24
25
  arr.forEach(cb, scope);
25
26
  } else if (arr) {
26
27
  cb.call(scope, arr);
27
28
  }
28
- };
29
+ }
29
30
 
30
31
  module.exports = forEachAccumulated;
@@ -7,6 +7,7 @@
7
7
  * of patent rights can be found in the PATENTS file in the same directory.
8
8
  *
9
9
  * @providesModule getIteratorFn
10
+ *
10
11
  */
11
12
 
12
13
  'use strict';
@@ -72,14 +72,14 @@ var nextDebugID = 1;
72
72
  * Given a ReactNode, create an instance that will actually be mounted.
73
73
  *
74
74
  * @param {ReactNode} node
75
+ * @param {boolean} shouldHaveDebugID
75
76
  * @return {object} A new instance of the element's constructor.
76
77
  * @protected
77
78
  */
78
- function instantiateReactComponent(node) {
79
+ function instantiateReactComponent(node, shouldHaveDebugID) {
79
80
  var instance;
80
81
 
81
- var isEmpty = node === null || node === false;
82
- if (isEmpty) {
82
+ if (node === null || node === false) {
83
83
  instance = ReactEmptyComponent.create(instantiateReactComponent);
84
84
  } else if (typeof node === 'object') {
85
85
  var element = node;
@@ -118,16 +118,17 @@ function instantiateReactComponent(node) {
118
118
  instance._mountImage = null;
119
119
 
120
120
  if (process.env.NODE_ENV !== 'production') {
121
- var debugID = isEmpty ? 0 : nextDebugID++;
122
- instance._debugID = debugID;
123
-
124
- if (debugID !== 0) {
121
+ if (shouldHaveDebugID) {
122
+ var debugID = nextDebugID++;
123
+ instance._debugID = debugID;
125
124
  var displayName = getDisplayName(instance);
126
125
  ReactInstrumentation.debugTool.onSetDisplayName(debugID, displayName);
127
126
  var owner = node && node._owner;
128
127
  if (owner) {
129
128
  ReactInstrumentation.debugTool.onSetOwner(debugID, owner._debugID);
130
129
  }
130
+ } else {
131
+ instance._debugID = 0;
131
132
  }
132
133
  }
133
134
 
@@ -7,6 +7,7 @@
7
7
  * of patent rights can be found in the PATENTS file in the same directory.
8
8
  *
9
9
  * @providesModule isTextInputElement
10
+ *
10
11
  */
11
12
 
12
13
  'use strict';
@@ -35,7 +36,16 @@ var supportedInputTypes = {
35
36
 
36
37
  function isTextInputElement(elem) {
37
38
  var nodeName = elem && elem.nodeName && elem.nodeName.toLowerCase();
38
- return nodeName && (nodeName === 'input' && supportedInputTypes[elem.type] || nodeName === 'textarea');
39
+
40
+ if (nodeName === 'input') {
41
+ return !!supportedInputTypes[elem.type];
42
+ }
43
+
44
+ if (nodeName === 'textarea') {
45
+ return true;
46
+ }
47
+
48
+ return false;
39
49
  }
40
50
 
41
51
  module.exports = isTextInputElement;
@@ -7,6 +7,7 @@
7
7
  * of patent rights can be found in the PATENTS file in the same directory.
8
8
  *
9
9
  * @providesModule reactProdInvariant
10
+ *
10
11
  */
11
12
  'use strict';
12
13
 
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "react",
3
3
  "description": "React is a JavaScript library for building user interfaces.",
4
- "version": "15.2.0",
4
+ "version": "15.2.1",
5
5
  "keywords": [
6
6
  "react"
7
7
  ],