react 15.6.2 → 16.0.0-alpha.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.
- package/LICENSE +26 -16
- package/PATENTS +33 -0
- package/README.md +7 -0
- package/dist/react-with-addons.js +3772 -4326
- package/dist/react-with-addons.min.js +12 -6
- package/dist/react.js +2798 -3167
- package/dist/react.min.js +12 -5
- package/lib/KeyEscapeUtils.js +5 -3
- package/lib/PooledClass.js +5 -3
- package/lib/React.js +11 -46
- package/lib/ReactAddonsDOMDependencies.js +5 -3
- package/lib/ReactAddonsDOMDependenciesUMDShim.js +5 -3
- package/lib/ReactBaseClasses.js +9 -13
- package/lib/ReactCSSTransitionGroup.js +9 -9
- package/lib/ReactCSSTransitionGroupChild.js +118 -134
- package/lib/ReactChildren.js +9 -7
- package/lib/ReactClass.js +704 -0
- package/lib/ReactComponentTreeHook.js +63 -58
- package/lib/ReactComponentTreeHookUMDShim.js +5 -3
- package/lib/ReactComponentWithPureRenderMixin.js +5 -3
- package/lib/ReactCurrentOwner.js +7 -3
- package/lib/ReactCurrentOwnerUMDShim.js +5 -3
- package/lib/ReactDOMFactories.js +6 -3
- package/lib/ReactElement.js +9 -7
- package/lib/ReactElementSymbol.js +5 -3
- package/lib/ReactElementType.js +5 -3
- package/lib/ReactElementValidator.js +15 -14
- package/lib/ReactFragment.js +5 -3
- package/lib/ReactNoopUpdateQueue.js +16 -17
- package/lib/ReactPropTypeLocationNames.js +5 -3
- package/lib/ReactPropTypeLocations.js +5 -3
- package/lib/ReactPropTypes.js +460 -7
- package/lib/ReactPropTypesSecret.js +5 -3
- package/lib/ReactStateSetters.js +5 -3
- package/lib/ReactTransitionChildMapping.js +5 -3
- package/lib/ReactTransitionEvents.js +5 -3
- package/lib/ReactTransitionGroup.js +8 -12
- package/lib/ReactTypeOfWork.js +26 -0
- package/lib/ReactUMDEntry.js +8 -7
- package/lib/ReactUMDShim.js +5 -3
- package/lib/ReactVersion.js +6 -4
- package/lib/ReactWithAddons.js +5 -5
- package/lib/ReactWithAddonsUMDEntry.js +8 -7
- package/lib/canDefineProperty.js +5 -3
- package/lib/checkReactTypeSpec.js +21 -7
- package/lib/deprecated.js +8 -6
- package/lib/flattenChildren.js +5 -3
- package/lib/getComponentName.js +35 -0
- package/lib/getIteratorFn.js +5 -3
- package/lib/getNextDebugID.js +5 -3
- package/lib/onlyChild.js +6 -4
- package/lib/reactProdInvariant.js +4 -2
- package/lib/shallowCompare.js +5 -3
- package/lib/sliceChildren.js +5 -3
- package/lib/traverseAllChildren.js +20 -29
- package/lib/update.js +5 -3
- package/package.json +4 -5
- package/lib/LinkedStateMixin.js +0 -32
- package/lib/ReactComponentTreeDevtool.js +0 -12
- package/lib/ReactLink.js +0 -47
- package/lib/createClass.js +0 -20
- package/lib/getNextDebugIDUMDShim.js +0 -15
- package/lib/lowPriorityWarning.js +0 -62
package/lib/onlyChild.js
CHANGED
|
@@ -1,8 +1,10 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* Copyright
|
|
2
|
+
* Copyright 2013-present, Facebook, Inc.
|
|
3
|
+
* All rights reserved.
|
|
3
4
|
*
|
|
4
|
-
* This source code is licensed under the
|
|
5
|
-
* LICENSE file in the root directory of this source tree.
|
|
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.
|
|
6
8
|
*
|
|
7
9
|
*/
|
|
8
10
|
'use strict';
|
|
@@ -17,7 +19,7 @@ var invariant = require('fbjs/lib/invariant');
|
|
|
17
19
|
* Returns the first child in a collection of children and verifies that there
|
|
18
20
|
* is only one child in the collection.
|
|
19
21
|
*
|
|
20
|
-
* See https://facebook.github.io/react/docs/
|
|
22
|
+
* See https://facebook.github.io/react/docs/react-api.html#react.children.only
|
|
21
23
|
*
|
|
22
24
|
* The current implementation of this function assumes that a single child gets
|
|
23
25
|
* passed without a wrapper, but the purpose of this helper function is to
|
|
@@ -1,8 +1,10 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Copyright (c) 2013-present, Facebook, Inc.
|
|
3
|
+
* All rights reserved.
|
|
3
4
|
*
|
|
4
|
-
* This source code is licensed under the
|
|
5
|
-
* LICENSE file in the root directory of this source tree.
|
|
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.
|
|
6
8
|
*
|
|
7
9
|
*
|
|
8
10
|
*/
|
package/lib/shallowCompare.js
CHANGED
|
@@ -1,8 +1,10 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* Copyright
|
|
2
|
+
* Copyright 2013-present, Facebook, Inc.
|
|
3
|
+
* All rights reserved.
|
|
3
4
|
*
|
|
4
|
-
* This source code is licensed under the
|
|
5
|
-
* LICENSE file in the root directory of this source tree.
|
|
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.
|
|
6
8
|
*
|
|
7
9
|
*/
|
|
8
10
|
|
package/lib/sliceChildren.js
CHANGED
|
@@ -1,8 +1,10 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* Copyright
|
|
2
|
+
* Copyright 2013-present, Facebook, Inc.
|
|
3
|
+
* All rights reserved.
|
|
3
4
|
*
|
|
4
|
-
* This source code is licensed under the
|
|
5
|
-
* LICENSE file in the root directory of this source tree.
|
|
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.
|
|
6
8
|
*
|
|
7
9
|
*/
|
|
8
10
|
|
|
@@ -1,8 +1,10 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* Copyright
|
|
2
|
+
* Copyright 2013-present, Facebook, Inc.
|
|
3
|
+
* All rights reserved.
|
|
3
4
|
*
|
|
4
|
-
* This source code is licensed under the
|
|
5
|
-
* LICENSE file in the root directory of this source tree.
|
|
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.
|
|
6
8
|
*
|
|
7
9
|
*/
|
|
8
10
|
|
|
@@ -93,48 +95,37 @@ function traverseAllChildrenImpl(children, nameSoFar, callback, traverseContext)
|
|
|
93
95
|
} else {
|
|
94
96
|
var iteratorFn = getIteratorFn(children);
|
|
95
97
|
if (iteratorFn) {
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
var ii = 0;
|
|
100
|
-
while (!(step = iterator.next()).done) {
|
|
101
|
-
child = step.value;
|
|
102
|
-
nextName = nextNamePrefix + getComponentKey(child, ii++);
|
|
103
|
-
subtreeCount += traverseAllChildrenImpl(child, nextName, callback, traverseContext);
|
|
104
|
-
}
|
|
105
|
-
} else {
|
|
106
|
-
if (process.env.NODE_ENV !== 'production') {
|
|
98
|
+
if (process.env.NODE_ENV !== 'production') {
|
|
99
|
+
// Warn about using Maps as children
|
|
100
|
+
if (iteratorFn === children.entries) {
|
|
107
101
|
var mapsAsChildrenAddendum = '';
|
|
108
102
|
if (ReactCurrentOwner.current) {
|
|
109
103
|
var mapsAsChildrenOwnerName = ReactCurrentOwner.current.getName();
|
|
110
104
|
if (mapsAsChildrenOwnerName) {
|
|
111
|
-
mapsAsChildrenAddendum = '
|
|
105
|
+
mapsAsChildrenAddendum = '\n\nCheck the render method of `' + mapsAsChildrenOwnerName + '`.';
|
|
112
106
|
}
|
|
113
107
|
}
|
|
114
|
-
process.env.NODE_ENV !== 'production' ? warning(didWarnAboutMaps, 'Using Maps as children is
|
|
108
|
+
process.env.NODE_ENV !== 'production' ? warning(didWarnAboutMaps, 'Using Maps as children is unsupported and will likely yield ' + 'unexpected results. Convert it to a sequence/iterable of keyed ' + 'ReactElements instead.%s', mapsAsChildrenAddendum) : void 0;
|
|
115
109
|
didWarnAboutMaps = true;
|
|
116
110
|
}
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
111
|
+
}
|
|
112
|
+
|
|
113
|
+
var iterator = iteratorFn.call(children);
|
|
114
|
+
var step;
|
|
115
|
+
var ii = 0;
|
|
116
|
+
while (!(step = iterator.next()).done) {
|
|
117
|
+
child = step.value;
|
|
118
|
+
nextName = nextNamePrefix + getComponentKey(child, ii++);
|
|
119
|
+
subtreeCount += traverseAllChildrenImpl(child, nextName, callback, traverseContext);
|
|
126
120
|
}
|
|
127
121
|
} else if (type === 'object') {
|
|
128
122
|
var addendum = '';
|
|
129
123
|
if (process.env.NODE_ENV !== 'production') {
|
|
130
124
|
addendum = ' If you meant to render a collection of children, use an array ' + 'instead or wrap the object using createFragment(object) from the ' + 'React add-ons.';
|
|
131
|
-
if (children._isReactElement) {
|
|
132
|
-
addendum = " It looks like you're using an element created by a different " + 'version of React. Make sure to use only one copy of React.';
|
|
133
|
-
}
|
|
134
125
|
if (ReactCurrentOwner.current) {
|
|
135
126
|
var name = ReactCurrentOwner.current.getName();
|
|
136
127
|
if (name) {
|
|
137
|
-
addendum += '
|
|
128
|
+
addendum += '\n\nCheck the render method of `' + name + '`.';
|
|
138
129
|
}
|
|
139
130
|
}
|
|
140
131
|
}
|
package/lib/update.js
CHANGED
|
@@ -1,8 +1,10 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* Copyright
|
|
2
|
+
* Copyright 2013-present, Facebook, Inc.
|
|
3
|
+
* All rights reserved.
|
|
3
4
|
*
|
|
4
|
-
* This source code is licensed under the
|
|
5
|
-
* LICENSE file in the root directory of this source tree.
|
|
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.
|
|
6
8
|
*
|
|
7
9
|
*/
|
|
8
10
|
|
package/package.json
CHANGED
|
@@ -1,15 +1,16 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "react",
|
|
3
3
|
"description": "React is a JavaScript library for building user interfaces.",
|
|
4
|
-
"version": "
|
|
4
|
+
"version": "16.0.0-alpha.2",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"react"
|
|
7
7
|
],
|
|
8
8
|
"homepage": "https://facebook.github.io/react/",
|
|
9
9
|
"bugs": "https://github.com/facebook/react/issues",
|
|
10
|
-
"license": "
|
|
10
|
+
"license": "BSD-3-Clause",
|
|
11
11
|
"files": [
|
|
12
12
|
"LICENSE",
|
|
13
|
+
"PATENTS",
|
|
13
14
|
"addons.js",
|
|
14
15
|
"react.js",
|
|
15
16
|
"addons/",
|
|
@@ -22,11 +23,9 @@
|
|
|
22
23
|
"node": ">=0.10.0"
|
|
23
24
|
},
|
|
24
25
|
"dependencies": {
|
|
25
|
-
"create-react-class": "^15.6.0",
|
|
26
26
|
"fbjs": "^0.8.9",
|
|
27
27
|
"loose-envify": "^1.1.0",
|
|
28
|
-
"object-assign": "^4.1.0"
|
|
29
|
-
"prop-types": "^15.5.10"
|
|
28
|
+
"object-assign": "^4.1.0"
|
|
30
29
|
},
|
|
31
30
|
"browserify": {
|
|
32
31
|
"transform": [
|
package/lib/LinkedStateMixin.js
DELETED
|
@@ -1,32 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Copyright (c) 2013-present, Facebook, Inc.
|
|
3
|
-
*
|
|
4
|
-
* This source code is licensed under the MIT license found in the
|
|
5
|
-
* LICENSE file in the root directory of this source tree.
|
|
6
|
-
*
|
|
7
|
-
*/
|
|
8
|
-
|
|
9
|
-
'use strict';
|
|
10
|
-
|
|
11
|
-
var ReactLink = require('./ReactLink');
|
|
12
|
-
var ReactStateSetters = require('./ReactStateSetters');
|
|
13
|
-
|
|
14
|
-
/**
|
|
15
|
-
* A simple mixin around ReactLink.forState().
|
|
16
|
-
* See https://facebook.github.io/react/docs/two-way-binding-helpers.html
|
|
17
|
-
*/
|
|
18
|
-
var LinkedStateMixin = {
|
|
19
|
-
/**
|
|
20
|
-
* Create a ReactLink that's linked to part of this component's state. The
|
|
21
|
-
* ReactLink will have the current value of this.state[key] and will call
|
|
22
|
-
* setState() when a change is requested.
|
|
23
|
-
*
|
|
24
|
-
* @param {string} key state key to update.
|
|
25
|
-
* @return {ReactLink} ReactLink instance linking to the state.
|
|
26
|
-
*/
|
|
27
|
-
linkState: function (key) {
|
|
28
|
-
return new ReactLink(this.state[key], ReactStateSetters.createStateKeySetter(this, key));
|
|
29
|
-
}
|
|
30
|
-
};
|
|
31
|
-
|
|
32
|
-
module.exports = LinkedStateMixin;
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Copyright (c) 2016-present, Facebook, Inc.
|
|
3
|
-
*
|
|
4
|
-
* This source code is licensed under the MIT license found in the
|
|
5
|
-
* LICENSE file in the root directory of this source tree.
|
|
6
|
-
*
|
|
7
|
-
*/
|
|
8
|
-
'use strict';
|
|
9
|
-
|
|
10
|
-
// TODO remove this proxy when RN/www gets updated
|
|
11
|
-
|
|
12
|
-
module.exports = require('./ReactComponentTreeHook');
|
package/lib/ReactLink.js
DELETED
|
@@ -1,47 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Copyright (c) 2013-present, Facebook, Inc.
|
|
3
|
-
*
|
|
4
|
-
* This source code is licensed under the MIT license found in the
|
|
5
|
-
* LICENSE file in the root directory of this source tree.
|
|
6
|
-
*
|
|
7
|
-
*/
|
|
8
|
-
|
|
9
|
-
'use strict';
|
|
10
|
-
|
|
11
|
-
/**
|
|
12
|
-
* ReactLink encapsulates a common pattern in which a component wants to modify
|
|
13
|
-
* a prop received from its parent. ReactLink allows the parent to pass down a
|
|
14
|
-
* value coupled with a callback that, when invoked, expresses an intent to
|
|
15
|
-
* modify that value. For example:
|
|
16
|
-
*
|
|
17
|
-
* React.createClass({
|
|
18
|
-
* getInitialState: function() {
|
|
19
|
-
* return {value: ''};
|
|
20
|
-
* },
|
|
21
|
-
* render: function() {
|
|
22
|
-
* var valueLink = new ReactLink(this.state.value, this._handleValueChange);
|
|
23
|
-
* return <input valueLink={valueLink} />;
|
|
24
|
-
* },
|
|
25
|
-
* _handleValueChange: function(newValue) {
|
|
26
|
-
* this.setState({value: newValue});
|
|
27
|
-
* }
|
|
28
|
-
* });
|
|
29
|
-
*
|
|
30
|
-
* We have provided some sugary mixins to make the creation and
|
|
31
|
-
* consumption of ReactLink easier; see LinkedValueUtils and LinkedStateMixin.
|
|
32
|
-
*/
|
|
33
|
-
|
|
34
|
-
/**
|
|
35
|
-
* Deprecated: An an easy way to express two-way binding with React.
|
|
36
|
-
* See https://facebook.github.io/react/docs/two-way-binding-helpers.html
|
|
37
|
-
*
|
|
38
|
-
* @param {*} value current value of the link
|
|
39
|
-
* @param {function} requestChange callback to request a change
|
|
40
|
-
*/
|
|
41
|
-
|
|
42
|
-
function ReactLink(value, requestChange) {
|
|
43
|
-
this.value = value;
|
|
44
|
-
this.requestChange = requestChange;
|
|
45
|
-
}
|
|
46
|
-
|
|
47
|
-
module.exports = ReactLink;
|
package/lib/createClass.js
DELETED
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Copyright (c) 2013-present, Facebook, Inc.
|
|
3
|
-
*
|
|
4
|
-
* This source code is licensed under the MIT license found in the
|
|
5
|
-
* LICENSE file in the root directory of this source tree.
|
|
6
|
-
*
|
|
7
|
-
*/
|
|
8
|
-
|
|
9
|
-
'use strict';
|
|
10
|
-
|
|
11
|
-
var _require = require('./ReactBaseClasses'),
|
|
12
|
-
Component = _require.Component;
|
|
13
|
-
|
|
14
|
-
var _require2 = require('./ReactElement'),
|
|
15
|
-
isValidElement = _require2.isValidElement;
|
|
16
|
-
|
|
17
|
-
var ReactNoopUpdateQueue = require('./ReactNoopUpdateQueue');
|
|
18
|
-
var factory = require('create-react-class/factory');
|
|
19
|
-
|
|
20
|
-
module.exports = factory(Component, isValidElement, ReactNoopUpdateQueue);
|
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Copyright (c) 2013-present, Facebook, Inc.
|
|
3
|
-
*
|
|
4
|
-
* This source code is licensed under the MIT license found in the
|
|
5
|
-
* LICENSE file in the root directory of this source tree.
|
|
6
|
-
*
|
|
7
|
-
*/
|
|
8
|
-
|
|
9
|
-
/* globals React */
|
|
10
|
-
|
|
11
|
-
'use strict';
|
|
12
|
-
|
|
13
|
-
var ReactInternals = React.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED;
|
|
14
|
-
|
|
15
|
-
module.exports = ReactInternals.getNextDebugID;
|
|
@@ -1,62 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Copyright (c) 2014-present, Facebook, Inc.
|
|
3
|
-
*
|
|
4
|
-
* This source code is licensed under the MIT license found in the
|
|
5
|
-
* LICENSE file in the root directory of this source tree.
|
|
6
|
-
*
|
|
7
|
-
*/
|
|
8
|
-
|
|
9
|
-
'use strict';
|
|
10
|
-
|
|
11
|
-
/**
|
|
12
|
-
* Forked from fbjs/warning:
|
|
13
|
-
* https://github.com/facebook/fbjs/blob/e66ba20ad5be433eb54423f2b097d829324d9de6/packages/fbjs/src/__forks__/warning.js
|
|
14
|
-
*
|
|
15
|
-
* Only change is we use console.warn instead of console.error,
|
|
16
|
-
* and do nothing when 'console' is not supported.
|
|
17
|
-
* This really simplifies the code.
|
|
18
|
-
* ---
|
|
19
|
-
* Similar to invariant but only logs a warning if the condition is not met.
|
|
20
|
-
* This can be used to log issues in development environments in critical
|
|
21
|
-
* paths. Removing the logging code for production environments will keep the
|
|
22
|
-
* same logic and follow the same code paths.
|
|
23
|
-
*/
|
|
24
|
-
|
|
25
|
-
var lowPriorityWarning = function () {};
|
|
26
|
-
|
|
27
|
-
if (process.env.NODE_ENV !== 'production') {
|
|
28
|
-
var printWarning = function (format) {
|
|
29
|
-
for (var _len = arguments.length, args = Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {
|
|
30
|
-
args[_key - 1] = arguments[_key];
|
|
31
|
-
}
|
|
32
|
-
|
|
33
|
-
var argIndex = 0;
|
|
34
|
-
var message = 'Warning: ' + format.replace(/%s/g, function () {
|
|
35
|
-
return args[argIndex++];
|
|
36
|
-
});
|
|
37
|
-
if (typeof console !== 'undefined') {
|
|
38
|
-
console.warn(message);
|
|
39
|
-
}
|
|
40
|
-
try {
|
|
41
|
-
// --- Welcome to debugging React ---
|
|
42
|
-
// This error was thrown as a convenience so that you can use this stack
|
|
43
|
-
// to find the callsite that caused this warning to fire.
|
|
44
|
-
throw new Error(message);
|
|
45
|
-
} catch (x) {}
|
|
46
|
-
};
|
|
47
|
-
|
|
48
|
-
lowPriorityWarning = function (condition, format) {
|
|
49
|
-
if (format === undefined) {
|
|
50
|
-
throw new Error('`warning(condition, format, ...args)` requires a warning ' + 'message argument');
|
|
51
|
-
}
|
|
52
|
-
if (!condition) {
|
|
53
|
-
for (var _len2 = arguments.length, args = Array(_len2 > 2 ? _len2 - 2 : 0), _key2 = 2; _key2 < _len2; _key2++) {
|
|
54
|
-
args[_key2 - 2] = arguments[_key2];
|
|
55
|
-
}
|
|
56
|
-
|
|
57
|
-
printWarning.apply(undefined, [format].concat(args));
|
|
58
|
-
}
|
|
59
|
-
};
|
|
60
|
-
}
|
|
61
|
-
|
|
62
|
-
module.exports = lowPriorityWarning;
|