react 15.2.0-rc.2 → 15.3.0-rc.2

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 (73) hide show
  1. package/dist/react-with-addons.js +1506 -1128
  2. package/dist/react-with-addons.min.js +6 -7
  3. package/dist/react.js +1434 -1059
  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/EventPluginHub.js +14 -6
  9. package/lib/HTMLDOMPropertyConfig.js +1 -0
  10. package/lib/KeyEscapeUtils.js +2 -1
  11. package/lib/LinkedValueUtils.js +2 -1
  12. package/lib/NativeMethodsMixin.js +1 -1
  13. package/lib/PooledClass.js +1 -1
  14. package/lib/React.js +2 -0
  15. package/lib/ReactChildReconciler.js +8 -4
  16. package/lib/ReactChildrenMutationWarningDevtool.js +62 -0
  17. package/lib/ReactClass.js +7 -0
  18. package/lib/ReactComponentTreeDevtool.js +0 -5
  19. package/lib/ReactCompositeComponent.js +94 -33
  20. package/lib/ReactDOM.js +2 -2
  21. package/lib/ReactDOMComponent.js +23 -1
  22. package/lib/ReactDOMDebugTool.js +11 -11
  23. package/lib/ReactDOMFiber.js +78 -0
  24. package/lib/ReactDOMInput.js +21 -16
  25. package/lib/ReactDOMInstrumentation.js +7 -2
  26. package/lib/ReactDOMNullInputValuePropDevtool.js +43 -0
  27. package/lib/ReactDOMSelect.js +0 -13
  28. package/lib/ReactDOMTextarea.js +0 -14
  29. package/lib/ReactDebugTool.js +85 -83
  30. package/lib/ReactElement.js +8 -0
  31. package/lib/ReactFeatureFlags.js +1 -0
  32. package/lib/ReactInstrumentation.js +7 -2
  33. package/lib/ReactMount.js +15 -17
  34. package/lib/ReactMultiChild.js +19 -11
  35. package/lib/ReactNativeMount.js +2 -13
  36. package/lib/ReactNativeReconcileTransaction.js +16 -0
  37. package/lib/ReactNodeTypes.js +1 -0
  38. package/lib/ReactNoop.js +100 -3
  39. package/lib/ReactNoopUpdateQueue.js +6 -5
  40. package/lib/ReactPropTypes.js +24 -12
  41. package/lib/ReactPropTypesSecret.js +16 -0
  42. package/lib/ReactPureComponent.js +42 -0
  43. package/lib/ReactReconcileTransaction.js +16 -0
  44. package/lib/ReactReconciler.js +2 -4
  45. package/lib/ReactRef.js +3 -1
  46. package/lib/ReactServerRendering.js +9 -6
  47. package/lib/ReactServerRenderingTransaction.js +17 -0
  48. package/lib/ReactServerUpdateQueue.js +141 -0
  49. package/lib/ReactTestMount.js +29 -27
  50. package/lib/ReactTestReconcileTransaction.js +8 -0
  51. package/lib/ReactTestRenderer.js +11 -0
  52. package/lib/ReactTestUtils.js +2 -0
  53. package/lib/ReactTransitionGroup.js +1 -0
  54. package/lib/ReactUpdateQueue.js +4 -2
  55. package/lib/ReactUpdates.js +1 -10
  56. package/lib/ReactVersion.js +1 -1
  57. package/lib/ResponderEventPlugin.js +1 -1
  58. package/lib/ResponderTouchHistoryStore.js +97 -95
  59. package/lib/SVGDOMPropertyConfig.js +2 -0
  60. package/lib/SimpleEventPlugin.js +10 -6
  61. package/lib/accumulate.js +14 -14
  62. package/lib/accumulateInto.js +8 -11
  63. package/lib/adler32.js +1 -0
  64. package/lib/checkReactTypeSpec.js +9 -6
  65. package/lib/deprecated.js +7 -1
  66. package/lib/flattenChildren.js +11 -8
  67. package/lib/forEachAccumulated.js +3 -2
  68. package/lib/getIteratorFn.js +1 -0
  69. package/lib/instantiateReactComponent.js +8 -7
  70. package/lib/isTextInputElement.js +11 -1
  71. package/lib/reactProdInvariant.js +1 -0
  72. package/lib/traverseAllChildren.js +8 -1
  73. package/package.json +1 -1
@@ -263,6 +263,8 @@ var ATTRS = {
263
263
  xlinkTitle: 'xlink:title',
264
264
  xlinkType: 'xlink:type',
265
265
  xmlBase: 'xml:base',
266
+ xmlns: 0,
267
+ xmlnsXlink: 'xmlns:xlink',
266
268
  xmlLang: 'xml:lang',
267
269
  xmlSpace: 'xml:space',
268
270
  y: 0,
@@ -485,6 +485,10 @@ for (var type in topLevelEventsToDispatchConfig) {
485
485
  var ON_CLICK_KEY = keyOf({ onClick: null });
486
486
  var onClickListeners = {};
487
487
 
488
+ function getDictionaryKey(inst) {
489
+ return '.' + inst._rootNodeID;
490
+ }
491
+
488
492
  var SimpleEventPlugin = {
489
493
 
490
494
  eventTypes: eventTypes,
@@ -608,19 +612,19 @@ var SimpleEventPlugin = {
608
612
  // fire. The workaround for this bug involves attaching an empty click
609
613
  // listener on the target node.
610
614
  if (registrationName === ON_CLICK_KEY) {
611
- var id = inst._rootNodeID;
615
+ var key = getDictionaryKey(inst);
612
616
  var node = ReactDOMComponentTree.getNodeFromInstance(inst);
613
- if (!onClickListeners[id]) {
614
- onClickListeners[id] = EventListener.listen(node, 'click', emptyFunction);
617
+ if (!onClickListeners[key]) {
618
+ onClickListeners[key] = EventListener.listen(node, 'click', emptyFunction);
615
619
  }
616
620
  }
617
621
  },
618
622
 
619
623
  willDeleteListener: function (inst, registrationName) {
620
624
  if (registrationName === ON_CLICK_KEY) {
621
- var id = inst._rootNodeID;
622
- onClickListeners[id].remove();
623
- delete onClickListeners[id];
625
+ var key = getDictionaryKey(inst);
626
+ onClickListeners[key].remove();
627
+ delete onClickListeners[key];
624
628
  }
625
629
  }
626
630
 
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,8 +13,8 @@
13
13
 
14
14
  var _prodInvariant = require('./reactProdInvariant');
15
15
 
16
- var ReactComponentTreeDevtool = require('./ReactComponentTreeDevtool');
17
16
  var ReactPropTypeLocationNames = require('./ReactPropTypeLocationNames');
17
+ var ReactPropTypesSecret = require('./ReactPropTypesSecret');
18
18
 
19
19
  var invariant = require('fbjs/lib/invariant');
20
20
  var warning = require('fbjs/lib/warning');
@@ -44,7 +44,7 @@ function checkReactTypeSpec(typeSpecs, values, location, componentName, element,
44
44
  // This is intentionally an invariant that gets caught. It's the same
45
45
  // behavior as without this statement except with a better message.
46
46
  !(typeof typeSpecs[typeSpecName] === 'function') ? process.env.NODE_ENV !== 'production' ? invariant(false, '%s: %s type `%s` is invalid; it must be a function, usually from React.PropTypes.', componentName || 'React class', ReactPropTypeLocationNames[location], typeSpecName) : _prodInvariant('84', componentName || 'React class', ReactPropTypeLocationNames[location], typeSpecName) : void 0;
47
- error = typeSpecs[typeSpecName](values, typeSpecName, componentName, location);
47
+ error = typeSpecs[typeSpecName](values, typeSpecName, componentName, location, null, ReactPropTypesSecret);
48
48
  } catch (ex) {
49
49
  error = ex;
50
50
  }
@@ -56,10 +56,13 @@ function checkReactTypeSpec(typeSpecs, values, location, componentName, element,
56
56
 
57
57
  var componentStackInfo = '';
58
58
 
59
- if (debugID !== null) {
60
- componentStackInfo = ReactComponentTreeDevtool.getStackAddendumByID(debugID);
61
- } else if (element !== null) {
62
- componentStackInfo = ReactComponentTreeDevtool.getCurrentStackAddendum(element);
59
+ if (process.env.NODE_ENV !== 'production') {
60
+ var ReactComponentTreeDevtool = require('./ReactComponentTreeDevtool');
61
+ if (debugID !== null) {
62
+ componentStackInfo = ReactComponentTreeDevtool.getStackAddendumByID(debugID);
63
+ } else if (element !== null) {
64
+ componentStackInfo = ReactComponentTreeDevtool.getCurrentStackAddendum(element);
65
+ }
63
66
  }
64
67
 
65
68
  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
 
@@ -98,7 +98,14 @@ function traverseAllChildrenImpl(children, nameSoFar, callback, traverseContext)
98
98
  }
99
99
  } else {
100
100
  if (process.env.NODE_ENV !== 'production') {
101
- process.env.NODE_ENV !== 'production' ? warning(didWarnAboutMaps, 'Using Maps as children is not yet fully supported. It is an ' + 'experimental feature that might be removed. Convert it to a ' + 'sequence / iterable of keyed ReactElements instead.') : void 0;
101
+ var mapsAsChildrenAddendum = '';
102
+ if (ReactCurrentOwner.current) {
103
+ var mapsAsChildrenOwnerName = ReactCurrentOwner.current.getName();
104
+ if (mapsAsChildrenOwnerName) {
105
+ mapsAsChildrenAddendum = ' Check the render method of `' + mapsAsChildrenOwnerName + '`.';
106
+ }
107
+ }
108
+ process.env.NODE_ENV !== 'production' ? warning(didWarnAboutMaps, 'Using Maps as children is not yet fully supported. It is an ' + 'experimental feature that might be removed. Convert it to a ' + 'sequence / iterable of keyed ReactElements instead.%s', mapsAsChildrenAddendum) : void 0;
102
109
  didWarnAboutMaps = true;
103
110
  }
104
111
  // Iterator will provide entry [k,v] tuples rather than values.
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-rc.2",
4
+ "version": "15.3.0-rc.2",
5
5
  "keywords": [
6
6
  "react"
7
7
  ],