graphiql-rails 1.4.5 → 1.4.6
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.
- checksums.yaml +4 -4
- data/app/assets/javascripts/graphiql/rails/application.js +3 -3
- data/app/assets/javascripts/graphiql/rails/{graphiql-0.11.5.js → graphiql-0.11.9.js} +240 -190
- data/app/assets/javascripts/graphiql/rails/react-16.0.0.js +1698 -0
- data/app/assets/javascripts/graphiql/rails/react-dom-16.0.0.js +17221 -0
- data/app/assets/stylesheets/graphiql/rails/application.css +1 -1
- data/app/assets/stylesheets/graphiql/rails/{graphiql-0.11.5.css → graphiql-0.11.9.css} +2 -2
- data/lib/graphiql/rails/version.rb +1 -1
- metadata +6 -6
- data/app/assets/javascripts/graphiql/rails/react-15.6.2.js +0 -4268
- data/app/assets/javascripts/graphiql/rails/react-dom-15.6.2.js +0 -18853
@@ -0,0 +1,1698 @@
|
|
1
|
+
/** @license React v16.0.0
|
2
|
+
* react.development.js
|
3
|
+
*
|
4
|
+
* Copyright (c) 2013-present, Facebook, Inc.
|
5
|
+
*
|
6
|
+
* This source code is licensed under the MIT license found in the
|
7
|
+
* LICENSE file in the root directory of this source tree.
|
8
|
+
*/
|
9
|
+
'use strict';
|
10
|
+
|
11
|
+
|
12
|
+
if (process.env.NODE_ENV !== "production") {
|
13
|
+
(function() {
|
14
|
+
|
15
|
+
'use strict';
|
16
|
+
|
17
|
+
var objectAssign$1 = require('object-assign');
|
18
|
+
var require$$0 = require('fbjs/lib/warning');
|
19
|
+
var emptyObject = require('fbjs/lib/emptyObject');
|
20
|
+
var invariant = require('fbjs/lib/invariant');
|
21
|
+
var emptyFunction = require('fbjs/lib/emptyFunction');
|
22
|
+
var checkPropTypes = require('prop-types/checkPropTypes');
|
23
|
+
|
24
|
+
/**
|
25
|
+
* Copyright (c) 2013-present, Facebook, Inc.
|
26
|
+
*
|
27
|
+
* This source code is licensed under the MIT license found in the
|
28
|
+
* LICENSE file in the root directory of this source tree.
|
29
|
+
*
|
30
|
+
* @providesModule reactProdInvariant
|
31
|
+
*
|
32
|
+
*/
|
33
|
+
|
34
|
+
{
|
35
|
+
var warning = require$$0;
|
36
|
+
}
|
37
|
+
|
38
|
+
function warnNoop(publicInstance, callerName) {
|
39
|
+
{
|
40
|
+
var constructor = publicInstance.constructor;
|
41
|
+
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');
|
42
|
+
}
|
43
|
+
}
|
44
|
+
|
45
|
+
/**
|
46
|
+
* This is the abstract API for an update queue.
|
47
|
+
*/
|
48
|
+
var ReactNoopUpdateQueue = {
|
49
|
+
/**
|
50
|
+
* Checks whether or not this composite component is mounted.
|
51
|
+
* @param {ReactClass} publicInstance The instance we want to test.
|
52
|
+
* @return {boolean} True if mounted, false otherwise.
|
53
|
+
* @protected
|
54
|
+
* @final
|
55
|
+
*/
|
56
|
+
isMounted: function (publicInstance) {
|
57
|
+
return false;
|
58
|
+
},
|
59
|
+
|
60
|
+
/**
|
61
|
+
* Forces an update. This should only be invoked when it is known with
|
62
|
+
* certainty that we are **not** in a DOM transaction.
|
63
|
+
*
|
64
|
+
* You may want to call this when you know that some deeper aspect of the
|
65
|
+
* component's state has changed but `setState` was not called.
|
66
|
+
*
|
67
|
+
* This will not invoke `shouldComponentUpdate`, but it will invoke
|
68
|
+
* `componentWillUpdate` and `componentDidUpdate`.
|
69
|
+
*
|
70
|
+
* @param {ReactClass} publicInstance The instance that should rerender.
|
71
|
+
* @param {?function} callback Called after component is updated.
|
72
|
+
* @param {?string} callerName name of the calling function in the public API.
|
73
|
+
* @internal
|
74
|
+
*/
|
75
|
+
enqueueForceUpdate: function (publicInstance, callback, callerName) {
|
76
|
+
warnNoop(publicInstance, 'forceUpdate');
|
77
|
+
},
|
78
|
+
|
79
|
+
/**
|
80
|
+
* Replaces all of the state. Always use this or `setState` to mutate state.
|
81
|
+
* You should treat `this.state` as immutable.
|
82
|
+
*
|
83
|
+
* There is no guarantee that `this.state` will be immediately updated, so
|
84
|
+
* accessing `this.state` after calling this method may return the old value.
|
85
|
+
*
|
86
|
+
* @param {ReactClass} publicInstance The instance that should rerender.
|
87
|
+
* @param {object} completeState Next state.
|
88
|
+
* @param {?function} callback Called after component is updated.
|
89
|
+
* @param {?string} callerName name of the calling function in the public API.
|
90
|
+
* @internal
|
91
|
+
*/
|
92
|
+
enqueueReplaceState: function (publicInstance, completeState, callback, callerName) {
|
93
|
+
warnNoop(publicInstance, 'replaceState');
|
94
|
+
},
|
95
|
+
|
96
|
+
/**
|
97
|
+
* Sets a subset of the state. This only exists because _pendingState is
|
98
|
+
* internal. This provides a merging strategy that is not available to deep
|
99
|
+
* properties which is confusing. TODO: Expose pendingState or don't use it
|
100
|
+
* during the merge.
|
101
|
+
*
|
102
|
+
* @param {ReactClass} publicInstance The instance that should rerender.
|
103
|
+
* @param {object} partialState Next partial state to be merged with state.
|
104
|
+
* @param {?function} callback Called after component is updated.
|
105
|
+
* @param {?string} Name of the calling function in the public API.
|
106
|
+
* @internal
|
107
|
+
*/
|
108
|
+
enqueueSetState: function (publicInstance, partialState, callback, callerName) {
|
109
|
+
warnNoop(publicInstance, 'setState');
|
110
|
+
}
|
111
|
+
};
|
112
|
+
|
113
|
+
var ReactNoopUpdateQueue_1 = ReactNoopUpdateQueue;
|
114
|
+
|
115
|
+
/**
|
116
|
+
* Copyright (c) 2014-present, Facebook, Inc.
|
117
|
+
*
|
118
|
+
* This source code is licensed under the MIT license found in the
|
119
|
+
* LICENSE file in the root directory of this source tree.
|
120
|
+
*
|
121
|
+
* @providesModule lowPriorityWarning
|
122
|
+
*/
|
123
|
+
|
124
|
+
/**
|
125
|
+
* Forked from fbjs/warning:
|
126
|
+
* https://github.com/facebook/fbjs/blob/e66ba20ad5be433eb54423f2b097d829324d9de6/packages/fbjs/src/__forks__/warning.js
|
127
|
+
*
|
128
|
+
* Only change is we use console.warn instead of console.error,
|
129
|
+
* and do nothing when 'console' is not supported.
|
130
|
+
* This really simplifies the code.
|
131
|
+
* ---
|
132
|
+
* Similar to invariant but only logs a warning if the condition is not met.
|
133
|
+
* This can be used to log issues in development environments in critical
|
134
|
+
* paths. Removing the logging code for production environments will keep the
|
135
|
+
* same logic and follow the same code paths.
|
136
|
+
*/
|
137
|
+
|
138
|
+
var lowPriorityWarning = function () {};
|
139
|
+
|
140
|
+
{
|
141
|
+
var printWarning = function (format) {
|
142
|
+
for (var _len = arguments.length, args = Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {
|
143
|
+
args[_key - 1] = arguments[_key];
|
144
|
+
}
|
145
|
+
|
146
|
+
var argIndex = 0;
|
147
|
+
var message = 'Warning: ' + format.replace(/%s/g, function () {
|
148
|
+
return args[argIndex++];
|
149
|
+
});
|
150
|
+
if (typeof console !== 'undefined') {
|
151
|
+
console.warn(message);
|
152
|
+
}
|
153
|
+
try {
|
154
|
+
// --- Welcome to debugging React ---
|
155
|
+
// This error was thrown as a convenience so that you can use this stack
|
156
|
+
// to find the callsite that caused this warning to fire.
|
157
|
+
throw new Error(message);
|
158
|
+
} catch (x) {}
|
159
|
+
};
|
160
|
+
|
161
|
+
lowPriorityWarning = function (condition, format) {
|
162
|
+
if (format === undefined) {
|
163
|
+
throw new Error('`warning(condition, format, ...args)` requires a warning ' + 'message argument');
|
164
|
+
}
|
165
|
+
if (!condition) {
|
166
|
+
for (var _len2 = arguments.length, args = Array(_len2 > 2 ? _len2 - 2 : 0), _key2 = 2; _key2 < _len2; _key2++) {
|
167
|
+
args[_key2 - 2] = arguments[_key2];
|
168
|
+
}
|
169
|
+
|
170
|
+
printWarning.apply(undefined, [format].concat(args));
|
171
|
+
}
|
172
|
+
};
|
173
|
+
}
|
174
|
+
|
175
|
+
var lowPriorityWarning_1 = lowPriorityWarning;
|
176
|
+
|
177
|
+
/**
|
178
|
+
* Base class helpers for the updating state of a component.
|
179
|
+
*/
|
180
|
+
function ReactComponent(props, context, updater) {
|
181
|
+
this.props = props;
|
182
|
+
this.context = context;
|
183
|
+
this.refs = emptyObject;
|
184
|
+
// We initialize the default updater but the real one gets injected by the
|
185
|
+
// renderer.
|
186
|
+
this.updater = updater || ReactNoopUpdateQueue_1;
|
187
|
+
}
|
188
|
+
|
189
|
+
ReactComponent.prototype.isReactComponent = {};
|
190
|
+
|
191
|
+
/**
|
192
|
+
* Sets a subset of the state. Always use this to mutate
|
193
|
+
* state. You should treat `this.state` as immutable.
|
194
|
+
*
|
195
|
+
* There is no guarantee that `this.state` will be immediately updated, so
|
196
|
+
* accessing `this.state` after calling this method may return the old value.
|
197
|
+
*
|
198
|
+
* There is no guarantee that calls to `setState` will run synchronously,
|
199
|
+
* as they may eventually be batched together. You can provide an optional
|
200
|
+
* callback that will be executed when the call to setState is actually
|
201
|
+
* completed.
|
202
|
+
*
|
203
|
+
* When a function is provided to setState, it will be called at some point in
|
204
|
+
* the future (not synchronously). It will be called with the up to date
|
205
|
+
* component arguments (state, props, context). These values can be different
|
206
|
+
* from this.* because your function may be called after receiveProps but before
|
207
|
+
* shouldComponentUpdate, and this new state, props, and context will not yet be
|
208
|
+
* assigned to this.
|
209
|
+
*
|
210
|
+
* @param {object|function} partialState Next partial state or function to
|
211
|
+
* produce next partial state to be merged with current state.
|
212
|
+
* @param {?function} callback Called after state is updated.
|
213
|
+
* @final
|
214
|
+
* @protected
|
215
|
+
*/
|
216
|
+
ReactComponent.prototype.setState = function (partialState, callback) {
|
217
|
+
!(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;
|
218
|
+
this.updater.enqueueSetState(this, partialState, callback, 'setState');
|
219
|
+
};
|
220
|
+
|
221
|
+
/**
|
222
|
+
* Forces an update. This should only be invoked when it is known with
|
223
|
+
* certainty that we are **not** in a DOM transaction.
|
224
|
+
*
|
225
|
+
* You may want to call this when you know that some deeper aspect of the
|
226
|
+
* component's state has changed but `setState` was not called.
|
227
|
+
*
|
228
|
+
* This will not invoke `shouldComponentUpdate`, but it will invoke
|
229
|
+
* `componentWillUpdate` and `componentDidUpdate`.
|
230
|
+
*
|
231
|
+
* @param {?function} callback Called after update is complete.
|
232
|
+
* @final
|
233
|
+
* @protected
|
234
|
+
*/
|
235
|
+
ReactComponent.prototype.forceUpdate = function (callback) {
|
236
|
+
this.updater.enqueueForceUpdate(this, callback, 'forceUpdate');
|
237
|
+
};
|
238
|
+
|
239
|
+
/**
|
240
|
+
* Deprecated APIs. These APIs used to exist on classic React classes but since
|
241
|
+
* we would like to deprecate them, we're not going to move them over to this
|
242
|
+
* modern base class. Instead, we define a getter that warns if it's accessed.
|
243
|
+
*/
|
244
|
+
{
|
245
|
+
var deprecatedAPIs = {
|
246
|
+
isMounted: ['isMounted', 'Instead, make sure to clean up subscriptions and pending requests in ' + 'componentWillUnmount to prevent memory leaks.'],
|
247
|
+
replaceState: ['replaceState', 'Refactor your code to use setState instead (see ' + 'https://github.com/facebook/react/issues/3236).']
|
248
|
+
};
|
249
|
+
var defineDeprecationWarning = function (methodName, info) {
|
250
|
+
Object.defineProperty(ReactComponent.prototype, methodName, {
|
251
|
+
get: function () {
|
252
|
+
lowPriorityWarning_1(false, '%s(...) is deprecated in plain JavaScript React classes. %s', info[0], info[1]);
|
253
|
+
return undefined;
|
254
|
+
}
|
255
|
+
});
|
256
|
+
};
|
257
|
+
for (var fnName in deprecatedAPIs) {
|
258
|
+
if (deprecatedAPIs.hasOwnProperty(fnName)) {
|
259
|
+
defineDeprecationWarning(fnName, deprecatedAPIs[fnName]);
|
260
|
+
}
|
261
|
+
}
|
262
|
+
}
|
263
|
+
|
264
|
+
/**
|
265
|
+
* Base class helpers for the updating state of a component.
|
266
|
+
*/
|
267
|
+
function ReactPureComponent(props, context, updater) {
|
268
|
+
// Duplicated from ReactComponent.
|
269
|
+
this.props = props;
|
270
|
+
this.context = context;
|
271
|
+
this.refs = emptyObject;
|
272
|
+
// We initialize the default updater but the real one gets injected by the
|
273
|
+
// renderer.
|
274
|
+
this.updater = updater || ReactNoopUpdateQueue_1;
|
275
|
+
}
|
276
|
+
|
277
|
+
function ComponentDummy() {}
|
278
|
+
ComponentDummy.prototype = ReactComponent.prototype;
|
279
|
+
var pureComponentPrototype = ReactPureComponent.prototype = new ComponentDummy();
|
280
|
+
pureComponentPrototype.constructor = ReactPureComponent;
|
281
|
+
// Avoid an extra prototype jump for these methods.
|
282
|
+
objectAssign$1(pureComponentPrototype, ReactComponent.prototype);
|
283
|
+
pureComponentPrototype.isPureReactComponent = true;
|
284
|
+
|
285
|
+
function ReactAsyncComponent(props, context, updater) {
|
286
|
+
// Duplicated from ReactComponent.
|
287
|
+
this.props = props;
|
288
|
+
this.context = context;
|
289
|
+
this.refs = emptyObject;
|
290
|
+
// We initialize the default updater but the real one gets injected by the
|
291
|
+
// renderer.
|
292
|
+
this.updater = updater || ReactNoopUpdateQueue_1;
|
293
|
+
}
|
294
|
+
|
295
|
+
var asyncComponentPrototype = ReactAsyncComponent.prototype = new ComponentDummy();
|
296
|
+
asyncComponentPrototype.constructor = ReactAsyncComponent;
|
297
|
+
// Avoid an extra prototype jump for these methods.
|
298
|
+
objectAssign$1(asyncComponentPrototype, ReactComponent.prototype);
|
299
|
+
asyncComponentPrototype.unstable_isAsyncReactComponent = true;
|
300
|
+
asyncComponentPrototype.render = function () {
|
301
|
+
return this.props.children;
|
302
|
+
};
|
303
|
+
|
304
|
+
var ReactBaseClasses = {
|
305
|
+
Component: ReactComponent,
|
306
|
+
PureComponent: ReactPureComponent,
|
307
|
+
AsyncComponent: ReactAsyncComponent
|
308
|
+
};
|
309
|
+
|
310
|
+
/**
|
311
|
+
* Copyright (c) 2013-present, Facebook, Inc.
|
312
|
+
*
|
313
|
+
* This source code is licensed under the MIT license found in the
|
314
|
+
* LICENSE file in the root directory of this source tree.
|
315
|
+
*
|
316
|
+
* @providesModule ReactCurrentOwner
|
317
|
+
*
|
318
|
+
*/
|
319
|
+
|
320
|
+
/**
|
321
|
+
* Keeps track of the current owner.
|
322
|
+
*
|
323
|
+
* The current owner is the component who should own any components that are
|
324
|
+
* currently being constructed.
|
325
|
+
*/
|
326
|
+
var ReactCurrentOwner = {
|
327
|
+
/**
|
328
|
+
* @internal
|
329
|
+
* @type {ReactComponent}
|
330
|
+
*/
|
331
|
+
current: null
|
332
|
+
};
|
333
|
+
|
334
|
+
var ReactCurrentOwner_1 = ReactCurrentOwner;
|
335
|
+
|
336
|
+
var hasOwnProperty = Object.prototype.hasOwnProperty;
|
337
|
+
|
338
|
+
{
|
339
|
+
var warning$2 = require$$0;
|
340
|
+
}
|
341
|
+
|
342
|
+
// The Symbol used to tag the ReactElement type. If there is no native Symbol
|
343
|
+
// nor polyfill, then a plain number is used for performance.
|
344
|
+
var REACT_ELEMENT_TYPE$1 = typeof Symbol === 'function' && Symbol['for'] && Symbol['for']('react.element') || 0xeac7;
|
345
|
+
|
346
|
+
var RESERVED_PROPS = {
|
347
|
+
key: true,
|
348
|
+
ref: true,
|
349
|
+
__self: true,
|
350
|
+
__source: true
|
351
|
+
};
|
352
|
+
|
353
|
+
var specialPropKeyWarningShown;
|
354
|
+
var specialPropRefWarningShown;
|
355
|
+
|
356
|
+
function hasValidRef(config) {
|
357
|
+
{
|
358
|
+
if (hasOwnProperty.call(config, 'ref')) {
|
359
|
+
var getter = Object.getOwnPropertyDescriptor(config, 'ref').get;
|
360
|
+
if (getter && getter.isReactWarning) {
|
361
|
+
return false;
|
362
|
+
}
|
363
|
+
}
|
364
|
+
}
|
365
|
+
return config.ref !== undefined;
|
366
|
+
}
|
367
|
+
|
368
|
+
function hasValidKey(config) {
|
369
|
+
{
|
370
|
+
if (hasOwnProperty.call(config, 'key')) {
|
371
|
+
var getter = Object.getOwnPropertyDescriptor(config, 'key').get;
|
372
|
+
if (getter && getter.isReactWarning) {
|
373
|
+
return false;
|
374
|
+
}
|
375
|
+
}
|
376
|
+
}
|
377
|
+
return config.key !== undefined;
|
378
|
+
}
|
379
|
+
|
380
|
+
function defineKeyPropWarningGetter(props, displayName) {
|
381
|
+
var warnAboutAccessingKey = function () {
|
382
|
+
if (!specialPropKeyWarningShown) {
|
383
|
+
specialPropKeyWarningShown = true;
|
384
|
+
warning$2(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);
|
385
|
+
}
|
386
|
+
};
|
387
|
+
warnAboutAccessingKey.isReactWarning = true;
|
388
|
+
Object.defineProperty(props, 'key', {
|
389
|
+
get: warnAboutAccessingKey,
|
390
|
+
configurable: true
|
391
|
+
});
|
392
|
+
}
|
393
|
+
|
394
|
+
function defineRefPropWarningGetter(props, displayName) {
|
395
|
+
var warnAboutAccessingRef = function () {
|
396
|
+
if (!specialPropRefWarningShown) {
|
397
|
+
specialPropRefWarningShown = true;
|
398
|
+
warning$2(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);
|
399
|
+
}
|
400
|
+
};
|
401
|
+
warnAboutAccessingRef.isReactWarning = true;
|
402
|
+
Object.defineProperty(props, 'ref', {
|
403
|
+
get: warnAboutAccessingRef,
|
404
|
+
configurable: true
|
405
|
+
});
|
406
|
+
}
|
407
|
+
|
408
|
+
/**
|
409
|
+
* Factory method to create a new React element. This no longer adheres to
|
410
|
+
* the class pattern, so do not use new to call it. Also, no instanceof check
|
411
|
+
* will work. Instead test $$typeof field against Symbol.for('react.element') to check
|
412
|
+
* if something is a React Element.
|
413
|
+
*
|
414
|
+
* @param {*} type
|
415
|
+
* @param {*} key
|
416
|
+
* @param {string|object} ref
|
417
|
+
* @param {*} self A *temporary* helper to detect places where `this` is
|
418
|
+
* different from the `owner` when React.createElement is called, so that we
|
419
|
+
* can warn. We want to get rid of owner and replace string `ref`s with arrow
|
420
|
+
* functions, and as long as `this` and owner are the same, there will be no
|
421
|
+
* change in behavior.
|
422
|
+
* @param {*} source An annotation object (added by a transpiler or otherwise)
|
423
|
+
* indicating filename, line number, and/or other information.
|
424
|
+
* @param {*} owner
|
425
|
+
* @param {*} props
|
426
|
+
* @internal
|
427
|
+
*/
|
428
|
+
var ReactElement = function (type, key, ref, self, source, owner, props) {
|
429
|
+
var element = {
|
430
|
+
// This tag allow us to uniquely identify this as a React Element
|
431
|
+
$$typeof: REACT_ELEMENT_TYPE$1,
|
432
|
+
|
433
|
+
// Built-in properties that belong on the element
|
434
|
+
type: type,
|
435
|
+
key: key,
|
436
|
+
ref: ref,
|
437
|
+
props: props,
|
438
|
+
|
439
|
+
// Record the component responsible for creating this element.
|
440
|
+
_owner: owner
|
441
|
+
};
|
442
|
+
|
443
|
+
{
|
444
|
+
// The validation flag is currently mutative. We put it on
|
445
|
+
// an external backing store so that we can freeze the whole object.
|
446
|
+
// This can be replaced with a WeakMap once they are implemented in
|
447
|
+
// commonly used development environments.
|
448
|
+
element._store = {};
|
449
|
+
|
450
|
+
// To make comparing ReactElements easier for testing purposes, we make
|
451
|
+
// the validation flag non-enumerable (where possible, which should
|
452
|
+
// include every environment we run tests in), so the test framework
|
453
|
+
// ignores it.
|
454
|
+
Object.defineProperty(element._store, 'validated', {
|
455
|
+
configurable: false,
|
456
|
+
enumerable: false,
|
457
|
+
writable: true,
|
458
|
+
value: false
|
459
|
+
});
|
460
|
+
// self and source are DEV only properties.
|
461
|
+
Object.defineProperty(element, '_self', {
|
462
|
+
configurable: false,
|
463
|
+
enumerable: false,
|
464
|
+
writable: false,
|
465
|
+
value: self
|
466
|
+
});
|
467
|
+
// Two elements created in two different places should be considered
|
468
|
+
// equal for testing purposes and therefore we hide it from enumeration.
|
469
|
+
Object.defineProperty(element, '_source', {
|
470
|
+
configurable: false,
|
471
|
+
enumerable: false,
|
472
|
+
writable: false,
|
473
|
+
value: source
|
474
|
+
});
|
475
|
+
if (Object.freeze) {
|
476
|
+
Object.freeze(element.props);
|
477
|
+
Object.freeze(element);
|
478
|
+
}
|
479
|
+
}
|
480
|
+
|
481
|
+
return element;
|
482
|
+
};
|
483
|
+
|
484
|
+
/**
|
485
|
+
* Create and return a new ReactElement of the given type.
|
486
|
+
* See https://facebook.github.io/react/docs/react-api.html#createelement
|
487
|
+
*/
|
488
|
+
ReactElement.createElement = function (type, config, children) {
|
489
|
+
var propName;
|
490
|
+
|
491
|
+
// Reserved names are extracted
|
492
|
+
var props = {};
|
493
|
+
|
494
|
+
var key = null;
|
495
|
+
var ref = null;
|
496
|
+
var self = null;
|
497
|
+
var source = null;
|
498
|
+
|
499
|
+
if (config != null) {
|
500
|
+
if (hasValidRef(config)) {
|
501
|
+
ref = config.ref;
|
502
|
+
}
|
503
|
+
if (hasValidKey(config)) {
|
504
|
+
key = '' + config.key;
|
505
|
+
}
|
506
|
+
|
507
|
+
self = config.__self === undefined ? null : config.__self;
|
508
|
+
source = config.__source === undefined ? null : config.__source;
|
509
|
+
// Remaining properties are added to a new props object
|
510
|
+
for (propName in config) {
|
511
|
+
if (hasOwnProperty.call(config, propName) && !RESERVED_PROPS.hasOwnProperty(propName)) {
|
512
|
+
props[propName] = config[propName];
|
513
|
+
}
|
514
|
+
}
|
515
|
+
}
|
516
|
+
|
517
|
+
// Children can be more than one argument, and those are transferred onto
|
518
|
+
// the newly allocated props object.
|
519
|
+
var childrenLength = arguments.length - 2;
|
520
|
+
if (childrenLength === 1) {
|
521
|
+
props.children = children;
|
522
|
+
} else if (childrenLength > 1) {
|
523
|
+
var childArray = Array(childrenLength);
|
524
|
+
for (var i = 0; i < childrenLength; i++) {
|
525
|
+
childArray[i] = arguments[i + 2];
|
526
|
+
}
|
527
|
+
{
|
528
|
+
if (Object.freeze) {
|
529
|
+
Object.freeze(childArray);
|
530
|
+
}
|
531
|
+
}
|
532
|
+
props.children = childArray;
|
533
|
+
}
|
534
|
+
|
535
|
+
// Resolve default props
|
536
|
+
if (type && type.defaultProps) {
|
537
|
+
var defaultProps = type.defaultProps;
|
538
|
+
for (propName in defaultProps) {
|
539
|
+
if (props[propName] === undefined) {
|
540
|
+
props[propName] = defaultProps[propName];
|
541
|
+
}
|
542
|
+
}
|
543
|
+
}
|
544
|
+
{
|
545
|
+
if (key || ref) {
|
546
|
+
if (typeof props.$$typeof === 'undefined' || props.$$typeof !== REACT_ELEMENT_TYPE$1) {
|
547
|
+
var displayName = typeof type === 'function' ? type.displayName || type.name || 'Unknown' : type;
|
548
|
+
if (key) {
|
549
|
+
defineKeyPropWarningGetter(props, displayName);
|
550
|
+
}
|
551
|
+
if (ref) {
|
552
|
+
defineRefPropWarningGetter(props, displayName);
|
553
|
+
}
|
554
|
+
}
|
555
|
+
}
|
556
|
+
}
|
557
|
+
return ReactElement(type, key, ref, self, source, ReactCurrentOwner_1.current, props);
|
558
|
+
};
|
559
|
+
|
560
|
+
/**
|
561
|
+
* Return a function that produces ReactElements of a given type.
|
562
|
+
* See https://facebook.github.io/react/docs/react-api.html#createfactory
|
563
|
+
*/
|
564
|
+
ReactElement.createFactory = function (type) {
|
565
|
+
var factory = ReactElement.createElement.bind(null, type);
|
566
|
+
// Expose the type on the factory and the prototype so that it can be
|
567
|
+
// easily accessed on elements. E.g. `<Foo />.type === Foo`.
|
568
|
+
// This should not be named `constructor` since this may not be the function
|
569
|
+
// that created the element, and it may not even be a constructor.
|
570
|
+
// Legacy hook TODO: Warn if this is accessed
|
571
|
+
factory.type = type;
|
572
|
+
return factory;
|
573
|
+
};
|
574
|
+
|
575
|
+
ReactElement.cloneAndReplaceKey = function (oldElement, newKey) {
|
576
|
+
var newElement = ReactElement(oldElement.type, newKey, oldElement.ref, oldElement._self, oldElement._source, oldElement._owner, oldElement.props);
|
577
|
+
|
578
|
+
return newElement;
|
579
|
+
};
|
580
|
+
|
581
|
+
/**
|
582
|
+
* Clone and return a new ReactElement using element as the starting point.
|
583
|
+
* See https://facebook.github.io/react/docs/react-api.html#cloneelement
|
584
|
+
*/
|
585
|
+
ReactElement.cloneElement = function (element, config, children) {
|
586
|
+
var propName;
|
587
|
+
|
588
|
+
// Original props are copied
|
589
|
+
var props = objectAssign$1({}, element.props);
|
590
|
+
|
591
|
+
// Reserved names are extracted
|
592
|
+
var key = element.key;
|
593
|
+
var ref = element.ref;
|
594
|
+
// Self is preserved since the owner is preserved.
|
595
|
+
var self = element._self;
|
596
|
+
// Source is preserved since cloneElement is unlikely to be targeted by a
|
597
|
+
// transpiler, and the original source is probably a better indicator of the
|
598
|
+
// true owner.
|
599
|
+
var source = element._source;
|
600
|
+
|
601
|
+
// Owner will be preserved, unless ref is overridden
|
602
|
+
var owner = element._owner;
|
603
|
+
|
604
|
+
if (config != null) {
|
605
|
+
if (hasValidRef(config)) {
|
606
|
+
// Silently steal the ref from the parent.
|
607
|
+
ref = config.ref;
|
608
|
+
owner = ReactCurrentOwner_1.current;
|
609
|
+
}
|
610
|
+
if (hasValidKey(config)) {
|
611
|
+
key = '' + config.key;
|
612
|
+
}
|
613
|
+
|
614
|
+
// Remaining properties override existing props
|
615
|
+
var defaultProps;
|
616
|
+
if (element.type && element.type.defaultProps) {
|
617
|
+
defaultProps = element.type.defaultProps;
|
618
|
+
}
|
619
|
+
for (propName in config) {
|
620
|
+
if (hasOwnProperty.call(config, propName) && !RESERVED_PROPS.hasOwnProperty(propName)) {
|
621
|
+
if (config[propName] === undefined && defaultProps !== undefined) {
|
622
|
+
// Resolve default props
|
623
|
+
props[propName] = defaultProps[propName];
|
624
|
+
} else {
|
625
|
+
props[propName] = config[propName];
|
626
|
+
}
|
627
|
+
}
|
628
|
+
}
|
629
|
+
}
|
630
|
+
|
631
|
+
// Children can be more than one argument, and those are transferred onto
|
632
|
+
// the newly allocated props object.
|
633
|
+
var childrenLength = arguments.length - 2;
|
634
|
+
if (childrenLength === 1) {
|
635
|
+
props.children = children;
|
636
|
+
} else if (childrenLength > 1) {
|
637
|
+
var childArray = Array(childrenLength);
|
638
|
+
for (var i = 0; i < childrenLength; i++) {
|
639
|
+
childArray[i] = arguments[i + 2];
|
640
|
+
}
|
641
|
+
props.children = childArray;
|
642
|
+
}
|
643
|
+
|
644
|
+
return ReactElement(element.type, key, ref, self, source, owner, props);
|
645
|
+
};
|
646
|
+
|
647
|
+
/**
|
648
|
+
* Verifies the object is a ReactElement.
|
649
|
+
* See https://facebook.github.io/react/docs/react-api.html#isvalidelement
|
650
|
+
* @param {?object} object
|
651
|
+
* @return {boolean} True if `object` is a valid component.
|
652
|
+
* @final
|
653
|
+
*/
|
654
|
+
ReactElement.isValidElement = function (object) {
|
655
|
+
return typeof object === 'object' && object !== null && object.$$typeof === REACT_ELEMENT_TYPE$1;
|
656
|
+
};
|
657
|
+
|
658
|
+
var ReactElement_1 = ReactElement;
|
659
|
+
|
660
|
+
/**
|
661
|
+
* Copyright (c) 2013-present, Facebook, Inc.
|
662
|
+
*
|
663
|
+
* This source code is licensed under the MIT license found in the
|
664
|
+
* LICENSE file in the root directory of this source tree.
|
665
|
+
*
|
666
|
+
* @providesModule ReactDebugCurrentFrame
|
667
|
+
*
|
668
|
+
*/
|
669
|
+
|
670
|
+
var ReactDebugCurrentFrame = {};
|
671
|
+
|
672
|
+
{
|
673
|
+
// Component that is being worked on
|
674
|
+
ReactDebugCurrentFrame.getCurrentStack = null;
|
675
|
+
|
676
|
+
ReactDebugCurrentFrame.getStackAddendum = function () {
|
677
|
+
var impl = ReactDebugCurrentFrame.getCurrentStack;
|
678
|
+
if (impl) {
|
679
|
+
return impl();
|
680
|
+
}
|
681
|
+
return null;
|
682
|
+
};
|
683
|
+
}
|
684
|
+
|
685
|
+
var ReactDebugCurrentFrame_1 = ReactDebugCurrentFrame;
|
686
|
+
|
687
|
+
{
|
688
|
+
var warning$1 = require$$0;
|
689
|
+
|
690
|
+
var _require = ReactDebugCurrentFrame_1,
|
691
|
+
getStackAddendum = _require.getStackAddendum;
|
692
|
+
}
|
693
|
+
|
694
|
+
var ITERATOR_SYMBOL = typeof Symbol === 'function' && Symbol.iterator;
|
695
|
+
var FAUX_ITERATOR_SYMBOL = '@@iterator'; // Before Symbol spec.
|
696
|
+
// The Symbol used to tag the ReactElement type. If there is no native Symbol
|
697
|
+
// nor polyfill, then a plain number is used for performance.
|
698
|
+
var REACT_ELEMENT_TYPE = typeof Symbol === 'function' && Symbol['for'] && Symbol['for']('react.element') || 0xeac7;
|
699
|
+
|
700
|
+
var SEPARATOR = '.';
|
701
|
+
var SUBSEPARATOR = ':';
|
702
|
+
|
703
|
+
/**
|
704
|
+
* Escape and wrap key so it is safe to use as a reactid
|
705
|
+
*
|
706
|
+
* @param {string} key to be escaped.
|
707
|
+
* @return {string} the escaped key.
|
708
|
+
*/
|
709
|
+
function escape(key) {
|
710
|
+
var escapeRegex = /[=:]/g;
|
711
|
+
var escaperLookup = {
|
712
|
+
'=': '=0',
|
713
|
+
':': '=2'
|
714
|
+
};
|
715
|
+
var escapedString = ('' + key).replace(escapeRegex, function (match) {
|
716
|
+
return escaperLookup[match];
|
717
|
+
});
|
718
|
+
|
719
|
+
return '$' + escapedString;
|
720
|
+
}
|
721
|
+
|
722
|
+
/**
|
723
|
+
* TODO: Test that a single child and an array with one item have the same key
|
724
|
+
* pattern.
|
725
|
+
*/
|
726
|
+
|
727
|
+
var didWarnAboutMaps = false;
|
728
|
+
|
729
|
+
var userProvidedKeyEscapeRegex = /\/+/g;
|
730
|
+
function escapeUserProvidedKey(text) {
|
731
|
+
return ('' + text).replace(userProvidedKeyEscapeRegex, '$&/');
|
732
|
+
}
|
733
|
+
|
734
|
+
var POOL_SIZE = 10;
|
735
|
+
var traverseContextPool = [];
|
736
|
+
function getPooledTraverseContext(mapResult, keyPrefix, mapFunction, mapContext) {
|
737
|
+
if (traverseContextPool.length) {
|
738
|
+
var traverseContext = traverseContextPool.pop();
|
739
|
+
traverseContext.result = mapResult;
|
740
|
+
traverseContext.keyPrefix = keyPrefix;
|
741
|
+
traverseContext.func = mapFunction;
|
742
|
+
traverseContext.context = mapContext;
|
743
|
+
traverseContext.count = 0;
|
744
|
+
return traverseContext;
|
745
|
+
} else {
|
746
|
+
return {
|
747
|
+
result: mapResult,
|
748
|
+
keyPrefix: keyPrefix,
|
749
|
+
func: mapFunction,
|
750
|
+
context: mapContext,
|
751
|
+
count: 0
|
752
|
+
};
|
753
|
+
}
|
754
|
+
}
|
755
|
+
|
756
|
+
function releaseTraverseContext(traverseContext) {
|
757
|
+
traverseContext.result = null;
|
758
|
+
traverseContext.keyPrefix = null;
|
759
|
+
traverseContext.func = null;
|
760
|
+
traverseContext.context = null;
|
761
|
+
traverseContext.count = 0;
|
762
|
+
if (traverseContextPool.length < POOL_SIZE) {
|
763
|
+
traverseContextPool.push(traverseContext);
|
764
|
+
}
|
765
|
+
}
|
766
|
+
|
767
|
+
/**
|
768
|
+
* @param {?*} children Children tree container.
|
769
|
+
* @param {!string} nameSoFar Name of the key path so far.
|
770
|
+
* @param {!function} callback Callback to invoke with each child found.
|
771
|
+
* @param {?*} traverseContext Used to pass information throughout the traversal
|
772
|
+
* process.
|
773
|
+
* @return {!number} The number of children in this subtree.
|
774
|
+
*/
|
775
|
+
function traverseAllChildrenImpl(children, nameSoFar, callback, traverseContext) {
|
776
|
+
var type = typeof children;
|
777
|
+
|
778
|
+
if (type === 'undefined' || type === 'boolean') {
|
779
|
+
// All of the above are perceived as null.
|
780
|
+
children = null;
|
781
|
+
}
|
782
|
+
|
783
|
+
if (children === null || type === 'string' || type === 'number' ||
|
784
|
+
// The following is inlined from ReactElement. This means we can optimize
|
785
|
+
// some checks. React Fiber also inlines this logic for similar purposes.
|
786
|
+
type === 'object' && children.$$typeof === REACT_ELEMENT_TYPE) {
|
787
|
+
callback(traverseContext, children,
|
788
|
+
// If it's the only child, treat the name as if it was wrapped in an array
|
789
|
+
// so that it's consistent if the number of children grows.
|
790
|
+
nameSoFar === '' ? SEPARATOR + getComponentKey(children, 0) : nameSoFar);
|
791
|
+
return 1;
|
792
|
+
}
|
793
|
+
|
794
|
+
var child;
|
795
|
+
var nextName;
|
796
|
+
var subtreeCount = 0; // Count of children found in the current subtree.
|
797
|
+
var nextNamePrefix = nameSoFar === '' ? SEPARATOR : nameSoFar + SUBSEPARATOR;
|
798
|
+
|
799
|
+
if (Array.isArray(children)) {
|
800
|
+
for (var i = 0; i < children.length; i++) {
|
801
|
+
child = children[i];
|
802
|
+
nextName = nextNamePrefix + getComponentKey(child, i);
|
803
|
+
subtreeCount += traverseAllChildrenImpl(child, nextName, callback, traverseContext);
|
804
|
+
}
|
805
|
+
} else {
|
806
|
+
var iteratorFn = ITERATOR_SYMBOL && children[ITERATOR_SYMBOL] || children[FAUX_ITERATOR_SYMBOL];
|
807
|
+
if (typeof iteratorFn === 'function') {
|
808
|
+
{
|
809
|
+
// Warn about using Maps as children
|
810
|
+
if (iteratorFn === children.entries) {
|
811
|
+
warning$1(didWarnAboutMaps, 'Using Maps as children is unsupported and will likely yield ' + 'unexpected results. Convert it to a sequence/iterable of keyed ' + 'ReactElements instead.%s', getStackAddendum());
|
812
|
+
didWarnAboutMaps = true;
|
813
|
+
}
|
814
|
+
}
|
815
|
+
|
816
|
+
var iterator = iteratorFn.call(children);
|
817
|
+
var step;
|
818
|
+
var ii = 0;
|
819
|
+
while (!(step = iterator.next()).done) {
|
820
|
+
child = step.value;
|
821
|
+
nextName = nextNamePrefix + getComponentKey(child, ii++);
|
822
|
+
subtreeCount += traverseAllChildrenImpl(child, nextName, callback, traverseContext);
|
823
|
+
}
|
824
|
+
} else if (type === 'object') {
|
825
|
+
var addendum = '';
|
826
|
+
{
|
827
|
+
addendum = ' If you meant to render a collection of children, use an array ' + 'instead.' + getStackAddendum();
|
828
|
+
}
|
829
|
+
var childrenString = '' + children;
|
830
|
+
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);
|
831
|
+
}
|
832
|
+
}
|
833
|
+
|
834
|
+
return subtreeCount;
|
835
|
+
}
|
836
|
+
|
837
|
+
/**
|
838
|
+
* Traverses children that are typically specified as `props.children`, but
|
839
|
+
* might also be specified through attributes:
|
840
|
+
*
|
841
|
+
* - `traverseAllChildren(this.props.children, ...)`
|
842
|
+
* - `traverseAllChildren(this.props.leftPanelChildren, ...)`
|
843
|
+
*
|
844
|
+
* The `traverseContext` is an optional argument that is passed through the
|
845
|
+
* entire traversal. It can be used to store accumulations or anything else that
|
846
|
+
* the callback might find relevant.
|
847
|
+
*
|
848
|
+
* @param {?*} children Children tree object.
|
849
|
+
* @param {!function} callback To invoke upon traversing each child.
|
850
|
+
* @param {?*} traverseContext Context for traversal.
|
851
|
+
* @return {!number} The number of children in this subtree.
|
852
|
+
*/
|
853
|
+
function traverseAllChildren(children, callback, traverseContext) {
|
854
|
+
if (children == null) {
|
855
|
+
return 0;
|
856
|
+
}
|
857
|
+
|
858
|
+
return traverseAllChildrenImpl(children, '', callback, traverseContext);
|
859
|
+
}
|
860
|
+
|
861
|
+
/**
|
862
|
+
* Generate a key string that identifies a component within a set.
|
863
|
+
*
|
864
|
+
* @param {*} component A component that could contain a manual key.
|
865
|
+
* @param {number} index Index that is used if a manual key is not provided.
|
866
|
+
* @return {string}
|
867
|
+
*/
|
868
|
+
function getComponentKey(component, index) {
|
869
|
+
// Do some typechecking here since we call this blindly. We want to ensure
|
870
|
+
// that we don't block potential future ES APIs.
|
871
|
+
if (typeof component === 'object' && component !== null && component.key != null) {
|
872
|
+
// Explicit key
|
873
|
+
return escape(component.key);
|
874
|
+
}
|
875
|
+
// Implicit key determined by the index in the set
|
876
|
+
return index.toString(36);
|
877
|
+
}
|
878
|
+
|
879
|
+
function forEachSingleChild(bookKeeping, child, name) {
|
880
|
+
var func = bookKeeping.func,
|
881
|
+
context = bookKeeping.context;
|
882
|
+
|
883
|
+
func.call(context, child, bookKeeping.count++);
|
884
|
+
}
|
885
|
+
|
886
|
+
/**
|
887
|
+
* Iterates through children that are typically specified as `props.children`.
|
888
|
+
*
|
889
|
+
* See https://facebook.github.io/react/docs/react-api.html#react.children.foreach
|
890
|
+
*
|
891
|
+
* The provided forEachFunc(child, index) will be called for each
|
892
|
+
* leaf child.
|
893
|
+
*
|
894
|
+
* @param {?*} children Children tree container.
|
895
|
+
* @param {function(*, int)} forEachFunc
|
896
|
+
* @param {*} forEachContext Context for forEachContext.
|
897
|
+
*/
|
898
|
+
function forEachChildren(children, forEachFunc, forEachContext) {
|
899
|
+
if (children == null) {
|
900
|
+
return children;
|
901
|
+
}
|
902
|
+
var traverseContext = getPooledTraverseContext(null, null, forEachFunc, forEachContext);
|
903
|
+
traverseAllChildren(children, forEachSingleChild, traverseContext);
|
904
|
+
releaseTraverseContext(traverseContext);
|
905
|
+
}
|
906
|
+
|
907
|
+
function mapSingleChildIntoContext(bookKeeping, child, childKey) {
|
908
|
+
var result = bookKeeping.result,
|
909
|
+
keyPrefix = bookKeeping.keyPrefix,
|
910
|
+
func = bookKeeping.func,
|
911
|
+
context = bookKeeping.context;
|
912
|
+
|
913
|
+
|
914
|
+
var mappedChild = func.call(context, child, bookKeeping.count++);
|
915
|
+
if (Array.isArray(mappedChild)) {
|
916
|
+
mapIntoWithKeyPrefixInternal(mappedChild, result, childKey, emptyFunction.thatReturnsArgument);
|
917
|
+
} else if (mappedChild != null) {
|
918
|
+
if (ReactElement_1.isValidElement(mappedChild)) {
|
919
|
+
mappedChild = ReactElement_1.cloneAndReplaceKey(mappedChild,
|
920
|
+
// Keep both the (mapped) and old keys if they differ, just as
|
921
|
+
// traverseAllChildren used to do for objects as children
|
922
|
+
keyPrefix + (mappedChild.key && (!child || child.key !== mappedChild.key) ? escapeUserProvidedKey(mappedChild.key) + '/' : '') + childKey);
|
923
|
+
}
|
924
|
+
result.push(mappedChild);
|
925
|
+
}
|
926
|
+
}
|
927
|
+
|
928
|
+
function mapIntoWithKeyPrefixInternal(children, array, prefix, func, context) {
|
929
|
+
var escapedPrefix = '';
|
930
|
+
if (prefix != null) {
|
931
|
+
escapedPrefix = escapeUserProvidedKey(prefix) + '/';
|
932
|
+
}
|
933
|
+
var traverseContext = getPooledTraverseContext(array, escapedPrefix, func, context);
|
934
|
+
traverseAllChildren(children, mapSingleChildIntoContext, traverseContext);
|
935
|
+
releaseTraverseContext(traverseContext);
|
936
|
+
}
|
937
|
+
|
938
|
+
/**
|
939
|
+
* Maps children that are typically specified as `props.children`.
|
940
|
+
*
|
941
|
+
* See https://facebook.github.io/react/docs/react-api.html#react.children.map
|
942
|
+
*
|
943
|
+
* The provided mapFunction(child, key, index) will be called for each
|
944
|
+
* leaf child.
|
945
|
+
*
|
946
|
+
* @param {?*} children Children tree container.
|
947
|
+
* @param {function(*, int)} func The map function.
|
948
|
+
* @param {*} context Context for mapFunction.
|
949
|
+
* @return {object} Object containing the ordered map of results.
|
950
|
+
*/
|
951
|
+
function mapChildren(children, func, context) {
|
952
|
+
if (children == null) {
|
953
|
+
return children;
|
954
|
+
}
|
955
|
+
var result = [];
|
956
|
+
mapIntoWithKeyPrefixInternal(children, result, null, func, context);
|
957
|
+
return result;
|
958
|
+
}
|
959
|
+
|
960
|
+
/**
|
961
|
+
* Count the number of children that are typically specified as
|
962
|
+
* `props.children`.
|
963
|
+
*
|
964
|
+
* See https://facebook.github.io/react/docs/react-api.html#react.children.count
|
965
|
+
*
|
966
|
+
* @param {?*} children Children tree container.
|
967
|
+
* @return {number} The number of children.
|
968
|
+
*/
|
969
|
+
function countChildren(children, context) {
|
970
|
+
return traverseAllChildren(children, emptyFunction.thatReturnsNull, null);
|
971
|
+
}
|
972
|
+
|
973
|
+
/**
|
974
|
+
* Flatten a children object (typically specified as `props.children`) and
|
975
|
+
* return an array with appropriately re-keyed children.
|
976
|
+
*
|
977
|
+
* See https://facebook.github.io/react/docs/react-api.html#react.children.toarray
|
978
|
+
*/
|
979
|
+
function toArray(children) {
|
980
|
+
var result = [];
|
981
|
+
mapIntoWithKeyPrefixInternal(children, result, null, emptyFunction.thatReturnsArgument);
|
982
|
+
return result;
|
983
|
+
}
|
984
|
+
|
985
|
+
var ReactChildren = {
|
986
|
+
forEach: forEachChildren,
|
987
|
+
map: mapChildren,
|
988
|
+
count: countChildren,
|
989
|
+
toArray: toArray
|
990
|
+
};
|
991
|
+
|
992
|
+
var ReactChildren_1 = ReactChildren;
|
993
|
+
|
994
|
+
/**
|
995
|
+
* Copyright (c) 2013-present, Facebook, Inc.
|
996
|
+
*
|
997
|
+
* This source code is licensed under the MIT license found in the
|
998
|
+
* LICENSE file in the root directory of this source tree.
|
999
|
+
*
|
1000
|
+
* @providesModule ReactVersion
|
1001
|
+
*/
|
1002
|
+
|
1003
|
+
var ReactVersion = '16.0.0';
|
1004
|
+
|
1005
|
+
/**
|
1006
|
+
* Returns the first child in a collection of children and verifies that there
|
1007
|
+
* is only one child in the collection.
|
1008
|
+
*
|
1009
|
+
* See https://facebook.github.io/react/docs/react-api.html#react.children.only
|
1010
|
+
*
|
1011
|
+
* The current implementation of this function assumes that a single child gets
|
1012
|
+
* passed without a wrapper, but the purpose of this helper function is to
|
1013
|
+
* abstract away the particular structure of children.
|
1014
|
+
*
|
1015
|
+
* @param {?object} children Child collection structure.
|
1016
|
+
* @return {ReactElement} The first and only `ReactElement` contained in the
|
1017
|
+
* structure.
|
1018
|
+
*/
|
1019
|
+
function onlyChild(children) {
|
1020
|
+
!ReactElement_1.isValidElement(children) ? invariant(false, 'React.Children.only expected to receive a single React element child.') : void 0;
|
1021
|
+
return children;
|
1022
|
+
}
|
1023
|
+
|
1024
|
+
var onlyChild_1 = onlyChild;
|
1025
|
+
|
1026
|
+
/**
|
1027
|
+
* Copyright (c) 2016-present, Facebook, Inc.
|
1028
|
+
*
|
1029
|
+
* This source code is licensed under the MIT license found in the
|
1030
|
+
* LICENSE file in the root directory of this source tree.
|
1031
|
+
*
|
1032
|
+
*
|
1033
|
+
* @providesModule describeComponentFrame
|
1034
|
+
*/
|
1035
|
+
|
1036
|
+
var describeComponentFrame$1 = function (name, source, ownerName) {
|
1037
|
+
return '\n in ' + (name || 'Unknown') + (source ? ' (at ' + source.fileName.replace(/^.*[\\\/]/, '') + ':' + source.lineNumber + ')' : ownerName ? ' (created by ' + ownerName + ')' : '');
|
1038
|
+
};
|
1039
|
+
|
1040
|
+
/**
|
1041
|
+
* Copyright (c) 2013-present, Facebook, Inc.
|
1042
|
+
*
|
1043
|
+
* This source code is licensed under the MIT license found in the
|
1044
|
+
* LICENSE file in the root directory of this source tree.
|
1045
|
+
*
|
1046
|
+
* @providesModule getComponentName
|
1047
|
+
*
|
1048
|
+
*/
|
1049
|
+
|
1050
|
+
function getComponentName$1(instanceOrFiber) {
|
1051
|
+
if (typeof instanceOrFiber.getName === 'function') {
|
1052
|
+
// Stack reconciler
|
1053
|
+
var instance = instanceOrFiber;
|
1054
|
+
return instance.getName();
|
1055
|
+
}
|
1056
|
+
if (typeof instanceOrFiber.tag === 'number') {
|
1057
|
+
// Fiber reconciler
|
1058
|
+
var fiber = instanceOrFiber;
|
1059
|
+
var type = fiber.type;
|
1060
|
+
|
1061
|
+
if (typeof type === 'string') {
|
1062
|
+
return type;
|
1063
|
+
}
|
1064
|
+
if (typeof type === 'function') {
|
1065
|
+
return type.displayName || type.name;
|
1066
|
+
}
|
1067
|
+
}
|
1068
|
+
return null;
|
1069
|
+
}
|
1070
|
+
|
1071
|
+
var getComponentName_1 = getComponentName$1;
|
1072
|
+
|
1073
|
+
{
|
1074
|
+
var checkPropTypes$1 = checkPropTypes;
|
1075
|
+
var lowPriorityWarning$1 = lowPriorityWarning_1;
|
1076
|
+
var ReactDebugCurrentFrame$1 = ReactDebugCurrentFrame_1;
|
1077
|
+
var warning$3 = require$$0;
|
1078
|
+
var describeComponentFrame = describeComponentFrame$1;
|
1079
|
+
var getComponentName = getComponentName_1;
|
1080
|
+
|
1081
|
+
var currentlyValidatingElement = null;
|
1082
|
+
|
1083
|
+
var getDisplayName = function (element) {
|
1084
|
+
if (element == null) {
|
1085
|
+
return '#empty';
|
1086
|
+
} else if (typeof element === 'string' || typeof element === 'number') {
|
1087
|
+
return '#text';
|
1088
|
+
} else if (typeof element.type === 'string') {
|
1089
|
+
return element.type;
|
1090
|
+
} else {
|
1091
|
+
return element.type.displayName || element.type.name || 'Unknown';
|
1092
|
+
}
|
1093
|
+
};
|
1094
|
+
|
1095
|
+
var getStackAddendum$1 = function () {
|
1096
|
+
var stack = '';
|
1097
|
+
if (currentlyValidatingElement) {
|
1098
|
+
var name = getDisplayName(currentlyValidatingElement);
|
1099
|
+
var owner = currentlyValidatingElement._owner;
|
1100
|
+
stack += describeComponentFrame(name, currentlyValidatingElement._source, owner && getComponentName(owner));
|
1101
|
+
}
|
1102
|
+
stack += ReactDebugCurrentFrame$1.getStackAddendum() || '';
|
1103
|
+
return stack;
|
1104
|
+
};
|
1105
|
+
}
|
1106
|
+
|
1107
|
+
var ITERATOR_SYMBOL$1 = typeof Symbol === 'function' && Symbol.iterator;
|
1108
|
+
var FAUX_ITERATOR_SYMBOL$1 = '@@iterator'; // Before Symbol spec.
|
1109
|
+
|
1110
|
+
function getDeclarationErrorAddendum() {
|
1111
|
+
if (ReactCurrentOwner_1.current) {
|
1112
|
+
var name = getComponentName(ReactCurrentOwner_1.current);
|
1113
|
+
if (name) {
|
1114
|
+
return '\n\nCheck the render method of `' + name + '`.';
|
1115
|
+
}
|
1116
|
+
}
|
1117
|
+
return '';
|
1118
|
+
}
|
1119
|
+
|
1120
|
+
function getSourceInfoErrorAddendum(elementProps) {
|
1121
|
+
if (elementProps !== null && elementProps !== undefined && elementProps.__source !== undefined) {
|
1122
|
+
var source = elementProps.__source;
|
1123
|
+
var fileName = source.fileName.replace(/^.*[\\\/]/, '');
|
1124
|
+
var lineNumber = source.lineNumber;
|
1125
|
+
return '\n\nCheck your code at ' + fileName + ':' + lineNumber + '.';
|
1126
|
+
}
|
1127
|
+
return '';
|
1128
|
+
}
|
1129
|
+
|
1130
|
+
/**
|
1131
|
+
* Warn if there's no key explicitly set on dynamic arrays of children or
|
1132
|
+
* object keys are not valid. This allows us to keep track of children between
|
1133
|
+
* updates.
|
1134
|
+
*/
|
1135
|
+
var ownerHasKeyUseWarning = {};
|
1136
|
+
|
1137
|
+
function getCurrentComponentErrorInfo(parentType) {
|
1138
|
+
var info = getDeclarationErrorAddendum();
|
1139
|
+
|
1140
|
+
if (!info) {
|
1141
|
+
var parentName = typeof parentType === 'string' ? parentType : parentType.displayName || parentType.name;
|
1142
|
+
if (parentName) {
|
1143
|
+
info = '\n\nCheck the top-level render call using <' + parentName + '>.';
|
1144
|
+
}
|
1145
|
+
}
|
1146
|
+
return info;
|
1147
|
+
}
|
1148
|
+
|
1149
|
+
/**
|
1150
|
+
* Warn if the element doesn't have an explicit key assigned to it.
|
1151
|
+
* This element is in an array. The array could grow and shrink or be
|
1152
|
+
* reordered. All children that haven't already been validated are required to
|
1153
|
+
* have a "key" property assigned to it. Error statuses are cached so a warning
|
1154
|
+
* will only be shown once.
|
1155
|
+
*
|
1156
|
+
* @internal
|
1157
|
+
* @param {ReactElement} element Element that requires a key.
|
1158
|
+
* @param {*} parentType element's parent's type.
|
1159
|
+
*/
|
1160
|
+
function validateExplicitKey(element, parentType) {
|
1161
|
+
if (!element._store || element._store.validated || element.key != null) {
|
1162
|
+
return;
|
1163
|
+
}
|
1164
|
+
element._store.validated = true;
|
1165
|
+
|
1166
|
+
var currentComponentErrorInfo = getCurrentComponentErrorInfo(parentType);
|
1167
|
+
if (ownerHasKeyUseWarning[currentComponentErrorInfo]) {
|
1168
|
+
return;
|
1169
|
+
}
|
1170
|
+
ownerHasKeyUseWarning[currentComponentErrorInfo] = true;
|
1171
|
+
|
1172
|
+
// Usually the current owner is the offender, but if it accepts children as a
|
1173
|
+
// property, it may be the creator of the child that's responsible for
|
1174
|
+
// assigning it a key.
|
1175
|
+
var childOwner = '';
|
1176
|
+
if (element && element._owner && element._owner !== ReactCurrentOwner_1.current) {
|
1177
|
+
// Give the component that originally created this child.
|
1178
|
+
childOwner = ' It was passed a child from ' + getComponentName(element._owner) + '.';
|
1179
|
+
}
|
1180
|
+
|
1181
|
+
currentlyValidatingElement = element;
|
1182
|
+
{
|
1183
|
+
warning$3(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, getStackAddendum$1());
|
1184
|
+
}
|
1185
|
+
currentlyValidatingElement = null;
|
1186
|
+
}
|
1187
|
+
|
1188
|
+
/**
|
1189
|
+
* Ensure that every element either is passed in a static location, in an
|
1190
|
+
* array with an explicit keys property defined, or in an object literal
|
1191
|
+
* with valid key property.
|
1192
|
+
*
|
1193
|
+
* @internal
|
1194
|
+
* @param {ReactNode} node Statically passed child of any type.
|
1195
|
+
* @param {*} parentType node's parent's type.
|
1196
|
+
*/
|
1197
|
+
function validateChildKeys(node, parentType) {
|
1198
|
+
if (typeof node !== 'object') {
|
1199
|
+
return;
|
1200
|
+
}
|
1201
|
+
if (Array.isArray(node)) {
|
1202
|
+
for (var i = 0; i < node.length; i++) {
|
1203
|
+
var child = node[i];
|
1204
|
+
if (ReactElement_1.isValidElement(child)) {
|
1205
|
+
validateExplicitKey(child, parentType);
|
1206
|
+
}
|
1207
|
+
}
|
1208
|
+
} else if (ReactElement_1.isValidElement(node)) {
|
1209
|
+
// This element was passed in a valid location.
|
1210
|
+
if (node._store) {
|
1211
|
+
node._store.validated = true;
|
1212
|
+
}
|
1213
|
+
} else if (node) {
|
1214
|
+
var iteratorFn = ITERATOR_SYMBOL$1 && node[ITERATOR_SYMBOL$1] || node[FAUX_ITERATOR_SYMBOL$1];
|
1215
|
+
if (typeof iteratorFn === 'function') {
|
1216
|
+
// Entry iterators used to provide implicit keys,
|
1217
|
+
// but now we print a separate warning for them later.
|
1218
|
+
if (iteratorFn !== node.entries) {
|
1219
|
+
var iterator = iteratorFn.call(node);
|
1220
|
+
var step;
|
1221
|
+
while (!(step = iterator.next()).done) {
|
1222
|
+
if (ReactElement_1.isValidElement(step.value)) {
|
1223
|
+
validateExplicitKey(step.value, parentType);
|
1224
|
+
}
|
1225
|
+
}
|
1226
|
+
}
|
1227
|
+
}
|
1228
|
+
}
|
1229
|
+
}
|
1230
|
+
|
1231
|
+
/**
|
1232
|
+
* Given an element, validate that its props follow the propTypes definition,
|
1233
|
+
* provided by the type.
|
1234
|
+
*
|
1235
|
+
* @param {ReactElement} element
|
1236
|
+
*/
|
1237
|
+
function validatePropTypes(element) {
|
1238
|
+
var componentClass = element.type;
|
1239
|
+
if (typeof componentClass !== 'function') {
|
1240
|
+
return;
|
1241
|
+
}
|
1242
|
+
var name = componentClass.displayName || componentClass.name;
|
1243
|
+
var propTypes = componentClass.propTypes;
|
1244
|
+
|
1245
|
+
if (propTypes) {
|
1246
|
+
currentlyValidatingElement = element;
|
1247
|
+
checkPropTypes$1(propTypes, element.props, 'prop', name, getStackAddendum$1);
|
1248
|
+
currentlyValidatingElement = null;
|
1249
|
+
}
|
1250
|
+
if (typeof componentClass.getDefaultProps === 'function') {
|
1251
|
+
warning$3(componentClass.getDefaultProps.isReactClassApproved, 'getDefaultProps is only used on classic React.createClass ' + 'definitions. Use a static property named `defaultProps` instead.');
|
1252
|
+
}
|
1253
|
+
}
|
1254
|
+
|
1255
|
+
var ReactElementValidator$1 = {
|
1256
|
+
createElement: function (type, props, children) {
|
1257
|
+
var validType = typeof type === 'string' || typeof type === 'function';
|
1258
|
+
// We warn in this case but don't throw. We expect the element creation to
|
1259
|
+
// succeed and there will likely be errors in render.
|
1260
|
+
if (!validType) {
|
1261
|
+
var info = '';
|
1262
|
+
if (type === undefined || typeof type === 'object' && type !== null && Object.keys(type).length === 0) {
|
1263
|
+
info += ' You likely forgot to export your component from the file ' + "it's defined in.";
|
1264
|
+
}
|
1265
|
+
|
1266
|
+
var sourceInfo = getSourceInfoErrorAddendum(props);
|
1267
|
+
if (sourceInfo) {
|
1268
|
+
info += sourceInfo;
|
1269
|
+
} else {
|
1270
|
+
info += getDeclarationErrorAddendum();
|
1271
|
+
}
|
1272
|
+
|
1273
|
+
info += ReactDebugCurrentFrame$1.getStackAddendum() || '';
|
1274
|
+
|
1275
|
+
warning$3(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);
|
1276
|
+
}
|
1277
|
+
|
1278
|
+
var element = ReactElement_1.createElement.apply(this, arguments);
|
1279
|
+
|
1280
|
+
// The result can be nullish if a mock or a custom function is used.
|
1281
|
+
// TODO: Drop this when these are no longer allowed as the type argument.
|
1282
|
+
if (element == null) {
|
1283
|
+
return element;
|
1284
|
+
}
|
1285
|
+
|
1286
|
+
// Skip key warning if the type isn't valid since our key validation logic
|
1287
|
+
// doesn't expect a non-string/function type and can throw confusing errors.
|
1288
|
+
// We don't want exception behavior to differ between dev and prod.
|
1289
|
+
// (Rendering will throw with a helpful message and as soon as the type is
|
1290
|
+
// fixed, the key warnings will appear.)
|
1291
|
+
if (validType) {
|
1292
|
+
for (var i = 2; i < arguments.length; i++) {
|
1293
|
+
validateChildKeys(arguments[i], type);
|
1294
|
+
}
|
1295
|
+
}
|
1296
|
+
|
1297
|
+
validatePropTypes(element);
|
1298
|
+
|
1299
|
+
return element;
|
1300
|
+
},
|
1301
|
+
|
1302
|
+
createFactory: function (type) {
|
1303
|
+
var validatedFactory = ReactElementValidator$1.createElement.bind(null, type);
|
1304
|
+
// Legacy hook TODO: Warn if this is accessed
|
1305
|
+
validatedFactory.type = type;
|
1306
|
+
|
1307
|
+
{
|
1308
|
+
Object.defineProperty(validatedFactory, 'type', {
|
1309
|
+
enumerable: false,
|
1310
|
+
get: function () {
|
1311
|
+
lowPriorityWarning$1(false, 'Factory.type is deprecated. Access the class directly ' + 'before passing it to createFactory.');
|
1312
|
+
Object.defineProperty(this, 'type', {
|
1313
|
+
value: type
|
1314
|
+
});
|
1315
|
+
return type;
|
1316
|
+
}
|
1317
|
+
});
|
1318
|
+
}
|
1319
|
+
|
1320
|
+
return validatedFactory;
|
1321
|
+
},
|
1322
|
+
|
1323
|
+
cloneElement: function (element, props, children) {
|
1324
|
+
var newElement = ReactElement_1.cloneElement.apply(this, arguments);
|
1325
|
+
for (var i = 2; i < arguments.length; i++) {
|
1326
|
+
validateChildKeys(arguments[i], newElement.type);
|
1327
|
+
}
|
1328
|
+
validatePropTypes(newElement);
|
1329
|
+
return newElement;
|
1330
|
+
}
|
1331
|
+
};
|
1332
|
+
|
1333
|
+
var ReactElementValidator_1 = ReactElementValidator$1;
|
1334
|
+
|
1335
|
+
{
|
1336
|
+
var warning$4 = require$$0;
|
1337
|
+
}
|
1338
|
+
|
1339
|
+
function isNative(fn) {
|
1340
|
+
// Based on isNative() from Lodash
|
1341
|
+
var funcToString = Function.prototype.toString;
|
1342
|
+
var reIsNative = RegExp('^' + funcToString
|
1343
|
+
// Take an example native function source for comparison
|
1344
|
+
.call(Object.prototype.hasOwnProperty)
|
1345
|
+
// Strip regex characters so we can use it for regex
|
1346
|
+
.replace(/[\\^$.*+?()[\]{}|]/g, '\\$&')
|
1347
|
+
// Remove hasOwnProperty from the template to make it generic
|
1348
|
+
.replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g, '$1.*?') + '$');
|
1349
|
+
try {
|
1350
|
+
var source = funcToString.call(fn);
|
1351
|
+
return reIsNative.test(source);
|
1352
|
+
} catch (err) {
|
1353
|
+
return false;
|
1354
|
+
}
|
1355
|
+
}
|
1356
|
+
|
1357
|
+
var canUseCollections =
|
1358
|
+
// Array.from
|
1359
|
+
typeof Array.from === 'function' &&
|
1360
|
+
// Map
|
1361
|
+
typeof Map === 'function' && isNative(Map) &&
|
1362
|
+
// Map.prototype.keys
|
1363
|
+
Map.prototype != null && typeof Map.prototype.keys === 'function' && isNative(Map.prototype.keys) &&
|
1364
|
+
// Set
|
1365
|
+
typeof Set === 'function' && isNative(Set) &&
|
1366
|
+
// Set.prototype.keys
|
1367
|
+
Set.prototype != null && typeof Set.prototype.keys === 'function' && isNative(Set.prototype.keys);
|
1368
|
+
|
1369
|
+
var setItem;
|
1370
|
+
var getItem;
|
1371
|
+
var removeItem;
|
1372
|
+
var getItemIDs;
|
1373
|
+
var addRoot;
|
1374
|
+
var removeRoot;
|
1375
|
+
var getRootIDs;
|
1376
|
+
|
1377
|
+
if (canUseCollections) {
|
1378
|
+
var itemMap = new Map();
|
1379
|
+
var rootIDSet = new Set();
|
1380
|
+
|
1381
|
+
setItem = function (id, item) {
|
1382
|
+
itemMap.set(id, item);
|
1383
|
+
};
|
1384
|
+
getItem = function (id) {
|
1385
|
+
return itemMap.get(id);
|
1386
|
+
};
|
1387
|
+
removeItem = function (id) {
|
1388
|
+
itemMap['delete'](id);
|
1389
|
+
};
|
1390
|
+
getItemIDs = function () {
|
1391
|
+
return Array.from(itemMap.keys());
|
1392
|
+
};
|
1393
|
+
|
1394
|
+
addRoot = function (id) {
|
1395
|
+
rootIDSet.add(id);
|
1396
|
+
};
|
1397
|
+
removeRoot = function (id) {
|
1398
|
+
rootIDSet['delete'](id);
|
1399
|
+
};
|
1400
|
+
getRootIDs = function () {
|
1401
|
+
return Array.from(rootIDSet.keys());
|
1402
|
+
};
|
1403
|
+
} else {
|
1404
|
+
var itemByKey = {};
|
1405
|
+
var rootByKey = {};
|
1406
|
+
|
1407
|
+
// Use non-numeric keys to prevent V8 performance issues:
|
1408
|
+
// https://github.com/facebook/react/pull/7232
|
1409
|
+
var getKeyFromID = function (id) {
|
1410
|
+
return '.' + id;
|
1411
|
+
};
|
1412
|
+
var getIDFromKey = function (key) {
|
1413
|
+
return parseInt(key.substr(1), 10);
|
1414
|
+
};
|
1415
|
+
|
1416
|
+
setItem = function (id, item) {
|
1417
|
+
var key = getKeyFromID(id);
|
1418
|
+
itemByKey[key] = item;
|
1419
|
+
};
|
1420
|
+
getItem = function (id) {
|
1421
|
+
var key = getKeyFromID(id);
|
1422
|
+
return itemByKey[key];
|
1423
|
+
};
|
1424
|
+
removeItem = function (id) {
|
1425
|
+
var key = getKeyFromID(id);
|
1426
|
+
delete itemByKey[key];
|
1427
|
+
};
|
1428
|
+
getItemIDs = function () {
|
1429
|
+
return Object.keys(itemByKey).map(getIDFromKey);
|
1430
|
+
};
|
1431
|
+
|
1432
|
+
addRoot = function (id) {
|
1433
|
+
var key = getKeyFromID(id);
|
1434
|
+
rootByKey[key] = true;
|
1435
|
+
};
|
1436
|
+
removeRoot = function (id) {
|
1437
|
+
var key = getKeyFromID(id);
|
1438
|
+
delete rootByKey[key];
|
1439
|
+
};
|
1440
|
+
getRootIDs = function () {
|
1441
|
+
return Object.keys(rootByKey).map(getIDFromKey);
|
1442
|
+
};
|
1443
|
+
}
|
1444
|
+
|
1445
|
+
var unmountedIDs = [];
|
1446
|
+
|
1447
|
+
function purgeDeep(id) {
|
1448
|
+
var item = getItem(id);
|
1449
|
+
if (item) {
|
1450
|
+
var childIDs = item.childIDs;
|
1451
|
+
|
1452
|
+
removeItem(id);
|
1453
|
+
childIDs.forEach(purgeDeep);
|
1454
|
+
}
|
1455
|
+
}
|
1456
|
+
|
1457
|
+
function getDisplayName$1(element) {
|
1458
|
+
if (element == null) {
|
1459
|
+
return '#empty';
|
1460
|
+
} else if (typeof element === 'string' || typeof element === 'number') {
|
1461
|
+
return '#text';
|
1462
|
+
} else if (typeof element.type === 'string') {
|
1463
|
+
return element.type;
|
1464
|
+
} else {
|
1465
|
+
return element.type.displayName || element.type.name || 'Unknown';
|
1466
|
+
}
|
1467
|
+
}
|
1468
|
+
|
1469
|
+
function describeID(id) {
|
1470
|
+
var name = ReactComponentTreeHook.getDisplayName(id);
|
1471
|
+
var element = ReactComponentTreeHook.getElement(id);
|
1472
|
+
var ownerID = ReactComponentTreeHook.getOwnerID(id);
|
1473
|
+
var ownerName = void 0;
|
1474
|
+
|
1475
|
+
if (ownerID) {
|
1476
|
+
ownerName = ReactComponentTreeHook.getDisplayName(ownerID);
|
1477
|
+
}
|
1478
|
+
warning$4(element, 'ReactComponentTreeHook: Missing React element for debugID %s when ' + 'building stack', id);
|
1479
|
+
return describeComponentFrame$1(name || '', element && element._source, ownerName || '');
|
1480
|
+
}
|
1481
|
+
|
1482
|
+
var ReactComponentTreeHook = {
|
1483
|
+
onSetChildren: function (id, nextChildIDs) {
|
1484
|
+
var item = getItem(id);
|
1485
|
+
!item ? invariant(false, 'Item must have been set') : void 0;
|
1486
|
+
item.childIDs = nextChildIDs;
|
1487
|
+
|
1488
|
+
for (var i = 0; i < nextChildIDs.length; i++) {
|
1489
|
+
var nextChildID = nextChildIDs[i];
|
1490
|
+
var nextChild = getItem(nextChildID);
|
1491
|
+
!nextChild ? invariant(false, 'Expected hook events to fire for the child before its parent includes it in onSetChildren().') : void 0;
|
1492
|
+
!(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;
|
1493
|
+
!nextChild.isMounted ? invariant(false, 'Expected onMountComponent() to fire for the child before its parent includes it in onSetChildren().') : void 0;
|
1494
|
+
if (nextChild.parentID == null) {
|
1495
|
+
nextChild.parentID = id;
|
1496
|
+
// TODO: This shouldn't be necessary but mounting a new root during in
|
1497
|
+
// componentWillMount currently causes not-yet-mounted components to
|
1498
|
+
// be purged from our tree data so their parent id is missing.
|
1499
|
+
}
|
1500
|
+
!(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;
|
1501
|
+
}
|
1502
|
+
},
|
1503
|
+
onBeforeMountComponent: function (id, element, parentID) {
|
1504
|
+
var item = {
|
1505
|
+
element: element,
|
1506
|
+
parentID: parentID,
|
1507
|
+
text: null,
|
1508
|
+
childIDs: [],
|
1509
|
+
isMounted: false,
|
1510
|
+
updateCount: 0
|
1511
|
+
};
|
1512
|
+
setItem(id, item);
|
1513
|
+
},
|
1514
|
+
onBeforeUpdateComponent: function (id, element) {
|
1515
|
+
var item = getItem(id);
|
1516
|
+
if (!item || !item.isMounted) {
|
1517
|
+
// We may end up here as a result of setState() in componentWillUnmount().
|
1518
|
+
// In this case, ignore the element.
|
1519
|
+
return;
|
1520
|
+
}
|
1521
|
+
item.element = element;
|
1522
|
+
},
|
1523
|
+
onMountComponent: function (id) {
|
1524
|
+
var item = getItem(id);
|
1525
|
+
!item ? invariant(false, 'Item must have been set') : void 0;
|
1526
|
+
item.isMounted = true;
|
1527
|
+
var isRoot = item.parentID === 0;
|
1528
|
+
if (isRoot) {
|
1529
|
+
addRoot(id);
|
1530
|
+
}
|
1531
|
+
},
|
1532
|
+
onUpdateComponent: function (id) {
|
1533
|
+
var item = getItem(id);
|
1534
|
+
if (!item || !item.isMounted) {
|
1535
|
+
// We may end up here as a result of setState() in componentWillUnmount().
|
1536
|
+
// In this case, ignore the element.
|
1537
|
+
return;
|
1538
|
+
}
|
1539
|
+
item.updateCount++;
|
1540
|
+
},
|
1541
|
+
onUnmountComponent: function (id) {
|
1542
|
+
var item = getItem(id);
|
1543
|
+
if (item) {
|
1544
|
+
// We need to check if it exists.
|
1545
|
+
// `item` might not exist if it is inside an error boundary, and a sibling
|
1546
|
+
// error boundary child threw while mounting. Then this instance never
|
1547
|
+
// got a chance to mount, but it still gets an unmounting event during
|
1548
|
+
// the error boundary cleanup.
|
1549
|
+
item.isMounted = false;
|
1550
|
+
var isRoot = item.parentID === 0;
|
1551
|
+
if (isRoot) {
|
1552
|
+
removeRoot(id);
|
1553
|
+
}
|
1554
|
+
}
|
1555
|
+
unmountedIDs.push(id);
|
1556
|
+
},
|
1557
|
+
purgeUnmountedComponents: function () {
|
1558
|
+
if (ReactComponentTreeHook._preventPurging) {
|
1559
|
+
// Should only be used for testing.
|
1560
|
+
return;
|
1561
|
+
}
|
1562
|
+
|
1563
|
+
for (var i = 0; i < unmountedIDs.length; i++) {
|
1564
|
+
var id = unmountedIDs[i];
|
1565
|
+
purgeDeep(id);
|
1566
|
+
}
|
1567
|
+
unmountedIDs.length = 0;
|
1568
|
+
},
|
1569
|
+
isMounted: function (id) {
|
1570
|
+
var item = getItem(id);
|
1571
|
+
return item ? item.isMounted : false;
|
1572
|
+
},
|
1573
|
+
getCurrentStackAddendum: function () {
|
1574
|
+
var info = '';
|
1575
|
+
var currentOwner = ReactCurrentOwner_1.current;
|
1576
|
+
if (currentOwner) {
|
1577
|
+
!(typeof currentOwner.tag !== 'number') ? invariant(false, 'Fiber owners should not show up in Stack stack traces.') : void 0;
|
1578
|
+
if (typeof currentOwner._debugID === 'number') {
|
1579
|
+
info += ReactComponentTreeHook.getStackAddendumByID(currentOwner._debugID);
|
1580
|
+
}
|
1581
|
+
}
|
1582
|
+
return info;
|
1583
|
+
},
|
1584
|
+
getStackAddendumByID: function (id) {
|
1585
|
+
var info = '';
|
1586
|
+
while (id) {
|
1587
|
+
info += describeID(id);
|
1588
|
+
id = ReactComponentTreeHook.getParentID(id);
|
1589
|
+
}
|
1590
|
+
return info;
|
1591
|
+
},
|
1592
|
+
getChildIDs: function (id) {
|
1593
|
+
var item = getItem(id);
|
1594
|
+
return item ? item.childIDs : [];
|
1595
|
+
},
|
1596
|
+
getDisplayName: function (id) {
|
1597
|
+
var element = ReactComponentTreeHook.getElement(id);
|
1598
|
+
if (!element) {
|
1599
|
+
return null;
|
1600
|
+
}
|
1601
|
+
return getDisplayName$1(element);
|
1602
|
+
},
|
1603
|
+
getElement: function (id) {
|
1604
|
+
var item = getItem(id);
|
1605
|
+
return item ? item.element : null;
|
1606
|
+
},
|
1607
|
+
getOwnerID: function (id) {
|
1608
|
+
var element = ReactComponentTreeHook.getElement(id);
|
1609
|
+
if (!element || !element._owner) {
|
1610
|
+
return null;
|
1611
|
+
}
|
1612
|
+
return element._owner._debugID;
|
1613
|
+
},
|
1614
|
+
getParentID: function (id) {
|
1615
|
+
var item = getItem(id);
|
1616
|
+
return item ? item.parentID : null;
|
1617
|
+
},
|
1618
|
+
getSource: function (id) {
|
1619
|
+
var item = getItem(id);
|
1620
|
+
var element = item ? item.element : null;
|
1621
|
+
var source = element != null ? element._source : null;
|
1622
|
+
return source;
|
1623
|
+
},
|
1624
|
+
getText: function (id) {
|
1625
|
+
var element = ReactComponentTreeHook.getElement(id);
|
1626
|
+
if (typeof element === 'string') {
|
1627
|
+
return element;
|
1628
|
+
} else if (typeof element === 'number') {
|
1629
|
+
return '' + element;
|
1630
|
+
} else {
|
1631
|
+
return null;
|
1632
|
+
}
|
1633
|
+
},
|
1634
|
+
getUpdateCount: function (id) {
|
1635
|
+
var item = getItem(id);
|
1636
|
+
return item ? item.updateCount : 0;
|
1637
|
+
},
|
1638
|
+
|
1639
|
+
|
1640
|
+
getRootIDs: getRootIDs,
|
1641
|
+
getRegisteredIDs: getItemIDs
|
1642
|
+
};
|
1643
|
+
|
1644
|
+
var ReactComponentTreeHook_1 = ReactComponentTreeHook;
|
1645
|
+
|
1646
|
+
var createElement = ReactElement_1.createElement;
|
1647
|
+
var createFactory = ReactElement_1.createFactory;
|
1648
|
+
var cloneElement = ReactElement_1.cloneElement;
|
1649
|
+
|
1650
|
+
{
|
1651
|
+
var ReactElementValidator = ReactElementValidator_1;
|
1652
|
+
createElement = ReactElementValidator.createElement;
|
1653
|
+
createFactory = ReactElementValidator.createFactory;
|
1654
|
+
cloneElement = ReactElementValidator.cloneElement;
|
1655
|
+
}
|
1656
|
+
|
1657
|
+
var React = {
|
1658
|
+
Children: {
|
1659
|
+
map: ReactChildren_1.map,
|
1660
|
+
forEach: ReactChildren_1.forEach,
|
1661
|
+
count: ReactChildren_1.count,
|
1662
|
+
toArray: ReactChildren_1.toArray,
|
1663
|
+
only: onlyChild_1
|
1664
|
+
},
|
1665
|
+
|
1666
|
+
Component: ReactBaseClasses.Component,
|
1667
|
+
PureComponent: ReactBaseClasses.PureComponent,
|
1668
|
+
unstable_AsyncComponent: ReactBaseClasses.AsyncComponent,
|
1669
|
+
|
1670
|
+
createElement: createElement,
|
1671
|
+
cloneElement: cloneElement,
|
1672
|
+
isValidElement: ReactElement_1.isValidElement,
|
1673
|
+
|
1674
|
+
createFactory: createFactory,
|
1675
|
+
|
1676
|
+
version: ReactVersion,
|
1677
|
+
|
1678
|
+
__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED: {
|
1679
|
+
ReactCurrentOwner: ReactCurrentOwner_1,
|
1680
|
+
// Used by renderers to avoid bundling object-assign twice in UMD bundles:
|
1681
|
+
assign: objectAssign$1
|
1682
|
+
}
|
1683
|
+
};
|
1684
|
+
|
1685
|
+
{
|
1686
|
+
objectAssign$1(React.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED, {
|
1687
|
+
// These should not be included in production.
|
1688
|
+
ReactComponentTreeHook: ReactComponentTreeHook_1,
|
1689
|
+
ReactDebugCurrentFrame: ReactDebugCurrentFrame_1
|
1690
|
+
});
|
1691
|
+
}
|
1692
|
+
|
1693
|
+
var ReactEntry = React;
|
1694
|
+
|
1695
|
+
module.exports = ReactEntry;
|
1696
|
+
|
1697
|
+
})();
|
1698
|
+
}
|