react 16.0.0-alpha.4 → 16.0.0-alpha.8

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 (58) hide show
  1. package/README.md +0 -7
  2. package/{dist/react-with-addons.js → cjs/react.development.js} +1671 -3772
  3. package/cjs/react.production.min.js +1 -0
  4. package/index.js +7 -0
  5. package/package.json +7 -8
  6. package/{dist/react.js → umd/react.development.js} +2825 -3246
  7. package/umd/react.production.min.js +4 -0
  8. package/dist/react-with-addons.min.js +0 -17
  9. package/dist/react.min.js +0 -17
  10. package/lib/KeyEscapeUtils.js +0 -58
  11. package/lib/PooledClass.js +0 -111
  12. package/lib/React.js +0 -86
  13. package/lib/ReactAddonsDOMDependencies.js +0 -36
  14. package/lib/ReactAddonsDOMDependenciesUMDShim.js +0 -35
  15. package/lib/ReactBaseClasses.js +0 -136
  16. package/lib/ReactCSSTransitionGroup.js +0 -104
  17. package/lib/ReactCSSTransitionGroupChild.js +0 -166
  18. package/lib/ReactChildren.js +0 -190
  19. package/lib/ReactClass.js +0 -703
  20. package/lib/ReactComponentTreeHook.js +0 -342
  21. package/lib/ReactComponentTreeHookUMDShim.js +0 -17
  22. package/lib/ReactComponentWithPureRenderMixin.js +0 -47
  23. package/lib/ReactCurrentOwner.js +0 -30
  24. package/lib/ReactCurrentOwnerUMDShim.js +0 -17
  25. package/lib/ReactDOMFactories.js +0 -169
  26. package/lib/ReactDebugCurrentFrame.js +0 -55
  27. package/lib/ReactElement.js +0 -340
  28. package/lib/ReactElementSymbol.js +0 -19
  29. package/lib/ReactElementType.js +0 -12
  30. package/lib/ReactElementValidator.js +0 -271
  31. package/lib/ReactFiberComponentTreeHook.js +0 -62
  32. package/lib/ReactFragment.js +0 -68
  33. package/lib/ReactNoopUpdateQueue.js +0 -91
  34. package/lib/ReactPropTypes.js +0 -458
  35. package/lib/ReactPropTypesSecret.js +0 -16
  36. package/lib/ReactTransitionChildMapping.js +0 -102
  37. package/lib/ReactTransitionEvents.js +0 -72
  38. package/lib/ReactTransitionGroup.js +0 -228
  39. package/lib/ReactTypeOfWork.js +0 -26
  40. package/lib/ReactUMDEntry.js +0 -31
  41. package/lib/ReactUMDShim.js +0 -15
  42. package/lib/ReactVersion.js +0 -13
  43. package/lib/ReactWithAddons.js +0 -50
  44. package/lib/ReactWithAddonsUMDEntry.js +0 -32
  45. package/lib/canDefineProperty.js +0 -25
  46. package/lib/checkPropTypes.js +0 -64
  47. package/lib/checkReactTypeSpec.js +0 -22
  48. package/lib/deprecated.js +0 -56
  49. package/lib/flattenChildren.js +0 -75
  50. package/lib/getComponentName.js +0 -35
  51. package/lib/getIteratorFn.js +0 -40
  52. package/lib/getNextDebugID.js +0 -20
  53. package/lib/onlyChild.js +0 -37
  54. package/lib/reactProdInvariant.js +0 -38
  55. package/lib/shallowCompare.js +0 -24
  56. package/lib/traverseAllChildren.js +0 -164
  57. package/lib/update.js +0 -111
  58. package/react.js +0 -3
@@ -1,104 +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
- function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
16
-
17
- function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }
18
-
19
- function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }
20
-
21
- var React = require('./React');
22
-
23
- var ReactTransitionGroup = require('./ReactTransitionGroup');
24
- var ReactCSSTransitionGroupChild = require('./ReactCSSTransitionGroupChild');
25
-
26
- function createTransitionTimeoutPropValidator(transitionType) {
27
- var timeoutPropName = 'transition' + transitionType + 'Timeout';
28
- var enabledPropName = 'transition' + transitionType;
29
-
30
- return function (props) {
31
- // If the transition is enabled
32
- if (props[enabledPropName]) {
33
- // If no timeout duration is provided
34
- if (props[timeoutPropName] == null) {
35
- return new Error(timeoutPropName + ' wasn\'t supplied to ReactCSSTransitionGroup: ' + 'this can cause unreliable animations and won\'t be supported in ' + 'a future version of React. See ' + 'https://fb.me/react-animation-transition-group-timeout for more ' + 'information.');
36
-
37
- // If the duration isn't a number
38
- } else if (typeof props[timeoutPropName] !== 'number') {
39
- return new Error(timeoutPropName + ' must be a number (in milliseconds)');
40
- }
41
- }
42
- };
43
- }
44
-
45
- /**
46
- * An easy way to perform CSS transitions and animations when a React component
47
- * enters or leaves the DOM.
48
- * See https://facebook.github.io/react/docs/animation.html#high-level-api-reactcsstransitiongroup
49
- */
50
-
51
- var ReactCSSTransitionGroup = function (_React$Component) {
52
- _inherits(ReactCSSTransitionGroup, _React$Component);
53
-
54
- function ReactCSSTransitionGroup() {
55
- var _temp, _this, _ret;
56
-
57
- _classCallCheck(this, ReactCSSTransitionGroup);
58
-
59
- for (var _len = arguments.length, args = Array(_len), _key = 0; _key < _len; _key++) {
60
- args[_key] = arguments[_key];
61
- }
62
-
63
- return _ret = (_temp = (_this = _possibleConstructorReturn(this, _React$Component.call.apply(_React$Component, [this].concat(args))), _this), _this._wrapChild = function (child) {
64
- // We need to provide this childFactory so that
65
- // ReactCSSTransitionGroupChild can receive updates to name, enter, and
66
- // leave while it is leaving.
67
- return React.createElement(ReactCSSTransitionGroupChild, {
68
- name: _this.props.transitionName,
69
- appear: _this.props.transitionAppear,
70
- enter: _this.props.transitionEnter,
71
- leave: _this.props.transitionLeave,
72
- appearTimeout: _this.props.transitionAppearTimeout,
73
- enterTimeout: _this.props.transitionEnterTimeout,
74
- leaveTimeout: _this.props.transitionLeaveTimeout
75
- }, child);
76
- }, _temp), _possibleConstructorReturn(_this, _ret);
77
- }
78
-
79
- ReactCSSTransitionGroup.prototype.render = function render() {
80
- return React.createElement(ReactTransitionGroup, _assign({}, this.props, { childFactory: this._wrapChild }));
81
- };
82
-
83
- return ReactCSSTransitionGroup;
84
- }(React.Component);
85
-
86
- ReactCSSTransitionGroup.displayName = 'ReactCSSTransitionGroup';
87
- ReactCSSTransitionGroup.propTypes = {
88
- transitionName: ReactCSSTransitionGroupChild.propTypes.name,
89
-
90
- transitionAppear: React.PropTypes.bool,
91
- transitionEnter: React.PropTypes.bool,
92
- transitionLeave: React.PropTypes.bool,
93
- transitionAppearTimeout: createTransitionTimeoutPropValidator('Appear'),
94
- transitionEnterTimeout: createTransitionTimeoutPropValidator('Enter'),
95
- transitionLeaveTimeout: createTransitionTimeoutPropValidator('Leave')
96
- };
97
- ReactCSSTransitionGroup.defaultProps = {
98
- transitionAppear: false,
99
- transitionEnter: true,
100
- transitionLeave: true
101
- };
102
-
103
-
104
- module.exports = ReactCSSTransitionGroup;
@@ -1,166 +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
-
16
- var CSSCore = require('fbjs/lib/CSSCore');
17
- var ReactTransitionEvents = require('./ReactTransitionEvents');
18
-
19
- var onlyChild = require('./onlyChild');
20
-
21
- var TICK = 17;
22
-
23
- var ReactCSSTransitionGroupChild = React.createClass({
24
- displayName: 'ReactCSSTransitionGroupChild',
25
-
26
- propTypes: {
27
- name: React.PropTypes.oneOfType([React.PropTypes.string, React.PropTypes.shape({
28
- enter: React.PropTypes.string,
29
- leave: React.PropTypes.string,
30
- active: React.PropTypes.string
31
- }), React.PropTypes.shape({
32
- enter: React.PropTypes.string,
33
- enterActive: React.PropTypes.string,
34
- leave: React.PropTypes.string,
35
- leaveActive: React.PropTypes.string,
36
- appear: React.PropTypes.string,
37
- appearActive: React.PropTypes.string
38
- })]).isRequired,
39
-
40
- // Once we require timeouts to be specified, we can remove the
41
- // boolean flags (appear etc.) and just accept a number
42
- // or a bool for the timeout flags (appearTimeout etc.)
43
- appear: React.PropTypes.bool,
44
- enter: React.PropTypes.bool,
45
- leave: React.PropTypes.bool,
46
- appearTimeout: React.PropTypes.number,
47
- enterTimeout: React.PropTypes.number,
48
- leaveTimeout: React.PropTypes.number
49
- },
50
-
51
- transition: function (animationType, finishCallback, userSpecifiedDelay) {
52
- var node = ReactAddonsDOMDependencies.getReactDOM().findDOMNode(this);
53
-
54
- if (!node) {
55
- if (finishCallback) {
56
- finishCallback();
57
- }
58
- return;
59
- }
60
-
61
- var className = this.props.name[animationType] || this.props.name + '-' + animationType;
62
- var activeClassName = this.props.name[animationType + 'Active'] || className + '-active';
63
- var timeout = null;
64
-
65
- var endListener = function (e) {
66
- if (e && e.target !== node) {
67
- return;
68
- }
69
-
70
- clearTimeout(timeout);
71
-
72
- CSSCore.removeClass(node, className);
73
- CSSCore.removeClass(node, activeClassName);
74
-
75
- ReactTransitionEvents.removeEndEventListener(node, endListener);
76
-
77
- // Usually this optional callback is used for informing an owner of
78
- // a leave animation and telling it to remove the child.
79
- if (finishCallback) {
80
- finishCallback();
81
- }
82
- };
83
-
84
- CSSCore.addClass(node, className);
85
-
86
- // Need to do this to actually trigger a transition.
87
- this.queueClassAndNode(activeClassName, node);
88
-
89
- // If the user specified a timeout delay.
90
- if (userSpecifiedDelay) {
91
- // Clean-up the animation after the specified delay
92
- timeout = setTimeout(endListener, userSpecifiedDelay);
93
- this.transitionTimeouts.push(timeout);
94
- } else {
95
- // DEPRECATED: this listener will be removed in a future version of react
96
- ReactTransitionEvents.addEndEventListener(node, endListener);
97
- }
98
- },
99
-
100
- queueClassAndNode: function (className, node) {
101
- this.classNameAndNodeQueue.push({
102
- className: className,
103
- node: node
104
- });
105
-
106
- if (!this.timeout) {
107
- this.timeout = setTimeout(this.flushClassNameAndNodeQueue, TICK);
108
- }
109
- },
110
-
111
- flushClassNameAndNodeQueue: function () {
112
- if (this.isMounted()) {
113
- this.classNameAndNodeQueue.forEach(function (obj) {
114
- CSSCore.addClass(obj.node, obj.className);
115
- });
116
- }
117
- this.classNameAndNodeQueue.length = 0;
118
- this.timeout = null;
119
- },
120
-
121
- componentWillMount: function () {
122
- this.classNameAndNodeQueue = [];
123
- this.transitionTimeouts = [];
124
- },
125
-
126
- componentWillUnmount: function () {
127
- if (this.timeout) {
128
- clearTimeout(this.timeout);
129
- }
130
- this.transitionTimeouts.forEach(function (timeout) {
131
- clearTimeout(timeout);
132
- });
133
-
134
- this.classNameAndNodeQueue.length = 0;
135
- },
136
-
137
- componentWillAppear: function (done) {
138
- if (this.props.appear) {
139
- this.transition('appear', done, this.props.appearTimeout);
140
- } else {
141
- done();
142
- }
143
- },
144
-
145
- componentWillEnter: function (done) {
146
- if (this.props.enter) {
147
- this.transition('enter', done, this.props.enterTimeout);
148
- } else {
149
- done();
150
- }
151
- },
152
-
153
- componentWillLeave: function (done) {
154
- if (this.props.leave) {
155
- this.transition('leave', done, this.props.leaveTimeout);
156
- } else {
157
- done();
158
- }
159
- },
160
-
161
- render: function () {
162
- return onlyChild(this.props.children);
163
- }
164
- });
165
-
166
- module.exports = ReactCSSTransitionGroupChild;
@@ -1,190 +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 PooledClass = require('./PooledClass');
14
- var ReactElement = require('./ReactElement');
15
-
16
- var emptyFunction = require('fbjs/lib/emptyFunction');
17
- var traverseAllChildren = require('./traverseAllChildren');
18
-
19
- var twoArgumentPooler = PooledClass.twoArgumentPooler;
20
- var fourArgumentPooler = PooledClass.fourArgumentPooler;
21
-
22
- var userProvidedKeyEscapeRegex = /\/+/g;
23
- function escapeUserProvidedKey(text) {
24
- return ('' + text).replace(userProvidedKeyEscapeRegex, '$&/');
25
- }
26
-
27
- /**
28
- * PooledClass representing the bookkeeping associated with performing a child
29
- * traversal. Allows avoiding binding callbacks.
30
- *
31
- * @constructor ForEachBookKeeping
32
- * @param {!function} forEachFunction Function to perform traversal with.
33
- * @param {?*} forEachContext Context to perform context with.
34
- */
35
- function ForEachBookKeeping(forEachFunction, forEachContext) {
36
- this.func = forEachFunction;
37
- this.context = forEachContext;
38
- this.count = 0;
39
- }
40
- ForEachBookKeeping.prototype.destructor = function () {
41
- this.func = null;
42
- this.context = null;
43
- this.count = 0;
44
- };
45
- PooledClass.addPoolingTo(ForEachBookKeeping, twoArgumentPooler);
46
-
47
- function forEachSingleChild(bookKeeping, child, name) {
48
- var func = bookKeeping.func,
49
- context = bookKeeping.context;
50
-
51
- func.call(context, child, bookKeeping.count++);
52
- }
53
-
54
- /**
55
- * Iterates through children that are typically specified as `props.children`.
56
- *
57
- * See https://facebook.github.io/react/docs/react-api.html#react.children.foreach
58
- *
59
- * The provided forEachFunc(child, index) will be called for each
60
- * leaf child.
61
- *
62
- * @param {?*} children Children tree container.
63
- * @param {function(*, int)} forEachFunc
64
- * @param {*} forEachContext Context for forEachContext.
65
- */
66
- function forEachChildren(children, forEachFunc, forEachContext) {
67
- if (children == null) {
68
- return children;
69
- }
70
- var traverseContext = ForEachBookKeeping.getPooled(forEachFunc, forEachContext);
71
- traverseAllChildren(children, forEachSingleChild, traverseContext);
72
- ForEachBookKeeping.release(traverseContext);
73
- }
74
-
75
- /**
76
- * PooledClass representing the bookkeeping associated with performing a child
77
- * mapping. Allows avoiding binding callbacks.
78
- *
79
- * @constructor MapBookKeeping
80
- * @param {!*} mapResult Object containing the ordered map of results.
81
- * @param {!function} mapFunction Function to perform mapping with.
82
- * @param {?*} mapContext Context to perform mapping with.
83
- */
84
- function MapBookKeeping(mapResult, keyPrefix, mapFunction, mapContext) {
85
- this.result = mapResult;
86
- this.keyPrefix = keyPrefix;
87
- this.func = mapFunction;
88
- this.context = mapContext;
89
- this.count = 0;
90
- }
91
- MapBookKeeping.prototype.destructor = function () {
92
- this.result = null;
93
- this.keyPrefix = null;
94
- this.func = null;
95
- this.context = null;
96
- this.count = 0;
97
- };
98
- PooledClass.addPoolingTo(MapBookKeeping, fourArgumentPooler);
99
-
100
- function mapSingleChildIntoContext(bookKeeping, child, childKey) {
101
- var result = bookKeeping.result,
102
- keyPrefix = bookKeeping.keyPrefix,
103
- func = bookKeeping.func,
104
- context = bookKeeping.context;
105
-
106
-
107
- var mappedChild = func.call(context, child, bookKeeping.count++);
108
- if (Array.isArray(mappedChild)) {
109
- mapIntoWithKeyPrefixInternal(mappedChild, result, childKey, emptyFunction.thatReturnsArgument);
110
- } else if (mappedChild != null) {
111
- if (ReactElement.isValidElement(mappedChild)) {
112
- mappedChild = ReactElement.cloneAndReplaceKey(mappedChild,
113
- // Keep both the (mapped) and old keys if they differ, just as
114
- // traverseAllChildren used to do for objects as children
115
- keyPrefix + (mappedChild.key && (!child || child.key !== mappedChild.key) ? escapeUserProvidedKey(mappedChild.key) + '/' : '') + childKey);
116
- }
117
- result.push(mappedChild);
118
- }
119
- }
120
-
121
- function mapIntoWithKeyPrefixInternal(children, array, prefix, func, context) {
122
- var escapedPrefix = '';
123
- if (prefix != null) {
124
- escapedPrefix = escapeUserProvidedKey(prefix) + '/';
125
- }
126
- var traverseContext = MapBookKeeping.getPooled(array, escapedPrefix, func, context);
127
- traverseAllChildren(children, mapSingleChildIntoContext, traverseContext);
128
- MapBookKeeping.release(traverseContext);
129
- }
130
-
131
- /**
132
- * Maps children that are typically specified as `props.children`.
133
- *
134
- * See https://facebook.github.io/react/docs/react-api.html#react.children.map
135
- *
136
- * The provided mapFunction(child, key, index) will be called for each
137
- * leaf child.
138
- *
139
- * @param {?*} children Children tree container.
140
- * @param {function(*, int)} func The map function.
141
- * @param {*} context Context for mapFunction.
142
- * @return {object} Object containing the ordered map of results.
143
- */
144
- function mapChildren(children, func, context) {
145
- if (children == null) {
146
- return children;
147
- }
148
- var result = [];
149
- mapIntoWithKeyPrefixInternal(children, result, null, func, context);
150
- return result;
151
- }
152
-
153
- function forEachSingleChildDummy(traverseContext, child, name) {
154
- return null;
155
- }
156
-
157
- /**
158
- * Count the number of children that are typically specified as
159
- * `props.children`.
160
- *
161
- * See https://facebook.github.io/react/docs/react-api.html#react.children.count
162
- *
163
- * @param {?*} children Children tree container.
164
- * @return {number} The number of children.
165
- */
166
- function countChildren(children, context) {
167
- return traverseAllChildren(children, forEachSingleChildDummy, null);
168
- }
169
-
170
- /**
171
- * Flatten a children object (typically specified as `props.children`) and
172
- * return an array with appropriately re-keyed children.
173
- *
174
- * See https://facebook.github.io/react/docs/react-api.html#react.children.toarray
175
- */
176
- function toArray(children) {
177
- var result = [];
178
- mapIntoWithKeyPrefixInternal(children, result, null, emptyFunction.thatReturnsArgument);
179
- return result;
180
- }
181
-
182
- var ReactChildren = {
183
- forEach: forEachChildren,
184
- map: mapChildren,
185
- mapIntoWithKeyPrefixInternal: mapIntoWithKeyPrefixInternal,
186
- count: countChildren,
187
- toArray: toArray
188
- };
189
-
190
- module.exports = ReactChildren;