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.
Files changed (63) hide show
  1. package/LICENSE +26 -16
  2. package/PATENTS +33 -0
  3. package/README.md +7 -0
  4. package/dist/react-with-addons.js +3772 -4326
  5. package/dist/react-with-addons.min.js +12 -6
  6. package/dist/react.js +2798 -3167
  7. package/dist/react.min.js +12 -5
  8. package/lib/KeyEscapeUtils.js +5 -3
  9. package/lib/PooledClass.js +5 -3
  10. package/lib/React.js +11 -46
  11. package/lib/ReactAddonsDOMDependencies.js +5 -3
  12. package/lib/ReactAddonsDOMDependenciesUMDShim.js +5 -3
  13. package/lib/ReactBaseClasses.js +9 -13
  14. package/lib/ReactCSSTransitionGroup.js +9 -9
  15. package/lib/ReactCSSTransitionGroupChild.js +118 -134
  16. package/lib/ReactChildren.js +9 -7
  17. package/lib/ReactClass.js +704 -0
  18. package/lib/ReactComponentTreeHook.js +63 -58
  19. package/lib/ReactComponentTreeHookUMDShim.js +5 -3
  20. package/lib/ReactComponentWithPureRenderMixin.js +5 -3
  21. package/lib/ReactCurrentOwner.js +7 -3
  22. package/lib/ReactCurrentOwnerUMDShim.js +5 -3
  23. package/lib/ReactDOMFactories.js +6 -3
  24. package/lib/ReactElement.js +9 -7
  25. package/lib/ReactElementSymbol.js +5 -3
  26. package/lib/ReactElementType.js +5 -3
  27. package/lib/ReactElementValidator.js +15 -14
  28. package/lib/ReactFragment.js +5 -3
  29. package/lib/ReactNoopUpdateQueue.js +16 -17
  30. package/lib/ReactPropTypeLocationNames.js +5 -3
  31. package/lib/ReactPropTypeLocations.js +5 -3
  32. package/lib/ReactPropTypes.js +460 -7
  33. package/lib/ReactPropTypesSecret.js +5 -3
  34. package/lib/ReactStateSetters.js +5 -3
  35. package/lib/ReactTransitionChildMapping.js +5 -3
  36. package/lib/ReactTransitionEvents.js +5 -3
  37. package/lib/ReactTransitionGroup.js +8 -12
  38. package/lib/ReactTypeOfWork.js +26 -0
  39. package/lib/ReactUMDEntry.js +8 -7
  40. package/lib/ReactUMDShim.js +5 -3
  41. package/lib/ReactVersion.js +6 -4
  42. package/lib/ReactWithAddons.js +5 -5
  43. package/lib/ReactWithAddonsUMDEntry.js +8 -7
  44. package/lib/canDefineProperty.js +5 -3
  45. package/lib/checkReactTypeSpec.js +21 -7
  46. package/lib/deprecated.js +8 -6
  47. package/lib/flattenChildren.js +5 -3
  48. package/lib/getComponentName.js +35 -0
  49. package/lib/getIteratorFn.js +5 -3
  50. package/lib/getNextDebugID.js +5 -3
  51. package/lib/onlyChild.js +6 -4
  52. package/lib/reactProdInvariant.js +4 -2
  53. package/lib/shallowCompare.js +5 -3
  54. package/lib/sliceChildren.js +5 -3
  55. package/lib/traverseAllChildren.js +20 -29
  56. package/lib/update.js +5 -3
  57. package/package.json +4 -5
  58. package/lib/LinkedStateMixin.js +0 -32
  59. package/lib/ReactComponentTreeDevtool.js +0 -12
  60. package/lib/ReactLink.js +0 -47
  61. package/lib/createClass.js +0 -20
  62. package/lib/getNextDebugIDUMDShim.js +0 -15
  63. package/lib/lowPriorityWarning.js +0 -62
@@ -1,8 +1,10 @@
1
1
  /**
2
- * Copyright (c) 2013-present, Facebook, Inc.
2
+ * Copyright 2013-present, Facebook, Inc.
3
+ * All rights reserved.
3
4
  *
4
- * This source code is licensed under the MIT license found in 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 (c) 2013-present, Facebook, Inc.
2
+ * Copyright 2013-present, Facebook, Inc.
3
+ * All rights reserved.
3
4
  *
4
- * This source code is licensed under the MIT license found in 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 (c) 2013-present, Facebook, Inc.
2
+ * Copyright 2013-present, Facebook, Inc.
3
+ * All rights reserved.
3
4
  *
4
- * This source code is licensed under the MIT license found in 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 (c) 2013-present, Facebook, Inc.
2
+ * Copyright 2013-present, Facebook, Inc.
3
+ * All rights reserved.
3
4
  *
4
- * This source code is licensed under the MIT license found in 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 (c) 2013-present, Facebook, Inc.
2
+ * Copyright 2013-present, Facebook, Inc.
3
+ * All rights reserved.
3
4
  *
4
- * This source code is licensed under the MIT license found in 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
 
@@ -19,9 +21,6 @@ function _inherits(subClass, superClass) { if (typeof superClass !== "function"
19
21
  var React = require('./React');
20
22
  var ReactTransitionChildMapping = require('./ReactTransitionChildMapping');
21
23
 
22
- var propTypesFactory = require('prop-types/factory');
23
- var PropTypes = propTypesFactory(React.isValidElement);
24
-
25
24
  var emptyFunction = require('fbjs/lib/emptyFunction');
26
25
 
27
26
  /**
@@ -193,10 +192,7 @@ var ReactTransitionGroup = function (_React$Component) {
193
192
  // already been removed. In case you need this behavior you can provide
194
193
  // a childFactory function to wrap every child, even the ones that are
195
194
  // leaving.
196
- childrenToRender.push(React.cloneElement(this.props.childFactory(child), {
197
- ref: key,
198
- key: key
199
- }));
195
+ childrenToRender.push(React.cloneElement(this.props.childFactory(child), { ref: key, key: key }));
200
196
  }
201
197
  }
202
198
 
@@ -220,8 +216,8 @@ var ReactTransitionGroup = function (_React$Component) {
220
216
 
221
217
  ReactTransitionGroup.displayName = 'ReactTransitionGroup';
222
218
  ReactTransitionGroup.propTypes = {
223
- component: PropTypes.any,
224
- childFactory: PropTypes.func
219
+ component: React.PropTypes.any,
220
+ childFactory: React.PropTypes.func
225
221
  };
226
222
  ReactTransitionGroup.defaultProps = {
227
223
  component: 'span',
@@ -0,0 +1,26 @@
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
+
12
+ 'use strict';
13
+
14
+ module.exports = {
15
+ IndeterminateComponent: 0, // Before we know whether it is functional or class
16
+ FunctionalComponent: 1,
17
+ ClassComponent: 2,
18
+ HostRoot: 3, // Root of a host tree. Could be nested inside another node.
19
+ HostPortal: 4, // A subtree. Could be an entry point to a different renderer.
20
+ HostComponent: 5,
21
+ HostText: 6,
22
+ CoroutineComponent: 7,
23
+ CoroutineHandlerPhase: 8,
24
+ YieldComponent: 9,
25
+ Fragment: 10
26
+ };
@@ -1,8 +1,10 @@
1
1
  /**
2
- * Copyright (c) 2013-present, Facebook, Inc.
2
+ * Copyright 2013-present, Facebook, Inc.
3
+ * All rights reserved.
3
4
  *
4
- * This source code is licensed under the MIT license found in 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
 
@@ -13,17 +15,16 @@ var _assign = require('object-assign');
13
15
  var React = require('./React');
14
16
 
15
17
  // `version` will be added here by the React module.
16
- var ReactUMDEntry = _assign(React, {
18
+ var ReactUMDEntry = _assign({
17
19
  __SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED: {
18
20
  ReactCurrentOwner: require('./ReactCurrentOwner')
19
21
  }
20
- });
22
+ }, React);
21
23
 
22
24
  if (process.env.NODE_ENV !== 'production') {
23
25
  _assign(ReactUMDEntry.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED, {
24
26
  // ReactComponentTreeHook should not be included in production.
25
- ReactComponentTreeHook: require('./ReactComponentTreeHook'),
26
- getNextDebugID: require('./getNextDebugID')
27
+ ReactComponentTreeHook: require('./ReactComponentTreeHook')
27
28
  });
28
29
  }
29
30
 
@@ -1,8 +1,10 @@
1
1
  /**
2
- * Copyright (c) 2013-present, Facebook, Inc.
2
+ * Copyright 2013-present, Facebook, Inc.
3
+ * All rights reserved.
3
4
  *
4
- * This source code is licensed under the MIT license found in 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,11 +1,13 @@
1
1
  /**
2
- * Copyright (c) 2013-present, Facebook, Inc.
2
+ * Copyright 2013-present, Facebook, Inc.
3
+ * All rights reserved.
3
4
  *
4
- * This source code is licensed under the MIT license found in 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
 
9
11
  'use strict';
10
12
 
11
- module.exports = '15.6.2';
13
+ module.exports = '16.0.0-alpha.2';
@@ -1,14 +1,15 @@
1
1
  /**
2
- * Copyright (c) 2013-present, Facebook, Inc.
2
+ * Copyright 2013-present, Facebook, Inc.
3
+ * All rights reserved.
3
4
  *
4
- * This source code is licensed under the MIT license found in 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
 
9
11
  'use strict';
10
12
 
11
- var LinkedStateMixin = require('./LinkedStateMixin');
12
13
  var React = require('./React');
13
14
  var ReactAddonsDOMDependencies = require('./ReactAddonsDOMDependencies');
14
15
  var ReactComponentWithPureRenderMixin = require('./ReactComponentWithPureRenderMixin');
@@ -21,7 +22,6 @@ var update = require('./update');
21
22
 
22
23
  React.addons = {
23
24
  CSSTransitionGroup: ReactCSSTransitionGroup,
24
- LinkedStateMixin: LinkedStateMixin,
25
25
  PureRenderMixin: ReactComponentWithPureRenderMixin,
26
26
  TransitionGroup: ReactTransitionGroup,
27
27
 
@@ -1,8 +1,10 @@
1
1
  /**
2
- * Copyright (c) 2013-present, Facebook, Inc.
2
+ * Copyright 2013-present, Facebook, Inc.
3
+ * All rights reserved.
3
4
  *
4
- * This source code is licensed under the MIT license found in 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
 
@@ -13,18 +15,17 @@ var _assign = require('object-assign');
13
15
  var ReactWithAddons = require('./ReactWithAddons');
14
16
 
15
17
  // `version` will be added here by the React module.
16
- var ReactWithAddonsUMDEntry = _assign(ReactWithAddons, {
18
+ var ReactWithAddonsUMDEntry = _assign({
17
19
  __SECRET_INJECTED_REACT_DOM_DO_NOT_USE_OR_YOU_WILL_BE_FIRED: null, // Will be injected by ReactDOM UMD build.
18
20
  __SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED: {
19
21
  ReactCurrentOwner: require('./ReactCurrentOwner')
20
22
  }
21
- });
23
+ }, ReactWithAddons);
22
24
 
23
25
  if (process.env.NODE_ENV !== 'production') {
24
26
  _assign(ReactWithAddonsUMDEntry.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED, {
25
27
  // ReactComponentTreeHook should not be included in production.
26
- ReactComponentTreeHook: require('./ReactComponentTreeHook'),
27
- getNextDebugID: require('./getNextDebugID')
28
+ ReactComponentTreeHook: require('./ReactComponentTreeHook')
28
29
  });
29
30
  }
30
31
 
@@ -1,8 +1,10 @@
1
1
  /**
2
- * Copyright (c) 2013-present, Facebook, Inc.
2
+ * Copyright 2013-present, Facebook, Inc.
3
+ * All rights reserved.
3
4
  *
4
- * This source code is licensed under the MIT license found in 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 (c) 2013-present, Facebook, Inc.
2
+ * Copyright 2013-present, Facebook, Inc.
3
+ * All rights reserved.
3
4
  *
4
- * This source code is licensed under the MIT license found in 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
 
@@ -38,10 +40,12 @@ var loggedTypeFailures = {};
38
40
  * @param {string} location e.g. "prop", "context", "child context"
39
41
  * @param {string} componentName Name of the component for error messages.
40
42
  * @param {?object} element The React element that is being type-checked
41
- * @param {?number} debugID The React component instance that is being type-checked
43
+ * @param {?number} workInProgressOrDebugID The React component instance that is being type-checked
42
44
  * @private
43
45
  */
44
- function checkReactTypeSpec(typeSpecs, values, location, componentName, element, debugID) {
46
+ function checkReactTypeSpec(typeSpecs, values, location, componentName, element,
47
+ // It is only safe to pass fiber if it is the work-in-progress version, and
48
+ workInProgressOrDebugID) {
45
49
  for (var typeSpecName in typeSpecs) {
46
50
  if (typeSpecs.hasOwnProperty(typeSpecName)) {
47
51
  var error;
@@ -68,8 +72,18 @@ function checkReactTypeSpec(typeSpecs, values, location, componentName, element,
68
72
  if (!ReactComponentTreeHook) {
69
73
  ReactComponentTreeHook = require('./ReactComponentTreeHook');
70
74
  }
71
- if (debugID !== null) {
72
- componentStackInfo = ReactComponentTreeHook.getStackAddendumByID(debugID);
75
+ if (workInProgressOrDebugID != null) {
76
+ if (typeof workInProgressOrDebugID === 'number') {
77
+ // DebugID from Stack.
78
+ var debugID = workInProgressOrDebugID;
79
+ componentStackInfo = ReactComponentTreeHook.getStackAddendumByID(debugID);
80
+ } else if (typeof workInProgressOrDebugID.tag === 'number') {
81
+ // This is a Fiber.
82
+ // The stack will only be correct if this is a work in progress
83
+ // version and we're calling it during reconciliation.
84
+ var workInProgress = workInProgressOrDebugID;
85
+ componentStackInfo = ReactComponentTreeHook.getStackAddendumByWorkInProgressFiber(workInProgress);
86
+ }
73
87
  } else if (element !== null) {
74
88
  componentStackInfo = ReactComponentTreeHook.getCurrentStackAddendum(element);
75
89
  }
package/lib/deprecated.js CHANGED
@@ -1,8 +1,10 @@
1
1
  /**
2
- * Copyright (c) 2013-present, Facebook, Inc.
2
+ * Copyright 2013-present, Facebook, Inc.
3
+ * All rights reserved.
3
4
  *
4
- * This source code is licensed under the MIT license found in 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
  */
@@ -11,7 +13,7 @@
11
13
 
12
14
  var _assign = require('object-assign');
13
15
 
14
- var lowPriorityWarning = require('./lowPriorityWarning');
16
+ var warning = require('fbjs/lib/warning');
15
17
 
16
18
  /**
17
19
  * This will log a single deprecation notice per function and forward the call
@@ -28,12 +30,12 @@ function deprecated(fnName, newModule, newPackage, ctx, fn) {
28
30
  var warned = false;
29
31
  if (process.env.NODE_ENV !== 'production') {
30
32
  var newFn = function () {
31
- lowPriorityWarning(warned,
33
+ process.env.NODE_ENV !== 'production' ? warning(warned,
32
34
  /* eslint-disable no-useless-concat */
33
35
  // Require examples in this string must be split to prevent React's
34
36
  // build tools from mistaking them for real requires.
35
37
  // Otherwise the build tools will attempt to build a '%s' module.
36
- 'React.%s is deprecated. Please use %s.%s from require' + "('%s') " + 'instead.', fnName, newModule, fnName, newPackage);
38
+ 'React.%s is deprecated. Please use %s.%s from require' + '(\'%s\') ' + 'instead.', fnName, newModule, fnName, newPackage) : void 0;
37
39
  /* eslint-enable no-useless-concat */
38
40
  warned = true;
39
41
  return fn.apply(ctx, arguments);
@@ -1,8 +1,10 @@
1
1
  /**
2
- * Copyright (c) 2013-present, Facebook, Inc.
2
+ * Copyright 2013-present, Facebook, Inc.
3
+ * All rights reserved.
3
4
  *
4
- * This source code is licensed under the MIT license found in 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
  */
@@ -0,0 +1,35 @@
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
+
12
+ 'use strict';
13
+
14
+ function getComponentName(instanceOrFiber) {
15
+ if (typeof instanceOrFiber.getName === 'function') {
16
+ // Stack reconciler
17
+ var instance = instanceOrFiber;
18
+ return instance.getName();
19
+ }
20
+ if (typeof instanceOrFiber.tag === 'number') {
21
+ // Fiber reconciler
22
+ var fiber = instanceOrFiber;
23
+ var type = fiber.type;
24
+
25
+ if (typeof type === 'string') {
26
+ return type;
27
+ }
28
+ if (typeof type === 'function') {
29
+ return type.displayName || type.name;
30
+ }
31
+ }
32
+ return null;
33
+ }
34
+
35
+ module.exports = getComponentName;
@@ -1,8 +1,10 @@
1
1
  /**
2
- * Copyright (c) 2013-present, Facebook, Inc.
2
+ * Copyright 2013-present, Facebook, Inc.
3
+ * All rights reserved.
3
4
  *
4
- * This source code is licensed under the MIT license found in 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 (c) 2013-present, Facebook, Inc.
2
+ * Copyright 2013-present, Facebook, Inc.
3
+ * All rights reserved.
3
4
  *
4
- * This source code is licensed under the MIT license found in 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
  */