react 16.0.0-alpha.6 → 16.0.0-alpha.10
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/cjs/react.development.js +2149 -0
- package/cjs/react.production.min.js +1 -0
- package/index.js +7 -0
- package/package.json +10 -9
- package/{dist/react.js → umd/react.development.js} +2610 -2900
- package/umd/react.production.min.js +4 -0
- package/dist/react.min.js +0 -17
- package/lib/KeyEscapeUtils.js +0 -58
- package/lib/PooledClass.js +0 -111
- package/lib/React.js +0 -84
- package/lib/ReactBaseClasses.js +0 -136
- package/lib/ReactChildren.js +0 -190
- package/lib/ReactClass.js +0 -698
- package/lib/ReactComponentTreeHook.js +0 -342
- package/lib/ReactComponentTreeHookUMDShim.js +0 -17
- package/lib/ReactCurrentOwner.js +0 -28
- 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 -276
- package/lib/ReactFiberComponentTreeHook.js +0 -62
- package/lib/ReactNoopUpdateQueue.js +0 -90
- package/lib/ReactPropTypes.js +0 -458
- package/lib/ReactPropTypesSecret.js +0 -16
- 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/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/traverseAllChildren.js +0 -164
- package/react.js +0 -3
package/README.md
CHANGED
|
@@ -13,11 +13,4 @@ To use React in production mode, set the environment variable `NODE_ENV` to `pro
|
|
|
13
13
|
|
|
14
14
|
```js
|
|
15
15
|
var React = require('react');
|
|
16
|
-
|
|
17
|
-
// Addons are in separate packages:
|
|
18
|
-
var createFragment = require('react-addons-create-fragment');
|
|
19
|
-
var immutabilityHelpers = require('react-addons-update');
|
|
20
|
-
var CSSTransitionGroup = require('react-addons-css-transition-group');
|
|
21
16
|
```
|
|
22
|
-
|
|
23
|
-
For a complete list of addons visit the [addons documentation page](https://facebook.github.io/react/docs/addons.html).
|
|
@@ -0,0 +1,2149 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
var objectAssign$1 = require('object-assign');
|
|
4
|
+
var warning = require('fbjs/lib/warning');
|
|
5
|
+
var emptyObject = require('fbjs/lib/emptyObject');
|
|
6
|
+
var invariant = require('fbjs/lib/invariant');
|
|
7
|
+
var emptyFunction = require('fbjs/lib/emptyFunction');
|
|
8
|
+
var checkPropTypes = require('prop-types/checkPropTypes');
|
|
9
|
+
var factory = require('prop-types/factory');
|
|
10
|
+
var factory$1 = require('create-react-class/factory');
|
|
11
|
+
|
|
12
|
+
/**
|
|
13
|
+
* Copyright (c) 2013-present, Facebook, Inc.
|
|
14
|
+
* All rights reserved.
|
|
15
|
+
*
|
|
16
|
+
* This source code is licensed under the BSD-style license found in the
|
|
17
|
+
* LICENSE file in the root directory of this source tree. An additional grant
|
|
18
|
+
* of patent rights can be found in the PATENTS file in the same directory.
|
|
19
|
+
*
|
|
20
|
+
* @providesModule reactProdInvariant
|
|
21
|
+
*
|
|
22
|
+
*/
|
|
23
|
+
|
|
24
|
+
function warnNoop(publicInstance, callerName) {
|
|
25
|
+
{
|
|
26
|
+
var constructor = publicInstance.constructor;
|
|
27
|
+
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');
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
/**
|
|
32
|
+
* This is the abstract API for an update queue.
|
|
33
|
+
*/
|
|
34
|
+
var ReactNoopUpdateQueue = {
|
|
35
|
+
/**
|
|
36
|
+
* Checks whether or not this composite component is mounted.
|
|
37
|
+
* @param {ReactClass} publicInstance The instance we want to test.
|
|
38
|
+
* @return {boolean} True if mounted, false otherwise.
|
|
39
|
+
* @protected
|
|
40
|
+
* @final
|
|
41
|
+
*/
|
|
42
|
+
isMounted: function (publicInstance) {
|
|
43
|
+
return false;
|
|
44
|
+
},
|
|
45
|
+
|
|
46
|
+
/**
|
|
47
|
+
* Forces an update. This should only be invoked when it is known with
|
|
48
|
+
* certainty that we are **not** in a DOM transaction.
|
|
49
|
+
*
|
|
50
|
+
* You may want to call this when you know that some deeper aspect of the
|
|
51
|
+
* component's state has changed but `setState` was not called.
|
|
52
|
+
*
|
|
53
|
+
* This will not invoke `shouldComponentUpdate`, but it will invoke
|
|
54
|
+
* `componentWillUpdate` and `componentDidUpdate`.
|
|
55
|
+
*
|
|
56
|
+
* @param {ReactClass} publicInstance The instance that should rerender.
|
|
57
|
+
* @param {?function} callback Called after component is updated.
|
|
58
|
+
* @param {?string} Name of the calling function in the public API.
|
|
59
|
+
* @internal
|
|
60
|
+
*/
|
|
61
|
+
enqueueForceUpdate: function (publicInstance, callback, callerName) {
|
|
62
|
+
warnNoop(publicInstance, 'forceUpdate');
|
|
63
|
+
},
|
|
64
|
+
|
|
65
|
+
/**
|
|
66
|
+
* Replaces all of the state. Always use this or `setState` to mutate state.
|
|
67
|
+
* You should treat `this.state` as immutable.
|
|
68
|
+
*
|
|
69
|
+
* There is no guarantee that `this.state` will be immediately updated, so
|
|
70
|
+
* accessing `this.state` after calling this method may return the old value.
|
|
71
|
+
*
|
|
72
|
+
* @param {ReactClass} publicInstance The instance that should rerender.
|
|
73
|
+
* @param {object} completeState Next state.
|
|
74
|
+
* @param {?function} callback Called after component is updated.
|
|
75
|
+
* @param {?string} Name of the calling function in the public API.
|
|
76
|
+
* @internal
|
|
77
|
+
*/
|
|
78
|
+
enqueueReplaceState: function (publicInstance, completeState, callback, callerName) {
|
|
79
|
+
warnNoop(publicInstance, 'replaceState');
|
|
80
|
+
},
|
|
81
|
+
|
|
82
|
+
/**
|
|
83
|
+
* Sets a subset of the state. This only exists because _pendingState is
|
|
84
|
+
* internal. This provides a merging strategy that is not available to deep
|
|
85
|
+
* properties which is confusing. TODO: Expose pendingState or don't use it
|
|
86
|
+
* during the merge.
|
|
87
|
+
*
|
|
88
|
+
* @param {ReactClass} publicInstance The instance that should rerender.
|
|
89
|
+
* @param {object} partialState Next partial state to be merged with state.
|
|
90
|
+
* @param {?function} callback Called after component is updated.
|
|
91
|
+
* @param {?string} Name of the calling function in the public API.
|
|
92
|
+
* @internal
|
|
93
|
+
*/
|
|
94
|
+
enqueueSetState: function (publicInstance, partialState, callback, callerName) {
|
|
95
|
+
warnNoop(publicInstance, 'setState');
|
|
96
|
+
}
|
|
97
|
+
};
|
|
98
|
+
|
|
99
|
+
var ReactNoopUpdateQueue_1 = ReactNoopUpdateQueue;
|
|
100
|
+
|
|
101
|
+
/**
|
|
102
|
+
* Copyright 2013-present, Facebook, Inc.
|
|
103
|
+
* All rights reserved.
|
|
104
|
+
*
|
|
105
|
+
* This source code is licensed under the BSD-style license found in the
|
|
106
|
+
* LICENSE file in the root directory of this source tree. An additional grant
|
|
107
|
+
* of patent rights can be found in the PATENTS file in the same directory.
|
|
108
|
+
*
|
|
109
|
+
*
|
|
110
|
+
* @providesModule canDefineProperty
|
|
111
|
+
*/
|
|
112
|
+
|
|
113
|
+
var canDefineProperty$1 = false;
|
|
114
|
+
{
|
|
115
|
+
try {
|
|
116
|
+
// $FlowFixMe https://github.com/facebook/flow/issues/285
|
|
117
|
+
Object.defineProperty({}, 'x', { get: function () {} });
|
|
118
|
+
canDefineProperty$1 = true;
|
|
119
|
+
} catch (x) {
|
|
120
|
+
// IE will fail on defineProperty
|
|
121
|
+
}
|
|
122
|
+
}
|
|
123
|
+
|
|
124
|
+
var canDefineProperty_1 = canDefineProperty$1;
|
|
125
|
+
|
|
126
|
+
/**
|
|
127
|
+
* Base class helpers for the updating state of a component.
|
|
128
|
+
*/
|
|
129
|
+
function ReactComponent(props, context, updater) {
|
|
130
|
+
this.props = props;
|
|
131
|
+
this.context = context;
|
|
132
|
+
this.refs = emptyObject;
|
|
133
|
+
// We initialize the default updater but the real one gets injected by the
|
|
134
|
+
// renderer.
|
|
135
|
+
this.updater = updater || ReactNoopUpdateQueue_1;
|
|
136
|
+
}
|
|
137
|
+
|
|
138
|
+
ReactComponent.prototype.isReactComponent = {};
|
|
139
|
+
|
|
140
|
+
/**
|
|
141
|
+
* Sets a subset of the state. Always use this to mutate
|
|
142
|
+
* state. You should treat `this.state` as immutable.
|
|
143
|
+
*
|
|
144
|
+
* There is no guarantee that `this.state` will be immediately updated, so
|
|
145
|
+
* accessing `this.state` after calling this method may return the old value.
|
|
146
|
+
*
|
|
147
|
+
* There is no guarantee that calls to `setState` will run synchronously,
|
|
148
|
+
* as they may eventually be batched together. You can provide an optional
|
|
149
|
+
* callback that will be executed when the call to setState is actually
|
|
150
|
+
* completed.
|
|
151
|
+
*
|
|
152
|
+
* When a function is provided to setState, it will be called at some point in
|
|
153
|
+
* the future (not synchronously). It will be called with the up to date
|
|
154
|
+
* component arguments (state, props, context). These values can be different
|
|
155
|
+
* from this.* because your function may be called after receiveProps but before
|
|
156
|
+
* shouldComponentUpdate, and this new state, props, and context will not yet be
|
|
157
|
+
* assigned to this.
|
|
158
|
+
*
|
|
159
|
+
* @param {object|function} partialState Next partial state or function to
|
|
160
|
+
* produce next partial state to be merged with current state.
|
|
161
|
+
* @param {?function} callback Called after state is updated.
|
|
162
|
+
* @final
|
|
163
|
+
* @protected
|
|
164
|
+
*/
|
|
165
|
+
ReactComponent.prototype.setState = function (partialState, callback) {
|
|
166
|
+
!(typeof partialState === 'object' || typeof partialState === 'function' || partialState == null) ? invariant(false, 'setState(...): takes an object of state variables to update or a function which returns an object of state variables.') : void 0;
|
|
167
|
+
this.updater.enqueueSetState(this, partialState, callback, 'setState');
|
|
168
|
+
};
|
|
169
|
+
|
|
170
|
+
/**
|
|
171
|
+
* Forces an update. This should only be invoked when it is known with
|
|
172
|
+
* certainty that we are **not** in a DOM transaction.
|
|
173
|
+
*
|
|
174
|
+
* You may want to call this when you know that some deeper aspect of the
|
|
175
|
+
* component's state has changed but `setState` was not called.
|
|
176
|
+
*
|
|
177
|
+
* This will not invoke `shouldComponentUpdate`, but it will invoke
|
|
178
|
+
* `componentWillUpdate` and `componentDidUpdate`.
|
|
179
|
+
*
|
|
180
|
+
* @param {?function} callback Called after update is complete.
|
|
181
|
+
* @final
|
|
182
|
+
* @protected
|
|
183
|
+
*/
|
|
184
|
+
ReactComponent.prototype.forceUpdate = function (callback) {
|
|
185
|
+
this.updater.enqueueForceUpdate(this, callback, 'forceUpdate');
|
|
186
|
+
};
|
|
187
|
+
|
|
188
|
+
/**
|
|
189
|
+
* Deprecated APIs. These APIs used to exist on classic React classes but since
|
|
190
|
+
* we would like to deprecate them, we're not going to move them over to this
|
|
191
|
+
* modern base class. Instead, we define a getter that warns if it's accessed.
|
|
192
|
+
*/
|
|
193
|
+
{
|
|
194
|
+
var deprecatedAPIs = {
|
|
195
|
+
isMounted: ['isMounted', 'Instead, make sure to clean up subscriptions and pending requests in ' + 'componentWillUnmount to prevent memory leaks.'],
|
|
196
|
+
replaceState: ['replaceState', 'Refactor your code to use setState instead (see ' + 'https://github.com/facebook/react/issues/3236).']
|
|
197
|
+
};
|
|
198
|
+
var defineDeprecationWarning = function (methodName, info) {
|
|
199
|
+
if (canDefineProperty_1) {
|
|
200
|
+
Object.defineProperty(ReactComponent.prototype, methodName, {
|
|
201
|
+
get: function () {
|
|
202
|
+
warning(false, '%s(...) is deprecated in plain JavaScript React classes. %s', info[0], info[1]);
|
|
203
|
+
return undefined;
|
|
204
|
+
}
|
|
205
|
+
});
|
|
206
|
+
}
|
|
207
|
+
};
|
|
208
|
+
for (var fnName in deprecatedAPIs) {
|
|
209
|
+
if (deprecatedAPIs.hasOwnProperty(fnName)) {
|
|
210
|
+
defineDeprecationWarning(fnName, deprecatedAPIs[fnName]);
|
|
211
|
+
}
|
|
212
|
+
}
|
|
213
|
+
}
|
|
214
|
+
|
|
215
|
+
/**
|
|
216
|
+
* Base class helpers for the updating state of a component.
|
|
217
|
+
*/
|
|
218
|
+
function ReactPureComponent(props, context, updater) {
|
|
219
|
+
// Duplicated from ReactComponent.
|
|
220
|
+
this.props = props;
|
|
221
|
+
this.context = context;
|
|
222
|
+
this.refs = emptyObject;
|
|
223
|
+
// We initialize the default updater but the real one gets injected by the
|
|
224
|
+
// renderer.
|
|
225
|
+
this.updater = updater || ReactNoopUpdateQueue_1;
|
|
226
|
+
}
|
|
227
|
+
|
|
228
|
+
function ComponentDummy() {}
|
|
229
|
+
ComponentDummy.prototype = ReactComponent.prototype;
|
|
230
|
+
ReactPureComponent.prototype = new ComponentDummy();
|
|
231
|
+
ReactPureComponent.prototype.constructor = ReactPureComponent;
|
|
232
|
+
// Avoid an extra prototype jump for these methods.
|
|
233
|
+
objectAssign$1(ReactPureComponent.prototype, ReactComponent.prototype);
|
|
234
|
+
ReactPureComponent.prototype.isPureReactComponent = true;
|
|
235
|
+
|
|
236
|
+
var ReactBaseClasses = {
|
|
237
|
+
Component: ReactComponent,
|
|
238
|
+
PureComponent: ReactPureComponent
|
|
239
|
+
};
|
|
240
|
+
|
|
241
|
+
/**
|
|
242
|
+
* Static poolers. Several custom versions for each potential number of
|
|
243
|
+
* arguments. A completely generic pooler is easy to implement, but would
|
|
244
|
+
* require accessing the `arguments` object. In each of these, `this` refers to
|
|
245
|
+
* the Class itself, not an instance. If any others are needed, simply add them
|
|
246
|
+
* here, or in their own files.
|
|
247
|
+
*/
|
|
248
|
+
var oneArgumentPooler = function (copyFieldsFrom) {
|
|
249
|
+
var Klass = this;
|
|
250
|
+
if (Klass.instancePool.length) {
|
|
251
|
+
var instance = Klass.instancePool.pop();
|
|
252
|
+
Klass.call(instance, copyFieldsFrom);
|
|
253
|
+
return instance;
|
|
254
|
+
} else {
|
|
255
|
+
return new Klass(copyFieldsFrom);
|
|
256
|
+
}
|
|
257
|
+
};
|
|
258
|
+
|
|
259
|
+
var twoArgumentPooler$1 = function (a1, a2) {
|
|
260
|
+
var Klass = this;
|
|
261
|
+
if (Klass.instancePool.length) {
|
|
262
|
+
var instance = Klass.instancePool.pop();
|
|
263
|
+
Klass.call(instance, a1, a2);
|
|
264
|
+
return instance;
|
|
265
|
+
} else {
|
|
266
|
+
return new Klass(a1, a2);
|
|
267
|
+
}
|
|
268
|
+
};
|
|
269
|
+
|
|
270
|
+
var threeArgumentPooler = function (a1, a2, a3) {
|
|
271
|
+
var Klass = this;
|
|
272
|
+
if (Klass.instancePool.length) {
|
|
273
|
+
var instance = Klass.instancePool.pop();
|
|
274
|
+
Klass.call(instance, a1, a2, a3);
|
|
275
|
+
return instance;
|
|
276
|
+
} else {
|
|
277
|
+
return new Klass(a1, a2, a3);
|
|
278
|
+
}
|
|
279
|
+
};
|
|
280
|
+
|
|
281
|
+
var fourArgumentPooler$1 = function (a1, a2, a3, a4) {
|
|
282
|
+
var Klass = this;
|
|
283
|
+
if (Klass.instancePool.length) {
|
|
284
|
+
var instance = Klass.instancePool.pop();
|
|
285
|
+
Klass.call(instance, a1, a2, a3, a4);
|
|
286
|
+
return instance;
|
|
287
|
+
} else {
|
|
288
|
+
return new Klass(a1, a2, a3, a4);
|
|
289
|
+
}
|
|
290
|
+
};
|
|
291
|
+
|
|
292
|
+
var standardReleaser = function (instance) {
|
|
293
|
+
var Klass = this;
|
|
294
|
+
!(instance instanceof Klass) ? invariant(false, 'Trying to release an instance into a pool of a different type.') : void 0;
|
|
295
|
+
instance.destructor();
|
|
296
|
+
if (Klass.instancePool.length < Klass.poolSize) {
|
|
297
|
+
Klass.instancePool.push(instance);
|
|
298
|
+
}
|
|
299
|
+
};
|
|
300
|
+
|
|
301
|
+
var DEFAULT_POOL_SIZE = 10;
|
|
302
|
+
var DEFAULT_POOLER = oneArgumentPooler;
|
|
303
|
+
|
|
304
|
+
/**
|
|
305
|
+
* Augments `CopyConstructor` to be a poolable class, augmenting only the class
|
|
306
|
+
* itself (statically) not adding any prototypical fields. Any CopyConstructor
|
|
307
|
+
* you give this may have a `poolSize` property, and will look for a
|
|
308
|
+
* prototypical `destructor` on instances.
|
|
309
|
+
*
|
|
310
|
+
* @param {Function} CopyConstructor Constructor that can be used to reset.
|
|
311
|
+
* @param {Function} pooler Customizable pooler.
|
|
312
|
+
*/
|
|
313
|
+
var addPoolingTo = function (CopyConstructor, pooler) {
|
|
314
|
+
// Casting as any so that flow ignores the actual implementation and trusts
|
|
315
|
+
// it to match the type we declared
|
|
316
|
+
var NewKlass = CopyConstructor;
|
|
317
|
+
NewKlass.instancePool = [];
|
|
318
|
+
NewKlass.getPooled = pooler || DEFAULT_POOLER;
|
|
319
|
+
if (!NewKlass.poolSize) {
|
|
320
|
+
NewKlass.poolSize = DEFAULT_POOL_SIZE;
|
|
321
|
+
}
|
|
322
|
+
NewKlass.release = standardReleaser;
|
|
323
|
+
return NewKlass;
|
|
324
|
+
};
|
|
325
|
+
|
|
326
|
+
var PooledClass = {
|
|
327
|
+
addPoolingTo: addPoolingTo,
|
|
328
|
+
oneArgumentPooler: oneArgumentPooler,
|
|
329
|
+
twoArgumentPooler: twoArgumentPooler$1,
|
|
330
|
+
threeArgumentPooler: threeArgumentPooler,
|
|
331
|
+
fourArgumentPooler: fourArgumentPooler$1
|
|
332
|
+
};
|
|
333
|
+
|
|
334
|
+
var PooledClass_1 = PooledClass;
|
|
335
|
+
|
|
336
|
+
/**
|
|
337
|
+
* Copyright 2013-present, Facebook, Inc.
|
|
338
|
+
* All rights reserved.
|
|
339
|
+
*
|
|
340
|
+
* This source code is licensed under the BSD-style license found in the
|
|
341
|
+
* LICENSE file in the root directory of this source tree. An additional grant
|
|
342
|
+
* of patent rights can be found in the PATENTS file in the same directory.
|
|
343
|
+
*
|
|
344
|
+
* @providesModule ReactCurrentOwner
|
|
345
|
+
*
|
|
346
|
+
*/
|
|
347
|
+
|
|
348
|
+
/**
|
|
349
|
+
* Keeps track of the current owner.
|
|
350
|
+
*
|
|
351
|
+
* The current owner is the component who should own any components that are
|
|
352
|
+
* currently being constructed.
|
|
353
|
+
*/
|
|
354
|
+
var ReactCurrentOwner = {
|
|
355
|
+
/**
|
|
356
|
+
* @internal
|
|
357
|
+
* @type {ReactComponent}
|
|
358
|
+
*/
|
|
359
|
+
current: null
|
|
360
|
+
};
|
|
361
|
+
|
|
362
|
+
var ReactCurrentOwner_1 = ReactCurrentOwner;
|
|
363
|
+
|
|
364
|
+
/**
|
|
365
|
+
* Copyright 2014-present, Facebook, Inc.
|
|
366
|
+
* All rights reserved.
|
|
367
|
+
*
|
|
368
|
+
* This source code is licensed under the BSD-style license found in the
|
|
369
|
+
* LICENSE file in the root directory of this source tree. An additional grant
|
|
370
|
+
* of patent rights can be found in the PATENTS file in the same directory.
|
|
371
|
+
*
|
|
372
|
+
* @providesModule ReactElementSymbol
|
|
373
|
+
*
|
|
374
|
+
*/
|
|
375
|
+
|
|
376
|
+
// The Symbol used to tag the ReactElement type. If there is no native Symbol
|
|
377
|
+
// nor polyfill, then a plain number is used for performance.
|
|
378
|
+
|
|
379
|
+
var REACT_ELEMENT_TYPE = typeof Symbol === 'function' && Symbol['for'] && Symbol['for']('react.element') || 0xeac7;
|
|
380
|
+
|
|
381
|
+
var ReactElementSymbol = REACT_ELEMENT_TYPE;
|
|
382
|
+
|
|
383
|
+
var hasOwnProperty = Object.prototype.hasOwnProperty;
|
|
384
|
+
|
|
385
|
+
|
|
386
|
+
|
|
387
|
+
var RESERVED_PROPS = {
|
|
388
|
+
key: true,
|
|
389
|
+
ref: true,
|
|
390
|
+
__self: true,
|
|
391
|
+
__source: true
|
|
392
|
+
};
|
|
393
|
+
|
|
394
|
+
var specialPropKeyWarningShown;
|
|
395
|
+
var specialPropRefWarningShown;
|
|
396
|
+
|
|
397
|
+
function hasValidRef(config) {
|
|
398
|
+
{
|
|
399
|
+
if (hasOwnProperty.call(config, 'ref')) {
|
|
400
|
+
var getter = Object.getOwnPropertyDescriptor(config, 'ref').get;
|
|
401
|
+
if (getter && getter.isReactWarning) {
|
|
402
|
+
return false;
|
|
403
|
+
}
|
|
404
|
+
}
|
|
405
|
+
}
|
|
406
|
+
return config.ref !== undefined;
|
|
407
|
+
}
|
|
408
|
+
|
|
409
|
+
function hasValidKey(config) {
|
|
410
|
+
{
|
|
411
|
+
if (hasOwnProperty.call(config, 'key')) {
|
|
412
|
+
var getter = Object.getOwnPropertyDescriptor(config, 'key').get;
|
|
413
|
+
if (getter && getter.isReactWarning) {
|
|
414
|
+
return false;
|
|
415
|
+
}
|
|
416
|
+
}
|
|
417
|
+
}
|
|
418
|
+
return config.key !== undefined;
|
|
419
|
+
}
|
|
420
|
+
|
|
421
|
+
function defineKeyPropWarningGetter(props, displayName) {
|
|
422
|
+
var warnAboutAccessingKey = function () {
|
|
423
|
+
if (!specialPropKeyWarningShown) {
|
|
424
|
+
specialPropKeyWarningShown = true;
|
|
425
|
+
warning(false, '%s: `key` is not a prop. Trying to access it will result ' + 'in `undefined` being returned. If you need to access the same ' + 'value within the child component, you should pass it as a different ' + 'prop. (https://fb.me/react-special-props)', displayName);
|
|
426
|
+
}
|
|
427
|
+
};
|
|
428
|
+
warnAboutAccessingKey.isReactWarning = true;
|
|
429
|
+
Object.defineProperty(props, 'key', {
|
|
430
|
+
get: warnAboutAccessingKey,
|
|
431
|
+
configurable: true
|
|
432
|
+
});
|
|
433
|
+
}
|
|
434
|
+
|
|
435
|
+
function defineRefPropWarningGetter(props, displayName) {
|
|
436
|
+
var warnAboutAccessingRef = function () {
|
|
437
|
+
if (!specialPropRefWarningShown) {
|
|
438
|
+
specialPropRefWarningShown = true;
|
|
439
|
+
warning(false, '%s: `ref` is not a prop. Trying to access it will result ' + 'in `undefined` being returned. If you need to access the same ' + 'value within the child component, you should pass it as a different ' + 'prop. (https://fb.me/react-special-props)', displayName);
|
|
440
|
+
}
|
|
441
|
+
};
|
|
442
|
+
warnAboutAccessingRef.isReactWarning = true;
|
|
443
|
+
Object.defineProperty(props, 'ref', {
|
|
444
|
+
get: warnAboutAccessingRef,
|
|
445
|
+
configurable: true
|
|
446
|
+
});
|
|
447
|
+
}
|
|
448
|
+
|
|
449
|
+
/**
|
|
450
|
+
* Factory method to create a new React element. This no longer adheres to
|
|
451
|
+
* the class pattern, so do not use new to call it. Also, no instanceof check
|
|
452
|
+
* will work. Instead test $$typeof field against Symbol.for('react.element') to check
|
|
453
|
+
* if something is a React Element.
|
|
454
|
+
*
|
|
455
|
+
* @param {*} type
|
|
456
|
+
* @param {*} key
|
|
457
|
+
* @param {string|object} ref
|
|
458
|
+
* @param {*} self A *temporary* helper to detect places where `this` is
|
|
459
|
+
* different from the `owner` when React.createElement is called, so that we
|
|
460
|
+
* can warn. We want to get rid of owner and replace string `ref`s with arrow
|
|
461
|
+
* functions, and as long as `this` and owner are the same, there will be no
|
|
462
|
+
* change in behavior.
|
|
463
|
+
* @param {*} source An annotation object (added by a transpiler or otherwise)
|
|
464
|
+
* indicating filename, line number, and/or other information.
|
|
465
|
+
* @param {*} owner
|
|
466
|
+
* @param {*} props
|
|
467
|
+
* @internal
|
|
468
|
+
*/
|
|
469
|
+
var ReactElement = function (type, key, ref, self, source, owner, props) {
|
|
470
|
+
var element = {
|
|
471
|
+
// This tag allow us to uniquely identify this as a React Element
|
|
472
|
+
$$typeof: ReactElementSymbol,
|
|
473
|
+
|
|
474
|
+
// Built-in properties that belong on the element
|
|
475
|
+
type: type,
|
|
476
|
+
key: key,
|
|
477
|
+
ref: ref,
|
|
478
|
+
props: props,
|
|
479
|
+
|
|
480
|
+
// Record the component responsible for creating this element.
|
|
481
|
+
_owner: owner
|
|
482
|
+
};
|
|
483
|
+
|
|
484
|
+
{
|
|
485
|
+
// The validation flag is currently mutative. We put it on
|
|
486
|
+
// an external backing store so that we can freeze the whole object.
|
|
487
|
+
// This can be replaced with a WeakMap once they are implemented in
|
|
488
|
+
// commonly used development environments.
|
|
489
|
+
element._store = {};
|
|
490
|
+
|
|
491
|
+
// To make comparing ReactElements easier for testing purposes, we make
|
|
492
|
+
// the validation flag non-enumerable (where possible, which should
|
|
493
|
+
// include every environment we run tests in), so the test framework
|
|
494
|
+
// ignores it.
|
|
495
|
+
if (canDefineProperty_1) {
|
|
496
|
+
Object.defineProperty(element._store, 'validated', {
|
|
497
|
+
configurable: false,
|
|
498
|
+
enumerable: false,
|
|
499
|
+
writable: true,
|
|
500
|
+
value: false
|
|
501
|
+
});
|
|
502
|
+
// self and source are DEV only properties.
|
|
503
|
+
Object.defineProperty(element, '_self', {
|
|
504
|
+
configurable: false,
|
|
505
|
+
enumerable: false,
|
|
506
|
+
writable: false,
|
|
507
|
+
value: self
|
|
508
|
+
});
|
|
509
|
+
// Two elements created in two different places should be considered
|
|
510
|
+
// equal for testing purposes and therefore we hide it from enumeration.
|
|
511
|
+
Object.defineProperty(element, '_source', {
|
|
512
|
+
configurable: false,
|
|
513
|
+
enumerable: false,
|
|
514
|
+
writable: false,
|
|
515
|
+
value: source
|
|
516
|
+
});
|
|
517
|
+
} else {
|
|
518
|
+
element._store.validated = false;
|
|
519
|
+
element._self = self;
|
|
520
|
+
element._source = source;
|
|
521
|
+
}
|
|
522
|
+
if (Object.freeze) {
|
|
523
|
+
Object.freeze(element.props);
|
|
524
|
+
Object.freeze(element);
|
|
525
|
+
}
|
|
526
|
+
}
|
|
527
|
+
|
|
528
|
+
return element;
|
|
529
|
+
};
|
|
530
|
+
|
|
531
|
+
/**
|
|
532
|
+
* Create and return a new ReactElement of the given type.
|
|
533
|
+
* See https://facebook.github.io/react/docs/react-api.html#createelement
|
|
534
|
+
*/
|
|
535
|
+
ReactElement.createElement = function (type, config, children) {
|
|
536
|
+
var propName;
|
|
537
|
+
|
|
538
|
+
// Reserved names are extracted
|
|
539
|
+
var props = {};
|
|
540
|
+
|
|
541
|
+
var key = null;
|
|
542
|
+
var ref = null;
|
|
543
|
+
var self = null;
|
|
544
|
+
var source = null;
|
|
545
|
+
|
|
546
|
+
if (config != null) {
|
|
547
|
+
if (hasValidRef(config)) {
|
|
548
|
+
ref = config.ref;
|
|
549
|
+
}
|
|
550
|
+
if (hasValidKey(config)) {
|
|
551
|
+
key = '' + config.key;
|
|
552
|
+
}
|
|
553
|
+
|
|
554
|
+
self = config.__self === undefined ? null : config.__self;
|
|
555
|
+
source = config.__source === undefined ? null : config.__source;
|
|
556
|
+
// Remaining properties are added to a new props object
|
|
557
|
+
for (propName in config) {
|
|
558
|
+
if (hasOwnProperty.call(config, propName) && !RESERVED_PROPS.hasOwnProperty(propName)) {
|
|
559
|
+
props[propName] = config[propName];
|
|
560
|
+
}
|
|
561
|
+
}
|
|
562
|
+
}
|
|
563
|
+
|
|
564
|
+
// Children can be more than one argument, and those are transferred onto
|
|
565
|
+
// the newly allocated props object.
|
|
566
|
+
var childrenLength = arguments.length - 2;
|
|
567
|
+
if (childrenLength === 1) {
|
|
568
|
+
props.children = children;
|
|
569
|
+
} else if (childrenLength > 1) {
|
|
570
|
+
var childArray = Array(childrenLength);
|
|
571
|
+
for (var i = 0; i < childrenLength; i++) {
|
|
572
|
+
childArray[i] = arguments[i + 2];
|
|
573
|
+
}
|
|
574
|
+
{
|
|
575
|
+
if (Object.freeze) {
|
|
576
|
+
Object.freeze(childArray);
|
|
577
|
+
}
|
|
578
|
+
}
|
|
579
|
+
props.children = childArray;
|
|
580
|
+
}
|
|
581
|
+
|
|
582
|
+
// Resolve default props
|
|
583
|
+
if (type && type.defaultProps) {
|
|
584
|
+
var defaultProps = type.defaultProps;
|
|
585
|
+
for (propName in defaultProps) {
|
|
586
|
+
if (props[propName] === undefined) {
|
|
587
|
+
props[propName] = defaultProps[propName];
|
|
588
|
+
}
|
|
589
|
+
}
|
|
590
|
+
}
|
|
591
|
+
{
|
|
592
|
+
if (key || ref) {
|
|
593
|
+
if (typeof props.$$typeof === 'undefined' || props.$$typeof !== ReactElementSymbol) {
|
|
594
|
+
var displayName = typeof type === 'function' ? type.displayName || type.name || 'Unknown' : type;
|
|
595
|
+
if (key) {
|
|
596
|
+
defineKeyPropWarningGetter(props, displayName);
|
|
597
|
+
}
|
|
598
|
+
if (ref) {
|
|
599
|
+
defineRefPropWarningGetter(props, displayName);
|
|
600
|
+
}
|
|
601
|
+
}
|
|
602
|
+
}
|
|
603
|
+
}
|
|
604
|
+
return ReactElement(type, key, ref, self, source, ReactCurrentOwner_1.current, props);
|
|
605
|
+
};
|
|
606
|
+
|
|
607
|
+
/**
|
|
608
|
+
* Return a function that produces ReactElements of a given type.
|
|
609
|
+
* See https://facebook.github.io/react/docs/react-api.html#createfactory
|
|
610
|
+
*/
|
|
611
|
+
ReactElement.createFactory = function (type) {
|
|
612
|
+
var factory$$1 = ReactElement.createElement.bind(null, type);
|
|
613
|
+
// Expose the type on the factory and the prototype so that it can be
|
|
614
|
+
// easily accessed on elements. E.g. `<Foo />.type === Foo`.
|
|
615
|
+
// This should not be named `constructor` since this may not be the function
|
|
616
|
+
// that created the element, and it may not even be a constructor.
|
|
617
|
+
// Legacy hook TODO: Warn if this is accessed
|
|
618
|
+
factory$$1.type = type;
|
|
619
|
+
return factory$$1;
|
|
620
|
+
};
|
|
621
|
+
|
|
622
|
+
ReactElement.cloneAndReplaceKey = function (oldElement, newKey) {
|
|
623
|
+
var newElement = ReactElement(oldElement.type, newKey, oldElement.ref, oldElement._self, oldElement._source, oldElement._owner, oldElement.props);
|
|
624
|
+
|
|
625
|
+
return newElement;
|
|
626
|
+
};
|
|
627
|
+
|
|
628
|
+
/**
|
|
629
|
+
* Clone and return a new ReactElement using element as the starting point.
|
|
630
|
+
* See https://facebook.github.io/react/docs/react-api.html#cloneelement
|
|
631
|
+
*/
|
|
632
|
+
ReactElement.cloneElement = function (element, config, children) {
|
|
633
|
+
var propName;
|
|
634
|
+
|
|
635
|
+
// Original props are copied
|
|
636
|
+
var props = objectAssign$1({}, element.props);
|
|
637
|
+
|
|
638
|
+
// Reserved names are extracted
|
|
639
|
+
var key = element.key;
|
|
640
|
+
var ref = element.ref;
|
|
641
|
+
// Self is preserved since the owner is preserved.
|
|
642
|
+
var self = element._self;
|
|
643
|
+
// Source is preserved since cloneElement is unlikely to be targeted by a
|
|
644
|
+
// transpiler, and the original source is probably a better indicator of the
|
|
645
|
+
// true owner.
|
|
646
|
+
var source = element._source;
|
|
647
|
+
|
|
648
|
+
// Owner will be preserved, unless ref is overridden
|
|
649
|
+
var owner = element._owner;
|
|
650
|
+
|
|
651
|
+
if (config != null) {
|
|
652
|
+
if (hasValidRef(config)) {
|
|
653
|
+
// Silently steal the ref from the parent.
|
|
654
|
+
ref = config.ref;
|
|
655
|
+
owner = ReactCurrentOwner_1.current;
|
|
656
|
+
}
|
|
657
|
+
if (hasValidKey(config)) {
|
|
658
|
+
key = '' + config.key;
|
|
659
|
+
}
|
|
660
|
+
|
|
661
|
+
// Remaining properties override existing props
|
|
662
|
+
var defaultProps;
|
|
663
|
+
if (element.type && element.type.defaultProps) {
|
|
664
|
+
defaultProps = element.type.defaultProps;
|
|
665
|
+
}
|
|
666
|
+
for (propName in config) {
|
|
667
|
+
if (hasOwnProperty.call(config, propName) && !RESERVED_PROPS.hasOwnProperty(propName)) {
|
|
668
|
+
if (config[propName] === undefined && defaultProps !== undefined) {
|
|
669
|
+
// Resolve default props
|
|
670
|
+
props[propName] = defaultProps[propName];
|
|
671
|
+
} else {
|
|
672
|
+
props[propName] = config[propName];
|
|
673
|
+
}
|
|
674
|
+
}
|
|
675
|
+
}
|
|
676
|
+
}
|
|
677
|
+
|
|
678
|
+
// Children can be more than one argument, and those are transferred onto
|
|
679
|
+
// the newly allocated props object.
|
|
680
|
+
var childrenLength = arguments.length - 2;
|
|
681
|
+
if (childrenLength === 1) {
|
|
682
|
+
props.children = children;
|
|
683
|
+
} else if (childrenLength > 1) {
|
|
684
|
+
var childArray = Array(childrenLength);
|
|
685
|
+
for (var i = 0; i < childrenLength; i++) {
|
|
686
|
+
childArray[i] = arguments[i + 2];
|
|
687
|
+
}
|
|
688
|
+
props.children = childArray;
|
|
689
|
+
}
|
|
690
|
+
|
|
691
|
+
return ReactElement(element.type, key, ref, self, source, owner, props);
|
|
692
|
+
};
|
|
693
|
+
|
|
694
|
+
/**
|
|
695
|
+
* Verifies the object is a ReactElement.
|
|
696
|
+
* See https://facebook.github.io/react/docs/react-api.html#isvalidelement
|
|
697
|
+
* @param {?object} object
|
|
698
|
+
* @return {boolean} True if `object` is a valid component.
|
|
699
|
+
* @final
|
|
700
|
+
*/
|
|
701
|
+
ReactElement.isValidElement = function (object) {
|
|
702
|
+
return typeof object === 'object' && object !== null && object.$$typeof === ReactElementSymbol;
|
|
703
|
+
};
|
|
704
|
+
|
|
705
|
+
var ReactElement_1 = ReactElement;
|
|
706
|
+
|
|
707
|
+
/**
|
|
708
|
+
* Copyright 2013-present, Facebook, Inc.
|
|
709
|
+
* All rights reserved.
|
|
710
|
+
*
|
|
711
|
+
* This source code is licensed under the BSD-style license found in the
|
|
712
|
+
* LICENSE file in the root directory of this source tree. An additional grant
|
|
713
|
+
* of patent rights can be found in the PATENTS file in the same directory.
|
|
714
|
+
*
|
|
715
|
+
* @providesModule getIteratorFn
|
|
716
|
+
*
|
|
717
|
+
*/
|
|
718
|
+
|
|
719
|
+
/* global Symbol */
|
|
720
|
+
|
|
721
|
+
var ITERATOR_SYMBOL = typeof Symbol === 'function' && Symbol.iterator;
|
|
722
|
+
var FAUX_ITERATOR_SYMBOL = '@@iterator'; // Before Symbol spec.
|
|
723
|
+
|
|
724
|
+
/**
|
|
725
|
+
* Returns the iterator method function contained on the iterable object.
|
|
726
|
+
*
|
|
727
|
+
* Be sure to invoke the function with the iterable as context:
|
|
728
|
+
*
|
|
729
|
+
* var iteratorFn = getIteratorFn(myIterable);
|
|
730
|
+
* if (iteratorFn) {
|
|
731
|
+
* var iterator = iteratorFn.call(myIterable);
|
|
732
|
+
* ...
|
|
733
|
+
* }
|
|
734
|
+
*
|
|
735
|
+
* @param {?object} maybeIterable
|
|
736
|
+
* @return {?function}
|
|
737
|
+
*/
|
|
738
|
+
function getIteratorFn(maybeIterable) {
|
|
739
|
+
var iteratorFn = maybeIterable && (ITERATOR_SYMBOL && maybeIterable[ITERATOR_SYMBOL] || maybeIterable[FAUX_ITERATOR_SYMBOL]);
|
|
740
|
+
if (typeof iteratorFn === 'function') {
|
|
741
|
+
return iteratorFn;
|
|
742
|
+
}
|
|
743
|
+
}
|
|
744
|
+
|
|
745
|
+
var getIteratorFn_1 = getIteratorFn;
|
|
746
|
+
|
|
747
|
+
/**
|
|
748
|
+
* Copyright 2013-present, Facebook, Inc.
|
|
749
|
+
* All rights reserved.
|
|
750
|
+
*
|
|
751
|
+
* This source code is licensed under the BSD-style license found in the
|
|
752
|
+
* LICENSE file in the root directory of this source tree. An additional grant
|
|
753
|
+
* of patent rights can be found in the PATENTS file in the same directory.
|
|
754
|
+
*
|
|
755
|
+
* @providesModule KeyEscapeUtils
|
|
756
|
+
*
|
|
757
|
+
*/
|
|
758
|
+
|
|
759
|
+
/**
|
|
760
|
+
* Escape and wrap key so it is safe to use as a reactid
|
|
761
|
+
*
|
|
762
|
+
* @param {string} key to be escaped.
|
|
763
|
+
* @return {string} the escaped key.
|
|
764
|
+
*/
|
|
765
|
+
|
|
766
|
+
function escape(key) {
|
|
767
|
+
var escapeRegex = /[=:]/g;
|
|
768
|
+
var escaperLookup = {
|
|
769
|
+
'=': '=0',
|
|
770
|
+
':': '=2'
|
|
771
|
+
};
|
|
772
|
+
var escapedString = ('' + key).replace(escapeRegex, function (match) {
|
|
773
|
+
return escaperLookup[match];
|
|
774
|
+
});
|
|
775
|
+
|
|
776
|
+
return '$' + escapedString;
|
|
777
|
+
}
|
|
778
|
+
|
|
779
|
+
/**
|
|
780
|
+
* Unescape and unwrap key for human-readable display
|
|
781
|
+
*
|
|
782
|
+
* @param {string} key to unescape.
|
|
783
|
+
* @return {string} the unescaped key.
|
|
784
|
+
*/
|
|
785
|
+
function unescape(key) {
|
|
786
|
+
var unescapeRegex = /(=0|=2)/g;
|
|
787
|
+
var unescaperLookup = {
|
|
788
|
+
'=0': '=',
|
|
789
|
+
'=2': ':'
|
|
790
|
+
};
|
|
791
|
+
var keySubstring = key[0] === '.' && key[1] === '$' ? key.substring(2) : key.substring(1);
|
|
792
|
+
|
|
793
|
+
return ('' + keySubstring).replace(unescapeRegex, function (match) {
|
|
794
|
+
return unescaperLookup[match];
|
|
795
|
+
});
|
|
796
|
+
}
|
|
797
|
+
|
|
798
|
+
var KeyEscapeUtils = {
|
|
799
|
+
escape: escape,
|
|
800
|
+
unescape: unescape
|
|
801
|
+
};
|
|
802
|
+
|
|
803
|
+
var KeyEscapeUtils_1 = KeyEscapeUtils;
|
|
804
|
+
|
|
805
|
+
/**
|
|
806
|
+
* Copyright 2013-present, Facebook, Inc.
|
|
807
|
+
* All rights reserved.
|
|
808
|
+
*
|
|
809
|
+
* This source code is licensed under the BSD-style license found in the
|
|
810
|
+
* LICENSE file in the root directory of this source tree. An additional grant
|
|
811
|
+
* of patent rights can be found in the PATENTS file in the same directory.
|
|
812
|
+
*
|
|
813
|
+
* @providesModule ReactTypeOfWork
|
|
814
|
+
*
|
|
815
|
+
*/
|
|
816
|
+
|
|
817
|
+
var ReactTypeOfWork = {
|
|
818
|
+
IndeterminateComponent: 0, // Before we know whether it is functional or class
|
|
819
|
+
FunctionalComponent: 1,
|
|
820
|
+
ClassComponent: 2,
|
|
821
|
+
HostRoot: 3, // Root of a host tree. Could be nested inside another node.
|
|
822
|
+
HostPortal: 4, // A subtree. Could be an entry point to a different renderer.
|
|
823
|
+
HostComponent: 5,
|
|
824
|
+
HostText: 6,
|
|
825
|
+
CoroutineComponent: 7,
|
|
826
|
+
CoroutineHandlerPhase: 8,
|
|
827
|
+
YieldComponent: 9,
|
|
828
|
+
Fragment: 10
|
|
829
|
+
};
|
|
830
|
+
|
|
831
|
+
/**
|
|
832
|
+
* Copyright 2013-present, Facebook, Inc.
|
|
833
|
+
* All rights reserved.
|
|
834
|
+
*
|
|
835
|
+
* This source code is licensed under the BSD-style license found in the
|
|
836
|
+
* LICENSE file in the root directory of this source tree. An additional grant
|
|
837
|
+
* of patent rights can be found in the PATENTS file in the same directory.
|
|
838
|
+
*
|
|
839
|
+
* @providesModule getComponentName
|
|
840
|
+
*
|
|
841
|
+
*/
|
|
842
|
+
|
|
843
|
+
function getComponentName(instanceOrFiber) {
|
|
844
|
+
if (typeof instanceOrFiber.getName === 'function') {
|
|
845
|
+
// Stack reconciler
|
|
846
|
+
var instance = instanceOrFiber;
|
|
847
|
+
return instance.getName();
|
|
848
|
+
}
|
|
849
|
+
if (typeof instanceOrFiber.tag === 'number') {
|
|
850
|
+
// Fiber reconciler
|
|
851
|
+
var fiber = instanceOrFiber;
|
|
852
|
+
var type = fiber.type;
|
|
853
|
+
|
|
854
|
+
if (typeof type === 'string') {
|
|
855
|
+
return type;
|
|
856
|
+
}
|
|
857
|
+
if (typeof type === 'function') {
|
|
858
|
+
return type.displayName || type.name;
|
|
859
|
+
}
|
|
860
|
+
}
|
|
861
|
+
return null;
|
|
862
|
+
}
|
|
863
|
+
|
|
864
|
+
var getComponentName_1 = getComponentName;
|
|
865
|
+
|
|
866
|
+
var IndeterminateComponent = ReactTypeOfWork.IndeterminateComponent;
|
|
867
|
+
var FunctionalComponent = ReactTypeOfWork.FunctionalComponent;
|
|
868
|
+
var ClassComponent = ReactTypeOfWork.ClassComponent;
|
|
869
|
+
var HostComponent = ReactTypeOfWork.HostComponent;
|
|
870
|
+
|
|
871
|
+
|
|
872
|
+
|
|
873
|
+
function describeComponentFrame$1(name, source, ownerName) {
|
|
874
|
+
return '\n in ' + (name || 'Unknown') + (source ? ' (at ' + source.fileName.replace(/^.*[\\\/]/, '') + ':' + source.lineNumber + ')' : ownerName ? ' (created by ' + ownerName + ')' : '');
|
|
875
|
+
}
|
|
876
|
+
|
|
877
|
+
function describeFiber(fiber) {
|
|
878
|
+
switch (fiber.tag) {
|
|
879
|
+
case IndeterminateComponent:
|
|
880
|
+
case FunctionalComponent:
|
|
881
|
+
case ClassComponent:
|
|
882
|
+
case HostComponent:
|
|
883
|
+
var owner = fiber._debugOwner;
|
|
884
|
+
var source = fiber._debugSource;
|
|
885
|
+
var name = getComponentName_1(fiber);
|
|
886
|
+
var ownerName = null;
|
|
887
|
+
if (owner) {
|
|
888
|
+
ownerName = getComponentName_1(owner);
|
|
889
|
+
}
|
|
890
|
+
return describeComponentFrame$1(name, source, ownerName);
|
|
891
|
+
default:
|
|
892
|
+
return '';
|
|
893
|
+
}
|
|
894
|
+
}
|
|
895
|
+
|
|
896
|
+
// This function can only be called with a work-in-progress fiber and
|
|
897
|
+
// only during begin or complete phase. Do not call it under any other
|
|
898
|
+
// circumstances.
|
|
899
|
+
function getStackAddendumByWorkInProgressFiber$1(workInProgress) {
|
|
900
|
+
var info = '';
|
|
901
|
+
var node = workInProgress;
|
|
902
|
+
do {
|
|
903
|
+
info += describeFiber(node);
|
|
904
|
+
// Otherwise this return pointer might point to the wrong tree:
|
|
905
|
+
node = node['return'];
|
|
906
|
+
} while (node);
|
|
907
|
+
return info;
|
|
908
|
+
}
|
|
909
|
+
|
|
910
|
+
var ReactFiberComponentTreeHook = {
|
|
911
|
+
getStackAddendumByWorkInProgressFiber: getStackAddendumByWorkInProgressFiber$1,
|
|
912
|
+
describeComponentFrame: describeComponentFrame$1
|
|
913
|
+
};
|
|
914
|
+
|
|
915
|
+
var getStackAddendumByWorkInProgressFiber = ReactFiberComponentTreeHook.getStackAddendumByWorkInProgressFiber;
|
|
916
|
+
var describeComponentFrame = ReactFiberComponentTreeHook.describeComponentFrame;
|
|
917
|
+
|
|
918
|
+
|
|
919
|
+
|
|
920
|
+
|
|
921
|
+
|
|
922
|
+
function isNative(fn) {
|
|
923
|
+
// Based on isNative() from Lodash
|
|
924
|
+
var funcToString = Function.prototype.toString;
|
|
925
|
+
var hasOwnProperty = Object.prototype.hasOwnProperty;
|
|
926
|
+
var reIsNative = RegExp('^' + funcToString
|
|
927
|
+
// Take an example native function source for comparison
|
|
928
|
+
.call(hasOwnProperty)
|
|
929
|
+
// Strip regex characters so we can use it for regex
|
|
930
|
+
.replace(/[\\^$.*+?()[\]{}|]/g, '\\$&')
|
|
931
|
+
// Remove hasOwnProperty from the template to make it generic
|
|
932
|
+
.replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g, '$1.*?') + '$');
|
|
933
|
+
try {
|
|
934
|
+
var source = funcToString.call(fn);
|
|
935
|
+
return reIsNative.test(source);
|
|
936
|
+
} catch (err) {
|
|
937
|
+
return false;
|
|
938
|
+
}
|
|
939
|
+
}
|
|
940
|
+
|
|
941
|
+
var canUseCollections =
|
|
942
|
+
// Array.from
|
|
943
|
+
typeof Array.from === 'function' &&
|
|
944
|
+
// Map
|
|
945
|
+
typeof Map === 'function' && isNative(Map) &&
|
|
946
|
+
// Map.prototype.keys
|
|
947
|
+
Map.prototype != null && typeof Map.prototype.keys === 'function' && isNative(Map.prototype.keys) &&
|
|
948
|
+
// Set
|
|
949
|
+
typeof Set === 'function' && isNative(Set) &&
|
|
950
|
+
// Set.prototype.keys
|
|
951
|
+
Set.prototype != null && typeof Set.prototype.keys === 'function' && isNative(Set.prototype.keys);
|
|
952
|
+
|
|
953
|
+
var setItem;
|
|
954
|
+
var getItem;
|
|
955
|
+
var removeItem;
|
|
956
|
+
var getItemIDs;
|
|
957
|
+
var addRoot;
|
|
958
|
+
var removeRoot;
|
|
959
|
+
var getRootIDs;
|
|
960
|
+
|
|
961
|
+
if (canUseCollections) {
|
|
962
|
+
var itemMap = new Map();
|
|
963
|
+
var rootIDSet = new Set();
|
|
964
|
+
|
|
965
|
+
setItem = function (id, item) {
|
|
966
|
+
itemMap.set(id, item);
|
|
967
|
+
};
|
|
968
|
+
getItem = function (id) {
|
|
969
|
+
return itemMap.get(id);
|
|
970
|
+
};
|
|
971
|
+
removeItem = function (id) {
|
|
972
|
+
itemMap['delete'](id);
|
|
973
|
+
};
|
|
974
|
+
getItemIDs = function () {
|
|
975
|
+
return Array.from(itemMap.keys());
|
|
976
|
+
};
|
|
977
|
+
|
|
978
|
+
addRoot = function (id) {
|
|
979
|
+
rootIDSet.add(id);
|
|
980
|
+
};
|
|
981
|
+
removeRoot = function (id) {
|
|
982
|
+
rootIDSet['delete'](id);
|
|
983
|
+
};
|
|
984
|
+
getRootIDs = function () {
|
|
985
|
+
return Array.from(rootIDSet.keys());
|
|
986
|
+
};
|
|
987
|
+
} else {
|
|
988
|
+
var itemByKey = {};
|
|
989
|
+
var rootByKey = {};
|
|
990
|
+
|
|
991
|
+
// Use non-numeric keys to prevent V8 performance issues:
|
|
992
|
+
// https://github.com/facebook/react/pull/7232
|
|
993
|
+
var getKeyFromID = function (id) {
|
|
994
|
+
return '.' + id;
|
|
995
|
+
};
|
|
996
|
+
var getIDFromKey = function (key) {
|
|
997
|
+
return parseInt(key.substr(1), 10);
|
|
998
|
+
};
|
|
999
|
+
|
|
1000
|
+
setItem = function (id, item) {
|
|
1001
|
+
var key = getKeyFromID(id);
|
|
1002
|
+
itemByKey[key] = item;
|
|
1003
|
+
};
|
|
1004
|
+
getItem = function (id) {
|
|
1005
|
+
var key = getKeyFromID(id);
|
|
1006
|
+
return itemByKey[key];
|
|
1007
|
+
};
|
|
1008
|
+
removeItem = function (id) {
|
|
1009
|
+
var key = getKeyFromID(id);
|
|
1010
|
+
delete itemByKey[key];
|
|
1011
|
+
};
|
|
1012
|
+
getItemIDs = function () {
|
|
1013
|
+
return Object.keys(itemByKey).map(getIDFromKey);
|
|
1014
|
+
};
|
|
1015
|
+
|
|
1016
|
+
addRoot = function (id) {
|
|
1017
|
+
var key = getKeyFromID(id);
|
|
1018
|
+
rootByKey[key] = true;
|
|
1019
|
+
};
|
|
1020
|
+
removeRoot = function (id) {
|
|
1021
|
+
var key = getKeyFromID(id);
|
|
1022
|
+
delete rootByKey[key];
|
|
1023
|
+
};
|
|
1024
|
+
getRootIDs = function () {
|
|
1025
|
+
return Object.keys(rootByKey).map(getIDFromKey);
|
|
1026
|
+
};
|
|
1027
|
+
}
|
|
1028
|
+
|
|
1029
|
+
var unmountedIDs = [];
|
|
1030
|
+
|
|
1031
|
+
function purgeDeep(id) {
|
|
1032
|
+
var item = getItem(id);
|
|
1033
|
+
if (item) {
|
|
1034
|
+
var childIDs = item.childIDs;
|
|
1035
|
+
|
|
1036
|
+
removeItem(id);
|
|
1037
|
+
childIDs.forEach(purgeDeep);
|
|
1038
|
+
}
|
|
1039
|
+
}
|
|
1040
|
+
|
|
1041
|
+
function getDisplayName(element) {
|
|
1042
|
+
if (element == null) {
|
|
1043
|
+
return '#empty';
|
|
1044
|
+
} else if (typeof element === 'string' || typeof element === 'number') {
|
|
1045
|
+
return '#text';
|
|
1046
|
+
} else if (typeof element.type === 'string') {
|
|
1047
|
+
return element.type;
|
|
1048
|
+
} else {
|
|
1049
|
+
return element.type.displayName || element.type.name || 'Unknown';
|
|
1050
|
+
}
|
|
1051
|
+
}
|
|
1052
|
+
|
|
1053
|
+
function describeID(id) {
|
|
1054
|
+
var name = ReactComponentTreeHook.getDisplayName(id);
|
|
1055
|
+
var element = ReactComponentTreeHook.getElement(id);
|
|
1056
|
+
var ownerID = ReactComponentTreeHook.getOwnerID(id);
|
|
1057
|
+
var ownerName = void 0;
|
|
1058
|
+
|
|
1059
|
+
if (ownerID) {
|
|
1060
|
+
ownerName = ReactComponentTreeHook.getDisplayName(ownerID);
|
|
1061
|
+
}
|
|
1062
|
+
warning(element, 'ReactComponentTreeHook: Missing React element for debugID %s when ' + 'building stack', id);
|
|
1063
|
+
return describeComponentFrame(name || '', element && element._source, ownerName || '');
|
|
1064
|
+
}
|
|
1065
|
+
|
|
1066
|
+
var ReactComponentTreeHook = {
|
|
1067
|
+
onSetChildren: function (id, nextChildIDs) {
|
|
1068
|
+
var item = getItem(id);
|
|
1069
|
+
invariant(item, 'Item must have been set');
|
|
1070
|
+
item.childIDs = nextChildIDs;
|
|
1071
|
+
|
|
1072
|
+
for (var i = 0; i < nextChildIDs.length; i++) {
|
|
1073
|
+
var nextChildID = nextChildIDs[i];
|
|
1074
|
+
var nextChild = getItem(nextChildID);
|
|
1075
|
+
!nextChild ? invariant(false, 'Expected hook events to fire for the child before its parent includes it in onSetChildren().') : void 0;
|
|
1076
|
+
!(nextChild.childIDs != null || typeof nextChild.element !== 'object' || nextChild.element == null) ? invariant(false, 'Expected onSetChildren() to fire for a container child before its parent includes it in onSetChildren().') : void 0;
|
|
1077
|
+
!nextChild.isMounted ? invariant(false, 'Expected onMountComponent() to fire for the child before its parent includes it in onSetChildren().') : void 0;
|
|
1078
|
+
if (nextChild.parentID == null) {
|
|
1079
|
+
nextChild.parentID = id;
|
|
1080
|
+
// TODO: This shouldn't be necessary but mounting a new root during in
|
|
1081
|
+
// componentWillMount currently causes not-yet-mounted components to
|
|
1082
|
+
// be purged from our tree data so their parent id is missing.
|
|
1083
|
+
}
|
|
1084
|
+
!(nextChild.parentID === id) ? invariant(false, 'Expected onBeforeMountComponent() parent and onSetChildren() to be consistent (%s has parents %s and %s).', nextChildID, nextChild.parentID, id) : void 0;
|
|
1085
|
+
}
|
|
1086
|
+
},
|
|
1087
|
+
onBeforeMountComponent: function (id, element, parentID) {
|
|
1088
|
+
var item = {
|
|
1089
|
+
element: element,
|
|
1090
|
+
parentID: parentID,
|
|
1091
|
+
text: null,
|
|
1092
|
+
childIDs: [],
|
|
1093
|
+
isMounted: false,
|
|
1094
|
+
updateCount: 0
|
|
1095
|
+
};
|
|
1096
|
+
setItem(id, item);
|
|
1097
|
+
},
|
|
1098
|
+
onBeforeUpdateComponent: function (id, element) {
|
|
1099
|
+
var item = getItem(id);
|
|
1100
|
+
if (!item || !item.isMounted) {
|
|
1101
|
+
// We may end up here as a result of setState() in componentWillUnmount().
|
|
1102
|
+
// In this case, ignore the element.
|
|
1103
|
+
return;
|
|
1104
|
+
}
|
|
1105
|
+
item.element = element;
|
|
1106
|
+
},
|
|
1107
|
+
onMountComponent: function (id) {
|
|
1108
|
+
var item = getItem(id);
|
|
1109
|
+
invariant(item, 'Item must have been set');
|
|
1110
|
+
item.isMounted = true;
|
|
1111
|
+
var isRoot = item.parentID === 0;
|
|
1112
|
+
if (isRoot) {
|
|
1113
|
+
addRoot(id);
|
|
1114
|
+
}
|
|
1115
|
+
},
|
|
1116
|
+
onUpdateComponent: function (id) {
|
|
1117
|
+
var item = getItem(id);
|
|
1118
|
+
if (!item || !item.isMounted) {
|
|
1119
|
+
// We may end up here as a result of setState() in componentWillUnmount().
|
|
1120
|
+
// In this case, ignore the element.
|
|
1121
|
+
return;
|
|
1122
|
+
}
|
|
1123
|
+
item.updateCount++;
|
|
1124
|
+
},
|
|
1125
|
+
onUnmountComponent: function (id) {
|
|
1126
|
+
var item = getItem(id);
|
|
1127
|
+
if (item) {
|
|
1128
|
+
// We need to check if it exists.
|
|
1129
|
+
// `item` might not exist if it is inside an error boundary, and a sibling
|
|
1130
|
+
// error boundary child threw while mounting. Then this instance never
|
|
1131
|
+
// got a chance to mount, but it still gets an unmounting event during
|
|
1132
|
+
// the error boundary cleanup.
|
|
1133
|
+
item.isMounted = false;
|
|
1134
|
+
var isRoot = item.parentID === 0;
|
|
1135
|
+
if (isRoot) {
|
|
1136
|
+
removeRoot(id);
|
|
1137
|
+
}
|
|
1138
|
+
}
|
|
1139
|
+
unmountedIDs.push(id);
|
|
1140
|
+
},
|
|
1141
|
+
purgeUnmountedComponents: function () {
|
|
1142
|
+
if (ReactComponentTreeHook._preventPurging) {
|
|
1143
|
+
// Should only be used for testing.
|
|
1144
|
+
return;
|
|
1145
|
+
}
|
|
1146
|
+
|
|
1147
|
+
for (var i = 0; i < unmountedIDs.length; i++) {
|
|
1148
|
+
var id = unmountedIDs[i];
|
|
1149
|
+
purgeDeep(id);
|
|
1150
|
+
}
|
|
1151
|
+
unmountedIDs.length = 0;
|
|
1152
|
+
},
|
|
1153
|
+
isMounted: function (id) {
|
|
1154
|
+
var item = getItem(id);
|
|
1155
|
+
return item ? item.isMounted : false;
|
|
1156
|
+
},
|
|
1157
|
+
getCurrentStackAddendum: function (topElement) {
|
|
1158
|
+
var info = '';
|
|
1159
|
+
if (topElement) {
|
|
1160
|
+
var name = getDisplayName(topElement);
|
|
1161
|
+
var owner = topElement._owner;
|
|
1162
|
+
info += describeComponentFrame(name, topElement._source, owner && getComponentName_1(owner));
|
|
1163
|
+
}
|
|
1164
|
+
|
|
1165
|
+
var currentOwner = ReactCurrentOwner_1.current;
|
|
1166
|
+
if (currentOwner) {
|
|
1167
|
+
if (typeof currentOwner.tag === 'number') {
|
|
1168
|
+
var workInProgress = currentOwner;
|
|
1169
|
+
// Safe because if current owner exists, we are reconciling,
|
|
1170
|
+
// and it is guaranteed to be the work-in-progress version.
|
|
1171
|
+
info += getStackAddendumByWorkInProgressFiber(workInProgress);
|
|
1172
|
+
} else if (typeof currentOwner._debugID === 'number') {
|
|
1173
|
+
info += ReactComponentTreeHook.getStackAddendumByID(currentOwner._debugID);
|
|
1174
|
+
}
|
|
1175
|
+
}
|
|
1176
|
+
return info;
|
|
1177
|
+
},
|
|
1178
|
+
getStackAddendumByID: function (id) {
|
|
1179
|
+
var info = '';
|
|
1180
|
+
while (id) {
|
|
1181
|
+
info += describeID(id);
|
|
1182
|
+
id = ReactComponentTreeHook.getParentID(id);
|
|
1183
|
+
}
|
|
1184
|
+
return info;
|
|
1185
|
+
},
|
|
1186
|
+
getChildIDs: function (id) {
|
|
1187
|
+
var item = getItem(id);
|
|
1188
|
+
return item ? item.childIDs : [];
|
|
1189
|
+
},
|
|
1190
|
+
getDisplayName: function (id) {
|
|
1191
|
+
var element = ReactComponentTreeHook.getElement(id);
|
|
1192
|
+
if (!element) {
|
|
1193
|
+
return null;
|
|
1194
|
+
}
|
|
1195
|
+
return getDisplayName(element);
|
|
1196
|
+
},
|
|
1197
|
+
getElement: function (id) {
|
|
1198
|
+
var item = getItem(id);
|
|
1199
|
+
return item ? item.element : null;
|
|
1200
|
+
},
|
|
1201
|
+
getOwnerID: function (id) {
|
|
1202
|
+
var element = ReactComponentTreeHook.getElement(id);
|
|
1203
|
+
if (!element || !element._owner) {
|
|
1204
|
+
return null;
|
|
1205
|
+
}
|
|
1206
|
+
return element._owner._debugID;
|
|
1207
|
+
},
|
|
1208
|
+
getParentID: function (id) {
|
|
1209
|
+
var item = getItem(id);
|
|
1210
|
+
return item ? item.parentID : null;
|
|
1211
|
+
},
|
|
1212
|
+
getSource: function (id) {
|
|
1213
|
+
var item = getItem(id);
|
|
1214
|
+
var element = item ? item.element : null;
|
|
1215
|
+
var source = element != null ? element._source : null;
|
|
1216
|
+
return source;
|
|
1217
|
+
},
|
|
1218
|
+
getText: function (id) {
|
|
1219
|
+
var element = ReactComponentTreeHook.getElement(id);
|
|
1220
|
+
if (typeof element === 'string') {
|
|
1221
|
+
return element;
|
|
1222
|
+
} else if (typeof element === 'number') {
|
|
1223
|
+
return '' + element;
|
|
1224
|
+
} else {
|
|
1225
|
+
return null;
|
|
1226
|
+
}
|
|
1227
|
+
},
|
|
1228
|
+
getUpdateCount: function (id) {
|
|
1229
|
+
var item = getItem(id);
|
|
1230
|
+
return item ? item.updateCount : 0;
|
|
1231
|
+
},
|
|
1232
|
+
|
|
1233
|
+
|
|
1234
|
+
getRootIDs: getRootIDs,
|
|
1235
|
+
getRegisteredIDs: getItemIDs
|
|
1236
|
+
};
|
|
1237
|
+
|
|
1238
|
+
var ReactComponentTreeHook_1 = ReactComponentTreeHook;
|
|
1239
|
+
|
|
1240
|
+
{
|
|
1241
|
+
var _require = ReactComponentTreeHook_1,
|
|
1242
|
+
getCurrentStackAddendum = _require.getCurrentStackAddendum;
|
|
1243
|
+
}
|
|
1244
|
+
|
|
1245
|
+
var SEPARATOR = '.';
|
|
1246
|
+
var SUBSEPARATOR = ':';
|
|
1247
|
+
|
|
1248
|
+
/**
|
|
1249
|
+
* This is inlined from ReactElement since this file is shared between
|
|
1250
|
+
* isomorphic and renderers. We could extract this to a
|
|
1251
|
+
*
|
|
1252
|
+
*/
|
|
1253
|
+
|
|
1254
|
+
/**
|
|
1255
|
+
* TODO: Test that a single child and an array with one item have the same key
|
|
1256
|
+
* pattern.
|
|
1257
|
+
*/
|
|
1258
|
+
|
|
1259
|
+
var didWarnAboutMaps = false;
|
|
1260
|
+
|
|
1261
|
+
/**
|
|
1262
|
+
* Generate a key string that identifies a component within a set.
|
|
1263
|
+
*
|
|
1264
|
+
* @param {*} component A component that could contain a manual key.
|
|
1265
|
+
* @param {number} index Index that is used if a manual key is not provided.
|
|
1266
|
+
* @return {string}
|
|
1267
|
+
*/
|
|
1268
|
+
function getComponentKey(component, index) {
|
|
1269
|
+
// Do some typechecking here since we call this blindly. We want to ensure
|
|
1270
|
+
// that we don't block potential future ES APIs.
|
|
1271
|
+
if (component && typeof component === 'object' && component.key != null) {
|
|
1272
|
+
// Explicit key
|
|
1273
|
+
return KeyEscapeUtils_1.escape(component.key);
|
|
1274
|
+
}
|
|
1275
|
+
// Implicit key determined by the index in the set
|
|
1276
|
+
return index.toString(36);
|
|
1277
|
+
}
|
|
1278
|
+
|
|
1279
|
+
/**
|
|
1280
|
+
* @param {?*} children Children tree container.
|
|
1281
|
+
* @param {!string} nameSoFar Name of the key path so far.
|
|
1282
|
+
* @param {!function} callback Callback to invoke with each child found.
|
|
1283
|
+
* @param {?*} traverseContext Used to pass information throughout the traversal
|
|
1284
|
+
* process.
|
|
1285
|
+
* @return {!number} The number of children in this subtree.
|
|
1286
|
+
*/
|
|
1287
|
+
function traverseAllChildrenImpl(children, nameSoFar, callback, traverseContext) {
|
|
1288
|
+
var type = typeof children;
|
|
1289
|
+
|
|
1290
|
+
if (type === 'undefined' || type === 'boolean') {
|
|
1291
|
+
// All of the above are perceived as null.
|
|
1292
|
+
children = null;
|
|
1293
|
+
}
|
|
1294
|
+
|
|
1295
|
+
if (children === null || type === 'string' || type === 'number' ||
|
|
1296
|
+
// The following is inlined from ReactElement. This means we can optimize
|
|
1297
|
+
// some checks. React Fiber also inlines this logic for similar purposes.
|
|
1298
|
+
type === 'object' && children.$$typeof === ReactElementSymbol) {
|
|
1299
|
+
callback(traverseContext, children,
|
|
1300
|
+
// If it's the only child, treat the name as if it was wrapped in an array
|
|
1301
|
+
// so that it's consistent if the number of children grows.
|
|
1302
|
+
nameSoFar === '' ? SEPARATOR + getComponentKey(children, 0) : nameSoFar);
|
|
1303
|
+
return 1;
|
|
1304
|
+
}
|
|
1305
|
+
|
|
1306
|
+
var child;
|
|
1307
|
+
var nextName;
|
|
1308
|
+
var subtreeCount = 0; // Count of children found in the current subtree.
|
|
1309
|
+
var nextNamePrefix = nameSoFar === '' ? SEPARATOR : nameSoFar + SUBSEPARATOR;
|
|
1310
|
+
|
|
1311
|
+
if (Array.isArray(children)) {
|
|
1312
|
+
for (var i = 0; i < children.length; i++) {
|
|
1313
|
+
child = children[i];
|
|
1314
|
+
nextName = nextNamePrefix + getComponentKey(child, i);
|
|
1315
|
+
subtreeCount += traverseAllChildrenImpl(child, nextName, callback, traverseContext);
|
|
1316
|
+
}
|
|
1317
|
+
} else {
|
|
1318
|
+
var iteratorFn = getIteratorFn_1(children);
|
|
1319
|
+
if (iteratorFn) {
|
|
1320
|
+
{
|
|
1321
|
+
// Warn about using Maps as children
|
|
1322
|
+
if (iteratorFn === children.entries) {
|
|
1323
|
+
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', getCurrentStackAddendum());
|
|
1324
|
+
didWarnAboutMaps = true;
|
|
1325
|
+
}
|
|
1326
|
+
}
|
|
1327
|
+
|
|
1328
|
+
var iterator = iteratorFn.call(children);
|
|
1329
|
+
var step;
|
|
1330
|
+
var ii = 0;
|
|
1331
|
+
while (!(step = iterator.next()).done) {
|
|
1332
|
+
child = step.value;
|
|
1333
|
+
nextName = nextNamePrefix + getComponentKey(child, ii++);
|
|
1334
|
+
subtreeCount += traverseAllChildrenImpl(child, nextName, callback, traverseContext);
|
|
1335
|
+
}
|
|
1336
|
+
} else if (type === 'object') {
|
|
1337
|
+
var addendum = '';
|
|
1338
|
+
{
|
|
1339
|
+
addendum = ' If you meant to render a collection of children, use an array ' + 'instead.' + getCurrentStackAddendum();
|
|
1340
|
+
}
|
|
1341
|
+
var childrenString = '' + children;
|
|
1342
|
+
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);
|
|
1343
|
+
}
|
|
1344
|
+
}
|
|
1345
|
+
|
|
1346
|
+
return subtreeCount;
|
|
1347
|
+
}
|
|
1348
|
+
|
|
1349
|
+
/**
|
|
1350
|
+
* Traverses children that are typically specified as `props.children`, but
|
|
1351
|
+
* might also be specified through attributes:
|
|
1352
|
+
*
|
|
1353
|
+
* - `traverseAllChildren(this.props.children, ...)`
|
|
1354
|
+
* - `traverseAllChildren(this.props.leftPanelChildren, ...)`
|
|
1355
|
+
*
|
|
1356
|
+
* The `traverseContext` is an optional argument that is passed through the
|
|
1357
|
+
* entire traversal. It can be used to store accumulations or anything else that
|
|
1358
|
+
* the callback might find relevant.
|
|
1359
|
+
*
|
|
1360
|
+
* @param {?*} children Children tree object.
|
|
1361
|
+
* @param {!function} callback To invoke upon traversing each child.
|
|
1362
|
+
* @param {?*} traverseContext Context for traversal.
|
|
1363
|
+
* @return {!number} The number of children in this subtree.
|
|
1364
|
+
*/
|
|
1365
|
+
function traverseAllChildren(children, callback, traverseContext) {
|
|
1366
|
+
if (children == null) {
|
|
1367
|
+
return 0;
|
|
1368
|
+
}
|
|
1369
|
+
|
|
1370
|
+
return traverseAllChildrenImpl(children, '', callback, traverseContext);
|
|
1371
|
+
}
|
|
1372
|
+
|
|
1373
|
+
var traverseAllChildren_1 = traverseAllChildren;
|
|
1374
|
+
|
|
1375
|
+
var twoArgumentPooler = PooledClass_1.twoArgumentPooler;
|
|
1376
|
+
var fourArgumentPooler = PooledClass_1.fourArgumentPooler;
|
|
1377
|
+
|
|
1378
|
+
var userProvidedKeyEscapeRegex = /\/+/g;
|
|
1379
|
+
function escapeUserProvidedKey(text) {
|
|
1380
|
+
return ('' + text).replace(userProvidedKeyEscapeRegex, '$&/');
|
|
1381
|
+
}
|
|
1382
|
+
|
|
1383
|
+
/**
|
|
1384
|
+
* PooledClass representing the bookkeeping associated with performing a child
|
|
1385
|
+
* traversal. Allows avoiding binding callbacks.
|
|
1386
|
+
*
|
|
1387
|
+
* @constructor ForEachBookKeeping
|
|
1388
|
+
* @param {!function} forEachFunction Function to perform traversal with.
|
|
1389
|
+
* @param {?*} forEachContext Context to perform context with.
|
|
1390
|
+
*/
|
|
1391
|
+
function ForEachBookKeeping(forEachFunction, forEachContext) {
|
|
1392
|
+
this.func = forEachFunction;
|
|
1393
|
+
this.context = forEachContext;
|
|
1394
|
+
this.count = 0;
|
|
1395
|
+
}
|
|
1396
|
+
ForEachBookKeeping.prototype.destructor = function () {
|
|
1397
|
+
this.func = null;
|
|
1398
|
+
this.context = null;
|
|
1399
|
+
this.count = 0;
|
|
1400
|
+
};
|
|
1401
|
+
PooledClass_1.addPoolingTo(ForEachBookKeeping, twoArgumentPooler);
|
|
1402
|
+
|
|
1403
|
+
function forEachSingleChild(bookKeeping, child, name) {
|
|
1404
|
+
var func = bookKeeping.func,
|
|
1405
|
+
context = bookKeeping.context;
|
|
1406
|
+
|
|
1407
|
+
func.call(context, child, bookKeeping.count++);
|
|
1408
|
+
}
|
|
1409
|
+
|
|
1410
|
+
/**
|
|
1411
|
+
* Iterates through children that are typically specified as `props.children`.
|
|
1412
|
+
*
|
|
1413
|
+
* See https://facebook.github.io/react/docs/react-api.html#react.children.foreach
|
|
1414
|
+
*
|
|
1415
|
+
* The provided forEachFunc(child, index) will be called for each
|
|
1416
|
+
* leaf child.
|
|
1417
|
+
*
|
|
1418
|
+
* @param {?*} children Children tree container.
|
|
1419
|
+
* @param {function(*, int)} forEachFunc
|
|
1420
|
+
* @param {*} forEachContext Context for forEachContext.
|
|
1421
|
+
*/
|
|
1422
|
+
function forEachChildren(children, forEachFunc, forEachContext) {
|
|
1423
|
+
if (children == null) {
|
|
1424
|
+
return children;
|
|
1425
|
+
}
|
|
1426
|
+
var traverseContext = ForEachBookKeeping.getPooled(forEachFunc, forEachContext);
|
|
1427
|
+
traverseAllChildren_1(children, forEachSingleChild, traverseContext);
|
|
1428
|
+
ForEachBookKeeping.release(traverseContext);
|
|
1429
|
+
}
|
|
1430
|
+
|
|
1431
|
+
/**
|
|
1432
|
+
* PooledClass representing the bookkeeping associated with performing a child
|
|
1433
|
+
* mapping. Allows avoiding binding callbacks.
|
|
1434
|
+
*
|
|
1435
|
+
* @constructor MapBookKeeping
|
|
1436
|
+
* @param {!*} mapResult Object containing the ordered map of results.
|
|
1437
|
+
* @param {!function} mapFunction Function to perform mapping with.
|
|
1438
|
+
* @param {?*} mapContext Context to perform mapping with.
|
|
1439
|
+
*/
|
|
1440
|
+
function MapBookKeeping(mapResult, keyPrefix, mapFunction, mapContext) {
|
|
1441
|
+
this.result = mapResult;
|
|
1442
|
+
this.keyPrefix = keyPrefix;
|
|
1443
|
+
this.func = mapFunction;
|
|
1444
|
+
this.context = mapContext;
|
|
1445
|
+
this.count = 0;
|
|
1446
|
+
}
|
|
1447
|
+
MapBookKeeping.prototype.destructor = function () {
|
|
1448
|
+
this.result = null;
|
|
1449
|
+
this.keyPrefix = null;
|
|
1450
|
+
this.func = null;
|
|
1451
|
+
this.context = null;
|
|
1452
|
+
this.count = 0;
|
|
1453
|
+
};
|
|
1454
|
+
PooledClass_1.addPoolingTo(MapBookKeeping, fourArgumentPooler);
|
|
1455
|
+
|
|
1456
|
+
function mapSingleChildIntoContext(bookKeeping, child, childKey) {
|
|
1457
|
+
var result = bookKeeping.result,
|
|
1458
|
+
keyPrefix = bookKeeping.keyPrefix,
|
|
1459
|
+
func = bookKeeping.func,
|
|
1460
|
+
context = bookKeeping.context;
|
|
1461
|
+
|
|
1462
|
+
|
|
1463
|
+
var mappedChild = func.call(context, child, bookKeeping.count++);
|
|
1464
|
+
if (Array.isArray(mappedChild)) {
|
|
1465
|
+
mapIntoWithKeyPrefixInternal(mappedChild, result, childKey, emptyFunction.thatReturnsArgument);
|
|
1466
|
+
} else if (mappedChild != null) {
|
|
1467
|
+
if (ReactElement_1.isValidElement(mappedChild)) {
|
|
1468
|
+
mappedChild = ReactElement_1.cloneAndReplaceKey(mappedChild,
|
|
1469
|
+
// Keep both the (mapped) and old keys if they differ, just as
|
|
1470
|
+
// traverseAllChildren used to do for objects as children
|
|
1471
|
+
keyPrefix + (mappedChild.key && (!child || child.key !== mappedChild.key) ? escapeUserProvidedKey(mappedChild.key) + '/' : '') + childKey);
|
|
1472
|
+
}
|
|
1473
|
+
result.push(mappedChild);
|
|
1474
|
+
}
|
|
1475
|
+
}
|
|
1476
|
+
|
|
1477
|
+
function mapIntoWithKeyPrefixInternal(children, array, prefix, func, context) {
|
|
1478
|
+
var escapedPrefix = '';
|
|
1479
|
+
if (prefix != null) {
|
|
1480
|
+
escapedPrefix = escapeUserProvidedKey(prefix) + '/';
|
|
1481
|
+
}
|
|
1482
|
+
var traverseContext = MapBookKeeping.getPooled(array, escapedPrefix, func, context);
|
|
1483
|
+
traverseAllChildren_1(children, mapSingleChildIntoContext, traverseContext);
|
|
1484
|
+
MapBookKeeping.release(traverseContext);
|
|
1485
|
+
}
|
|
1486
|
+
|
|
1487
|
+
/**
|
|
1488
|
+
* Maps children that are typically specified as `props.children`.
|
|
1489
|
+
*
|
|
1490
|
+
* See https://facebook.github.io/react/docs/react-api.html#react.children.map
|
|
1491
|
+
*
|
|
1492
|
+
* The provided mapFunction(child, key, index) will be called for each
|
|
1493
|
+
* leaf child.
|
|
1494
|
+
*
|
|
1495
|
+
* @param {?*} children Children tree container.
|
|
1496
|
+
* @param {function(*, int)} func The map function.
|
|
1497
|
+
* @param {*} context Context for mapFunction.
|
|
1498
|
+
* @return {object} Object containing the ordered map of results.
|
|
1499
|
+
*/
|
|
1500
|
+
function mapChildren(children, func, context) {
|
|
1501
|
+
if (children == null) {
|
|
1502
|
+
return children;
|
|
1503
|
+
}
|
|
1504
|
+
var result = [];
|
|
1505
|
+
mapIntoWithKeyPrefixInternal(children, result, null, func, context);
|
|
1506
|
+
return result;
|
|
1507
|
+
}
|
|
1508
|
+
|
|
1509
|
+
function forEachSingleChildDummy(traverseContext, child, name) {
|
|
1510
|
+
return null;
|
|
1511
|
+
}
|
|
1512
|
+
|
|
1513
|
+
/**
|
|
1514
|
+
* Count the number of children that are typically specified as
|
|
1515
|
+
* `props.children`.
|
|
1516
|
+
*
|
|
1517
|
+
* See https://facebook.github.io/react/docs/react-api.html#react.children.count
|
|
1518
|
+
*
|
|
1519
|
+
* @param {?*} children Children tree container.
|
|
1520
|
+
* @return {number} The number of children.
|
|
1521
|
+
*/
|
|
1522
|
+
function countChildren(children, context) {
|
|
1523
|
+
return traverseAllChildren_1(children, forEachSingleChildDummy, null);
|
|
1524
|
+
}
|
|
1525
|
+
|
|
1526
|
+
/**
|
|
1527
|
+
* Flatten a children object (typically specified as `props.children`) and
|
|
1528
|
+
* return an array with appropriately re-keyed children.
|
|
1529
|
+
*
|
|
1530
|
+
* See https://facebook.github.io/react/docs/react-api.html#react.children.toarray
|
|
1531
|
+
*/
|
|
1532
|
+
function toArray(children) {
|
|
1533
|
+
var result = [];
|
|
1534
|
+
mapIntoWithKeyPrefixInternal(children, result, null, emptyFunction.thatReturnsArgument);
|
|
1535
|
+
return result;
|
|
1536
|
+
}
|
|
1537
|
+
|
|
1538
|
+
var ReactChildren = {
|
|
1539
|
+
forEach: forEachChildren,
|
|
1540
|
+
map: mapChildren,
|
|
1541
|
+
mapIntoWithKeyPrefixInternal: mapIntoWithKeyPrefixInternal,
|
|
1542
|
+
count: countChildren,
|
|
1543
|
+
toArray: toArray
|
|
1544
|
+
};
|
|
1545
|
+
|
|
1546
|
+
var ReactChildren_1 = ReactChildren;
|
|
1547
|
+
|
|
1548
|
+
var ReactDebugCurrentFrame$1 = {};
|
|
1549
|
+
|
|
1550
|
+
{
|
|
1551
|
+
var _require$2 = ReactComponentTreeHook_1,
|
|
1552
|
+
getStackAddendumByID = _require$2.getStackAddendumByID,
|
|
1553
|
+
getCurrentStackAddendum$2 = _require$2.getCurrentStackAddendum;
|
|
1554
|
+
|
|
1555
|
+
var _require2$1 = ReactFiberComponentTreeHook,
|
|
1556
|
+
getStackAddendumByWorkInProgressFiber$2 = _require2$1.getStackAddendumByWorkInProgressFiber;
|
|
1557
|
+
|
|
1558
|
+
// Component that is being worked on
|
|
1559
|
+
|
|
1560
|
+
|
|
1561
|
+
ReactDebugCurrentFrame$1.current = null;
|
|
1562
|
+
|
|
1563
|
+
// Element that is being cloned or created
|
|
1564
|
+
ReactDebugCurrentFrame$1.element = null;
|
|
1565
|
+
|
|
1566
|
+
ReactDebugCurrentFrame$1.getStackAddendum = function () {
|
|
1567
|
+
var stack = null;
|
|
1568
|
+
var current = ReactDebugCurrentFrame$1.current;
|
|
1569
|
+
var element = ReactDebugCurrentFrame$1.element;
|
|
1570
|
+
if (current !== null) {
|
|
1571
|
+
if (typeof current === 'number') {
|
|
1572
|
+
// DebugID from Stack.
|
|
1573
|
+
var debugID = current;
|
|
1574
|
+
stack = getStackAddendumByID(debugID);
|
|
1575
|
+
} else if (typeof current.tag === 'number') {
|
|
1576
|
+
// This is a Fiber.
|
|
1577
|
+
// The stack will only be correct if this is a work in progress
|
|
1578
|
+
// version and we're calling it during reconciliation.
|
|
1579
|
+
var workInProgress = current;
|
|
1580
|
+
stack = getStackAddendumByWorkInProgressFiber$2(workInProgress);
|
|
1581
|
+
}
|
|
1582
|
+
} else if (element !== null) {
|
|
1583
|
+
stack = getCurrentStackAddendum$2(element);
|
|
1584
|
+
}
|
|
1585
|
+
return stack;
|
|
1586
|
+
};
|
|
1587
|
+
}
|
|
1588
|
+
|
|
1589
|
+
var ReactDebugCurrentFrame_1 = ReactDebugCurrentFrame$1;
|
|
1590
|
+
|
|
1591
|
+
{
|
|
1592
|
+
var checkPropTypes$1 = checkPropTypes;
|
|
1593
|
+
var warning$2 = warning;
|
|
1594
|
+
var ReactDebugCurrentFrame = ReactDebugCurrentFrame_1;
|
|
1595
|
+
|
|
1596
|
+
var _require$1 = ReactComponentTreeHook_1,
|
|
1597
|
+
getCurrentStackAddendum$1 = _require$1.getCurrentStackAddendum;
|
|
1598
|
+
}
|
|
1599
|
+
|
|
1600
|
+
function getDeclarationErrorAddendum() {
|
|
1601
|
+
if (ReactCurrentOwner_1.current) {
|
|
1602
|
+
var name = getComponentName_1(ReactCurrentOwner_1.current);
|
|
1603
|
+
if (name) {
|
|
1604
|
+
return '\n\nCheck the render method of `' + name + '`.';
|
|
1605
|
+
}
|
|
1606
|
+
}
|
|
1607
|
+
return '';
|
|
1608
|
+
}
|
|
1609
|
+
|
|
1610
|
+
function getSourceInfoErrorAddendum(elementProps) {
|
|
1611
|
+
if (elementProps !== null && elementProps !== undefined && elementProps.__source !== undefined) {
|
|
1612
|
+
var source = elementProps.__source;
|
|
1613
|
+
var fileName = source.fileName.replace(/^.*[\\\/]/, '');
|
|
1614
|
+
var lineNumber = source.lineNumber;
|
|
1615
|
+
return '\n\nCheck your code at ' + fileName + ':' + lineNumber + '.';
|
|
1616
|
+
}
|
|
1617
|
+
return '';
|
|
1618
|
+
}
|
|
1619
|
+
|
|
1620
|
+
/**
|
|
1621
|
+
* Warn if there's no key explicitly set on dynamic arrays of children or
|
|
1622
|
+
* object keys are not valid. This allows us to keep track of children between
|
|
1623
|
+
* updates.
|
|
1624
|
+
*/
|
|
1625
|
+
var ownerHasKeyUseWarning = {};
|
|
1626
|
+
|
|
1627
|
+
function getCurrentComponentErrorInfo(parentType) {
|
|
1628
|
+
var info = getDeclarationErrorAddendum();
|
|
1629
|
+
|
|
1630
|
+
if (!info) {
|
|
1631
|
+
var parentName = typeof parentType === 'string' ? parentType : parentType.displayName || parentType.name;
|
|
1632
|
+
if (parentName) {
|
|
1633
|
+
info = '\n\nCheck the top-level render call using <' + parentName + '>.';
|
|
1634
|
+
}
|
|
1635
|
+
}
|
|
1636
|
+
return info;
|
|
1637
|
+
}
|
|
1638
|
+
|
|
1639
|
+
/**
|
|
1640
|
+
* Warn if the element doesn't have an explicit key assigned to it.
|
|
1641
|
+
* This element is in an array. The array could grow and shrink or be
|
|
1642
|
+
* reordered. All children that haven't already been validated are required to
|
|
1643
|
+
* have a "key" property assigned to it. Error statuses are cached so a warning
|
|
1644
|
+
* will only be shown once.
|
|
1645
|
+
*
|
|
1646
|
+
* @internal
|
|
1647
|
+
* @param {ReactElement} element Element that requires a key.
|
|
1648
|
+
* @param {*} parentType element's parent's type.
|
|
1649
|
+
*/
|
|
1650
|
+
function validateExplicitKey(element, parentType) {
|
|
1651
|
+
if (!element._store || element._store.validated || element.key != null) {
|
|
1652
|
+
return;
|
|
1653
|
+
}
|
|
1654
|
+
element._store.validated = true;
|
|
1655
|
+
|
|
1656
|
+
var currentComponentErrorInfo = getCurrentComponentErrorInfo(parentType);
|
|
1657
|
+
if (ownerHasKeyUseWarning[currentComponentErrorInfo]) {
|
|
1658
|
+
return;
|
|
1659
|
+
}
|
|
1660
|
+
ownerHasKeyUseWarning[currentComponentErrorInfo] = true;
|
|
1661
|
+
|
|
1662
|
+
// Usually the current owner is the offender, but if it accepts children as a
|
|
1663
|
+
// property, it may be the creator of the child that's responsible for
|
|
1664
|
+
// assigning it a key.
|
|
1665
|
+
var childOwner = '';
|
|
1666
|
+
if (element && element._owner && element._owner !== ReactCurrentOwner_1.current) {
|
|
1667
|
+
// Give the component that originally created this child.
|
|
1668
|
+
childOwner = ' It was passed a child from ' + getComponentName_1(element._owner) + '.';
|
|
1669
|
+
}
|
|
1670
|
+
|
|
1671
|
+
warning$2(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$1(element));
|
|
1672
|
+
}
|
|
1673
|
+
|
|
1674
|
+
/**
|
|
1675
|
+
* Ensure that every element either is passed in a static location, in an
|
|
1676
|
+
* array with an explicit keys property defined, or in an object literal
|
|
1677
|
+
* with valid key property.
|
|
1678
|
+
*
|
|
1679
|
+
* @internal
|
|
1680
|
+
* @param {ReactNode} node Statically passed child of any type.
|
|
1681
|
+
* @param {*} parentType node's parent's type.
|
|
1682
|
+
*/
|
|
1683
|
+
function validateChildKeys(node, parentType) {
|
|
1684
|
+
if (typeof node !== 'object') {
|
|
1685
|
+
return;
|
|
1686
|
+
}
|
|
1687
|
+
if (Array.isArray(node)) {
|
|
1688
|
+
for (var i = 0; i < node.length; i++) {
|
|
1689
|
+
var child = node[i];
|
|
1690
|
+
if (ReactElement_1.isValidElement(child)) {
|
|
1691
|
+
validateExplicitKey(child, parentType);
|
|
1692
|
+
}
|
|
1693
|
+
}
|
|
1694
|
+
} else if (ReactElement_1.isValidElement(node)) {
|
|
1695
|
+
// This element was passed in a valid location.
|
|
1696
|
+
if (node._store) {
|
|
1697
|
+
node._store.validated = true;
|
|
1698
|
+
}
|
|
1699
|
+
} else if (node) {
|
|
1700
|
+
var iteratorFn = getIteratorFn_1(node);
|
|
1701
|
+
// Entry iterators provide implicit keys.
|
|
1702
|
+
if (iteratorFn) {
|
|
1703
|
+
if (iteratorFn !== node.entries) {
|
|
1704
|
+
var iterator = iteratorFn.call(node);
|
|
1705
|
+
var step;
|
|
1706
|
+
while (!(step = iterator.next()).done) {
|
|
1707
|
+
if (ReactElement_1.isValidElement(step.value)) {
|
|
1708
|
+
validateExplicitKey(step.value, parentType);
|
|
1709
|
+
}
|
|
1710
|
+
}
|
|
1711
|
+
}
|
|
1712
|
+
}
|
|
1713
|
+
}
|
|
1714
|
+
}
|
|
1715
|
+
|
|
1716
|
+
/**
|
|
1717
|
+
* Given an element, validate that its props follow the propTypes definition,
|
|
1718
|
+
* provided by the type.
|
|
1719
|
+
*
|
|
1720
|
+
* @param {ReactElement} element
|
|
1721
|
+
*/
|
|
1722
|
+
function validatePropTypes(element) {
|
|
1723
|
+
var componentClass = element.type;
|
|
1724
|
+
if (typeof componentClass !== 'function') {
|
|
1725
|
+
return;
|
|
1726
|
+
}
|
|
1727
|
+
var name = componentClass.displayName || componentClass.name;
|
|
1728
|
+
|
|
1729
|
+
// ReactNative `View.propTypes` have been deprecated in favor of `ViewPropTypes`.
|
|
1730
|
+
// In their place a temporary getter has been added with a deprecated warning message.
|
|
1731
|
+
// Avoid triggering that warning during validation using the temporary workaround,
|
|
1732
|
+
// __propTypesSecretDontUseThesePlease.
|
|
1733
|
+
// TODO (bvaughn) Revert this particular change any time after April 1 ReactNative tag.
|
|
1734
|
+
var propTypes = typeof componentClass.__propTypesSecretDontUseThesePlease === 'object' ? componentClass.__propTypesSecretDontUseThesePlease : componentClass.propTypes;
|
|
1735
|
+
|
|
1736
|
+
if (propTypes) {
|
|
1737
|
+
checkPropTypes$1(propTypes, element.props, 'prop', name, ReactDebugCurrentFrame.getStackAddendum);
|
|
1738
|
+
}
|
|
1739
|
+
if (typeof componentClass.getDefaultProps === 'function') {
|
|
1740
|
+
warning$2(componentClass.getDefaultProps.isReactClassApproved, 'getDefaultProps is only used on classic React.createClass ' + 'definitions. Use a static property named `defaultProps` instead.');
|
|
1741
|
+
}
|
|
1742
|
+
}
|
|
1743
|
+
|
|
1744
|
+
var ReactElementValidator$2 = {
|
|
1745
|
+
createElement: function (type, props, children) {
|
|
1746
|
+
var validType = typeof type === 'string' || typeof type === 'function';
|
|
1747
|
+
// We warn in this case but don't throw. We expect the element creation to
|
|
1748
|
+
// succeed and there will likely be errors in render.
|
|
1749
|
+
if (!validType) {
|
|
1750
|
+
var info = '';
|
|
1751
|
+
if (type === undefined || typeof type === 'object' && type !== null && Object.keys(type).length === 0) {
|
|
1752
|
+
info += ' You likely forgot to export your component from the file ' + "it's defined in.";
|
|
1753
|
+
}
|
|
1754
|
+
|
|
1755
|
+
var sourceInfo = getSourceInfoErrorAddendum(props);
|
|
1756
|
+
if (sourceInfo) {
|
|
1757
|
+
info += sourceInfo;
|
|
1758
|
+
} else {
|
|
1759
|
+
info += getDeclarationErrorAddendum();
|
|
1760
|
+
}
|
|
1761
|
+
|
|
1762
|
+
info += getCurrentStackAddendum$1();
|
|
1763
|
+
|
|
1764
|
+
warning$2(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);
|
|
1765
|
+
}
|
|
1766
|
+
|
|
1767
|
+
var element = ReactElement_1.createElement.apply(this, arguments);
|
|
1768
|
+
|
|
1769
|
+
// The result can be nullish if a mock or a custom function is used.
|
|
1770
|
+
// TODO: Drop this when these are no longer allowed as the type argument.
|
|
1771
|
+
if (element == null) {
|
|
1772
|
+
return element;
|
|
1773
|
+
}
|
|
1774
|
+
|
|
1775
|
+
{
|
|
1776
|
+
ReactDebugCurrentFrame.element = element;
|
|
1777
|
+
}
|
|
1778
|
+
|
|
1779
|
+
// Skip key warning if the type isn't valid since our key validation logic
|
|
1780
|
+
// doesn't expect a non-string/function type and can throw confusing errors.
|
|
1781
|
+
// We don't want exception behavior to differ between dev and prod.
|
|
1782
|
+
// (Rendering will throw with a helpful message and as soon as the type is
|
|
1783
|
+
// fixed, the key warnings will appear.)
|
|
1784
|
+
if (validType) {
|
|
1785
|
+
for (var i = 2; i < arguments.length; i++) {
|
|
1786
|
+
validateChildKeys(arguments[i], type);
|
|
1787
|
+
}
|
|
1788
|
+
}
|
|
1789
|
+
|
|
1790
|
+
validatePropTypes(element);
|
|
1791
|
+
|
|
1792
|
+
{
|
|
1793
|
+
ReactDebugCurrentFrame.element = null;
|
|
1794
|
+
}
|
|
1795
|
+
|
|
1796
|
+
return element;
|
|
1797
|
+
},
|
|
1798
|
+
|
|
1799
|
+
createFactory: function (type) {
|
|
1800
|
+
var validatedFactory = ReactElementValidator$2.createElement.bind(null, type);
|
|
1801
|
+
// Legacy hook TODO: Warn if this is accessed
|
|
1802
|
+
validatedFactory.type = type;
|
|
1803
|
+
|
|
1804
|
+
{
|
|
1805
|
+
if (canDefineProperty_1) {
|
|
1806
|
+
Object.defineProperty(validatedFactory, 'type', {
|
|
1807
|
+
enumerable: false,
|
|
1808
|
+
get: function () {
|
|
1809
|
+
warning$2(false, 'Factory.type is deprecated. Access the class directly ' + 'before passing it to createFactory.');
|
|
1810
|
+
Object.defineProperty(this, 'type', {
|
|
1811
|
+
value: type
|
|
1812
|
+
});
|
|
1813
|
+
return type;
|
|
1814
|
+
}
|
|
1815
|
+
});
|
|
1816
|
+
}
|
|
1817
|
+
}
|
|
1818
|
+
|
|
1819
|
+
return validatedFactory;
|
|
1820
|
+
},
|
|
1821
|
+
|
|
1822
|
+
cloneElement: function (element, props, children) {
|
|
1823
|
+
var newElement = ReactElement_1.cloneElement.apply(this, arguments);
|
|
1824
|
+
{
|
|
1825
|
+
ReactDebugCurrentFrame.element = newElement;
|
|
1826
|
+
}
|
|
1827
|
+
for (var i = 2; i < arguments.length; i++) {
|
|
1828
|
+
validateChildKeys(arguments[i], newElement.type);
|
|
1829
|
+
}
|
|
1830
|
+
validatePropTypes(newElement);
|
|
1831
|
+
{
|
|
1832
|
+
ReactDebugCurrentFrame.element = null;
|
|
1833
|
+
}
|
|
1834
|
+
return newElement;
|
|
1835
|
+
}
|
|
1836
|
+
};
|
|
1837
|
+
|
|
1838
|
+
var ReactElementValidator_1 = ReactElementValidator$2;
|
|
1839
|
+
|
|
1840
|
+
/**
|
|
1841
|
+
* Create a factory that creates HTML tag elements.
|
|
1842
|
+
*
|
|
1843
|
+
* @private
|
|
1844
|
+
*/
|
|
1845
|
+
var createDOMFactory = ReactElement_1.createFactory;
|
|
1846
|
+
{
|
|
1847
|
+
var ReactElementValidator$1 = ReactElementValidator_1;
|
|
1848
|
+
createDOMFactory = ReactElementValidator$1.createFactory;
|
|
1849
|
+
}
|
|
1850
|
+
|
|
1851
|
+
/**
|
|
1852
|
+
* Creates a mapping from supported HTML tags to `ReactDOMComponent` classes.
|
|
1853
|
+
* This is also accessible via `React.DOM`.
|
|
1854
|
+
*
|
|
1855
|
+
* @public
|
|
1856
|
+
*/
|
|
1857
|
+
var ReactDOMFactories = {
|
|
1858
|
+
a: createDOMFactory('a'),
|
|
1859
|
+
abbr: createDOMFactory('abbr'),
|
|
1860
|
+
address: createDOMFactory('address'),
|
|
1861
|
+
area: createDOMFactory('area'),
|
|
1862
|
+
article: createDOMFactory('article'),
|
|
1863
|
+
aside: createDOMFactory('aside'),
|
|
1864
|
+
audio: createDOMFactory('audio'),
|
|
1865
|
+
b: createDOMFactory('b'),
|
|
1866
|
+
base: createDOMFactory('base'),
|
|
1867
|
+
bdi: createDOMFactory('bdi'),
|
|
1868
|
+
bdo: createDOMFactory('bdo'),
|
|
1869
|
+
big: createDOMFactory('big'),
|
|
1870
|
+
blockquote: createDOMFactory('blockquote'),
|
|
1871
|
+
body: createDOMFactory('body'),
|
|
1872
|
+
br: createDOMFactory('br'),
|
|
1873
|
+
button: createDOMFactory('button'),
|
|
1874
|
+
canvas: createDOMFactory('canvas'),
|
|
1875
|
+
caption: createDOMFactory('caption'),
|
|
1876
|
+
cite: createDOMFactory('cite'),
|
|
1877
|
+
code: createDOMFactory('code'),
|
|
1878
|
+
col: createDOMFactory('col'),
|
|
1879
|
+
colgroup: createDOMFactory('colgroup'),
|
|
1880
|
+
data: createDOMFactory('data'),
|
|
1881
|
+
datalist: createDOMFactory('datalist'),
|
|
1882
|
+
dd: createDOMFactory('dd'),
|
|
1883
|
+
del: createDOMFactory('del'),
|
|
1884
|
+
details: createDOMFactory('details'),
|
|
1885
|
+
dfn: createDOMFactory('dfn'),
|
|
1886
|
+
dialog: createDOMFactory('dialog'),
|
|
1887
|
+
div: createDOMFactory('div'),
|
|
1888
|
+
dl: createDOMFactory('dl'),
|
|
1889
|
+
dt: createDOMFactory('dt'),
|
|
1890
|
+
em: createDOMFactory('em'),
|
|
1891
|
+
embed: createDOMFactory('embed'),
|
|
1892
|
+
fieldset: createDOMFactory('fieldset'),
|
|
1893
|
+
figcaption: createDOMFactory('figcaption'),
|
|
1894
|
+
figure: createDOMFactory('figure'),
|
|
1895
|
+
footer: createDOMFactory('footer'),
|
|
1896
|
+
form: createDOMFactory('form'),
|
|
1897
|
+
h1: createDOMFactory('h1'),
|
|
1898
|
+
h2: createDOMFactory('h2'),
|
|
1899
|
+
h3: createDOMFactory('h3'),
|
|
1900
|
+
h4: createDOMFactory('h4'),
|
|
1901
|
+
h5: createDOMFactory('h5'),
|
|
1902
|
+
h6: createDOMFactory('h6'),
|
|
1903
|
+
head: createDOMFactory('head'),
|
|
1904
|
+
header: createDOMFactory('header'),
|
|
1905
|
+
hgroup: createDOMFactory('hgroup'),
|
|
1906
|
+
hr: createDOMFactory('hr'),
|
|
1907
|
+
html: createDOMFactory('html'),
|
|
1908
|
+
i: createDOMFactory('i'),
|
|
1909
|
+
iframe: createDOMFactory('iframe'),
|
|
1910
|
+
img: createDOMFactory('img'),
|
|
1911
|
+
input: createDOMFactory('input'),
|
|
1912
|
+
ins: createDOMFactory('ins'),
|
|
1913
|
+
kbd: createDOMFactory('kbd'),
|
|
1914
|
+
keygen: createDOMFactory('keygen'),
|
|
1915
|
+
label: createDOMFactory('label'),
|
|
1916
|
+
legend: createDOMFactory('legend'),
|
|
1917
|
+
li: createDOMFactory('li'),
|
|
1918
|
+
link: createDOMFactory('link'),
|
|
1919
|
+
main: createDOMFactory('main'),
|
|
1920
|
+
map: createDOMFactory('map'),
|
|
1921
|
+
mark: createDOMFactory('mark'),
|
|
1922
|
+
menu: createDOMFactory('menu'),
|
|
1923
|
+
menuitem: createDOMFactory('menuitem'),
|
|
1924
|
+
meta: createDOMFactory('meta'),
|
|
1925
|
+
meter: createDOMFactory('meter'),
|
|
1926
|
+
nav: createDOMFactory('nav'),
|
|
1927
|
+
noscript: createDOMFactory('noscript'),
|
|
1928
|
+
object: createDOMFactory('object'),
|
|
1929
|
+
ol: createDOMFactory('ol'),
|
|
1930
|
+
optgroup: createDOMFactory('optgroup'),
|
|
1931
|
+
option: createDOMFactory('option'),
|
|
1932
|
+
output: createDOMFactory('output'),
|
|
1933
|
+
p: createDOMFactory('p'),
|
|
1934
|
+
param: createDOMFactory('param'),
|
|
1935
|
+
picture: createDOMFactory('picture'),
|
|
1936
|
+
pre: createDOMFactory('pre'),
|
|
1937
|
+
progress: createDOMFactory('progress'),
|
|
1938
|
+
q: createDOMFactory('q'),
|
|
1939
|
+
rp: createDOMFactory('rp'),
|
|
1940
|
+
rt: createDOMFactory('rt'),
|
|
1941
|
+
ruby: createDOMFactory('ruby'),
|
|
1942
|
+
s: createDOMFactory('s'),
|
|
1943
|
+
samp: createDOMFactory('samp'),
|
|
1944
|
+
script: createDOMFactory('script'),
|
|
1945
|
+
section: createDOMFactory('section'),
|
|
1946
|
+
select: createDOMFactory('select'),
|
|
1947
|
+
small: createDOMFactory('small'),
|
|
1948
|
+
source: createDOMFactory('source'),
|
|
1949
|
+
span: createDOMFactory('span'),
|
|
1950
|
+
strong: createDOMFactory('strong'),
|
|
1951
|
+
style: createDOMFactory('style'),
|
|
1952
|
+
sub: createDOMFactory('sub'),
|
|
1953
|
+
summary: createDOMFactory('summary'),
|
|
1954
|
+
sup: createDOMFactory('sup'),
|
|
1955
|
+
table: createDOMFactory('table'),
|
|
1956
|
+
tbody: createDOMFactory('tbody'),
|
|
1957
|
+
td: createDOMFactory('td'),
|
|
1958
|
+
textarea: createDOMFactory('textarea'),
|
|
1959
|
+
tfoot: createDOMFactory('tfoot'),
|
|
1960
|
+
th: createDOMFactory('th'),
|
|
1961
|
+
thead: createDOMFactory('thead'),
|
|
1962
|
+
time: createDOMFactory('time'),
|
|
1963
|
+
title: createDOMFactory('title'),
|
|
1964
|
+
tr: createDOMFactory('tr'),
|
|
1965
|
+
track: createDOMFactory('track'),
|
|
1966
|
+
u: createDOMFactory('u'),
|
|
1967
|
+
ul: createDOMFactory('ul'),
|
|
1968
|
+
'var': createDOMFactory('var'),
|
|
1969
|
+
video: createDOMFactory('video'),
|
|
1970
|
+
wbr: createDOMFactory('wbr'),
|
|
1971
|
+
|
|
1972
|
+
// SVG
|
|
1973
|
+
circle: createDOMFactory('circle'),
|
|
1974
|
+
clipPath: createDOMFactory('clipPath'),
|
|
1975
|
+
defs: createDOMFactory('defs'),
|
|
1976
|
+
ellipse: createDOMFactory('ellipse'),
|
|
1977
|
+
g: createDOMFactory('g'),
|
|
1978
|
+
image: createDOMFactory('image'),
|
|
1979
|
+
line: createDOMFactory('line'),
|
|
1980
|
+
linearGradient: createDOMFactory('linearGradient'),
|
|
1981
|
+
mask: createDOMFactory('mask'),
|
|
1982
|
+
path: createDOMFactory('path'),
|
|
1983
|
+
pattern: createDOMFactory('pattern'),
|
|
1984
|
+
polygon: createDOMFactory('polygon'),
|
|
1985
|
+
polyline: createDOMFactory('polyline'),
|
|
1986
|
+
radialGradient: createDOMFactory('radialGradient'),
|
|
1987
|
+
rect: createDOMFactory('rect'),
|
|
1988
|
+
stop: createDOMFactory('stop'),
|
|
1989
|
+
svg: createDOMFactory('svg'),
|
|
1990
|
+
text: createDOMFactory('text'),
|
|
1991
|
+
tspan: createDOMFactory('tspan')
|
|
1992
|
+
};
|
|
1993
|
+
|
|
1994
|
+
var ReactDOMFactories_1 = ReactDOMFactories;
|
|
1995
|
+
|
|
1996
|
+
var isValidElement = ReactElement_1.isValidElement;
|
|
1997
|
+
|
|
1998
|
+
|
|
1999
|
+
|
|
2000
|
+
var ReactPropTypes = factory(isValidElement);
|
|
2001
|
+
|
|
2002
|
+
/**
|
|
2003
|
+
* Copyright 2013-present, Facebook, Inc.
|
|
2004
|
+
* All rights reserved.
|
|
2005
|
+
*
|
|
2006
|
+
* This source code is licensed under the BSD-style license found in the
|
|
2007
|
+
* LICENSE file in the root directory of this source tree. An additional grant
|
|
2008
|
+
* of patent rights can be found in the PATENTS file in the same directory.
|
|
2009
|
+
*
|
|
2010
|
+
* @providesModule ReactVersion
|
|
2011
|
+
*/
|
|
2012
|
+
|
|
2013
|
+
var ReactVersion = '16.0.0-alpha.10';
|
|
2014
|
+
|
|
2015
|
+
/**
|
|
2016
|
+
* Returns the first child in a collection of children and verifies that there
|
|
2017
|
+
* is only one child in the collection.
|
|
2018
|
+
*
|
|
2019
|
+
* See https://facebook.github.io/react/docs/react-api.html#react.children.only
|
|
2020
|
+
*
|
|
2021
|
+
* The current implementation of this function assumes that a single child gets
|
|
2022
|
+
* passed without a wrapper, but the purpose of this helper function is to
|
|
2023
|
+
* abstract away the particular structure of children.
|
|
2024
|
+
*
|
|
2025
|
+
* @param {?object} children Child collection structure.
|
|
2026
|
+
* @return {ReactElement} The first and only `ReactElement` contained in the
|
|
2027
|
+
* structure.
|
|
2028
|
+
*/
|
|
2029
|
+
function onlyChild(children) {
|
|
2030
|
+
!ReactElement_1.isValidElement(children) ? invariant(false, 'React.Children.only expected to receive a single React element child.') : void 0;
|
|
2031
|
+
return children;
|
|
2032
|
+
}
|
|
2033
|
+
|
|
2034
|
+
var onlyChild_1 = onlyChild;
|
|
2035
|
+
|
|
2036
|
+
var Component = ReactBaseClasses.Component;
|
|
2037
|
+
|
|
2038
|
+
var isValidElement$1 = ReactElement_1.isValidElement;
|
|
2039
|
+
|
|
2040
|
+
|
|
2041
|
+
|
|
2042
|
+
|
|
2043
|
+
var createClass = factory$1(Component, isValidElement$1, ReactNoopUpdateQueue_1);
|
|
2044
|
+
|
|
2045
|
+
var createElement = ReactElement_1.createElement;
|
|
2046
|
+
var createFactory = ReactElement_1.createFactory;
|
|
2047
|
+
var cloneElement = ReactElement_1.cloneElement;
|
|
2048
|
+
|
|
2049
|
+
{
|
|
2050
|
+
var warning$1 = warning;
|
|
2051
|
+
var canDefineProperty = canDefineProperty_1;
|
|
2052
|
+
var ReactElementValidator = ReactElementValidator_1;
|
|
2053
|
+
createElement = ReactElementValidator.createElement;
|
|
2054
|
+
createFactory = ReactElementValidator.createFactory;
|
|
2055
|
+
cloneElement = ReactElementValidator.cloneElement;
|
|
2056
|
+
}
|
|
2057
|
+
|
|
2058
|
+
var createMixin = function (mixin) {
|
|
2059
|
+
return mixin;
|
|
2060
|
+
};
|
|
2061
|
+
|
|
2062
|
+
var React = {
|
|
2063
|
+
// Modern
|
|
2064
|
+
|
|
2065
|
+
Children: {
|
|
2066
|
+
map: ReactChildren_1.map,
|
|
2067
|
+
forEach: ReactChildren_1.forEach,
|
|
2068
|
+
count: ReactChildren_1.count,
|
|
2069
|
+
toArray: ReactChildren_1.toArray,
|
|
2070
|
+
only: onlyChild_1
|
|
2071
|
+
},
|
|
2072
|
+
|
|
2073
|
+
Component: ReactBaseClasses.Component,
|
|
2074
|
+
PureComponent: ReactBaseClasses.PureComponent,
|
|
2075
|
+
|
|
2076
|
+
createElement: createElement,
|
|
2077
|
+
cloneElement: cloneElement,
|
|
2078
|
+
isValidElement: ReactElement_1.isValidElement,
|
|
2079
|
+
|
|
2080
|
+
// TODO (bvaughn) Remove these getters before 16.0.0
|
|
2081
|
+
PropTypes: ReactPropTypes,
|
|
2082
|
+
checkPropTypes: checkPropTypes,
|
|
2083
|
+
createClass: createClass,
|
|
2084
|
+
|
|
2085
|
+
// Classic
|
|
2086
|
+
|
|
2087
|
+
createFactory: createFactory,
|
|
2088
|
+
createMixin: createMixin,
|
|
2089
|
+
|
|
2090
|
+
// This looks DOM specific but these are actually isomorphic helpers
|
|
2091
|
+
// since they are just generating DOM strings.
|
|
2092
|
+
DOM: ReactDOMFactories_1,
|
|
2093
|
+
|
|
2094
|
+
version: ReactVersion,
|
|
2095
|
+
|
|
2096
|
+
__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED: {
|
|
2097
|
+
ReactCurrentOwner: ReactCurrentOwner_1
|
|
2098
|
+
}
|
|
2099
|
+
};
|
|
2100
|
+
|
|
2101
|
+
{
|
|
2102
|
+
objectAssign$1(React.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED, {
|
|
2103
|
+
// These should not be included in production.
|
|
2104
|
+
ReactComponentTreeHook: ReactComponentTreeHook_1,
|
|
2105
|
+
ReactDebugCurrentFrame: ReactDebugCurrentFrame_1
|
|
2106
|
+
});
|
|
2107
|
+
|
|
2108
|
+
var warnedForCheckPropTypes = false;
|
|
2109
|
+
var warnedForCreateMixin = false;
|
|
2110
|
+
var warnedForCreateClass = false;
|
|
2111
|
+
var warnedForPropTypes = false;
|
|
2112
|
+
|
|
2113
|
+
React.createMixin = function (mixin) {
|
|
2114
|
+
warning$1(warnedForCreateMixin, 'React.createMixin is deprecated and should not be used. You ' + 'can use this mixin directly instead.');
|
|
2115
|
+
warnedForCreateMixin = true;
|
|
2116
|
+
return mixin;
|
|
2117
|
+
};
|
|
2118
|
+
|
|
2119
|
+
// TODO (bvaughn) Remove both of these deprecation warnings before 16.0.0
|
|
2120
|
+
if (canDefineProperty) {
|
|
2121
|
+
Object.defineProperty(React, 'checkPropTypes', {
|
|
2122
|
+
get: function () {
|
|
2123
|
+
warning$1(warnedForCheckPropTypes, 'checkPropTypes has been moved to a separate package. ' + 'Accessing React.checkPropTypes is no longer supported ' + 'and will be removed completely in React 16. ' + 'Use the prop-types package on npm instead. ' + '(https://fb.me/migrating-from-react-proptypes)');
|
|
2124
|
+
warnedForCheckPropTypes = true;
|
|
2125
|
+
return ReactPropTypes;
|
|
2126
|
+
}
|
|
2127
|
+
});
|
|
2128
|
+
|
|
2129
|
+
Object.defineProperty(React, 'createClass', {
|
|
2130
|
+
get: function () {
|
|
2131
|
+
warning$1(warnedForCreateClass, 'React.createClass is no longer supported. Use a plain JavaScript ' + "class instead. If you're not yet ready to migrate, " + 'create-react-class is available on npm as a drop-in replacement. ' + '(https://fb.me/migrating-from-react-create-class)');
|
|
2132
|
+
warnedForCreateClass = true;
|
|
2133
|
+
return createClass;
|
|
2134
|
+
}
|
|
2135
|
+
});
|
|
2136
|
+
|
|
2137
|
+
Object.defineProperty(React, 'PropTypes', {
|
|
2138
|
+
get: function () {
|
|
2139
|
+
warning$1(warnedForPropTypes, 'PropTypes has been moved to a separate package. ' + 'Accessing React.PropTypes is no longer supported ' + 'and will be removed completely in React 16. ' + 'Use the prop-types package on npm instead. ' + '(https://fb.me/migrating-from-react-proptypes)');
|
|
2140
|
+
warnedForPropTypes = true;
|
|
2141
|
+
return ReactPropTypes;
|
|
2142
|
+
}
|
|
2143
|
+
});
|
|
2144
|
+
}
|
|
2145
|
+
}
|
|
2146
|
+
|
|
2147
|
+
var React_1 = React;
|
|
2148
|
+
|
|
2149
|
+
module.exports = React_1;
|