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.
- package/README.md +0 -7
- package/{dist/react-with-addons.js → cjs/react.development.js} +1671 -3772
- package/cjs/react.production.min.js +1 -0
- package/index.js +7 -0
- package/package.json +7 -8
- package/{dist/react.js → umd/react.development.js} +2825 -3246
- package/umd/react.production.min.js +4 -0
- package/dist/react-with-addons.min.js +0 -17
- package/dist/react.min.js +0 -17
- package/lib/KeyEscapeUtils.js +0 -58
- package/lib/PooledClass.js +0 -111
- package/lib/React.js +0 -86
- package/lib/ReactAddonsDOMDependencies.js +0 -36
- package/lib/ReactAddonsDOMDependenciesUMDShim.js +0 -35
- package/lib/ReactBaseClasses.js +0 -136
- package/lib/ReactCSSTransitionGroup.js +0 -104
- package/lib/ReactCSSTransitionGroupChild.js +0 -166
- package/lib/ReactChildren.js +0 -190
- package/lib/ReactClass.js +0 -703
- package/lib/ReactComponentTreeHook.js +0 -342
- package/lib/ReactComponentTreeHookUMDShim.js +0 -17
- package/lib/ReactComponentWithPureRenderMixin.js +0 -47
- package/lib/ReactCurrentOwner.js +0 -30
- package/lib/ReactCurrentOwnerUMDShim.js +0 -17
- package/lib/ReactDOMFactories.js +0 -169
- package/lib/ReactDebugCurrentFrame.js +0 -55
- package/lib/ReactElement.js +0 -340
- package/lib/ReactElementSymbol.js +0 -19
- package/lib/ReactElementType.js +0 -12
- package/lib/ReactElementValidator.js +0 -271
- package/lib/ReactFiberComponentTreeHook.js +0 -62
- package/lib/ReactFragment.js +0 -68
- package/lib/ReactNoopUpdateQueue.js +0 -91
- package/lib/ReactPropTypes.js +0 -458
- package/lib/ReactPropTypesSecret.js +0 -16
- package/lib/ReactTransitionChildMapping.js +0 -102
- package/lib/ReactTransitionEvents.js +0 -72
- package/lib/ReactTransitionGroup.js +0 -228
- package/lib/ReactTypeOfWork.js +0 -26
- package/lib/ReactUMDEntry.js +0 -31
- package/lib/ReactUMDShim.js +0 -15
- package/lib/ReactVersion.js +0 -13
- package/lib/ReactWithAddons.js +0 -50
- package/lib/ReactWithAddonsUMDEntry.js +0 -32
- package/lib/canDefineProperty.js +0 -25
- package/lib/checkPropTypes.js +0 -64
- package/lib/checkReactTypeSpec.js +0 -22
- package/lib/deprecated.js +0 -56
- package/lib/flattenChildren.js +0 -75
- package/lib/getComponentName.js +0 -35
- package/lib/getIteratorFn.js +0 -40
- package/lib/getNextDebugID.js +0 -20
- package/lib/onlyChild.js +0 -37
- package/lib/reactProdInvariant.js +0 -38
- package/lib/shallowCompare.js +0 -24
- package/lib/traverseAllChildren.js +0 -164
- package/lib/update.js +0 -111
- package/react.js +0 -3
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Copyright 2014-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
|
-
// The Symbol used to tag the ReactElement type. If there is no native Symbol
|
|
15
|
-
// nor polyfill, then a plain number is used for performance.
|
|
16
|
-
|
|
17
|
-
var REACT_ELEMENT_TYPE = typeof Symbol === 'function' && Symbol['for'] && Symbol['for']('react.element') || 0xeac7;
|
|
18
|
-
|
|
19
|
-
module.exports = REACT_ELEMENT_TYPE;
|
package/lib/ReactElementType.js
DELETED
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Copyright 2016-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';
|
|
@@ -1,271 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Copyright 2014-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
|
-
* ReactElementValidator provides a wrapper around a element factory
|
|
13
|
-
* which validates the props passed to the element. This is intended to be
|
|
14
|
-
* used only in DEV and could be replaced by a static type checker for languages
|
|
15
|
-
* that support it.
|
|
16
|
-
*/
|
|
17
|
-
|
|
18
|
-
'use strict';
|
|
19
|
-
|
|
20
|
-
var ReactCurrentOwner = require('./ReactCurrentOwner');
|
|
21
|
-
var ReactElement = require('./ReactElement');
|
|
22
|
-
|
|
23
|
-
var checkReactTypeSpec = require('./checkReactTypeSpec');
|
|
24
|
-
|
|
25
|
-
var canDefineProperty = require('./canDefineProperty');
|
|
26
|
-
var getComponentName = require('./getComponentName');
|
|
27
|
-
var getIteratorFn = require('./getIteratorFn');
|
|
28
|
-
|
|
29
|
-
if (process.env.NODE_ENV !== 'production') {
|
|
30
|
-
var warning = require('fbjs/lib/warning');
|
|
31
|
-
var ReactDebugCurrentFrame = require('./ReactDebugCurrentFrame');
|
|
32
|
-
|
|
33
|
-
var _require = require('./ReactComponentTreeHook'),
|
|
34
|
-
getCurrentStackAddendum = _require.getCurrentStackAddendum;
|
|
35
|
-
}
|
|
36
|
-
|
|
37
|
-
function getDeclarationErrorAddendum() {
|
|
38
|
-
if (ReactCurrentOwner.current) {
|
|
39
|
-
var name = getComponentName(ReactCurrentOwner.current);
|
|
40
|
-
if (name) {
|
|
41
|
-
return '\n\nCheck the render method of `' + name + '`.';
|
|
42
|
-
}
|
|
43
|
-
}
|
|
44
|
-
return '';
|
|
45
|
-
}
|
|
46
|
-
|
|
47
|
-
function getSourceInfoErrorAddendum(elementProps) {
|
|
48
|
-
if (elementProps !== null && elementProps !== undefined && elementProps.__source !== undefined) {
|
|
49
|
-
var source = elementProps.__source;
|
|
50
|
-
var fileName = source.fileName.replace(/^.*[\\\/]/, '');
|
|
51
|
-
var lineNumber = source.lineNumber;
|
|
52
|
-
return '\n\nCheck your code at ' + fileName + ':' + lineNumber + '.';
|
|
53
|
-
}
|
|
54
|
-
return '';
|
|
55
|
-
}
|
|
56
|
-
|
|
57
|
-
/**
|
|
58
|
-
* Warn if there's no key explicitly set on dynamic arrays of children or
|
|
59
|
-
* object keys are not valid. This allows us to keep track of children between
|
|
60
|
-
* updates.
|
|
61
|
-
*/
|
|
62
|
-
var ownerHasKeyUseWarning = {};
|
|
63
|
-
|
|
64
|
-
function getCurrentComponentErrorInfo(parentType) {
|
|
65
|
-
var info = getDeclarationErrorAddendum();
|
|
66
|
-
|
|
67
|
-
if (!info) {
|
|
68
|
-
var parentName = typeof parentType === 'string' ? parentType : parentType.displayName || parentType.name;
|
|
69
|
-
if (parentName) {
|
|
70
|
-
info = '\n\nCheck the top-level render call using <' + parentName + '>.';
|
|
71
|
-
}
|
|
72
|
-
}
|
|
73
|
-
return info;
|
|
74
|
-
}
|
|
75
|
-
|
|
76
|
-
/**
|
|
77
|
-
* Warn if the element doesn't have an explicit key assigned to it.
|
|
78
|
-
* This element is in an array. The array could grow and shrink or be
|
|
79
|
-
* reordered. All children that haven't already been validated are required to
|
|
80
|
-
* have a "key" property assigned to it. Error statuses are cached so a warning
|
|
81
|
-
* will only be shown once.
|
|
82
|
-
*
|
|
83
|
-
* @internal
|
|
84
|
-
* @param {ReactElement} element Element that requires a key.
|
|
85
|
-
* @param {*} parentType element's parent's type.
|
|
86
|
-
*/
|
|
87
|
-
function validateExplicitKey(element, parentType) {
|
|
88
|
-
if (!element._store || element._store.validated || element.key != null) {
|
|
89
|
-
return;
|
|
90
|
-
}
|
|
91
|
-
element._store.validated = true;
|
|
92
|
-
|
|
93
|
-
var memoizer = ownerHasKeyUseWarning.uniqueKey || (ownerHasKeyUseWarning.uniqueKey = {});
|
|
94
|
-
|
|
95
|
-
var currentComponentErrorInfo = getCurrentComponentErrorInfo(parentType);
|
|
96
|
-
if (memoizer[currentComponentErrorInfo]) {
|
|
97
|
-
return;
|
|
98
|
-
}
|
|
99
|
-
memoizer[currentComponentErrorInfo] = true;
|
|
100
|
-
|
|
101
|
-
// Usually the current owner is the offender, but if it accepts children as a
|
|
102
|
-
// property, it may be the creator of the child that's responsible for
|
|
103
|
-
// assigning it a key.
|
|
104
|
-
var childOwner = '';
|
|
105
|
-
if (element && element._owner && element._owner !== ReactCurrentOwner.current) {
|
|
106
|
-
// Give the component that originally created this child.
|
|
107
|
-
childOwner = ' It was passed a child from ' + getComponentName(element._owner) + '.';
|
|
108
|
-
}
|
|
109
|
-
|
|
110
|
-
process.env.NODE_ENV !== 'production' ? warning(false, 'Each child in an array or iterator should have a unique "key" prop.' + '%s%s See https://fb.me/react-warning-keys for more information.%s', currentComponentErrorInfo, childOwner, getCurrentStackAddendum(element)) : void 0;
|
|
111
|
-
}
|
|
112
|
-
|
|
113
|
-
/**
|
|
114
|
-
* Ensure that every element either is passed in a static location, in an
|
|
115
|
-
* array with an explicit keys property defined, or in an object literal
|
|
116
|
-
* with valid key property.
|
|
117
|
-
*
|
|
118
|
-
* @internal
|
|
119
|
-
* @param {ReactNode} node Statically passed child of any type.
|
|
120
|
-
* @param {*} parentType node's parent's type.
|
|
121
|
-
*/
|
|
122
|
-
function validateChildKeys(node, parentType) {
|
|
123
|
-
if (typeof node !== 'object') {
|
|
124
|
-
return;
|
|
125
|
-
}
|
|
126
|
-
if (Array.isArray(node)) {
|
|
127
|
-
for (var i = 0; i < node.length; i++) {
|
|
128
|
-
var child = node[i];
|
|
129
|
-
if (ReactElement.isValidElement(child)) {
|
|
130
|
-
validateExplicitKey(child, parentType);
|
|
131
|
-
}
|
|
132
|
-
}
|
|
133
|
-
} else if (ReactElement.isValidElement(node)) {
|
|
134
|
-
// This element was passed in a valid location.
|
|
135
|
-
if (node._store) {
|
|
136
|
-
node._store.validated = true;
|
|
137
|
-
}
|
|
138
|
-
} else if (node) {
|
|
139
|
-
var iteratorFn = getIteratorFn(node);
|
|
140
|
-
// Entry iterators provide implicit keys.
|
|
141
|
-
if (iteratorFn) {
|
|
142
|
-
if (iteratorFn !== node.entries) {
|
|
143
|
-
var iterator = iteratorFn.call(node);
|
|
144
|
-
var step;
|
|
145
|
-
while (!(step = iterator.next()).done) {
|
|
146
|
-
if (ReactElement.isValidElement(step.value)) {
|
|
147
|
-
validateExplicitKey(step.value, parentType);
|
|
148
|
-
}
|
|
149
|
-
}
|
|
150
|
-
}
|
|
151
|
-
}
|
|
152
|
-
}
|
|
153
|
-
}
|
|
154
|
-
|
|
155
|
-
/**
|
|
156
|
-
* Given an element, validate that its props follow the propTypes definition,
|
|
157
|
-
* provided by the type.
|
|
158
|
-
*
|
|
159
|
-
* @param {ReactElement} element
|
|
160
|
-
*/
|
|
161
|
-
function validatePropTypes(element) {
|
|
162
|
-
var componentClass = element.type;
|
|
163
|
-
if (typeof componentClass !== 'function') {
|
|
164
|
-
return;
|
|
165
|
-
}
|
|
166
|
-
var name = componentClass.displayName || componentClass.name;
|
|
167
|
-
if (componentClass.propTypes) {
|
|
168
|
-
checkReactTypeSpec(componentClass.propTypes, element.props, 'prop', name);
|
|
169
|
-
}
|
|
170
|
-
if (typeof componentClass.getDefaultProps === 'function') {
|
|
171
|
-
process.env.NODE_ENV !== 'production' ? warning(componentClass.getDefaultProps.isReactClassApproved, 'getDefaultProps is only used on classic React.createClass ' + 'definitions. Use a static property named `defaultProps` instead.') : void 0;
|
|
172
|
-
}
|
|
173
|
-
}
|
|
174
|
-
|
|
175
|
-
var ReactElementValidator = {
|
|
176
|
-
|
|
177
|
-
createElement: function (type, props, children) {
|
|
178
|
-
var validType = typeof type === 'string' || typeof type === 'function';
|
|
179
|
-
// We warn in this case but don't throw. We expect the element creation to
|
|
180
|
-
// succeed and there will likely be errors in render.
|
|
181
|
-
if (!validType) {
|
|
182
|
-
var info = '';
|
|
183
|
-
if (type === undefined || typeof type === 'object' && type !== null && Object.keys(type).length === 0) {
|
|
184
|
-
info += ' You likely forgot to export your component from the file ' + 'it\'s defined in.';
|
|
185
|
-
}
|
|
186
|
-
|
|
187
|
-
var sourceInfo = getSourceInfoErrorAddendum(props);
|
|
188
|
-
if (sourceInfo) {
|
|
189
|
-
info += sourceInfo;
|
|
190
|
-
} else {
|
|
191
|
-
info += getDeclarationErrorAddendum();
|
|
192
|
-
}
|
|
193
|
-
|
|
194
|
-
info += getCurrentStackAddendum();
|
|
195
|
-
|
|
196
|
-
process.env.NODE_ENV !== 'production' ? warning(false, 'React.createElement: type is invalid -- expected a string (for ' + 'built-in components) or a class/function (for composite ' + 'components) but got: %s.%s', type == null ? type : typeof type, info) : void 0;
|
|
197
|
-
}
|
|
198
|
-
|
|
199
|
-
var element = ReactElement.createElement.apply(this, arguments);
|
|
200
|
-
|
|
201
|
-
// The result can be nullish if a mock or a custom function is used.
|
|
202
|
-
// TODO: Drop this when these are no longer allowed as the type argument.
|
|
203
|
-
if (element == null) {
|
|
204
|
-
return element;
|
|
205
|
-
}
|
|
206
|
-
|
|
207
|
-
if (process.env.NODE_ENV !== 'production') {
|
|
208
|
-
ReactDebugCurrentFrame.element = element;
|
|
209
|
-
}
|
|
210
|
-
|
|
211
|
-
// Skip key warning if the type isn't valid since our key validation logic
|
|
212
|
-
// doesn't expect a non-string/function type and can throw confusing errors.
|
|
213
|
-
// We don't want exception behavior to differ between dev and prod.
|
|
214
|
-
// (Rendering will throw with a helpful message and as soon as the type is
|
|
215
|
-
// fixed, the key warnings will appear.)
|
|
216
|
-
if (validType) {
|
|
217
|
-
for (var i = 2; i < arguments.length; i++) {
|
|
218
|
-
validateChildKeys(arguments[i], type);
|
|
219
|
-
}
|
|
220
|
-
}
|
|
221
|
-
|
|
222
|
-
validatePropTypes(element);
|
|
223
|
-
|
|
224
|
-
if (process.env.NODE_ENV !== 'production') {
|
|
225
|
-
ReactDebugCurrentFrame.element = null;
|
|
226
|
-
}
|
|
227
|
-
|
|
228
|
-
return element;
|
|
229
|
-
},
|
|
230
|
-
|
|
231
|
-
createFactory: function (type) {
|
|
232
|
-
var validatedFactory = ReactElementValidator.createElement.bind(null, type);
|
|
233
|
-
// Legacy hook TODO: Warn if this is accessed
|
|
234
|
-
validatedFactory.type = type;
|
|
235
|
-
|
|
236
|
-
if (process.env.NODE_ENV !== 'production') {
|
|
237
|
-
if (canDefineProperty) {
|
|
238
|
-
Object.defineProperty(validatedFactory, 'type', {
|
|
239
|
-
enumerable: false,
|
|
240
|
-
get: function () {
|
|
241
|
-
process.env.NODE_ENV !== 'production' ? warning(false, 'Factory.type is deprecated. Access the class directly ' + 'before passing it to createFactory.') : void 0;
|
|
242
|
-
Object.defineProperty(this, 'type', {
|
|
243
|
-
value: type
|
|
244
|
-
});
|
|
245
|
-
return type;
|
|
246
|
-
}
|
|
247
|
-
});
|
|
248
|
-
}
|
|
249
|
-
}
|
|
250
|
-
|
|
251
|
-
return validatedFactory;
|
|
252
|
-
},
|
|
253
|
-
|
|
254
|
-
cloneElement: function (element, props, children) {
|
|
255
|
-
var newElement = ReactElement.cloneElement.apply(this, arguments);
|
|
256
|
-
if (process.env.NODE_ENV !== 'production') {
|
|
257
|
-
ReactDebugCurrentFrame.element = newElement;
|
|
258
|
-
}
|
|
259
|
-
for (var i = 2; i < arguments.length; i++) {
|
|
260
|
-
validateChildKeys(arguments[i], newElement.type);
|
|
261
|
-
}
|
|
262
|
-
validatePropTypes(newElement);
|
|
263
|
-
if (process.env.NODE_ENV !== 'production') {
|
|
264
|
-
ReactDebugCurrentFrame.element = null;
|
|
265
|
-
}
|
|
266
|
-
return newElement;
|
|
267
|
-
}
|
|
268
|
-
|
|
269
|
-
};
|
|
270
|
-
|
|
271
|
-
module.exports = ReactElementValidator;
|
|
@@ -1,62 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Copyright 2016-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
|
-
var ReactTypeOfWork = require('./ReactTypeOfWork');
|
|
15
|
-
var IndeterminateComponent = ReactTypeOfWork.IndeterminateComponent,
|
|
16
|
-
FunctionalComponent = ReactTypeOfWork.FunctionalComponent,
|
|
17
|
-
ClassComponent = ReactTypeOfWork.ClassComponent,
|
|
18
|
-
HostComponent = ReactTypeOfWork.HostComponent;
|
|
19
|
-
|
|
20
|
-
var getComponentName = require('./getComponentName');
|
|
21
|
-
|
|
22
|
-
function describeComponentFrame(name, source, ownerName) {
|
|
23
|
-
return '\n in ' + (name || 'Unknown') + (source ? ' (at ' + source.fileName.replace(/^.*[\\\/]/, '') + ':' + source.lineNumber + ')' : ownerName ? ' (created by ' + ownerName + ')' : '');
|
|
24
|
-
}
|
|
25
|
-
|
|
26
|
-
function describeFiber(fiber) {
|
|
27
|
-
switch (fiber.tag) {
|
|
28
|
-
case IndeterminateComponent:
|
|
29
|
-
case FunctionalComponent:
|
|
30
|
-
case ClassComponent:
|
|
31
|
-
case HostComponent:
|
|
32
|
-
var owner = fiber._debugOwner;
|
|
33
|
-
var source = fiber._debugSource;
|
|
34
|
-
var name = getComponentName(fiber);
|
|
35
|
-
var ownerName = null;
|
|
36
|
-
if (owner) {
|
|
37
|
-
ownerName = getComponentName(owner);
|
|
38
|
-
}
|
|
39
|
-
return describeComponentFrame(name, source, ownerName);
|
|
40
|
-
default:
|
|
41
|
-
return '';
|
|
42
|
-
}
|
|
43
|
-
}
|
|
44
|
-
|
|
45
|
-
// This function can only be called with a work-in-progress fiber and
|
|
46
|
-
// only during begin or complete phase. Do not call it under any other
|
|
47
|
-
// circumstances.
|
|
48
|
-
function getStackAddendumByWorkInProgressFiber(workInProgress) {
|
|
49
|
-
var info = '';
|
|
50
|
-
var node = workInProgress;
|
|
51
|
-
do {
|
|
52
|
-
info += describeFiber(node);
|
|
53
|
-
// Otherwise this return pointer might point to the wrong tree:
|
|
54
|
-
node = node['return'];
|
|
55
|
-
} while (node);
|
|
56
|
-
return info;
|
|
57
|
-
}
|
|
58
|
-
|
|
59
|
-
module.exports = {
|
|
60
|
-
getStackAddendumByWorkInProgressFiber: getStackAddendumByWorkInProgressFiber,
|
|
61
|
-
describeComponentFrame: describeComponentFrame
|
|
62
|
-
};
|
package/lib/ReactFragment.js
DELETED
|
@@ -1,68 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Copyright 2015-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 ReactChildren = require('./ReactChildren');
|
|
16
|
-
var ReactElement = require('./ReactElement');
|
|
17
|
-
|
|
18
|
-
var emptyFunction = require('fbjs/lib/emptyFunction');
|
|
19
|
-
var invariant = require('fbjs/lib/invariant');
|
|
20
|
-
var warning = require('fbjs/lib/warning');
|
|
21
|
-
|
|
22
|
-
/**
|
|
23
|
-
* We used to allow keyed objects to serve as a collection of ReactElements,
|
|
24
|
-
* or nested sets. This allowed us a way to explicitly key a set or fragment of
|
|
25
|
-
* components. This is now being replaced with an opaque data structure.
|
|
26
|
-
* The upgrade path is to call React.addons.createFragment({ key: value }) to
|
|
27
|
-
* create a keyed fragment. The resulting data structure is an array.
|
|
28
|
-
*/
|
|
29
|
-
|
|
30
|
-
var numericPropertyRegex = /^\d+$/;
|
|
31
|
-
|
|
32
|
-
var warnedAboutNumeric = false;
|
|
33
|
-
|
|
34
|
-
var ReactFragment = {
|
|
35
|
-
/**
|
|
36
|
-
* Wrap a keyed object in an opaque proxy that warns you if you access any
|
|
37
|
-
* of its properties.
|
|
38
|
-
* See https://facebook.github.io/react/docs/create-fragment.html
|
|
39
|
-
*/
|
|
40
|
-
create: function (object) {
|
|
41
|
-
if (typeof object !== 'object' || !object || Array.isArray(object)) {
|
|
42
|
-
process.env.NODE_ENV !== 'production' ? warning(false, 'React.addons.createFragment only accepts a single object. Got: %s', object) : void 0;
|
|
43
|
-
return object;
|
|
44
|
-
}
|
|
45
|
-
if (ReactElement.isValidElement(object)) {
|
|
46
|
-
process.env.NODE_ENV !== 'production' ? warning(false, 'React.addons.createFragment does not accept a ReactElement ' + 'without a wrapper object.') : void 0;
|
|
47
|
-
return object;
|
|
48
|
-
}
|
|
49
|
-
|
|
50
|
-
!(object.nodeType !== 1) ? process.env.NODE_ENV !== 'production' ? invariant(false, 'React.addons.createFragment(...): Encountered an invalid child; DOM elements are not valid children of React components.') : _prodInvariant('0') : void 0;
|
|
51
|
-
|
|
52
|
-
var result = [];
|
|
53
|
-
|
|
54
|
-
for (var key in object) {
|
|
55
|
-
if (process.env.NODE_ENV !== 'production') {
|
|
56
|
-
if (!warnedAboutNumeric && numericPropertyRegex.test(key)) {
|
|
57
|
-
process.env.NODE_ENV !== 'production' ? warning(false, 'React.addons.createFragment(...): Child objects should have ' + 'non-numeric keys so ordering is preserved.') : void 0;
|
|
58
|
-
warnedAboutNumeric = true;
|
|
59
|
-
}
|
|
60
|
-
}
|
|
61
|
-
ReactChildren.mapIntoWithKeyPrefixInternal(object[key], result, key, emptyFunction.thatReturnsArgument);
|
|
62
|
-
}
|
|
63
|
-
|
|
64
|
-
return result;
|
|
65
|
-
}
|
|
66
|
-
};
|
|
67
|
-
|
|
68
|
-
module.exports = ReactFragment;
|
|
@@ -1,91 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Copyright 2015-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 warning = require('fbjs/lib/warning');
|
|
14
|
-
|
|
15
|
-
function warnNoop(publicInstance, callerName) {
|
|
16
|
-
if (process.env.NODE_ENV !== 'production') {
|
|
17
|
-
var constructor = publicInstance.constructor;
|
|
18
|
-
process.env.NODE_ENV !== 'production' ? warning(false, '%s(...): Can only update a mounted or mounting component. ' + 'This usually means you called %s() on an unmounted component. ' + 'This is a no-op.\n\nPlease check the code for the %s component.', callerName, callerName, constructor && (constructor.displayName || constructor.name) || 'ReactClass') : void 0;
|
|
19
|
-
}
|
|
20
|
-
}
|
|
21
|
-
|
|
22
|
-
/**
|
|
23
|
-
* This is the abstract API for an update queue.
|
|
24
|
-
*/
|
|
25
|
-
var ReactNoopUpdateQueue = {
|
|
26
|
-
|
|
27
|
-
/**
|
|
28
|
-
* Checks whether or not this composite component is mounted.
|
|
29
|
-
* @param {ReactClass} publicInstance The instance we want to test.
|
|
30
|
-
* @return {boolean} True if mounted, false otherwise.
|
|
31
|
-
* @protected
|
|
32
|
-
* @final
|
|
33
|
-
*/
|
|
34
|
-
isMounted: function (publicInstance) {
|
|
35
|
-
return false;
|
|
36
|
-
},
|
|
37
|
-
|
|
38
|
-
/**
|
|
39
|
-
* Forces an update. This should only be invoked when it is known with
|
|
40
|
-
* certainty that we are **not** in a DOM transaction.
|
|
41
|
-
*
|
|
42
|
-
* You may want to call this when you know that some deeper aspect of the
|
|
43
|
-
* component's state has changed but `setState` was not called.
|
|
44
|
-
*
|
|
45
|
-
* This will not invoke `shouldComponentUpdate`, but it will invoke
|
|
46
|
-
* `componentWillUpdate` and `componentDidUpdate`.
|
|
47
|
-
*
|
|
48
|
-
* @param {ReactClass} publicInstance The instance that should rerender.
|
|
49
|
-
* @param {?function} callback Called after component is updated.
|
|
50
|
-
* @param {?string} Name of the calling function in the public API.
|
|
51
|
-
* @internal
|
|
52
|
-
*/
|
|
53
|
-
enqueueForceUpdate: function (publicInstance, callback, callerName) {
|
|
54
|
-
warnNoop(publicInstance, 'forceUpdate');
|
|
55
|
-
},
|
|
56
|
-
|
|
57
|
-
/**
|
|
58
|
-
* Replaces all of the state. Always use this or `setState` to mutate state.
|
|
59
|
-
* You should treat `this.state` as immutable.
|
|
60
|
-
*
|
|
61
|
-
* There is no guarantee that `this.state` will be immediately updated, so
|
|
62
|
-
* accessing `this.state` after calling this method may return the old value.
|
|
63
|
-
*
|
|
64
|
-
* @param {ReactClass} publicInstance The instance that should rerender.
|
|
65
|
-
* @param {object} completeState Next state.
|
|
66
|
-
* @param {?function} callback Called after component is updated.
|
|
67
|
-
* @param {?string} Name of the calling function in the public API.
|
|
68
|
-
* @internal
|
|
69
|
-
*/
|
|
70
|
-
enqueueReplaceState: function (publicInstance, completeState, callback, callerName) {
|
|
71
|
-
warnNoop(publicInstance, 'replaceState');
|
|
72
|
-
},
|
|
73
|
-
|
|
74
|
-
/**
|
|
75
|
-
* Sets a subset of the state. This only exists because _pendingState is
|
|
76
|
-
* internal. This provides a merging strategy that is not available to deep
|
|
77
|
-
* properties which is confusing. TODO: Expose pendingState or don't use it
|
|
78
|
-
* during the merge.
|
|
79
|
-
*
|
|
80
|
-
* @param {ReactClass} publicInstance The instance that should rerender.
|
|
81
|
-
* @param {object} partialState Next partial state to be merged with state.
|
|
82
|
-
* @param {?function} callback Called after component is updated.
|
|
83
|
-
* @param {?string} Name of the calling function in the public API.
|
|
84
|
-
* @internal
|
|
85
|
-
*/
|
|
86
|
-
enqueueSetState: function (publicInstance, partialState, callback, callerName) {
|
|
87
|
-
warnNoop(publicInstance, 'setState');
|
|
88
|
-
}
|
|
89
|
-
};
|
|
90
|
-
|
|
91
|
-
module.exports = ReactNoopUpdateQueue;
|