react 16.0.0-alpha.2 → 16.0.0-alpha.6
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.js +330 -295
- package/dist/react.min.js +3 -3
- package/lib/React.js +4 -14
- package/lib/ReactClass.js +5 -11
- package/lib/ReactComponentTreeHook.js +8 -47
- package/lib/ReactCurrentOwner.js +0 -2
- package/lib/ReactDebugCurrentFrame.js +55 -0
- package/lib/ReactElementValidator.js +44 -21
- package/lib/ReactFiberComponentTreeHook.js +62 -0
- package/lib/ReactNoopUpdateQueue.js +0 -1
- package/lib/ReactPropTypes.js +12 -23
- package/lib/ReactVersion.js +1 -1
- package/lib/checkPropTypes.js +64 -0
- package/lib/checkReactTypeSpec.js +5 -81
- package/lib/deprecated.js +1 -1
- package/lib/traverseAllChildren.js +2 -2
- package/package.json +1 -1
- package/dist/react-with-addons.js +0 -5323
- package/dist/react-with-addons.min.js +0 -17
- package/lib/ReactAddonsDOMDependencies.js +0 -36
- package/lib/ReactAddonsDOMDependenciesUMDShim.js +0 -35
- package/lib/ReactCSSTransitionGroup.js +0 -104
- package/lib/ReactCSSTransitionGroupChild.js +0 -166
- package/lib/ReactComponentWithPureRenderMixin.js +0 -47
- package/lib/ReactFragment.js +0 -68
- package/lib/ReactPropTypeLocationNames.js +0 -24
- package/lib/ReactPropTypeLocations.js +0 -12
- package/lib/ReactStateSetters.js +0 -103
- package/lib/ReactTransitionChildMapping.js +0 -102
- package/lib/ReactTransitionEvents.js +0 -72
- package/lib/ReactTransitionGroup.js +0 -228
- package/lib/ReactWithAddons.js +0 -50
- package/lib/ReactWithAddonsUMDEntry.js +0 -32
- package/lib/shallowCompare.js +0 -24
- package/lib/sliceChildren.js +0 -33
- package/lib/update.js +0 -111
package/lib/ReactWithAddons.js
DELETED
|
@@ -1,50 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Copyright 2013-present, Facebook, Inc.
|
|
3
|
-
* All rights reserved.
|
|
4
|
-
*
|
|
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.
|
|
8
|
-
*
|
|
9
|
-
*/
|
|
10
|
-
|
|
11
|
-
'use strict';
|
|
12
|
-
|
|
13
|
-
var React = require('./React');
|
|
14
|
-
var ReactAddonsDOMDependencies = require('./ReactAddonsDOMDependencies');
|
|
15
|
-
var ReactComponentWithPureRenderMixin = require('./ReactComponentWithPureRenderMixin');
|
|
16
|
-
var ReactCSSTransitionGroup = require('./ReactCSSTransitionGroup');
|
|
17
|
-
var ReactFragment = require('./ReactFragment');
|
|
18
|
-
var ReactTransitionGroup = require('./ReactTransitionGroup');
|
|
19
|
-
|
|
20
|
-
var shallowCompare = require('./shallowCompare');
|
|
21
|
-
var update = require('./update');
|
|
22
|
-
|
|
23
|
-
React.addons = {
|
|
24
|
-
CSSTransitionGroup: ReactCSSTransitionGroup,
|
|
25
|
-
PureRenderMixin: ReactComponentWithPureRenderMixin,
|
|
26
|
-
TransitionGroup: ReactTransitionGroup,
|
|
27
|
-
|
|
28
|
-
createFragment: ReactFragment.create,
|
|
29
|
-
shallowCompare: shallowCompare,
|
|
30
|
-
update: update
|
|
31
|
-
};
|
|
32
|
-
|
|
33
|
-
if (process.env.NODE_ENV !== 'production') {
|
|
34
|
-
// For the UMD build we get these lazily from the global since they're tied
|
|
35
|
-
// to the DOM renderer and it hasn't loaded yet.
|
|
36
|
-
Object.defineProperty(React.addons, 'Perf', {
|
|
37
|
-
enumerable: true,
|
|
38
|
-
get: function () {
|
|
39
|
-
return ReactAddonsDOMDependencies.getReactPerf();
|
|
40
|
-
}
|
|
41
|
-
});
|
|
42
|
-
Object.defineProperty(React.addons, 'TestUtils', {
|
|
43
|
-
enumerable: true,
|
|
44
|
-
get: function () {
|
|
45
|
-
return ReactAddonsDOMDependencies.getReactTestUtils();
|
|
46
|
-
}
|
|
47
|
-
});
|
|
48
|
-
}
|
|
49
|
-
|
|
50
|
-
module.exports = React;
|
|
@@ -1,32 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Copyright 2013-present, Facebook, Inc.
|
|
3
|
-
* All rights reserved.
|
|
4
|
-
*
|
|
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.
|
|
8
|
-
*
|
|
9
|
-
*/
|
|
10
|
-
|
|
11
|
-
'use strict';
|
|
12
|
-
|
|
13
|
-
var _assign = require('object-assign');
|
|
14
|
-
|
|
15
|
-
var ReactWithAddons = require('./ReactWithAddons');
|
|
16
|
-
|
|
17
|
-
// `version` will be added here by the React module.
|
|
18
|
-
var ReactWithAddonsUMDEntry = _assign({
|
|
19
|
-
__SECRET_INJECTED_REACT_DOM_DO_NOT_USE_OR_YOU_WILL_BE_FIRED: null, // Will be injected by ReactDOM UMD build.
|
|
20
|
-
__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED: {
|
|
21
|
-
ReactCurrentOwner: require('./ReactCurrentOwner')
|
|
22
|
-
}
|
|
23
|
-
}, ReactWithAddons);
|
|
24
|
-
|
|
25
|
-
if (process.env.NODE_ENV !== 'production') {
|
|
26
|
-
_assign(ReactWithAddonsUMDEntry.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED, {
|
|
27
|
-
// ReactComponentTreeHook should not be included in production.
|
|
28
|
-
ReactComponentTreeHook: require('./ReactComponentTreeHook')
|
|
29
|
-
});
|
|
30
|
-
}
|
|
31
|
-
|
|
32
|
-
module.exports = ReactWithAddonsUMDEntry;
|
package/lib/shallowCompare.js
DELETED
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Copyright 2013-present, Facebook, Inc.
|
|
3
|
-
* All rights reserved.
|
|
4
|
-
*
|
|
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.
|
|
8
|
-
*
|
|
9
|
-
*/
|
|
10
|
-
|
|
11
|
-
'use strict';
|
|
12
|
-
|
|
13
|
-
var shallowEqual = require('fbjs/lib/shallowEqual');
|
|
14
|
-
|
|
15
|
-
/**
|
|
16
|
-
* Does a shallow comparison for props and state.
|
|
17
|
-
* See ReactComponentWithPureRenderMixin
|
|
18
|
-
* See also https://facebook.github.io/react/docs/shallow-compare.html
|
|
19
|
-
*/
|
|
20
|
-
function shallowCompare(instance, nextProps, nextState) {
|
|
21
|
-
return !shallowEqual(instance.props, nextProps) || !shallowEqual(instance.state, nextState);
|
|
22
|
-
}
|
|
23
|
-
|
|
24
|
-
module.exports = shallowCompare;
|
package/lib/sliceChildren.js
DELETED
|
@@ -1,33 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Copyright 2013-present, Facebook, Inc.
|
|
3
|
-
* All rights reserved.
|
|
4
|
-
*
|
|
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.
|
|
8
|
-
*
|
|
9
|
-
*/
|
|
10
|
-
|
|
11
|
-
'use strict';
|
|
12
|
-
|
|
13
|
-
var ReactChildren = require('./ReactChildren');
|
|
14
|
-
|
|
15
|
-
/**
|
|
16
|
-
* Slice children that are typically specified as `props.children`. This version
|
|
17
|
-
* of slice children ignores empty child components.
|
|
18
|
-
*
|
|
19
|
-
* @param {*} children The children set to filter.
|
|
20
|
-
* @param {number} start The first zero-based index to include in the subset.
|
|
21
|
-
* @param {?number} end The non-inclusive last index of the subset.
|
|
22
|
-
* @return {object} mirrored array with mapped children
|
|
23
|
-
*/
|
|
24
|
-
function sliceChildren(children, start, end) {
|
|
25
|
-
if (children == null) {
|
|
26
|
-
return children;
|
|
27
|
-
}
|
|
28
|
-
|
|
29
|
-
var array = ReactChildren.toArray(children);
|
|
30
|
-
return array.slice(start, end);
|
|
31
|
-
}
|
|
32
|
-
|
|
33
|
-
module.exports = sliceChildren;
|
package/lib/update.js
DELETED
|
@@ -1,111 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Copyright 2013-present, Facebook, Inc.
|
|
3
|
-
* All rights reserved.
|
|
4
|
-
*
|
|
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.
|
|
8
|
-
*
|
|
9
|
-
*/
|
|
10
|
-
|
|
11
|
-
/* global hasOwnProperty:true */
|
|
12
|
-
|
|
13
|
-
'use strict';
|
|
14
|
-
|
|
15
|
-
var _prodInvariant = require('./reactProdInvariant'),
|
|
16
|
-
_assign = require('object-assign');
|
|
17
|
-
|
|
18
|
-
var invariant = require('fbjs/lib/invariant');
|
|
19
|
-
var hasOwnProperty = {}.hasOwnProperty;
|
|
20
|
-
|
|
21
|
-
function shallowCopy(x) {
|
|
22
|
-
if (Array.isArray(x)) {
|
|
23
|
-
return x.concat();
|
|
24
|
-
} else if (x && typeof x === 'object') {
|
|
25
|
-
return _assign(new x.constructor(), x);
|
|
26
|
-
} else {
|
|
27
|
-
return x;
|
|
28
|
-
}
|
|
29
|
-
}
|
|
30
|
-
|
|
31
|
-
var COMMAND_PUSH = '$push';
|
|
32
|
-
var COMMAND_UNSHIFT = '$unshift';
|
|
33
|
-
var COMMAND_SPLICE = '$splice';
|
|
34
|
-
var COMMAND_SET = '$set';
|
|
35
|
-
var COMMAND_MERGE = '$merge';
|
|
36
|
-
var COMMAND_APPLY = '$apply';
|
|
37
|
-
|
|
38
|
-
var ALL_COMMANDS_LIST = [COMMAND_PUSH, COMMAND_UNSHIFT, COMMAND_SPLICE, COMMAND_SET, COMMAND_MERGE, COMMAND_APPLY];
|
|
39
|
-
|
|
40
|
-
var ALL_COMMANDS_SET = {};
|
|
41
|
-
|
|
42
|
-
ALL_COMMANDS_LIST.forEach(function (command) {
|
|
43
|
-
ALL_COMMANDS_SET[command] = true;
|
|
44
|
-
});
|
|
45
|
-
|
|
46
|
-
function invariantArrayCase(value, spec, command) {
|
|
47
|
-
!Array.isArray(value) ? process.env.NODE_ENV !== 'production' ? invariant(false, 'update(): expected target of %s to be an array; got %s.', command, value) : _prodInvariant('1', command, value) : void 0;
|
|
48
|
-
var specValue = spec[command];
|
|
49
|
-
!Array.isArray(specValue) ? process.env.NODE_ENV !== 'production' ? invariant(false, 'update(): expected spec of %s to be an array; got %s. Did you forget to wrap your parameter in an array?', command, specValue) : _prodInvariant('2', command, specValue) : void 0;
|
|
50
|
-
}
|
|
51
|
-
|
|
52
|
-
/**
|
|
53
|
-
* Returns a updated shallow copy of an object without mutating the original.
|
|
54
|
-
* See https://facebook.github.io/react/docs/update.html for details.
|
|
55
|
-
*/
|
|
56
|
-
function update(value, spec) {
|
|
57
|
-
!(typeof spec === 'object') ? process.env.NODE_ENV !== 'production' ? invariant(false, 'update(): You provided a key path to update() that did not contain one of %s. Did you forget to include {%s: ...}?', ALL_COMMANDS_LIST.join(', '), COMMAND_SET) : _prodInvariant('3', ALL_COMMANDS_LIST.join(', '), COMMAND_SET) : void 0;
|
|
58
|
-
|
|
59
|
-
if (hasOwnProperty.call(spec, COMMAND_SET)) {
|
|
60
|
-
!(Object.keys(spec).length === 1) ? process.env.NODE_ENV !== 'production' ? invariant(false, 'Cannot have more than one key in an object with %s', COMMAND_SET) : _prodInvariant('4', COMMAND_SET) : void 0;
|
|
61
|
-
|
|
62
|
-
return spec[COMMAND_SET];
|
|
63
|
-
}
|
|
64
|
-
|
|
65
|
-
var nextValue = shallowCopy(value);
|
|
66
|
-
|
|
67
|
-
if (hasOwnProperty.call(spec, COMMAND_MERGE)) {
|
|
68
|
-
var mergeObj = spec[COMMAND_MERGE];
|
|
69
|
-
!(mergeObj && typeof mergeObj === 'object') ? process.env.NODE_ENV !== 'production' ? invariant(false, 'update(): %s expects a spec of type \'object\'; got %s', COMMAND_MERGE, mergeObj) : _prodInvariant('5', COMMAND_MERGE, mergeObj) : void 0;
|
|
70
|
-
!(nextValue && typeof nextValue === 'object') ? process.env.NODE_ENV !== 'production' ? invariant(false, 'update(): %s expects a target of type \'object\'; got %s', COMMAND_MERGE, nextValue) : _prodInvariant('6', COMMAND_MERGE, nextValue) : void 0;
|
|
71
|
-
_assign(nextValue, spec[COMMAND_MERGE]);
|
|
72
|
-
}
|
|
73
|
-
|
|
74
|
-
if (hasOwnProperty.call(spec, COMMAND_PUSH)) {
|
|
75
|
-
invariantArrayCase(value, spec, COMMAND_PUSH);
|
|
76
|
-
spec[COMMAND_PUSH].forEach(function (item) {
|
|
77
|
-
nextValue.push(item);
|
|
78
|
-
});
|
|
79
|
-
}
|
|
80
|
-
|
|
81
|
-
if (hasOwnProperty.call(spec, COMMAND_UNSHIFT)) {
|
|
82
|
-
invariantArrayCase(value, spec, COMMAND_UNSHIFT);
|
|
83
|
-
spec[COMMAND_UNSHIFT].forEach(function (item) {
|
|
84
|
-
nextValue.unshift(item);
|
|
85
|
-
});
|
|
86
|
-
}
|
|
87
|
-
|
|
88
|
-
if (hasOwnProperty.call(spec, COMMAND_SPLICE)) {
|
|
89
|
-
!Array.isArray(value) ? process.env.NODE_ENV !== 'production' ? invariant(false, 'Expected %s target to be an array; got %s', COMMAND_SPLICE, value) : _prodInvariant('7', COMMAND_SPLICE, value) : void 0;
|
|
90
|
-
!Array.isArray(spec[COMMAND_SPLICE]) ? process.env.NODE_ENV !== 'production' ? invariant(false, 'update(): expected spec of %s to be an array of arrays; got %s. Did you forget to wrap your parameters in an array?', COMMAND_SPLICE, spec[COMMAND_SPLICE]) : _prodInvariant('8', COMMAND_SPLICE, spec[COMMAND_SPLICE]) : void 0;
|
|
91
|
-
spec[COMMAND_SPLICE].forEach(function (args) {
|
|
92
|
-
!Array.isArray(args) ? process.env.NODE_ENV !== 'production' ? invariant(false, 'update(): expected spec of %s to be an array of arrays; got %s. Did you forget to wrap your parameters in an array?', COMMAND_SPLICE, spec[COMMAND_SPLICE]) : _prodInvariant('8', COMMAND_SPLICE, spec[COMMAND_SPLICE]) : void 0;
|
|
93
|
-
nextValue.splice.apply(nextValue, args);
|
|
94
|
-
});
|
|
95
|
-
}
|
|
96
|
-
|
|
97
|
-
if (hasOwnProperty.call(spec, COMMAND_APPLY)) {
|
|
98
|
-
!(typeof spec[COMMAND_APPLY] === 'function') ? process.env.NODE_ENV !== 'production' ? invariant(false, 'update(): expected spec of %s to be a function; got %s.', COMMAND_APPLY, spec[COMMAND_APPLY]) : _prodInvariant('9', COMMAND_APPLY, spec[COMMAND_APPLY]) : void 0;
|
|
99
|
-
nextValue = spec[COMMAND_APPLY](nextValue);
|
|
100
|
-
}
|
|
101
|
-
|
|
102
|
-
for (var k in spec) {
|
|
103
|
-
if (!(ALL_COMMANDS_SET.hasOwnProperty(k) && ALL_COMMANDS_SET[k])) {
|
|
104
|
-
nextValue[k] = update(value[k], spec[k]);
|
|
105
|
-
}
|
|
106
|
-
}
|
|
107
|
-
|
|
108
|
-
return nextValue;
|
|
109
|
-
}
|
|
110
|
-
|
|
111
|
-
module.exports = update;
|