react-codemirror-runmode 1.0.4 → 2.0.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.
@@ -1,1127 +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 = 5);
64
- /******/ })
65
- /************************************************************************/
66
- /******/ ([
67
- /* 0 */
68
- /***/ (function(module, exports) {
69
-
70
- module.exports = React;
71
-
72
- /***/ }),
73
- /* 1 */
74
- /***/ (function(module, exports, __webpack_require__) {
75
-
76
- "use strict";
77
-
78
-
79
- /**
80
- * Copyright (c) 2013-present, Facebook, Inc.
81
- *
82
- * This source code is licensed under the MIT license found in the
83
- * LICENSE file in the root directory of this source tree.
84
- *
85
- *
86
- */
87
-
88
- function makeEmptyFunction(arg) {
89
- return function () {
90
- return arg;
91
- };
92
- }
93
-
94
- /**
95
- * This function accepts and discards inputs; it has no side effects. This is
96
- * primarily useful idiomatically for overridable function endpoints which
97
- * always need to be callable, since JS lacks a null-call idiom ala Cocoa.
98
- */
99
- var emptyFunction = function emptyFunction() {};
100
-
101
- emptyFunction.thatReturns = makeEmptyFunction;
102
- emptyFunction.thatReturnsFalse = makeEmptyFunction(false);
103
- emptyFunction.thatReturnsTrue = makeEmptyFunction(true);
104
- emptyFunction.thatReturnsNull = makeEmptyFunction(null);
105
- emptyFunction.thatReturnsThis = function () {
106
- return this;
107
- };
108
- emptyFunction.thatReturnsArgument = function (arg) {
109
- return arg;
110
- };
111
-
112
- module.exports = emptyFunction;
113
-
114
- /***/ }),
115
- /* 2 */
116
- /***/ (function(module, exports, __webpack_require__) {
117
-
118
- "use strict";
119
- /**
120
- * Copyright (c) 2013-present, Facebook, Inc.
121
- *
122
- * This source code is licensed under the MIT license found in the
123
- * LICENSE file in the root directory of this source tree.
124
- *
125
- */
126
-
127
-
128
-
129
- /**
130
- * Use invariant() to assert state which your program assumes to be true.
131
- *
132
- * Provide sprintf-style format (only %s is supported) and arguments
133
- * to provide information about what broke and what you were
134
- * expecting.
135
- *
136
- * The invariant message will be stripped in production, but the invariant
137
- * will remain to ensure logic does not differ in production.
138
- */
139
-
140
- var validateFormat = function validateFormat(format) {};
141
-
142
- if (true) {
143
- validateFormat = function validateFormat(format) {
144
- if (format === undefined) {
145
- throw new Error('invariant requires an error message argument');
146
- }
147
- };
148
- }
149
-
150
- function invariant(condition, format, a, b, c, d, e, f) {
151
- validateFormat(format);
152
-
153
- if (!condition) {
154
- var error;
155
- if (format === undefined) {
156
- error = new Error('Minified exception occurred; use the non-minified dev environment ' + 'for the full error message and additional helpful warnings.');
157
- } else {
158
- var args = [a, b, c, d, e, f];
159
- var argIndex = 0;
160
- error = new Error(format.replace(/%s/g, function () {
161
- return args[argIndex++];
162
- }));
163
- error.name = 'Invariant Violation';
164
- }
165
-
166
- error.framesToPop = 1; // we don't care about invariant's own frame
167
- throw error;
168
- }
169
- }
170
-
171
- module.exports = invariant;
172
-
173
- /***/ }),
174
- /* 3 */
175
- /***/ (function(module, exports, __webpack_require__) {
176
-
177
- "use strict";
178
- /**
179
- * Copyright (c) 2014-present, Facebook, Inc.
180
- *
181
- * This source code is licensed under the MIT license found in the
182
- * LICENSE file in the root directory of this source tree.
183
- *
184
- */
185
-
186
-
187
-
188
- var emptyFunction = __webpack_require__(1);
189
-
190
- /**
191
- * Similar to invariant but only logs a warning if the condition is not met.
192
- * This can be used to log issues in development environments in critical
193
- * paths. Removing the logging code for production environments will keep the
194
- * same logic and follow the same code paths.
195
- */
196
-
197
- var warning = emptyFunction;
198
-
199
- if (true) {
200
- var printWarning = function printWarning(format) {
201
- for (var _len = arguments.length, args = Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {
202
- args[_key - 1] = arguments[_key];
203
- }
204
-
205
- var argIndex = 0;
206
- var message = 'Warning: ' + format.replace(/%s/g, function () {
207
- return args[argIndex++];
208
- });
209
- if (typeof console !== 'undefined') {
210
- console.error(message);
211
- }
212
- try {
213
- // --- Welcome to debugging React ---
214
- // This error was thrown as a convenience so that you can use this stack
215
- // to find the callsite that caused this warning to fire.
216
- throw new Error(message);
217
- } catch (x) {}
218
- };
219
-
220
- warning = function warning(condition, format) {
221
- if (format === undefined) {
222
- throw new Error('`warning(condition, format, ...args)` requires a warning ' + 'message argument');
223
- }
224
-
225
- if (format.indexOf('Failed Composite propType: ') === 0) {
226
- return; // Ignore CompositeComponent proptype check.
227
- }
228
-
229
- if (!condition) {
230
- for (var _len2 = arguments.length, args = Array(_len2 > 2 ? _len2 - 2 : 0), _key2 = 2; _key2 < _len2; _key2++) {
231
- args[_key2 - 2] = arguments[_key2];
232
- }
233
-
234
- printWarning.apply(undefined, [format].concat(args));
235
- }
236
- };
237
- }
238
-
239
- module.exports = warning;
240
-
241
- /***/ }),
242
- /* 4 */
243
- /***/ (function(module, exports, __webpack_require__) {
244
-
245
- "use strict";
246
- /**
247
- * Copyright (c) 2013-present, Facebook, Inc.
248
- *
249
- * This source code is licensed under the MIT license found in the
250
- * LICENSE file in the root directory of this source tree.
251
- */
252
-
253
-
254
-
255
- var ReactPropTypesSecret = 'SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED';
256
-
257
- module.exports = ReactPropTypesSecret;
258
-
259
- /***/ }),
260
- /* 5 */
261
- /***/ (function(module, exports, __webpack_require__) {
262
-
263
- "use strict";
264
-
265
-
266
- var _index = __webpack_require__(6);
267
-
268
- var _index2 = _interopRequireDefault(_index);
269
-
270
- var _react = __webpack_require__(0);
271
-
272
- var _react2 = _interopRequireDefault(_react);
273
-
274
- var _reactDom = __webpack_require__(11);
275
-
276
- var _reactDom2 = _interopRequireDefault(_reactDom);
277
-
278
- function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
279
-
280
- const exampleCode = `
281
- * Incremental highlighted search (/, ?, #, *, g#, g*)
282
- * Search/replace with confirm (:substitute, :%s)
283
- * Search history
284
-
285
- \`\`\`javascript
286
- import React from 'react'
287
- import PropTypes from 'prop-types'
288
-
289
- export default class MirrorLight extends React.Component {
290
- static propTypes = {
291
- codeMirror: PropTypes.object.isRequired,
292
- className: PropTypes.string,
293
- inline: PropTypes.bool,
294
- language: PropTypes.string,
295
- prefix: PropTypes.string,
296
- subset: PropTypes.arrayOf(PropTypes.string),
297
- value: PropTypes.string.isRequired
298
- }
299
-
300
- render () {
301
- const { inline, codeMirror, value, language, className } = this.props
302
- const elements = []
303
- codeMirror.runMode(value, language, (token, style) => {
304
- elements.push(<span className={style}>{token}</span>)
305
- })
306
- const code = (
307
- <code className={inline ? 'inline' : ''}>
308
- {elements}
309
- </code>
310
- )
311
-
312
- return inline ? code : <pre className={className}>{code}</pre>
313
- }
314
- }
315
- \`\`\`
316
- `;
317
-
318
- _reactDom2.default.render(_react2.default.createElement(_index2.default, {
319
- codeMirror: CodeMirror,
320
- theme: 'solarized',
321
- value: exampleCode,
322
- language: 'gfm'
323
- }), document.getElementById('root'));
324
-
325
- /***/ }),
326
- /* 6 */
327
- /***/ (function(module, exports, __webpack_require__) {
328
-
329
- "use strict";
330
-
331
-
332
- Object.defineProperty(exports, "__esModule", {
333
- value: true
334
- });
335
-
336
- var _react = __webpack_require__(0);
337
-
338
- var _react2 = _interopRequireDefault(_react);
339
-
340
- var _propTypes = __webpack_require__(7);
341
-
342
- var _propTypes2 = _interopRequireDefault(_propTypes);
343
-
344
- function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
345
-
346
- class MirrorLight extends _react2.default.Component {
347
-
348
- render() {
349
- const { inline, codeMirror, value, language, className, prefix, theme } = this.props;
350
- const elements = [];
351
- let index = 0;
352
- let lastStyle = null;
353
- let tokenBuf = '';
354
- const pushElement = (token, style) => {
355
- elements.push(_react2.default.createElement(
356
- 'span',
357
- { className: style ? prefix + style : '', key: ++index },
358
- token
359
- ));
360
- };
361
- const mode = codeMirror.findModeByName(language);
362
- codeMirror.runMode(value, mode ? mode.mime : language, (token, style) => {
363
- if (lastStyle === style) {
364
- tokenBuf += token;
365
- lastStyle = style;
366
- } else {
367
- if (tokenBuf) {
368
- pushElement(tokenBuf, lastStyle);
369
- }
370
- tokenBuf = token;
371
- lastStyle = style;
372
- }
373
- });
374
- pushElement(tokenBuf, lastStyle);
375
-
376
- const code = _react2.default.createElement(
377
- 'code',
378
- { className: inline ? `inline ${prefix}s-${theme}` : '' },
379
- elements
380
- );
381
-
382
- return inline ? code : _react2.default.createElement(
383
- 'pre',
384
- { className: `${className} ${prefix}s-${theme}` },
385
- code
386
- );
387
- }
388
- }
389
- exports.default = MirrorLight;
390
- MirrorLight.propTypes = {
391
- codeMirror: _propTypes2.default.func.isRequired,
392
- className: _propTypes2.default.string,
393
- theme: _propTypes2.default.string,
394
- inline: _propTypes2.default.bool,
395
- language: _propTypes2.default.string,
396
- prefix: _propTypes2.default.string,
397
- value: _propTypes2.default.string.isRequired
398
- };
399
- MirrorLight.defaultProps = {
400
- className: '',
401
- prefix: 'cm-'
402
- };
403
- module.exports = exports['default'];
404
-
405
- /***/ }),
406
- /* 7 */
407
- /***/ (function(module, exports, __webpack_require__) {
408
-
409
- "use strict";
410
-
411
-
412
- /**
413
- * Copyright (c) 2013-present, Facebook, Inc.
414
- *
415
- * This source code is licensed under the MIT license found in the
416
- * LICENSE file in the root directory of this source tree.
417
- */
418
-
419
- if (true) {
420
- var REACT_ELEMENT_TYPE = typeof Symbol === 'function' && Symbol.for && Symbol.for('react.element') || 0xeac7;
421
-
422
- var isValidElement = function (object) {
423
- return typeof object === 'object' && object !== null && object.$$typeof === REACT_ELEMENT_TYPE;
424
- };
425
-
426
- // By explicitly using `prop-types` you are opting into new development behavior.
427
- // http://fb.me/prop-types-in-prod
428
- var throwOnDirectAccess = true;
429
- module.exports = __webpack_require__(8)(isValidElement, throwOnDirectAccess);
430
- } else {
431
- // By explicitly using `prop-types` you are opting into new production behavior.
432
- // http://fb.me/prop-types-in-prod
433
- module.exports = require('./factoryWithThrowingShims')();
434
- }
435
-
436
- /***/ }),
437
- /* 8 */
438
- /***/ (function(module, exports, __webpack_require__) {
439
-
440
- "use strict";
441
- /**
442
- * Copyright (c) 2013-present, Facebook, Inc.
443
- *
444
- * This source code is licensed under the MIT license found in the
445
- * LICENSE file in the root directory of this source tree.
446
- */
447
-
448
-
449
-
450
- var emptyFunction = __webpack_require__(1);
451
- var invariant = __webpack_require__(2);
452
- var warning = __webpack_require__(3);
453
- var assign = __webpack_require__(9);
454
-
455
- var ReactPropTypesSecret = __webpack_require__(4);
456
- var checkPropTypes = __webpack_require__(10);
457
-
458
- module.exports = function (isValidElement, throwOnDirectAccess) {
459
- /* global Symbol */
460
- var ITERATOR_SYMBOL = typeof Symbol === 'function' && Symbol.iterator;
461
- var FAUX_ITERATOR_SYMBOL = '@@iterator'; // Before Symbol spec.
462
-
463
- /**
464
- * Returns the iterator method function contained on the iterable object.
465
- *
466
- * Be sure to invoke the function with the iterable as context:
467
- *
468
- * var iteratorFn = getIteratorFn(myIterable);
469
- * if (iteratorFn) {
470
- * var iterator = iteratorFn.call(myIterable);
471
- * ...
472
- * }
473
- *
474
- * @param {?object} maybeIterable
475
- * @return {?function}
476
- */
477
- function getIteratorFn(maybeIterable) {
478
- var iteratorFn = maybeIterable && (ITERATOR_SYMBOL && maybeIterable[ITERATOR_SYMBOL] || maybeIterable[FAUX_ITERATOR_SYMBOL]);
479
- if (typeof iteratorFn === 'function') {
480
- return iteratorFn;
481
- }
482
- }
483
-
484
- /**
485
- * Collection of methods that allow declaration and validation of props that are
486
- * supplied to React components. Example usage:
487
- *
488
- * var Props = require('ReactPropTypes');
489
- * var MyArticle = React.createClass({
490
- * propTypes: {
491
- * // An optional string prop named "description".
492
- * description: Props.string,
493
- *
494
- * // A required enum prop named "category".
495
- * category: Props.oneOf(['News','Photos']).isRequired,
496
- *
497
- * // A prop named "dialog" that requires an instance of Dialog.
498
- * dialog: Props.instanceOf(Dialog).isRequired
499
- * },
500
- * render: function() { ... }
501
- * });
502
- *
503
- * A more formal specification of how these methods are used:
504
- *
505
- * type := array|bool|func|object|number|string|oneOf([...])|instanceOf(...)
506
- * decl := ReactPropTypes.{type}(.isRequired)?
507
- *
508
- * Each and every declaration produces a function with the same signature. This
509
- * allows the creation of custom validation functions. For example:
510
- *
511
- * var MyLink = React.createClass({
512
- * propTypes: {
513
- * // An optional string or URI prop named "href".
514
- * href: function(props, propName, componentName) {
515
- * var propValue = props[propName];
516
- * if (propValue != null && typeof propValue !== 'string' &&
517
- * !(propValue instanceof URI)) {
518
- * return new Error(
519
- * 'Expected a string or an URI for ' + propName + ' in ' +
520
- * componentName
521
- * );
522
- * }
523
- * }
524
- * },
525
- * render: function() {...}
526
- * });
527
- *
528
- * @internal
529
- */
530
-
531
- var ANONYMOUS = '<<anonymous>>';
532
-
533
- // Important!
534
- // Keep this list in sync with production version in `./factoryWithThrowingShims.js`.
535
- var ReactPropTypes = {
536
- array: createPrimitiveTypeChecker('array'),
537
- bool: createPrimitiveTypeChecker('boolean'),
538
- func: createPrimitiveTypeChecker('function'),
539
- number: createPrimitiveTypeChecker('number'),
540
- object: createPrimitiveTypeChecker('object'),
541
- string: createPrimitiveTypeChecker('string'),
542
- symbol: createPrimitiveTypeChecker('symbol'),
543
-
544
- any: createAnyTypeChecker(),
545
- arrayOf: createArrayOfTypeChecker,
546
- element: createElementTypeChecker(),
547
- instanceOf: createInstanceTypeChecker,
548
- node: createNodeChecker(),
549
- objectOf: createObjectOfTypeChecker,
550
- oneOf: createEnumTypeChecker,
551
- oneOfType: createUnionTypeChecker,
552
- shape: createShapeTypeChecker,
553
- exact: createStrictShapeTypeChecker
554
- };
555
-
556
- /**
557
- * inlined Object.is polyfill to avoid requiring consumers ship their own
558
- * https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/is
559
- */
560
- /*eslint-disable no-self-compare*/
561
- function is(x, y) {
562
- // SameValue algorithm
563
- if (x === y) {
564
- // Steps 1-5, 7-10
565
- // Steps 6.b-6.e: +0 != -0
566
- return x !== 0 || 1 / x === 1 / y;
567
- } else {
568
- // Step 6.a: NaN == NaN
569
- return x !== x && y !== y;
570
- }
571
- }
572
- /*eslint-enable no-self-compare*/
573
-
574
- /**
575
- * We use an Error-like object for backward compatibility as people may call
576
- * PropTypes directly and inspect their output. However, we don't use real
577
- * Errors anymore. We don't inspect their stack anyway, and creating them
578
- * is prohibitively expensive if they are created too often, such as what
579
- * happens in oneOfType() for any type before the one that matched.
580
- */
581
- function PropTypeError(message) {
582
- this.message = message;
583
- this.stack = '';
584
- }
585
- // Make `instanceof Error` still work for returned errors.
586
- PropTypeError.prototype = Error.prototype;
587
-
588
- function createChainableTypeChecker(validate) {
589
- if (true) {
590
- var manualPropTypeCallCache = {};
591
- var manualPropTypeWarningCount = 0;
592
- }
593
- function checkType(isRequired, props, propName, componentName, location, propFullName, secret) {
594
- componentName = componentName || ANONYMOUS;
595
- propFullName = propFullName || propName;
596
-
597
- if (secret !== ReactPropTypesSecret) {
598
- if (throwOnDirectAccess) {
599
- // New behavior only for users of `prop-types` package
600
- invariant(false, 'Calling PropTypes validators directly is not supported by the `prop-types` package. ' + 'Use `PropTypes.checkPropTypes()` to call them. ' + 'Read more at http://fb.me/use-check-prop-types');
601
- } else if ("development" !== 'production' && typeof console !== 'undefined') {
602
- // Old behavior for people using React.PropTypes
603
- var cacheKey = componentName + ':' + propName;
604
- if (!manualPropTypeCallCache[cacheKey] &&
605
- // Avoid spamming the console because they are often not actionable except for lib authors
606
- manualPropTypeWarningCount < 3) {
607
- warning(false, 'You are manually calling a React.PropTypes validation ' + 'function for the `%s` prop on `%s`. This is deprecated ' + 'and will throw in the standalone `prop-types` package. ' + 'You may be seeing this warning due to a third-party PropTypes ' + 'library. See https://fb.me/react-warning-dont-call-proptypes ' + 'for details.', propFullName, componentName);
608
- manualPropTypeCallCache[cacheKey] = true;
609
- manualPropTypeWarningCount++;
610
- }
611
- }
612
- }
613
- if (props[propName] == null) {
614
- if (isRequired) {
615
- if (props[propName] === null) {
616
- return new PropTypeError('The ' + location + ' `' + propFullName + '` is marked as required ' + ('in `' + componentName + '`, but its value is `null`.'));
617
- }
618
- return new PropTypeError('The ' + location + ' `' + propFullName + '` is marked as required in ' + ('`' + componentName + '`, but its value is `undefined`.'));
619
- }
620
- return null;
621
- } else {
622
- return validate(props, propName, componentName, location, propFullName);
623
- }
624
- }
625
-
626
- var chainedCheckType = checkType.bind(null, false);
627
- chainedCheckType.isRequired = checkType.bind(null, true);
628
-
629
- return chainedCheckType;
630
- }
631
-
632
- function createPrimitiveTypeChecker(expectedType) {
633
- function validate(props, propName, componentName, location, propFullName, secret) {
634
- var propValue = props[propName];
635
- var propType = getPropType(propValue);
636
- if (propType !== expectedType) {
637
- // `propValue` being instance of, say, date/regexp, pass the 'object'
638
- // check, but we can offer a more precise error message here rather than
639
- // 'of type `object`'.
640
- var preciseType = getPreciseType(propValue);
641
-
642
- return new PropTypeError('Invalid ' + location + ' `' + propFullName + '` of type ' + ('`' + preciseType + '` supplied to `' + componentName + '`, expected ') + ('`' + expectedType + '`.'));
643
- }
644
- return null;
645
- }
646
- return createChainableTypeChecker(validate);
647
- }
648
-
649
- function createAnyTypeChecker() {
650
- return createChainableTypeChecker(emptyFunction.thatReturnsNull);
651
- }
652
-
653
- function createArrayOfTypeChecker(typeChecker) {
654
- function validate(props, propName, componentName, location, propFullName) {
655
- if (typeof typeChecker !== 'function') {
656
- return new PropTypeError('Property `' + propFullName + '` of component `' + componentName + '` has invalid PropType notation inside arrayOf.');
657
- }
658
- var propValue = props[propName];
659
- if (!Array.isArray(propValue)) {
660
- var propType = getPropType(propValue);
661
- return new PropTypeError('Invalid ' + location + ' `' + propFullName + '` of type ' + ('`' + propType + '` supplied to `' + componentName + '`, expected an array.'));
662
- }
663
- for (var i = 0; i < propValue.length; i++) {
664
- var error = typeChecker(propValue, i, componentName, location, propFullName + '[' + i + ']', ReactPropTypesSecret);
665
- if (error instanceof Error) {
666
- return error;
667
- }
668
- }
669
- return null;
670
- }
671
- return createChainableTypeChecker(validate);
672
- }
673
-
674
- function createElementTypeChecker() {
675
- function validate(props, propName, componentName, location, propFullName) {
676
- var propValue = props[propName];
677
- if (!isValidElement(propValue)) {
678
- var propType = getPropType(propValue);
679
- return new PropTypeError('Invalid ' + location + ' `' + propFullName + '` of type ' + ('`' + propType + '` supplied to `' + componentName + '`, expected a single ReactElement.'));
680
- }
681
- return null;
682
- }
683
- return createChainableTypeChecker(validate);
684
- }
685
-
686
- function createInstanceTypeChecker(expectedClass) {
687
- function validate(props, propName, componentName, location, propFullName) {
688
- if (!(props[propName] instanceof expectedClass)) {
689
- var expectedClassName = expectedClass.name || ANONYMOUS;
690
- var actualClassName = getClassName(props[propName]);
691
- return new PropTypeError('Invalid ' + location + ' `' + propFullName + '` of type ' + ('`' + actualClassName + '` supplied to `' + componentName + '`, expected ') + ('instance of `' + expectedClassName + '`.'));
692
- }
693
- return null;
694
- }
695
- return createChainableTypeChecker(validate);
696
- }
697
-
698
- function createEnumTypeChecker(expectedValues) {
699
- if (!Array.isArray(expectedValues)) {
700
- true ? warning(false, 'Invalid argument supplied to oneOf, expected an instance of array.') : void 0;
701
- return emptyFunction.thatReturnsNull;
702
- }
703
-
704
- function validate(props, propName, componentName, location, propFullName) {
705
- var propValue = props[propName];
706
- for (var i = 0; i < expectedValues.length; i++) {
707
- if (is(propValue, expectedValues[i])) {
708
- return null;
709
- }
710
- }
711
-
712
- var valuesString = JSON.stringify(expectedValues);
713
- return new PropTypeError('Invalid ' + location + ' `' + propFullName + '` of value `' + propValue + '` ' + ('supplied to `' + componentName + '`, expected one of ' + valuesString + '.'));
714
- }
715
- return createChainableTypeChecker(validate);
716
- }
717
-
718
- function createObjectOfTypeChecker(typeChecker) {
719
- function validate(props, propName, componentName, location, propFullName) {
720
- if (typeof typeChecker !== 'function') {
721
- return new PropTypeError('Property `' + propFullName + '` of component `' + componentName + '` has invalid PropType notation inside objectOf.');
722
- }
723
- var propValue = props[propName];
724
- var propType = getPropType(propValue);
725
- if (propType !== 'object') {
726
- return new PropTypeError('Invalid ' + location + ' `' + propFullName + '` of type ' + ('`' + propType + '` supplied to `' + componentName + '`, expected an object.'));
727
- }
728
- for (var key in propValue) {
729
- if (propValue.hasOwnProperty(key)) {
730
- var error = typeChecker(propValue, key, componentName, location, propFullName + '.' + key, ReactPropTypesSecret);
731
- if (error instanceof Error) {
732
- return error;
733
- }
734
- }
735
- }
736
- return null;
737
- }
738
- return createChainableTypeChecker(validate);
739
- }
740
-
741
- function createUnionTypeChecker(arrayOfTypeCheckers) {
742
- if (!Array.isArray(arrayOfTypeCheckers)) {
743
- true ? warning(false, 'Invalid argument supplied to oneOfType, expected an instance of array.') : void 0;
744
- return emptyFunction.thatReturnsNull;
745
- }
746
-
747
- for (var i = 0; i < arrayOfTypeCheckers.length; i++) {
748
- var checker = arrayOfTypeCheckers[i];
749
- if (typeof checker !== 'function') {
750
- warning(false, 'Invalid argument supplied to oneOfType. Expected an array of check functions, but ' + 'received %s at index %s.', getPostfixForTypeWarning(checker), i);
751
- return emptyFunction.thatReturnsNull;
752
- }
753
- }
754
-
755
- function validate(props, propName, componentName, location, propFullName) {
756
- for (var i = 0; i < arrayOfTypeCheckers.length; i++) {
757
- var checker = arrayOfTypeCheckers[i];
758
- if (checker(props, propName, componentName, location, propFullName, ReactPropTypesSecret) == null) {
759
- return null;
760
- }
761
- }
762
-
763
- return new PropTypeError('Invalid ' + location + ' `' + propFullName + '` supplied to ' + ('`' + componentName + '`.'));
764
- }
765
- return createChainableTypeChecker(validate);
766
- }
767
-
768
- function createNodeChecker() {
769
- function validate(props, propName, componentName, location, propFullName) {
770
- if (!isNode(props[propName])) {
771
- return new PropTypeError('Invalid ' + location + ' `' + propFullName + '` supplied to ' + ('`' + componentName + '`, expected a ReactNode.'));
772
- }
773
- return null;
774
- }
775
- return createChainableTypeChecker(validate);
776
- }
777
-
778
- function createShapeTypeChecker(shapeTypes) {
779
- function validate(props, propName, componentName, location, propFullName) {
780
- var propValue = props[propName];
781
- var propType = getPropType(propValue);
782
- if (propType !== 'object') {
783
- return new PropTypeError('Invalid ' + location + ' `' + propFullName + '` of type `' + propType + '` ' + ('supplied to `' + componentName + '`, expected `object`.'));
784
- }
785
- for (var key in shapeTypes) {
786
- var checker = shapeTypes[key];
787
- if (!checker) {
788
- continue;
789
- }
790
- var error = checker(propValue, key, componentName, location, propFullName + '.' + key, ReactPropTypesSecret);
791
- if (error) {
792
- return error;
793
- }
794
- }
795
- return null;
796
- }
797
- return createChainableTypeChecker(validate);
798
- }
799
-
800
- function createStrictShapeTypeChecker(shapeTypes) {
801
- function validate(props, propName, componentName, location, propFullName) {
802
- var propValue = props[propName];
803
- var propType = getPropType(propValue);
804
- if (propType !== 'object') {
805
- return new PropTypeError('Invalid ' + location + ' `' + propFullName + '` of type `' + propType + '` ' + ('supplied to `' + componentName + '`, expected `object`.'));
806
- }
807
- // We need to check all keys in case some are required but missing from
808
- // props.
809
- var allKeys = assign({}, props[propName], shapeTypes);
810
- for (var key in allKeys) {
811
- var checker = shapeTypes[key];
812
- if (!checker) {
813
- return new PropTypeError('Invalid ' + location + ' `' + propFullName + '` key `' + key + '` supplied to `' + componentName + '`.' + '\nBad object: ' + JSON.stringify(props[propName], null, ' ') + '\nValid keys: ' + JSON.stringify(Object.keys(shapeTypes), null, ' '));
814
- }
815
- var error = checker(propValue, key, componentName, location, propFullName + '.' + key, ReactPropTypesSecret);
816
- if (error) {
817
- return error;
818
- }
819
- }
820
- return null;
821
- }
822
-
823
- return createChainableTypeChecker(validate);
824
- }
825
-
826
- function isNode(propValue) {
827
- switch (typeof propValue) {
828
- case 'number':
829
- case 'string':
830
- case 'undefined':
831
- return true;
832
- case 'boolean':
833
- return !propValue;
834
- case 'object':
835
- if (Array.isArray(propValue)) {
836
- return propValue.every(isNode);
837
- }
838
- if (propValue === null || isValidElement(propValue)) {
839
- return true;
840
- }
841
-
842
- var iteratorFn = getIteratorFn(propValue);
843
- if (iteratorFn) {
844
- var iterator = iteratorFn.call(propValue);
845
- var step;
846
- if (iteratorFn !== propValue.entries) {
847
- while (!(step = iterator.next()).done) {
848
- if (!isNode(step.value)) {
849
- return false;
850
- }
851
- }
852
- } else {
853
- // Iterator will provide entry [k,v] tuples rather than values.
854
- while (!(step = iterator.next()).done) {
855
- var entry = step.value;
856
- if (entry) {
857
- if (!isNode(entry[1])) {
858
- return false;
859
- }
860
- }
861
- }
862
- }
863
- } else {
864
- return false;
865
- }
866
-
867
- return true;
868
- default:
869
- return false;
870
- }
871
- }
872
-
873
- function isSymbol(propType, propValue) {
874
- // Native Symbol.
875
- if (propType === 'symbol') {
876
- return true;
877
- }
878
-
879
- // 19.4.3.5 Symbol.prototype[@@toStringTag] === 'Symbol'
880
- if (propValue['@@toStringTag'] === 'Symbol') {
881
- return true;
882
- }
883
-
884
- // Fallback for non-spec compliant Symbols which are polyfilled.
885
- if (typeof Symbol === 'function' && propValue instanceof Symbol) {
886
- return true;
887
- }
888
-
889
- return false;
890
- }
891
-
892
- // Equivalent of `typeof` but with special handling for array and regexp.
893
- function getPropType(propValue) {
894
- var propType = typeof propValue;
895
- if (Array.isArray(propValue)) {
896
- return 'array';
897
- }
898
- if (propValue instanceof RegExp) {
899
- // Old webkits (at least until Android 4.0) return 'function' rather than
900
- // 'object' for typeof a RegExp. We'll normalize this here so that /bla/
901
- // passes PropTypes.object.
902
- return 'object';
903
- }
904
- if (isSymbol(propType, propValue)) {
905
- return 'symbol';
906
- }
907
- return propType;
908
- }
909
-
910
- // This handles more types than `getPropType`. Only used for error messages.
911
- // See `createPrimitiveTypeChecker`.
912
- function getPreciseType(propValue) {
913
- if (typeof propValue === 'undefined' || propValue === null) {
914
- return '' + propValue;
915
- }
916
- var propType = getPropType(propValue);
917
- if (propType === 'object') {
918
- if (propValue instanceof Date) {
919
- return 'date';
920
- } else if (propValue instanceof RegExp) {
921
- return 'regexp';
922
- }
923
- }
924
- return propType;
925
- }
926
-
927
- // Returns a string that is postfixed to a warning about an invalid type.
928
- // For example, "undefined" or "of type array"
929
- function getPostfixForTypeWarning(value) {
930
- var type = getPreciseType(value);
931
- switch (type) {
932
- case 'array':
933
- case 'object':
934
- return 'an ' + type;
935
- case 'boolean':
936
- case 'date':
937
- case 'regexp':
938
- return 'a ' + type;
939
- default:
940
- return type;
941
- }
942
- }
943
-
944
- // Returns class name of the object, if any.
945
- function getClassName(propValue) {
946
- if (!propValue.constructor || !propValue.constructor.name) {
947
- return ANONYMOUS;
948
- }
949
- return propValue.constructor.name;
950
- }
951
-
952
- ReactPropTypes.checkPropTypes = checkPropTypes;
953
- ReactPropTypes.PropTypes = ReactPropTypes;
954
-
955
- return ReactPropTypes;
956
- };
957
-
958
- /***/ }),
959
- /* 9 */
960
- /***/ (function(module, exports, __webpack_require__) {
961
-
962
- "use strict";
963
- /*
964
- object-assign
965
- (c) Sindre Sorhus
966
- @license MIT
967
- */
968
-
969
-
970
- /* eslint-disable no-unused-vars */
971
-
972
- var getOwnPropertySymbols = Object.getOwnPropertySymbols;
973
- var hasOwnProperty = Object.prototype.hasOwnProperty;
974
- var propIsEnumerable = Object.prototype.propertyIsEnumerable;
975
-
976
- function toObject(val) {
977
- if (val === null || val === undefined) {
978
- throw new TypeError('Object.assign cannot be called with null or undefined');
979
- }
980
-
981
- return Object(val);
982
- }
983
-
984
- function shouldUseNative() {
985
- try {
986
- if (!Object.assign) {
987
- return false;
988
- }
989
-
990
- // Detect buggy property enumeration order in older V8 versions.
991
-
992
- // https://bugs.chromium.org/p/v8/issues/detail?id=4118
993
- var test1 = new String('abc'); // eslint-disable-line no-new-wrappers
994
- test1[5] = 'de';
995
- if (Object.getOwnPropertyNames(test1)[0] === '5') {
996
- return false;
997
- }
998
-
999
- // https://bugs.chromium.org/p/v8/issues/detail?id=3056
1000
- var test2 = {};
1001
- for (var i = 0; i < 10; i++) {
1002
- test2['_' + String.fromCharCode(i)] = i;
1003
- }
1004
- var order2 = Object.getOwnPropertyNames(test2).map(function (n) {
1005
- return test2[n];
1006
- });
1007
- if (order2.join('') !== '0123456789') {
1008
- return false;
1009
- }
1010
-
1011
- // https://bugs.chromium.org/p/v8/issues/detail?id=3056
1012
- var test3 = {};
1013
- 'abcdefghijklmnopqrst'.split('').forEach(function (letter) {
1014
- test3[letter] = letter;
1015
- });
1016
- if (Object.keys(Object.assign({}, test3)).join('') !== 'abcdefghijklmnopqrst') {
1017
- return false;
1018
- }
1019
-
1020
- return true;
1021
- } catch (err) {
1022
- // We don't expect any of the above to throw, but better to be safe.
1023
- return false;
1024
- }
1025
- }
1026
-
1027
- module.exports = shouldUseNative() ? Object.assign : function (target, source) {
1028
- var from;
1029
- var to = toObject(target);
1030
- var symbols;
1031
-
1032
- for (var s = 1; s < arguments.length; s++) {
1033
- from = Object(arguments[s]);
1034
-
1035
- for (var key in from) {
1036
- if (hasOwnProperty.call(from, key)) {
1037
- to[key] = from[key];
1038
- }
1039
- }
1040
-
1041
- if (getOwnPropertySymbols) {
1042
- symbols = getOwnPropertySymbols(from);
1043
- for (var i = 0; i < symbols.length; i++) {
1044
- if (propIsEnumerable.call(from, symbols[i])) {
1045
- to[symbols[i]] = from[symbols[i]];
1046
- }
1047
- }
1048
- }
1049
- }
1050
-
1051
- return to;
1052
- };
1053
-
1054
- /***/ }),
1055
- /* 10 */
1056
- /***/ (function(module, exports, __webpack_require__) {
1057
-
1058
- "use strict";
1059
- /**
1060
- * Copyright (c) 2013-present, Facebook, Inc.
1061
- *
1062
- * This source code is licensed under the MIT license found in the
1063
- * LICENSE file in the root directory of this source tree.
1064
- */
1065
-
1066
-
1067
-
1068
- if (true) {
1069
- var invariant = __webpack_require__(2);
1070
- var warning = __webpack_require__(3);
1071
- var ReactPropTypesSecret = __webpack_require__(4);
1072
- var loggedTypeFailures = {};
1073
- }
1074
-
1075
- /**
1076
- * Assert that the values match with the type specs.
1077
- * Error messages are memorized and will only be shown once.
1078
- *
1079
- * @param {object} typeSpecs Map of name to a ReactPropType
1080
- * @param {object} values Runtime values that need to be type-checked
1081
- * @param {string} location e.g. "prop", "context", "child context"
1082
- * @param {string} componentName Name of the component for error messages.
1083
- * @param {?Function} getStack Returns the component stack.
1084
- * @private
1085
- */
1086
- function checkPropTypes(typeSpecs, values, location, componentName, getStack) {
1087
- if (true) {
1088
- for (var typeSpecName in typeSpecs) {
1089
- if (typeSpecs.hasOwnProperty(typeSpecName)) {
1090
- var error;
1091
- // Prop type validation may throw. In case they do, we don't want to
1092
- // fail the render phase where it didn't fail before. So we log it.
1093
- // After these have been cleaned up, we'll let them throw.
1094
- try {
1095
- // This is intentionally an invariant that gets caught. It's the same
1096
- // behavior as without this statement except with a better message.
1097
- 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]);
1098
- error = typeSpecs[typeSpecName](values, typeSpecName, componentName, location, null, ReactPropTypesSecret);
1099
- } catch (ex) {
1100
- error = ex;
1101
- }
1102
- 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);
1103
- if (error instanceof Error && !(error.message in loggedTypeFailures)) {
1104
- // Only monitor this failure once because there tends to be a lot of the
1105
- // same error.
1106
- loggedTypeFailures[error.message] = true;
1107
-
1108
- var stack = getStack ? getStack() : '';
1109
-
1110
- warning(false, 'Failed %s type: %s%s', location, error.message, stack != null ? stack : '');
1111
- }
1112
- }
1113
- }
1114
- }
1115
- }
1116
-
1117
- module.exports = checkPropTypes;
1118
-
1119
- /***/ }),
1120
- /* 11 */
1121
- /***/ (function(module, exports) {
1122
-
1123
- module.exports = ReactDOM;
1124
-
1125
- /***/ })
1126
- /******/ ]);
1127
- //# sourceMappingURL=demo.min.js.map