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.
- package/dist/react-with-addons.js +1099 -999
- package/dist/react-with-addons.min.js +6 -7
- package/dist/react.js +1034 -935
- package/dist/react.min.js +6 -6
- package/lib/DOMProperty.js +0 -9
- package/lib/DOMPropertyOperations.js +4 -12
- package/lib/Danger.js +0 -98
- package/lib/KeyEscapeUtils.js +2 -1
- package/lib/PooledClass.js +1 -1
- package/lib/ReactChildReconciler.js +3 -3
- package/lib/ReactComponentTreeDevtool.js +0 -5
- package/lib/ReactCompositeComponent.js +23 -13
- package/lib/ReactDOMComponent.js +1 -1
- package/lib/ReactDOMDebugTool.js +11 -11
- package/lib/ReactDOMFiber.js +78 -0
- package/lib/ReactDOMInput.js +17 -15
- package/lib/ReactDOMInstrumentation.js +7 -2
- package/lib/ReactDOMNullInputValuePropDevtool.js +43 -0
- package/lib/ReactDOMSelect.js +0 -13
- package/lib/ReactDOMTextarea.js +0 -14
- package/lib/ReactDebugTool.js +75 -83
- package/lib/ReactFeatureFlags.js +1 -0
- package/lib/ReactInstrumentation.js +7 -2
- package/lib/ReactMount.js +15 -17
- package/lib/ReactMultiChild.js +8 -3
- package/lib/ReactNativeMount.js +2 -13
- package/lib/ReactNativeReconcileTransaction.js +16 -0
- package/lib/ReactNodeTypes.js +1 -0
- package/lib/ReactNoop.js +100 -3
- package/lib/ReactNoopUpdateQueue.js +6 -5
- package/lib/ReactReconcileTransaction.js +16 -0
- package/lib/ReactServerRendering.js +1 -5
- package/lib/ReactServerRenderingTransaction.js +17 -0
- package/lib/ReactServerUpdateQueue.js +141 -0
- package/lib/ReactTestMount.js +1 -12
- package/lib/ReactTestReconcileTransaction.js +8 -0
- package/lib/ReactTransitionGroup.js +1 -0
- package/lib/ReactUpdateQueue.js +4 -2
- package/lib/ReactUpdates.js +1 -10
- package/lib/ReactVersion.js +1 -1
- package/lib/ResponderEventPlugin.js +1 -1
- package/lib/ResponderTouchHistoryStore.js +97 -95
- package/lib/accumulate.js +14 -14
- package/lib/accumulateInto.js +8 -11
- package/lib/adler32.js +1 -0
- package/lib/checkReactTypeSpec.js +7 -5
- package/lib/deprecated.js +7 -1
- package/lib/flattenChildren.js +11 -8
- package/lib/forEachAccumulated.js +3 -2
- package/lib/getIteratorFn.js +1 -0
- package/lib/instantiateReactComponent.js +8 -7
- package/lib/isTextInputElement.js +11 -1
- package/lib/reactProdInvariant.js +1 -0
- 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;
|
package/lib/accumulateInto.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 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
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
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 (
|
|
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
|
@@ -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 (
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
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
|
-
|
|
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;
|
package/lib/flattenChildren.js
CHANGED
|
@@ -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
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
process.env.NODE_ENV !== 'production'
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
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
|
-
|
|
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;
|
package/lib/getIteratorFn.js
CHANGED
|
@@ -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
|
-
|
|
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
|
-
|
|
122
|
-
|
|
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
|
-
|
|
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;
|