react-webpacker 1.2.2 → 1.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/.gitignore +1 -0
- data/Gemfile.lock +1 -1
- data/README.md +45 -12
- data/lib/react-webpacker/version.rb +1 -1
- data/package.json +1 -1
- data/src/react-webpacker.js +2 -2
- metadata +2 -4
- data/test/__build__/packs/components/MyComponent.js +0 -2752
- data/test/__build__/packs/react-webpacker.js +0 -18292
@@ -1,2752 +0,0 @@
|
|
1
|
-
/******/ (function(modules) { // webpackBootstrap
|
2
|
-
/******/ // The module cache
|
3
|
-
/******/ var installedModules = {};
|
4
|
-
/******/
|
5
|
-
/******/ // The require function
|
6
|
-
/******/ function __webpack_require__(moduleId) {
|
7
|
-
/******/
|
8
|
-
/******/ // Check if module is in cache
|
9
|
-
/******/ if(installedModules[moduleId]) {
|
10
|
-
/******/ return installedModules[moduleId].exports;
|
11
|
-
/******/ }
|
12
|
-
/******/ // Create a new module (and put it into the cache)
|
13
|
-
/******/ var module = installedModules[moduleId] = {
|
14
|
-
/******/ i: moduleId,
|
15
|
-
/******/ l: false,
|
16
|
-
/******/ exports: {}
|
17
|
-
/******/ };
|
18
|
-
/******/
|
19
|
-
/******/ // Execute the module function
|
20
|
-
/******/ modules[moduleId].call(module.exports, module, module.exports, __webpack_require__);
|
21
|
-
/******/
|
22
|
-
/******/ // Flag the module as loaded
|
23
|
-
/******/ module.l = true;
|
24
|
-
/******/
|
25
|
-
/******/ // Return the exports of the module
|
26
|
-
/******/ return module.exports;
|
27
|
-
/******/ }
|
28
|
-
/******/
|
29
|
-
/******/
|
30
|
-
/******/ // expose the modules object (__webpack_modules__)
|
31
|
-
/******/ __webpack_require__.m = modules;
|
32
|
-
/******/
|
33
|
-
/******/ // expose the module cache
|
34
|
-
/******/ __webpack_require__.c = installedModules;
|
35
|
-
/******/
|
36
|
-
/******/ // define getter function for harmony exports
|
37
|
-
/******/ __webpack_require__.d = function(exports, name, getter) {
|
38
|
-
/******/ if(!__webpack_require__.o(exports, name)) {
|
39
|
-
/******/ Object.defineProperty(exports, name, {
|
40
|
-
/******/ configurable: false,
|
41
|
-
/******/ enumerable: true,
|
42
|
-
/******/ get: getter
|
43
|
-
/******/ });
|
44
|
-
/******/ }
|
45
|
-
/******/ };
|
46
|
-
/******/
|
47
|
-
/******/ // getDefaultExport function for compatibility with non-harmony modules
|
48
|
-
/******/ __webpack_require__.n = function(module) {
|
49
|
-
/******/ var getter = module && module.__esModule ?
|
50
|
-
/******/ function getDefault() { return module['default']; } :
|
51
|
-
/******/ function getModuleExports() { return module; };
|
52
|
-
/******/ __webpack_require__.d(getter, 'a', getter);
|
53
|
-
/******/ return getter;
|
54
|
-
/******/ };
|
55
|
-
/******/
|
56
|
-
/******/ // Object.prototype.hasOwnProperty.call
|
57
|
-
/******/ __webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); };
|
58
|
-
/******/
|
59
|
-
/******/ // __webpack_public_path__
|
60
|
-
/******/ __webpack_require__.p = "";
|
61
|
-
/******/
|
62
|
-
/******/ // Load entry module and return exports
|
63
|
-
/******/ return __webpack_require__(__webpack_require__.s = 28);
|
64
|
-
/******/ })
|
65
|
-
/************************************************************************/
|
66
|
-
/******/ ([
|
67
|
-
/* 0 */
|
68
|
-
/***/ (function(module, exports) {
|
69
|
-
|
70
|
-
// shim for using process in browser
|
71
|
-
var process = module.exports = {};
|
72
|
-
|
73
|
-
// cached from whatever global is present so that test runners that stub it
|
74
|
-
// don't break things. But we need to wrap it in a try catch in case it is
|
75
|
-
// wrapped in strict mode code which doesn't define any globals. It's inside a
|
76
|
-
// function because try/catches deoptimize in certain engines.
|
77
|
-
|
78
|
-
var cachedSetTimeout;
|
79
|
-
var cachedClearTimeout;
|
80
|
-
|
81
|
-
function defaultSetTimout() {
|
82
|
-
throw new Error('setTimeout has not been defined');
|
83
|
-
}
|
84
|
-
function defaultClearTimeout () {
|
85
|
-
throw new Error('clearTimeout has not been defined');
|
86
|
-
}
|
87
|
-
(function () {
|
88
|
-
try {
|
89
|
-
if (typeof setTimeout === 'function') {
|
90
|
-
cachedSetTimeout = setTimeout;
|
91
|
-
} else {
|
92
|
-
cachedSetTimeout = defaultSetTimout;
|
93
|
-
}
|
94
|
-
} catch (e) {
|
95
|
-
cachedSetTimeout = defaultSetTimout;
|
96
|
-
}
|
97
|
-
try {
|
98
|
-
if (typeof clearTimeout === 'function') {
|
99
|
-
cachedClearTimeout = clearTimeout;
|
100
|
-
} else {
|
101
|
-
cachedClearTimeout = defaultClearTimeout;
|
102
|
-
}
|
103
|
-
} catch (e) {
|
104
|
-
cachedClearTimeout = defaultClearTimeout;
|
105
|
-
}
|
106
|
-
} ())
|
107
|
-
function runTimeout(fun) {
|
108
|
-
if (cachedSetTimeout === setTimeout) {
|
109
|
-
//normal enviroments in sane situations
|
110
|
-
return setTimeout(fun, 0);
|
111
|
-
}
|
112
|
-
// if setTimeout wasn't available but was latter defined
|
113
|
-
if ((cachedSetTimeout === defaultSetTimout || !cachedSetTimeout) && setTimeout) {
|
114
|
-
cachedSetTimeout = setTimeout;
|
115
|
-
return setTimeout(fun, 0);
|
116
|
-
}
|
117
|
-
try {
|
118
|
-
// when when somebody has screwed with setTimeout but no I.E. maddness
|
119
|
-
return cachedSetTimeout(fun, 0);
|
120
|
-
} catch(e){
|
121
|
-
try {
|
122
|
-
// When we are in I.E. but the script has been evaled so I.E. doesn't trust the global object when called normally
|
123
|
-
return cachedSetTimeout.call(null, fun, 0);
|
124
|
-
} catch(e){
|
125
|
-
// same as above but when it's a version of I.E. that must have the global object for 'this', hopfully our context correct otherwise it will throw a global error
|
126
|
-
return cachedSetTimeout.call(this, fun, 0);
|
127
|
-
}
|
128
|
-
}
|
129
|
-
|
130
|
-
|
131
|
-
}
|
132
|
-
function runClearTimeout(marker) {
|
133
|
-
if (cachedClearTimeout === clearTimeout) {
|
134
|
-
//normal enviroments in sane situations
|
135
|
-
return clearTimeout(marker);
|
136
|
-
}
|
137
|
-
// if clearTimeout wasn't available but was latter defined
|
138
|
-
if ((cachedClearTimeout === defaultClearTimeout || !cachedClearTimeout) && clearTimeout) {
|
139
|
-
cachedClearTimeout = clearTimeout;
|
140
|
-
return clearTimeout(marker);
|
141
|
-
}
|
142
|
-
try {
|
143
|
-
// when when somebody has screwed with setTimeout but no I.E. maddness
|
144
|
-
return cachedClearTimeout(marker);
|
145
|
-
} catch (e){
|
146
|
-
try {
|
147
|
-
// When we are in I.E. but the script has been evaled so I.E. doesn't trust the global object when called normally
|
148
|
-
return cachedClearTimeout.call(null, marker);
|
149
|
-
} catch (e){
|
150
|
-
// same as above but when it's a version of I.E. that must have the global object for 'this', hopfully our context correct otherwise it will throw a global error.
|
151
|
-
// Some versions of I.E. have different rules for clearTimeout vs setTimeout
|
152
|
-
return cachedClearTimeout.call(this, marker);
|
153
|
-
}
|
154
|
-
}
|
155
|
-
|
156
|
-
|
157
|
-
|
158
|
-
}
|
159
|
-
var queue = [];
|
160
|
-
var draining = false;
|
161
|
-
var currentQueue;
|
162
|
-
var queueIndex = -1;
|
163
|
-
|
164
|
-
function cleanUpNextTick() {
|
165
|
-
if (!draining || !currentQueue) {
|
166
|
-
return;
|
167
|
-
}
|
168
|
-
draining = false;
|
169
|
-
if (currentQueue.length) {
|
170
|
-
queue = currentQueue.concat(queue);
|
171
|
-
} else {
|
172
|
-
queueIndex = -1;
|
173
|
-
}
|
174
|
-
if (queue.length) {
|
175
|
-
drainQueue();
|
176
|
-
}
|
177
|
-
}
|
178
|
-
|
179
|
-
function drainQueue() {
|
180
|
-
if (draining) {
|
181
|
-
return;
|
182
|
-
}
|
183
|
-
var timeout = runTimeout(cleanUpNextTick);
|
184
|
-
draining = true;
|
185
|
-
|
186
|
-
var len = queue.length;
|
187
|
-
while(len) {
|
188
|
-
currentQueue = queue;
|
189
|
-
queue = [];
|
190
|
-
while (++queueIndex < len) {
|
191
|
-
if (currentQueue) {
|
192
|
-
currentQueue[queueIndex].run();
|
193
|
-
}
|
194
|
-
}
|
195
|
-
queueIndex = -1;
|
196
|
-
len = queue.length;
|
197
|
-
}
|
198
|
-
currentQueue = null;
|
199
|
-
draining = false;
|
200
|
-
runClearTimeout(timeout);
|
201
|
-
}
|
202
|
-
|
203
|
-
process.nextTick = function (fun) {
|
204
|
-
var args = new Array(arguments.length - 1);
|
205
|
-
if (arguments.length > 1) {
|
206
|
-
for (var i = 1; i < arguments.length; i++) {
|
207
|
-
args[i - 1] = arguments[i];
|
208
|
-
}
|
209
|
-
}
|
210
|
-
queue.push(new Item(fun, args));
|
211
|
-
if (queue.length === 1 && !draining) {
|
212
|
-
runTimeout(drainQueue);
|
213
|
-
}
|
214
|
-
};
|
215
|
-
|
216
|
-
// v8 likes predictible objects
|
217
|
-
function Item(fun, array) {
|
218
|
-
this.fun = fun;
|
219
|
-
this.array = array;
|
220
|
-
}
|
221
|
-
Item.prototype.run = function () {
|
222
|
-
this.fun.apply(null, this.array);
|
223
|
-
};
|
224
|
-
process.title = 'browser';
|
225
|
-
process.browser = true;
|
226
|
-
process.env = {};
|
227
|
-
process.argv = [];
|
228
|
-
process.version = ''; // empty string to avoid regexp issues
|
229
|
-
process.versions = {};
|
230
|
-
|
231
|
-
function noop() {}
|
232
|
-
|
233
|
-
process.on = noop;
|
234
|
-
process.addListener = noop;
|
235
|
-
process.once = noop;
|
236
|
-
process.off = noop;
|
237
|
-
process.removeListener = noop;
|
238
|
-
process.removeAllListeners = noop;
|
239
|
-
process.emit = noop;
|
240
|
-
process.prependListener = noop;
|
241
|
-
process.prependOnceListener = noop;
|
242
|
-
|
243
|
-
process.listeners = function (name) { return [] }
|
244
|
-
|
245
|
-
process.binding = function (name) {
|
246
|
-
throw new Error('process.binding is not supported');
|
247
|
-
};
|
248
|
-
|
249
|
-
process.cwd = function () { return '/' };
|
250
|
-
process.chdir = function (dir) {
|
251
|
-
throw new Error('process.chdir is not supported');
|
252
|
-
};
|
253
|
-
process.umask = function() { return 0; };
|
254
|
-
|
255
|
-
|
256
|
-
/***/ }),
|
257
|
-
/* 1 */
|
258
|
-
/***/ (function(module, exports, __webpack_require__) {
|
259
|
-
|
260
|
-
"use strict";
|
261
|
-
|
262
|
-
|
263
|
-
/**
|
264
|
-
* Copyright (c) 2013-present, Facebook, Inc.
|
265
|
-
*
|
266
|
-
* This source code is licensed under the MIT license found in the
|
267
|
-
* LICENSE file in the root directory of this source tree.
|
268
|
-
*
|
269
|
-
*
|
270
|
-
*/
|
271
|
-
|
272
|
-
function makeEmptyFunction(arg) {
|
273
|
-
return function () {
|
274
|
-
return arg;
|
275
|
-
};
|
276
|
-
}
|
277
|
-
|
278
|
-
/**
|
279
|
-
* This function accepts and discards inputs; it has no side effects. This is
|
280
|
-
* primarily useful idiomatically for overridable function endpoints which
|
281
|
-
* always need to be callable, since JS lacks a null-call idiom ala Cocoa.
|
282
|
-
*/
|
283
|
-
var emptyFunction = function emptyFunction() {};
|
284
|
-
|
285
|
-
emptyFunction.thatReturns = makeEmptyFunction;
|
286
|
-
emptyFunction.thatReturnsFalse = makeEmptyFunction(false);
|
287
|
-
emptyFunction.thatReturnsTrue = makeEmptyFunction(true);
|
288
|
-
emptyFunction.thatReturnsNull = makeEmptyFunction(null);
|
289
|
-
emptyFunction.thatReturnsThis = function () {
|
290
|
-
return this;
|
291
|
-
};
|
292
|
-
emptyFunction.thatReturnsArgument = function (arg) {
|
293
|
-
return arg;
|
294
|
-
};
|
295
|
-
|
296
|
-
module.exports = emptyFunction;
|
297
|
-
|
298
|
-
/***/ }),
|
299
|
-
/* 2 */
|
300
|
-
/***/ (function(module, exports, __webpack_require__) {
|
301
|
-
|
302
|
-
"use strict";
|
303
|
-
/*
|
304
|
-
object-assign
|
305
|
-
(c) Sindre Sorhus
|
306
|
-
@license MIT
|
307
|
-
*/
|
308
|
-
|
309
|
-
|
310
|
-
/* eslint-disable no-unused-vars */
|
311
|
-
var getOwnPropertySymbols = Object.getOwnPropertySymbols;
|
312
|
-
var hasOwnProperty = Object.prototype.hasOwnProperty;
|
313
|
-
var propIsEnumerable = Object.prototype.propertyIsEnumerable;
|
314
|
-
|
315
|
-
function toObject(val) {
|
316
|
-
if (val === null || val === undefined) {
|
317
|
-
throw new TypeError('Object.assign cannot be called with null or undefined');
|
318
|
-
}
|
319
|
-
|
320
|
-
return Object(val);
|
321
|
-
}
|
322
|
-
|
323
|
-
function shouldUseNative() {
|
324
|
-
try {
|
325
|
-
if (!Object.assign) {
|
326
|
-
return false;
|
327
|
-
}
|
328
|
-
|
329
|
-
// Detect buggy property enumeration order in older V8 versions.
|
330
|
-
|
331
|
-
// https://bugs.chromium.org/p/v8/issues/detail?id=4118
|
332
|
-
var test1 = new String('abc'); // eslint-disable-line no-new-wrappers
|
333
|
-
test1[5] = 'de';
|
334
|
-
if (Object.getOwnPropertyNames(test1)[0] === '5') {
|
335
|
-
return false;
|
336
|
-
}
|
337
|
-
|
338
|
-
// https://bugs.chromium.org/p/v8/issues/detail?id=3056
|
339
|
-
var test2 = {};
|
340
|
-
for (var i = 0; i < 10; i++) {
|
341
|
-
test2['_' + String.fromCharCode(i)] = i;
|
342
|
-
}
|
343
|
-
var order2 = Object.getOwnPropertyNames(test2).map(function (n) {
|
344
|
-
return test2[n];
|
345
|
-
});
|
346
|
-
if (order2.join('') !== '0123456789') {
|
347
|
-
return false;
|
348
|
-
}
|
349
|
-
|
350
|
-
// https://bugs.chromium.org/p/v8/issues/detail?id=3056
|
351
|
-
var test3 = {};
|
352
|
-
'abcdefghijklmnopqrst'.split('').forEach(function (letter) {
|
353
|
-
test3[letter] = letter;
|
354
|
-
});
|
355
|
-
if (Object.keys(Object.assign({}, test3)).join('') !==
|
356
|
-
'abcdefghijklmnopqrst') {
|
357
|
-
return false;
|
358
|
-
}
|
359
|
-
|
360
|
-
return true;
|
361
|
-
} catch (err) {
|
362
|
-
// We don't expect any of the above to throw, but better to be safe.
|
363
|
-
return false;
|
364
|
-
}
|
365
|
-
}
|
366
|
-
|
367
|
-
module.exports = shouldUseNative() ? Object.assign : function (target, source) {
|
368
|
-
var from;
|
369
|
-
var to = toObject(target);
|
370
|
-
var symbols;
|
371
|
-
|
372
|
-
for (var s = 1; s < arguments.length; s++) {
|
373
|
-
from = Object(arguments[s]);
|
374
|
-
|
375
|
-
for (var key in from) {
|
376
|
-
if (hasOwnProperty.call(from, key)) {
|
377
|
-
to[key] = from[key];
|
378
|
-
}
|
379
|
-
}
|
380
|
-
|
381
|
-
if (getOwnPropertySymbols) {
|
382
|
-
symbols = getOwnPropertySymbols(from);
|
383
|
-
for (var i = 0; i < symbols.length; i++) {
|
384
|
-
if (propIsEnumerable.call(from, symbols[i])) {
|
385
|
-
to[symbols[i]] = from[symbols[i]];
|
386
|
-
}
|
387
|
-
}
|
388
|
-
}
|
389
|
-
}
|
390
|
-
|
391
|
-
return to;
|
392
|
-
};
|
393
|
-
|
394
|
-
|
395
|
-
/***/ }),
|
396
|
-
/* 3 */
|
397
|
-
/***/ (function(module, exports, __webpack_require__) {
|
398
|
-
|
399
|
-
"use strict";
|
400
|
-
/* WEBPACK VAR INJECTION */(function(process) {/**
|
401
|
-
* Copyright (c) 2013-present, Facebook, Inc.
|
402
|
-
*
|
403
|
-
* This source code is licensed under the MIT license found in the
|
404
|
-
* LICENSE file in the root directory of this source tree.
|
405
|
-
*
|
406
|
-
*/
|
407
|
-
|
408
|
-
|
409
|
-
|
410
|
-
/**
|
411
|
-
* Use invariant() to assert state which your program assumes to be true.
|
412
|
-
*
|
413
|
-
* Provide sprintf-style format (only %s is supported) and arguments
|
414
|
-
* to provide information about what broke and what you were
|
415
|
-
* expecting.
|
416
|
-
*
|
417
|
-
* The invariant message will be stripped in production, but the invariant
|
418
|
-
* will remain to ensure logic does not differ in production.
|
419
|
-
*/
|
420
|
-
|
421
|
-
var validateFormat = function validateFormat(format) {};
|
422
|
-
|
423
|
-
if (process.env.NODE_ENV !== 'production') {
|
424
|
-
validateFormat = function validateFormat(format) {
|
425
|
-
if (format === undefined) {
|
426
|
-
throw new Error('invariant requires an error message argument');
|
427
|
-
}
|
428
|
-
};
|
429
|
-
}
|
430
|
-
|
431
|
-
function invariant(condition, format, a, b, c, d, e, f) {
|
432
|
-
validateFormat(format);
|
433
|
-
|
434
|
-
if (!condition) {
|
435
|
-
var error;
|
436
|
-
if (format === undefined) {
|
437
|
-
error = new Error('Minified exception occurred; use the non-minified dev environment ' + 'for the full error message and additional helpful warnings.');
|
438
|
-
} else {
|
439
|
-
var args = [a, b, c, d, e, f];
|
440
|
-
var argIndex = 0;
|
441
|
-
error = new Error(format.replace(/%s/g, function () {
|
442
|
-
return args[argIndex++];
|
443
|
-
}));
|
444
|
-
error.name = 'Invariant Violation';
|
445
|
-
}
|
446
|
-
|
447
|
-
error.framesToPop = 1; // we don't care about invariant's own frame
|
448
|
-
throw error;
|
449
|
-
}
|
450
|
-
}
|
451
|
-
|
452
|
-
module.exports = invariant;
|
453
|
-
/* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(0)))
|
454
|
-
|
455
|
-
/***/ }),
|
456
|
-
/* 4 */
|
457
|
-
/***/ (function(module, exports, __webpack_require__) {
|
458
|
-
|
459
|
-
"use strict";
|
460
|
-
/* WEBPACK VAR INJECTION */(function(process) {/**
|
461
|
-
* Copyright (c) 2013-present, Facebook, Inc.
|
462
|
-
*
|
463
|
-
* This source code is licensed under the MIT license found in the
|
464
|
-
* LICENSE file in the root directory of this source tree.
|
465
|
-
*
|
466
|
-
*/
|
467
|
-
|
468
|
-
|
469
|
-
|
470
|
-
var emptyObject = {};
|
471
|
-
|
472
|
-
if (process.env.NODE_ENV !== 'production') {
|
473
|
-
Object.freeze(emptyObject);
|
474
|
-
}
|
475
|
-
|
476
|
-
module.exports = emptyObject;
|
477
|
-
/* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(0)))
|
478
|
-
|
479
|
-
/***/ }),
|
480
|
-
/* 5 */
|
481
|
-
/***/ (function(module, exports, __webpack_require__) {
|
482
|
-
|
483
|
-
"use strict";
|
484
|
-
/* WEBPACK VAR INJECTION */(function(process) {/**
|
485
|
-
* Copyright (c) 2014-present, Facebook, Inc.
|
486
|
-
*
|
487
|
-
* This source code is licensed under the MIT license found in the
|
488
|
-
* LICENSE file in the root directory of this source tree.
|
489
|
-
*
|
490
|
-
*/
|
491
|
-
|
492
|
-
|
493
|
-
|
494
|
-
var emptyFunction = __webpack_require__(1);
|
495
|
-
|
496
|
-
/**
|
497
|
-
* Similar to invariant but only logs a warning if the condition is not met.
|
498
|
-
* This can be used to log issues in development environments in critical
|
499
|
-
* paths. Removing the logging code for production environments will keep the
|
500
|
-
* same logic and follow the same code paths.
|
501
|
-
*/
|
502
|
-
|
503
|
-
var warning = emptyFunction;
|
504
|
-
|
505
|
-
if (process.env.NODE_ENV !== 'production') {
|
506
|
-
var printWarning = function printWarning(format) {
|
507
|
-
for (var _len = arguments.length, args = Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {
|
508
|
-
args[_key - 1] = arguments[_key];
|
509
|
-
}
|
510
|
-
|
511
|
-
var argIndex = 0;
|
512
|
-
var message = 'Warning: ' + format.replace(/%s/g, function () {
|
513
|
-
return args[argIndex++];
|
514
|
-
});
|
515
|
-
if (typeof console !== 'undefined') {
|
516
|
-
console.error(message);
|
517
|
-
}
|
518
|
-
try {
|
519
|
-
// --- Welcome to debugging React ---
|
520
|
-
// This error was thrown as a convenience so that you can use this stack
|
521
|
-
// to find the callsite that caused this warning to fire.
|
522
|
-
throw new Error(message);
|
523
|
-
} catch (x) {}
|
524
|
-
};
|
525
|
-
|
526
|
-
warning = function warning(condition, format) {
|
527
|
-
if (format === undefined) {
|
528
|
-
throw new Error('`warning(condition, format, ...args)` requires a warning ' + 'message argument');
|
529
|
-
}
|
530
|
-
|
531
|
-
if (format.indexOf('Failed Composite propType: ') === 0) {
|
532
|
-
return; // Ignore CompositeComponent proptype check.
|
533
|
-
}
|
534
|
-
|
535
|
-
if (!condition) {
|
536
|
-
for (var _len2 = arguments.length, args = Array(_len2 > 2 ? _len2 - 2 : 0), _key2 = 2; _key2 < _len2; _key2++) {
|
537
|
-
args[_key2 - 2] = arguments[_key2];
|
538
|
-
}
|
539
|
-
|
540
|
-
printWarning.apply(undefined, [format].concat(args));
|
541
|
-
}
|
542
|
-
};
|
543
|
-
}
|
544
|
-
|
545
|
-
module.exports = warning;
|
546
|
-
/* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(0)))
|
547
|
-
|
548
|
-
/***/ }),
|
549
|
-
/* 6 */
|
550
|
-
/***/ (function(module, exports, __webpack_require__) {
|
551
|
-
|
552
|
-
"use strict";
|
553
|
-
/* WEBPACK VAR INJECTION */(function(process) {
|
554
|
-
|
555
|
-
if (process.env.NODE_ENV === 'production') {
|
556
|
-
module.exports = __webpack_require__(9);
|
557
|
-
} else {
|
558
|
-
module.exports = __webpack_require__(10);
|
559
|
-
}
|
560
|
-
|
561
|
-
/* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(0)))
|
562
|
-
|
563
|
-
/***/ }),
|
564
|
-
/* 7 */
|
565
|
-
/***/ (function(module, exports, __webpack_require__) {
|
566
|
-
|
567
|
-
"use strict";
|
568
|
-
/* WEBPACK VAR INJECTION */(function(process) {/**
|
569
|
-
* Copyright (c) 2013-present, Facebook, Inc.
|
570
|
-
*
|
571
|
-
* This source code is licensed under the MIT license found in the
|
572
|
-
* LICENSE file in the root directory of this source tree.
|
573
|
-
*/
|
574
|
-
|
575
|
-
|
576
|
-
|
577
|
-
if (process.env.NODE_ENV !== 'production') {
|
578
|
-
var invariant = __webpack_require__(3);
|
579
|
-
var warning = __webpack_require__(5);
|
580
|
-
var ReactPropTypesSecret = __webpack_require__(8);
|
581
|
-
var loggedTypeFailures = {};
|
582
|
-
}
|
583
|
-
|
584
|
-
/**
|
585
|
-
* Assert that the values match with the type specs.
|
586
|
-
* Error messages are memorized and will only be shown once.
|
587
|
-
*
|
588
|
-
* @param {object} typeSpecs Map of name to a ReactPropType
|
589
|
-
* @param {object} values Runtime values that need to be type-checked
|
590
|
-
* @param {string} location e.g. "prop", "context", "child context"
|
591
|
-
* @param {string} componentName Name of the component for error messages.
|
592
|
-
* @param {?Function} getStack Returns the component stack.
|
593
|
-
* @private
|
594
|
-
*/
|
595
|
-
function checkPropTypes(typeSpecs, values, location, componentName, getStack) {
|
596
|
-
if (process.env.NODE_ENV !== 'production') {
|
597
|
-
for (var typeSpecName in typeSpecs) {
|
598
|
-
if (typeSpecs.hasOwnProperty(typeSpecName)) {
|
599
|
-
var error;
|
600
|
-
// Prop type validation may throw. In case they do, we don't want to
|
601
|
-
// fail the render phase where it didn't fail before. So we log it.
|
602
|
-
// After these have been cleaned up, we'll let them throw.
|
603
|
-
try {
|
604
|
-
// This is intentionally an invariant that gets caught. It's the same
|
605
|
-
// behavior as without this statement except with a better message.
|
606
|
-
invariant(typeof typeSpecs[typeSpecName] === 'function', '%s: %s type `%s` is invalid; it must be a function, usually from ' + 'the `prop-types` package, but received `%s`.', componentName || 'React class', location, typeSpecName, typeof typeSpecs[typeSpecName]);
|
607
|
-
error = typeSpecs[typeSpecName](values, typeSpecName, componentName, location, null, ReactPropTypesSecret);
|
608
|
-
} catch (ex) {
|
609
|
-
error = ex;
|
610
|
-
}
|
611
|
-
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', location, typeSpecName, typeof error);
|
612
|
-
if (error instanceof Error && !(error.message in loggedTypeFailures)) {
|
613
|
-
// Only monitor this failure once because there tends to be a lot of the
|
614
|
-
// same error.
|
615
|
-
loggedTypeFailures[error.message] = true;
|
616
|
-
|
617
|
-
var stack = getStack ? getStack() : '';
|
618
|
-
|
619
|
-
warning(false, 'Failed %s type: %s%s', location, error.message, stack != null ? stack : '');
|
620
|
-
}
|
621
|
-
}
|
622
|
-
}
|
623
|
-
}
|
624
|
-
}
|
625
|
-
|
626
|
-
module.exports = checkPropTypes;
|
627
|
-
|
628
|
-
/* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(0)))
|
629
|
-
|
630
|
-
/***/ }),
|
631
|
-
/* 8 */
|
632
|
-
/***/ (function(module, exports, __webpack_require__) {
|
633
|
-
|
634
|
-
"use strict";
|
635
|
-
/**
|
636
|
-
* Copyright (c) 2013-present, Facebook, Inc.
|
637
|
-
*
|
638
|
-
* This source code is licensed under the MIT license found in the
|
639
|
-
* LICENSE file in the root directory of this source tree.
|
640
|
-
*/
|
641
|
-
|
642
|
-
|
643
|
-
|
644
|
-
var ReactPropTypesSecret = 'SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED';
|
645
|
-
|
646
|
-
module.exports = ReactPropTypesSecret;
|
647
|
-
|
648
|
-
|
649
|
-
/***/ }),
|
650
|
-
/* 9 */
|
651
|
-
/***/ (function(module, exports, __webpack_require__) {
|
652
|
-
|
653
|
-
"use strict";
|
654
|
-
/** @license React v16.2.0
|
655
|
-
* react.production.min.js
|
656
|
-
*
|
657
|
-
* Copyright (c) 2013-present, Facebook, Inc.
|
658
|
-
*
|
659
|
-
* This source code is licensed under the MIT license found in the
|
660
|
-
* LICENSE file in the root directory of this source tree.
|
661
|
-
*/
|
662
|
-
|
663
|
-
var m=__webpack_require__(2),n=__webpack_require__(4),p=__webpack_require__(1),q="function"===typeof Symbol&&Symbol["for"],r=q?Symbol["for"]("react.element"):60103,t=q?Symbol["for"]("react.call"):60104,u=q?Symbol["for"]("react.return"):60105,v=q?Symbol["for"]("react.portal"):60106,w=q?Symbol["for"]("react.fragment"):60107,x="function"===typeof Symbol&&Symbol.iterator;
|
664
|
-
function y(a){for(var b=arguments.length-1,e="Minified React error #"+a+"; visit http://facebook.github.io/react/docs/error-decoder.html?invariant\x3d"+a,c=0;c<b;c++)e+="\x26args[]\x3d"+encodeURIComponent(arguments[c+1]);b=Error(e+" for the full message or use the non-minified dev environment for full errors and additional helpful warnings.");b.name="Invariant Violation";b.framesToPop=1;throw b;}
|
665
|
-
var z={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}};function A(a,b,e){this.props=a;this.context=b;this.refs=n;this.updater=e||z}A.prototype.isReactComponent={};A.prototype.setState=function(a,b){"object"!==typeof a&&"function"!==typeof a&&null!=a?y("85"):void 0;this.updater.enqueueSetState(this,a,b,"setState")};A.prototype.forceUpdate=function(a){this.updater.enqueueForceUpdate(this,a,"forceUpdate")};
|
666
|
-
function B(a,b,e){this.props=a;this.context=b;this.refs=n;this.updater=e||z}function C(){}C.prototype=A.prototype;var D=B.prototype=new C;D.constructor=B;m(D,A.prototype);D.isPureReactComponent=!0;function E(a,b,e){this.props=a;this.context=b;this.refs=n;this.updater=e||z}var F=E.prototype=new C;F.constructor=E;m(F,A.prototype);F.unstable_isAsyncReactComponent=!0;F.render=function(){return this.props.children};var G={current:null},H=Object.prototype.hasOwnProperty,I={key:!0,ref:!0,__self:!0,__source:!0};
|
667
|
-
function J(a,b,e){var c,d={},g=null,k=null;if(null!=b)for(c in void 0!==b.ref&&(k=b.ref),void 0!==b.key&&(g=""+b.key),b)H.call(b,c)&&!I.hasOwnProperty(c)&&(d[c]=b[c]);var f=arguments.length-2;if(1===f)d.children=e;else if(1<f){for(var h=Array(f),l=0;l<f;l++)h[l]=arguments[l+2];d.children=h}if(a&&a.defaultProps)for(c in f=a.defaultProps,f)void 0===d[c]&&(d[c]=f[c]);return{$$typeof:r,type:a,key:g,ref:k,props:d,_owner:G.current}}function K(a){return"object"===typeof a&&null!==a&&a.$$typeof===r}
|
668
|
-
function escape(a){var b={"\x3d":"\x3d0",":":"\x3d2"};return"$"+(""+a).replace(/[=:]/g,function(a){return b[a]})}var L=/\/+/g,M=[];function N(a,b,e,c){if(M.length){var d=M.pop();d.result=a;d.keyPrefix=b;d.func=e;d.context=c;d.count=0;return d}return{result:a,keyPrefix:b,func:e,context:c,count:0}}function O(a){a.result=null;a.keyPrefix=null;a.func=null;a.context=null;a.count=0;10>M.length&&M.push(a)}
|
669
|
-
function P(a,b,e,c){var d=typeof a;if("undefined"===d||"boolean"===d)a=null;var g=!1;if(null===a)g=!0;else switch(d){case "string":case "number":g=!0;break;case "object":switch(a.$$typeof){case r:case t:case u:case v:g=!0}}if(g)return e(c,a,""===b?"."+Q(a,0):b),1;g=0;b=""===b?".":b+":";if(Array.isArray(a))for(var k=0;k<a.length;k++){d=a[k];var f=b+Q(d,k);g+=P(d,f,e,c)}else if(null===a||"undefined"===typeof a?f=null:(f=x&&a[x]||a["@@iterator"],f="function"===typeof f?f:null),"function"===typeof f)for(a=
|
670
|
-
f.call(a),k=0;!(d=a.next()).done;)d=d.value,f=b+Q(d,k++),g+=P(d,f,e,c);else"object"===d&&(e=""+a,y("31","[object Object]"===e?"object with keys {"+Object.keys(a).join(", ")+"}":e,""));return g}function Q(a,b){return"object"===typeof a&&null!==a&&null!=a.key?escape(a.key):b.toString(36)}function R(a,b){a.func.call(a.context,b,a.count++)}
|
671
|
-
function S(a,b,e){var c=a.result,d=a.keyPrefix;a=a.func.call(a.context,b,a.count++);Array.isArray(a)?T(a,c,e,p.thatReturnsArgument):null!=a&&(K(a)&&(b=d+(!a.key||b&&b.key===a.key?"":(""+a.key).replace(L,"$\x26/")+"/")+e,a={$$typeof:r,type:a.type,key:b,ref:a.ref,props:a.props,_owner:a._owner}),c.push(a))}function T(a,b,e,c,d){var g="";null!=e&&(g=(""+e).replace(L,"$\x26/")+"/");b=N(b,g,c,d);null==a||P(a,"",S,b);O(b)}
|
672
|
-
var U={Children:{map:function(a,b,e){if(null==a)return a;var c=[];T(a,c,null,b,e);return c},forEach:function(a,b,e){if(null==a)return a;b=N(null,null,b,e);null==a||P(a,"",R,b);O(b)},count:function(a){return null==a?0:P(a,"",p.thatReturnsNull,null)},toArray:function(a){var b=[];T(a,b,null,p.thatReturnsArgument);return b},only:function(a){K(a)?void 0:y("143");return a}},Component:A,PureComponent:B,unstable_AsyncComponent:E,Fragment:w,createElement:J,cloneElement:function(a,b,e){var c=m({},a.props),
|
673
|
-
d=a.key,g=a.ref,k=a._owner;if(null!=b){void 0!==b.ref&&(g=b.ref,k=G.current);void 0!==b.key&&(d=""+b.key);if(a.type&&a.type.defaultProps)var f=a.type.defaultProps;for(h in b)H.call(b,h)&&!I.hasOwnProperty(h)&&(c[h]=void 0===b[h]&&void 0!==f?f[h]:b[h])}var h=arguments.length-2;if(1===h)c.children=e;else if(1<h){f=Array(h);for(var l=0;l<h;l++)f[l]=arguments[l+2];c.children=f}return{$$typeof:r,type:a.type,key:d,ref:g,props:c,_owner:k}},createFactory:function(a){var b=J.bind(null,a);b.type=a;return b},
|
674
|
-
isValidElement:K,version:"16.2.0",__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED:{ReactCurrentOwner:G,assign:m}},V=Object.freeze({default:U}),W=V&&U||V;module.exports=W["default"]?W["default"]:W;
|
675
|
-
|
676
|
-
|
677
|
-
/***/ }),
|
678
|
-
/* 10 */
|
679
|
-
/***/ (function(module, exports, __webpack_require__) {
|
680
|
-
|
681
|
-
"use strict";
|
682
|
-
/* WEBPACK VAR INJECTION */(function(process) {/** @license React v16.2.0
|
683
|
-
* react.development.js
|
684
|
-
*
|
685
|
-
* Copyright (c) 2013-present, Facebook, Inc.
|
686
|
-
*
|
687
|
-
* This source code is licensed under the MIT license found in the
|
688
|
-
* LICENSE file in the root directory of this source tree.
|
689
|
-
*/
|
690
|
-
|
691
|
-
|
692
|
-
|
693
|
-
|
694
|
-
|
695
|
-
if (process.env.NODE_ENV !== "production") {
|
696
|
-
(function() {
|
697
|
-
'use strict';
|
698
|
-
|
699
|
-
var _assign = __webpack_require__(2);
|
700
|
-
var emptyObject = __webpack_require__(4);
|
701
|
-
var invariant = __webpack_require__(3);
|
702
|
-
var warning = __webpack_require__(5);
|
703
|
-
var emptyFunction = __webpack_require__(1);
|
704
|
-
var checkPropTypes = __webpack_require__(7);
|
705
|
-
|
706
|
-
// TODO: this is special because it gets imported during build.
|
707
|
-
|
708
|
-
var ReactVersion = '16.2.0';
|
709
|
-
|
710
|
-
// The Symbol used to tag the ReactElement-like types. If there is no native Symbol
|
711
|
-
// nor polyfill, then a plain number is used for performance.
|
712
|
-
var hasSymbol = typeof Symbol === 'function' && Symbol['for'];
|
713
|
-
|
714
|
-
var REACT_ELEMENT_TYPE = hasSymbol ? Symbol['for']('react.element') : 0xeac7;
|
715
|
-
var REACT_CALL_TYPE = hasSymbol ? Symbol['for']('react.call') : 0xeac8;
|
716
|
-
var REACT_RETURN_TYPE = hasSymbol ? Symbol['for']('react.return') : 0xeac9;
|
717
|
-
var REACT_PORTAL_TYPE = hasSymbol ? Symbol['for']('react.portal') : 0xeaca;
|
718
|
-
var REACT_FRAGMENT_TYPE = hasSymbol ? Symbol['for']('react.fragment') : 0xeacb;
|
719
|
-
|
720
|
-
var MAYBE_ITERATOR_SYMBOL = typeof Symbol === 'function' && Symbol.iterator;
|
721
|
-
var FAUX_ITERATOR_SYMBOL = '@@iterator';
|
722
|
-
|
723
|
-
function getIteratorFn(maybeIterable) {
|
724
|
-
if (maybeIterable === null || typeof maybeIterable === 'undefined') {
|
725
|
-
return null;
|
726
|
-
}
|
727
|
-
var maybeIterator = MAYBE_ITERATOR_SYMBOL && maybeIterable[MAYBE_ITERATOR_SYMBOL] || maybeIterable[FAUX_ITERATOR_SYMBOL];
|
728
|
-
if (typeof maybeIterator === 'function') {
|
729
|
-
return maybeIterator;
|
730
|
-
}
|
731
|
-
return null;
|
732
|
-
}
|
733
|
-
|
734
|
-
/**
|
735
|
-
* WARNING: DO NOT manually require this module.
|
736
|
-
* This is a replacement for `invariant(...)` used by the error code system
|
737
|
-
* and will _only_ be required by the corresponding babel pass.
|
738
|
-
* It always throws.
|
739
|
-
*/
|
740
|
-
|
741
|
-
/**
|
742
|
-
* Forked from fbjs/warning:
|
743
|
-
* https://github.com/facebook/fbjs/blob/e66ba20ad5be433eb54423f2b097d829324d9de6/packages/fbjs/src/__forks__/warning.js
|
744
|
-
*
|
745
|
-
* Only change is we use console.warn instead of console.error,
|
746
|
-
* and do nothing when 'console' is not supported.
|
747
|
-
* This really simplifies the code.
|
748
|
-
* ---
|
749
|
-
* Similar to invariant but only logs a warning if the condition is not met.
|
750
|
-
* This can be used to log issues in development environments in critical
|
751
|
-
* paths. Removing the logging code for production environments will keep the
|
752
|
-
* same logic and follow the same code paths.
|
753
|
-
*/
|
754
|
-
|
755
|
-
var lowPriorityWarning = function () {};
|
756
|
-
|
757
|
-
{
|
758
|
-
var printWarning = function (format) {
|
759
|
-
for (var _len = arguments.length, args = Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {
|
760
|
-
args[_key - 1] = arguments[_key];
|
761
|
-
}
|
762
|
-
|
763
|
-
var argIndex = 0;
|
764
|
-
var message = 'Warning: ' + format.replace(/%s/g, function () {
|
765
|
-
return args[argIndex++];
|
766
|
-
});
|
767
|
-
if (typeof console !== 'undefined') {
|
768
|
-
console.warn(message);
|
769
|
-
}
|
770
|
-
try {
|
771
|
-
// --- Welcome to debugging React ---
|
772
|
-
// This error was thrown as a convenience so that you can use this stack
|
773
|
-
// to find the callsite that caused this warning to fire.
|
774
|
-
throw new Error(message);
|
775
|
-
} catch (x) {}
|
776
|
-
};
|
777
|
-
|
778
|
-
lowPriorityWarning = function (condition, format) {
|
779
|
-
if (format === undefined) {
|
780
|
-
throw new Error('`warning(condition, format, ...args)` requires a warning ' + 'message argument');
|
781
|
-
}
|
782
|
-
if (!condition) {
|
783
|
-
for (var _len2 = arguments.length, args = Array(_len2 > 2 ? _len2 - 2 : 0), _key2 = 2; _key2 < _len2; _key2++) {
|
784
|
-
args[_key2 - 2] = arguments[_key2];
|
785
|
-
}
|
786
|
-
|
787
|
-
printWarning.apply(undefined, [format].concat(args));
|
788
|
-
}
|
789
|
-
};
|
790
|
-
}
|
791
|
-
|
792
|
-
var lowPriorityWarning$1 = lowPriorityWarning;
|
793
|
-
|
794
|
-
var didWarnStateUpdateForUnmountedComponent = {};
|
795
|
-
|
796
|
-
function warnNoop(publicInstance, callerName) {
|
797
|
-
{
|
798
|
-
var constructor = publicInstance.constructor;
|
799
|
-
var componentName = constructor && (constructor.displayName || constructor.name) || 'ReactClass';
|
800
|
-
var warningKey = componentName + '.' + callerName;
|
801
|
-
if (didWarnStateUpdateForUnmountedComponent[warningKey]) {
|
802
|
-
return;
|
803
|
-
}
|
804
|
-
warning(false, '%s(...): Can only update a mounted or mounting component. ' + 'This usually means you called %s() on an unmounted component. ' + 'This is a no-op.\n\nPlease check the code for the %s component.', callerName, callerName, componentName);
|
805
|
-
didWarnStateUpdateForUnmountedComponent[warningKey] = true;
|
806
|
-
}
|
807
|
-
}
|
808
|
-
|
809
|
-
/**
|
810
|
-
* This is the abstract API for an update queue.
|
811
|
-
*/
|
812
|
-
var ReactNoopUpdateQueue = {
|
813
|
-
/**
|
814
|
-
* Checks whether or not this composite component is mounted.
|
815
|
-
* @param {ReactClass} publicInstance The instance we want to test.
|
816
|
-
* @return {boolean} True if mounted, false otherwise.
|
817
|
-
* @protected
|
818
|
-
* @final
|
819
|
-
*/
|
820
|
-
isMounted: function (publicInstance) {
|
821
|
-
return false;
|
822
|
-
},
|
823
|
-
|
824
|
-
/**
|
825
|
-
* Forces an update. This should only be invoked when it is known with
|
826
|
-
* certainty that we are **not** in a DOM transaction.
|
827
|
-
*
|
828
|
-
* You may want to call this when you know that some deeper aspect of the
|
829
|
-
* component's state has changed but `setState` was not called.
|
830
|
-
*
|
831
|
-
* This will not invoke `shouldComponentUpdate`, but it will invoke
|
832
|
-
* `componentWillUpdate` and `componentDidUpdate`.
|
833
|
-
*
|
834
|
-
* @param {ReactClass} publicInstance The instance that should rerender.
|
835
|
-
* @param {?function} callback Called after component is updated.
|
836
|
-
* @param {?string} callerName name of the calling function in the public API.
|
837
|
-
* @internal
|
838
|
-
*/
|
839
|
-
enqueueForceUpdate: function (publicInstance, callback, callerName) {
|
840
|
-
warnNoop(publicInstance, 'forceUpdate');
|
841
|
-
},
|
842
|
-
|
843
|
-
/**
|
844
|
-
* Replaces all of the state. Always use this or `setState` to mutate state.
|
845
|
-
* You should treat `this.state` as immutable.
|
846
|
-
*
|
847
|
-
* There is no guarantee that `this.state` will be immediately updated, so
|
848
|
-
* accessing `this.state` after calling this method may return the old value.
|
849
|
-
*
|
850
|
-
* @param {ReactClass} publicInstance The instance that should rerender.
|
851
|
-
* @param {object} completeState Next state.
|
852
|
-
* @param {?function} callback Called after component is updated.
|
853
|
-
* @param {?string} callerName name of the calling function in the public API.
|
854
|
-
* @internal
|
855
|
-
*/
|
856
|
-
enqueueReplaceState: function (publicInstance, completeState, callback, callerName) {
|
857
|
-
warnNoop(publicInstance, 'replaceState');
|
858
|
-
},
|
859
|
-
|
860
|
-
/**
|
861
|
-
* Sets a subset of the state. This only exists because _pendingState is
|
862
|
-
* internal. This provides a merging strategy that is not available to deep
|
863
|
-
* properties which is confusing. TODO: Expose pendingState or don't use it
|
864
|
-
* during the merge.
|
865
|
-
*
|
866
|
-
* @param {ReactClass} publicInstance The instance that should rerender.
|
867
|
-
* @param {object} partialState Next partial state to be merged with state.
|
868
|
-
* @param {?function} callback Called after component is updated.
|
869
|
-
* @param {?string} Name of the calling function in the public API.
|
870
|
-
* @internal
|
871
|
-
*/
|
872
|
-
enqueueSetState: function (publicInstance, partialState, callback, callerName) {
|
873
|
-
warnNoop(publicInstance, 'setState');
|
874
|
-
}
|
875
|
-
};
|
876
|
-
|
877
|
-
/**
|
878
|
-
* Base class helpers for the updating state of a component.
|
879
|
-
*/
|
880
|
-
function Component(props, context, updater) {
|
881
|
-
this.props = props;
|
882
|
-
this.context = context;
|
883
|
-
this.refs = emptyObject;
|
884
|
-
// We initialize the default updater but the real one gets injected by the
|
885
|
-
// renderer.
|
886
|
-
this.updater = updater || ReactNoopUpdateQueue;
|
887
|
-
}
|
888
|
-
|
889
|
-
Component.prototype.isReactComponent = {};
|
890
|
-
|
891
|
-
/**
|
892
|
-
* Sets a subset of the state. Always use this to mutate
|
893
|
-
* state. You should treat `this.state` as immutable.
|
894
|
-
*
|
895
|
-
* There is no guarantee that `this.state` will be immediately updated, so
|
896
|
-
* accessing `this.state` after calling this method may return the old value.
|
897
|
-
*
|
898
|
-
* There is no guarantee that calls to `setState` will run synchronously,
|
899
|
-
* as they may eventually be batched together. You can provide an optional
|
900
|
-
* callback that will be executed when the call to setState is actually
|
901
|
-
* completed.
|
902
|
-
*
|
903
|
-
* When a function is provided to setState, it will be called at some point in
|
904
|
-
* the future (not synchronously). It will be called with the up to date
|
905
|
-
* component arguments (state, props, context). These values can be different
|
906
|
-
* from this.* because your function may be called after receiveProps but before
|
907
|
-
* shouldComponentUpdate, and this new state, props, and context will not yet be
|
908
|
-
* assigned to this.
|
909
|
-
*
|
910
|
-
* @param {object|function} partialState Next partial state or function to
|
911
|
-
* produce next partial state to be merged with current state.
|
912
|
-
* @param {?function} callback Called after state is updated.
|
913
|
-
* @final
|
914
|
-
* @protected
|
915
|
-
*/
|
916
|
-
Component.prototype.setState = function (partialState, callback) {
|
917
|
-
!(typeof partialState === 'object' || typeof partialState === 'function' || partialState == null) ? invariant(false, 'setState(...): takes an object of state variables to update or a function which returns an object of state variables.') : void 0;
|
918
|
-
this.updater.enqueueSetState(this, partialState, callback, 'setState');
|
919
|
-
};
|
920
|
-
|
921
|
-
/**
|
922
|
-
* Forces an update. This should only be invoked when it is known with
|
923
|
-
* certainty that we are **not** in a DOM transaction.
|
924
|
-
*
|
925
|
-
* You may want to call this when you know that some deeper aspect of the
|
926
|
-
* component's state has changed but `setState` was not called.
|
927
|
-
*
|
928
|
-
* This will not invoke `shouldComponentUpdate`, but it will invoke
|
929
|
-
* `componentWillUpdate` and `componentDidUpdate`.
|
930
|
-
*
|
931
|
-
* @param {?function} callback Called after update is complete.
|
932
|
-
* @final
|
933
|
-
* @protected
|
934
|
-
*/
|
935
|
-
Component.prototype.forceUpdate = function (callback) {
|
936
|
-
this.updater.enqueueForceUpdate(this, callback, 'forceUpdate');
|
937
|
-
};
|
938
|
-
|
939
|
-
/**
|
940
|
-
* Deprecated APIs. These APIs used to exist on classic React classes but since
|
941
|
-
* we would like to deprecate them, we're not going to move them over to this
|
942
|
-
* modern base class. Instead, we define a getter that warns if it's accessed.
|
943
|
-
*/
|
944
|
-
{
|
945
|
-
var deprecatedAPIs = {
|
946
|
-
isMounted: ['isMounted', 'Instead, make sure to clean up subscriptions and pending requests in ' + 'componentWillUnmount to prevent memory leaks.'],
|
947
|
-
replaceState: ['replaceState', 'Refactor your code to use setState instead (see ' + 'https://github.com/facebook/react/issues/3236).']
|
948
|
-
};
|
949
|
-
var defineDeprecationWarning = function (methodName, info) {
|
950
|
-
Object.defineProperty(Component.prototype, methodName, {
|
951
|
-
get: function () {
|
952
|
-
lowPriorityWarning$1(false, '%s(...) is deprecated in plain JavaScript React classes. %s', info[0], info[1]);
|
953
|
-
return undefined;
|
954
|
-
}
|
955
|
-
});
|
956
|
-
};
|
957
|
-
for (var fnName in deprecatedAPIs) {
|
958
|
-
if (deprecatedAPIs.hasOwnProperty(fnName)) {
|
959
|
-
defineDeprecationWarning(fnName, deprecatedAPIs[fnName]);
|
960
|
-
}
|
961
|
-
}
|
962
|
-
}
|
963
|
-
|
964
|
-
/**
|
965
|
-
* Base class helpers for the updating state of a component.
|
966
|
-
*/
|
967
|
-
function PureComponent(props, context, updater) {
|
968
|
-
// Duplicated from Component.
|
969
|
-
this.props = props;
|
970
|
-
this.context = context;
|
971
|
-
this.refs = emptyObject;
|
972
|
-
// We initialize the default updater but the real one gets injected by the
|
973
|
-
// renderer.
|
974
|
-
this.updater = updater || ReactNoopUpdateQueue;
|
975
|
-
}
|
976
|
-
|
977
|
-
function ComponentDummy() {}
|
978
|
-
ComponentDummy.prototype = Component.prototype;
|
979
|
-
var pureComponentPrototype = PureComponent.prototype = new ComponentDummy();
|
980
|
-
pureComponentPrototype.constructor = PureComponent;
|
981
|
-
// Avoid an extra prototype jump for these methods.
|
982
|
-
_assign(pureComponentPrototype, Component.prototype);
|
983
|
-
pureComponentPrototype.isPureReactComponent = true;
|
984
|
-
|
985
|
-
function AsyncComponent(props, context, updater) {
|
986
|
-
// Duplicated from Component.
|
987
|
-
this.props = props;
|
988
|
-
this.context = context;
|
989
|
-
this.refs = emptyObject;
|
990
|
-
// We initialize the default updater but the real one gets injected by the
|
991
|
-
// renderer.
|
992
|
-
this.updater = updater || ReactNoopUpdateQueue;
|
993
|
-
}
|
994
|
-
|
995
|
-
var asyncComponentPrototype = AsyncComponent.prototype = new ComponentDummy();
|
996
|
-
asyncComponentPrototype.constructor = AsyncComponent;
|
997
|
-
// Avoid an extra prototype jump for these methods.
|
998
|
-
_assign(asyncComponentPrototype, Component.prototype);
|
999
|
-
asyncComponentPrototype.unstable_isAsyncReactComponent = true;
|
1000
|
-
asyncComponentPrototype.render = function () {
|
1001
|
-
return this.props.children;
|
1002
|
-
};
|
1003
|
-
|
1004
|
-
/**
|
1005
|
-
* Keeps track of the current owner.
|
1006
|
-
*
|
1007
|
-
* The current owner is the component who should own any components that are
|
1008
|
-
* currently being constructed.
|
1009
|
-
*/
|
1010
|
-
var ReactCurrentOwner = {
|
1011
|
-
/**
|
1012
|
-
* @internal
|
1013
|
-
* @type {ReactComponent}
|
1014
|
-
*/
|
1015
|
-
current: null
|
1016
|
-
};
|
1017
|
-
|
1018
|
-
var hasOwnProperty = Object.prototype.hasOwnProperty;
|
1019
|
-
|
1020
|
-
var RESERVED_PROPS = {
|
1021
|
-
key: true,
|
1022
|
-
ref: true,
|
1023
|
-
__self: true,
|
1024
|
-
__source: true
|
1025
|
-
};
|
1026
|
-
|
1027
|
-
var specialPropKeyWarningShown;
|
1028
|
-
var specialPropRefWarningShown;
|
1029
|
-
|
1030
|
-
function hasValidRef(config) {
|
1031
|
-
{
|
1032
|
-
if (hasOwnProperty.call(config, 'ref')) {
|
1033
|
-
var getter = Object.getOwnPropertyDescriptor(config, 'ref').get;
|
1034
|
-
if (getter && getter.isReactWarning) {
|
1035
|
-
return false;
|
1036
|
-
}
|
1037
|
-
}
|
1038
|
-
}
|
1039
|
-
return config.ref !== undefined;
|
1040
|
-
}
|
1041
|
-
|
1042
|
-
function hasValidKey(config) {
|
1043
|
-
{
|
1044
|
-
if (hasOwnProperty.call(config, 'key')) {
|
1045
|
-
var getter = Object.getOwnPropertyDescriptor(config, 'key').get;
|
1046
|
-
if (getter && getter.isReactWarning) {
|
1047
|
-
return false;
|
1048
|
-
}
|
1049
|
-
}
|
1050
|
-
}
|
1051
|
-
return config.key !== undefined;
|
1052
|
-
}
|
1053
|
-
|
1054
|
-
function defineKeyPropWarningGetter(props, displayName) {
|
1055
|
-
var warnAboutAccessingKey = function () {
|
1056
|
-
if (!specialPropKeyWarningShown) {
|
1057
|
-
specialPropKeyWarningShown = true;
|
1058
|
-
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);
|
1059
|
-
}
|
1060
|
-
};
|
1061
|
-
warnAboutAccessingKey.isReactWarning = true;
|
1062
|
-
Object.defineProperty(props, 'key', {
|
1063
|
-
get: warnAboutAccessingKey,
|
1064
|
-
configurable: true
|
1065
|
-
});
|
1066
|
-
}
|
1067
|
-
|
1068
|
-
function defineRefPropWarningGetter(props, displayName) {
|
1069
|
-
var warnAboutAccessingRef = function () {
|
1070
|
-
if (!specialPropRefWarningShown) {
|
1071
|
-
specialPropRefWarningShown = true;
|
1072
|
-
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);
|
1073
|
-
}
|
1074
|
-
};
|
1075
|
-
warnAboutAccessingRef.isReactWarning = true;
|
1076
|
-
Object.defineProperty(props, 'ref', {
|
1077
|
-
get: warnAboutAccessingRef,
|
1078
|
-
configurable: true
|
1079
|
-
});
|
1080
|
-
}
|
1081
|
-
|
1082
|
-
/**
|
1083
|
-
* Factory method to create a new React element. This no longer adheres to
|
1084
|
-
* the class pattern, so do not use new to call it. Also, no instanceof check
|
1085
|
-
* will work. Instead test $$typeof field against Symbol.for('react.element') to check
|
1086
|
-
* if something is a React Element.
|
1087
|
-
*
|
1088
|
-
* @param {*} type
|
1089
|
-
* @param {*} key
|
1090
|
-
* @param {string|object} ref
|
1091
|
-
* @param {*} self A *temporary* helper to detect places where `this` is
|
1092
|
-
* different from the `owner` when React.createElement is called, so that we
|
1093
|
-
* can warn. We want to get rid of owner and replace string `ref`s with arrow
|
1094
|
-
* functions, and as long as `this` and owner are the same, there will be no
|
1095
|
-
* change in behavior.
|
1096
|
-
* @param {*} source An annotation object (added by a transpiler or otherwise)
|
1097
|
-
* indicating filename, line number, and/or other information.
|
1098
|
-
* @param {*} owner
|
1099
|
-
* @param {*} props
|
1100
|
-
* @internal
|
1101
|
-
*/
|
1102
|
-
var ReactElement = function (type, key, ref, self, source, owner, props) {
|
1103
|
-
var element = {
|
1104
|
-
// This tag allow us to uniquely identify this as a React Element
|
1105
|
-
$$typeof: REACT_ELEMENT_TYPE,
|
1106
|
-
|
1107
|
-
// Built-in properties that belong on the element
|
1108
|
-
type: type,
|
1109
|
-
key: key,
|
1110
|
-
ref: ref,
|
1111
|
-
props: props,
|
1112
|
-
|
1113
|
-
// Record the component responsible for creating this element.
|
1114
|
-
_owner: owner
|
1115
|
-
};
|
1116
|
-
|
1117
|
-
{
|
1118
|
-
// The validation flag is currently mutative. We put it on
|
1119
|
-
// an external backing store so that we can freeze the whole object.
|
1120
|
-
// This can be replaced with a WeakMap once they are implemented in
|
1121
|
-
// commonly used development environments.
|
1122
|
-
element._store = {};
|
1123
|
-
|
1124
|
-
// To make comparing ReactElements easier for testing purposes, we make
|
1125
|
-
// the validation flag non-enumerable (where possible, which should
|
1126
|
-
// include every environment we run tests in), so the test framework
|
1127
|
-
// ignores it.
|
1128
|
-
Object.defineProperty(element._store, 'validated', {
|
1129
|
-
configurable: false,
|
1130
|
-
enumerable: false,
|
1131
|
-
writable: true,
|
1132
|
-
value: false
|
1133
|
-
});
|
1134
|
-
// self and source are DEV only properties.
|
1135
|
-
Object.defineProperty(element, '_self', {
|
1136
|
-
configurable: false,
|
1137
|
-
enumerable: false,
|
1138
|
-
writable: false,
|
1139
|
-
value: self
|
1140
|
-
});
|
1141
|
-
// Two elements created in two different places should be considered
|
1142
|
-
// equal for testing purposes and therefore we hide it from enumeration.
|
1143
|
-
Object.defineProperty(element, '_source', {
|
1144
|
-
configurable: false,
|
1145
|
-
enumerable: false,
|
1146
|
-
writable: false,
|
1147
|
-
value: source
|
1148
|
-
});
|
1149
|
-
if (Object.freeze) {
|
1150
|
-
Object.freeze(element.props);
|
1151
|
-
Object.freeze(element);
|
1152
|
-
}
|
1153
|
-
}
|
1154
|
-
|
1155
|
-
return element;
|
1156
|
-
};
|
1157
|
-
|
1158
|
-
/**
|
1159
|
-
* Create and return a new ReactElement of the given type.
|
1160
|
-
* See https://reactjs.org/docs/react-api.html#createelement
|
1161
|
-
*/
|
1162
|
-
function createElement(type, config, children) {
|
1163
|
-
var propName;
|
1164
|
-
|
1165
|
-
// Reserved names are extracted
|
1166
|
-
var props = {};
|
1167
|
-
|
1168
|
-
var key = null;
|
1169
|
-
var ref = null;
|
1170
|
-
var self = null;
|
1171
|
-
var source = null;
|
1172
|
-
|
1173
|
-
if (config != null) {
|
1174
|
-
if (hasValidRef(config)) {
|
1175
|
-
ref = config.ref;
|
1176
|
-
}
|
1177
|
-
if (hasValidKey(config)) {
|
1178
|
-
key = '' + config.key;
|
1179
|
-
}
|
1180
|
-
|
1181
|
-
self = config.__self === undefined ? null : config.__self;
|
1182
|
-
source = config.__source === undefined ? null : config.__source;
|
1183
|
-
// Remaining properties are added to a new props object
|
1184
|
-
for (propName in config) {
|
1185
|
-
if (hasOwnProperty.call(config, propName) && !RESERVED_PROPS.hasOwnProperty(propName)) {
|
1186
|
-
props[propName] = config[propName];
|
1187
|
-
}
|
1188
|
-
}
|
1189
|
-
}
|
1190
|
-
|
1191
|
-
// Children can be more than one argument, and those are transferred onto
|
1192
|
-
// the newly allocated props object.
|
1193
|
-
var childrenLength = arguments.length - 2;
|
1194
|
-
if (childrenLength === 1) {
|
1195
|
-
props.children = children;
|
1196
|
-
} else if (childrenLength > 1) {
|
1197
|
-
var childArray = Array(childrenLength);
|
1198
|
-
for (var i = 0; i < childrenLength; i++) {
|
1199
|
-
childArray[i] = arguments[i + 2];
|
1200
|
-
}
|
1201
|
-
{
|
1202
|
-
if (Object.freeze) {
|
1203
|
-
Object.freeze(childArray);
|
1204
|
-
}
|
1205
|
-
}
|
1206
|
-
props.children = childArray;
|
1207
|
-
}
|
1208
|
-
|
1209
|
-
// Resolve default props
|
1210
|
-
if (type && type.defaultProps) {
|
1211
|
-
var defaultProps = type.defaultProps;
|
1212
|
-
for (propName in defaultProps) {
|
1213
|
-
if (props[propName] === undefined) {
|
1214
|
-
props[propName] = defaultProps[propName];
|
1215
|
-
}
|
1216
|
-
}
|
1217
|
-
}
|
1218
|
-
{
|
1219
|
-
if (key || ref) {
|
1220
|
-
if (typeof props.$$typeof === 'undefined' || props.$$typeof !== REACT_ELEMENT_TYPE) {
|
1221
|
-
var displayName = typeof type === 'function' ? type.displayName || type.name || 'Unknown' : type;
|
1222
|
-
if (key) {
|
1223
|
-
defineKeyPropWarningGetter(props, displayName);
|
1224
|
-
}
|
1225
|
-
if (ref) {
|
1226
|
-
defineRefPropWarningGetter(props, displayName);
|
1227
|
-
}
|
1228
|
-
}
|
1229
|
-
}
|
1230
|
-
}
|
1231
|
-
return ReactElement(type, key, ref, self, source, ReactCurrentOwner.current, props);
|
1232
|
-
}
|
1233
|
-
|
1234
|
-
/**
|
1235
|
-
* Return a function that produces ReactElements of a given type.
|
1236
|
-
* See https://reactjs.org/docs/react-api.html#createfactory
|
1237
|
-
*/
|
1238
|
-
|
1239
|
-
|
1240
|
-
function cloneAndReplaceKey(oldElement, newKey) {
|
1241
|
-
var newElement = ReactElement(oldElement.type, newKey, oldElement.ref, oldElement._self, oldElement._source, oldElement._owner, oldElement.props);
|
1242
|
-
|
1243
|
-
return newElement;
|
1244
|
-
}
|
1245
|
-
|
1246
|
-
/**
|
1247
|
-
* Clone and return a new ReactElement using element as the starting point.
|
1248
|
-
* See https://reactjs.org/docs/react-api.html#cloneelement
|
1249
|
-
*/
|
1250
|
-
function cloneElement(element, config, children) {
|
1251
|
-
var propName;
|
1252
|
-
|
1253
|
-
// Original props are copied
|
1254
|
-
var props = _assign({}, element.props);
|
1255
|
-
|
1256
|
-
// Reserved names are extracted
|
1257
|
-
var key = element.key;
|
1258
|
-
var ref = element.ref;
|
1259
|
-
// Self is preserved since the owner is preserved.
|
1260
|
-
var self = element._self;
|
1261
|
-
// Source is preserved since cloneElement is unlikely to be targeted by a
|
1262
|
-
// transpiler, and the original source is probably a better indicator of the
|
1263
|
-
// true owner.
|
1264
|
-
var source = element._source;
|
1265
|
-
|
1266
|
-
// Owner will be preserved, unless ref is overridden
|
1267
|
-
var owner = element._owner;
|
1268
|
-
|
1269
|
-
if (config != null) {
|
1270
|
-
if (hasValidRef(config)) {
|
1271
|
-
// Silently steal the ref from the parent.
|
1272
|
-
ref = config.ref;
|
1273
|
-
owner = ReactCurrentOwner.current;
|
1274
|
-
}
|
1275
|
-
if (hasValidKey(config)) {
|
1276
|
-
key = '' + config.key;
|
1277
|
-
}
|
1278
|
-
|
1279
|
-
// Remaining properties override existing props
|
1280
|
-
var defaultProps;
|
1281
|
-
if (element.type && element.type.defaultProps) {
|
1282
|
-
defaultProps = element.type.defaultProps;
|
1283
|
-
}
|
1284
|
-
for (propName in config) {
|
1285
|
-
if (hasOwnProperty.call(config, propName) && !RESERVED_PROPS.hasOwnProperty(propName)) {
|
1286
|
-
if (config[propName] === undefined && defaultProps !== undefined) {
|
1287
|
-
// Resolve default props
|
1288
|
-
props[propName] = defaultProps[propName];
|
1289
|
-
} else {
|
1290
|
-
props[propName] = config[propName];
|
1291
|
-
}
|
1292
|
-
}
|
1293
|
-
}
|
1294
|
-
}
|
1295
|
-
|
1296
|
-
// Children can be more than one argument, and those are transferred onto
|
1297
|
-
// the newly allocated props object.
|
1298
|
-
var childrenLength = arguments.length - 2;
|
1299
|
-
if (childrenLength === 1) {
|
1300
|
-
props.children = children;
|
1301
|
-
} else if (childrenLength > 1) {
|
1302
|
-
var childArray = Array(childrenLength);
|
1303
|
-
for (var i = 0; i < childrenLength; i++) {
|
1304
|
-
childArray[i] = arguments[i + 2];
|
1305
|
-
}
|
1306
|
-
props.children = childArray;
|
1307
|
-
}
|
1308
|
-
|
1309
|
-
return ReactElement(element.type, key, ref, self, source, owner, props);
|
1310
|
-
}
|
1311
|
-
|
1312
|
-
/**
|
1313
|
-
* Verifies the object is a ReactElement.
|
1314
|
-
* See https://reactjs.org/docs/react-api.html#isvalidelement
|
1315
|
-
* @param {?object} object
|
1316
|
-
* @return {boolean} True if `object` is a valid component.
|
1317
|
-
* @final
|
1318
|
-
*/
|
1319
|
-
function isValidElement(object) {
|
1320
|
-
return typeof object === 'object' && object !== null && object.$$typeof === REACT_ELEMENT_TYPE;
|
1321
|
-
}
|
1322
|
-
|
1323
|
-
var ReactDebugCurrentFrame = {};
|
1324
|
-
|
1325
|
-
{
|
1326
|
-
// Component that is being worked on
|
1327
|
-
ReactDebugCurrentFrame.getCurrentStack = null;
|
1328
|
-
|
1329
|
-
ReactDebugCurrentFrame.getStackAddendum = function () {
|
1330
|
-
var impl = ReactDebugCurrentFrame.getCurrentStack;
|
1331
|
-
if (impl) {
|
1332
|
-
return impl();
|
1333
|
-
}
|
1334
|
-
return null;
|
1335
|
-
};
|
1336
|
-
}
|
1337
|
-
|
1338
|
-
var SEPARATOR = '.';
|
1339
|
-
var SUBSEPARATOR = ':';
|
1340
|
-
|
1341
|
-
/**
|
1342
|
-
* Escape and wrap key so it is safe to use as a reactid
|
1343
|
-
*
|
1344
|
-
* @param {string} key to be escaped.
|
1345
|
-
* @return {string} the escaped key.
|
1346
|
-
*/
|
1347
|
-
function escape(key) {
|
1348
|
-
var escapeRegex = /[=:]/g;
|
1349
|
-
var escaperLookup = {
|
1350
|
-
'=': '=0',
|
1351
|
-
':': '=2'
|
1352
|
-
};
|
1353
|
-
var escapedString = ('' + key).replace(escapeRegex, function (match) {
|
1354
|
-
return escaperLookup[match];
|
1355
|
-
});
|
1356
|
-
|
1357
|
-
return '$' + escapedString;
|
1358
|
-
}
|
1359
|
-
|
1360
|
-
/**
|
1361
|
-
* TODO: Test that a single child and an array with one item have the same key
|
1362
|
-
* pattern.
|
1363
|
-
*/
|
1364
|
-
|
1365
|
-
var didWarnAboutMaps = false;
|
1366
|
-
|
1367
|
-
var userProvidedKeyEscapeRegex = /\/+/g;
|
1368
|
-
function escapeUserProvidedKey(text) {
|
1369
|
-
return ('' + text).replace(userProvidedKeyEscapeRegex, '$&/');
|
1370
|
-
}
|
1371
|
-
|
1372
|
-
var POOL_SIZE = 10;
|
1373
|
-
var traverseContextPool = [];
|
1374
|
-
function getPooledTraverseContext(mapResult, keyPrefix, mapFunction, mapContext) {
|
1375
|
-
if (traverseContextPool.length) {
|
1376
|
-
var traverseContext = traverseContextPool.pop();
|
1377
|
-
traverseContext.result = mapResult;
|
1378
|
-
traverseContext.keyPrefix = keyPrefix;
|
1379
|
-
traverseContext.func = mapFunction;
|
1380
|
-
traverseContext.context = mapContext;
|
1381
|
-
traverseContext.count = 0;
|
1382
|
-
return traverseContext;
|
1383
|
-
} else {
|
1384
|
-
return {
|
1385
|
-
result: mapResult,
|
1386
|
-
keyPrefix: keyPrefix,
|
1387
|
-
func: mapFunction,
|
1388
|
-
context: mapContext,
|
1389
|
-
count: 0
|
1390
|
-
};
|
1391
|
-
}
|
1392
|
-
}
|
1393
|
-
|
1394
|
-
function releaseTraverseContext(traverseContext) {
|
1395
|
-
traverseContext.result = null;
|
1396
|
-
traverseContext.keyPrefix = null;
|
1397
|
-
traverseContext.func = null;
|
1398
|
-
traverseContext.context = null;
|
1399
|
-
traverseContext.count = 0;
|
1400
|
-
if (traverseContextPool.length < POOL_SIZE) {
|
1401
|
-
traverseContextPool.push(traverseContext);
|
1402
|
-
}
|
1403
|
-
}
|
1404
|
-
|
1405
|
-
/**
|
1406
|
-
* @param {?*} children Children tree container.
|
1407
|
-
* @param {!string} nameSoFar Name of the key path so far.
|
1408
|
-
* @param {!function} callback Callback to invoke with each child found.
|
1409
|
-
* @param {?*} traverseContext Used to pass information throughout the traversal
|
1410
|
-
* process.
|
1411
|
-
* @return {!number} The number of children in this subtree.
|
1412
|
-
*/
|
1413
|
-
function traverseAllChildrenImpl(children, nameSoFar, callback, traverseContext) {
|
1414
|
-
var type = typeof children;
|
1415
|
-
|
1416
|
-
if (type === 'undefined' || type === 'boolean') {
|
1417
|
-
// All of the above are perceived as null.
|
1418
|
-
children = null;
|
1419
|
-
}
|
1420
|
-
|
1421
|
-
var invokeCallback = false;
|
1422
|
-
|
1423
|
-
if (children === null) {
|
1424
|
-
invokeCallback = true;
|
1425
|
-
} else {
|
1426
|
-
switch (type) {
|
1427
|
-
case 'string':
|
1428
|
-
case 'number':
|
1429
|
-
invokeCallback = true;
|
1430
|
-
break;
|
1431
|
-
case 'object':
|
1432
|
-
switch (children.$$typeof) {
|
1433
|
-
case REACT_ELEMENT_TYPE:
|
1434
|
-
case REACT_CALL_TYPE:
|
1435
|
-
case REACT_RETURN_TYPE:
|
1436
|
-
case REACT_PORTAL_TYPE:
|
1437
|
-
invokeCallback = true;
|
1438
|
-
}
|
1439
|
-
}
|
1440
|
-
}
|
1441
|
-
|
1442
|
-
if (invokeCallback) {
|
1443
|
-
callback(traverseContext, children,
|
1444
|
-
// If it's the only child, treat the name as if it was wrapped in an array
|
1445
|
-
// so that it's consistent if the number of children grows.
|
1446
|
-
nameSoFar === '' ? SEPARATOR + getComponentKey(children, 0) : nameSoFar);
|
1447
|
-
return 1;
|
1448
|
-
}
|
1449
|
-
|
1450
|
-
var child;
|
1451
|
-
var nextName;
|
1452
|
-
var subtreeCount = 0; // Count of children found in the current subtree.
|
1453
|
-
var nextNamePrefix = nameSoFar === '' ? SEPARATOR : nameSoFar + SUBSEPARATOR;
|
1454
|
-
|
1455
|
-
if (Array.isArray(children)) {
|
1456
|
-
for (var i = 0; i < children.length; i++) {
|
1457
|
-
child = children[i];
|
1458
|
-
nextName = nextNamePrefix + getComponentKey(child, i);
|
1459
|
-
subtreeCount += traverseAllChildrenImpl(child, nextName, callback, traverseContext);
|
1460
|
-
}
|
1461
|
-
} else {
|
1462
|
-
var iteratorFn = getIteratorFn(children);
|
1463
|
-
if (typeof iteratorFn === 'function') {
|
1464
|
-
{
|
1465
|
-
// Warn about using Maps as children
|
1466
|
-
if (iteratorFn === children.entries) {
|
1467
|
-
warning(didWarnAboutMaps, 'Using Maps as children is unsupported and will likely yield ' + 'unexpected results. Convert it to a sequence/iterable of keyed ' + 'ReactElements instead.%s', ReactDebugCurrentFrame.getStackAddendum());
|
1468
|
-
didWarnAboutMaps = true;
|
1469
|
-
}
|
1470
|
-
}
|
1471
|
-
|
1472
|
-
var iterator = iteratorFn.call(children);
|
1473
|
-
var step;
|
1474
|
-
var ii = 0;
|
1475
|
-
while (!(step = iterator.next()).done) {
|
1476
|
-
child = step.value;
|
1477
|
-
nextName = nextNamePrefix + getComponentKey(child, ii++);
|
1478
|
-
subtreeCount += traverseAllChildrenImpl(child, nextName, callback, traverseContext);
|
1479
|
-
}
|
1480
|
-
} else if (type === 'object') {
|
1481
|
-
var addendum = '';
|
1482
|
-
{
|
1483
|
-
addendum = ' If you meant to render a collection of children, use an array ' + 'instead.' + ReactDebugCurrentFrame.getStackAddendum();
|
1484
|
-
}
|
1485
|
-
var childrenString = '' + children;
|
1486
|
-
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);
|
1487
|
-
}
|
1488
|
-
}
|
1489
|
-
|
1490
|
-
return subtreeCount;
|
1491
|
-
}
|
1492
|
-
|
1493
|
-
/**
|
1494
|
-
* Traverses children that are typically specified as `props.children`, but
|
1495
|
-
* might also be specified through attributes:
|
1496
|
-
*
|
1497
|
-
* - `traverseAllChildren(this.props.children, ...)`
|
1498
|
-
* - `traverseAllChildren(this.props.leftPanelChildren, ...)`
|
1499
|
-
*
|
1500
|
-
* The `traverseContext` is an optional argument that is passed through the
|
1501
|
-
* entire traversal. It can be used to store accumulations or anything else that
|
1502
|
-
* the callback might find relevant.
|
1503
|
-
*
|
1504
|
-
* @param {?*} children Children tree object.
|
1505
|
-
* @param {!function} callback To invoke upon traversing each child.
|
1506
|
-
* @param {?*} traverseContext Context for traversal.
|
1507
|
-
* @return {!number} The number of children in this subtree.
|
1508
|
-
*/
|
1509
|
-
function traverseAllChildren(children, callback, traverseContext) {
|
1510
|
-
if (children == null) {
|
1511
|
-
return 0;
|
1512
|
-
}
|
1513
|
-
|
1514
|
-
return traverseAllChildrenImpl(children, '', callback, traverseContext);
|
1515
|
-
}
|
1516
|
-
|
1517
|
-
/**
|
1518
|
-
* Generate a key string that identifies a component within a set.
|
1519
|
-
*
|
1520
|
-
* @param {*} component A component that could contain a manual key.
|
1521
|
-
* @param {number} index Index that is used if a manual key is not provided.
|
1522
|
-
* @return {string}
|
1523
|
-
*/
|
1524
|
-
function getComponentKey(component, index) {
|
1525
|
-
// Do some typechecking here since we call this blindly. We want to ensure
|
1526
|
-
// that we don't block potential future ES APIs.
|
1527
|
-
if (typeof component === 'object' && component !== null && component.key != null) {
|
1528
|
-
// Explicit key
|
1529
|
-
return escape(component.key);
|
1530
|
-
}
|
1531
|
-
// Implicit key determined by the index in the set
|
1532
|
-
return index.toString(36);
|
1533
|
-
}
|
1534
|
-
|
1535
|
-
function forEachSingleChild(bookKeeping, child, name) {
|
1536
|
-
var func = bookKeeping.func,
|
1537
|
-
context = bookKeeping.context;
|
1538
|
-
|
1539
|
-
func.call(context, child, bookKeeping.count++);
|
1540
|
-
}
|
1541
|
-
|
1542
|
-
/**
|
1543
|
-
* Iterates through children that are typically specified as `props.children`.
|
1544
|
-
*
|
1545
|
-
* See https://reactjs.org/docs/react-api.html#react.children.foreach
|
1546
|
-
*
|
1547
|
-
* The provided forEachFunc(child, index) will be called for each
|
1548
|
-
* leaf child.
|
1549
|
-
*
|
1550
|
-
* @param {?*} children Children tree container.
|
1551
|
-
* @param {function(*, int)} forEachFunc
|
1552
|
-
* @param {*} forEachContext Context for forEachContext.
|
1553
|
-
*/
|
1554
|
-
function forEachChildren(children, forEachFunc, forEachContext) {
|
1555
|
-
if (children == null) {
|
1556
|
-
return children;
|
1557
|
-
}
|
1558
|
-
var traverseContext = getPooledTraverseContext(null, null, forEachFunc, forEachContext);
|
1559
|
-
traverseAllChildren(children, forEachSingleChild, traverseContext);
|
1560
|
-
releaseTraverseContext(traverseContext);
|
1561
|
-
}
|
1562
|
-
|
1563
|
-
function mapSingleChildIntoContext(bookKeeping, child, childKey) {
|
1564
|
-
var result = bookKeeping.result,
|
1565
|
-
keyPrefix = bookKeeping.keyPrefix,
|
1566
|
-
func = bookKeeping.func,
|
1567
|
-
context = bookKeeping.context;
|
1568
|
-
|
1569
|
-
|
1570
|
-
var mappedChild = func.call(context, child, bookKeeping.count++);
|
1571
|
-
if (Array.isArray(mappedChild)) {
|
1572
|
-
mapIntoWithKeyPrefixInternal(mappedChild, result, childKey, emptyFunction.thatReturnsArgument);
|
1573
|
-
} else if (mappedChild != null) {
|
1574
|
-
if (isValidElement(mappedChild)) {
|
1575
|
-
mappedChild = cloneAndReplaceKey(mappedChild,
|
1576
|
-
// Keep both the (mapped) and old keys if they differ, just as
|
1577
|
-
// traverseAllChildren used to do for objects as children
|
1578
|
-
keyPrefix + (mappedChild.key && (!child || child.key !== mappedChild.key) ? escapeUserProvidedKey(mappedChild.key) + '/' : '') + childKey);
|
1579
|
-
}
|
1580
|
-
result.push(mappedChild);
|
1581
|
-
}
|
1582
|
-
}
|
1583
|
-
|
1584
|
-
function mapIntoWithKeyPrefixInternal(children, array, prefix, func, context) {
|
1585
|
-
var escapedPrefix = '';
|
1586
|
-
if (prefix != null) {
|
1587
|
-
escapedPrefix = escapeUserProvidedKey(prefix) + '/';
|
1588
|
-
}
|
1589
|
-
var traverseContext = getPooledTraverseContext(array, escapedPrefix, func, context);
|
1590
|
-
traverseAllChildren(children, mapSingleChildIntoContext, traverseContext);
|
1591
|
-
releaseTraverseContext(traverseContext);
|
1592
|
-
}
|
1593
|
-
|
1594
|
-
/**
|
1595
|
-
* Maps children that are typically specified as `props.children`.
|
1596
|
-
*
|
1597
|
-
* See https://reactjs.org/docs/react-api.html#react.children.map
|
1598
|
-
*
|
1599
|
-
* The provided mapFunction(child, key, index) will be called for each
|
1600
|
-
* leaf child.
|
1601
|
-
*
|
1602
|
-
* @param {?*} children Children tree container.
|
1603
|
-
* @param {function(*, int)} func The map function.
|
1604
|
-
* @param {*} context Context for mapFunction.
|
1605
|
-
* @return {object} Object containing the ordered map of results.
|
1606
|
-
*/
|
1607
|
-
function mapChildren(children, func, context) {
|
1608
|
-
if (children == null) {
|
1609
|
-
return children;
|
1610
|
-
}
|
1611
|
-
var result = [];
|
1612
|
-
mapIntoWithKeyPrefixInternal(children, result, null, func, context);
|
1613
|
-
return result;
|
1614
|
-
}
|
1615
|
-
|
1616
|
-
/**
|
1617
|
-
* Count the number of children that are typically specified as
|
1618
|
-
* `props.children`.
|
1619
|
-
*
|
1620
|
-
* See https://reactjs.org/docs/react-api.html#react.children.count
|
1621
|
-
*
|
1622
|
-
* @param {?*} children Children tree container.
|
1623
|
-
* @return {number} The number of children.
|
1624
|
-
*/
|
1625
|
-
function countChildren(children, context) {
|
1626
|
-
return traverseAllChildren(children, emptyFunction.thatReturnsNull, null);
|
1627
|
-
}
|
1628
|
-
|
1629
|
-
/**
|
1630
|
-
* Flatten a children object (typically specified as `props.children`) and
|
1631
|
-
* return an array with appropriately re-keyed children.
|
1632
|
-
*
|
1633
|
-
* See https://reactjs.org/docs/react-api.html#react.children.toarray
|
1634
|
-
*/
|
1635
|
-
function toArray(children) {
|
1636
|
-
var result = [];
|
1637
|
-
mapIntoWithKeyPrefixInternal(children, result, null, emptyFunction.thatReturnsArgument);
|
1638
|
-
return result;
|
1639
|
-
}
|
1640
|
-
|
1641
|
-
/**
|
1642
|
-
* Returns the first child in a collection of children and verifies that there
|
1643
|
-
* is only one child in the collection.
|
1644
|
-
*
|
1645
|
-
* See https://reactjs.org/docs/react-api.html#react.children.only
|
1646
|
-
*
|
1647
|
-
* The current implementation of this function assumes that a single child gets
|
1648
|
-
* passed without a wrapper, but the purpose of this helper function is to
|
1649
|
-
* abstract away the particular structure of children.
|
1650
|
-
*
|
1651
|
-
* @param {?object} children Child collection structure.
|
1652
|
-
* @return {ReactElement} The first and only `ReactElement` contained in the
|
1653
|
-
* structure.
|
1654
|
-
*/
|
1655
|
-
function onlyChild(children) {
|
1656
|
-
!isValidElement(children) ? invariant(false, 'React.Children.only expected to receive a single React element child.') : void 0;
|
1657
|
-
return children;
|
1658
|
-
}
|
1659
|
-
|
1660
|
-
var describeComponentFrame = function (name, source, ownerName) {
|
1661
|
-
return '\n in ' + (name || 'Unknown') + (source ? ' (at ' + source.fileName.replace(/^.*[\\\/]/, '') + ':' + source.lineNumber + ')' : ownerName ? ' (created by ' + ownerName + ')' : '');
|
1662
|
-
};
|
1663
|
-
|
1664
|
-
function getComponentName(fiber) {
|
1665
|
-
var type = fiber.type;
|
1666
|
-
|
1667
|
-
if (typeof type === 'string') {
|
1668
|
-
return type;
|
1669
|
-
}
|
1670
|
-
if (typeof type === 'function') {
|
1671
|
-
return type.displayName || type.name;
|
1672
|
-
}
|
1673
|
-
return null;
|
1674
|
-
}
|
1675
|
-
|
1676
|
-
/**
|
1677
|
-
* ReactElementValidator provides a wrapper around a element factory
|
1678
|
-
* which validates the props passed to the element. This is intended to be
|
1679
|
-
* used only in DEV and could be replaced by a static type checker for languages
|
1680
|
-
* that support it.
|
1681
|
-
*/
|
1682
|
-
|
1683
|
-
{
|
1684
|
-
var currentlyValidatingElement = null;
|
1685
|
-
|
1686
|
-
var propTypesMisspellWarningShown = false;
|
1687
|
-
|
1688
|
-
var getDisplayName = function (element) {
|
1689
|
-
if (element == null) {
|
1690
|
-
return '#empty';
|
1691
|
-
} else if (typeof element === 'string' || typeof element === 'number') {
|
1692
|
-
return '#text';
|
1693
|
-
} else if (typeof element.type === 'string') {
|
1694
|
-
return element.type;
|
1695
|
-
} else if (element.type === REACT_FRAGMENT_TYPE) {
|
1696
|
-
return 'React.Fragment';
|
1697
|
-
} else {
|
1698
|
-
return element.type.displayName || element.type.name || 'Unknown';
|
1699
|
-
}
|
1700
|
-
};
|
1701
|
-
|
1702
|
-
var getStackAddendum = function () {
|
1703
|
-
var stack = '';
|
1704
|
-
if (currentlyValidatingElement) {
|
1705
|
-
var name = getDisplayName(currentlyValidatingElement);
|
1706
|
-
var owner = currentlyValidatingElement._owner;
|
1707
|
-
stack += describeComponentFrame(name, currentlyValidatingElement._source, owner && getComponentName(owner));
|
1708
|
-
}
|
1709
|
-
stack += ReactDebugCurrentFrame.getStackAddendum() || '';
|
1710
|
-
return stack;
|
1711
|
-
};
|
1712
|
-
|
1713
|
-
var VALID_FRAGMENT_PROPS = new Map([['children', true], ['key', true]]);
|
1714
|
-
}
|
1715
|
-
|
1716
|
-
function getDeclarationErrorAddendum() {
|
1717
|
-
if (ReactCurrentOwner.current) {
|
1718
|
-
var name = getComponentName(ReactCurrentOwner.current);
|
1719
|
-
if (name) {
|
1720
|
-
return '\n\nCheck the render method of `' + name + '`.';
|
1721
|
-
}
|
1722
|
-
}
|
1723
|
-
return '';
|
1724
|
-
}
|
1725
|
-
|
1726
|
-
function getSourceInfoErrorAddendum(elementProps) {
|
1727
|
-
if (elementProps !== null && elementProps !== undefined && elementProps.__source !== undefined) {
|
1728
|
-
var source = elementProps.__source;
|
1729
|
-
var fileName = source.fileName.replace(/^.*[\\\/]/, '');
|
1730
|
-
var lineNumber = source.lineNumber;
|
1731
|
-
return '\n\nCheck your code at ' + fileName + ':' + lineNumber + '.';
|
1732
|
-
}
|
1733
|
-
return '';
|
1734
|
-
}
|
1735
|
-
|
1736
|
-
/**
|
1737
|
-
* Warn if there's no key explicitly set on dynamic arrays of children or
|
1738
|
-
* object keys are not valid. This allows us to keep track of children between
|
1739
|
-
* updates.
|
1740
|
-
*/
|
1741
|
-
var ownerHasKeyUseWarning = {};
|
1742
|
-
|
1743
|
-
function getCurrentComponentErrorInfo(parentType) {
|
1744
|
-
var info = getDeclarationErrorAddendum();
|
1745
|
-
|
1746
|
-
if (!info) {
|
1747
|
-
var parentName = typeof parentType === 'string' ? parentType : parentType.displayName || parentType.name;
|
1748
|
-
if (parentName) {
|
1749
|
-
info = '\n\nCheck the top-level render call using <' + parentName + '>.';
|
1750
|
-
}
|
1751
|
-
}
|
1752
|
-
return info;
|
1753
|
-
}
|
1754
|
-
|
1755
|
-
/**
|
1756
|
-
* Warn if the element doesn't have an explicit key assigned to it.
|
1757
|
-
* This element is in an array. The array could grow and shrink or be
|
1758
|
-
* reordered. All children that haven't already been validated are required to
|
1759
|
-
* have a "key" property assigned to it. Error statuses are cached so a warning
|
1760
|
-
* will only be shown once.
|
1761
|
-
*
|
1762
|
-
* @internal
|
1763
|
-
* @param {ReactElement} element Element that requires a key.
|
1764
|
-
* @param {*} parentType element's parent's type.
|
1765
|
-
*/
|
1766
|
-
function validateExplicitKey(element, parentType) {
|
1767
|
-
if (!element._store || element._store.validated || element.key != null) {
|
1768
|
-
return;
|
1769
|
-
}
|
1770
|
-
element._store.validated = true;
|
1771
|
-
|
1772
|
-
var currentComponentErrorInfo = getCurrentComponentErrorInfo(parentType);
|
1773
|
-
if (ownerHasKeyUseWarning[currentComponentErrorInfo]) {
|
1774
|
-
return;
|
1775
|
-
}
|
1776
|
-
ownerHasKeyUseWarning[currentComponentErrorInfo] = true;
|
1777
|
-
|
1778
|
-
// Usually the current owner is the offender, but if it accepts children as a
|
1779
|
-
// property, it may be the creator of the child that's responsible for
|
1780
|
-
// assigning it a key.
|
1781
|
-
var childOwner = '';
|
1782
|
-
if (element && element._owner && element._owner !== ReactCurrentOwner.current) {
|
1783
|
-
// Give the component that originally created this child.
|
1784
|
-
childOwner = ' It was passed a child from ' + getComponentName(element._owner) + '.';
|
1785
|
-
}
|
1786
|
-
|
1787
|
-
currentlyValidatingElement = element;
|
1788
|
-
{
|
1789
|
-
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, getStackAddendum());
|
1790
|
-
}
|
1791
|
-
currentlyValidatingElement = null;
|
1792
|
-
}
|
1793
|
-
|
1794
|
-
/**
|
1795
|
-
* Ensure that every element either is passed in a static location, in an
|
1796
|
-
* array with an explicit keys property defined, or in an object literal
|
1797
|
-
* with valid key property.
|
1798
|
-
*
|
1799
|
-
* @internal
|
1800
|
-
* @param {ReactNode} node Statically passed child of any type.
|
1801
|
-
* @param {*} parentType node's parent's type.
|
1802
|
-
*/
|
1803
|
-
function validateChildKeys(node, parentType) {
|
1804
|
-
if (typeof node !== 'object') {
|
1805
|
-
return;
|
1806
|
-
}
|
1807
|
-
if (Array.isArray(node)) {
|
1808
|
-
for (var i = 0; i < node.length; i++) {
|
1809
|
-
var child = node[i];
|
1810
|
-
if (isValidElement(child)) {
|
1811
|
-
validateExplicitKey(child, parentType);
|
1812
|
-
}
|
1813
|
-
}
|
1814
|
-
} else if (isValidElement(node)) {
|
1815
|
-
// This element was passed in a valid location.
|
1816
|
-
if (node._store) {
|
1817
|
-
node._store.validated = true;
|
1818
|
-
}
|
1819
|
-
} else if (node) {
|
1820
|
-
var iteratorFn = getIteratorFn(node);
|
1821
|
-
if (typeof iteratorFn === 'function') {
|
1822
|
-
// Entry iterators used to provide implicit keys,
|
1823
|
-
// but now we print a separate warning for them later.
|
1824
|
-
if (iteratorFn !== node.entries) {
|
1825
|
-
var iterator = iteratorFn.call(node);
|
1826
|
-
var step;
|
1827
|
-
while (!(step = iterator.next()).done) {
|
1828
|
-
if (isValidElement(step.value)) {
|
1829
|
-
validateExplicitKey(step.value, parentType);
|
1830
|
-
}
|
1831
|
-
}
|
1832
|
-
}
|
1833
|
-
}
|
1834
|
-
}
|
1835
|
-
}
|
1836
|
-
|
1837
|
-
/**
|
1838
|
-
* Given an element, validate that its props follow the propTypes definition,
|
1839
|
-
* provided by the type.
|
1840
|
-
*
|
1841
|
-
* @param {ReactElement} element
|
1842
|
-
*/
|
1843
|
-
function validatePropTypes(element) {
|
1844
|
-
var componentClass = element.type;
|
1845
|
-
if (typeof componentClass !== 'function') {
|
1846
|
-
return;
|
1847
|
-
}
|
1848
|
-
var name = componentClass.displayName || componentClass.name;
|
1849
|
-
var propTypes = componentClass.propTypes;
|
1850
|
-
if (propTypes) {
|
1851
|
-
currentlyValidatingElement = element;
|
1852
|
-
checkPropTypes(propTypes, element.props, 'prop', name, getStackAddendum);
|
1853
|
-
currentlyValidatingElement = null;
|
1854
|
-
} else if (componentClass.PropTypes !== undefined && !propTypesMisspellWarningShown) {
|
1855
|
-
propTypesMisspellWarningShown = true;
|
1856
|
-
warning(false, 'Component %s declared `PropTypes` instead of `propTypes`. Did you misspell the property assignment?', name || 'Unknown');
|
1857
|
-
}
|
1858
|
-
if (typeof componentClass.getDefaultProps === 'function') {
|
1859
|
-
warning(componentClass.getDefaultProps.isReactClassApproved, 'getDefaultProps is only used on classic React.createClass ' + 'definitions. Use a static property named `defaultProps` instead.');
|
1860
|
-
}
|
1861
|
-
}
|
1862
|
-
|
1863
|
-
/**
|
1864
|
-
* Given a fragment, validate that it can only be provided with fragment props
|
1865
|
-
* @param {ReactElement} fragment
|
1866
|
-
*/
|
1867
|
-
function validateFragmentProps(fragment) {
|
1868
|
-
currentlyValidatingElement = fragment;
|
1869
|
-
|
1870
|
-
var _iteratorNormalCompletion = true;
|
1871
|
-
var _didIteratorError = false;
|
1872
|
-
var _iteratorError = undefined;
|
1873
|
-
|
1874
|
-
try {
|
1875
|
-
for (var _iterator = Object.keys(fragment.props)[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true) {
|
1876
|
-
var key = _step.value;
|
1877
|
-
|
1878
|
-
if (!VALID_FRAGMENT_PROPS.has(key)) {
|
1879
|
-
warning(false, 'Invalid prop `%s` supplied to `React.Fragment`. ' + 'React.Fragment can only have `key` and `children` props.%s', key, getStackAddendum());
|
1880
|
-
break;
|
1881
|
-
}
|
1882
|
-
}
|
1883
|
-
} catch (err) {
|
1884
|
-
_didIteratorError = true;
|
1885
|
-
_iteratorError = err;
|
1886
|
-
} finally {
|
1887
|
-
try {
|
1888
|
-
if (!_iteratorNormalCompletion && _iterator['return']) {
|
1889
|
-
_iterator['return']();
|
1890
|
-
}
|
1891
|
-
} finally {
|
1892
|
-
if (_didIteratorError) {
|
1893
|
-
throw _iteratorError;
|
1894
|
-
}
|
1895
|
-
}
|
1896
|
-
}
|
1897
|
-
|
1898
|
-
if (fragment.ref !== null) {
|
1899
|
-
warning(false, 'Invalid attribute `ref` supplied to `React.Fragment`.%s', getStackAddendum());
|
1900
|
-
}
|
1901
|
-
|
1902
|
-
currentlyValidatingElement = null;
|
1903
|
-
}
|
1904
|
-
|
1905
|
-
function createElementWithValidation(type, props, children) {
|
1906
|
-
var validType = typeof type === 'string' || typeof type === 'function' || typeof type === 'symbol' || typeof type === 'number';
|
1907
|
-
// We warn in this case but don't throw. We expect the element creation to
|
1908
|
-
// succeed and there will likely be errors in render.
|
1909
|
-
if (!validType) {
|
1910
|
-
var info = '';
|
1911
|
-
if (type === undefined || typeof type === 'object' && type !== null && Object.keys(type).length === 0) {
|
1912
|
-
info += ' You likely forgot to export your component from the file ' + "it's defined in, or you might have mixed up default and named imports.";
|
1913
|
-
}
|
1914
|
-
|
1915
|
-
var sourceInfo = getSourceInfoErrorAddendum(props);
|
1916
|
-
if (sourceInfo) {
|
1917
|
-
info += sourceInfo;
|
1918
|
-
} else {
|
1919
|
-
info += getDeclarationErrorAddendum();
|
1920
|
-
}
|
1921
|
-
|
1922
|
-
info += getStackAddendum() || '';
|
1923
|
-
|
1924
|
-
warning(false, 'React.createElement: type is invalid -- expected a string (for ' + 'built-in components) or a class/function (for composite ' + 'components) but got: %s.%s', type == null ? type : typeof type, info);
|
1925
|
-
}
|
1926
|
-
|
1927
|
-
var element = createElement.apply(this, arguments);
|
1928
|
-
|
1929
|
-
// The result can be nullish if a mock or a custom function is used.
|
1930
|
-
// TODO: Drop this when these are no longer allowed as the type argument.
|
1931
|
-
if (element == null) {
|
1932
|
-
return element;
|
1933
|
-
}
|
1934
|
-
|
1935
|
-
// Skip key warning if the type isn't valid since our key validation logic
|
1936
|
-
// doesn't expect a non-string/function type and can throw confusing errors.
|
1937
|
-
// We don't want exception behavior to differ between dev and prod.
|
1938
|
-
// (Rendering will throw with a helpful message and as soon as the type is
|
1939
|
-
// fixed, the key warnings will appear.)
|
1940
|
-
if (validType) {
|
1941
|
-
for (var i = 2; i < arguments.length; i++) {
|
1942
|
-
validateChildKeys(arguments[i], type);
|
1943
|
-
}
|
1944
|
-
}
|
1945
|
-
|
1946
|
-
if (typeof type === 'symbol' && type === REACT_FRAGMENT_TYPE) {
|
1947
|
-
validateFragmentProps(element);
|
1948
|
-
} else {
|
1949
|
-
validatePropTypes(element);
|
1950
|
-
}
|
1951
|
-
|
1952
|
-
return element;
|
1953
|
-
}
|
1954
|
-
|
1955
|
-
function createFactoryWithValidation(type) {
|
1956
|
-
var validatedFactory = createElementWithValidation.bind(null, type);
|
1957
|
-
// Legacy hook TODO: Warn if this is accessed
|
1958
|
-
validatedFactory.type = type;
|
1959
|
-
|
1960
|
-
{
|
1961
|
-
Object.defineProperty(validatedFactory, 'type', {
|
1962
|
-
enumerable: false,
|
1963
|
-
get: function () {
|
1964
|
-
lowPriorityWarning$1(false, 'Factory.type is deprecated. Access the class directly ' + 'before passing it to createFactory.');
|
1965
|
-
Object.defineProperty(this, 'type', {
|
1966
|
-
value: type
|
1967
|
-
});
|
1968
|
-
return type;
|
1969
|
-
}
|
1970
|
-
});
|
1971
|
-
}
|
1972
|
-
|
1973
|
-
return validatedFactory;
|
1974
|
-
}
|
1975
|
-
|
1976
|
-
function cloneElementWithValidation(element, props, children) {
|
1977
|
-
var newElement = cloneElement.apply(this, arguments);
|
1978
|
-
for (var i = 2; i < arguments.length; i++) {
|
1979
|
-
validateChildKeys(arguments[i], newElement.type);
|
1980
|
-
}
|
1981
|
-
validatePropTypes(newElement);
|
1982
|
-
return newElement;
|
1983
|
-
}
|
1984
|
-
|
1985
|
-
var React = {
|
1986
|
-
Children: {
|
1987
|
-
map: mapChildren,
|
1988
|
-
forEach: forEachChildren,
|
1989
|
-
count: countChildren,
|
1990
|
-
toArray: toArray,
|
1991
|
-
only: onlyChild
|
1992
|
-
},
|
1993
|
-
|
1994
|
-
Component: Component,
|
1995
|
-
PureComponent: PureComponent,
|
1996
|
-
unstable_AsyncComponent: AsyncComponent,
|
1997
|
-
|
1998
|
-
Fragment: REACT_FRAGMENT_TYPE,
|
1999
|
-
|
2000
|
-
createElement: createElementWithValidation,
|
2001
|
-
cloneElement: cloneElementWithValidation,
|
2002
|
-
createFactory: createFactoryWithValidation,
|
2003
|
-
isValidElement: isValidElement,
|
2004
|
-
|
2005
|
-
version: ReactVersion,
|
2006
|
-
|
2007
|
-
__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED: {
|
2008
|
-
ReactCurrentOwner: ReactCurrentOwner,
|
2009
|
-
// Used by renderers to avoid bundling object-assign twice in UMD bundles:
|
2010
|
-
assign: _assign
|
2011
|
-
}
|
2012
|
-
};
|
2013
|
-
|
2014
|
-
{
|
2015
|
-
_assign(React.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED, {
|
2016
|
-
// These should not be included in production.
|
2017
|
-
ReactDebugCurrentFrame: ReactDebugCurrentFrame,
|
2018
|
-
// Shim for React DOM 16.0.0 which still destructured (but not used) this.
|
2019
|
-
// TODO: remove in React 17.0.
|
2020
|
-
ReactComponentTreeHook: {}
|
2021
|
-
});
|
2022
|
-
}
|
2023
|
-
|
2024
|
-
|
2025
|
-
|
2026
|
-
var React$2 = Object.freeze({
|
2027
|
-
default: React
|
2028
|
-
});
|
2029
|
-
|
2030
|
-
var React$3 = ( React$2 && React ) || React$2;
|
2031
|
-
|
2032
|
-
// TODO: decide on the top-level export form.
|
2033
|
-
// This is hacky but makes it work with both Rollup and Jest.
|
2034
|
-
var react = React$3['default'] ? React$3['default'] : React$3;
|
2035
|
-
|
2036
|
-
module.exports = react;
|
2037
|
-
})();
|
2038
|
-
}
|
2039
|
-
|
2040
|
-
/* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(0)))
|
2041
|
-
|
2042
|
-
/***/ }),
|
2043
|
-
/* 11 */,
|
2044
|
-
/* 12 */,
|
2045
|
-
/* 13 */,
|
2046
|
-
/* 14 */,
|
2047
|
-
/* 15 */,
|
2048
|
-
/* 16 */,
|
2049
|
-
/* 17 */,
|
2050
|
-
/* 18 */,
|
2051
|
-
/* 19 */,
|
2052
|
-
/* 20 */,
|
2053
|
-
/* 21 */,
|
2054
|
-
/* 22 */,
|
2055
|
-
/* 23 */,
|
2056
|
-
/* 24 */,
|
2057
|
-
/* 25 */,
|
2058
|
-
/* 26 */,
|
2059
|
-
/* 27 */,
|
2060
|
-
/* 28 */
|
2061
|
-
/***/ (function(module, exports, __webpack_require__) {
|
2062
|
-
|
2063
|
-
"use strict";
|
2064
|
-
|
2065
|
-
|
2066
|
-
Object.defineProperty(exports, "__esModule", {
|
2067
|
-
value: true
|
2068
|
-
});
|
2069
|
-
|
2070
|
-
var _react = __webpack_require__(6);
|
2071
|
-
|
2072
|
-
var _react2 = _interopRequireDefault(_react);
|
2073
|
-
|
2074
|
-
var _propTypes = __webpack_require__(29);
|
2075
|
-
|
2076
|
-
var _propTypes2 = _interopRequireDefault(_propTypes);
|
2077
|
-
|
2078
|
-
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
2079
|
-
|
2080
|
-
var MyComponent = function MyComponent(_ref) {
|
2081
|
-
var myName = _ref.myName,
|
2082
|
-
value = _ref.value;
|
2083
|
-
return _react2.default.createElement(
|
2084
|
-
'h1',
|
2085
|
-
null,
|
2086
|
-
myName,
|
2087
|
-
': ',
|
2088
|
-
value
|
2089
|
-
);
|
2090
|
-
};
|
2091
|
-
|
2092
|
-
MyComponent.propTypes = {
|
2093
|
-
myName: _propTypes2.default.string.isRequired,
|
2094
|
-
value: _propTypes2.default.number.isRequired
|
2095
|
-
};
|
2096
|
-
|
2097
|
-
exports.default = MyComponent;
|
2098
|
-
|
2099
|
-
window.MyComponent = MyComponent;
|
2100
|
-
|
2101
|
-
/***/ }),
|
2102
|
-
/* 29 */
|
2103
|
-
/***/ (function(module, exports, __webpack_require__) {
|
2104
|
-
|
2105
|
-
/* WEBPACK VAR INJECTION */(function(process) {/**
|
2106
|
-
* Copyright (c) 2013-present, Facebook, Inc.
|
2107
|
-
*
|
2108
|
-
* This source code is licensed under the MIT license found in the
|
2109
|
-
* LICENSE file in the root directory of this source tree.
|
2110
|
-
*/
|
2111
|
-
|
2112
|
-
if (process.env.NODE_ENV !== 'production') {
|
2113
|
-
var REACT_ELEMENT_TYPE = (typeof Symbol === 'function' &&
|
2114
|
-
Symbol.for &&
|
2115
|
-
Symbol.for('react.element')) ||
|
2116
|
-
0xeac7;
|
2117
|
-
|
2118
|
-
var isValidElement = function(object) {
|
2119
|
-
return typeof object === 'object' &&
|
2120
|
-
object !== null &&
|
2121
|
-
object.$$typeof === REACT_ELEMENT_TYPE;
|
2122
|
-
};
|
2123
|
-
|
2124
|
-
// By explicitly using `prop-types` you are opting into new development behavior.
|
2125
|
-
// http://fb.me/prop-types-in-prod
|
2126
|
-
var throwOnDirectAccess = true;
|
2127
|
-
module.exports = __webpack_require__(30)(isValidElement, throwOnDirectAccess);
|
2128
|
-
} else {
|
2129
|
-
// By explicitly using `prop-types` you are opting into new production behavior.
|
2130
|
-
// http://fb.me/prop-types-in-prod
|
2131
|
-
module.exports = __webpack_require__(31)();
|
2132
|
-
}
|
2133
|
-
|
2134
|
-
/* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(0)))
|
2135
|
-
|
2136
|
-
/***/ }),
|
2137
|
-
/* 30 */
|
2138
|
-
/***/ (function(module, exports, __webpack_require__) {
|
2139
|
-
|
2140
|
-
"use strict";
|
2141
|
-
/* WEBPACK VAR INJECTION */(function(process) {/**
|
2142
|
-
* Copyright (c) 2013-present, Facebook, Inc.
|
2143
|
-
*
|
2144
|
-
* This source code is licensed under the MIT license found in the
|
2145
|
-
* LICENSE file in the root directory of this source tree.
|
2146
|
-
*/
|
2147
|
-
|
2148
|
-
|
2149
|
-
|
2150
|
-
var emptyFunction = __webpack_require__(1);
|
2151
|
-
var invariant = __webpack_require__(3);
|
2152
|
-
var warning = __webpack_require__(5);
|
2153
|
-
var assign = __webpack_require__(2);
|
2154
|
-
|
2155
|
-
var ReactPropTypesSecret = __webpack_require__(8);
|
2156
|
-
var checkPropTypes = __webpack_require__(7);
|
2157
|
-
|
2158
|
-
module.exports = function(isValidElement, throwOnDirectAccess) {
|
2159
|
-
/* global Symbol */
|
2160
|
-
var ITERATOR_SYMBOL = typeof Symbol === 'function' && Symbol.iterator;
|
2161
|
-
var FAUX_ITERATOR_SYMBOL = '@@iterator'; // Before Symbol spec.
|
2162
|
-
|
2163
|
-
/**
|
2164
|
-
* Returns the iterator method function contained on the iterable object.
|
2165
|
-
*
|
2166
|
-
* Be sure to invoke the function with the iterable as context:
|
2167
|
-
*
|
2168
|
-
* var iteratorFn = getIteratorFn(myIterable);
|
2169
|
-
* if (iteratorFn) {
|
2170
|
-
* var iterator = iteratorFn.call(myIterable);
|
2171
|
-
* ...
|
2172
|
-
* }
|
2173
|
-
*
|
2174
|
-
* @param {?object} maybeIterable
|
2175
|
-
* @return {?function}
|
2176
|
-
*/
|
2177
|
-
function getIteratorFn(maybeIterable) {
|
2178
|
-
var iteratorFn = maybeIterable && (ITERATOR_SYMBOL && maybeIterable[ITERATOR_SYMBOL] || maybeIterable[FAUX_ITERATOR_SYMBOL]);
|
2179
|
-
if (typeof iteratorFn === 'function') {
|
2180
|
-
return iteratorFn;
|
2181
|
-
}
|
2182
|
-
}
|
2183
|
-
|
2184
|
-
/**
|
2185
|
-
* Collection of methods that allow declaration and validation of props that are
|
2186
|
-
* supplied to React components. Example usage:
|
2187
|
-
*
|
2188
|
-
* var Props = require('ReactPropTypes');
|
2189
|
-
* var MyArticle = React.createClass({
|
2190
|
-
* propTypes: {
|
2191
|
-
* // An optional string prop named "description".
|
2192
|
-
* description: Props.string,
|
2193
|
-
*
|
2194
|
-
* // A required enum prop named "category".
|
2195
|
-
* category: Props.oneOf(['News','Photos']).isRequired,
|
2196
|
-
*
|
2197
|
-
* // A prop named "dialog" that requires an instance of Dialog.
|
2198
|
-
* dialog: Props.instanceOf(Dialog).isRequired
|
2199
|
-
* },
|
2200
|
-
* render: function() { ... }
|
2201
|
-
* });
|
2202
|
-
*
|
2203
|
-
* A more formal specification of how these methods are used:
|
2204
|
-
*
|
2205
|
-
* type := array|bool|func|object|number|string|oneOf([...])|instanceOf(...)
|
2206
|
-
* decl := ReactPropTypes.{type}(.isRequired)?
|
2207
|
-
*
|
2208
|
-
* Each and every declaration produces a function with the same signature. This
|
2209
|
-
* allows the creation of custom validation functions. For example:
|
2210
|
-
*
|
2211
|
-
* var MyLink = React.createClass({
|
2212
|
-
* propTypes: {
|
2213
|
-
* // An optional string or URI prop named "href".
|
2214
|
-
* href: function(props, propName, componentName) {
|
2215
|
-
* var propValue = props[propName];
|
2216
|
-
* if (propValue != null && typeof propValue !== 'string' &&
|
2217
|
-
* !(propValue instanceof URI)) {
|
2218
|
-
* return new Error(
|
2219
|
-
* 'Expected a string or an URI for ' + propName + ' in ' +
|
2220
|
-
* componentName
|
2221
|
-
* );
|
2222
|
-
* }
|
2223
|
-
* }
|
2224
|
-
* },
|
2225
|
-
* render: function() {...}
|
2226
|
-
* });
|
2227
|
-
*
|
2228
|
-
* @internal
|
2229
|
-
*/
|
2230
|
-
|
2231
|
-
var ANONYMOUS = '<<anonymous>>';
|
2232
|
-
|
2233
|
-
// Important!
|
2234
|
-
// Keep this list in sync with production version in `./factoryWithThrowingShims.js`.
|
2235
|
-
var ReactPropTypes = {
|
2236
|
-
array: createPrimitiveTypeChecker('array'),
|
2237
|
-
bool: createPrimitiveTypeChecker('boolean'),
|
2238
|
-
func: createPrimitiveTypeChecker('function'),
|
2239
|
-
number: createPrimitiveTypeChecker('number'),
|
2240
|
-
object: createPrimitiveTypeChecker('object'),
|
2241
|
-
string: createPrimitiveTypeChecker('string'),
|
2242
|
-
symbol: createPrimitiveTypeChecker('symbol'),
|
2243
|
-
|
2244
|
-
any: createAnyTypeChecker(),
|
2245
|
-
arrayOf: createArrayOfTypeChecker,
|
2246
|
-
element: createElementTypeChecker(),
|
2247
|
-
instanceOf: createInstanceTypeChecker,
|
2248
|
-
node: createNodeChecker(),
|
2249
|
-
objectOf: createObjectOfTypeChecker,
|
2250
|
-
oneOf: createEnumTypeChecker,
|
2251
|
-
oneOfType: createUnionTypeChecker,
|
2252
|
-
shape: createShapeTypeChecker,
|
2253
|
-
exact: createStrictShapeTypeChecker,
|
2254
|
-
};
|
2255
|
-
|
2256
|
-
/**
|
2257
|
-
* inlined Object.is polyfill to avoid requiring consumers ship their own
|
2258
|
-
* https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/is
|
2259
|
-
*/
|
2260
|
-
/*eslint-disable no-self-compare*/
|
2261
|
-
function is(x, y) {
|
2262
|
-
// SameValue algorithm
|
2263
|
-
if (x === y) {
|
2264
|
-
// Steps 1-5, 7-10
|
2265
|
-
// Steps 6.b-6.e: +0 != -0
|
2266
|
-
return x !== 0 || 1 / x === 1 / y;
|
2267
|
-
} else {
|
2268
|
-
// Step 6.a: NaN == NaN
|
2269
|
-
return x !== x && y !== y;
|
2270
|
-
}
|
2271
|
-
}
|
2272
|
-
/*eslint-enable no-self-compare*/
|
2273
|
-
|
2274
|
-
/**
|
2275
|
-
* We use an Error-like object for backward compatibility as people may call
|
2276
|
-
* PropTypes directly and inspect their output. However, we don't use real
|
2277
|
-
* Errors anymore. We don't inspect their stack anyway, and creating them
|
2278
|
-
* is prohibitively expensive if they are created too often, such as what
|
2279
|
-
* happens in oneOfType() for any type before the one that matched.
|
2280
|
-
*/
|
2281
|
-
function PropTypeError(message) {
|
2282
|
-
this.message = message;
|
2283
|
-
this.stack = '';
|
2284
|
-
}
|
2285
|
-
// Make `instanceof Error` still work for returned errors.
|
2286
|
-
PropTypeError.prototype = Error.prototype;
|
2287
|
-
|
2288
|
-
function createChainableTypeChecker(validate) {
|
2289
|
-
if (process.env.NODE_ENV !== 'production') {
|
2290
|
-
var manualPropTypeCallCache = {};
|
2291
|
-
var manualPropTypeWarningCount = 0;
|
2292
|
-
}
|
2293
|
-
function checkType(isRequired, props, propName, componentName, location, propFullName, secret) {
|
2294
|
-
componentName = componentName || ANONYMOUS;
|
2295
|
-
propFullName = propFullName || propName;
|
2296
|
-
|
2297
|
-
if (secret !== ReactPropTypesSecret) {
|
2298
|
-
if (throwOnDirectAccess) {
|
2299
|
-
// New behavior only for users of `prop-types` package
|
2300
|
-
invariant(
|
2301
|
-
false,
|
2302
|
-
'Calling PropTypes validators directly is not supported by the `prop-types` package. ' +
|
2303
|
-
'Use `PropTypes.checkPropTypes()` to call them. ' +
|
2304
|
-
'Read more at http://fb.me/use-check-prop-types'
|
2305
|
-
);
|
2306
|
-
} else if (process.env.NODE_ENV !== 'production' && typeof console !== 'undefined') {
|
2307
|
-
// Old behavior for people using React.PropTypes
|
2308
|
-
var cacheKey = componentName + ':' + propName;
|
2309
|
-
if (
|
2310
|
-
!manualPropTypeCallCache[cacheKey] &&
|
2311
|
-
// Avoid spamming the console because they are often not actionable except for lib authors
|
2312
|
-
manualPropTypeWarningCount < 3
|
2313
|
-
) {
|
2314
|
-
warning(
|
2315
|
-
false,
|
2316
|
-
'You are manually calling a React.PropTypes validation ' +
|
2317
|
-
'function for the `%s` prop on `%s`. This is deprecated ' +
|
2318
|
-
'and will throw in the standalone `prop-types` package. ' +
|
2319
|
-
'You may be seeing this warning due to a third-party PropTypes ' +
|
2320
|
-
'library. See https://fb.me/react-warning-dont-call-proptypes ' + 'for details.',
|
2321
|
-
propFullName,
|
2322
|
-
componentName
|
2323
|
-
);
|
2324
|
-
manualPropTypeCallCache[cacheKey] = true;
|
2325
|
-
manualPropTypeWarningCount++;
|
2326
|
-
}
|
2327
|
-
}
|
2328
|
-
}
|
2329
|
-
if (props[propName] == null) {
|
2330
|
-
if (isRequired) {
|
2331
|
-
if (props[propName] === null) {
|
2332
|
-
return new PropTypeError('The ' + location + ' `' + propFullName + '` is marked as required ' + ('in `' + componentName + '`, but its value is `null`.'));
|
2333
|
-
}
|
2334
|
-
return new PropTypeError('The ' + location + ' `' + propFullName + '` is marked as required in ' + ('`' + componentName + '`, but its value is `undefined`.'));
|
2335
|
-
}
|
2336
|
-
return null;
|
2337
|
-
} else {
|
2338
|
-
return validate(props, propName, componentName, location, propFullName);
|
2339
|
-
}
|
2340
|
-
}
|
2341
|
-
|
2342
|
-
var chainedCheckType = checkType.bind(null, false);
|
2343
|
-
chainedCheckType.isRequired = checkType.bind(null, true);
|
2344
|
-
|
2345
|
-
return chainedCheckType;
|
2346
|
-
}
|
2347
|
-
|
2348
|
-
function createPrimitiveTypeChecker(expectedType) {
|
2349
|
-
function validate(props, propName, componentName, location, propFullName, secret) {
|
2350
|
-
var propValue = props[propName];
|
2351
|
-
var propType = getPropType(propValue);
|
2352
|
-
if (propType !== expectedType) {
|
2353
|
-
// `propValue` being instance of, say, date/regexp, pass the 'object'
|
2354
|
-
// check, but we can offer a more precise error message here rather than
|
2355
|
-
// 'of type `object`'.
|
2356
|
-
var preciseType = getPreciseType(propValue);
|
2357
|
-
|
2358
|
-
return new PropTypeError('Invalid ' + location + ' `' + propFullName + '` of type ' + ('`' + preciseType + '` supplied to `' + componentName + '`, expected ') + ('`' + expectedType + '`.'));
|
2359
|
-
}
|
2360
|
-
return null;
|
2361
|
-
}
|
2362
|
-
return createChainableTypeChecker(validate);
|
2363
|
-
}
|
2364
|
-
|
2365
|
-
function createAnyTypeChecker() {
|
2366
|
-
return createChainableTypeChecker(emptyFunction.thatReturnsNull);
|
2367
|
-
}
|
2368
|
-
|
2369
|
-
function createArrayOfTypeChecker(typeChecker) {
|
2370
|
-
function validate(props, propName, componentName, location, propFullName) {
|
2371
|
-
if (typeof typeChecker !== 'function') {
|
2372
|
-
return new PropTypeError('Property `' + propFullName + '` of component `' + componentName + '` has invalid PropType notation inside arrayOf.');
|
2373
|
-
}
|
2374
|
-
var propValue = props[propName];
|
2375
|
-
if (!Array.isArray(propValue)) {
|
2376
|
-
var propType = getPropType(propValue);
|
2377
|
-
return new PropTypeError('Invalid ' + location + ' `' + propFullName + '` of type ' + ('`' + propType + '` supplied to `' + componentName + '`, expected an array.'));
|
2378
|
-
}
|
2379
|
-
for (var i = 0; i < propValue.length; i++) {
|
2380
|
-
var error = typeChecker(propValue, i, componentName, location, propFullName + '[' + i + ']', ReactPropTypesSecret);
|
2381
|
-
if (error instanceof Error) {
|
2382
|
-
return error;
|
2383
|
-
}
|
2384
|
-
}
|
2385
|
-
return null;
|
2386
|
-
}
|
2387
|
-
return createChainableTypeChecker(validate);
|
2388
|
-
}
|
2389
|
-
|
2390
|
-
function createElementTypeChecker() {
|
2391
|
-
function validate(props, propName, componentName, location, propFullName) {
|
2392
|
-
var propValue = props[propName];
|
2393
|
-
if (!isValidElement(propValue)) {
|
2394
|
-
var propType = getPropType(propValue);
|
2395
|
-
return new PropTypeError('Invalid ' + location + ' `' + propFullName + '` of type ' + ('`' + propType + '` supplied to `' + componentName + '`, expected a single ReactElement.'));
|
2396
|
-
}
|
2397
|
-
return null;
|
2398
|
-
}
|
2399
|
-
return createChainableTypeChecker(validate);
|
2400
|
-
}
|
2401
|
-
|
2402
|
-
function createInstanceTypeChecker(expectedClass) {
|
2403
|
-
function validate(props, propName, componentName, location, propFullName) {
|
2404
|
-
if (!(props[propName] instanceof expectedClass)) {
|
2405
|
-
var expectedClassName = expectedClass.name || ANONYMOUS;
|
2406
|
-
var actualClassName = getClassName(props[propName]);
|
2407
|
-
return new PropTypeError('Invalid ' + location + ' `' + propFullName + '` of type ' + ('`' + actualClassName + '` supplied to `' + componentName + '`, expected ') + ('instance of `' + expectedClassName + '`.'));
|
2408
|
-
}
|
2409
|
-
return null;
|
2410
|
-
}
|
2411
|
-
return createChainableTypeChecker(validate);
|
2412
|
-
}
|
2413
|
-
|
2414
|
-
function createEnumTypeChecker(expectedValues) {
|
2415
|
-
if (!Array.isArray(expectedValues)) {
|
2416
|
-
process.env.NODE_ENV !== 'production' ? warning(false, 'Invalid argument supplied to oneOf, expected an instance of array.') : void 0;
|
2417
|
-
return emptyFunction.thatReturnsNull;
|
2418
|
-
}
|
2419
|
-
|
2420
|
-
function validate(props, propName, componentName, location, propFullName) {
|
2421
|
-
var propValue = props[propName];
|
2422
|
-
for (var i = 0; i < expectedValues.length; i++) {
|
2423
|
-
if (is(propValue, expectedValues[i])) {
|
2424
|
-
return null;
|
2425
|
-
}
|
2426
|
-
}
|
2427
|
-
|
2428
|
-
var valuesString = JSON.stringify(expectedValues);
|
2429
|
-
return new PropTypeError('Invalid ' + location + ' `' + propFullName + '` of value `' + propValue + '` ' + ('supplied to `' + componentName + '`, expected one of ' + valuesString + '.'));
|
2430
|
-
}
|
2431
|
-
return createChainableTypeChecker(validate);
|
2432
|
-
}
|
2433
|
-
|
2434
|
-
function createObjectOfTypeChecker(typeChecker) {
|
2435
|
-
function validate(props, propName, componentName, location, propFullName) {
|
2436
|
-
if (typeof typeChecker !== 'function') {
|
2437
|
-
return new PropTypeError('Property `' + propFullName + '` of component `' + componentName + '` has invalid PropType notation inside objectOf.');
|
2438
|
-
}
|
2439
|
-
var propValue = props[propName];
|
2440
|
-
var propType = getPropType(propValue);
|
2441
|
-
if (propType !== 'object') {
|
2442
|
-
return new PropTypeError('Invalid ' + location + ' `' + propFullName + '` of type ' + ('`' + propType + '` supplied to `' + componentName + '`, expected an object.'));
|
2443
|
-
}
|
2444
|
-
for (var key in propValue) {
|
2445
|
-
if (propValue.hasOwnProperty(key)) {
|
2446
|
-
var error = typeChecker(propValue, key, componentName, location, propFullName + '.' + key, ReactPropTypesSecret);
|
2447
|
-
if (error instanceof Error) {
|
2448
|
-
return error;
|
2449
|
-
}
|
2450
|
-
}
|
2451
|
-
}
|
2452
|
-
return null;
|
2453
|
-
}
|
2454
|
-
return createChainableTypeChecker(validate);
|
2455
|
-
}
|
2456
|
-
|
2457
|
-
function createUnionTypeChecker(arrayOfTypeCheckers) {
|
2458
|
-
if (!Array.isArray(arrayOfTypeCheckers)) {
|
2459
|
-
process.env.NODE_ENV !== 'production' ? warning(false, 'Invalid argument supplied to oneOfType, expected an instance of array.') : void 0;
|
2460
|
-
return emptyFunction.thatReturnsNull;
|
2461
|
-
}
|
2462
|
-
|
2463
|
-
for (var i = 0; i < arrayOfTypeCheckers.length; i++) {
|
2464
|
-
var checker = arrayOfTypeCheckers[i];
|
2465
|
-
if (typeof checker !== 'function') {
|
2466
|
-
warning(
|
2467
|
-
false,
|
2468
|
-
'Invalid argument supplied to oneOfType. Expected an array of check functions, but ' +
|
2469
|
-
'received %s at index %s.',
|
2470
|
-
getPostfixForTypeWarning(checker),
|
2471
|
-
i
|
2472
|
-
);
|
2473
|
-
return emptyFunction.thatReturnsNull;
|
2474
|
-
}
|
2475
|
-
}
|
2476
|
-
|
2477
|
-
function validate(props, propName, componentName, location, propFullName) {
|
2478
|
-
for (var i = 0; i < arrayOfTypeCheckers.length; i++) {
|
2479
|
-
var checker = arrayOfTypeCheckers[i];
|
2480
|
-
if (checker(props, propName, componentName, location, propFullName, ReactPropTypesSecret) == null) {
|
2481
|
-
return null;
|
2482
|
-
}
|
2483
|
-
}
|
2484
|
-
|
2485
|
-
return new PropTypeError('Invalid ' + location + ' `' + propFullName + '` supplied to ' + ('`' + componentName + '`.'));
|
2486
|
-
}
|
2487
|
-
return createChainableTypeChecker(validate);
|
2488
|
-
}
|
2489
|
-
|
2490
|
-
function createNodeChecker() {
|
2491
|
-
function validate(props, propName, componentName, location, propFullName) {
|
2492
|
-
if (!isNode(props[propName])) {
|
2493
|
-
return new PropTypeError('Invalid ' + location + ' `' + propFullName + '` supplied to ' + ('`' + componentName + '`, expected a ReactNode.'));
|
2494
|
-
}
|
2495
|
-
return null;
|
2496
|
-
}
|
2497
|
-
return createChainableTypeChecker(validate);
|
2498
|
-
}
|
2499
|
-
|
2500
|
-
function createShapeTypeChecker(shapeTypes) {
|
2501
|
-
function validate(props, propName, componentName, location, propFullName) {
|
2502
|
-
var propValue = props[propName];
|
2503
|
-
var propType = getPropType(propValue);
|
2504
|
-
if (propType !== 'object') {
|
2505
|
-
return new PropTypeError('Invalid ' + location + ' `' + propFullName + '` of type `' + propType + '` ' + ('supplied to `' + componentName + '`, expected `object`.'));
|
2506
|
-
}
|
2507
|
-
for (var key in shapeTypes) {
|
2508
|
-
var checker = shapeTypes[key];
|
2509
|
-
if (!checker) {
|
2510
|
-
continue;
|
2511
|
-
}
|
2512
|
-
var error = checker(propValue, key, componentName, location, propFullName + '.' + key, ReactPropTypesSecret);
|
2513
|
-
if (error) {
|
2514
|
-
return error;
|
2515
|
-
}
|
2516
|
-
}
|
2517
|
-
return null;
|
2518
|
-
}
|
2519
|
-
return createChainableTypeChecker(validate);
|
2520
|
-
}
|
2521
|
-
|
2522
|
-
function createStrictShapeTypeChecker(shapeTypes) {
|
2523
|
-
function validate(props, propName, componentName, location, propFullName) {
|
2524
|
-
var propValue = props[propName];
|
2525
|
-
var propType = getPropType(propValue);
|
2526
|
-
if (propType !== 'object') {
|
2527
|
-
return new PropTypeError('Invalid ' + location + ' `' + propFullName + '` of type `' + propType + '` ' + ('supplied to `' + componentName + '`, expected `object`.'));
|
2528
|
-
}
|
2529
|
-
// We need to check all keys in case some are required but missing from
|
2530
|
-
// props.
|
2531
|
-
var allKeys = assign({}, props[propName], shapeTypes);
|
2532
|
-
for (var key in allKeys) {
|
2533
|
-
var checker = shapeTypes[key];
|
2534
|
-
if (!checker) {
|
2535
|
-
return new PropTypeError(
|
2536
|
-
'Invalid ' + location + ' `' + propFullName + '` key `' + key + '` supplied to `' + componentName + '`.' +
|
2537
|
-
'\nBad object: ' + JSON.stringify(props[propName], null, ' ') +
|
2538
|
-
'\nValid keys: ' + JSON.stringify(Object.keys(shapeTypes), null, ' ')
|
2539
|
-
);
|
2540
|
-
}
|
2541
|
-
var error = checker(propValue, key, componentName, location, propFullName + '.' + key, ReactPropTypesSecret);
|
2542
|
-
if (error) {
|
2543
|
-
return error;
|
2544
|
-
}
|
2545
|
-
}
|
2546
|
-
return null;
|
2547
|
-
}
|
2548
|
-
|
2549
|
-
return createChainableTypeChecker(validate);
|
2550
|
-
}
|
2551
|
-
|
2552
|
-
function isNode(propValue) {
|
2553
|
-
switch (typeof propValue) {
|
2554
|
-
case 'number':
|
2555
|
-
case 'string':
|
2556
|
-
case 'undefined':
|
2557
|
-
return true;
|
2558
|
-
case 'boolean':
|
2559
|
-
return !propValue;
|
2560
|
-
case 'object':
|
2561
|
-
if (Array.isArray(propValue)) {
|
2562
|
-
return propValue.every(isNode);
|
2563
|
-
}
|
2564
|
-
if (propValue === null || isValidElement(propValue)) {
|
2565
|
-
return true;
|
2566
|
-
}
|
2567
|
-
|
2568
|
-
var iteratorFn = getIteratorFn(propValue);
|
2569
|
-
if (iteratorFn) {
|
2570
|
-
var iterator = iteratorFn.call(propValue);
|
2571
|
-
var step;
|
2572
|
-
if (iteratorFn !== propValue.entries) {
|
2573
|
-
while (!(step = iterator.next()).done) {
|
2574
|
-
if (!isNode(step.value)) {
|
2575
|
-
return false;
|
2576
|
-
}
|
2577
|
-
}
|
2578
|
-
} else {
|
2579
|
-
// Iterator will provide entry [k,v] tuples rather than values.
|
2580
|
-
while (!(step = iterator.next()).done) {
|
2581
|
-
var entry = step.value;
|
2582
|
-
if (entry) {
|
2583
|
-
if (!isNode(entry[1])) {
|
2584
|
-
return false;
|
2585
|
-
}
|
2586
|
-
}
|
2587
|
-
}
|
2588
|
-
}
|
2589
|
-
} else {
|
2590
|
-
return false;
|
2591
|
-
}
|
2592
|
-
|
2593
|
-
return true;
|
2594
|
-
default:
|
2595
|
-
return false;
|
2596
|
-
}
|
2597
|
-
}
|
2598
|
-
|
2599
|
-
function isSymbol(propType, propValue) {
|
2600
|
-
// Native Symbol.
|
2601
|
-
if (propType === 'symbol') {
|
2602
|
-
return true;
|
2603
|
-
}
|
2604
|
-
|
2605
|
-
// 19.4.3.5 Symbol.prototype[@@toStringTag] === 'Symbol'
|
2606
|
-
if (propValue['@@toStringTag'] === 'Symbol') {
|
2607
|
-
return true;
|
2608
|
-
}
|
2609
|
-
|
2610
|
-
// Fallback for non-spec compliant Symbols which are polyfilled.
|
2611
|
-
if (typeof Symbol === 'function' && propValue instanceof Symbol) {
|
2612
|
-
return true;
|
2613
|
-
}
|
2614
|
-
|
2615
|
-
return false;
|
2616
|
-
}
|
2617
|
-
|
2618
|
-
// Equivalent of `typeof` but with special handling for array and regexp.
|
2619
|
-
function getPropType(propValue) {
|
2620
|
-
var propType = typeof propValue;
|
2621
|
-
if (Array.isArray(propValue)) {
|
2622
|
-
return 'array';
|
2623
|
-
}
|
2624
|
-
if (propValue instanceof RegExp) {
|
2625
|
-
// Old webkits (at least until Android 4.0) return 'function' rather than
|
2626
|
-
// 'object' for typeof a RegExp. We'll normalize this here so that /bla/
|
2627
|
-
// passes PropTypes.object.
|
2628
|
-
return 'object';
|
2629
|
-
}
|
2630
|
-
if (isSymbol(propType, propValue)) {
|
2631
|
-
return 'symbol';
|
2632
|
-
}
|
2633
|
-
return propType;
|
2634
|
-
}
|
2635
|
-
|
2636
|
-
// This handles more types than `getPropType`. Only used for error messages.
|
2637
|
-
// See `createPrimitiveTypeChecker`.
|
2638
|
-
function getPreciseType(propValue) {
|
2639
|
-
if (typeof propValue === 'undefined' || propValue === null) {
|
2640
|
-
return '' + propValue;
|
2641
|
-
}
|
2642
|
-
var propType = getPropType(propValue);
|
2643
|
-
if (propType === 'object') {
|
2644
|
-
if (propValue instanceof Date) {
|
2645
|
-
return 'date';
|
2646
|
-
} else if (propValue instanceof RegExp) {
|
2647
|
-
return 'regexp';
|
2648
|
-
}
|
2649
|
-
}
|
2650
|
-
return propType;
|
2651
|
-
}
|
2652
|
-
|
2653
|
-
// Returns a string that is postfixed to a warning about an invalid type.
|
2654
|
-
// For example, "undefined" or "of type array"
|
2655
|
-
function getPostfixForTypeWarning(value) {
|
2656
|
-
var type = getPreciseType(value);
|
2657
|
-
switch (type) {
|
2658
|
-
case 'array':
|
2659
|
-
case 'object':
|
2660
|
-
return 'an ' + type;
|
2661
|
-
case 'boolean':
|
2662
|
-
case 'date':
|
2663
|
-
case 'regexp':
|
2664
|
-
return 'a ' + type;
|
2665
|
-
default:
|
2666
|
-
return type;
|
2667
|
-
}
|
2668
|
-
}
|
2669
|
-
|
2670
|
-
// Returns class name of the object, if any.
|
2671
|
-
function getClassName(propValue) {
|
2672
|
-
if (!propValue.constructor || !propValue.constructor.name) {
|
2673
|
-
return ANONYMOUS;
|
2674
|
-
}
|
2675
|
-
return propValue.constructor.name;
|
2676
|
-
}
|
2677
|
-
|
2678
|
-
ReactPropTypes.checkPropTypes = checkPropTypes;
|
2679
|
-
ReactPropTypes.PropTypes = ReactPropTypes;
|
2680
|
-
|
2681
|
-
return ReactPropTypes;
|
2682
|
-
};
|
2683
|
-
|
2684
|
-
/* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(0)))
|
2685
|
-
|
2686
|
-
/***/ }),
|
2687
|
-
/* 31 */
|
2688
|
-
/***/ (function(module, exports, __webpack_require__) {
|
2689
|
-
|
2690
|
-
"use strict";
|
2691
|
-
/**
|
2692
|
-
* Copyright (c) 2013-present, Facebook, Inc.
|
2693
|
-
*
|
2694
|
-
* This source code is licensed under the MIT license found in the
|
2695
|
-
* LICENSE file in the root directory of this source tree.
|
2696
|
-
*/
|
2697
|
-
|
2698
|
-
|
2699
|
-
|
2700
|
-
var emptyFunction = __webpack_require__(1);
|
2701
|
-
var invariant = __webpack_require__(3);
|
2702
|
-
var ReactPropTypesSecret = __webpack_require__(8);
|
2703
|
-
|
2704
|
-
module.exports = function() {
|
2705
|
-
function shim(props, propName, componentName, location, propFullName, secret) {
|
2706
|
-
if (secret === ReactPropTypesSecret) {
|
2707
|
-
// It is still safe when called from React.
|
2708
|
-
return;
|
2709
|
-
}
|
2710
|
-
invariant(
|
2711
|
-
false,
|
2712
|
-
'Calling PropTypes validators directly is not supported by the `prop-types` package. ' +
|
2713
|
-
'Use PropTypes.checkPropTypes() to call them. ' +
|
2714
|
-
'Read more at http://fb.me/use-check-prop-types'
|
2715
|
-
);
|
2716
|
-
};
|
2717
|
-
shim.isRequired = shim;
|
2718
|
-
function getShim() {
|
2719
|
-
return shim;
|
2720
|
-
};
|
2721
|
-
// Important!
|
2722
|
-
// Keep this list in sync with production version in `./factoryWithTypeCheckers.js`.
|
2723
|
-
var ReactPropTypes = {
|
2724
|
-
array: shim,
|
2725
|
-
bool: shim,
|
2726
|
-
func: shim,
|
2727
|
-
number: shim,
|
2728
|
-
object: shim,
|
2729
|
-
string: shim,
|
2730
|
-
symbol: shim,
|
2731
|
-
|
2732
|
-
any: shim,
|
2733
|
-
arrayOf: getShim,
|
2734
|
-
element: shim,
|
2735
|
-
instanceOf: getShim,
|
2736
|
-
node: shim,
|
2737
|
-
objectOf: getShim,
|
2738
|
-
oneOf: getShim,
|
2739
|
-
oneOfType: getShim,
|
2740
|
-
shape: getShim,
|
2741
|
-
exact: getShim
|
2742
|
-
};
|
2743
|
-
|
2744
|
-
ReactPropTypes.checkPropTypes = emptyFunction;
|
2745
|
-
ReactPropTypes.PropTypes = ReactPropTypes;
|
2746
|
-
|
2747
|
-
return ReactPropTypes;
|
2748
|
-
};
|
2749
|
-
|
2750
|
-
|
2751
|
-
/***/ })
|
2752
|
-
/******/ ]);
|