graphiql-rails 1.4.0 → 1.4.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/app/assets/javascripts/graphiql/rails/application.js +3 -3
- data/app/assets/javascripts/graphiql/rails/{graphiql-0.8.0.js → graphiql-0.8.1.js} +1056 -673
- data/app/assets/javascripts/graphiql/rails/react-15.4.1.js +3756 -0
- data/app/assets/javascripts/graphiql/rails/{react-15.3.2.js → react-dom-15.4.1.js} +2617 -4973
- data/app/assets/stylesheets/graphiql/rails/application.css +1 -1
- data/app/assets/stylesheets/graphiql/rails/{graphiql-0.8.0.css → graphiql-0.8.1.css} +179 -208
- data/lib/graphiql/rails/version.rb +1 -1
- metadata +6 -6
- data/app/assets/javascripts/graphiql/rails/react-dom-15.3.2.js +0 -42
@@ -0,0 +1,3756 @@
|
|
1
|
+
/**
|
2
|
+
* React v15.4.1
|
3
|
+
*/
|
4
|
+
(function(f){if(typeof exports==="object"&&typeof module!=="undefined"){module.exports=f()}else if(typeof define==="function"&&define.amd){define([],f)}else{var g;if(typeof window!=="undefined"){g=window}else if(typeof global!=="undefined"){g=global}else if(typeof self!=="undefined"){g=self}else{g=this}g.React = f()}})(function(){var define,module,exports;return (function e(t,n,r){function s(o,u){if(!n[o]){if(!t[o]){var a=typeof require=="function"&&require;if(!u&&a)return a(o,!0);if(i)return i(o,!0);var f=new Error("Cannot find module '"+o+"'");throw f.code="MODULE_NOT_FOUND",f}var l=n[o]={exports:{}};t[o][0].call(l.exports,function(e){var n=t[o][1][e];return s(n?n:e)},l,l.exports,e,t,n,r)}return n[o].exports}var i=typeof require=="function"&&require;for(var o=0;o<r.length;o++)s(r[o]);return s})({1:[function(_dereq_,module,exports){
|
5
|
+
/**
|
6
|
+
* Copyright 2013-present, Facebook, Inc.
|
7
|
+
* All rights reserved.
|
8
|
+
*
|
9
|
+
* This source code is licensed under the BSD-style license found in the
|
10
|
+
* LICENSE file in the root directory of this source tree. An additional grant
|
11
|
+
* of patent rights can be found in the PATENTS file in the same directory.
|
12
|
+
*
|
13
|
+
*
|
14
|
+
*/
|
15
|
+
|
16
|
+
'use strict';
|
17
|
+
|
18
|
+
/**
|
19
|
+
* Escape and wrap key so it is safe to use as a reactid
|
20
|
+
*
|
21
|
+
* @param {string} key to be escaped.
|
22
|
+
* @return {string} the escaped key.
|
23
|
+
*/
|
24
|
+
|
25
|
+
function escape(key) {
|
26
|
+
var escapeRegex = /[=:]/g;
|
27
|
+
var escaperLookup = {
|
28
|
+
'=': '=0',
|
29
|
+
':': '=2'
|
30
|
+
};
|
31
|
+
var escapedString = ('' + key).replace(escapeRegex, function (match) {
|
32
|
+
return escaperLookup[match];
|
33
|
+
});
|
34
|
+
|
35
|
+
return '$' + escapedString;
|
36
|
+
}
|
37
|
+
|
38
|
+
/**
|
39
|
+
* Unescape and unwrap key for human-readable display
|
40
|
+
*
|
41
|
+
* @param {string} key to unescape.
|
42
|
+
* @return {string} the unescaped key.
|
43
|
+
*/
|
44
|
+
function unescape(key) {
|
45
|
+
var unescapeRegex = /(=0|=2)/g;
|
46
|
+
var unescaperLookup = {
|
47
|
+
'=0': '=',
|
48
|
+
'=2': ':'
|
49
|
+
};
|
50
|
+
var keySubstring = key[0] === '.' && key[1] === '$' ? key.substring(2) : key.substring(1);
|
51
|
+
|
52
|
+
return ('' + keySubstring).replace(unescapeRegex, function (match) {
|
53
|
+
return unescaperLookup[match];
|
54
|
+
});
|
55
|
+
}
|
56
|
+
|
57
|
+
var KeyEscapeUtils = {
|
58
|
+
escape: escape,
|
59
|
+
unescape: unescape
|
60
|
+
};
|
61
|
+
|
62
|
+
module.exports = KeyEscapeUtils;
|
63
|
+
},{}],2:[function(_dereq_,module,exports){
|
64
|
+
/**
|
65
|
+
* Copyright 2013-present, Facebook, Inc.
|
66
|
+
* All rights reserved.
|
67
|
+
*
|
68
|
+
* This source code is licensed under the BSD-style license found in the
|
69
|
+
* LICENSE file in the root directory of this source tree. An additional grant
|
70
|
+
* of patent rights can be found in the PATENTS file in the same directory.
|
71
|
+
*
|
72
|
+
*
|
73
|
+
*/
|
74
|
+
|
75
|
+
'use strict';
|
76
|
+
|
77
|
+
var _prodInvariant = _dereq_(24);
|
78
|
+
|
79
|
+
var invariant = _dereq_(28);
|
80
|
+
|
81
|
+
/**
|
82
|
+
* Static poolers. Several custom versions for each potential number of
|
83
|
+
* arguments. A completely generic pooler is easy to implement, but would
|
84
|
+
* require accessing the `arguments` object. In each of these, `this` refers to
|
85
|
+
* the Class itself, not an instance. If any others are needed, simply add them
|
86
|
+
* here, or in their own files.
|
87
|
+
*/
|
88
|
+
var oneArgumentPooler = function (copyFieldsFrom) {
|
89
|
+
var Klass = this;
|
90
|
+
if (Klass.instancePool.length) {
|
91
|
+
var instance = Klass.instancePool.pop();
|
92
|
+
Klass.call(instance, copyFieldsFrom);
|
93
|
+
return instance;
|
94
|
+
} else {
|
95
|
+
return new Klass(copyFieldsFrom);
|
96
|
+
}
|
97
|
+
};
|
98
|
+
|
99
|
+
var twoArgumentPooler = function (a1, a2) {
|
100
|
+
var Klass = this;
|
101
|
+
if (Klass.instancePool.length) {
|
102
|
+
var instance = Klass.instancePool.pop();
|
103
|
+
Klass.call(instance, a1, a2);
|
104
|
+
return instance;
|
105
|
+
} else {
|
106
|
+
return new Klass(a1, a2);
|
107
|
+
}
|
108
|
+
};
|
109
|
+
|
110
|
+
var threeArgumentPooler = function (a1, a2, a3) {
|
111
|
+
var Klass = this;
|
112
|
+
if (Klass.instancePool.length) {
|
113
|
+
var instance = Klass.instancePool.pop();
|
114
|
+
Klass.call(instance, a1, a2, a3);
|
115
|
+
return instance;
|
116
|
+
} else {
|
117
|
+
return new Klass(a1, a2, a3);
|
118
|
+
}
|
119
|
+
};
|
120
|
+
|
121
|
+
var fourArgumentPooler = function (a1, a2, a3, a4) {
|
122
|
+
var Klass = this;
|
123
|
+
if (Klass.instancePool.length) {
|
124
|
+
var instance = Klass.instancePool.pop();
|
125
|
+
Klass.call(instance, a1, a2, a3, a4);
|
126
|
+
return instance;
|
127
|
+
} else {
|
128
|
+
return new Klass(a1, a2, a3, a4);
|
129
|
+
}
|
130
|
+
};
|
131
|
+
|
132
|
+
var fiveArgumentPooler = function (a1, a2, a3, a4, a5) {
|
133
|
+
var Klass = this;
|
134
|
+
if (Klass.instancePool.length) {
|
135
|
+
var instance = Klass.instancePool.pop();
|
136
|
+
Klass.call(instance, a1, a2, a3, a4, a5);
|
137
|
+
return instance;
|
138
|
+
} else {
|
139
|
+
return new Klass(a1, a2, a3, a4, a5);
|
140
|
+
}
|
141
|
+
};
|
142
|
+
|
143
|
+
var standardReleaser = function (instance) {
|
144
|
+
var Klass = this;
|
145
|
+
!(instance instanceof Klass) ? "development" !== 'production' ? invariant(false, 'Trying to release an instance into a pool of a different type.') : _prodInvariant('25') : void 0;
|
146
|
+
instance.destructor();
|
147
|
+
if (Klass.instancePool.length < Klass.poolSize) {
|
148
|
+
Klass.instancePool.push(instance);
|
149
|
+
}
|
150
|
+
};
|
151
|
+
|
152
|
+
var DEFAULT_POOL_SIZE = 10;
|
153
|
+
var DEFAULT_POOLER = oneArgumentPooler;
|
154
|
+
|
155
|
+
/**
|
156
|
+
* Augments `CopyConstructor` to be a poolable class, augmenting only the class
|
157
|
+
* itself (statically) not adding any prototypical fields. Any CopyConstructor
|
158
|
+
* you give this may have a `poolSize` property, and will look for a
|
159
|
+
* prototypical `destructor` on instances.
|
160
|
+
*
|
161
|
+
* @param {Function} CopyConstructor Constructor that can be used to reset.
|
162
|
+
* @param {Function} pooler Customizable pooler.
|
163
|
+
*/
|
164
|
+
var addPoolingTo = function (CopyConstructor, pooler) {
|
165
|
+
// Casting as any so that flow ignores the actual implementation and trusts
|
166
|
+
// it to match the type we declared
|
167
|
+
var NewKlass = CopyConstructor;
|
168
|
+
NewKlass.instancePool = [];
|
169
|
+
NewKlass.getPooled = pooler || DEFAULT_POOLER;
|
170
|
+
if (!NewKlass.poolSize) {
|
171
|
+
NewKlass.poolSize = DEFAULT_POOL_SIZE;
|
172
|
+
}
|
173
|
+
NewKlass.release = standardReleaser;
|
174
|
+
return NewKlass;
|
175
|
+
};
|
176
|
+
|
177
|
+
var PooledClass = {
|
178
|
+
addPoolingTo: addPoolingTo,
|
179
|
+
oneArgumentPooler: oneArgumentPooler,
|
180
|
+
twoArgumentPooler: twoArgumentPooler,
|
181
|
+
threeArgumentPooler: threeArgumentPooler,
|
182
|
+
fourArgumentPooler: fourArgumentPooler,
|
183
|
+
fiveArgumentPooler: fiveArgumentPooler
|
184
|
+
};
|
185
|
+
|
186
|
+
module.exports = PooledClass;
|
187
|
+
},{"24":24,"28":28}],3:[function(_dereq_,module,exports){
|
188
|
+
/**
|
189
|
+
* Copyright 2013-present, Facebook, Inc.
|
190
|
+
* All rights reserved.
|
191
|
+
*
|
192
|
+
* This source code is licensed under the BSD-style license found in the
|
193
|
+
* LICENSE file in the root directory of this source tree. An additional grant
|
194
|
+
* of patent rights can be found in the PATENTS file in the same directory.
|
195
|
+
*
|
196
|
+
*/
|
197
|
+
|
198
|
+
'use strict';
|
199
|
+
|
200
|
+
var _assign = _dereq_(30);
|
201
|
+
|
202
|
+
var ReactChildren = _dereq_(4);
|
203
|
+
var ReactComponent = _dereq_(6);
|
204
|
+
var ReactPureComponent = _dereq_(17);
|
205
|
+
var ReactClass = _dereq_(5);
|
206
|
+
var ReactDOMFactories = _dereq_(9);
|
207
|
+
var ReactElement = _dereq_(10);
|
208
|
+
var ReactPropTypes = _dereq_(15);
|
209
|
+
var ReactVersion = _dereq_(19);
|
210
|
+
|
211
|
+
var onlyChild = _dereq_(23);
|
212
|
+
var warning = _dereq_(29);
|
213
|
+
|
214
|
+
var createElement = ReactElement.createElement;
|
215
|
+
var createFactory = ReactElement.createFactory;
|
216
|
+
var cloneElement = ReactElement.cloneElement;
|
217
|
+
|
218
|
+
if ("development" !== 'production') {
|
219
|
+
var ReactElementValidator = _dereq_(12);
|
220
|
+
createElement = ReactElementValidator.createElement;
|
221
|
+
createFactory = ReactElementValidator.createFactory;
|
222
|
+
cloneElement = ReactElementValidator.cloneElement;
|
223
|
+
}
|
224
|
+
|
225
|
+
var __spread = _assign;
|
226
|
+
|
227
|
+
if ("development" !== 'production') {
|
228
|
+
var warned = false;
|
229
|
+
__spread = function () {
|
230
|
+
"development" !== 'production' ? warning(warned, 'React.__spread is deprecated and should not be used. Use ' + 'Object.assign directly or another helper function with similar ' + 'semantics. You may be seeing this warning due to your compiler. ' + 'See https://fb.me/react-spread-deprecation for more details.') : void 0;
|
231
|
+
warned = true;
|
232
|
+
return _assign.apply(null, arguments);
|
233
|
+
};
|
234
|
+
}
|
235
|
+
|
236
|
+
var React = {
|
237
|
+
|
238
|
+
// Modern
|
239
|
+
|
240
|
+
Children: {
|
241
|
+
map: ReactChildren.map,
|
242
|
+
forEach: ReactChildren.forEach,
|
243
|
+
count: ReactChildren.count,
|
244
|
+
toArray: ReactChildren.toArray,
|
245
|
+
only: onlyChild
|
246
|
+
},
|
247
|
+
|
248
|
+
Component: ReactComponent,
|
249
|
+
PureComponent: ReactPureComponent,
|
250
|
+
|
251
|
+
createElement: createElement,
|
252
|
+
cloneElement: cloneElement,
|
253
|
+
isValidElement: ReactElement.isValidElement,
|
254
|
+
|
255
|
+
// Classic
|
256
|
+
|
257
|
+
PropTypes: ReactPropTypes,
|
258
|
+
createClass: ReactClass.createClass,
|
259
|
+
createFactory: createFactory,
|
260
|
+
createMixin: function (mixin) {
|
261
|
+
// Currently a noop. Will be used to validate and trace mixins.
|
262
|
+
return mixin;
|
263
|
+
},
|
264
|
+
|
265
|
+
// This looks DOM specific but these are actually isomorphic helpers
|
266
|
+
// since they are just generating DOM strings.
|
267
|
+
DOM: ReactDOMFactories,
|
268
|
+
|
269
|
+
version: ReactVersion,
|
270
|
+
|
271
|
+
// Deprecated hook for JSX spread, don't use this for anything.
|
272
|
+
__spread: __spread
|
273
|
+
};
|
274
|
+
|
275
|
+
module.exports = React;
|
276
|
+
},{"10":10,"12":12,"15":15,"17":17,"19":19,"23":23,"29":29,"30":30,"4":4,"5":5,"6":6,"9":9}],4:[function(_dereq_,module,exports){
|
277
|
+
/**
|
278
|
+
* Copyright 2013-present, Facebook, Inc.
|
279
|
+
* All rights reserved.
|
280
|
+
*
|
281
|
+
* This source code is licensed under the BSD-style license found in the
|
282
|
+
* LICENSE file in the root directory of this source tree. An additional grant
|
283
|
+
* of patent rights can be found in the PATENTS file in the same directory.
|
284
|
+
*
|
285
|
+
*/
|
286
|
+
|
287
|
+
'use strict';
|
288
|
+
|
289
|
+
var PooledClass = _dereq_(2);
|
290
|
+
var ReactElement = _dereq_(10);
|
291
|
+
|
292
|
+
var emptyFunction = _dereq_(26);
|
293
|
+
var traverseAllChildren = _dereq_(25);
|
294
|
+
|
295
|
+
var twoArgumentPooler = PooledClass.twoArgumentPooler;
|
296
|
+
var fourArgumentPooler = PooledClass.fourArgumentPooler;
|
297
|
+
|
298
|
+
var userProvidedKeyEscapeRegex = /\/+/g;
|
299
|
+
function escapeUserProvidedKey(text) {
|
300
|
+
return ('' + text).replace(userProvidedKeyEscapeRegex, '$&/');
|
301
|
+
}
|
302
|
+
|
303
|
+
/**
|
304
|
+
* PooledClass representing the bookkeeping associated with performing a child
|
305
|
+
* traversal. Allows avoiding binding callbacks.
|
306
|
+
*
|
307
|
+
* @constructor ForEachBookKeeping
|
308
|
+
* @param {!function} forEachFunction Function to perform traversal with.
|
309
|
+
* @param {?*} forEachContext Context to perform context with.
|
310
|
+
*/
|
311
|
+
function ForEachBookKeeping(forEachFunction, forEachContext) {
|
312
|
+
this.func = forEachFunction;
|
313
|
+
this.context = forEachContext;
|
314
|
+
this.count = 0;
|
315
|
+
}
|
316
|
+
ForEachBookKeeping.prototype.destructor = function () {
|
317
|
+
this.func = null;
|
318
|
+
this.context = null;
|
319
|
+
this.count = 0;
|
320
|
+
};
|
321
|
+
PooledClass.addPoolingTo(ForEachBookKeeping, twoArgumentPooler);
|
322
|
+
|
323
|
+
function forEachSingleChild(bookKeeping, child, name) {
|
324
|
+
var func = bookKeeping.func,
|
325
|
+
context = bookKeeping.context;
|
326
|
+
|
327
|
+
func.call(context, child, bookKeeping.count++);
|
328
|
+
}
|
329
|
+
|
330
|
+
/**
|
331
|
+
* Iterates through children that are typically specified as `props.children`.
|
332
|
+
*
|
333
|
+
* See https://facebook.github.io/react/docs/top-level-api.html#react.children.foreach
|
334
|
+
*
|
335
|
+
* The provided forEachFunc(child, index) will be called for each
|
336
|
+
* leaf child.
|
337
|
+
*
|
338
|
+
* @param {?*} children Children tree container.
|
339
|
+
* @param {function(*, int)} forEachFunc
|
340
|
+
* @param {*} forEachContext Context for forEachContext.
|
341
|
+
*/
|
342
|
+
function forEachChildren(children, forEachFunc, forEachContext) {
|
343
|
+
if (children == null) {
|
344
|
+
return children;
|
345
|
+
}
|
346
|
+
var traverseContext = ForEachBookKeeping.getPooled(forEachFunc, forEachContext);
|
347
|
+
traverseAllChildren(children, forEachSingleChild, traverseContext);
|
348
|
+
ForEachBookKeeping.release(traverseContext);
|
349
|
+
}
|
350
|
+
|
351
|
+
/**
|
352
|
+
* PooledClass representing the bookkeeping associated with performing a child
|
353
|
+
* mapping. Allows avoiding binding callbacks.
|
354
|
+
*
|
355
|
+
* @constructor MapBookKeeping
|
356
|
+
* @param {!*} mapResult Object containing the ordered map of results.
|
357
|
+
* @param {!function} mapFunction Function to perform mapping with.
|
358
|
+
* @param {?*} mapContext Context to perform mapping with.
|
359
|
+
*/
|
360
|
+
function MapBookKeeping(mapResult, keyPrefix, mapFunction, mapContext) {
|
361
|
+
this.result = mapResult;
|
362
|
+
this.keyPrefix = keyPrefix;
|
363
|
+
this.func = mapFunction;
|
364
|
+
this.context = mapContext;
|
365
|
+
this.count = 0;
|
366
|
+
}
|
367
|
+
MapBookKeeping.prototype.destructor = function () {
|
368
|
+
this.result = null;
|
369
|
+
this.keyPrefix = null;
|
370
|
+
this.func = null;
|
371
|
+
this.context = null;
|
372
|
+
this.count = 0;
|
373
|
+
};
|
374
|
+
PooledClass.addPoolingTo(MapBookKeeping, fourArgumentPooler);
|
375
|
+
|
376
|
+
function mapSingleChildIntoContext(bookKeeping, child, childKey) {
|
377
|
+
var result = bookKeeping.result,
|
378
|
+
keyPrefix = bookKeeping.keyPrefix,
|
379
|
+
func = bookKeeping.func,
|
380
|
+
context = bookKeeping.context;
|
381
|
+
|
382
|
+
|
383
|
+
var mappedChild = func.call(context, child, bookKeeping.count++);
|
384
|
+
if (Array.isArray(mappedChild)) {
|
385
|
+
mapIntoWithKeyPrefixInternal(mappedChild, result, childKey, emptyFunction.thatReturnsArgument);
|
386
|
+
} else if (mappedChild != null) {
|
387
|
+
if (ReactElement.isValidElement(mappedChild)) {
|
388
|
+
mappedChild = ReactElement.cloneAndReplaceKey(mappedChild,
|
389
|
+
// Keep both the (mapped) and old keys if they differ, just as
|
390
|
+
// traverseAllChildren used to do for objects as children
|
391
|
+
keyPrefix + (mappedChild.key && (!child || child.key !== mappedChild.key) ? escapeUserProvidedKey(mappedChild.key) + '/' : '') + childKey);
|
392
|
+
}
|
393
|
+
result.push(mappedChild);
|
394
|
+
}
|
395
|
+
}
|
396
|
+
|
397
|
+
function mapIntoWithKeyPrefixInternal(children, array, prefix, func, context) {
|
398
|
+
var escapedPrefix = '';
|
399
|
+
if (prefix != null) {
|
400
|
+
escapedPrefix = escapeUserProvidedKey(prefix) + '/';
|
401
|
+
}
|
402
|
+
var traverseContext = MapBookKeeping.getPooled(array, escapedPrefix, func, context);
|
403
|
+
traverseAllChildren(children, mapSingleChildIntoContext, traverseContext);
|
404
|
+
MapBookKeeping.release(traverseContext);
|
405
|
+
}
|
406
|
+
|
407
|
+
/**
|
408
|
+
* Maps children that are typically specified as `props.children`.
|
409
|
+
*
|
410
|
+
* See https://facebook.github.io/react/docs/top-level-api.html#react.children.map
|
411
|
+
*
|
412
|
+
* The provided mapFunction(child, key, index) will be called for each
|
413
|
+
* leaf child.
|
414
|
+
*
|
415
|
+
* @param {?*} children Children tree container.
|
416
|
+
* @param {function(*, int)} func The map function.
|
417
|
+
* @param {*} context Context for mapFunction.
|
418
|
+
* @return {object} Object containing the ordered map of results.
|
419
|
+
*/
|
420
|
+
function mapChildren(children, func, context) {
|
421
|
+
if (children == null) {
|
422
|
+
return children;
|
423
|
+
}
|
424
|
+
var result = [];
|
425
|
+
mapIntoWithKeyPrefixInternal(children, result, null, func, context);
|
426
|
+
return result;
|
427
|
+
}
|
428
|
+
|
429
|
+
function forEachSingleChildDummy(traverseContext, child, name) {
|
430
|
+
return null;
|
431
|
+
}
|
432
|
+
|
433
|
+
/**
|
434
|
+
* Count the number of children that are typically specified as
|
435
|
+
* `props.children`.
|
436
|
+
*
|
437
|
+
* See https://facebook.github.io/react/docs/top-level-api.html#react.children.count
|
438
|
+
*
|
439
|
+
* @param {?*} children Children tree container.
|
440
|
+
* @return {number} The number of children.
|
441
|
+
*/
|
442
|
+
function countChildren(children, context) {
|
443
|
+
return traverseAllChildren(children, forEachSingleChildDummy, null);
|
444
|
+
}
|
445
|
+
|
446
|
+
/**
|
447
|
+
* Flatten a children object (typically specified as `props.children`) and
|
448
|
+
* return an array with appropriately re-keyed children.
|
449
|
+
*
|
450
|
+
* See https://facebook.github.io/react/docs/top-level-api.html#react.children.toarray
|
451
|
+
*/
|
452
|
+
function toArray(children) {
|
453
|
+
var result = [];
|
454
|
+
mapIntoWithKeyPrefixInternal(children, result, null, emptyFunction.thatReturnsArgument);
|
455
|
+
return result;
|
456
|
+
}
|
457
|
+
|
458
|
+
var ReactChildren = {
|
459
|
+
forEach: forEachChildren,
|
460
|
+
map: mapChildren,
|
461
|
+
mapIntoWithKeyPrefixInternal: mapIntoWithKeyPrefixInternal,
|
462
|
+
count: countChildren,
|
463
|
+
toArray: toArray
|
464
|
+
};
|
465
|
+
|
466
|
+
module.exports = ReactChildren;
|
467
|
+
},{"10":10,"2":2,"25":25,"26":26}],5:[function(_dereq_,module,exports){
|
468
|
+
/**
|
469
|
+
* Copyright 2013-present, Facebook, Inc.
|
470
|
+
* All rights reserved.
|
471
|
+
*
|
472
|
+
* This source code is licensed under the BSD-style license found in the
|
473
|
+
* LICENSE file in the root directory of this source tree. An additional grant
|
474
|
+
* of patent rights can be found in the PATENTS file in the same directory.
|
475
|
+
*
|
476
|
+
*/
|
477
|
+
|
478
|
+
'use strict';
|
479
|
+
|
480
|
+
var _prodInvariant = _dereq_(24),
|
481
|
+
_assign = _dereq_(30);
|
482
|
+
|
483
|
+
var ReactComponent = _dereq_(6);
|
484
|
+
var ReactElement = _dereq_(10);
|
485
|
+
var ReactPropTypeLocationNames = _dereq_(14);
|
486
|
+
var ReactNoopUpdateQueue = _dereq_(13);
|
487
|
+
|
488
|
+
var emptyObject = _dereq_(27);
|
489
|
+
var invariant = _dereq_(28);
|
490
|
+
var warning = _dereq_(29);
|
491
|
+
|
492
|
+
var MIXINS_KEY = 'mixins';
|
493
|
+
|
494
|
+
// Helper function to allow the creation of anonymous functions which do not
|
495
|
+
// have .name set to the name of the variable being assigned to.
|
496
|
+
function identity(fn) {
|
497
|
+
return fn;
|
498
|
+
}
|
499
|
+
|
500
|
+
/**
|
501
|
+
* Policies that describe methods in `ReactClassInterface`.
|
502
|
+
*/
|
503
|
+
|
504
|
+
|
505
|
+
var injectedMixins = [];
|
506
|
+
|
507
|
+
/**
|
508
|
+
* Composite components are higher-level components that compose other composite
|
509
|
+
* or host components.
|
510
|
+
*
|
511
|
+
* To create a new type of `ReactClass`, pass a specification of
|
512
|
+
* your new class to `React.createClass`. The only requirement of your class
|
513
|
+
* specification is that you implement a `render` method.
|
514
|
+
*
|
515
|
+
* var MyComponent = React.createClass({
|
516
|
+
* render: function() {
|
517
|
+
* return <div>Hello World</div>;
|
518
|
+
* }
|
519
|
+
* });
|
520
|
+
*
|
521
|
+
* The class specification supports a specific protocol of methods that have
|
522
|
+
* special meaning (e.g. `render`). See `ReactClassInterface` for
|
523
|
+
* more the comprehensive protocol. Any other properties and methods in the
|
524
|
+
* class specification will be available on the prototype.
|
525
|
+
*
|
526
|
+
* @interface ReactClassInterface
|
527
|
+
* @internal
|
528
|
+
*/
|
529
|
+
var ReactClassInterface = {
|
530
|
+
|
531
|
+
/**
|
532
|
+
* An array of Mixin objects to include when defining your component.
|
533
|
+
*
|
534
|
+
* @type {array}
|
535
|
+
* @optional
|
536
|
+
*/
|
537
|
+
mixins: 'DEFINE_MANY',
|
538
|
+
|
539
|
+
/**
|
540
|
+
* An object containing properties and methods that should be defined on
|
541
|
+
* the component's constructor instead of its prototype (static methods).
|
542
|
+
*
|
543
|
+
* @type {object}
|
544
|
+
* @optional
|
545
|
+
*/
|
546
|
+
statics: 'DEFINE_MANY',
|
547
|
+
|
548
|
+
/**
|
549
|
+
* Definition of prop types for this component.
|
550
|
+
*
|
551
|
+
* @type {object}
|
552
|
+
* @optional
|
553
|
+
*/
|
554
|
+
propTypes: 'DEFINE_MANY',
|
555
|
+
|
556
|
+
/**
|
557
|
+
* Definition of context types for this component.
|
558
|
+
*
|
559
|
+
* @type {object}
|
560
|
+
* @optional
|
561
|
+
*/
|
562
|
+
contextTypes: 'DEFINE_MANY',
|
563
|
+
|
564
|
+
/**
|
565
|
+
* Definition of context types this component sets for its children.
|
566
|
+
*
|
567
|
+
* @type {object}
|
568
|
+
* @optional
|
569
|
+
*/
|
570
|
+
childContextTypes: 'DEFINE_MANY',
|
571
|
+
|
572
|
+
// ==== Definition methods ====
|
573
|
+
|
574
|
+
/**
|
575
|
+
* Invoked when the component is mounted. Values in the mapping will be set on
|
576
|
+
* `this.props` if that prop is not specified (i.e. using an `in` check).
|
577
|
+
*
|
578
|
+
* This method is invoked before `getInitialState` and therefore cannot rely
|
579
|
+
* on `this.state` or use `this.setState`.
|
580
|
+
*
|
581
|
+
* @return {object}
|
582
|
+
* @optional
|
583
|
+
*/
|
584
|
+
getDefaultProps: 'DEFINE_MANY_MERGED',
|
585
|
+
|
586
|
+
/**
|
587
|
+
* Invoked once before the component is mounted. The return value will be used
|
588
|
+
* as the initial value of `this.state`.
|
589
|
+
*
|
590
|
+
* getInitialState: function() {
|
591
|
+
* return {
|
592
|
+
* isOn: false,
|
593
|
+
* fooBaz: new BazFoo()
|
594
|
+
* }
|
595
|
+
* }
|
596
|
+
*
|
597
|
+
* @return {object}
|
598
|
+
* @optional
|
599
|
+
*/
|
600
|
+
getInitialState: 'DEFINE_MANY_MERGED',
|
601
|
+
|
602
|
+
/**
|
603
|
+
* @return {object}
|
604
|
+
* @optional
|
605
|
+
*/
|
606
|
+
getChildContext: 'DEFINE_MANY_MERGED',
|
607
|
+
|
608
|
+
/**
|
609
|
+
* Uses props from `this.props` and state from `this.state` to render the
|
610
|
+
* structure of the component.
|
611
|
+
*
|
612
|
+
* No guarantees are made about when or how often this method is invoked, so
|
613
|
+
* it must not have side effects.
|
614
|
+
*
|
615
|
+
* render: function() {
|
616
|
+
* var name = this.props.name;
|
617
|
+
* return <div>Hello, {name}!</div>;
|
618
|
+
* }
|
619
|
+
*
|
620
|
+
* @return {ReactComponent}
|
621
|
+
* @nosideeffects
|
622
|
+
* @required
|
623
|
+
*/
|
624
|
+
render: 'DEFINE_ONCE',
|
625
|
+
|
626
|
+
// ==== Delegate methods ====
|
627
|
+
|
628
|
+
/**
|
629
|
+
* Invoked when the component is initially created and about to be mounted.
|
630
|
+
* This may have side effects, but any external subscriptions or data created
|
631
|
+
* by this method must be cleaned up in `componentWillUnmount`.
|
632
|
+
*
|
633
|
+
* @optional
|
634
|
+
*/
|
635
|
+
componentWillMount: 'DEFINE_MANY',
|
636
|
+
|
637
|
+
/**
|
638
|
+
* Invoked when the component has been mounted and has a DOM representation.
|
639
|
+
* However, there is no guarantee that the DOM node is in the document.
|
640
|
+
*
|
641
|
+
* Use this as an opportunity to operate on the DOM when the component has
|
642
|
+
* been mounted (initialized and rendered) for the first time.
|
643
|
+
*
|
644
|
+
* @param {DOMElement} rootNode DOM element representing the component.
|
645
|
+
* @optional
|
646
|
+
*/
|
647
|
+
componentDidMount: 'DEFINE_MANY',
|
648
|
+
|
649
|
+
/**
|
650
|
+
* Invoked before the component receives new props.
|
651
|
+
*
|
652
|
+
* Use this as an opportunity to react to a prop transition by updating the
|
653
|
+
* state using `this.setState`. Current props are accessed via `this.props`.
|
654
|
+
*
|
655
|
+
* componentWillReceiveProps: function(nextProps, nextContext) {
|
656
|
+
* this.setState({
|
657
|
+
* likesIncreasing: nextProps.likeCount > this.props.likeCount
|
658
|
+
* });
|
659
|
+
* }
|
660
|
+
*
|
661
|
+
* NOTE: There is no equivalent `componentWillReceiveState`. An incoming prop
|
662
|
+
* transition may cause a state change, but the opposite is not true. If you
|
663
|
+
* need it, you are probably looking for `componentWillUpdate`.
|
664
|
+
*
|
665
|
+
* @param {object} nextProps
|
666
|
+
* @optional
|
667
|
+
*/
|
668
|
+
componentWillReceiveProps: 'DEFINE_MANY',
|
669
|
+
|
670
|
+
/**
|
671
|
+
* Invoked while deciding if the component should be updated as a result of
|
672
|
+
* receiving new props, state and/or context.
|
673
|
+
*
|
674
|
+
* Use this as an opportunity to `return false` when you're certain that the
|
675
|
+
* transition to the new props/state/context will not require a component
|
676
|
+
* update.
|
677
|
+
*
|
678
|
+
* shouldComponentUpdate: function(nextProps, nextState, nextContext) {
|
679
|
+
* return !equal(nextProps, this.props) ||
|
680
|
+
* !equal(nextState, this.state) ||
|
681
|
+
* !equal(nextContext, this.context);
|
682
|
+
* }
|
683
|
+
*
|
684
|
+
* @param {object} nextProps
|
685
|
+
* @param {?object} nextState
|
686
|
+
* @param {?object} nextContext
|
687
|
+
* @return {boolean} True if the component should update.
|
688
|
+
* @optional
|
689
|
+
*/
|
690
|
+
shouldComponentUpdate: 'DEFINE_ONCE',
|
691
|
+
|
692
|
+
/**
|
693
|
+
* Invoked when the component is about to update due to a transition from
|
694
|
+
* `this.props`, `this.state` and `this.context` to `nextProps`, `nextState`
|
695
|
+
* and `nextContext`.
|
696
|
+
*
|
697
|
+
* Use this as an opportunity to perform preparation before an update occurs.
|
698
|
+
*
|
699
|
+
* NOTE: You **cannot** use `this.setState()` in this method.
|
700
|
+
*
|
701
|
+
* @param {object} nextProps
|
702
|
+
* @param {?object} nextState
|
703
|
+
* @param {?object} nextContext
|
704
|
+
* @param {ReactReconcileTransaction} transaction
|
705
|
+
* @optional
|
706
|
+
*/
|
707
|
+
componentWillUpdate: 'DEFINE_MANY',
|
708
|
+
|
709
|
+
/**
|
710
|
+
* Invoked when the component's DOM representation has been updated.
|
711
|
+
*
|
712
|
+
* Use this as an opportunity to operate on the DOM when the component has
|
713
|
+
* been updated.
|
714
|
+
*
|
715
|
+
* @param {object} prevProps
|
716
|
+
* @param {?object} prevState
|
717
|
+
* @param {?object} prevContext
|
718
|
+
* @param {DOMElement} rootNode DOM element representing the component.
|
719
|
+
* @optional
|
720
|
+
*/
|
721
|
+
componentDidUpdate: 'DEFINE_MANY',
|
722
|
+
|
723
|
+
/**
|
724
|
+
* Invoked when the component is about to be removed from its parent and have
|
725
|
+
* its DOM representation destroyed.
|
726
|
+
*
|
727
|
+
* Use this as an opportunity to deallocate any external resources.
|
728
|
+
*
|
729
|
+
* NOTE: There is no `componentDidUnmount` since your component will have been
|
730
|
+
* destroyed by that point.
|
731
|
+
*
|
732
|
+
* @optional
|
733
|
+
*/
|
734
|
+
componentWillUnmount: 'DEFINE_MANY',
|
735
|
+
|
736
|
+
// ==== Advanced methods ====
|
737
|
+
|
738
|
+
/**
|
739
|
+
* Updates the component's currently mounted DOM representation.
|
740
|
+
*
|
741
|
+
* By default, this implements React's rendering and reconciliation algorithm.
|
742
|
+
* Sophisticated clients may wish to override this.
|
743
|
+
*
|
744
|
+
* @param {ReactReconcileTransaction} transaction
|
745
|
+
* @internal
|
746
|
+
* @overridable
|
747
|
+
*/
|
748
|
+
updateComponent: 'OVERRIDE_BASE'
|
749
|
+
|
750
|
+
};
|
751
|
+
|
752
|
+
/**
|
753
|
+
* Mapping from class specification keys to special processing functions.
|
754
|
+
*
|
755
|
+
* Although these are declared like instance properties in the specification
|
756
|
+
* when defining classes using `React.createClass`, they are actually static
|
757
|
+
* and are accessible on the constructor instead of the prototype. Despite
|
758
|
+
* being static, they must be defined outside of the "statics" key under
|
759
|
+
* which all other static methods are defined.
|
760
|
+
*/
|
761
|
+
var RESERVED_SPEC_KEYS = {
|
762
|
+
displayName: function (Constructor, displayName) {
|
763
|
+
Constructor.displayName = displayName;
|
764
|
+
},
|
765
|
+
mixins: function (Constructor, mixins) {
|
766
|
+
if (mixins) {
|
767
|
+
for (var i = 0; i < mixins.length; i++) {
|
768
|
+
mixSpecIntoComponent(Constructor, mixins[i]);
|
769
|
+
}
|
770
|
+
}
|
771
|
+
},
|
772
|
+
childContextTypes: function (Constructor, childContextTypes) {
|
773
|
+
if ("development" !== 'production') {
|
774
|
+
validateTypeDef(Constructor, childContextTypes, 'childContext');
|
775
|
+
}
|
776
|
+
Constructor.childContextTypes = _assign({}, Constructor.childContextTypes, childContextTypes);
|
777
|
+
},
|
778
|
+
contextTypes: function (Constructor, contextTypes) {
|
779
|
+
if ("development" !== 'production') {
|
780
|
+
validateTypeDef(Constructor, contextTypes, 'context');
|
781
|
+
}
|
782
|
+
Constructor.contextTypes = _assign({}, Constructor.contextTypes, contextTypes);
|
783
|
+
},
|
784
|
+
/**
|
785
|
+
* Special case getDefaultProps which should move into statics but requires
|
786
|
+
* automatic merging.
|
787
|
+
*/
|
788
|
+
getDefaultProps: function (Constructor, getDefaultProps) {
|
789
|
+
if (Constructor.getDefaultProps) {
|
790
|
+
Constructor.getDefaultProps = createMergedResultFunction(Constructor.getDefaultProps, getDefaultProps);
|
791
|
+
} else {
|
792
|
+
Constructor.getDefaultProps = getDefaultProps;
|
793
|
+
}
|
794
|
+
},
|
795
|
+
propTypes: function (Constructor, propTypes) {
|
796
|
+
if ("development" !== 'production') {
|
797
|
+
validateTypeDef(Constructor, propTypes, 'prop');
|
798
|
+
}
|
799
|
+
Constructor.propTypes = _assign({}, Constructor.propTypes, propTypes);
|
800
|
+
},
|
801
|
+
statics: function (Constructor, statics) {
|
802
|
+
mixStaticSpecIntoComponent(Constructor, statics);
|
803
|
+
},
|
804
|
+
autobind: function () {} };
|
805
|
+
|
806
|
+
function validateTypeDef(Constructor, typeDef, location) {
|
807
|
+
for (var propName in typeDef) {
|
808
|
+
if (typeDef.hasOwnProperty(propName)) {
|
809
|
+
// use a warning instead of an invariant so components
|
810
|
+
// don't show up in prod but only in __DEV__
|
811
|
+
"development" !== 'production' ? warning(typeof typeDef[propName] === 'function', '%s: %s type `%s` is invalid; it must be a function, usually from ' + 'React.PropTypes.', Constructor.displayName || 'ReactClass', ReactPropTypeLocationNames[location], propName) : void 0;
|
812
|
+
}
|
813
|
+
}
|
814
|
+
}
|
815
|
+
|
816
|
+
function validateMethodOverride(isAlreadyDefined, name) {
|
817
|
+
var specPolicy = ReactClassInterface.hasOwnProperty(name) ? ReactClassInterface[name] : null;
|
818
|
+
|
819
|
+
// Disallow overriding of base class methods unless explicitly allowed.
|
820
|
+
if (ReactClassMixin.hasOwnProperty(name)) {
|
821
|
+
!(specPolicy === 'OVERRIDE_BASE') ? "development" !== 'production' ? invariant(false, 'ReactClassInterface: You are attempting to override `%s` from your class specification. Ensure that your method names do not overlap with React methods.', name) : _prodInvariant('73', name) : void 0;
|
822
|
+
}
|
823
|
+
|
824
|
+
// Disallow defining methods more than once unless explicitly allowed.
|
825
|
+
if (isAlreadyDefined) {
|
826
|
+
!(specPolicy === 'DEFINE_MANY' || specPolicy === 'DEFINE_MANY_MERGED') ? "development" !== 'production' ? invariant(false, 'ReactClassInterface: You are attempting to define `%s` on your component more than once. This conflict may be due to a mixin.', name) : _prodInvariant('74', name) : void 0;
|
827
|
+
}
|
828
|
+
}
|
829
|
+
|
830
|
+
/**
|
831
|
+
* Mixin helper which handles policy validation and reserved
|
832
|
+
* specification keys when building React classes.
|
833
|
+
*/
|
834
|
+
function mixSpecIntoComponent(Constructor, spec) {
|
835
|
+
if (!spec) {
|
836
|
+
if ("development" !== 'production') {
|
837
|
+
var typeofSpec = typeof spec;
|
838
|
+
var isMixinValid = typeofSpec === 'object' && spec !== null;
|
839
|
+
|
840
|
+
"development" !== 'production' ? warning(isMixinValid, '%s: You\'re attempting to include a mixin that is either null ' + 'or not an object. Check the mixins included by the component, ' + 'as well as any mixins they include themselves. ' + 'Expected object but got %s.', Constructor.displayName || 'ReactClass', spec === null ? null : typeofSpec) : void 0;
|
841
|
+
}
|
842
|
+
|
843
|
+
return;
|
844
|
+
}
|
845
|
+
|
846
|
+
!(typeof spec !== 'function') ? "development" !== 'production' ? invariant(false, 'ReactClass: You\'re attempting to use a component class or function as a mixin. Instead, just use a regular object.') : _prodInvariant('75') : void 0;
|
847
|
+
!!ReactElement.isValidElement(spec) ? "development" !== 'production' ? invariant(false, 'ReactClass: You\'re attempting to use a component as a mixin. Instead, just use a regular object.') : _prodInvariant('76') : void 0;
|
848
|
+
|
849
|
+
var proto = Constructor.prototype;
|
850
|
+
var autoBindPairs = proto.__reactAutoBindPairs;
|
851
|
+
|
852
|
+
// By handling mixins before any other properties, we ensure the same
|
853
|
+
// chaining order is applied to methods with DEFINE_MANY policy, whether
|
854
|
+
// mixins are listed before or after these methods in the spec.
|
855
|
+
if (spec.hasOwnProperty(MIXINS_KEY)) {
|
856
|
+
RESERVED_SPEC_KEYS.mixins(Constructor, spec.mixins);
|
857
|
+
}
|
858
|
+
|
859
|
+
for (var name in spec) {
|
860
|
+
if (!spec.hasOwnProperty(name)) {
|
861
|
+
continue;
|
862
|
+
}
|
863
|
+
|
864
|
+
if (name === MIXINS_KEY) {
|
865
|
+
// We have already handled mixins in a special case above.
|
866
|
+
continue;
|
867
|
+
}
|
868
|
+
|
869
|
+
var property = spec[name];
|
870
|
+
var isAlreadyDefined = proto.hasOwnProperty(name);
|
871
|
+
validateMethodOverride(isAlreadyDefined, name);
|
872
|
+
|
873
|
+
if (RESERVED_SPEC_KEYS.hasOwnProperty(name)) {
|
874
|
+
RESERVED_SPEC_KEYS[name](Constructor, property);
|
875
|
+
} else {
|
876
|
+
// Setup methods on prototype:
|
877
|
+
// The following member methods should not be automatically bound:
|
878
|
+
// 1. Expected ReactClass methods (in the "interface").
|
879
|
+
// 2. Overridden methods (that were mixed in).
|
880
|
+
var isReactClassMethod = ReactClassInterface.hasOwnProperty(name);
|
881
|
+
var isFunction = typeof property === 'function';
|
882
|
+
var shouldAutoBind = isFunction && !isReactClassMethod && !isAlreadyDefined && spec.autobind !== false;
|
883
|
+
|
884
|
+
if (shouldAutoBind) {
|
885
|
+
autoBindPairs.push(name, property);
|
886
|
+
proto[name] = property;
|
887
|
+
} else {
|
888
|
+
if (isAlreadyDefined) {
|
889
|
+
var specPolicy = ReactClassInterface[name];
|
890
|
+
|
891
|
+
// These cases should already be caught by validateMethodOverride.
|
892
|
+
!(isReactClassMethod && (specPolicy === 'DEFINE_MANY_MERGED' || specPolicy === 'DEFINE_MANY')) ? "development" !== 'production' ? invariant(false, 'ReactClass: Unexpected spec policy %s for key %s when mixing in component specs.', specPolicy, name) : _prodInvariant('77', specPolicy, name) : void 0;
|
893
|
+
|
894
|
+
// For methods which are defined more than once, call the existing
|
895
|
+
// methods before calling the new property, merging if appropriate.
|
896
|
+
if (specPolicy === 'DEFINE_MANY_MERGED') {
|
897
|
+
proto[name] = createMergedResultFunction(proto[name], property);
|
898
|
+
} else if (specPolicy === 'DEFINE_MANY') {
|
899
|
+
proto[name] = createChainedFunction(proto[name], property);
|
900
|
+
}
|
901
|
+
} else {
|
902
|
+
proto[name] = property;
|
903
|
+
if ("development" !== 'production') {
|
904
|
+
// Add verbose displayName to the function, which helps when looking
|
905
|
+
// at profiling tools.
|
906
|
+
if (typeof property === 'function' && spec.displayName) {
|
907
|
+
proto[name].displayName = spec.displayName + '_' + name;
|
908
|
+
}
|
909
|
+
}
|
910
|
+
}
|
911
|
+
}
|
912
|
+
}
|
913
|
+
}
|
914
|
+
}
|
915
|
+
|
916
|
+
function mixStaticSpecIntoComponent(Constructor, statics) {
|
917
|
+
if (!statics) {
|
918
|
+
return;
|
919
|
+
}
|
920
|
+
for (var name in statics) {
|
921
|
+
var property = statics[name];
|
922
|
+
if (!statics.hasOwnProperty(name)) {
|
923
|
+
continue;
|
924
|
+
}
|
925
|
+
|
926
|
+
var isReserved = name in RESERVED_SPEC_KEYS;
|
927
|
+
!!isReserved ? "development" !== 'production' ? invariant(false, 'ReactClass: You are attempting to define a reserved property, `%s`, that shouldn\'t be on the "statics" key. Define it as an instance property instead; it will still be accessible on the constructor.', name) : _prodInvariant('78', name) : void 0;
|
928
|
+
|
929
|
+
var isInherited = name in Constructor;
|
930
|
+
!!isInherited ? "development" !== 'production' ? invariant(false, 'ReactClass: You are attempting to define `%s` on your component more than once. This conflict may be due to a mixin.', name) : _prodInvariant('79', name) : void 0;
|
931
|
+
Constructor[name] = property;
|
932
|
+
}
|
933
|
+
}
|
934
|
+
|
935
|
+
/**
|
936
|
+
* Merge two objects, but throw if both contain the same key.
|
937
|
+
*
|
938
|
+
* @param {object} one The first object, which is mutated.
|
939
|
+
* @param {object} two The second object
|
940
|
+
* @return {object} one after it has been mutated to contain everything in two.
|
941
|
+
*/
|
942
|
+
function mergeIntoWithNoDuplicateKeys(one, two) {
|
943
|
+
!(one && two && typeof one === 'object' && typeof two === 'object') ? "development" !== 'production' ? invariant(false, 'mergeIntoWithNoDuplicateKeys(): Cannot merge non-objects.') : _prodInvariant('80') : void 0;
|
944
|
+
|
945
|
+
for (var key in two) {
|
946
|
+
if (two.hasOwnProperty(key)) {
|
947
|
+
!(one[key] === undefined) ? "development" !== 'production' ? invariant(false, 'mergeIntoWithNoDuplicateKeys(): Tried to merge two objects with the same key: `%s`. This conflict may be due to a mixin; in particular, this may be caused by two getInitialState() or getDefaultProps() methods returning objects with clashing keys.', key) : _prodInvariant('81', key) : void 0;
|
948
|
+
one[key] = two[key];
|
949
|
+
}
|
950
|
+
}
|
951
|
+
return one;
|
952
|
+
}
|
953
|
+
|
954
|
+
/**
|
955
|
+
* Creates a function that invokes two functions and merges their return values.
|
956
|
+
*
|
957
|
+
* @param {function} one Function to invoke first.
|
958
|
+
* @param {function} two Function to invoke second.
|
959
|
+
* @return {function} Function that invokes the two argument functions.
|
960
|
+
* @private
|
961
|
+
*/
|
962
|
+
function createMergedResultFunction(one, two) {
|
963
|
+
return function mergedResult() {
|
964
|
+
var a = one.apply(this, arguments);
|
965
|
+
var b = two.apply(this, arguments);
|
966
|
+
if (a == null) {
|
967
|
+
return b;
|
968
|
+
} else if (b == null) {
|
969
|
+
return a;
|
970
|
+
}
|
971
|
+
var c = {};
|
972
|
+
mergeIntoWithNoDuplicateKeys(c, a);
|
973
|
+
mergeIntoWithNoDuplicateKeys(c, b);
|
974
|
+
return c;
|
975
|
+
};
|
976
|
+
}
|
977
|
+
|
978
|
+
/**
|
979
|
+
* Creates a function that invokes two functions and ignores their return vales.
|
980
|
+
*
|
981
|
+
* @param {function} one Function to invoke first.
|
982
|
+
* @param {function} two Function to invoke second.
|
983
|
+
* @return {function} Function that invokes the two argument functions.
|
984
|
+
* @private
|
985
|
+
*/
|
986
|
+
function createChainedFunction(one, two) {
|
987
|
+
return function chainedFunction() {
|
988
|
+
one.apply(this, arguments);
|
989
|
+
two.apply(this, arguments);
|
990
|
+
};
|
991
|
+
}
|
992
|
+
|
993
|
+
/**
|
994
|
+
* Binds a method to the component.
|
995
|
+
*
|
996
|
+
* @param {object} component Component whose method is going to be bound.
|
997
|
+
* @param {function} method Method to be bound.
|
998
|
+
* @return {function} The bound method.
|
999
|
+
*/
|
1000
|
+
function bindAutoBindMethod(component, method) {
|
1001
|
+
var boundMethod = method.bind(component);
|
1002
|
+
if ("development" !== 'production') {
|
1003
|
+
boundMethod.__reactBoundContext = component;
|
1004
|
+
boundMethod.__reactBoundMethod = method;
|
1005
|
+
boundMethod.__reactBoundArguments = null;
|
1006
|
+
var componentName = component.constructor.displayName;
|
1007
|
+
var _bind = boundMethod.bind;
|
1008
|
+
boundMethod.bind = function (newThis) {
|
1009
|
+
for (var _len = arguments.length, args = Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {
|
1010
|
+
args[_key - 1] = arguments[_key];
|
1011
|
+
}
|
1012
|
+
|
1013
|
+
// User is trying to bind() an autobound method; we effectively will
|
1014
|
+
// ignore the value of "this" that the user is trying to use, so
|
1015
|
+
// let's warn.
|
1016
|
+
if (newThis !== component && newThis !== null) {
|
1017
|
+
"development" !== 'production' ? warning(false, 'bind(): React component methods may only be bound to the ' + 'component instance. See %s', componentName) : void 0;
|
1018
|
+
} else if (!args.length) {
|
1019
|
+
"development" !== 'production' ? warning(false, 'bind(): You are binding a component method to the component. ' + 'React does this for you automatically in a high-performance ' + 'way, so you can safely remove this call. See %s', componentName) : void 0;
|
1020
|
+
return boundMethod;
|
1021
|
+
}
|
1022
|
+
var reboundMethod = _bind.apply(boundMethod, arguments);
|
1023
|
+
reboundMethod.__reactBoundContext = component;
|
1024
|
+
reboundMethod.__reactBoundMethod = method;
|
1025
|
+
reboundMethod.__reactBoundArguments = args;
|
1026
|
+
return reboundMethod;
|
1027
|
+
};
|
1028
|
+
}
|
1029
|
+
return boundMethod;
|
1030
|
+
}
|
1031
|
+
|
1032
|
+
/**
|
1033
|
+
* Binds all auto-bound methods in a component.
|
1034
|
+
*
|
1035
|
+
* @param {object} component Component whose method is going to be bound.
|
1036
|
+
*/
|
1037
|
+
function bindAutoBindMethods(component) {
|
1038
|
+
var pairs = component.__reactAutoBindPairs;
|
1039
|
+
for (var i = 0; i < pairs.length; i += 2) {
|
1040
|
+
var autoBindKey = pairs[i];
|
1041
|
+
var method = pairs[i + 1];
|
1042
|
+
component[autoBindKey] = bindAutoBindMethod(component, method);
|
1043
|
+
}
|
1044
|
+
}
|
1045
|
+
|
1046
|
+
/**
|
1047
|
+
* Add more to the ReactClass base class. These are all legacy features and
|
1048
|
+
* therefore not already part of the modern ReactComponent.
|
1049
|
+
*/
|
1050
|
+
var ReactClassMixin = {
|
1051
|
+
|
1052
|
+
/**
|
1053
|
+
* TODO: This will be deprecated because state should always keep a consistent
|
1054
|
+
* type signature and the only use case for this, is to avoid that.
|
1055
|
+
*/
|
1056
|
+
replaceState: function (newState, callback) {
|
1057
|
+
this.updater.enqueueReplaceState(this, newState);
|
1058
|
+
if (callback) {
|
1059
|
+
this.updater.enqueueCallback(this, callback, 'replaceState');
|
1060
|
+
}
|
1061
|
+
},
|
1062
|
+
|
1063
|
+
/**
|
1064
|
+
* Checks whether or not this composite component is mounted.
|
1065
|
+
* @return {boolean} True if mounted, false otherwise.
|
1066
|
+
* @protected
|
1067
|
+
* @final
|
1068
|
+
*/
|
1069
|
+
isMounted: function () {
|
1070
|
+
return this.updater.isMounted(this);
|
1071
|
+
}
|
1072
|
+
};
|
1073
|
+
|
1074
|
+
var ReactClassComponent = function () {};
|
1075
|
+
_assign(ReactClassComponent.prototype, ReactComponent.prototype, ReactClassMixin);
|
1076
|
+
|
1077
|
+
/**
|
1078
|
+
* Module for creating composite components.
|
1079
|
+
*
|
1080
|
+
* @class ReactClass
|
1081
|
+
*/
|
1082
|
+
var ReactClass = {
|
1083
|
+
|
1084
|
+
/**
|
1085
|
+
* Creates a composite component class given a class specification.
|
1086
|
+
* See https://facebook.github.io/react/docs/top-level-api.html#react.createclass
|
1087
|
+
*
|
1088
|
+
* @param {object} spec Class specification (which must define `render`).
|
1089
|
+
* @return {function} Component constructor function.
|
1090
|
+
* @public
|
1091
|
+
*/
|
1092
|
+
createClass: function (spec) {
|
1093
|
+
// To keep our warnings more understandable, we'll use a little hack here to
|
1094
|
+
// ensure that Constructor.name !== 'Constructor'. This makes sure we don't
|
1095
|
+
// unnecessarily identify a class without displayName as 'Constructor'.
|
1096
|
+
var Constructor = identity(function (props, context, updater) {
|
1097
|
+
// This constructor gets overridden by mocks. The argument is used
|
1098
|
+
// by mocks to assert on what gets mounted.
|
1099
|
+
|
1100
|
+
if ("development" !== 'production') {
|
1101
|
+
"development" !== 'production' ? warning(this instanceof Constructor, 'Something is calling a React component directly. Use a factory or ' + 'JSX instead. See: https://fb.me/react-legacyfactory') : void 0;
|
1102
|
+
}
|
1103
|
+
|
1104
|
+
// Wire up auto-binding
|
1105
|
+
if (this.__reactAutoBindPairs.length) {
|
1106
|
+
bindAutoBindMethods(this);
|
1107
|
+
}
|
1108
|
+
|
1109
|
+
this.props = props;
|
1110
|
+
this.context = context;
|
1111
|
+
this.refs = emptyObject;
|
1112
|
+
this.updater = updater || ReactNoopUpdateQueue;
|
1113
|
+
|
1114
|
+
this.state = null;
|
1115
|
+
|
1116
|
+
// ReactClasses doesn't have constructors. Instead, they use the
|
1117
|
+
// getInitialState and componentWillMount methods for initialization.
|
1118
|
+
|
1119
|
+
var initialState = this.getInitialState ? this.getInitialState() : null;
|
1120
|
+
if ("development" !== 'production') {
|
1121
|
+
// We allow auto-mocks to proceed as if they're returning null.
|
1122
|
+
if (initialState === undefined && this.getInitialState._isMockFunction) {
|
1123
|
+
// This is probably bad practice. Consider warning here and
|
1124
|
+
// deprecating this convenience.
|
1125
|
+
initialState = null;
|
1126
|
+
}
|
1127
|
+
}
|
1128
|
+
!(typeof initialState === 'object' && !Array.isArray(initialState)) ? "development" !== 'production' ? invariant(false, '%s.getInitialState(): must return an object or null', Constructor.displayName || 'ReactCompositeComponent') : _prodInvariant('82', Constructor.displayName || 'ReactCompositeComponent') : void 0;
|
1129
|
+
|
1130
|
+
this.state = initialState;
|
1131
|
+
});
|
1132
|
+
Constructor.prototype = new ReactClassComponent();
|
1133
|
+
Constructor.prototype.constructor = Constructor;
|
1134
|
+
Constructor.prototype.__reactAutoBindPairs = [];
|
1135
|
+
|
1136
|
+
injectedMixins.forEach(mixSpecIntoComponent.bind(null, Constructor));
|
1137
|
+
|
1138
|
+
mixSpecIntoComponent(Constructor, spec);
|
1139
|
+
|
1140
|
+
// Initialize the defaultProps property after all mixins have been merged.
|
1141
|
+
if (Constructor.getDefaultProps) {
|
1142
|
+
Constructor.defaultProps = Constructor.getDefaultProps();
|
1143
|
+
}
|
1144
|
+
|
1145
|
+
if ("development" !== 'production') {
|
1146
|
+
// This is a tag to indicate that the use of these method names is ok,
|
1147
|
+
// since it's used with createClass. If it's not, then it's likely a
|
1148
|
+
// mistake so we'll warn you to use the static property, property
|
1149
|
+
// initializer or constructor respectively.
|
1150
|
+
if (Constructor.getDefaultProps) {
|
1151
|
+
Constructor.getDefaultProps.isReactClassApproved = {};
|
1152
|
+
}
|
1153
|
+
if (Constructor.prototype.getInitialState) {
|
1154
|
+
Constructor.prototype.getInitialState.isReactClassApproved = {};
|
1155
|
+
}
|
1156
|
+
}
|
1157
|
+
|
1158
|
+
!Constructor.prototype.render ? "development" !== 'production' ? invariant(false, 'createClass(...): Class specification must implement a `render` method.') : _prodInvariant('83') : void 0;
|
1159
|
+
|
1160
|
+
if ("development" !== 'production') {
|
1161
|
+
"development" !== 'production' ? warning(!Constructor.prototype.componentShouldUpdate, '%s has a method called ' + 'componentShouldUpdate(). Did you mean shouldComponentUpdate()? ' + 'The name is phrased as a question because the function is ' + 'expected to return a value.', spec.displayName || 'A component') : void 0;
|
1162
|
+
"development" !== 'production' ? warning(!Constructor.prototype.componentWillRecieveProps, '%s has a method called ' + 'componentWillRecieveProps(). Did you mean componentWillReceiveProps()?', spec.displayName || 'A component') : void 0;
|
1163
|
+
}
|
1164
|
+
|
1165
|
+
// Reduce time spent doing lookups by setting these on the prototype.
|
1166
|
+
for (var methodName in ReactClassInterface) {
|
1167
|
+
if (!Constructor.prototype[methodName]) {
|
1168
|
+
Constructor.prototype[methodName] = null;
|
1169
|
+
}
|
1170
|
+
}
|
1171
|
+
|
1172
|
+
return Constructor;
|
1173
|
+
},
|
1174
|
+
|
1175
|
+
injection: {
|
1176
|
+
injectMixin: function (mixin) {
|
1177
|
+
injectedMixins.push(mixin);
|
1178
|
+
}
|
1179
|
+
}
|
1180
|
+
|
1181
|
+
};
|
1182
|
+
|
1183
|
+
module.exports = ReactClass;
|
1184
|
+
},{"10":10,"13":13,"14":14,"24":24,"27":27,"28":28,"29":29,"30":30,"6":6}],6:[function(_dereq_,module,exports){
|
1185
|
+
/**
|
1186
|
+
* Copyright 2013-present, Facebook, Inc.
|
1187
|
+
* All rights reserved.
|
1188
|
+
*
|
1189
|
+
* This source code is licensed under the BSD-style license found in the
|
1190
|
+
* LICENSE file in the root directory of this source tree. An additional grant
|
1191
|
+
* of patent rights can be found in the PATENTS file in the same directory.
|
1192
|
+
*
|
1193
|
+
*/
|
1194
|
+
|
1195
|
+
'use strict';
|
1196
|
+
|
1197
|
+
var _prodInvariant = _dereq_(24);
|
1198
|
+
|
1199
|
+
var ReactNoopUpdateQueue = _dereq_(13);
|
1200
|
+
|
1201
|
+
var canDefineProperty = _dereq_(20);
|
1202
|
+
var emptyObject = _dereq_(27);
|
1203
|
+
var invariant = _dereq_(28);
|
1204
|
+
var warning = _dereq_(29);
|
1205
|
+
|
1206
|
+
/**
|
1207
|
+
* Base class helpers for the updating state of a component.
|
1208
|
+
*/
|
1209
|
+
function ReactComponent(props, context, updater) {
|
1210
|
+
this.props = props;
|
1211
|
+
this.context = context;
|
1212
|
+
this.refs = emptyObject;
|
1213
|
+
// We initialize the default updater but the real one gets injected by the
|
1214
|
+
// renderer.
|
1215
|
+
this.updater = updater || ReactNoopUpdateQueue;
|
1216
|
+
}
|
1217
|
+
|
1218
|
+
ReactComponent.prototype.isReactComponent = {};
|
1219
|
+
|
1220
|
+
/**
|
1221
|
+
* Sets a subset of the state. Always use this to mutate
|
1222
|
+
* state. You should treat `this.state` as immutable.
|
1223
|
+
*
|
1224
|
+
* There is no guarantee that `this.state` will be immediately updated, so
|
1225
|
+
* accessing `this.state` after calling this method may return the old value.
|
1226
|
+
*
|
1227
|
+
* There is no guarantee that calls to `setState` will run synchronously,
|
1228
|
+
* as they may eventually be batched together. You can provide an optional
|
1229
|
+
* callback that will be executed when the call to setState is actually
|
1230
|
+
* completed.
|
1231
|
+
*
|
1232
|
+
* When a function is provided to setState, it will be called at some point in
|
1233
|
+
* the future (not synchronously). It will be called with the up to date
|
1234
|
+
* component arguments (state, props, context). These values can be different
|
1235
|
+
* from this.* because your function may be called after receiveProps but before
|
1236
|
+
* shouldComponentUpdate, and this new state, props, and context will not yet be
|
1237
|
+
* assigned to this.
|
1238
|
+
*
|
1239
|
+
* @param {object|function} partialState Next partial state or function to
|
1240
|
+
* produce next partial state to be merged with current state.
|
1241
|
+
* @param {?function} callback Called after state is updated.
|
1242
|
+
* @final
|
1243
|
+
* @protected
|
1244
|
+
*/
|
1245
|
+
ReactComponent.prototype.setState = function (partialState, callback) {
|
1246
|
+
!(typeof partialState === 'object' || typeof partialState === 'function' || partialState == null) ? "development" !== 'production' ? invariant(false, 'setState(...): takes an object of state variables to update or a function which returns an object of state variables.') : _prodInvariant('85') : void 0;
|
1247
|
+
this.updater.enqueueSetState(this, partialState);
|
1248
|
+
if (callback) {
|
1249
|
+
this.updater.enqueueCallback(this, callback, 'setState');
|
1250
|
+
}
|
1251
|
+
};
|
1252
|
+
|
1253
|
+
/**
|
1254
|
+
* Forces an update. This should only be invoked when it is known with
|
1255
|
+
* certainty that we are **not** in a DOM transaction.
|
1256
|
+
*
|
1257
|
+
* You may want to call this when you know that some deeper aspect of the
|
1258
|
+
* component's state has changed but `setState` was not called.
|
1259
|
+
*
|
1260
|
+
* This will not invoke `shouldComponentUpdate`, but it will invoke
|
1261
|
+
* `componentWillUpdate` and `componentDidUpdate`.
|
1262
|
+
*
|
1263
|
+
* @param {?function} callback Called after update is complete.
|
1264
|
+
* @final
|
1265
|
+
* @protected
|
1266
|
+
*/
|
1267
|
+
ReactComponent.prototype.forceUpdate = function (callback) {
|
1268
|
+
this.updater.enqueueForceUpdate(this);
|
1269
|
+
if (callback) {
|
1270
|
+
this.updater.enqueueCallback(this, callback, 'forceUpdate');
|
1271
|
+
}
|
1272
|
+
};
|
1273
|
+
|
1274
|
+
/**
|
1275
|
+
* Deprecated APIs. These APIs used to exist on classic React classes but since
|
1276
|
+
* we would like to deprecate them, we're not going to move them over to this
|
1277
|
+
* modern base class. Instead, we define a getter that warns if it's accessed.
|
1278
|
+
*/
|
1279
|
+
if ("development" !== 'production') {
|
1280
|
+
var deprecatedAPIs = {
|
1281
|
+
isMounted: ['isMounted', 'Instead, make sure to clean up subscriptions and pending requests in ' + 'componentWillUnmount to prevent memory leaks.'],
|
1282
|
+
replaceState: ['replaceState', 'Refactor your code to use setState instead (see ' + 'https://github.com/facebook/react/issues/3236).']
|
1283
|
+
};
|
1284
|
+
var defineDeprecationWarning = function (methodName, info) {
|
1285
|
+
if (canDefineProperty) {
|
1286
|
+
Object.defineProperty(ReactComponent.prototype, methodName, {
|
1287
|
+
get: function () {
|
1288
|
+
"development" !== 'production' ? warning(false, '%s(...) is deprecated in plain JavaScript React classes. %s', info[0], info[1]) : void 0;
|
1289
|
+
return undefined;
|
1290
|
+
}
|
1291
|
+
});
|
1292
|
+
}
|
1293
|
+
};
|
1294
|
+
for (var fnName in deprecatedAPIs) {
|
1295
|
+
if (deprecatedAPIs.hasOwnProperty(fnName)) {
|
1296
|
+
defineDeprecationWarning(fnName, deprecatedAPIs[fnName]);
|
1297
|
+
}
|
1298
|
+
}
|
1299
|
+
}
|
1300
|
+
|
1301
|
+
module.exports = ReactComponent;
|
1302
|
+
},{"13":13,"20":20,"24":24,"27":27,"28":28,"29":29}],7:[function(_dereq_,module,exports){
|
1303
|
+
/**
|
1304
|
+
* Copyright 2016-present, Facebook, Inc.
|
1305
|
+
* All rights reserved.
|
1306
|
+
*
|
1307
|
+
* This source code is licensed under the BSD-style license found in the
|
1308
|
+
* LICENSE file in the root directory of this source tree. An additional grant
|
1309
|
+
* of patent rights can be found in the PATENTS file in the same directory.
|
1310
|
+
*
|
1311
|
+
*
|
1312
|
+
*/
|
1313
|
+
|
1314
|
+
'use strict';
|
1315
|
+
|
1316
|
+
var _prodInvariant = _dereq_(24);
|
1317
|
+
|
1318
|
+
var ReactCurrentOwner = _dereq_(8);
|
1319
|
+
|
1320
|
+
var invariant = _dereq_(28);
|
1321
|
+
var warning = _dereq_(29);
|
1322
|
+
|
1323
|
+
function isNative(fn) {
|
1324
|
+
// Based on isNative() from Lodash
|
1325
|
+
var funcToString = Function.prototype.toString;
|
1326
|
+
var hasOwnProperty = Object.prototype.hasOwnProperty;
|
1327
|
+
var reIsNative = RegExp('^' + funcToString
|
1328
|
+
// Take an example native function source for comparison
|
1329
|
+
.call(hasOwnProperty)
|
1330
|
+
// Strip regex characters so we can use it for regex
|
1331
|
+
.replace(/[\\^$.*+?()[\]{}|]/g, '\\$&')
|
1332
|
+
// Remove hasOwnProperty from the template to make it generic
|
1333
|
+
.replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g, '$1.*?') + '$');
|
1334
|
+
try {
|
1335
|
+
var source = funcToString.call(fn);
|
1336
|
+
return reIsNative.test(source);
|
1337
|
+
} catch (err) {
|
1338
|
+
return false;
|
1339
|
+
}
|
1340
|
+
}
|
1341
|
+
|
1342
|
+
var canUseCollections =
|
1343
|
+
// Array.from
|
1344
|
+
typeof Array.from === 'function' &&
|
1345
|
+
// Map
|
1346
|
+
typeof Map === 'function' && isNative(Map) &&
|
1347
|
+
// Map.prototype.keys
|
1348
|
+
Map.prototype != null && typeof Map.prototype.keys === 'function' && isNative(Map.prototype.keys) &&
|
1349
|
+
// Set
|
1350
|
+
typeof Set === 'function' && isNative(Set) &&
|
1351
|
+
// Set.prototype.keys
|
1352
|
+
Set.prototype != null && typeof Set.prototype.keys === 'function' && isNative(Set.prototype.keys);
|
1353
|
+
|
1354
|
+
var setItem;
|
1355
|
+
var getItem;
|
1356
|
+
var removeItem;
|
1357
|
+
var getItemIDs;
|
1358
|
+
var addRoot;
|
1359
|
+
var removeRoot;
|
1360
|
+
var getRootIDs;
|
1361
|
+
|
1362
|
+
if (canUseCollections) {
|
1363
|
+
var itemMap = new Map();
|
1364
|
+
var rootIDSet = new Set();
|
1365
|
+
|
1366
|
+
setItem = function (id, item) {
|
1367
|
+
itemMap.set(id, item);
|
1368
|
+
};
|
1369
|
+
getItem = function (id) {
|
1370
|
+
return itemMap.get(id);
|
1371
|
+
};
|
1372
|
+
removeItem = function (id) {
|
1373
|
+
itemMap['delete'](id);
|
1374
|
+
};
|
1375
|
+
getItemIDs = function () {
|
1376
|
+
return Array.from(itemMap.keys());
|
1377
|
+
};
|
1378
|
+
|
1379
|
+
addRoot = function (id) {
|
1380
|
+
rootIDSet.add(id);
|
1381
|
+
};
|
1382
|
+
removeRoot = function (id) {
|
1383
|
+
rootIDSet['delete'](id);
|
1384
|
+
};
|
1385
|
+
getRootIDs = function () {
|
1386
|
+
return Array.from(rootIDSet.keys());
|
1387
|
+
};
|
1388
|
+
} else {
|
1389
|
+
var itemByKey = {};
|
1390
|
+
var rootByKey = {};
|
1391
|
+
|
1392
|
+
// Use non-numeric keys to prevent V8 performance issues:
|
1393
|
+
// https://github.com/facebook/react/pull/7232
|
1394
|
+
var getKeyFromID = function (id) {
|
1395
|
+
return '.' + id;
|
1396
|
+
};
|
1397
|
+
var getIDFromKey = function (key) {
|
1398
|
+
return parseInt(key.substr(1), 10);
|
1399
|
+
};
|
1400
|
+
|
1401
|
+
setItem = function (id, item) {
|
1402
|
+
var key = getKeyFromID(id);
|
1403
|
+
itemByKey[key] = item;
|
1404
|
+
};
|
1405
|
+
getItem = function (id) {
|
1406
|
+
var key = getKeyFromID(id);
|
1407
|
+
return itemByKey[key];
|
1408
|
+
};
|
1409
|
+
removeItem = function (id) {
|
1410
|
+
var key = getKeyFromID(id);
|
1411
|
+
delete itemByKey[key];
|
1412
|
+
};
|
1413
|
+
getItemIDs = function () {
|
1414
|
+
return Object.keys(itemByKey).map(getIDFromKey);
|
1415
|
+
};
|
1416
|
+
|
1417
|
+
addRoot = function (id) {
|
1418
|
+
var key = getKeyFromID(id);
|
1419
|
+
rootByKey[key] = true;
|
1420
|
+
};
|
1421
|
+
removeRoot = function (id) {
|
1422
|
+
var key = getKeyFromID(id);
|
1423
|
+
delete rootByKey[key];
|
1424
|
+
};
|
1425
|
+
getRootIDs = function () {
|
1426
|
+
return Object.keys(rootByKey).map(getIDFromKey);
|
1427
|
+
};
|
1428
|
+
}
|
1429
|
+
|
1430
|
+
var unmountedIDs = [];
|
1431
|
+
|
1432
|
+
function purgeDeep(id) {
|
1433
|
+
var item = getItem(id);
|
1434
|
+
if (item) {
|
1435
|
+
var childIDs = item.childIDs;
|
1436
|
+
|
1437
|
+
removeItem(id);
|
1438
|
+
childIDs.forEach(purgeDeep);
|
1439
|
+
}
|
1440
|
+
}
|
1441
|
+
|
1442
|
+
function describeComponentFrame(name, source, ownerName) {
|
1443
|
+
return '\n in ' + (name || 'Unknown') + (source ? ' (at ' + source.fileName.replace(/^.*[\\\/]/, '') + ':' + source.lineNumber + ')' : ownerName ? ' (created by ' + ownerName + ')' : '');
|
1444
|
+
}
|
1445
|
+
|
1446
|
+
function getDisplayName(element) {
|
1447
|
+
if (element == null) {
|
1448
|
+
return '#empty';
|
1449
|
+
} else if (typeof element === 'string' || typeof element === 'number') {
|
1450
|
+
return '#text';
|
1451
|
+
} else if (typeof element.type === 'string') {
|
1452
|
+
return element.type;
|
1453
|
+
} else {
|
1454
|
+
return element.type.displayName || element.type.name || 'Unknown';
|
1455
|
+
}
|
1456
|
+
}
|
1457
|
+
|
1458
|
+
function describeID(id) {
|
1459
|
+
var name = ReactComponentTreeHook.getDisplayName(id);
|
1460
|
+
var element = ReactComponentTreeHook.getElement(id);
|
1461
|
+
var ownerID = ReactComponentTreeHook.getOwnerID(id);
|
1462
|
+
var ownerName;
|
1463
|
+
if (ownerID) {
|
1464
|
+
ownerName = ReactComponentTreeHook.getDisplayName(ownerID);
|
1465
|
+
}
|
1466
|
+
"development" !== 'production' ? warning(element, 'ReactComponentTreeHook: Missing React element for debugID %s when ' + 'building stack', id) : void 0;
|
1467
|
+
return describeComponentFrame(name, element && element._source, ownerName);
|
1468
|
+
}
|
1469
|
+
|
1470
|
+
var ReactComponentTreeHook = {
|
1471
|
+
onSetChildren: function (id, nextChildIDs) {
|
1472
|
+
var item = getItem(id);
|
1473
|
+
!item ? "development" !== 'production' ? invariant(false, 'Item must have been set') : _prodInvariant('144') : void 0;
|
1474
|
+
item.childIDs = nextChildIDs;
|
1475
|
+
|
1476
|
+
for (var i = 0; i < nextChildIDs.length; i++) {
|
1477
|
+
var nextChildID = nextChildIDs[i];
|
1478
|
+
var nextChild = getItem(nextChildID);
|
1479
|
+
!nextChild ? "development" !== 'production' ? invariant(false, 'Expected hook events to fire for the child before its parent includes it in onSetChildren().') : _prodInvariant('140') : void 0;
|
1480
|
+
!(nextChild.childIDs != null || typeof nextChild.element !== 'object' || nextChild.element == null) ? "development" !== 'production' ? invariant(false, 'Expected onSetChildren() to fire for a container child before its parent includes it in onSetChildren().') : _prodInvariant('141') : void 0;
|
1481
|
+
!nextChild.isMounted ? "development" !== 'production' ? invariant(false, 'Expected onMountComponent() to fire for the child before its parent includes it in onSetChildren().') : _prodInvariant('71') : void 0;
|
1482
|
+
if (nextChild.parentID == null) {
|
1483
|
+
nextChild.parentID = id;
|
1484
|
+
// TODO: This shouldn't be necessary but mounting a new root during in
|
1485
|
+
// componentWillMount currently causes not-yet-mounted components to
|
1486
|
+
// be purged from our tree data so their parent id is missing.
|
1487
|
+
}
|
1488
|
+
!(nextChild.parentID === id) ? "development" !== 'production' ? invariant(false, 'Expected onBeforeMountComponent() parent and onSetChildren() to be consistent (%s has parents %s and %s).', nextChildID, nextChild.parentID, id) : _prodInvariant('142', nextChildID, nextChild.parentID, id) : void 0;
|
1489
|
+
}
|
1490
|
+
},
|
1491
|
+
onBeforeMountComponent: function (id, element, parentID) {
|
1492
|
+
var item = {
|
1493
|
+
element: element,
|
1494
|
+
parentID: parentID,
|
1495
|
+
text: null,
|
1496
|
+
childIDs: [],
|
1497
|
+
isMounted: false,
|
1498
|
+
updateCount: 0
|
1499
|
+
};
|
1500
|
+
setItem(id, item);
|
1501
|
+
},
|
1502
|
+
onBeforeUpdateComponent: function (id, element) {
|
1503
|
+
var item = getItem(id);
|
1504
|
+
if (!item || !item.isMounted) {
|
1505
|
+
// We may end up here as a result of setState() in componentWillUnmount().
|
1506
|
+
// In this case, ignore the element.
|
1507
|
+
return;
|
1508
|
+
}
|
1509
|
+
item.element = element;
|
1510
|
+
},
|
1511
|
+
onMountComponent: function (id) {
|
1512
|
+
var item = getItem(id);
|
1513
|
+
!item ? "development" !== 'production' ? invariant(false, 'Item must have been set') : _prodInvariant('144') : void 0;
|
1514
|
+
item.isMounted = true;
|
1515
|
+
var isRoot = item.parentID === 0;
|
1516
|
+
if (isRoot) {
|
1517
|
+
addRoot(id);
|
1518
|
+
}
|
1519
|
+
},
|
1520
|
+
onUpdateComponent: function (id) {
|
1521
|
+
var item = getItem(id);
|
1522
|
+
if (!item || !item.isMounted) {
|
1523
|
+
// We may end up here as a result of setState() in componentWillUnmount().
|
1524
|
+
// In this case, ignore the element.
|
1525
|
+
return;
|
1526
|
+
}
|
1527
|
+
item.updateCount++;
|
1528
|
+
},
|
1529
|
+
onUnmountComponent: function (id) {
|
1530
|
+
var item = getItem(id);
|
1531
|
+
if (item) {
|
1532
|
+
// We need to check if it exists.
|
1533
|
+
// `item` might not exist if it is inside an error boundary, and a sibling
|
1534
|
+
// error boundary child threw while mounting. Then this instance never
|
1535
|
+
// got a chance to mount, but it still gets an unmounting event during
|
1536
|
+
// the error boundary cleanup.
|
1537
|
+
item.isMounted = false;
|
1538
|
+
var isRoot = item.parentID === 0;
|
1539
|
+
if (isRoot) {
|
1540
|
+
removeRoot(id);
|
1541
|
+
}
|
1542
|
+
}
|
1543
|
+
unmountedIDs.push(id);
|
1544
|
+
},
|
1545
|
+
purgeUnmountedComponents: function () {
|
1546
|
+
if (ReactComponentTreeHook._preventPurging) {
|
1547
|
+
// Should only be used for testing.
|
1548
|
+
return;
|
1549
|
+
}
|
1550
|
+
|
1551
|
+
for (var i = 0; i < unmountedIDs.length; i++) {
|
1552
|
+
var id = unmountedIDs[i];
|
1553
|
+
purgeDeep(id);
|
1554
|
+
}
|
1555
|
+
unmountedIDs.length = 0;
|
1556
|
+
},
|
1557
|
+
isMounted: function (id) {
|
1558
|
+
var item = getItem(id);
|
1559
|
+
return item ? item.isMounted : false;
|
1560
|
+
},
|
1561
|
+
getCurrentStackAddendum: function (topElement) {
|
1562
|
+
var info = '';
|
1563
|
+
if (topElement) {
|
1564
|
+
var name = getDisplayName(topElement);
|
1565
|
+
var owner = topElement._owner;
|
1566
|
+
info += describeComponentFrame(name, topElement._source, owner && owner.getName());
|
1567
|
+
}
|
1568
|
+
|
1569
|
+
var currentOwner = ReactCurrentOwner.current;
|
1570
|
+
var id = currentOwner && currentOwner._debugID;
|
1571
|
+
|
1572
|
+
info += ReactComponentTreeHook.getStackAddendumByID(id);
|
1573
|
+
return info;
|
1574
|
+
},
|
1575
|
+
getStackAddendumByID: function (id) {
|
1576
|
+
var info = '';
|
1577
|
+
while (id) {
|
1578
|
+
info += describeID(id);
|
1579
|
+
id = ReactComponentTreeHook.getParentID(id);
|
1580
|
+
}
|
1581
|
+
return info;
|
1582
|
+
},
|
1583
|
+
getChildIDs: function (id) {
|
1584
|
+
var item = getItem(id);
|
1585
|
+
return item ? item.childIDs : [];
|
1586
|
+
},
|
1587
|
+
getDisplayName: function (id) {
|
1588
|
+
var element = ReactComponentTreeHook.getElement(id);
|
1589
|
+
if (!element) {
|
1590
|
+
return null;
|
1591
|
+
}
|
1592
|
+
return getDisplayName(element);
|
1593
|
+
},
|
1594
|
+
getElement: function (id) {
|
1595
|
+
var item = getItem(id);
|
1596
|
+
return item ? item.element : null;
|
1597
|
+
},
|
1598
|
+
getOwnerID: function (id) {
|
1599
|
+
var element = ReactComponentTreeHook.getElement(id);
|
1600
|
+
if (!element || !element._owner) {
|
1601
|
+
return null;
|
1602
|
+
}
|
1603
|
+
return element._owner._debugID;
|
1604
|
+
},
|
1605
|
+
getParentID: function (id) {
|
1606
|
+
var item = getItem(id);
|
1607
|
+
return item ? item.parentID : null;
|
1608
|
+
},
|
1609
|
+
getSource: function (id) {
|
1610
|
+
var item = getItem(id);
|
1611
|
+
var element = item ? item.element : null;
|
1612
|
+
var source = element != null ? element._source : null;
|
1613
|
+
return source;
|
1614
|
+
},
|
1615
|
+
getText: function (id) {
|
1616
|
+
var element = ReactComponentTreeHook.getElement(id);
|
1617
|
+
if (typeof element === 'string') {
|
1618
|
+
return element;
|
1619
|
+
} else if (typeof element === 'number') {
|
1620
|
+
return '' + element;
|
1621
|
+
} else {
|
1622
|
+
return null;
|
1623
|
+
}
|
1624
|
+
},
|
1625
|
+
getUpdateCount: function (id) {
|
1626
|
+
var item = getItem(id);
|
1627
|
+
return item ? item.updateCount : 0;
|
1628
|
+
},
|
1629
|
+
|
1630
|
+
|
1631
|
+
getRootIDs: getRootIDs,
|
1632
|
+
getRegisteredIDs: getItemIDs
|
1633
|
+
};
|
1634
|
+
|
1635
|
+
module.exports = ReactComponentTreeHook;
|
1636
|
+
},{"24":24,"28":28,"29":29,"8":8}],8:[function(_dereq_,module,exports){
|
1637
|
+
/**
|
1638
|
+
* Copyright 2013-present, Facebook, Inc.
|
1639
|
+
* All rights reserved.
|
1640
|
+
*
|
1641
|
+
* This source code is licensed under the BSD-style license found in the
|
1642
|
+
* LICENSE file in the root directory of this source tree. An additional grant
|
1643
|
+
* of patent rights can be found in the PATENTS file in the same directory.
|
1644
|
+
*
|
1645
|
+
*
|
1646
|
+
*/
|
1647
|
+
|
1648
|
+
'use strict';
|
1649
|
+
|
1650
|
+
/**
|
1651
|
+
* Keeps track of the current owner.
|
1652
|
+
*
|
1653
|
+
* The current owner is the component who should own any components that are
|
1654
|
+
* currently being constructed.
|
1655
|
+
*/
|
1656
|
+
var ReactCurrentOwner = {
|
1657
|
+
|
1658
|
+
/**
|
1659
|
+
* @internal
|
1660
|
+
* @type {ReactComponent}
|
1661
|
+
*/
|
1662
|
+
current: null
|
1663
|
+
|
1664
|
+
};
|
1665
|
+
|
1666
|
+
module.exports = ReactCurrentOwner;
|
1667
|
+
},{}],9:[function(_dereq_,module,exports){
|
1668
|
+
/**
|
1669
|
+
* Copyright 2013-present, Facebook, Inc.
|
1670
|
+
* All rights reserved.
|
1671
|
+
*
|
1672
|
+
* This source code is licensed under the BSD-style license found in the
|
1673
|
+
* LICENSE file in the root directory of this source tree. An additional grant
|
1674
|
+
* of patent rights can be found in the PATENTS file in the same directory.
|
1675
|
+
*
|
1676
|
+
*/
|
1677
|
+
|
1678
|
+
'use strict';
|
1679
|
+
|
1680
|
+
var ReactElement = _dereq_(10);
|
1681
|
+
|
1682
|
+
/**
|
1683
|
+
* Create a factory that creates HTML tag elements.
|
1684
|
+
*
|
1685
|
+
* @private
|
1686
|
+
*/
|
1687
|
+
var createDOMFactory = ReactElement.createFactory;
|
1688
|
+
if ("development" !== 'production') {
|
1689
|
+
var ReactElementValidator = _dereq_(12);
|
1690
|
+
createDOMFactory = ReactElementValidator.createFactory;
|
1691
|
+
}
|
1692
|
+
|
1693
|
+
/**
|
1694
|
+
* Creates a mapping from supported HTML tags to `ReactDOMComponent` classes.
|
1695
|
+
* This is also accessible via `React.DOM`.
|
1696
|
+
*
|
1697
|
+
* @public
|
1698
|
+
*/
|
1699
|
+
var ReactDOMFactories = {
|
1700
|
+
a: createDOMFactory('a'),
|
1701
|
+
abbr: createDOMFactory('abbr'),
|
1702
|
+
address: createDOMFactory('address'),
|
1703
|
+
area: createDOMFactory('area'),
|
1704
|
+
article: createDOMFactory('article'),
|
1705
|
+
aside: createDOMFactory('aside'),
|
1706
|
+
audio: createDOMFactory('audio'),
|
1707
|
+
b: createDOMFactory('b'),
|
1708
|
+
base: createDOMFactory('base'),
|
1709
|
+
bdi: createDOMFactory('bdi'),
|
1710
|
+
bdo: createDOMFactory('bdo'),
|
1711
|
+
big: createDOMFactory('big'),
|
1712
|
+
blockquote: createDOMFactory('blockquote'),
|
1713
|
+
body: createDOMFactory('body'),
|
1714
|
+
br: createDOMFactory('br'),
|
1715
|
+
button: createDOMFactory('button'),
|
1716
|
+
canvas: createDOMFactory('canvas'),
|
1717
|
+
caption: createDOMFactory('caption'),
|
1718
|
+
cite: createDOMFactory('cite'),
|
1719
|
+
code: createDOMFactory('code'),
|
1720
|
+
col: createDOMFactory('col'),
|
1721
|
+
colgroup: createDOMFactory('colgroup'),
|
1722
|
+
data: createDOMFactory('data'),
|
1723
|
+
datalist: createDOMFactory('datalist'),
|
1724
|
+
dd: createDOMFactory('dd'),
|
1725
|
+
del: createDOMFactory('del'),
|
1726
|
+
details: createDOMFactory('details'),
|
1727
|
+
dfn: createDOMFactory('dfn'),
|
1728
|
+
dialog: createDOMFactory('dialog'),
|
1729
|
+
div: createDOMFactory('div'),
|
1730
|
+
dl: createDOMFactory('dl'),
|
1731
|
+
dt: createDOMFactory('dt'),
|
1732
|
+
em: createDOMFactory('em'),
|
1733
|
+
embed: createDOMFactory('embed'),
|
1734
|
+
fieldset: createDOMFactory('fieldset'),
|
1735
|
+
figcaption: createDOMFactory('figcaption'),
|
1736
|
+
figure: createDOMFactory('figure'),
|
1737
|
+
footer: createDOMFactory('footer'),
|
1738
|
+
form: createDOMFactory('form'),
|
1739
|
+
h1: createDOMFactory('h1'),
|
1740
|
+
h2: createDOMFactory('h2'),
|
1741
|
+
h3: createDOMFactory('h3'),
|
1742
|
+
h4: createDOMFactory('h4'),
|
1743
|
+
h5: createDOMFactory('h5'),
|
1744
|
+
h6: createDOMFactory('h6'),
|
1745
|
+
head: createDOMFactory('head'),
|
1746
|
+
header: createDOMFactory('header'),
|
1747
|
+
hgroup: createDOMFactory('hgroup'),
|
1748
|
+
hr: createDOMFactory('hr'),
|
1749
|
+
html: createDOMFactory('html'),
|
1750
|
+
i: createDOMFactory('i'),
|
1751
|
+
iframe: createDOMFactory('iframe'),
|
1752
|
+
img: createDOMFactory('img'),
|
1753
|
+
input: createDOMFactory('input'),
|
1754
|
+
ins: createDOMFactory('ins'),
|
1755
|
+
kbd: createDOMFactory('kbd'),
|
1756
|
+
keygen: createDOMFactory('keygen'),
|
1757
|
+
label: createDOMFactory('label'),
|
1758
|
+
legend: createDOMFactory('legend'),
|
1759
|
+
li: createDOMFactory('li'),
|
1760
|
+
link: createDOMFactory('link'),
|
1761
|
+
main: createDOMFactory('main'),
|
1762
|
+
map: createDOMFactory('map'),
|
1763
|
+
mark: createDOMFactory('mark'),
|
1764
|
+
menu: createDOMFactory('menu'),
|
1765
|
+
menuitem: createDOMFactory('menuitem'),
|
1766
|
+
meta: createDOMFactory('meta'),
|
1767
|
+
meter: createDOMFactory('meter'),
|
1768
|
+
nav: createDOMFactory('nav'),
|
1769
|
+
noscript: createDOMFactory('noscript'),
|
1770
|
+
object: createDOMFactory('object'),
|
1771
|
+
ol: createDOMFactory('ol'),
|
1772
|
+
optgroup: createDOMFactory('optgroup'),
|
1773
|
+
option: createDOMFactory('option'),
|
1774
|
+
output: createDOMFactory('output'),
|
1775
|
+
p: createDOMFactory('p'),
|
1776
|
+
param: createDOMFactory('param'),
|
1777
|
+
picture: createDOMFactory('picture'),
|
1778
|
+
pre: createDOMFactory('pre'),
|
1779
|
+
progress: createDOMFactory('progress'),
|
1780
|
+
q: createDOMFactory('q'),
|
1781
|
+
rp: createDOMFactory('rp'),
|
1782
|
+
rt: createDOMFactory('rt'),
|
1783
|
+
ruby: createDOMFactory('ruby'),
|
1784
|
+
s: createDOMFactory('s'),
|
1785
|
+
samp: createDOMFactory('samp'),
|
1786
|
+
script: createDOMFactory('script'),
|
1787
|
+
section: createDOMFactory('section'),
|
1788
|
+
select: createDOMFactory('select'),
|
1789
|
+
small: createDOMFactory('small'),
|
1790
|
+
source: createDOMFactory('source'),
|
1791
|
+
span: createDOMFactory('span'),
|
1792
|
+
strong: createDOMFactory('strong'),
|
1793
|
+
style: createDOMFactory('style'),
|
1794
|
+
sub: createDOMFactory('sub'),
|
1795
|
+
summary: createDOMFactory('summary'),
|
1796
|
+
sup: createDOMFactory('sup'),
|
1797
|
+
table: createDOMFactory('table'),
|
1798
|
+
tbody: createDOMFactory('tbody'),
|
1799
|
+
td: createDOMFactory('td'),
|
1800
|
+
textarea: createDOMFactory('textarea'),
|
1801
|
+
tfoot: createDOMFactory('tfoot'),
|
1802
|
+
th: createDOMFactory('th'),
|
1803
|
+
thead: createDOMFactory('thead'),
|
1804
|
+
time: createDOMFactory('time'),
|
1805
|
+
title: createDOMFactory('title'),
|
1806
|
+
tr: createDOMFactory('tr'),
|
1807
|
+
track: createDOMFactory('track'),
|
1808
|
+
u: createDOMFactory('u'),
|
1809
|
+
ul: createDOMFactory('ul'),
|
1810
|
+
'var': createDOMFactory('var'),
|
1811
|
+
video: createDOMFactory('video'),
|
1812
|
+
wbr: createDOMFactory('wbr'),
|
1813
|
+
|
1814
|
+
// SVG
|
1815
|
+
circle: createDOMFactory('circle'),
|
1816
|
+
clipPath: createDOMFactory('clipPath'),
|
1817
|
+
defs: createDOMFactory('defs'),
|
1818
|
+
ellipse: createDOMFactory('ellipse'),
|
1819
|
+
g: createDOMFactory('g'),
|
1820
|
+
image: createDOMFactory('image'),
|
1821
|
+
line: createDOMFactory('line'),
|
1822
|
+
linearGradient: createDOMFactory('linearGradient'),
|
1823
|
+
mask: createDOMFactory('mask'),
|
1824
|
+
path: createDOMFactory('path'),
|
1825
|
+
pattern: createDOMFactory('pattern'),
|
1826
|
+
polygon: createDOMFactory('polygon'),
|
1827
|
+
polyline: createDOMFactory('polyline'),
|
1828
|
+
radialGradient: createDOMFactory('radialGradient'),
|
1829
|
+
rect: createDOMFactory('rect'),
|
1830
|
+
stop: createDOMFactory('stop'),
|
1831
|
+
svg: createDOMFactory('svg'),
|
1832
|
+
text: createDOMFactory('text'),
|
1833
|
+
tspan: createDOMFactory('tspan')
|
1834
|
+
};
|
1835
|
+
|
1836
|
+
module.exports = ReactDOMFactories;
|
1837
|
+
},{"10":10,"12":12}],10:[function(_dereq_,module,exports){
|
1838
|
+
/**
|
1839
|
+
* Copyright 2014-present, Facebook, Inc.
|
1840
|
+
* All rights reserved.
|
1841
|
+
*
|
1842
|
+
* This source code is licensed under the BSD-style license found in the
|
1843
|
+
* LICENSE file in the root directory of this source tree. An additional grant
|
1844
|
+
* of patent rights can be found in the PATENTS file in the same directory.
|
1845
|
+
*
|
1846
|
+
*/
|
1847
|
+
|
1848
|
+
'use strict';
|
1849
|
+
|
1850
|
+
var _assign = _dereq_(30);
|
1851
|
+
|
1852
|
+
var ReactCurrentOwner = _dereq_(8);
|
1853
|
+
|
1854
|
+
var warning = _dereq_(29);
|
1855
|
+
var canDefineProperty = _dereq_(20);
|
1856
|
+
var hasOwnProperty = Object.prototype.hasOwnProperty;
|
1857
|
+
|
1858
|
+
var REACT_ELEMENT_TYPE = _dereq_(11);
|
1859
|
+
|
1860
|
+
var RESERVED_PROPS = {
|
1861
|
+
key: true,
|
1862
|
+
ref: true,
|
1863
|
+
__self: true,
|
1864
|
+
__source: true
|
1865
|
+
};
|
1866
|
+
|
1867
|
+
var specialPropKeyWarningShown, specialPropRefWarningShown;
|
1868
|
+
|
1869
|
+
function hasValidRef(config) {
|
1870
|
+
if ("development" !== 'production') {
|
1871
|
+
if (hasOwnProperty.call(config, 'ref')) {
|
1872
|
+
var getter = Object.getOwnPropertyDescriptor(config, 'ref').get;
|
1873
|
+
if (getter && getter.isReactWarning) {
|
1874
|
+
return false;
|
1875
|
+
}
|
1876
|
+
}
|
1877
|
+
}
|
1878
|
+
return config.ref !== undefined;
|
1879
|
+
}
|
1880
|
+
|
1881
|
+
function hasValidKey(config) {
|
1882
|
+
if ("development" !== 'production') {
|
1883
|
+
if (hasOwnProperty.call(config, 'key')) {
|
1884
|
+
var getter = Object.getOwnPropertyDescriptor(config, 'key').get;
|
1885
|
+
if (getter && getter.isReactWarning) {
|
1886
|
+
return false;
|
1887
|
+
}
|
1888
|
+
}
|
1889
|
+
}
|
1890
|
+
return config.key !== undefined;
|
1891
|
+
}
|
1892
|
+
|
1893
|
+
function defineKeyPropWarningGetter(props, displayName) {
|
1894
|
+
var warnAboutAccessingKey = function () {
|
1895
|
+
if (!specialPropKeyWarningShown) {
|
1896
|
+
specialPropKeyWarningShown = true;
|
1897
|
+
"development" !== 'production' ? 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) : void 0;
|
1898
|
+
}
|
1899
|
+
};
|
1900
|
+
warnAboutAccessingKey.isReactWarning = true;
|
1901
|
+
Object.defineProperty(props, 'key', {
|
1902
|
+
get: warnAboutAccessingKey,
|
1903
|
+
configurable: true
|
1904
|
+
});
|
1905
|
+
}
|
1906
|
+
|
1907
|
+
function defineRefPropWarningGetter(props, displayName) {
|
1908
|
+
var warnAboutAccessingRef = function () {
|
1909
|
+
if (!specialPropRefWarningShown) {
|
1910
|
+
specialPropRefWarningShown = true;
|
1911
|
+
"development" !== 'production' ? 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) : void 0;
|
1912
|
+
}
|
1913
|
+
};
|
1914
|
+
warnAboutAccessingRef.isReactWarning = true;
|
1915
|
+
Object.defineProperty(props, 'ref', {
|
1916
|
+
get: warnAboutAccessingRef,
|
1917
|
+
configurable: true
|
1918
|
+
});
|
1919
|
+
}
|
1920
|
+
|
1921
|
+
/**
|
1922
|
+
* Factory method to create a new React element. This no longer adheres to
|
1923
|
+
* the class pattern, so do not use new to call it. Also, no instanceof check
|
1924
|
+
* will work. Instead test $$typeof field against Symbol.for('react.element') to check
|
1925
|
+
* if something is a React Element.
|
1926
|
+
*
|
1927
|
+
* @param {*} type
|
1928
|
+
* @param {*} key
|
1929
|
+
* @param {string|object} ref
|
1930
|
+
* @param {*} self A *temporary* helper to detect places where `this` is
|
1931
|
+
* different from the `owner` when React.createElement is called, so that we
|
1932
|
+
* can warn. We want to get rid of owner and replace string `ref`s with arrow
|
1933
|
+
* functions, and as long as `this` and owner are the same, there will be no
|
1934
|
+
* change in behavior.
|
1935
|
+
* @param {*} source An annotation object (added by a transpiler or otherwise)
|
1936
|
+
* indicating filename, line number, and/or other information.
|
1937
|
+
* @param {*} owner
|
1938
|
+
* @param {*} props
|
1939
|
+
* @internal
|
1940
|
+
*/
|
1941
|
+
var ReactElement = function (type, key, ref, self, source, owner, props) {
|
1942
|
+
var element = {
|
1943
|
+
// This tag allow us to uniquely identify this as a React Element
|
1944
|
+
$$typeof: REACT_ELEMENT_TYPE,
|
1945
|
+
|
1946
|
+
// Built-in properties that belong on the element
|
1947
|
+
type: type,
|
1948
|
+
key: key,
|
1949
|
+
ref: ref,
|
1950
|
+
props: props,
|
1951
|
+
|
1952
|
+
// Record the component responsible for creating this element.
|
1953
|
+
_owner: owner
|
1954
|
+
};
|
1955
|
+
|
1956
|
+
if ("development" !== 'production') {
|
1957
|
+
// The validation flag is currently mutative. We put it on
|
1958
|
+
// an external backing store so that we can freeze the whole object.
|
1959
|
+
// This can be replaced with a WeakMap once they are implemented in
|
1960
|
+
// commonly used development environments.
|
1961
|
+
element._store = {};
|
1962
|
+
|
1963
|
+
// To make comparing ReactElements easier for testing purposes, we make
|
1964
|
+
// the validation flag non-enumerable (where possible, which should
|
1965
|
+
// include every environment we run tests in), so the test framework
|
1966
|
+
// ignores it.
|
1967
|
+
if (canDefineProperty) {
|
1968
|
+
Object.defineProperty(element._store, 'validated', {
|
1969
|
+
configurable: false,
|
1970
|
+
enumerable: false,
|
1971
|
+
writable: true,
|
1972
|
+
value: false
|
1973
|
+
});
|
1974
|
+
// self and source are DEV only properties.
|
1975
|
+
Object.defineProperty(element, '_self', {
|
1976
|
+
configurable: false,
|
1977
|
+
enumerable: false,
|
1978
|
+
writable: false,
|
1979
|
+
value: self
|
1980
|
+
});
|
1981
|
+
// Two elements created in two different places should be considered
|
1982
|
+
// equal for testing purposes and therefore we hide it from enumeration.
|
1983
|
+
Object.defineProperty(element, '_source', {
|
1984
|
+
configurable: false,
|
1985
|
+
enumerable: false,
|
1986
|
+
writable: false,
|
1987
|
+
value: source
|
1988
|
+
});
|
1989
|
+
} else {
|
1990
|
+
element._store.validated = false;
|
1991
|
+
element._self = self;
|
1992
|
+
element._source = source;
|
1993
|
+
}
|
1994
|
+
if (Object.freeze) {
|
1995
|
+
Object.freeze(element.props);
|
1996
|
+
Object.freeze(element);
|
1997
|
+
}
|
1998
|
+
}
|
1999
|
+
|
2000
|
+
return element;
|
2001
|
+
};
|
2002
|
+
|
2003
|
+
/**
|
2004
|
+
* Create and return a new ReactElement of the given type.
|
2005
|
+
* See https://facebook.github.io/react/docs/top-level-api.html#react.createelement
|
2006
|
+
*/
|
2007
|
+
ReactElement.createElement = function (type, config, children) {
|
2008
|
+
var propName;
|
2009
|
+
|
2010
|
+
// Reserved names are extracted
|
2011
|
+
var props = {};
|
2012
|
+
|
2013
|
+
var key = null;
|
2014
|
+
var ref = null;
|
2015
|
+
var self = null;
|
2016
|
+
var source = null;
|
2017
|
+
|
2018
|
+
if (config != null) {
|
2019
|
+
if (hasValidRef(config)) {
|
2020
|
+
ref = config.ref;
|
2021
|
+
}
|
2022
|
+
if (hasValidKey(config)) {
|
2023
|
+
key = '' + config.key;
|
2024
|
+
}
|
2025
|
+
|
2026
|
+
self = config.__self === undefined ? null : config.__self;
|
2027
|
+
source = config.__source === undefined ? null : config.__source;
|
2028
|
+
// Remaining properties are added to a new props object
|
2029
|
+
for (propName in config) {
|
2030
|
+
if (hasOwnProperty.call(config, propName) && !RESERVED_PROPS.hasOwnProperty(propName)) {
|
2031
|
+
props[propName] = config[propName];
|
2032
|
+
}
|
2033
|
+
}
|
2034
|
+
}
|
2035
|
+
|
2036
|
+
// Children can be more than one argument, and those are transferred onto
|
2037
|
+
// the newly allocated props object.
|
2038
|
+
var childrenLength = arguments.length - 2;
|
2039
|
+
if (childrenLength === 1) {
|
2040
|
+
props.children = children;
|
2041
|
+
} else if (childrenLength > 1) {
|
2042
|
+
var childArray = Array(childrenLength);
|
2043
|
+
for (var i = 0; i < childrenLength; i++) {
|
2044
|
+
childArray[i] = arguments[i + 2];
|
2045
|
+
}
|
2046
|
+
if ("development" !== 'production') {
|
2047
|
+
if (Object.freeze) {
|
2048
|
+
Object.freeze(childArray);
|
2049
|
+
}
|
2050
|
+
}
|
2051
|
+
props.children = childArray;
|
2052
|
+
}
|
2053
|
+
|
2054
|
+
// Resolve default props
|
2055
|
+
if (type && type.defaultProps) {
|
2056
|
+
var defaultProps = type.defaultProps;
|
2057
|
+
for (propName in defaultProps) {
|
2058
|
+
if (props[propName] === undefined) {
|
2059
|
+
props[propName] = defaultProps[propName];
|
2060
|
+
}
|
2061
|
+
}
|
2062
|
+
}
|
2063
|
+
if ("development" !== 'production') {
|
2064
|
+
if (key || ref) {
|
2065
|
+
if (typeof props.$$typeof === 'undefined' || props.$$typeof !== REACT_ELEMENT_TYPE) {
|
2066
|
+
var displayName = typeof type === 'function' ? type.displayName || type.name || 'Unknown' : type;
|
2067
|
+
if (key) {
|
2068
|
+
defineKeyPropWarningGetter(props, displayName);
|
2069
|
+
}
|
2070
|
+
if (ref) {
|
2071
|
+
defineRefPropWarningGetter(props, displayName);
|
2072
|
+
}
|
2073
|
+
}
|
2074
|
+
}
|
2075
|
+
}
|
2076
|
+
return ReactElement(type, key, ref, self, source, ReactCurrentOwner.current, props);
|
2077
|
+
};
|
2078
|
+
|
2079
|
+
/**
|
2080
|
+
* Return a function that produces ReactElements of a given type.
|
2081
|
+
* See https://facebook.github.io/react/docs/top-level-api.html#react.createfactory
|
2082
|
+
*/
|
2083
|
+
ReactElement.createFactory = function (type) {
|
2084
|
+
var factory = ReactElement.createElement.bind(null, type);
|
2085
|
+
// Expose the type on the factory and the prototype so that it can be
|
2086
|
+
// easily accessed on elements. E.g. `<Foo />.type === Foo`.
|
2087
|
+
// This should not be named `constructor` since this may not be the function
|
2088
|
+
// that created the element, and it may not even be a constructor.
|
2089
|
+
// Legacy hook TODO: Warn if this is accessed
|
2090
|
+
factory.type = type;
|
2091
|
+
return factory;
|
2092
|
+
};
|
2093
|
+
|
2094
|
+
ReactElement.cloneAndReplaceKey = function (oldElement, newKey) {
|
2095
|
+
var newElement = ReactElement(oldElement.type, newKey, oldElement.ref, oldElement._self, oldElement._source, oldElement._owner, oldElement.props);
|
2096
|
+
|
2097
|
+
return newElement;
|
2098
|
+
};
|
2099
|
+
|
2100
|
+
/**
|
2101
|
+
* Clone and return a new ReactElement using element as the starting point.
|
2102
|
+
* See https://facebook.github.io/react/docs/top-level-api.html#react.cloneelement
|
2103
|
+
*/
|
2104
|
+
ReactElement.cloneElement = function (element, config, children) {
|
2105
|
+
var propName;
|
2106
|
+
|
2107
|
+
// Original props are copied
|
2108
|
+
var props = _assign({}, element.props);
|
2109
|
+
|
2110
|
+
// Reserved names are extracted
|
2111
|
+
var key = element.key;
|
2112
|
+
var ref = element.ref;
|
2113
|
+
// Self is preserved since the owner is preserved.
|
2114
|
+
var self = element._self;
|
2115
|
+
// Source is preserved since cloneElement is unlikely to be targeted by a
|
2116
|
+
// transpiler, and the original source is probably a better indicator of the
|
2117
|
+
// true owner.
|
2118
|
+
var source = element._source;
|
2119
|
+
|
2120
|
+
// Owner will be preserved, unless ref is overridden
|
2121
|
+
var owner = element._owner;
|
2122
|
+
|
2123
|
+
if (config != null) {
|
2124
|
+
if (hasValidRef(config)) {
|
2125
|
+
// Silently steal the ref from the parent.
|
2126
|
+
ref = config.ref;
|
2127
|
+
owner = ReactCurrentOwner.current;
|
2128
|
+
}
|
2129
|
+
if (hasValidKey(config)) {
|
2130
|
+
key = '' + config.key;
|
2131
|
+
}
|
2132
|
+
|
2133
|
+
// Remaining properties override existing props
|
2134
|
+
var defaultProps;
|
2135
|
+
if (element.type && element.type.defaultProps) {
|
2136
|
+
defaultProps = element.type.defaultProps;
|
2137
|
+
}
|
2138
|
+
for (propName in config) {
|
2139
|
+
if (hasOwnProperty.call(config, propName) && !RESERVED_PROPS.hasOwnProperty(propName)) {
|
2140
|
+
if (config[propName] === undefined && defaultProps !== undefined) {
|
2141
|
+
// Resolve default props
|
2142
|
+
props[propName] = defaultProps[propName];
|
2143
|
+
} else {
|
2144
|
+
props[propName] = config[propName];
|
2145
|
+
}
|
2146
|
+
}
|
2147
|
+
}
|
2148
|
+
}
|
2149
|
+
|
2150
|
+
// Children can be more than one argument, and those are transferred onto
|
2151
|
+
// the newly allocated props object.
|
2152
|
+
var childrenLength = arguments.length - 2;
|
2153
|
+
if (childrenLength === 1) {
|
2154
|
+
props.children = children;
|
2155
|
+
} else if (childrenLength > 1) {
|
2156
|
+
var childArray = Array(childrenLength);
|
2157
|
+
for (var i = 0; i < childrenLength; i++) {
|
2158
|
+
childArray[i] = arguments[i + 2];
|
2159
|
+
}
|
2160
|
+
props.children = childArray;
|
2161
|
+
}
|
2162
|
+
|
2163
|
+
return ReactElement(element.type, key, ref, self, source, owner, props);
|
2164
|
+
};
|
2165
|
+
|
2166
|
+
/**
|
2167
|
+
* Verifies the object is a ReactElement.
|
2168
|
+
* See https://facebook.github.io/react/docs/top-level-api.html#react.isvalidelement
|
2169
|
+
* @param {?object} object
|
2170
|
+
* @return {boolean} True if `object` is a valid component.
|
2171
|
+
* @final
|
2172
|
+
*/
|
2173
|
+
ReactElement.isValidElement = function (object) {
|
2174
|
+
return typeof object === 'object' && object !== null && object.$$typeof === REACT_ELEMENT_TYPE;
|
2175
|
+
};
|
2176
|
+
|
2177
|
+
module.exports = ReactElement;
|
2178
|
+
},{"11":11,"20":20,"29":29,"30":30,"8":8}],11:[function(_dereq_,module,exports){
|
2179
|
+
/**
|
2180
|
+
* Copyright 2014-present, Facebook, Inc.
|
2181
|
+
* All rights reserved.
|
2182
|
+
*
|
2183
|
+
* This source code is licensed under the BSD-style license found in the
|
2184
|
+
* LICENSE file in the root directory of this source tree. An additional grant
|
2185
|
+
* of patent rights can be found in the PATENTS file in the same directory.
|
2186
|
+
*
|
2187
|
+
*
|
2188
|
+
*/
|
2189
|
+
|
2190
|
+
'use strict';
|
2191
|
+
|
2192
|
+
// The Symbol used to tag the ReactElement type. If there is no native Symbol
|
2193
|
+
// nor polyfill, then a plain number is used for performance.
|
2194
|
+
|
2195
|
+
var REACT_ELEMENT_TYPE = typeof Symbol === 'function' && Symbol['for'] && Symbol['for']('react.element') || 0xeac7;
|
2196
|
+
|
2197
|
+
module.exports = REACT_ELEMENT_TYPE;
|
2198
|
+
},{}],12:[function(_dereq_,module,exports){
|
2199
|
+
/**
|
2200
|
+
* Copyright 2014-present, Facebook, Inc.
|
2201
|
+
* All rights reserved.
|
2202
|
+
*
|
2203
|
+
* This source code is licensed under the BSD-style license found in the
|
2204
|
+
* LICENSE file in the root directory of this source tree. An additional grant
|
2205
|
+
* of patent rights can be found in the PATENTS file in the same directory.
|
2206
|
+
*
|
2207
|
+
*/
|
2208
|
+
|
2209
|
+
/**
|
2210
|
+
* ReactElementValidator provides a wrapper around a element factory
|
2211
|
+
* which validates the props passed to the element. This is intended to be
|
2212
|
+
* used only in DEV and could be replaced by a static type checker for languages
|
2213
|
+
* that support it.
|
2214
|
+
*/
|
2215
|
+
|
2216
|
+
'use strict';
|
2217
|
+
|
2218
|
+
var ReactCurrentOwner = _dereq_(8);
|
2219
|
+
var ReactComponentTreeHook = _dereq_(7);
|
2220
|
+
var ReactElement = _dereq_(10);
|
2221
|
+
|
2222
|
+
var checkReactTypeSpec = _dereq_(21);
|
2223
|
+
|
2224
|
+
var canDefineProperty = _dereq_(20);
|
2225
|
+
var getIteratorFn = _dereq_(22);
|
2226
|
+
var warning = _dereq_(29);
|
2227
|
+
|
2228
|
+
function getDeclarationErrorAddendum() {
|
2229
|
+
if (ReactCurrentOwner.current) {
|
2230
|
+
var name = ReactCurrentOwner.current.getName();
|
2231
|
+
if (name) {
|
2232
|
+
return ' Check the render method of `' + name + '`.';
|
2233
|
+
}
|
2234
|
+
}
|
2235
|
+
return '';
|
2236
|
+
}
|
2237
|
+
|
2238
|
+
/**
|
2239
|
+
* Warn if there's no key explicitly set on dynamic arrays of children or
|
2240
|
+
* object keys are not valid. This allows us to keep track of children between
|
2241
|
+
* updates.
|
2242
|
+
*/
|
2243
|
+
var ownerHasKeyUseWarning = {};
|
2244
|
+
|
2245
|
+
function getCurrentComponentErrorInfo(parentType) {
|
2246
|
+
var info = getDeclarationErrorAddendum();
|
2247
|
+
|
2248
|
+
if (!info) {
|
2249
|
+
var parentName = typeof parentType === 'string' ? parentType : parentType.displayName || parentType.name;
|
2250
|
+
if (parentName) {
|
2251
|
+
info = ' Check the top-level render call using <' + parentName + '>.';
|
2252
|
+
}
|
2253
|
+
}
|
2254
|
+
return info;
|
2255
|
+
}
|
2256
|
+
|
2257
|
+
/**
|
2258
|
+
* Warn if the element doesn't have an explicit key assigned to it.
|
2259
|
+
* This element is in an array. The array could grow and shrink or be
|
2260
|
+
* reordered. All children that haven't already been validated are required to
|
2261
|
+
* have a "key" property assigned to it. Error statuses are cached so a warning
|
2262
|
+
* will only be shown once.
|
2263
|
+
*
|
2264
|
+
* @internal
|
2265
|
+
* @param {ReactElement} element Element that requires a key.
|
2266
|
+
* @param {*} parentType element's parent's type.
|
2267
|
+
*/
|
2268
|
+
function validateExplicitKey(element, parentType) {
|
2269
|
+
if (!element._store || element._store.validated || element.key != null) {
|
2270
|
+
return;
|
2271
|
+
}
|
2272
|
+
element._store.validated = true;
|
2273
|
+
|
2274
|
+
var memoizer = ownerHasKeyUseWarning.uniqueKey || (ownerHasKeyUseWarning.uniqueKey = {});
|
2275
|
+
|
2276
|
+
var currentComponentErrorInfo = getCurrentComponentErrorInfo(parentType);
|
2277
|
+
if (memoizer[currentComponentErrorInfo]) {
|
2278
|
+
return;
|
2279
|
+
}
|
2280
|
+
memoizer[currentComponentErrorInfo] = true;
|
2281
|
+
|
2282
|
+
// Usually the current owner is the offender, but if it accepts children as a
|
2283
|
+
// property, it may be the creator of the child that's responsible for
|
2284
|
+
// assigning it a key.
|
2285
|
+
var childOwner = '';
|
2286
|
+
if (element && element._owner && element._owner !== ReactCurrentOwner.current) {
|
2287
|
+
// Give the component that originally created this child.
|
2288
|
+
childOwner = ' It was passed a child from ' + element._owner.getName() + '.';
|
2289
|
+
}
|
2290
|
+
|
2291
|
+
"development" !== 'production' ? warning(false, 'Each child in an array or iterator should have a unique "key" prop.' + '%s%s See https://fb.me/react-warning-keys for more information.%s', currentComponentErrorInfo, childOwner, ReactComponentTreeHook.getCurrentStackAddendum(element)) : void 0;
|
2292
|
+
}
|
2293
|
+
|
2294
|
+
/**
|
2295
|
+
* Ensure that every element either is passed in a static location, in an
|
2296
|
+
* array with an explicit keys property defined, or in an object literal
|
2297
|
+
* with valid key property.
|
2298
|
+
*
|
2299
|
+
* @internal
|
2300
|
+
* @param {ReactNode} node Statically passed child of any type.
|
2301
|
+
* @param {*} parentType node's parent's type.
|
2302
|
+
*/
|
2303
|
+
function validateChildKeys(node, parentType) {
|
2304
|
+
if (typeof node !== 'object') {
|
2305
|
+
return;
|
2306
|
+
}
|
2307
|
+
if (Array.isArray(node)) {
|
2308
|
+
for (var i = 0; i < node.length; i++) {
|
2309
|
+
var child = node[i];
|
2310
|
+
if (ReactElement.isValidElement(child)) {
|
2311
|
+
validateExplicitKey(child, parentType);
|
2312
|
+
}
|
2313
|
+
}
|
2314
|
+
} else if (ReactElement.isValidElement(node)) {
|
2315
|
+
// This element was passed in a valid location.
|
2316
|
+
if (node._store) {
|
2317
|
+
node._store.validated = true;
|
2318
|
+
}
|
2319
|
+
} else if (node) {
|
2320
|
+
var iteratorFn = getIteratorFn(node);
|
2321
|
+
// Entry iterators provide implicit keys.
|
2322
|
+
if (iteratorFn) {
|
2323
|
+
if (iteratorFn !== node.entries) {
|
2324
|
+
var iterator = iteratorFn.call(node);
|
2325
|
+
var step;
|
2326
|
+
while (!(step = iterator.next()).done) {
|
2327
|
+
if (ReactElement.isValidElement(step.value)) {
|
2328
|
+
validateExplicitKey(step.value, parentType);
|
2329
|
+
}
|
2330
|
+
}
|
2331
|
+
}
|
2332
|
+
}
|
2333
|
+
}
|
2334
|
+
}
|
2335
|
+
|
2336
|
+
/**
|
2337
|
+
* Given an element, validate that its props follow the propTypes definition,
|
2338
|
+
* provided by the type.
|
2339
|
+
*
|
2340
|
+
* @param {ReactElement} element
|
2341
|
+
*/
|
2342
|
+
function validatePropTypes(element) {
|
2343
|
+
var componentClass = element.type;
|
2344
|
+
if (typeof componentClass !== 'function') {
|
2345
|
+
return;
|
2346
|
+
}
|
2347
|
+
var name = componentClass.displayName || componentClass.name;
|
2348
|
+
if (componentClass.propTypes) {
|
2349
|
+
checkReactTypeSpec(componentClass.propTypes, element.props, 'prop', name, element, null);
|
2350
|
+
}
|
2351
|
+
if (typeof componentClass.getDefaultProps === 'function') {
|
2352
|
+
"development" !== 'production' ? warning(componentClass.getDefaultProps.isReactClassApproved, 'getDefaultProps is only used on classic React.createClass ' + 'definitions. Use a static property named `defaultProps` instead.') : void 0;
|
2353
|
+
}
|
2354
|
+
}
|
2355
|
+
|
2356
|
+
var ReactElementValidator = {
|
2357
|
+
|
2358
|
+
createElement: function (type, props, children) {
|
2359
|
+
var validType = typeof type === 'string' || typeof type === 'function';
|
2360
|
+
// We warn in this case but don't throw. We expect the element creation to
|
2361
|
+
// succeed and there will likely be errors in render.
|
2362
|
+
if (!validType) {
|
2363
|
+
"development" !== 'production' ? warning(false, 'React.createElement: type should not be null, undefined, boolean, or ' + 'number. It should be a string (for DOM elements) or a ReactClass ' + '(for composite components).%s', getDeclarationErrorAddendum()) : void 0;
|
2364
|
+
}
|
2365
|
+
|
2366
|
+
var element = ReactElement.createElement.apply(this, arguments);
|
2367
|
+
|
2368
|
+
// The result can be nullish if a mock or a custom function is used.
|
2369
|
+
// TODO: Drop this when these are no longer allowed as the type argument.
|
2370
|
+
if (element == null) {
|
2371
|
+
return element;
|
2372
|
+
}
|
2373
|
+
|
2374
|
+
// Skip key warning if the type isn't valid since our key validation logic
|
2375
|
+
// doesn't expect a non-string/function type and can throw confusing errors.
|
2376
|
+
// We don't want exception behavior to differ between dev and prod.
|
2377
|
+
// (Rendering will throw with a helpful message and as soon as the type is
|
2378
|
+
// fixed, the key warnings will appear.)
|
2379
|
+
if (validType) {
|
2380
|
+
for (var i = 2; i < arguments.length; i++) {
|
2381
|
+
validateChildKeys(arguments[i], type);
|
2382
|
+
}
|
2383
|
+
}
|
2384
|
+
|
2385
|
+
validatePropTypes(element);
|
2386
|
+
|
2387
|
+
return element;
|
2388
|
+
},
|
2389
|
+
|
2390
|
+
createFactory: function (type) {
|
2391
|
+
var validatedFactory = ReactElementValidator.createElement.bind(null, type);
|
2392
|
+
// Legacy hook TODO: Warn if this is accessed
|
2393
|
+
validatedFactory.type = type;
|
2394
|
+
|
2395
|
+
if ("development" !== 'production') {
|
2396
|
+
if (canDefineProperty) {
|
2397
|
+
Object.defineProperty(validatedFactory, 'type', {
|
2398
|
+
enumerable: false,
|
2399
|
+
get: function () {
|
2400
|
+
"development" !== 'production' ? warning(false, 'Factory.type is deprecated. Access the class directly ' + 'before passing it to createFactory.') : void 0;
|
2401
|
+
Object.defineProperty(this, 'type', {
|
2402
|
+
value: type
|
2403
|
+
});
|
2404
|
+
return type;
|
2405
|
+
}
|
2406
|
+
});
|
2407
|
+
}
|
2408
|
+
}
|
2409
|
+
|
2410
|
+
return validatedFactory;
|
2411
|
+
},
|
2412
|
+
|
2413
|
+
cloneElement: function (element, props, children) {
|
2414
|
+
var newElement = ReactElement.cloneElement.apply(this, arguments);
|
2415
|
+
for (var i = 2; i < arguments.length; i++) {
|
2416
|
+
validateChildKeys(arguments[i], newElement.type);
|
2417
|
+
}
|
2418
|
+
validatePropTypes(newElement);
|
2419
|
+
return newElement;
|
2420
|
+
}
|
2421
|
+
|
2422
|
+
};
|
2423
|
+
|
2424
|
+
module.exports = ReactElementValidator;
|
2425
|
+
},{"10":10,"20":20,"21":21,"22":22,"29":29,"7":7,"8":8}],13:[function(_dereq_,module,exports){
|
2426
|
+
/**
|
2427
|
+
* Copyright 2015-present, Facebook, Inc.
|
2428
|
+
* All rights reserved.
|
2429
|
+
*
|
2430
|
+
* This source code is licensed under the BSD-style license found in the
|
2431
|
+
* LICENSE file in the root directory of this source tree. An additional grant
|
2432
|
+
* of patent rights can be found in the PATENTS file in the same directory.
|
2433
|
+
*
|
2434
|
+
*/
|
2435
|
+
|
2436
|
+
'use strict';
|
2437
|
+
|
2438
|
+
var warning = _dereq_(29);
|
2439
|
+
|
2440
|
+
function warnNoop(publicInstance, callerName) {
|
2441
|
+
if ("development" !== 'production') {
|
2442
|
+
var constructor = publicInstance.constructor;
|
2443
|
+
"development" !== 'production' ? warning(false, '%s(...): Can only update a mounted or mounting component. ' + 'This usually means you called %s() on an unmounted component. ' + 'This is a no-op. Please check the code for the %s component.', callerName, callerName, constructor && (constructor.displayName || constructor.name) || 'ReactClass') : void 0;
|
2444
|
+
}
|
2445
|
+
}
|
2446
|
+
|
2447
|
+
/**
|
2448
|
+
* This is the abstract API for an update queue.
|
2449
|
+
*/
|
2450
|
+
var ReactNoopUpdateQueue = {
|
2451
|
+
|
2452
|
+
/**
|
2453
|
+
* Checks whether or not this composite component is mounted.
|
2454
|
+
* @param {ReactClass} publicInstance The instance we want to test.
|
2455
|
+
* @return {boolean} True if mounted, false otherwise.
|
2456
|
+
* @protected
|
2457
|
+
* @final
|
2458
|
+
*/
|
2459
|
+
isMounted: function (publicInstance) {
|
2460
|
+
return false;
|
2461
|
+
},
|
2462
|
+
|
2463
|
+
/**
|
2464
|
+
* Enqueue a callback that will be executed after all the pending updates
|
2465
|
+
* have processed.
|
2466
|
+
*
|
2467
|
+
* @param {ReactClass} publicInstance The instance to use as `this` context.
|
2468
|
+
* @param {?function} callback Called after state is updated.
|
2469
|
+
* @internal
|
2470
|
+
*/
|
2471
|
+
enqueueCallback: function (publicInstance, callback) {},
|
2472
|
+
|
2473
|
+
/**
|
2474
|
+
* Forces an update. This should only be invoked when it is known with
|
2475
|
+
* certainty that we are **not** in a DOM transaction.
|
2476
|
+
*
|
2477
|
+
* You may want to call this when you know that some deeper aspect of the
|
2478
|
+
* component's state has changed but `setState` was not called.
|
2479
|
+
*
|
2480
|
+
* This will not invoke `shouldComponentUpdate`, but it will invoke
|
2481
|
+
* `componentWillUpdate` and `componentDidUpdate`.
|
2482
|
+
*
|
2483
|
+
* @param {ReactClass} publicInstance The instance that should rerender.
|
2484
|
+
* @internal
|
2485
|
+
*/
|
2486
|
+
enqueueForceUpdate: function (publicInstance) {
|
2487
|
+
warnNoop(publicInstance, 'forceUpdate');
|
2488
|
+
},
|
2489
|
+
|
2490
|
+
/**
|
2491
|
+
* Replaces all of the state. Always use this or `setState` to mutate state.
|
2492
|
+
* You should treat `this.state` as immutable.
|
2493
|
+
*
|
2494
|
+
* There is no guarantee that `this.state` will be immediately updated, so
|
2495
|
+
* accessing `this.state` after calling this method may return the old value.
|
2496
|
+
*
|
2497
|
+
* @param {ReactClass} publicInstance The instance that should rerender.
|
2498
|
+
* @param {object} completeState Next state.
|
2499
|
+
* @internal
|
2500
|
+
*/
|
2501
|
+
enqueueReplaceState: function (publicInstance, completeState) {
|
2502
|
+
warnNoop(publicInstance, 'replaceState');
|
2503
|
+
},
|
2504
|
+
|
2505
|
+
/**
|
2506
|
+
* Sets a subset of the state. This only exists because _pendingState is
|
2507
|
+
* internal. This provides a merging strategy that is not available to deep
|
2508
|
+
* properties which is confusing. TODO: Expose pendingState or don't use it
|
2509
|
+
* during the merge.
|
2510
|
+
*
|
2511
|
+
* @param {ReactClass} publicInstance The instance that should rerender.
|
2512
|
+
* @param {object} partialState Next partial state to be merged with state.
|
2513
|
+
* @internal
|
2514
|
+
*/
|
2515
|
+
enqueueSetState: function (publicInstance, partialState) {
|
2516
|
+
warnNoop(publicInstance, 'setState');
|
2517
|
+
}
|
2518
|
+
};
|
2519
|
+
|
2520
|
+
module.exports = ReactNoopUpdateQueue;
|
2521
|
+
},{"29":29}],14:[function(_dereq_,module,exports){
|
2522
|
+
/**
|
2523
|
+
* Copyright 2013-present, Facebook, Inc.
|
2524
|
+
* All rights reserved.
|
2525
|
+
*
|
2526
|
+
* This source code is licensed under the BSD-style license found in the
|
2527
|
+
* LICENSE file in the root directory of this source tree. An additional grant
|
2528
|
+
* of patent rights can be found in the PATENTS file in the same directory.
|
2529
|
+
*
|
2530
|
+
*
|
2531
|
+
*/
|
2532
|
+
|
2533
|
+
'use strict';
|
2534
|
+
|
2535
|
+
var ReactPropTypeLocationNames = {};
|
2536
|
+
|
2537
|
+
if ("development" !== 'production') {
|
2538
|
+
ReactPropTypeLocationNames = {
|
2539
|
+
prop: 'prop',
|
2540
|
+
context: 'context',
|
2541
|
+
childContext: 'child context'
|
2542
|
+
};
|
2543
|
+
}
|
2544
|
+
|
2545
|
+
module.exports = ReactPropTypeLocationNames;
|
2546
|
+
},{}],15:[function(_dereq_,module,exports){
|
2547
|
+
/**
|
2548
|
+
* Copyright 2013-present, Facebook, Inc.
|
2549
|
+
* All rights reserved.
|
2550
|
+
*
|
2551
|
+
* This source code is licensed under the BSD-style license found in the
|
2552
|
+
* LICENSE file in the root directory of this source tree. An additional grant
|
2553
|
+
* of patent rights can be found in the PATENTS file in the same directory.
|
2554
|
+
*
|
2555
|
+
*/
|
2556
|
+
|
2557
|
+
'use strict';
|
2558
|
+
|
2559
|
+
var ReactElement = _dereq_(10);
|
2560
|
+
var ReactPropTypeLocationNames = _dereq_(14);
|
2561
|
+
var ReactPropTypesSecret = _dereq_(16);
|
2562
|
+
|
2563
|
+
var emptyFunction = _dereq_(26);
|
2564
|
+
var getIteratorFn = _dereq_(22);
|
2565
|
+
var warning = _dereq_(29);
|
2566
|
+
|
2567
|
+
/**
|
2568
|
+
* Collection of methods that allow declaration and validation of props that are
|
2569
|
+
* supplied to React components. Example usage:
|
2570
|
+
*
|
2571
|
+
* var Props = require('ReactPropTypes');
|
2572
|
+
* var MyArticle = React.createClass({
|
2573
|
+
* propTypes: {
|
2574
|
+
* // An optional string prop named "description".
|
2575
|
+
* description: Props.string,
|
2576
|
+
*
|
2577
|
+
* // A required enum prop named "category".
|
2578
|
+
* category: Props.oneOf(['News','Photos']).isRequired,
|
2579
|
+
*
|
2580
|
+
* // A prop named "dialog" that requires an instance of Dialog.
|
2581
|
+
* dialog: Props.instanceOf(Dialog).isRequired
|
2582
|
+
* },
|
2583
|
+
* render: function() { ... }
|
2584
|
+
* });
|
2585
|
+
*
|
2586
|
+
* A more formal specification of how these methods are used:
|
2587
|
+
*
|
2588
|
+
* type := array|bool|func|object|number|string|oneOf([...])|instanceOf(...)
|
2589
|
+
* decl := ReactPropTypes.{type}(.isRequired)?
|
2590
|
+
*
|
2591
|
+
* Each and every declaration produces a function with the same signature. This
|
2592
|
+
* allows the creation of custom validation functions. For example:
|
2593
|
+
*
|
2594
|
+
* var MyLink = React.createClass({
|
2595
|
+
* propTypes: {
|
2596
|
+
* // An optional string or URI prop named "href".
|
2597
|
+
* href: function(props, propName, componentName) {
|
2598
|
+
* var propValue = props[propName];
|
2599
|
+
* if (propValue != null && typeof propValue !== 'string' &&
|
2600
|
+
* !(propValue instanceof URI)) {
|
2601
|
+
* return new Error(
|
2602
|
+
* 'Expected a string or an URI for ' + propName + ' in ' +
|
2603
|
+
* componentName
|
2604
|
+
* );
|
2605
|
+
* }
|
2606
|
+
* }
|
2607
|
+
* },
|
2608
|
+
* render: function() {...}
|
2609
|
+
* });
|
2610
|
+
*
|
2611
|
+
* @internal
|
2612
|
+
*/
|
2613
|
+
|
2614
|
+
var ANONYMOUS = '<<anonymous>>';
|
2615
|
+
|
2616
|
+
var ReactPropTypes = {
|
2617
|
+
array: createPrimitiveTypeChecker('array'),
|
2618
|
+
bool: createPrimitiveTypeChecker('boolean'),
|
2619
|
+
func: createPrimitiveTypeChecker('function'),
|
2620
|
+
number: createPrimitiveTypeChecker('number'),
|
2621
|
+
object: createPrimitiveTypeChecker('object'),
|
2622
|
+
string: createPrimitiveTypeChecker('string'),
|
2623
|
+
symbol: createPrimitiveTypeChecker('symbol'),
|
2624
|
+
|
2625
|
+
any: createAnyTypeChecker(),
|
2626
|
+
arrayOf: createArrayOfTypeChecker,
|
2627
|
+
element: createElementTypeChecker(),
|
2628
|
+
instanceOf: createInstanceTypeChecker,
|
2629
|
+
node: createNodeChecker(),
|
2630
|
+
objectOf: createObjectOfTypeChecker,
|
2631
|
+
oneOf: createEnumTypeChecker,
|
2632
|
+
oneOfType: createUnionTypeChecker,
|
2633
|
+
shape: createShapeTypeChecker
|
2634
|
+
};
|
2635
|
+
|
2636
|
+
/**
|
2637
|
+
* inlined Object.is polyfill to avoid requiring consumers ship their own
|
2638
|
+
* https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/is
|
2639
|
+
*/
|
2640
|
+
/*eslint-disable no-self-compare*/
|
2641
|
+
function is(x, y) {
|
2642
|
+
// SameValue algorithm
|
2643
|
+
if (x === y) {
|
2644
|
+
// Steps 1-5, 7-10
|
2645
|
+
// Steps 6.b-6.e: +0 != -0
|
2646
|
+
return x !== 0 || 1 / x === 1 / y;
|
2647
|
+
} else {
|
2648
|
+
// Step 6.a: NaN == NaN
|
2649
|
+
return x !== x && y !== y;
|
2650
|
+
}
|
2651
|
+
}
|
2652
|
+
/*eslint-enable no-self-compare*/
|
2653
|
+
|
2654
|
+
/**
|
2655
|
+
* We use an Error-like object for backward compatibility as people may call
|
2656
|
+
* PropTypes directly and inspect their output. However we don't use real
|
2657
|
+
* Errors anymore. We don't inspect their stack anyway, and creating them
|
2658
|
+
* is prohibitively expensive if they are created too often, such as what
|
2659
|
+
* happens in oneOfType() for any type before the one that matched.
|
2660
|
+
*/
|
2661
|
+
function PropTypeError(message) {
|
2662
|
+
this.message = message;
|
2663
|
+
this.stack = '';
|
2664
|
+
}
|
2665
|
+
// Make `instanceof Error` still work for returned errors.
|
2666
|
+
PropTypeError.prototype = Error.prototype;
|
2667
|
+
|
2668
|
+
function createChainableTypeChecker(validate) {
|
2669
|
+
if ("development" !== 'production') {
|
2670
|
+
var manualPropTypeCallCache = {};
|
2671
|
+
}
|
2672
|
+
function checkType(isRequired, props, propName, componentName, location, propFullName, secret) {
|
2673
|
+
componentName = componentName || ANONYMOUS;
|
2674
|
+
propFullName = propFullName || propName;
|
2675
|
+
if ("development" !== 'production') {
|
2676
|
+
if (secret !== ReactPropTypesSecret && typeof console !== 'undefined') {
|
2677
|
+
var cacheKey = componentName + ':' + propName;
|
2678
|
+
if (!manualPropTypeCallCache[cacheKey]) {
|
2679
|
+
"development" !== 'production' ? warning(false, 'You are manually calling a React.PropTypes validation ' + 'function for the `%s` prop on `%s`. This is deprecated ' + 'and will not work in production with the next major version. ' + 'You may be seeing this warning due to a third-party PropTypes ' + 'library. See https://fb.me/react-warning-dont-call-proptypes ' + 'for details.', propFullName, componentName) : void 0;
|
2680
|
+
manualPropTypeCallCache[cacheKey] = true;
|
2681
|
+
}
|
2682
|
+
}
|
2683
|
+
}
|
2684
|
+
if (props[propName] == null) {
|
2685
|
+
var locationName = ReactPropTypeLocationNames[location];
|
2686
|
+
if (isRequired) {
|
2687
|
+
if (props[propName] === null) {
|
2688
|
+
return new PropTypeError('The ' + locationName + ' `' + propFullName + '` is marked as required ' + ('in `' + componentName + '`, but its value is `null`.'));
|
2689
|
+
}
|
2690
|
+
return new PropTypeError('The ' + locationName + ' `' + propFullName + '` is marked as required in ' + ('`' + componentName + '`, but its value is `undefined`.'));
|
2691
|
+
}
|
2692
|
+
return null;
|
2693
|
+
} else {
|
2694
|
+
return validate(props, propName, componentName, location, propFullName);
|
2695
|
+
}
|
2696
|
+
}
|
2697
|
+
|
2698
|
+
var chainedCheckType = checkType.bind(null, false);
|
2699
|
+
chainedCheckType.isRequired = checkType.bind(null, true);
|
2700
|
+
|
2701
|
+
return chainedCheckType;
|
2702
|
+
}
|
2703
|
+
|
2704
|
+
function createPrimitiveTypeChecker(expectedType) {
|
2705
|
+
function validate(props, propName, componentName, location, propFullName, secret) {
|
2706
|
+
var propValue = props[propName];
|
2707
|
+
var propType = getPropType(propValue);
|
2708
|
+
if (propType !== expectedType) {
|
2709
|
+
var locationName = ReactPropTypeLocationNames[location];
|
2710
|
+
// `propValue` being instance of, say, date/regexp, pass the 'object'
|
2711
|
+
// check, but we can offer a more precise error message here rather than
|
2712
|
+
// 'of type `object`'.
|
2713
|
+
var preciseType = getPreciseType(propValue);
|
2714
|
+
|
2715
|
+
return new PropTypeError('Invalid ' + locationName + ' `' + propFullName + '` of type ' + ('`' + preciseType + '` supplied to `' + componentName + '`, expected ') + ('`' + expectedType + '`.'));
|
2716
|
+
}
|
2717
|
+
return null;
|
2718
|
+
}
|
2719
|
+
return createChainableTypeChecker(validate);
|
2720
|
+
}
|
2721
|
+
|
2722
|
+
function createAnyTypeChecker() {
|
2723
|
+
return createChainableTypeChecker(emptyFunction.thatReturns(null));
|
2724
|
+
}
|
2725
|
+
|
2726
|
+
function createArrayOfTypeChecker(typeChecker) {
|
2727
|
+
function validate(props, propName, componentName, location, propFullName) {
|
2728
|
+
if (typeof typeChecker !== 'function') {
|
2729
|
+
return new PropTypeError('Property `' + propFullName + '` of component `' + componentName + '` has invalid PropType notation inside arrayOf.');
|
2730
|
+
}
|
2731
|
+
var propValue = props[propName];
|
2732
|
+
if (!Array.isArray(propValue)) {
|
2733
|
+
var locationName = ReactPropTypeLocationNames[location];
|
2734
|
+
var propType = getPropType(propValue);
|
2735
|
+
return new PropTypeError('Invalid ' + locationName + ' `' + propFullName + '` of type ' + ('`' + propType + '` supplied to `' + componentName + '`, expected an array.'));
|
2736
|
+
}
|
2737
|
+
for (var i = 0; i < propValue.length; i++) {
|
2738
|
+
var error = typeChecker(propValue, i, componentName, location, propFullName + '[' + i + ']', ReactPropTypesSecret);
|
2739
|
+
if (error instanceof Error) {
|
2740
|
+
return error;
|
2741
|
+
}
|
2742
|
+
}
|
2743
|
+
return null;
|
2744
|
+
}
|
2745
|
+
return createChainableTypeChecker(validate);
|
2746
|
+
}
|
2747
|
+
|
2748
|
+
function createElementTypeChecker() {
|
2749
|
+
function validate(props, propName, componentName, location, propFullName) {
|
2750
|
+
var propValue = props[propName];
|
2751
|
+
if (!ReactElement.isValidElement(propValue)) {
|
2752
|
+
var locationName = ReactPropTypeLocationNames[location];
|
2753
|
+
var propType = getPropType(propValue);
|
2754
|
+
return new PropTypeError('Invalid ' + locationName + ' `' + propFullName + '` of type ' + ('`' + propType + '` supplied to `' + componentName + '`, expected a single ReactElement.'));
|
2755
|
+
}
|
2756
|
+
return null;
|
2757
|
+
}
|
2758
|
+
return createChainableTypeChecker(validate);
|
2759
|
+
}
|
2760
|
+
|
2761
|
+
function createInstanceTypeChecker(expectedClass) {
|
2762
|
+
function validate(props, propName, componentName, location, propFullName) {
|
2763
|
+
if (!(props[propName] instanceof expectedClass)) {
|
2764
|
+
var locationName = ReactPropTypeLocationNames[location];
|
2765
|
+
var expectedClassName = expectedClass.name || ANONYMOUS;
|
2766
|
+
var actualClassName = getClassName(props[propName]);
|
2767
|
+
return new PropTypeError('Invalid ' + locationName + ' `' + propFullName + '` of type ' + ('`' + actualClassName + '` supplied to `' + componentName + '`, expected ') + ('instance of `' + expectedClassName + '`.'));
|
2768
|
+
}
|
2769
|
+
return null;
|
2770
|
+
}
|
2771
|
+
return createChainableTypeChecker(validate);
|
2772
|
+
}
|
2773
|
+
|
2774
|
+
function createEnumTypeChecker(expectedValues) {
|
2775
|
+
if (!Array.isArray(expectedValues)) {
|
2776
|
+
"development" !== 'production' ? warning(false, 'Invalid argument supplied to oneOf, expected an instance of array.') : void 0;
|
2777
|
+
return emptyFunction.thatReturnsNull;
|
2778
|
+
}
|
2779
|
+
|
2780
|
+
function validate(props, propName, componentName, location, propFullName) {
|
2781
|
+
var propValue = props[propName];
|
2782
|
+
for (var i = 0; i < expectedValues.length; i++) {
|
2783
|
+
if (is(propValue, expectedValues[i])) {
|
2784
|
+
return null;
|
2785
|
+
}
|
2786
|
+
}
|
2787
|
+
|
2788
|
+
var locationName = ReactPropTypeLocationNames[location];
|
2789
|
+
var valuesString = JSON.stringify(expectedValues);
|
2790
|
+
return new PropTypeError('Invalid ' + locationName + ' `' + propFullName + '` of value `' + propValue + '` ' + ('supplied to `' + componentName + '`, expected one of ' + valuesString + '.'));
|
2791
|
+
}
|
2792
|
+
return createChainableTypeChecker(validate);
|
2793
|
+
}
|
2794
|
+
|
2795
|
+
function createObjectOfTypeChecker(typeChecker) {
|
2796
|
+
function validate(props, propName, componentName, location, propFullName) {
|
2797
|
+
if (typeof typeChecker !== 'function') {
|
2798
|
+
return new PropTypeError('Property `' + propFullName + '` of component `' + componentName + '` has invalid PropType notation inside objectOf.');
|
2799
|
+
}
|
2800
|
+
var propValue = props[propName];
|
2801
|
+
var propType = getPropType(propValue);
|
2802
|
+
if (propType !== 'object') {
|
2803
|
+
var locationName = ReactPropTypeLocationNames[location];
|
2804
|
+
return new PropTypeError('Invalid ' + locationName + ' `' + propFullName + '` of type ' + ('`' + propType + '` supplied to `' + componentName + '`, expected an object.'));
|
2805
|
+
}
|
2806
|
+
for (var key in propValue) {
|
2807
|
+
if (propValue.hasOwnProperty(key)) {
|
2808
|
+
var error = typeChecker(propValue, key, componentName, location, propFullName + '.' + key, ReactPropTypesSecret);
|
2809
|
+
if (error instanceof Error) {
|
2810
|
+
return error;
|
2811
|
+
}
|
2812
|
+
}
|
2813
|
+
}
|
2814
|
+
return null;
|
2815
|
+
}
|
2816
|
+
return createChainableTypeChecker(validate);
|
2817
|
+
}
|
2818
|
+
|
2819
|
+
function createUnionTypeChecker(arrayOfTypeCheckers) {
|
2820
|
+
if (!Array.isArray(arrayOfTypeCheckers)) {
|
2821
|
+
"development" !== 'production' ? warning(false, 'Invalid argument supplied to oneOfType, expected an instance of array.') : void 0;
|
2822
|
+
return emptyFunction.thatReturnsNull;
|
2823
|
+
}
|
2824
|
+
|
2825
|
+
function validate(props, propName, componentName, location, propFullName) {
|
2826
|
+
for (var i = 0; i < arrayOfTypeCheckers.length; i++) {
|
2827
|
+
var checker = arrayOfTypeCheckers[i];
|
2828
|
+
if (checker(props, propName, componentName, location, propFullName, ReactPropTypesSecret) == null) {
|
2829
|
+
return null;
|
2830
|
+
}
|
2831
|
+
}
|
2832
|
+
|
2833
|
+
var locationName = ReactPropTypeLocationNames[location];
|
2834
|
+
return new PropTypeError('Invalid ' + locationName + ' `' + propFullName + '` supplied to ' + ('`' + componentName + '`.'));
|
2835
|
+
}
|
2836
|
+
return createChainableTypeChecker(validate);
|
2837
|
+
}
|
2838
|
+
|
2839
|
+
function createNodeChecker() {
|
2840
|
+
function validate(props, propName, componentName, location, propFullName) {
|
2841
|
+
if (!isNode(props[propName])) {
|
2842
|
+
var locationName = ReactPropTypeLocationNames[location];
|
2843
|
+
return new PropTypeError('Invalid ' + locationName + ' `' + propFullName + '` supplied to ' + ('`' + componentName + '`, expected a ReactNode.'));
|
2844
|
+
}
|
2845
|
+
return null;
|
2846
|
+
}
|
2847
|
+
return createChainableTypeChecker(validate);
|
2848
|
+
}
|
2849
|
+
|
2850
|
+
function createShapeTypeChecker(shapeTypes) {
|
2851
|
+
function validate(props, propName, componentName, location, propFullName) {
|
2852
|
+
var propValue = props[propName];
|
2853
|
+
var propType = getPropType(propValue);
|
2854
|
+
if (propType !== 'object') {
|
2855
|
+
var locationName = ReactPropTypeLocationNames[location];
|
2856
|
+
return new PropTypeError('Invalid ' + locationName + ' `' + propFullName + '` of type `' + propType + '` ' + ('supplied to `' + componentName + '`, expected `object`.'));
|
2857
|
+
}
|
2858
|
+
for (var key in shapeTypes) {
|
2859
|
+
var checker = shapeTypes[key];
|
2860
|
+
if (!checker) {
|
2861
|
+
continue;
|
2862
|
+
}
|
2863
|
+
var error = checker(propValue, key, componentName, location, propFullName + '.' + key, ReactPropTypesSecret);
|
2864
|
+
if (error) {
|
2865
|
+
return error;
|
2866
|
+
}
|
2867
|
+
}
|
2868
|
+
return null;
|
2869
|
+
}
|
2870
|
+
return createChainableTypeChecker(validate);
|
2871
|
+
}
|
2872
|
+
|
2873
|
+
function isNode(propValue) {
|
2874
|
+
switch (typeof propValue) {
|
2875
|
+
case 'number':
|
2876
|
+
case 'string':
|
2877
|
+
case 'undefined':
|
2878
|
+
return true;
|
2879
|
+
case 'boolean':
|
2880
|
+
return !propValue;
|
2881
|
+
case 'object':
|
2882
|
+
if (Array.isArray(propValue)) {
|
2883
|
+
return propValue.every(isNode);
|
2884
|
+
}
|
2885
|
+
if (propValue === null || ReactElement.isValidElement(propValue)) {
|
2886
|
+
return true;
|
2887
|
+
}
|
2888
|
+
|
2889
|
+
var iteratorFn = getIteratorFn(propValue);
|
2890
|
+
if (iteratorFn) {
|
2891
|
+
var iterator = iteratorFn.call(propValue);
|
2892
|
+
var step;
|
2893
|
+
if (iteratorFn !== propValue.entries) {
|
2894
|
+
while (!(step = iterator.next()).done) {
|
2895
|
+
if (!isNode(step.value)) {
|
2896
|
+
return false;
|
2897
|
+
}
|
2898
|
+
}
|
2899
|
+
} else {
|
2900
|
+
// Iterator will provide entry [k,v] tuples rather than values.
|
2901
|
+
while (!(step = iterator.next()).done) {
|
2902
|
+
var entry = step.value;
|
2903
|
+
if (entry) {
|
2904
|
+
if (!isNode(entry[1])) {
|
2905
|
+
return false;
|
2906
|
+
}
|
2907
|
+
}
|
2908
|
+
}
|
2909
|
+
}
|
2910
|
+
} else {
|
2911
|
+
return false;
|
2912
|
+
}
|
2913
|
+
|
2914
|
+
return true;
|
2915
|
+
default:
|
2916
|
+
return false;
|
2917
|
+
}
|
2918
|
+
}
|
2919
|
+
|
2920
|
+
function isSymbol(propType, propValue) {
|
2921
|
+
// Native Symbol.
|
2922
|
+
if (propType === 'symbol') {
|
2923
|
+
return true;
|
2924
|
+
}
|
2925
|
+
|
2926
|
+
// 19.4.3.5 Symbol.prototype[@@toStringTag] === 'Symbol'
|
2927
|
+
if (propValue['@@toStringTag'] === 'Symbol') {
|
2928
|
+
return true;
|
2929
|
+
}
|
2930
|
+
|
2931
|
+
// Fallback for non-spec compliant Symbols which are polyfilled.
|
2932
|
+
if (typeof Symbol === 'function' && propValue instanceof Symbol) {
|
2933
|
+
return true;
|
2934
|
+
}
|
2935
|
+
|
2936
|
+
return false;
|
2937
|
+
}
|
2938
|
+
|
2939
|
+
// Equivalent of `typeof` but with special handling for array and regexp.
|
2940
|
+
function getPropType(propValue) {
|
2941
|
+
var propType = typeof propValue;
|
2942
|
+
if (Array.isArray(propValue)) {
|
2943
|
+
return 'array';
|
2944
|
+
}
|
2945
|
+
if (propValue instanceof RegExp) {
|
2946
|
+
// Old webkits (at least until Android 4.0) return 'function' rather than
|
2947
|
+
// 'object' for typeof a RegExp. We'll normalize this here so that /bla/
|
2948
|
+
// passes PropTypes.object.
|
2949
|
+
return 'object';
|
2950
|
+
}
|
2951
|
+
if (isSymbol(propType, propValue)) {
|
2952
|
+
return 'symbol';
|
2953
|
+
}
|
2954
|
+
return propType;
|
2955
|
+
}
|
2956
|
+
|
2957
|
+
// This handles more types than `getPropType`. Only used for error messages.
|
2958
|
+
// See `createPrimitiveTypeChecker`.
|
2959
|
+
function getPreciseType(propValue) {
|
2960
|
+
var propType = getPropType(propValue);
|
2961
|
+
if (propType === 'object') {
|
2962
|
+
if (propValue instanceof Date) {
|
2963
|
+
return 'date';
|
2964
|
+
} else if (propValue instanceof RegExp) {
|
2965
|
+
return 'regexp';
|
2966
|
+
}
|
2967
|
+
}
|
2968
|
+
return propType;
|
2969
|
+
}
|
2970
|
+
|
2971
|
+
// Returns class name of the object, if any.
|
2972
|
+
function getClassName(propValue) {
|
2973
|
+
if (!propValue.constructor || !propValue.constructor.name) {
|
2974
|
+
return ANONYMOUS;
|
2975
|
+
}
|
2976
|
+
return propValue.constructor.name;
|
2977
|
+
}
|
2978
|
+
|
2979
|
+
module.exports = ReactPropTypes;
|
2980
|
+
},{"10":10,"14":14,"16":16,"22":22,"26":26,"29":29}],16:[function(_dereq_,module,exports){
|
2981
|
+
/**
|
2982
|
+
* Copyright 2013-present, Facebook, Inc.
|
2983
|
+
* All rights reserved.
|
2984
|
+
*
|
2985
|
+
* This source code is licensed under the BSD-style license found in the
|
2986
|
+
* LICENSE file in the root directory of this source tree. An additional grant
|
2987
|
+
* of patent rights can be found in the PATENTS file in the same directory.
|
2988
|
+
*
|
2989
|
+
*
|
2990
|
+
*/
|
2991
|
+
|
2992
|
+
'use strict';
|
2993
|
+
|
2994
|
+
var ReactPropTypesSecret = 'SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED';
|
2995
|
+
|
2996
|
+
module.exports = ReactPropTypesSecret;
|
2997
|
+
},{}],17:[function(_dereq_,module,exports){
|
2998
|
+
/**
|
2999
|
+
* Copyright 2013-present, Facebook, Inc.
|
3000
|
+
* All rights reserved.
|
3001
|
+
*
|
3002
|
+
* This source code is licensed under the BSD-style license found in the
|
3003
|
+
* LICENSE file in the root directory of this source tree. An additional grant
|
3004
|
+
* of patent rights can be found in the PATENTS file in the same directory.
|
3005
|
+
*
|
3006
|
+
*/
|
3007
|
+
|
3008
|
+
'use strict';
|
3009
|
+
|
3010
|
+
var _assign = _dereq_(30);
|
3011
|
+
|
3012
|
+
var ReactComponent = _dereq_(6);
|
3013
|
+
var ReactNoopUpdateQueue = _dereq_(13);
|
3014
|
+
|
3015
|
+
var emptyObject = _dereq_(27);
|
3016
|
+
|
3017
|
+
/**
|
3018
|
+
* Base class helpers for the updating state of a component.
|
3019
|
+
*/
|
3020
|
+
function ReactPureComponent(props, context, updater) {
|
3021
|
+
// Duplicated from ReactComponent.
|
3022
|
+
this.props = props;
|
3023
|
+
this.context = context;
|
3024
|
+
this.refs = emptyObject;
|
3025
|
+
// We initialize the default updater but the real one gets injected by the
|
3026
|
+
// renderer.
|
3027
|
+
this.updater = updater || ReactNoopUpdateQueue;
|
3028
|
+
}
|
3029
|
+
|
3030
|
+
function ComponentDummy() {}
|
3031
|
+
ComponentDummy.prototype = ReactComponent.prototype;
|
3032
|
+
ReactPureComponent.prototype = new ComponentDummy();
|
3033
|
+
ReactPureComponent.prototype.constructor = ReactPureComponent;
|
3034
|
+
// Avoid an extra prototype jump for these methods.
|
3035
|
+
_assign(ReactPureComponent.prototype, ReactComponent.prototype);
|
3036
|
+
ReactPureComponent.prototype.isPureReactComponent = true;
|
3037
|
+
|
3038
|
+
module.exports = ReactPureComponent;
|
3039
|
+
},{"13":13,"27":27,"30":30,"6":6}],18:[function(_dereq_,module,exports){
|
3040
|
+
/**
|
3041
|
+
* Copyright 2013-present, Facebook, Inc.
|
3042
|
+
* All rights reserved.
|
3043
|
+
*
|
3044
|
+
* This source code is licensed under the BSD-style license found in the
|
3045
|
+
* LICENSE file in the root directory of this source tree. An additional grant
|
3046
|
+
* of patent rights can be found in the PATENTS file in the same directory.
|
3047
|
+
*
|
3048
|
+
*/
|
3049
|
+
|
3050
|
+
'use strict';
|
3051
|
+
|
3052
|
+
var _assign = _dereq_(30);
|
3053
|
+
|
3054
|
+
var React = _dereq_(3);
|
3055
|
+
|
3056
|
+
// `version` will be added here by the React module.
|
3057
|
+
var ReactUMDEntry = _assign({
|
3058
|
+
__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED: {
|
3059
|
+
ReactCurrentOwner: _dereq_(8)
|
3060
|
+
}
|
3061
|
+
}, React);
|
3062
|
+
|
3063
|
+
if ("development" !== 'production') {
|
3064
|
+
_assign(ReactUMDEntry.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED, {
|
3065
|
+
// ReactComponentTreeHook should not be included in production.
|
3066
|
+
ReactComponentTreeHook: _dereq_(7)
|
3067
|
+
});
|
3068
|
+
}
|
3069
|
+
|
3070
|
+
module.exports = ReactUMDEntry;
|
3071
|
+
},{"3":3,"30":30,"7":7,"8":8}],19:[function(_dereq_,module,exports){
|
3072
|
+
/**
|
3073
|
+
* Copyright 2013-present, Facebook, Inc.
|
3074
|
+
* All rights reserved.
|
3075
|
+
*
|
3076
|
+
* This source code is licensed under the BSD-style license found in the
|
3077
|
+
* LICENSE file in the root directory of this source tree. An additional grant
|
3078
|
+
* of patent rights can be found in the PATENTS file in the same directory.
|
3079
|
+
*
|
3080
|
+
*/
|
3081
|
+
|
3082
|
+
'use strict';
|
3083
|
+
|
3084
|
+
module.exports = '15.4.1';
|
3085
|
+
},{}],20:[function(_dereq_,module,exports){
|
3086
|
+
/**
|
3087
|
+
* Copyright 2013-present, Facebook, Inc.
|
3088
|
+
* All rights reserved.
|
3089
|
+
*
|
3090
|
+
* This source code is licensed under the BSD-style license found in the
|
3091
|
+
* LICENSE file in the root directory of this source tree. An additional grant
|
3092
|
+
* of patent rights can be found in the PATENTS file in the same directory.
|
3093
|
+
*
|
3094
|
+
*
|
3095
|
+
*/
|
3096
|
+
|
3097
|
+
'use strict';
|
3098
|
+
|
3099
|
+
var canDefineProperty = false;
|
3100
|
+
if ("development" !== 'production') {
|
3101
|
+
try {
|
3102
|
+
// $FlowFixMe https://github.com/facebook/flow/issues/285
|
3103
|
+
Object.defineProperty({}, 'x', { get: function () {} });
|
3104
|
+
canDefineProperty = true;
|
3105
|
+
} catch (x) {
|
3106
|
+
// IE will fail on defineProperty
|
3107
|
+
}
|
3108
|
+
}
|
3109
|
+
|
3110
|
+
module.exports = canDefineProperty;
|
3111
|
+
},{}],21:[function(_dereq_,module,exports){
|
3112
|
+
(function (process){
|
3113
|
+
/**
|
3114
|
+
* Copyright 2013-present, Facebook, Inc.
|
3115
|
+
* All rights reserved.
|
3116
|
+
*
|
3117
|
+
* This source code is licensed under the BSD-style license found in the
|
3118
|
+
* LICENSE file in the root directory of this source tree. An additional grant
|
3119
|
+
* of patent rights can be found in the PATENTS file in the same directory.
|
3120
|
+
*
|
3121
|
+
*/
|
3122
|
+
|
3123
|
+
'use strict';
|
3124
|
+
|
3125
|
+
var _prodInvariant = _dereq_(24);
|
3126
|
+
|
3127
|
+
var ReactPropTypeLocationNames = _dereq_(14);
|
3128
|
+
var ReactPropTypesSecret = _dereq_(16);
|
3129
|
+
|
3130
|
+
var invariant = _dereq_(28);
|
3131
|
+
var warning = _dereq_(29);
|
3132
|
+
|
3133
|
+
var ReactComponentTreeHook;
|
3134
|
+
|
3135
|
+
if (typeof process !== 'undefined' && process.env && "development" === 'test') {
|
3136
|
+
// Temporary hack.
|
3137
|
+
// Inline requires don't work well with Jest:
|
3138
|
+
// https://github.com/facebook/react/issues/7240
|
3139
|
+
// Remove the inline requires when we don't need them anymore:
|
3140
|
+
// https://github.com/facebook/react/pull/7178
|
3141
|
+
ReactComponentTreeHook = _dereq_(7);
|
3142
|
+
}
|
3143
|
+
|
3144
|
+
var loggedTypeFailures = {};
|
3145
|
+
|
3146
|
+
/**
|
3147
|
+
* Assert that the values match with the type specs.
|
3148
|
+
* Error messages are memorized and will only be shown once.
|
3149
|
+
*
|
3150
|
+
* @param {object} typeSpecs Map of name to a ReactPropType
|
3151
|
+
* @param {object} values Runtime values that need to be type-checked
|
3152
|
+
* @param {string} location e.g. "prop", "context", "child context"
|
3153
|
+
* @param {string} componentName Name of the component for error messages.
|
3154
|
+
* @param {?object} element The React element that is being type-checked
|
3155
|
+
* @param {?number} debugID The React component instance that is being type-checked
|
3156
|
+
* @private
|
3157
|
+
*/
|
3158
|
+
function checkReactTypeSpec(typeSpecs, values, location, componentName, element, debugID) {
|
3159
|
+
for (var typeSpecName in typeSpecs) {
|
3160
|
+
if (typeSpecs.hasOwnProperty(typeSpecName)) {
|
3161
|
+
var error;
|
3162
|
+
// Prop type validation may throw. In case they do, we don't want to
|
3163
|
+
// fail the render phase where it didn't fail before. So we log it.
|
3164
|
+
// After these have been cleaned up, we'll let them throw.
|
3165
|
+
try {
|
3166
|
+
// This is intentionally an invariant that gets caught. It's the same
|
3167
|
+
// behavior as without this statement except with a better message.
|
3168
|
+
!(typeof typeSpecs[typeSpecName] === 'function') ? "development" !== 'production' ? invariant(false, '%s: %s type `%s` is invalid; it must be a function, usually from React.PropTypes.', componentName || 'React class', ReactPropTypeLocationNames[location], typeSpecName) : _prodInvariant('84', componentName || 'React class', ReactPropTypeLocationNames[location], typeSpecName) : void 0;
|
3169
|
+
error = typeSpecs[typeSpecName](values, typeSpecName, componentName, location, null, ReactPropTypesSecret);
|
3170
|
+
} catch (ex) {
|
3171
|
+
error = ex;
|
3172
|
+
}
|
3173
|
+
"development" !== 'production' ? warning(!error || error instanceof Error, '%s: type specification of %s `%s` is invalid; the type checker ' + 'function must return `null` or an `Error` but returned a %s. ' + 'You may have forgotten to pass an argument to the type checker ' + 'creator (arrayOf, instanceOf, objectOf, oneOf, oneOfType, and ' + 'shape all require an argument).', componentName || 'React class', ReactPropTypeLocationNames[location], typeSpecName, typeof error) : void 0;
|
3174
|
+
if (error instanceof Error && !(error.message in loggedTypeFailures)) {
|
3175
|
+
// Only monitor this failure once because there tends to be a lot of the
|
3176
|
+
// same error.
|
3177
|
+
loggedTypeFailures[error.message] = true;
|
3178
|
+
|
3179
|
+
var componentStackInfo = '';
|
3180
|
+
|
3181
|
+
if ("development" !== 'production') {
|
3182
|
+
if (!ReactComponentTreeHook) {
|
3183
|
+
ReactComponentTreeHook = _dereq_(7);
|
3184
|
+
}
|
3185
|
+
if (debugID !== null) {
|
3186
|
+
componentStackInfo = ReactComponentTreeHook.getStackAddendumByID(debugID);
|
3187
|
+
} else if (element !== null) {
|
3188
|
+
componentStackInfo = ReactComponentTreeHook.getCurrentStackAddendum(element);
|
3189
|
+
}
|
3190
|
+
}
|
3191
|
+
|
3192
|
+
"development" !== 'production' ? warning(false, 'Failed %s type: %s%s', location, error.message, componentStackInfo) : void 0;
|
3193
|
+
}
|
3194
|
+
}
|
3195
|
+
}
|
3196
|
+
}
|
3197
|
+
|
3198
|
+
module.exports = checkReactTypeSpec;
|
3199
|
+
}).call(this,undefined)
|
3200
|
+
},{"14":14,"16":16,"24":24,"28":28,"29":29,"7":7}],22:[function(_dereq_,module,exports){
|
3201
|
+
/**
|
3202
|
+
* Copyright 2013-present, Facebook, Inc.
|
3203
|
+
* All rights reserved.
|
3204
|
+
*
|
3205
|
+
* This source code is licensed under the BSD-style license found in the
|
3206
|
+
* LICENSE file in the root directory of this source tree. An additional grant
|
3207
|
+
* of patent rights can be found in the PATENTS file in the same directory.
|
3208
|
+
*
|
3209
|
+
*
|
3210
|
+
*/
|
3211
|
+
|
3212
|
+
'use strict';
|
3213
|
+
|
3214
|
+
/* global Symbol */
|
3215
|
+
|
3216
|
+
var ITERATOR_SYMBOL = typeof Symbol === 'function' && Symbol.iterator;
|
3217
|
+
var FAUX_ITERATOR_SYMBOL = '@@iterator'; // Before Symbol spec.
|
3218
|
+
|
3219
|
+
/**
|
3220
|
+
* Returns the iterator method function contained on the iterable object.
|
3221
|
+
*
|
3222
|
+
* Be sure to invoke the function with the iterable as context:
|
3223
|
+
*
|
3224
|
+
* var iteratorFn = getIteratorFn(myIterable);
|
3225
|
+
* if (iteratorFn) {
|
3226
|
+
* var iterator = iteratorFn.call(myIterable);
|
3227
|
+
* ...
|
3228
|
+
* }
|
3229
|
+
*
|
3230
|
+
* @param {?object} maybeIterable
|
3231
|
+
* @return {?function}
|
3232
|
+
*/
|
3233
|
+
function getIteratorFn(maybeIterable) {
|
3234
|
+
var iteratorFn = maybeIterable && (ITERATOR_SYMBOL && maybeIterable[ITERATOR_SYMBOL] || maybeIterable[FAUX_ITERATOR_SYMBOL]);
|
3235
|
+
if (typeof iteratorFn === 'function') {
|
3236
|
+
return iteratorFn;
|
3237
|
+
}
|
3238
|
+
}
|
3239
|
+
|
3240
|
+
module.exports = getIteratorFn;
|
3241
|
+
},{}],23:[function(_dereq_,module,exports){
|
3242
|
+
/**
|
3243
|
+
* Copyright 2013-present, Facebook, Inc.
|
3244
|
+
* All rights reserved.
|
3245
|
+
*
|
3246
|
+
* This source code is licensed under the BSD-style license found in the
|
3247
|
+
* LICENSE file in the root directory of this source tree. An additional grant
|
3248
|
+
* of patent rights can be found in the PATENTS file in the same directory.
|
3249
|
+
*
|
3250
|
+
*/
|
3251
|
+
'use strict';
|
3252
|
+
|
3253
|
+
var _prodInvariant = _dereq_(24);
|
3254
|
+
|
3255
|
+
var ReactElement = _dereq_(10);
|
3256
|
+
|
3257
|
+
var invariant = _dereq_(28);
|
3258
|
+
|
3259
|
+
/**
|
3260
|
+
* Returns the first child in a collection of children and verifies that there
|
3261
|
+
* is only one child in the collection.
|
3262
|
+
*
|
3263
|
+
* See https://facebook.github.io/react/docs/top-level-api.html#react.children.only
|
3264
|
+
*
|
3265
|
+
* The current implementation of this function assumes that a single child gets
|
3266
|
+
* passed without a wrapper, but the purpose of this helper function is to
|
3267
|
+
* abstract away the particular structure of children.
|
3268
|
+
*
|
3269
|
+
* @param {?object} children Child collection structure.
|
3270
|
+
* @return {ReactElement} The first and only `ReactElement` contained in the
|
3271
|
+
* structure.
|
3272
|
+
*/
|
3273
|
+
function onlyChild(children) {
|
3274
|
+
!ReactElement.isValidElement(children) ? "development" !== 'production' ? invariant(false, 'React.Children.only expected to receive a single React element child.') : _prodInvariant('143') : void 0;
|
3275
|
+
return children;
|
3276
|
+
}
|
3277
|
+
|
3278
|
+
module.exports = onlyChild;
|
3279
|
+
},{"10":10,"24":24,"28":28}],24:[function(_dereq_,module,exports){
|
3280
|
+
/**
|
3281
|
+
* Copyright (c) 2013-present, Facebook, Inc.
|
3282
|
+
* All rights reserved.
|
3283
|
+
*
|
3284
|
+
* This source code is licensed under the BSD-style license found in the
|
3285
|
+
* LICENSE file in the root directory of this source tree. An additional grant
|
3286
|
+
* of patent rights can be found in the PATENTS file in the same directory.
|
3287
|
+
*
|
3288
|
+
*
|
3289
|
+
*/
|
3290
|
+
'use strict';
|
3291
|
+
|
3292
|
+
/**
|
3293
|
+
* WARNING: DO NOT manually require this module.
|
3294
|
+
* This is a replacement for `invariant(...)` used by the error code system
|
3295
|
+
* and will _only_ be required by the corresponding babel pass.
|
3296
|
+
* It always throws.
|
3297
|
+
*/
|
3298
|
+
|
3299
|
+
function reactProdInvariant(code) {
|
3300
|
+
var argCount = arguments.length - 1;
|
3301
|
+
|
3302
|
+
var message = 'Minified React error #' + code + '; visit ' + 'http://facebook.github.io/react/docs/error-decoder.html?invariant=' + code;
|
3303
|
+
|
3304
|
+
for (var argIdx = 0; argIdx < argCount; argIdx++) {
|
3305
|
+
message += '&args[]=' + encodeURIComponent(arguments[argIdx + 1]);
|
3306
|
+
}
|
3307
|
+
|
3308
|
+
message += ' for the full message or use the non-minified dev environment' + ' for full errors and additional helpful warnings.';
|
3309
|
+
|
3310
|
+
var error = new Error(message);
|
3311
|
+
error.name = 'Invariant Violation';
|
3312
|
+
error.framesToPop = 1; // we don't care about reactProdInvariant's own frame
|
3313
|
+
|
3314
|
+
throw error;
|
3315
|
+
}
|
3316
|
+
|
3317
|
+
module.exports = reactProdInvariant;
|
3318
|
+
},{}],25:[function(_dereq_,module,exports){
|
3319
|
+
/**
|
3320
|
+
* Copyright 2013-present, Facebook, Inc.
|
3321
|
+
* All rights reserved.
|
3322
|
+
*
|
3323
|
+
* This source code is licensed under the BSD-style license found in the
|
3324
|
+
* LICENSE file in the root directory of this source tree. An additional grant
|
3325
|
+
* of patent rights can be found in the PATENTS file in the same directory.
|
3326
|
+
*
|
3327
|
+
*/
|
3328
|
+
|
3329
|
+
'use strict';
|
3330
|
+
|
3331
|
+
var _prodInvariant = _dereq_(24);
|
3332
|
+
|
3333
|
+
var ReactCurrentOwner = _dereq_(8);
|
3334
|
+
var REACT_ELEMENT_TYPE = _dereq_(11);
|
3335
|
+
|
3336
|
+
var getIteratorFn = _dereq_(22);
|
3337
|
+
var invariant = _dereq_(28);
|
3338
|
+
var KeyEscapeUtils = _dereq_(1);
|
3339
|
+
var warning = _dereq_(29);
|
3340
|
+
|
3341
|
+
var SEPARATOR = '.';
|
3342
|
+
var SUBSEPARATOR = ':';
|
3343
|
+
|
3344
|
+
/**
|
3345
|
+
* This is inlined from ReactElement since this file is shared between
|
3346
|
+
* isomorphic and renderers. We could extract this to a
|
3347
|
+
*
|
3348
|
+
*/
|
3349
|
+
|
3350
|
+
/**
|
3351
|
+
* TODO: Test that a single child and an array with one item have the same key
|
3352
|
+
* pattern.
|
3353
|
+
*/
|
3354
|
+
|
3355
|
+
var didWarnAboutMaps = false;
|
3356
|
+
|
3357
|
+
/**
|
3358
|
+
* Generate a key string that identifies a component within a set.
|
3359
|
+
*
|
3360
|
+
* @param {*} component A component that could contain a manual key.
|
3361
|
+
* @param {number} index Index that is used if a manual key is not provided.
|
3362
|
+
* @return {string}
|
3363
|
+
*/
|
3364
|
+
function getComponentKey(component, index) {
|
3365
|
+
// Do some typechecking here since we call this blindly. We want to ensure
|
3366
|
+
// that we don't block potential future ES APIs.
|
3367
|
+
if (component && typeof component === 'object' && component.key != null) {
|
3368
|
+
// Explicit key
|
3369
|
+
return KeyEscapeUtils.escape(component.key);
|
3370
|
+
}
|
3371
|
+
// Implicit key determined by the index in the set
|
3372
|
+
return index.toString(36);
|
3373
|
+
}
|
3374
|
+
|
3375
|
+
/**
|
3376
|
+
* @param {?*} children Children tree container.
|
3377
|
+
* @param {!string} nameSoFar Name of the key path so far.
|
3378
|
+
* @param {!function} callback Callback to invoke with each child found.
|
3379
|
+
* @param {?*} traverseContext Used to pass information throughout the traversal
|
3380
|
+
* process.
|
3381
|
+
* @return {!number} The number of children in this subtree.
|
3382
|
+
*/
|
3383
|
+
function traverseAllChildrenImpl(children, nameSoFar, callback, traverseContext) {
|
3384
|
+
var type = typeof children;
|
3385
|
+
|
3386
|
+
if (type === 'undefined' || type === 'boolean') {
|
3387
|
+
// All of the above are perceived as null.
|
3388
|
+
children = null;
|
3389
|
+
}
|
3390
|
+
|
3391
|
+
if (children === null || type === 'string' || type === 'number' ||
|
3392
|
+
// The following is inlined from ReactElement. This means we can optimize
|
3393
|
+
// some checks. React Fiber also inlines this logic for similar purposes.
|
3394
|
+
type === 'object' && children.$$typeof === REACT_ELEMENT_TYPE) {
|
3395
|
+
callback(traverseContext, children,
|
3396
|
+
// If it's the only child, treat the name as if it was wrapped in an array
|
3397
|
+
// so that it's consistent if the number of children grows.
|
3398
|
+
nameSoFar === '' ? SEPARATOR + getComponentKey(children, 0) : nameSoFar);
|
3399
|
+
return 1;
|
3400
|
+
}
|
3401
|
+
|
3402
|
+
var child;
|
3403
|
+
var nextName;
|
3404
|
+
var subtreeCount = 0; // Count of children found in the current subtree.
|
3405
|
+
var nextNamePrefix = nameSoFar === '' ? SEPARATOR : nameSoFar + SUBSEPARATOR;
|
3406
|
+
|
3407
|
+
if (Array.isArray(children)) {
|
3408
|
+
for (var i = 0; i < children.length; i++) {
|
3409
|
+
child = children[i];
|
3410
|
+
nextName = nextNamePrefix + getComponentKey(child, i);
|
3411
|
+
subtreeCount += traverseAllChildrenImpl(child, nextName, callback, traverseContext);
|
3412
|
+
}
|
3413
|
+
} else {
|
3414
|
+
var iteratorFn = getIteratorFn(children);
|
3415
|
+
if (iteratorFn) {
|
3416
|
+
var iterator = iteratorFn.call(children);
|
3417
|
+
var step;
|
3418
|
+
if (iteratorFn !== children.entries) {
|
3419
|
+
var ii = 0;
|
3420
|
+
while (!(step = iterator.next()).done) {
|
3421
|
+
child = step.value;
|
3422
|
+
nextName = nextNamePrefix + getComponentKey(child, ii++);
|
3423
|
+
subtreeCount += traverseAllChildrenImpl(child, nextName, callback, traverseContext);
|
3424
|
+
}
|
3425
|
+
} else {
|
3426
|
+
if ("development" !== 'production') {
|
3427
|
+
var mapsAsChildrenAddendum = '';
|
3428
|
+
if (ReactCurrentOwner.current) {
|
3429
|
+
var mapsAsChildrenOwnerName = ReactCurrentOwner.current.getName();
|
3430
|
+
if (mapsAsChildrenOwnerName) {
|
3431
|
+
mapsAsChildrenAddendum = ' Check the render method of `' + mapsAsChildrenOwnerName + '`.';
|
3432
|
+
}
|
3433
|
+
}
|
3434
|
+
"development" !== 'production' ? warning(didWarnAboutMaps, 'Using Maps as children is not yet fully supported. It is an ' + 'experimental feature that might be removed. Convert it to a ' + 'sequence / iterable of keyed ReactElements instead.%s', mapsAsChildrenAddendum) : void 0;
|
3435
|
+
didWarnAboutMaps = true;
|
3436
|
+
}
|
3437
|
+
// Iterator will provide entry [k,v] tuples rather than values.
|
3438
|
+
while (!(step = iterator.next()).done) {
|
3439
|
+
var entry = step.value;
|
3440
|
+
if (entry) {
|
3441
|
+
child = entry[1];
|
3442
|
+
nextName = nextNamePrefix + KeyEscapeUtils.escape(entry[0]) + SUBSEPARATOR + getComponentKey(child, 0);
|
3443
|
+
subtreeCount += traverseAllChildrenImpl(child, nextName, callback, traverseContext);
|
3444
|
+
}
|
3445
|
+
}
|
3446
|
+
}
|
3447
|
+
} else if (type === 'object') {
|
3448
|
+
var addendum = '';
|
3449
|
+
if ("development" !== 'production') {
|
3450
|
+
addendum = ' If you meant to render a collection of children, use an array ' + 'instead or wrap the object using createFragment(object) from the ' + 'React add-ons.';
|
3451
|
+
if (children._isReactElement) {
|
3452
|
+
addendum = ' It looks like you\'re using an element created by a different ' + 'version of React. Make sure to use only one copy of React.';
|
3453
|
+
}
|
3454
|
+
if (ReactCurrentOwner.current) {
|
3455
|
+
var name = ReactCurrentOwner.current.getName();
|
3456
|
+
if (name) {
|
3457
|
+
addendum += ' Check the render method of `' + name + '`.';
|
3458
|
+
}
|
3459
|
+
}
|
3460
|
+
}
|
3461
|
+
var childrenString = String(children);
|
3462
|
+
!false ? "development" !== 'production' ? invariant(false, 'Objects are not valid as a React child (found: %s).%s', childrenString === '[object Object]' ? 'object with keys {' + Object.keys(children).join(', ') + '}' : childrenString, addendum) : _prodInvariant('31', childrenString === '[object Object]' ? 'object with keys {' + Object.keys(children).join(', ') + '}' : childrenString, addendum) : void 0;
|
3463
|
+
}
|
3464
|
+
}
|
3465
|
+
|
3466
|
+
return subtreeCount;
|
3467
|
+
}
|
3468
|
+
|
3469
|
+
/**
|
3470
|
+
* Traverses children that are typically specified as `props.children`, but
|
3471
|
+
* might also be specified through attributes:
|
3472
|
+
*
|
3473
|
+
* - `traverseAllChildren(this.props.children, ...)`
|
3474
|
+
* - `traverseAllChildren(this.props.leftPanelChildren, ...)`
|
3475
|
+
*
|
3476
|
+
* The `traverseContext` is an optional argument that is passed through the
|
3477
|
+
* entire traversal. It can be used to store accumulations or anything else that
|
3478
|
+
* the callback might find relevant.
|
3479
|
+
*
|
3480
|
+
* @param {?*} children Children tree object.
|
3481
|
+
* @param {!function} callback To invoke upon traversing each child.
|
3482
|
+
* @param {?*} traverseContext Context for traversal.
|
3483
|
+
* @return {!number} The number of children in this subtree.
|
3484
|
+
*/
|
3485
|
+
function traverseAllChildren(children, callback, traverseContext) {
|
3486
|
+
if (children == null) {
|
3487
|
+
return 0;
|
3488
|
+
}
|
3489
|
+
|
3490
|
+
return traverseAllChildrenImpl(children, '', callback, traverseContext);
|
3491
|
+
}
|
3492
|
+
|
3493
|
+
module.exports = traverseAllChildren;
|
3494
|
+
},{"1":1,"11":11,"22":22,"24":24,"28":28,"29":29,"8":8}],26:[function(_dereq_,module,exports){
|
3495
|
+
"use strict";
|
3496
|
+
|
3497
|
+
/**
|
3498
|
+
* Copyright (c) 2013-present, Facebook, Inc.
|
3499
|
+
* All rights reserved.
|
3500
|
+
*
|
3501
|
+
* This source code is licensed under the BSD-style license found in the
|
3502
|
+
* LICENSE file in the root directory of this source tree. An additional grant
|
3503
|
+
* of patent rights can be found in the PATENTS file in the same directory.
|
3504
|
+
*
|
3505
|
+
*
|
3506
|
+
*/
|
3507
|
+
|
3508
|
+
function makeEmptyFunction(arg) {
|
3509
|
+
return function () {
|
3510
|
+
return arg;
|
3511
|
+
};
|
3512
|
+
}
|
3513
|
+
|
3514
|
+
/**
|
3515
|
+
* This function accepts and discards inputs; it has no side effects. This is
|
3516
|
+
* primarily useful idiomatically for overridable function endpoints which
|
3517
|
+
* always need to be callable, since JS lacks a null-call idiom ala Cocoa.
|
3518
|
+
*/
|
3519
|
+
var emptyFunction = function emptyFunction() {};
|
3520
|
+
|
3521
|
+
emptyFunction.thatReturns = makeEmptyFunction;
|
3522
|
+
emptyFunction.thatReturnsFalse = makeEmptyFunction(false);
|
3523
|
+
emptyFunction.thatReturnsTrue = makeEmptyFunction(true);
|
3524
|
+
emptyFunction.thatReturnsNull = makeEmptyFunction(null);
|
3525
|
+
emptyFunction.thatReturnsThis = function () {
|
3526
|
+
return this;
|
3527
|
+
};
|
3528
|
+
emptyFunction.thatReturnsArgument = function (arg) {
|
3529
|
+
return arg;
|
3530
|
+
};
|
3531
|
+
|
3532
|
+
module.exports = emptyFunction;
|
3533
|
+
},{}],27:[function(_dereq_,module,exports){
|
3534
|
+
/**
|
3535
|
+
* Copyright (c) 2013-present, Facebook, Inc.
|
3536
|
+
* All rights reserved.
|
3537
|
+
*
|
3538
|
+
* This source code is licensed under the BSD-style license found in the
|
3539
|
+
* LICENSE file in the root directory of this source tree. An additional grant
|
3540
|
+
* of patent rights can be found in the PATENTS file in the same directory.
|
3541
|
+
*
|
3542
|
+
*/
|
3543
|
+
|
3544
|
+
'use strict';
|
3545
|
+
|
3546
|
+
var emptyObject = {};
|
3547
|
+
|
3548
|
+
if ("development" !== 'production') {
|
3549
|
+
Object.freeze(emptyObject);
|
3550
|
+
}
|
3551
|
+
|
3552
|
+
module.exports = emptyObject;
|
3553
|
+
},{}],28:[function(_dereq_,module,exports){
|
3554
|
+
/**
|
3555
|
+
* Copyright (c) 2013-present, Facebook, Inc.
|
3556
|
+
* All rights reserved.
|
3557
|
+
*
|
3558
|
+
* This source code is licensed under the BSD-style license found in the
|
3559
|
+
* LICENSE file in the root directory of this source tree. An additional grant
|
3560
|
+
* of patent rights can be found in the PATENTS file in the same directory.
|
3561
|
+
*
|
3562
|
+
*/
|
3563
|
+
|
3564
|
+
'use strict';
|
3565
|
+
|
3566
|
+
/**
|
3567
|
+
* Use invariant() to assert state which your program assumes to be true.
|
3568
|
+
*
|
3569
|
+
* Provide sprintf-style format (only %s is supported) and arguments
|
3570
|
+
* to provide information about what broke and what you were
|
3571
|
+
* expecting.
|
3572
|
+
*
|
3573
|
+
* The invariant message will be stripped in production, but the invariant
|
3574
|
+
* will remain to ensure logic does not differ in production.
|
3575
|
+
*/
|
3576
|
+
|
3577
|
+
function invariant(condition, format, a, b, c, d, e, f) {
|
3578
|
+
if ("development" !== 'production') {
|
3579
|
+
if (format === undefined) {
|
3580
|
+
throw new Error('invariant requires an error message argument');
|
3581
|
+
}
|
3582
|
+
}
|
3583
|
+
|
3584
|
+
if (!condition) {
|
3585
|
+
var error;
|
3586
|
+
if (format === undefined) {
|
3587
|
+
error = new Error('Minified exception occurred; use the non-minified dev environment ' + 'for the full error message and additional helpful warnings.');
|
3588
|
+
} else {
|
3589
|
+
var args = [a, b, c, d, e, f];
|
3590
|
+
var argIndex = 0;
|
3591
|
+
error = new Error(format.replace(/%s/g, function () {
|
3592
|
+
return args[argIndex++];
|
3593
|
+
}));
|
3594
|
+
error.name = 'Invariant Violation';
|
3595
|
+
}
|
3596
|
+
|
3597
|
+
error.framesToPop = 1; // we don't care about invariant's own frame
|
3598
|
+
throw error;
|
3599
|
+
}
|
3600
|
+
}
|
3601
|
+
|
3602
|
+
module.exports = invariant;
|
3603
|
+
},{}],29:[function(_dereq_,module,exports){
|
3604
|
+
/**
|
3605
|
+
* Copyright 2014-2015, Facebook, Inc.
|
3606
|
+
* All rights reserved.
|
3607
|
+
*
|
3608
|
+
* This source code is licensed under the BSD-style license found in the
|
3609
|
+
* LICENSE file in the root directory of this source tree. An additional grant
|
3610
|
+
* of patent rights can be found in the PATENTS file in the same directory.
|
3611
|
+
*
|
3612
|
+
*/
|
3613
|
+
|
3614
|
+
'use strict';
|
3615
|
+
|
3616
|
+
var emptyFunction = _dereq_(26);
|
3617
|
+
|
3618
|
+
/**
|
3619
|
+
* Similar to invariant but only logs a warning if the condition is not met.
|
3620
|
+
* This can be used to log issues in development environments in critical
|
3621
|
+
* paths. Removing the logging code for production environments will keep the
|
3622
|
+
* same logic and follow the same code paths.
|
3623
|
+
*/
|
3624
|
+
|
3625
|
+
var warning = emptyFunction;
|
3626
|
+
|
3627
|
+
if ("development" !== 'production') {
|
3628
|
+
(function () {
|
3629
|
+
var printWarning = function printWarning(format) {
|
3630
|
+
for (var _len = arguments.length, args = Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {
|
3631
|
+
args[_key - 1] = arguments[_key];
|
3632
|
+
}
|
3633
|
+
|
3634
|
+
var argIndex = 0;
|
3635
|
+
var message = 'Warning: ' + format.replace(/%s/g, function () {
|
3636
|
+
return args[argIndex++];
|
3637
|
+
});
|
3638
|
+
if (typeof console !== 'undefined') {
|
3639
|
+
console.error(message);
|
3640
|
+
}
|
3641
|
+
try {
|
3642
|
+
// --- Welcome to debugging React ---
|
3643
|
+
// This error was thrown as a convenience so that you can use this stack
|
3644
|
+
// to find the callsite that caused this warning to fire.
|
3645
|
+
throw new Error(message);
|
3646
|
+
} catch (x) {}
|
3647
|
+
};
|
3648
|
+
|
3649
|
+
warning = function warning(condition, format) {
|
3650
|
+
if (format === undefined) {
|
3651
|
+
throw new Error('`warning(condition, format, ...args)` requires a warning ' + 'message argument');
|
3652
|
+
}
|
3653
|
+
|
3654
|
+
if (format.indexOf('Failed Composite propType: ') === 0) {
|
3655
|
+
return; // Ignore CompositeComponent proptype check.
|
3656
|
+
}
|
3657
|
+
|
3658
|
+
if (!condition) {
|
3659
|
+
for (var _len2 = arguments.length, args = Array(_len2 > 2 ? _len2 - 2 : 0), _key2 = 2; _key2 < _len2; _key2++) {
|
3660
|
+
args[_key2 - 2] = arguments[_key2];
|
3661
|
+
}
|
3662
|
+
|
3663
|
+
printWarning.apply(undefined, [format].concat(args));
|
3664
|
+
}
|
3665
|
+
};
|
3666
|
+
})();
|
3667
|
+
}
|
3668
|
+
|
3669
|
+
module.exports = warning;
|
3670
|
+
},{"26":26}],30:[function(_dereq_,module,exports){
|
3671
|
+
'use strict';
|
3672
|
+
/* eslint-disable no-unused-vars */
|
3673
|
+
var hasOwnProperty = Object.prototype.hasOwnProperty;
|
3674
|
+
var propIsEnumerable = Object.prototype.propertyIsEnumerable;
|
3675
|
+
|
3676
|
+
function toObject(val) {
|
3677
|
+
if (val === null || val === undefined) {
|
3678
|
+
throw new TypeError('Object.assign cannot be called with null or undefined');
|
3679
|
+
}
|
3680
|
+
|
3681
|
+
return Object(val);
|
3682
|
+
}
|
3683
|
+
|
3684
|
+
function shouldUseNative() {
|
3685
|
+
try {
|
3686
|
+
if (!Object.assign) {
|
3687
|
+
return false;
|
3688
|
+
}
|
3689
|
+
|
3690
|
+
// Detect buggy property enumeration order in older V8 versions.
|
3691
|
+
|
3692
|
+
// https://bugs.chromium.org/p/v8/issues/detail?id=4118
|
3693
|
+
var test1 = new String('abc'); // eslint-disable-line
|
3694
|
+
test1[5] = 'de';
|
3695
|
+
if (Object.getOwnPropertyNames(test1)[0] === '5') {
|
3696
|
+
return false;
|
3697
|
+
}
|
3698
|
+
|
3699
|
+
// https://bugs.chromium.org/p/v8/issues/detail?id=3056
|
3700
|
+
var test2 = {};
|
3701
|
+
for (var i = 0; i < 10; i++) {
|
3702
|
+
test2['_' + String.fromCharCode(i)] = i;
|
3703
|
+
}
|
3704
|
+
var order2 = Object.getOwnPropertyNames(test2).map(function (n) {
|
3705
|
+
return test2[n];
|
3706
|
+
});
|
3707
|
+
if (order2.join('') !== '0123456789') {
|
3708
|
+
return false;
|
3709
|
+
}
|
3710
|
+
|
3711
|
+
// https://bugs.chromium.org/p/v8/issues/detail?id=3056
|
3712
|
+
var test3 = {};
|
3713
|
+
'abcdefghijklmnopqrst'.split('').forEach(function (letter) {
|
3714
|
+
test3[letter] = letter;
|
3715
|
+
});
|
3716
|
+
if (Object.keys(Object.assign({}, test3)).join('') !==
|
3717
|
+
'abcdefghijklmnopqrst') {
|
3718
|
+
return false;
|
3719
|
+
}
|
3720
|
+
|
3721
|
+
return true;
|
3722
|
+
} catch (e) {
|
3723
|
+
// We don't expect any of the above to throw, but better to be safe.
|
3724
|
+
return false;
|
3725
|
+
}
|
3726
|
+
}
|
3727
|
+
|
3728
|
+
module.exports = shouldUseNative() ? Object.assign : function (target, source) {
|
3729
|
+
var from;
|
3730
|
+
var to = toObject(target);
|
3731
|
+
var symbols;
|
3732
|
+
|
3733
|
+
for (var s = 1; s < arguments.length; s++) {
|
3734
|
+
from = Object(arguments[s]);
|
3735
|
+
|
3736
|
+
for (var key in from) {
|
3737
|
+
if (hasOwnProperty.call(from, key)) {
|
3738
|
+
to[key] = from[key];
|
3739
|
+
}
|
3740
|
+
}
|
3741
|
+
|
3742
|
+
if (Object.getOwnPropertySymbols) {
|
3743
|
+
symbols = Object.getOwnPropertySymbols(from);
|
3744
|
+
for (var i = 0; i < symbols.length; i++) {
|
3745
|
+
if (propIsEnumerable.call(from, symbols[i])) {
|
3746
|
+
to[symbols[i]] = from[symbols[i]];
|
3747
|
+
}
|
3748
|
+
}
|
3749
|
+
}
|
3750
|
+
}
|
3751
|
+
|
3752
|
+
return to;
|
3753
|
+
};
|
3754
|
+
|
3755
|
+
},{}]},{},[18])(18)
|
3756
|
+
});
|