react 16.0.0-alpha.6 → 16.0.0-alpha.7

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 (43) hide show
  1. package/cjs/react.development.js +3268 -0
  2. package/cjs/react.production.min.js +1 -0
  3. package/index.js +7 -0
  4. package/package.json +7 -8
  5. package/{dist/react.js → umd/react.development.js} +2806 -3216
  6. package/umd/react.production.min.js +4 -0
  7. package/dist/react.min.js +0 -17
  8. package/lib/KeyEscapeUtils.js +0 -58
  9. package/lib/PooledClass.js +0 -111
  10. package/lib/React.js +0 -84
  11. package/lib/ReactBaseClasses.js +0 -136
  12. package/lib/ReactChildren.js +0 -190
  13. package/lib/ReactClass.js +0 -698
  14. package/lib/ReactComponentTreeHook.js +0 -342
  15. package/lib/ReactComponentTreeHookUMDShim.js +0 -17
  16. package/lib/ReactCurrentOwner.js +0 -28
  17. package/lib/ReactCurrentOwnerUMDShim.js +0 -17
  18. package/lib/ReactDOMFactories.js +0 -169
  19. package/lib/ReactDebugCurrentFrame.js +0 -55
  20. package/lib/ReactElement.js +0 -340
  21. package/lib/ReactElementSymbol.js +0 -19
  22. package/lib/ReactElementType.js +0 -12
  23. package/lib/ReactElementValidator.js +0 -276
  24. package/lib/ReactFiberComponentTreeHook.js +0 -62
  25. package/lib/ReactNoopUpdateQueue.js +0 -90
  26. package/lib/ReactPropTypes.js +0 -458
  27. package/lib/ReactPropTypesSecret.js +0 -16
  28. package/lib/ReactTypeOfWork.js +0 -26
  29. package/lib/ReactUMDEntry.js +0 -31
  30. package/lib/ReactUMDShim.js +0 -15
  31. package/lib/ReactVersion.js +0 -13
  32. package/lib/canDefineProperty.js +0 -25
  33. package/lib/checkPropTypes.js +0 -64
  34. package/lib/checkReactTypeSpec.js +0 -22
  35. package/lib/deprecated.js +0 -56
  36. package/lib/flattenChildren.js +0 -75
  37. package/lib/getComponentName.js +0 -35
  38. package/lib/getIteratorFn.js +0 -40
  39. package/lib/getNextDebugID.js +0 -20
  40. package/lib/onlyChild.js +0 -37
  41. package/lib/reactProdInvariant.js +0 -38
  42. package/lib/traverseAllChildren.js +0 -164
  43. package/react.js +0 -3
package/lib/onlyChild.js DELETED
@@ -1,37 +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
- 'use strict';
11
-
12
- var _prodInvariant = require('./reactProdInvariant');
13
-
14
- var ReactElement = require('./ReactElement');
15
-
16
- var invariant = require('fbjs/lib/invariant');
17
-
18
- /**
19
- * Returns the first child in a collection of children and verifies that there
20
- * is only one child in the collection.
21
- *
22
- * See https://facebook.github.io/react/docs/react-api.html#react.children.only
23
- *
24
- * The current implementation of this function assumes that a single child gets
25
- * passed without a wrapper, but the purpose of this helper function is to
26
- * abstract away the particular structure of children.
27
- *
28
- * @param {?object} children Child collection structure.
29
- * @return {ReactElement} The first and only `ReactElement` contained in the
30
- * structure.
31
- */
32
- function onlyChild(children) {
33
- !ReactElement.isValidElement(children) ? process.env.NODE_ENV !== 'production' ? invariant(false, 'React.Children.only expected to receive a single React element child.') : _prodInvariant('143') : void 0;
34
- return children;
35
- }
36
-
37
- module.exports = onlyChild;
@@ -1,38 +0,0 @@
1
- /**
2
- * Copyright (c) 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
- /**
14
- * WARNING: DO NOT manually require this module.
15
- * This is a replacement for `invariant(...)` used by the error code system
16
- * and will _only_ be required by the corresponding babel pass.
17
- * It always throws.
18
- */
19
-
20
- function reactProdInvariant(code) {
21
- var argCount = arguments.length - 1;
22
-
23
- var message = 'Minified React error #' + code + '; visit ' + 'http://facebook.github.io/react/docs/error-decoder.html?invariant=' + code;
24
-
25
- for (var argIdx = 0; argIdx < argCount; argIdx++) {
26
- message += '&args[]=' + encodeURIComponent(arguments[argIdx + 1]);
27
- }
28
-
29
- message += ' for the full message or use the non-minified dev environment' + ' for full errors and additional helpful warnings.';
30
-
31
- var error = new Error(message);
32
- error.name = 'Invariant Violation';
33
- error.framesToPop = 1; // we don't care about reactProdInvariant's own frame
34
-
35
- throw error;
36
- }
37
-
38
- module.exports = reactProdInvariant;
@@ -1,164 +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 _prodInvariant = require('./reactProdInvariant');
14
-
15
- var ReactCurrentOwner = require('./ReactCurrentOwner');
16
- var REACT_ELEMENT_TYPE = require('./ReactElementSymbol');
17
-
18
- var getIteratorFn = require('./getIteratorFn');
19
- var invariant = require('fbjs/lib/invariant');
20
- var KeyEscapeUtils = require('./KeyEscapeUtils');
21
- var warning = require('fbjs/lib/warning');
22
-
23
- var SEPARATOR = '.';
24
- var SUBSEPARATOR = ':';
25
-
26
- /**
27
- * This is inlined from ReactElement since this file is shared between
28
- * isomorphic and renderers. We could extract this to a
29
- *
30
- */
31
-
32
- /**
33
- * TODO: Test that a single child and an array with one item have the same key
34
- * pattern.
35
- */
36
-
37
- var didWarnAboutMaps = false;
38
-
39
- /**
40
- * Generate a key string that identifies a component within a set.
41
- *
42
- * @param {*} component A component that could contain a manual key.
43
- * @param {number} index Index that is used if a manual key is not provided.
44
- * @return {string}
45
- */
46
- function getComponentKey(component, index) {
47
- // Do some typechecking here since we call this blindly. We want to ensure
48
- // that we don't block potential future ES APIs.
49
- if (component && typeof component === 'object' && component.key != null) {
50
- // Explicit key
51
- return KeyEscapeUtils.escape(component.key);
52
- }
53
- // Implicit key determined by the index in the set
54
- return index.toString(36);
55
- }
56
-
57
- /**
58
- * @param {?*} children Children tree container.
59
- * @param {!string} nameSoFar Name of the key path so far.
60
- * @param {!function} callback Callback to invoke with each child found.
61
- * @param {?*} traverseContext Used to pass information throughout the traversal
62
- * process.
63
- * @return {!number} The number of children in this subtree.
64
- */
65
- function traverseAllChildrenImpl(children, nameSoFar, callback, traverseContext) {
66
- var type = typeof children;
67
-
68
- if (type === 'undefined' || type === 'boolean') {
69
- // All of the above are perceived as null.
70
- children = null;
71
- }
72
-
73
- if (children === null || type === 'string' || type === 'number' ||
74
- // The following is inlined from ReactElement. This means we can optimize
75
- // some checks. React Fiber also inlines this logic for similar purposes.
76
- type === 'object' && children.$$typeof === REACT_ELEMENT_TYPE) {
77
- callback(traverseContext, children,
78
- // If it's the only child, treat the name as if it was wrapped in an array
79
- // so that it's consistent if the number of children grows.
80
- nameSoFar === '' ? SEPARATOR + getComponentKey(children, 0) : nameSoFar);
81
- return 1;
82
- }
83
-
84
- var child;
85
- var nextName;
86
- var subtreeCount = 0; // Count of children found in the current subtree.
87
- var nextNamePrefix = nameSoFar === '' ? SEPARATOR : nameSoFar + SUBSEPARATOR;
88
-
89
- if (Array.isArray(children)) {
90
- for (var i = 0; i < children.length; i++) {
91
- child = children[i];
92
- nextName = nextNamePrefix + getComponentKey(child, i);
93
- subtreeCount += traverseAllChildrenImpl(child, nextName, callback, traverseContext);
94
- }
95
- } else {
96
- var iteratorFn = getIteratorFn(children);
97
- if (iteratorFn) {
98
- if (process.env.NODE_ENV !== 'production') {
99
- // Warn about using Maps as children
100
- if (iteratorFn === children.entries) {
101
- var mapsAsChildrenAddendum = '';
102
- if (ReactCurrentOwner.current) {
103
- var mapsAsChildrenOwnerName = ReactCurrentOwner.current.getName();
104
- if (mapsAsChildrenOwnerName) {
105
- mapsAsChildrenAddendum = '\n\nCheck the render method of `' + mapsAsChildrenOwnerName + '`.';
106
- }
107
- }
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;
109
- didWarnAboutMaps = true;
110
- }
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);
120
- }
121
- } else if (type === 'object') {
122
- var addendum = '';
123
- if (process.env.NODE_ENV !== 'production') {
124
- addendum = ' If you meant to render a collection of children, use an array ' + 'instead.';
125
- if (ReactCurrentOwner.current) {
126
- var name = ReactCurrentOwner.current.getName();
127
- if (name) {
128
- addendum += '\n\nCheck the render method of `' + name + '`.';
129
- }
130
- }
131
- }
132
- var childrenString = '' + children;
133
- !false ? process.env.NODE_ENV !== 'production' ? invariant(false, 'Objects are not valid as a React child (found: %s).%s', childrenString === '[object Object]' ? 'object with keys {' + Object.keys(children).join(', ') + '}' : childrenString, addendum) : _prodInvariant('31', childrenString === '[object Object]' ? 'object with keys {' + Object.keys(children).join(', ') + '}' : childrenString, addendum) : void 0;
134
- }
135
- }
136
-
137
- return subtreeCount;
138
- }
139
-
140
- /**
141
- * Traverses children that are typically specified as `props.children`, but
142
- * might also be specified through attributes:
143
- *
144
- * - `traverseAllChildren(this.props.children, ...)`
145
- * - `traverseAllChildren(this.props.leftPanelChildren, ...)`
146
- *
147
- * The `traverseContext` is an optional argument that is passed through the
148
- * entire traversal. It can be used to store accumulations or anything else that
149
- * the callback might find relevant.
150
- *
151
- * @param {?*} children Children tree object.
152
- * @param {!function} callback To invoke upon traversing each child.
153
- * @param {?*} traverseContext Context for traversal.
154
- * @return {!number} The number of children in this subtree.
155
- */
156
- function traverseAllChildren(children, callback, traverseContext) {
157
- if (children == null) {
158
- return 0;
159
- }
160
-
161
- return traverseAllChildrenImpl(children, '', callback, traverseContext);
162
- }
163
-
164
- module.exports = traverseAllChildren;
package/react.js DELETED
@@ -1,3 +0,0 @@
1
- 'use strict';
2
-
3
- module.exports = require('./lib/React');