1 | (function webpackUniversalModuleDefinition(root, factory) {
|
2 | if(typeof exports === 'object' && typeof module === 'object')
|
3 | module.exports = factory();
|
4 | else if(typeof define === 'function' && define.amd)
|
5 | define([], factory);
|
6 | else if(typeof exports === 'object')
|
7 | exports["index"] = factory();
|
8 | else
|
9 | root["index"] = factory();
|
10 | })(this, function() {
|
11 | return (function(modules) {
|
12 |
|
13 | var installedModules = {};
|
14 |
|
15 |
|
16 | function __webpack_require__(moduleId) {
|
17 |
|
18 |
|
19 | if(installedModules[moduleId])
|
20 | return installedModules[moduleId].exports;
|
21 |
|
22 |
|
23 | var module = installedModules[moduleId] = {
|
24 | exports: {},
|
25 | id: moduleId,
|
26 | loaded: false
|
27 | };
|
28 |
|
29 |
|
30 | modules[moduleId].call(module.exports, module, module.exports, __webpack_require__);
|
31 |
|
32 |
|
33 | module.loaded = true;
|
34 |
|
35 |
|
36 | return module.exports;
|
37 | }
|
38 |
|
39 |
|
40 |
|
41 | __webpack_require__.m = modules;
|
42 |
|
43 |
|
44 | __webpack_require__.c = installedModules;
|
45 |
|
46 |
|
47 | __webpack_require__.p = "";
|
48 |
|
49 |
|
50 | return __webpack_require__(0);
|
51 | })
|
52 |
|
53 | ([
|
54 |
|
55 | function(module, exports, __webpack_require__) {
|
56 |
|
57 | __webpack_require__(1);
|
58 | module.exports = __webpack_require__(160);
|
59 |
|
60 |
|
61 | },
|
62 |
|
63 | function(module, exports, __webpack_require__) {
|
64 |
|
65 | 'use strict';
|
66 |
|
67 | var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();
|
68 |
|
69 | var _react = __webpack_require__(2);
|
70 |
|
71 | var _react2 = _interopRequireDefault(_react);
|
72 |
|
73 | var _reactDom = __webpack_require__(159);
|
74 |
|
75 | function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
76 |
|
77 | function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
78 |
|
79 | function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }
|
80 |
|
81 | function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }
|
82 |
|
83 | var App = function (_Component) {
|
84 | _inherits(App, _Component);
|
85 |
|
86 | function App() {
|
87 | _classCallCheck(this, App);
|
88 |
|
89 | return _possibleConstructorReturn(this, Object.getPrototypeOf(App).apply(this, arguments));
|
90 | }
|
91 |
|
92 | _createClass(App, [{
|
93 | key: 'render',
|
94 | value: function render() {
|
95 | return _react2.default.createElement(
|
96 | 'h1',
|
97 | null,
|
98 | 'hello world'
|
99 | );
|
100 | }
|
101 | }]);
|
102 |
|
103 | return App;
|
104 | }(_react.Component);
|
105 |
|
106 | module.exports = App;
|
107 |
|
108 | },
|
109 |
|
110 | function(module, exports, __webpack_require__) {
|
111 |
|
112 | 'use strict';
|
113 |
|
114 | module.exports = __webpack_require__(3);
|
115 |
|
116 |
|
117 | },
|
118 |
|
119 | function(module, exports, __webpack_require__) {
|
120 |
|
121 | |
122 |
|
123 |
|
124 |
|
125 |
|
126 |
|
127 |
|
128 |
|
129 |
|
130 |
|
131 |
|
132 | 'use strict';
|
133 |
|
134 | var ReactDOM = __webpack_require__(4);
|
135 | var ReactDOMServer = __webpack_require__(149);
|
136 | var ReactIsomorphic = __webpack_require__(153);
|
137 |
|
138 | var assign = __webpack_require__(40);
|
139 | var deprecated = __webpack_require__(158);
|
140 |
|
141 |
|
142 | var React = {};
|
143 |
|
144 | assign(React, ReactIsomorphic);
|
145 |
|
146 | assign(React, {
|
147 |
|
148 | findDOMNode: deprecated('findDOMNode', 'ReactDOM', 'react-dom', ReactDOM, ReactDOM.findDOMNode),
|
149 | render: deprecated('render', 'ReactDOM', 'react-dom', ReactDOM, ReactDOM.render),
|
150 | unmountComponentAtNode: deprecated('unmountComponentAtNode', 'ReactDOM', 'react-dom', ReactDOM, ReactDOM.unmountComponentAtNode),
|
151 |
|
152 |
|
153 | renderToString: deprecated('renderToString', 'ReactDOMServer', 'react-dom/server', ReactDOMServer, ReactDOMServer.renderToString),
|
154 | renderToStaticMarkup: deprecated('renderToStaticMarkup', 'ReactDOMServer', 'react-dom/server', ReactDOMServer, ReactDOMServer.renderToStaticMarkup)
|
155 | });
|
156 |
|
157 | React.__SECRET_DOM_DO_NOT_USE_OR_YOU_WILL_BE_FIRED = ReactDOM;
|
158 | React.__SECRET_DOM_SERVER_DO_NOT_USE_OR_YOU_WILL_BE_FIRED = ReactDOMServer;
|
159 |
|
160 | module.exports = React;
|
161 |
|
162 | },
|
163 |
|
164 | function(module, exports, __webpack_require__) {
|
165 |
|
166 | (function(process) { |
167 |
|
168 |
|
169 |
|
170 |
|
171 |
|
172 |
|
173 |
|
174 |
|
175 |
|
176 |
|
177 |
|
178 |
|
179 | 'use strict';
|
180 |
|
181 | var ReactCurrentOwner = __webpack_require__(6);
|
182 | var ReactDOMTextComponent = __webpack_require__(7);
|
183 | var ReactDefaultInjection = __webpack_require__(72);
|
184 | var ReactInstanceHandles = __webpack_require__(46);
|
185 | var ReactMount = __webpack_require__(29);
|
186 | var ReactPerf = __webpack_require__(19);
|
187 | var ReactReconciler = __webpack_require__(51);
|
188 | var ReactUpdates = __webpack_require__(55);
|
189 | var ReactVersion = __webpack_require__(147);
|
190 |
|
191 | var findDOMNode = __webpack_require__(92);
|
192 | var renderSubtreeIntoContainer = __webpack_require__(148);
|
193 | var warning = __webpack_require__(26);
|
194 |
|
195 | ReactDefaultInjection.inject();
|
196 |
|
197 | var render = ReactPerf.measure('React', 'render', ReactMount.render);
|
198 |
|
199 | var React = {
|
200 | findDOMNode: findDOMNode,
|
201 | render: render,
|
202 | unmountComponentAtNode: ReactMount.unmountComponentAtNode,
|
203 | version: ReactVersion,
|
204 |
|
205 |
|
206 | unstable_batchedUpdates: ReactUpdates.batchedUpdates,
|
207 | unstable_renderSubtreeIntoContainer: renderSubtreeIntoContainer
|
208 | };
|
209 |
|
210 |
|
211 |
|
212 |
|
213 | if (typeof __REACT_DEVTOOLS_GLOBAL_HOOK__ !== 'undefined' && typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.inject === 'function') {
|
214 | __REACT_DEVTOOLS_GLOBAL_HOOK__.inject({
|
215 | CurrentOwner: ReactCurrentOwner,
|
216 | InstanceHandles: ReactInstanceHandles,
|
217 | Mount: ReactMount,
|
218 | Reconciler: ReactReconciler,
|
219 | TextComponent: ReactDOMTextComponent
|
220 | });
|
221 | }
|
222 |
|
223 | if (process.env.NODE_ENV !== 'production') {
|
224 | var ExecutionEnvironment = __webpack_require__(10);
|
225 | if (ExecutionEnvironment.canUseDOM && window.top === window.self) {
|
226 |
|
227 |
|
228 | if (typeof __REACT_DEVTOOLS_GLOBAL_HOOK__ === 'undefined') {
|
229 |
|
230 | if (navigator.userAgent.indexOf('Chrome') > -1 && navigator.userAgent.indexOf('Edge') === -1 || navigator.userAgent.indexOf('Firefox') > -1) {
|
231 | console.debug('Download the React DevTools for a better development experience: ' + 'https://fb.me/react-devtools');
|
232 | }
|
233 | }
|
234 |
|
235 |
|
236 |
|
237 | var ieCompatibilityMode = document.documentMode && document.documentMode < 8;
|
238 |
|
239 | process.env.NODE_ENV !== 'production' ? warning(!ieCompatibilityMode, 'Internet Explorer is running in compatibility mode; please add the ' + 'following tag to your HTML to prevent this from happening: ' + '<meta http-equiv="X-UA-Compatible" content="IE=edge" />') : undefined;
|
240 |
|
241 | var expectedFeatures = [
|
242 |
|
243 | Array.isArray, Array.prototype.every, Array.prototype.forEach, Array.prototype.indexOf, Array.prototype.map, Date.now, Function.prototype.bind, Object.keys, String.prototype.split, String.prototype.trim,
|
244 |
|
245 |
|
246 | Object.create, Object.freeze];
|
247 |
|
248 | for (var i = 0; i < expectedFeatures.length; i++) {
|
249 | if (!expectedFeatures[i]) {
|
250 | console.error('One or more ES5 shim/shams expected by React are not available: ' + 'https://fb.me/react-warning-polyfills');
|
251 | break;
|
252 | }
|
253 | }
|
254 | }
|
255 | }
|
256 |
|
257 | module.exports = React;
|
258 | }.call(exports, __webpack_require__(5)))
|
259 |
|
260 | },
|
261 |
|
262 | function(module, exports) {
|
263 |
|
264 |
|
265 |
|
266 | var process = module.exports = {};
|
267 | var queue = [];
|
268 | var draining = false;
|
269 | var currentQueue;
|
270 | var queueIndex = -1;
|
271 |
|
272 | function cleanUpNextTick() {
|
273 | draining = false;
|
274 | if (currentQueue.length) {
|
275 | queue = currentQueue.concat(queue);
|
276 | } else {
|
277 | queueIndex = -1;
|
278 | }
|
279 | if (queue.length) {
|
280 | drainQueue();
|
281 | }
|
282 | }
|
283 |
|
284 | function drainQueue() {
|
285 | if (draining) {
|
286 | return;
|
287 | }
|
288 | var timeout = setTimeout(cleanUpNextTick);
|
289 | draining = true;
|
290 |
|
291 | var len = queue.length;
|
292 | while(len) {
|
293 | currentQueue = queue;
|
294 | queue = [];
|
295 | while (++queueIndex < len) {
|
296 | if (currentQueue) {
|
297 | currentQueue[queueIndex].run();
|
298 | }
|
299 | }
|
300 | queueIndex = -1;
|
301 | len = queue.length;
|
302 | }
|
303 | currentQueue = null;
|
304 | draining = false;
|
305 | clearTimeout(timeout);
|
306 | }
|
307 |
|
308 | process.nextTick = function (fun) {
|
309 | var args = new Array(arguments.length - 1);
|
310 | if (arguments.length > 1) {
|
311 | for (var i = 1; i < arguments.length; i++) {
|
312 | args[i - 1] = arguments[i];
|
313 | }
|
314 | }
|
315 | queue.push(new Item(fun, args));
|
316 | if (queue.length === 1 && !draining) {
|
317 | setTimeout(drainQueue, 0);
|
318 | }
|
319 | };
|
320 |
|
321 |
|
322 | function Item(fun, array) {
|
323 | this.fun = fun;
|
324 | this.array = array;
|
325 | }
|
326 | Item.prototype.run = function () {
|
327 | this.fun.apply(null, this.array);
|
328 | };
|
329 | process.title = 'browser';
|
330 | process.browser = true;
|
331 | process.env = {};
|
332 | process.argv = [];
|
333 | process.version = '';
|
334 | process.versions = {};
|
335 |
|
336 | function noop() {}
|
337 |
|
338 | process.on = noop;
|
339 | process.addListener = noop;
|
340 | process.once = noop;
|
341 | process.off = noop;
|
342 | process.removeListener = noop;
|
343 | process.removeAllListeners = noop;
|
344 | process.emit = noop;
|
345 |
|
346 | process.binding = function (name) {
|
347 | throw new Error('process.binding is not supported');
|
348 | };
|
349 |
|
350 | process.cwd = function () { return '/' };
|
351 | process.chdir = function (dir) {
|
352 | throw new Error('process.chdir is not supported');
|
353 | };
|
354 | process.umask = function() { return 0; };
|
355 |
|
356 |
|
357 | },
|
358 |
|
359 | function(module, exports) {
|
360 |
|
361 | |
362 |
|
363 |
|
364 |
|
365 |
|
366 |
|
367 |
|
368 |
|
369 |
|
370 |
|
371 |
|
372 | 'use strict';
|
373 |
|
374 | |
375 |
|
376 |
|
377 |
|
378 |
|
379 |
|
380 | var ReactCurrentOwner = {
|
381 |
|
382 | |
383 |
|
384 |
|
385 |
|
386 | current: null
|
387 |
|
388 | };
|
389 |
|
390 | module.exports = ReactCurrentOwner;
|
391 |
|
392 | },
|
393 |
|
394 | function(module, exports, __webpack_require__) {
|
395 |
|
396 | (function(process) { |
397 |
|
398 |
|
399 |
|
400 |
|
401 |
|
402 |
|
403 |
|
404 |
|
405 |
|
406 |
|
407 |
|
408 | 'use strict';
|
409 |
|
410 | var DOMChildrenOperations = __webpack_require__(8);
|
411 | var DOMPropertyOperations = __webpack_require__(23);
|
412 | var ReactComponentBrowserEnvironment = __webpack_require__(27);
|
413 | var ReactMount = __webpack_require__(29);
|
414 |
|
415 | var assign = __webpack_require__(40);
|
416 | var escapeTextContentForBrowser = __webpack_require__(22);
|
417 | var setTextContent = __webpack_require__(21);
|
418 | var validateDOMNesting = __webpack_require__(71);
|
419 |
|
420 | |
421 |
|
422 |
|
423 |
|
424 |
|
425 |
|
426 |
|
427 |
|
428 |
|
429 |
|
430 |
|
431 |
|
432 |
|
433 |
|
434 |
|
435 | var ReactDOMTextComponent = function (props) {
|
436 |
|
437 | };
|
438 |
|
439 | assign(ReactDOMTextComponent.prototype, {
|
440 |
|
441 | |
442 |
|
443 |
|
444 |
|
445 | construct: function (text) {
|
446 |
|
447 | this._currentElement = text;
|
448 | this._stringText = '' + text;
|
449 |
|
450 |
|
451 | this._rootNodeID = null;
|
452 | this._mountIndex = 0;
|
453 | },
|
454 |
|
455 | |
456 |
|
457 |
|
458 |
|
459 |
|
460 |
|
461 |
|
462 |
|
463 |
|
464 | mountComponent: function (rootID, transaction, context) {
|
465 | if (process.env.NODE_ENV !== 'production') {
|
466 | if (context[validateDOMNesting.ancestorInfoContextKey]) {
|
467 | validateDOMNesting('span', null, context[validateDOMNesting.ancestorInfoContextKey]);
|
468 | }
|
469 | }
|
470 |
|
471 | this._rootNodeID = rootID;
|
472 | if (transaction.useCreateElement) {
|
473 | var ownerDocument = context[ReactMount.ownerDocumentContextKey];
|
474 | var el = ownerDocument.createElement('span');
|
475 | DOMPropertyOperations.setAttributeForID(el, rootID);
|
476 |
|
477 | ReactMount.getID(el);
|
478 | setTextContent(el, this._stringText);
|
479 | return el;
|
480 | } else {
|
481 | var escapedText = escapeTextContentForBrowser(this._stringText);
|
482 |
|
483 | if (transaction.renderToStaticMarkup) {
|
484 |
|
485 |
|
486 |
|
487 | return escapedText;
|
488 | }
|
489 |
|
490 | return '<span ' + DOMPropertyOperations.createMarkupForID(rootID) + '>' + escapedText + '</span>';
|
491 | }
|
492 | },
|
493 |
|
494 | |
495 |
|
496 |
|
497 |
|
498 |
|
499 |
|
500 |
|
501 | receiveComponent: function (nextText, transaction) {
|
502 | if (nextText !== this._currentElement) {
|
503 | this._currentElement = nextText;
|
504 | var nextStringText = '' + nextText;
|
505 | if (nextStringText !== this._stringText) {
|
506 |
|
507 |
|
508 |
|
509 | this._stringText = nextStringText;
|
510 | var node = ReactMount.getNode(this._rootNodeID);
|
511 | DOMChildrenOperations.updateTextContent(node, nextStringText);
|
512 | }
|
513 | }
|
514 | },
|
515 |
|
516 | unmountComponent: function () {
|
517 | ReactComponentBrowserEnvironment.unmountIDFromEnvironment(this._rootNodeID);
|
518 | }
|
519 |
|
520 | });
|
521 |
|
522 | module.exports = ReactDOMTextComponent;
|
523 | }.call(exports, __webpack_require__(5)))
|
524 |
|
525 | },
|
526 |
|
527 | function(module, exports, __webpack_require__) {
|
528 |
|
529 | (function(process) { |
530 |
|
531 |
|
532 |
|
533 |
|
534 |
|
535 |
|
536 |
|
537 |
|
538 |
|
539 |
|
540 |
|
541 | 'use strict';
|
542 |
|
543 | var Danger = __webpack_require__(9);
|
544 | var ReactMultiChildUpdateTypes = __webpack_require__(17);
|
545 | var ReactPerf = __webpack_require__(19);
|
546 |
|
547 | var setInnerHTML = __webpack_require__(20);
|
548 | var setTextContent = __webpack_require__(21);
|
549 | var invariant = __webpack_require__(14);
|
550 |
|
551 | |
552 |
|
553 |
|
554 |
|
555 |
|
556 |
|
557 |
|
558 |
|
559 | function insertChildAt(parentNode, childNode, index) {
|
560 |
|
561 |
|
562 |
|
563 |
|
564 |
|
565 |
|
566 |
|
567 | var beforeChild = index >= parentNode.childNodes.length ? null : parentNode.childNodes.item(index);
|
568 |
|
569 | parentNode.insertBefore(childNode, beforeChild);
|
570 | }
|
571 |
|
572 | |
573 |
|
574 |
|
575 | var DOMChildrenOperations = {
|
576 |
|
577 | dangerouslyReplaceNodeWithMarkup: Danger.dangerouslyReplaceNodeWithMarkup,
|
578 |
|
579 | updateTextContent: setTextContent,
|
580 |
|
581 | |
582 |
|
583 |
|
584 |
|
585 |
|
586 |
|
587 |
|
588 |
|
589 | processUpdates: function (updates, markupList) {
|
590 | var update;
|
591 |
|
592 | var initialChildren = null;
|
593 |
|
594 | var updatedChildren = null;
|
595 |
|
596 | for (var i = 0; i < updates.length; i++) {
|
597 | update = updates[i];
|
598 | if (update.type === ReactMultiChildUpdateTypes.MOVE_EXISTING || update.type === ReactMultiChildUpdateTypes.REMOVE_NODE) {
|
599 | var updatedIndex = update.fromIndex;
|
600 | var updatedChild = update.parentNode.childNodes[updatedIndex];
|
601 | var parentID = update.parentID;
|
602 |
|
603 | !updatedChild ? process.env.NODE_ENV !== 'production' ? invariant(false, 'processUpdates(): Unable to find child %s of element. This ' + 'probably means the DOM was unexpectedly mutated (e.g., by the ' + 'browser), usually due to forgetting a <tbody> when using tables, ' + 'nesting tags like <form>, <p>, or <a>, or using non-SVG elements ' + 'in an <svg> parent. Try inspecting the child nodes of the element ' + 'with React ID `%s`.', updatedIndex, parentID) : invariant(false) : undefined;
|
604 |
|
605 | initialChildren = initialChildren || {};
|
606 | initialChildren[parentID] = initialChildren[parentID] || [];
|
607 | initialChildren[parentID][updatedIndex] = updatedChild;
|
608 |
|
609 | updatedChildren = updatedChildren || [];
|
610 | updatedChildren.push(updatedChild);
|
611 | }
|
612 | }
|
613 |
|
614 | var renderedMarkup;
|
615 |
|
616 | if (markupList.length && typeof markupList[0] === 'string') {
|
617 | renderedMarkup = Danger.dangerouslyRenderMarkup(markupList);
|
618 | } else {
|
619 | renderedMarkup = markupList;
|
620 | }
|
621 |
|
622 |
|
623 | if (updatedChildren) {
|
624 | for (var j = 0; j < updatedChildren.length; j++) {
|
625 | updatedChildren[j].parentNode.removeChild(updatedChildren[j]);
|
626 | }
|
627 | }
|
628 |
|
629 | for (var k = 0; k < updates.length; k++) {
|
630 | update = updates[k];
|
631 | switch (update.type) {
|
632 | case ReactMultiChildUpdateTypes.INSERT_MARKUP:
|
633 | insertChildAt(update.parentNode, renderedMarkup[update.markupIndex], update.toIndex);
|
634 | break;
|
635 | case ReactMultiChildUpdateTypes.MOVE_EXISTING:
|
636 | insertChildAt(update.parentNode, initialChildren[update.parentID][update.fromIndex], update.toIndex);
|
637 | break;
|
638 | case ReactMultiChildUpdateTypes.SET_MARKUP:
|
639 | setInnerHTML(update.parentNode, update.content);
|
640 | break;
|
641 | case ReactMultiChildUpdateTypes.TEXT_CONTENT:
|
642 | setTextContent(update.parentNode, update.content);
|
643 | break;
|
644 | case ReactMultiChildUpdateTypes.REMOVE_NODE:
|
645 |
|
646 | break;
|
647 | }
|
648 | }
|
649 | }
|
650 |
|
651 | };
|
652 |
|
653 | ReactPerf.measureMethods(DOMChildrenOperations, 'DOMChildrenOperations', {
|
654 | updateTextContent: 'updateTextContent'
|
655 | });
|
656 |
|
657 | module.exports = DOMChildrenOperations;
|
658 | }.call(exports, __webpack_require__(5)))
|
659 |
|
660 | },
|
661 |
|
662 | function(module, exports, __webpack_require__) {
|
663 |
|
664 | (function(process) { |
665 |
|
666 |
|
667 |
|
668 |
|
669 |
|
670 |
|
671 |
|
672 |
|
673 |
|
674 |
|
675 |
|
676 | 'use strict';
|
677 |
|
678 | var ExecutionEnvironment = __webpack_require__(10);
|
679 |
|
680 | var createNodesFromMarkup = __webpack_require__(11);
|
681 | var emptyFunction = __webpack_require__(16);
|
682 | var getMarkupWrap = __webpack_require__(15);
|
683 | var invariant = __webpack_require__(14);
|
684 |
|
685 | var OPEN_TAG_NAME_EXP = /^(<[^ \/>]+)/;
|
686 | var RESULT_INDEX_ATTR = 'data-danger-index';
|
687 |
|
688 | |
689 |
|
690 |
|
691 |
|
692 |
|
693 |
|
694 |
|
695 |
|
696 |
|
697 |
|
698 |
|
699 | function getNodeName(markup) {
|
700 | return markup.substring(1, markup.indexOf(' '));
|
701 | }
|
702 |
|
703 | var Danger = {
|
704 |
|
705 | |
706 |
|
707 |
|
708 |
|
709 |
|
710 |
|
711 |
|
712 |
|
713 |
|
714 | dangerouslyRenderMarkup: function (markupList) {
|
715 | !ExecutionEnvironment.canUseDOM ? process.env.NODE_ENV !== 'production' ? invariant(false, 'dangerouslyRenderMarkup(...): Cannot render markup in a worker ' + 'thread. Make sure `window` and `document` are available globally ' + 'before requiring React when unit testing or use ' + 'ReactDOMServer.renderToString for server rendering.') : invariant(false) : undefined;
|
716 | var nodeName;
|
717 | var markupByNodeName = {};
|
718 |
|
719 | for (var i = 0; i < markupList.length; i++) {
|
720 | !markupList[i] ? process.env.NODE_ENV !== 'production' ? invariant(false, 'dangerouslyRenderMarkup(...): Missing markup.') : invariant(false) : undefined;
|
721 | nodeName = getNodeName(markupList[i]);
|
722 | nodeName = getMarkupWrap(nodeName) ? nodeName : '*';
|
723 | markupByNodeName[nodeName] = markupByNodeName[nodeName] || [];
|
724 | markupByNodeName[nodeName][i] = markupList[i];
|
725 | }
|
726 | var resultList = [];
|
727 | var resultListAssignmentCount = 0;
|
728 | for (nodeName in markupByNodeName) {
|
729 | if (!markupByNodeName.hasOwnProperty(nodeName)) {
|
730 | continue;
|
731 | }
|
732 | var markupListByNodeName = markupByNodeName[nodeName];
|
733 |
|
734 |
|
735 |
|
736 |
|
737 | var resultIndex;
|
738 | for (resultIndex in markupListByNodeName) {
|
739 | if (markupListByNodeName.hasOwnProperty(resultIndex)) {
|
740 | var markup = markupListByNodeName[resultIndex];
|
741 |
|
742 |
|
743 |
|
744 |
|
745 | markupListByNodeName[resultIndex] = markup.replace(OPEN_TAG_NAME_EXP,
|
746 |
|
747 | '$1 ' + RESULT_INDEX_ATTR + '="' + resultIndex + '" ');
|
748 | }
|
749 | }
|
750 |
|
751 |
|
752 | var renderNodes = createNodesFromMarkup(markupListByNodeName.join(''), emptyFunction
|
753 | );
|
754 |
|
755 | for (var j = 0; j < renderNodes.length; ++j) {
|
756 | var renderNode = renderNodes[j];
|
757 | if (renderNode.hasAttribute && renderNode.hasAttribute(RESULT_INDEX_ATTR)) {
|
758 |
|
759 | resultIndex = +renderNode.getAttribute(RESULT_INDEX_ATTR);
|
760 | renderNode.removeAttribute(RESULT_INDEX_ATTR);
|
761 |
|
762 | !!resultList.hasOwnProperty(resultIndex) ? process.env.NODE_ENV !== 'production' ? invariant(false, 'Danger: Assigning to an already-occupied result index.') : invariant(false) : undefined;
|
763 |
|
764 | resultList[resultIndex] = renderNode;
|
765 |
|
766 |
|
767 |
|
768 | resultListAssignmentCount += 1;
|
769 | } else if (process.env.NODE_ENV !== 'production') {
|
770 | console.error('Danger: Discarding unexpected node:', renderNode);
|
771 | }
|
772 | }
|
773 | }
|
774 |
|
775 |
|
776 |
|
777 | !(resultListAssignmentCount === resultList.length) ? process.env.NODE_ENV !== 'production' ? invariant(false, 'Danger: Did not assign to every index of resultList.') : invariant(false) : undefined;
|
778 |
|
779 | !(resultList.length === markupList.length) ? process.env.NODE_ENV !== 'production' ? invariant(false, 'Danger: Expected markup to render %s nodes, but rendered %s.', markupList.length, resultList.length) : invariant(false) : undefined;
|
780 |
|
781 | return resultList;
|
782 | },
|
783 |
|
784 | |
785 |
|
786 |
|
787 |
|
788 |
|
789 |
|
790 |
|
791 |
|
792 | dangerouslyReplaceNodeWithMarkup: function (oldChild, markup) {
|
793 | !ExecutionEnvironment.canUseDOM ? process.env.NODE_ENV !== 'production' ? invariant(false, 'dangerouslyReplaceNodeWithMarkup(...): Cannot render markup in a ' + 'worker thread. Make sure `window` and `document` are available ' + 'globally before requiring React when unit testing or use ' + 'ReactDOMServer.renderToString() for server rendering.') : invariant(false) : undefined;
|
794 | !markup ? process.env.NODE_ENV !== 'production' ? invariant(false, 'dangerouslyReplaceNodeWithMarkup(...): Missing markup.') : invariant(false) : undefined;
|
795 | !(oldChild.tagName.toLowerCase() !== 'html') ? process.env.NODE_ENV !== 'production' ? invariant(false, 'dangerouslyReplaceNodeWithMarkup(...): Cannot replace markup of the ' + '<html> node. This is because browser quirks make this unreliable ' + 'and/or slow. If you want to render to the root you must use ' + 'server rendering. See ReactDOMServer.renderToString().') : invariant(false) : undefined;
|
796 |
|
797 | var newChild;
|
798 | if (typeof markup === 'string') {
|
799 | newChild = createNodesFromMarkup(markup, emptyFunction)[0];
|
800 | } else {
|
801 | newChild = markup;
|
802 | }
|
803 | oldChild.parentNode.replaceChild(newChild, oldChild);
|
804 | }
|
805 |
|
806 | };
|
807 |
|
808 | module.exports = Danger;
|
809 | }.call(exports, __webpack_require__(5)))
|
810 |
|
811 | },
|
812 |
|
813 | function(module, exports) {
|
814 |
|
815 | |
816 |
|
817 |
|
818 |
|
819 |
|
820 |
|
821 |
|
822 |
|
823 |
|
824 |
|
825 |
|
826 | 'use strict';
|
827 |
|
828 | var canUseDOM = !!(typeof window !== 'undefined' && window.document && window.document.createElement);
|
829 |
|
830 | |
831 |
|
832 |
|
833 |
|
834 |
|
835 |
|
836 | var ExecutionEnvironment = {
|
837 |
|
838 | canUseDOM: canUseDOM,
|
839 |
|
840 | canUseWorkers: typeof Worker !== 'undefined',
|
841 |
|
842 | canUseEventListeners: canUseDOM && !!(window.addEventListener || window.attachEvent),
|
843 |
|
844 | canUseViewport: canUseDOM && !!window.screen,
|
845 |
|
846 | isInWorker: !canUseDOM
|
847 |
|
848 | };
|
849 |
|
850 | module.exports = ExecutionEnvironment;
|
851 |
|
852 | },
|
853 |
|
854 | function(module, exports, __webpack_require__) {
|
855 |
|
856 | (function(process) { |
857 |
|
858 |
|
859 |
|
860 |
|
861 |
|
862 |
|
863 |
|
864 |
|
865 |
|
866 |
|
867 |
|
868 |
|
869 |
|
870 | 'use strict';
|
871 |
|
872 | var ExecutionEnvironment = __webpack_require__(10);
|
873 |
|
874 | var createArrayFromMixed = __webpack_require__(12);
|
875 | var getMarkupWrap = __webpack_require__(15);
|
876 | var invariant = __webpack_require__(14);
|
877 |
|
878 | |
879 |
|
880 |
|
881 | var dummyNode = ExecutionEnvironment.canUseDOM ? document.createElement('div') : null;
|
882 |
|
883 | |
884 |
|
885 |
|
886 | var nodeNamePattern = /^\s*<(\w+)/;
|
887 |
|
888 | |
889 |
|
890 |
|
891 |
|
892 |
|
893 |
|
894 | function getNodeName(markup) {
|
895 | var nodeNameMatch = markup.match(nodeNamePattern);
|
896 | return nodeNameMatch && nodeNameMatch[1].toLowerCase();
|
897 | }
|
898 |
|
899 | |
900 |
|
901 |
|
902 |
|
903 |
|
904 |
|
905 |
|
906 |
|
907 |
|
908 |
|
909 | function createNodesFromMarkup(markup, handleScript) {
|
910 | var node = dummyNode;
|
911 | !!!dummyNode ? process.env.NODE_ENV !== 'production' ? invariant(false, 'createNodesFromMarkup dummy not initialized') : invariant(false) : undefined;
|
912 | var nodeName = getNodeName(markup);
|
913 |
|
914 | var wrap = nodeName && getMarkupWrap(nodeName);
|
915 | if (wrap) {
|
916 | node.innerHTML = wrap[1] + markup + wrap[2];
|
917 |
|
918 | var wrapDepth = wrap[0];
|
919 | while (wrapDepth--) {
|
920 | node = node.lastChild;
|
921 | }
|
922 | } else {
|
923 | node.innerHTML = markup;
|
924 | }
|
925 |
|
926 | var scripts = node.getElementsByTagName('script');
|
927 | if (scripts.length) {
|
928 | !handleScript ? process.env.NODE_ENV !== 'production' ? invariant(false, 'createNodesFromMarkup(...): Unexpected <script> element rendered.') : invariant(false) : undefined;
|
929 | createArrayFromMixed(scripts).forEach(handleScript);
|
930 | }
|
931 |
|
932 | var nodes = createArrayFromMixed(node.childNodes);
|
933 | while (node.lastChild) {
|
934 | node.removeChild(node.lastChild);
|
935 | }
|
936 | return nodes;
|
937 | }
|
938 |
|
939 | module.exports = createNodesFromMarkup;
|
940 | }.call(exports, __webpack_require__(5)))
|
941 |
|
942 | },
|
943 |
|
944 | function(module, exports, __webpack_require__) {
|
945 |
|
946 | |
947 |
|
948 |
|
949 |
|
950 |
|
951 |
|
952 |
|
953 |
|
954 |
|
955 |
|
956 |
|
957 |
|
958 | 'use strict';
|
959 |
|
960 | var toArray = __webpack_require__(13);
|
961 |
|
962 | |
963 |
|
964 |
|
965 |
|
966 |
|
967 |
|
968 |
|
969 |
|
970 |
|
971 |
|
972 |
|
973 |
|
974 |
|
975 |
|
976 |
|
977 | function hasArrayNature(obj) {
|
978 | return(
|
979 |
|
980 | !!obj && (
|
981 |
|
982 | typeof obj == 'object' || typeof obj == 'function') &&
|
983 |
|
984 | 'length' in obj &&
|
985 |
|
986 | !('setInterval' in obj) &&
|
987 |
|
988 |
|
989 | typeof obj.nodeType != 'number' && (
|
990 |
|
991 | Array.isArray(obj) ||
|
992 |
|
993 | 'callee' in obj ||
|
994 |
|
995 | 'item' in obj)
|
996 | );
|
997 | }
|
998 |
|
999 | |
1000 |
|
1001 |
|
1002 |
|
1003 |
|
1004 |
|
1005 |
|
1006 |
|
1007 |
|
1008 |
|
1009 |
|
1010 |
|
1011 |
|
1012 |
|
1013 |
|
1014 |
|
1015 |
|
1016 |
|
1017 |
|
1018 |
|
1019 |
|
1020 | function createArrayFromMixed(obj) {
|
1021 | if (!hasArrayNature(obj)) {
|
1022 | return [obj];
|
1023 | } else if (Array.isArray(obj)) {
|
1024 | return obj.slice();
|
1025 | } else {
|
1026 | return toArray(obj);
|
1027 | }
|
1028 | }
|
1029 |
|
1030 | module.exports = createArrayFromMixed;
|
1031 |
|
1032 | },
|
1033 |
|
1034 | function(module, exports, __webpack_require__) {
|
1035 |
|
1036 | (function(process) { |
1037 |
|
1038 |
|
1039 |
|
1040 |
|
1041 |
|
1042 |
|
1043 |
|
1044 |
|
1045 |
|
1046 |
|
1047 |
|
1048 | 'use strict';
|
1049 |
|
1050 | var invariant = __webpack_require__(14);
|
1051 |
|
1052 | |
1053 |
|
1054 |
|
1055 |
|
1056 |
|
1057 |
|
1058 |
|
1059 |
|
1060 |
|
1061 | function toArray(obj) {
|
1062 | var length = obj.length;
|
1063 |
|
1064 |
|
1065 |
|
1066 | !(!Array.isArray(obj) && (typeof obj === 'object' || typeof obj === 'function')) ? process.env.NODE_ENV !== 'production' ? invariant(false, 'toArray: Array-like object expected') : invariant(false) : undefined;
|
1067 |
|
1068 | !(typeof length === 'number') ? process.env.NODE_ENV !== 'production' ? invariant(false, 'toArray: Object needs a length property') : invariant(false) : undefined;
|
1069 |
|
1070 | !(length === 0 || length - 1 in obj) ? process.env.NODE_ENV !== 'production' ? invariant(false, 'toArray: Object should have keys for indices') : invariant(false) : undefined;
|
1071 |
|
1072 |
|
1073 |
|
1074 |
|
1075 | if (obj.hasOwnProperty) {
|
1076 | try {
|
1077 | return Array.prototype.slice.call(obj);
|
1078 | } catch (e) {
|
1079 |
|
1080 | }
|
1081 | }
|
1082 |
|
1083 |
|
1084 |
|
1085 | var ret = Array(length);
|
1086 | for (var ii = 0; ii < length; ii++) {
|
1087 | ret[ii] = obj[ii];
|
1088 | }
|
1089 | return ret;
|
1090 | }
|
1091 |
|
1092 | module.exports = toArray;
|
1093 | }.call(exports, __webpack_require__(5)))
|
1094 |
|
1095 | },
|
1096 |
|
1097 | function(module, exports, __webpack_require__) {
|
1098 |
|
1099 | (function(process) { |
1100 |
|
1101 |
|
1102 |
|
1103 |
|
1104 |
|
1105 |
|
1106 |
|
1107 |
|
1108 |
|
1109 |
|
1110 | 'use strict';
|
1111 |
|
1112 | |
1113 |
|
1114 |
|
1115 |
|
1116 |
|
1117 |
|
1118 |
|
1119 |
|
1120 |
|
1121 |
|
1122 |
|
1123 | function invariant(condition, format, a, b, c, d, e, f) {
|
1124 | if (process.env.NODE_ENV !== 'production') {
|
1125 | if (format === undefined) {
|
1126 | throw new Error('invariant requires an error message argument');
|
1127 | }
|
1128 | }
|
1129 |
|
1130 | if (!condition) {
|
1131 | var error;
|
1132 | if (format === undefined) {
|
1133 | error = new Error('Minified exception occurred; use the non-minified dev environment ' + 'for the full error message and additional helpful warnings.');
|
1134 | } else {
|
1135 | var args = [a, b, c, d, e, f];
|
1136 | var argIndex = 0;
|
1137 | error = new Error(format.replace(/%s/g, function () {
|
1138 | return args[argIndex++];
|
1139 | }));
|
1140 | error.name = 'Invariant Violation';
|
1141 | }
|
1142 |
|
1143 | error.framesToPop = 1;
|
1144 | throw error;
|
1145 | }
|
1146 | }
|
1147 |
|
1148 | module.exports = invariant;
|
1149 | }.call(exports, __webpack_require__(5)))
|
1150 |
|
1151 | },
|
1152 |
|
1153 | function(module, exports, __webpack_require__) {
|
1154 |
|
1155 | (function(process) { |
1156 |
|
1157 |
|
1158 |
|
1159 |
|
1160 |
|
1161 |
|
1162 |
|
1163 |
|
1164 |
|
1165 |
|
1166 |
|
1167 |
|
1168 | 'use strict';
|
1169 |
|
1170 | var ExecutionEnvironment = __webpack_require__(10);
|
1171 |
|
1172 | var invariant = __webpack_require__(14);
|
1173 |
|
1174 | |
1175 |
|
1176 |
|
1177 | var dummyNode = ExecutionEnvironment.canUseDOM ? document.createElement('div') : null;
|
1178 |
|
1179 | |
1180 |
|
1181 |
|
1182 |
|
1183 |
|
1184 |
|
1185 |
|
1186 | var shouldWrap = {};
|
1187 |
|
1188 | var selectWrap = [1, '<select multiple="true">', '</select>'];
|
1189 | var tableWrap = [1, '<table>', '</table>'];
|
1190 | var trWrap = [3, '<table><tbody><tr>', '</tr></tbody></table>'];
|
1191 |
|
1192 | var svgWrap = [1, '<svg xmlns="http://www.w3.org/2000/svg">', '</svg>'];
|
1193 |
|
1194 | var markupWrap = {
|
1195 | '*': [1, '?<div>', '</div>'],
|
1196 |
|
1197 | 'area': [1, '<map>', '</map>'],
|
1198 | 'col': [2, '<table><tbody></tbody><colgroup>', '</colgroup></table>'],
|
1199 | 'legend': [1, '<fieldset>', '</fieldset>'],
|
1200 | 'param': [1, '<object>', '</object>'],
|
1201 | 'tr': [2, '<table><tbody>', '</tbody></table>'],
|
1202 |
|
1203 | 'optgroup': selectWrap,
|
1204 | 'option': selectWrap,
|
1205 |
|
1206 | 'caption': tableWrap,
|
1207 | 'colgroup': tableWrap,
|
1208 | 'tbody': tableWrap,
|
1209 | 'tfoot': tableWrap,
|
1210 | 'thead': tableWrap,
|
1211 |
|
1212 | 'td': trWrap,
|
1213 | 'th': trWrap
|
1214 | };
|
1215 |
|
1216 |
|
1217 |
|
1218 |
|
1219 | var svgElements = ['circle', 'clipPath', 'defs', 'ellipse', 'g', 'image', 'line', 'linearGradient', 'mask', 'path', 'pattern', 'polygon', 'polyline', 'radialGradient', 'rect', 'stop', 'text', 'tspan'];
|
1220 | svgElements.forEach(function (nodeName) {
|
1221 | markupWrap[nodeName] = svgWrap;
|
1222 | shouldWrap[nodeName] = true;
|
1223 | });
|
1224 |
|
1225 | |
1226 |
|
1227 |
|
1228 |
|
1229 |
|
1230 |
|
1231 |
|
1232 |
|
1233 | function getMarkupWrap(nodeName) {
|
1234 | !!!dummyNode ? process.env.NODE_ENV !== 'production' ? invariant(false, 'Markup wrapping node not initialized') : invariant(false) : undefined;
|
1235 | if (!markupWrap.hasOwnProperty(nodeName)) {
|
1236 | nodeName = '*';
|
1237 | }
|
1238 | if (!shouldWrap.hasOwnProperty(nodeName)) {
|
1239 | if (nodeName === '*') {
|
1240 | dummyNode.innerHTML = '<link />';
|
1241 | } else {
|
1242 | dummyNode.innerHTML = '<' + nodeName + '></' + nodeName + '>';
|
1243 | }
|
1244 | shouldWrap[nodeName] = !dummyNode.firstChild;
|
1245 | }
|
1246 | return shouldWrap[nodeName] ? markupWrap[nodeName] : null;
|
1247 | }
|
1248 |
|
1249 | module.exports = getMarkupWrap;
|
1250 | }.call(exports, __webpack_require__(5)))
|
1251 |
|
1252 | },
|
1253 |
|
1254 | function(module, exports) {
|
1255 |
|
1256 | |
1257 |
|
1258 |
|
1259 |
|
1260 |
|
1261 |
|
1262 |
|
1263 |
|
1264 |
|
1265 |
|
1266 |
|
1267 | "use strict";
|
1268 |
|
1269 | function makeEmptyFunction(arg) {
|
1270 | return function () {
|
1271 | return arg;
|
1272 | };
|
1273 | }
|
1274 |
|
1275 | |
1276 |
|
1277 |
|
1278 |
|
1279 |
|
1280 | function emptyFunction() {}
|
1281 |
|
1282 | emptyFunction.thatReturns = makeEmptyFunction;
|
1283 | emptyFunction.thatReturnsFalse = makeEmptyFunction(false);
|
1284 | emptyFunction.thatReturnsTrue = makeEmptyFunction(true);
|
1285 | emptyFunction.thatReturnsNull = makeEmptyFunction(null);
|
1286 | emptyFunction.thatReturnsThis = function () {
|
1287 | return this;
|
1288 | };
|
1289 | emptyFunction.thatReturnsArgument = function (arg) {
|
1290 | return arg;
|
1291 | };
|
1292 |
|
1293 | module.exports = emptyFunction;
|
1294 |
|
1295 | },
|
1296 |
|
1297 | function(module, exports, __webpack_require__) {
|
1298 |
|
1299 | |
1300 |
|
1301 |
|
1302 |
|
1303 |
|
1304 |
|
1305 |
|
1306 |
|
1307 |
|
1308 |
|
1309 |
|
1310 | 'use strict';
|
1311 |
|
1312 | var keyMirror = __webpack_require__(18);
|
1313 |
|
1314 | |
1315 |
|
1316 |
|
1317 |
|
1318 |
|
1319 |
|
1320 |
|
1321 |
|
1322 | var ReactMultiChildUpdateTypes = keyMirror({
|
1323 | INSERT_MARKUP: null,
|
1324 | MOVE_EXISTING: null,
|
1325 | REMOVE_NODE: null,
|
1326 | SET_MARKUP: null,
|
1327 | TEXT_CONTENT: null
|
1328 | });
|
1329 |
|
1330 | module.exports = ReactMultiChildUpdateTypes;
|
1331 |
|
1332 | },
|
1333 |
|
1334 | function(module, exports, __webpack_require__) {
|
1335 |
|
1336 | (function(process) { |
1337 |
|
1338 |
|
1339 |
|
1340 |
|
1341 |
|
1342 |
|
1343 |
|
1344 |
|
1345 |
|
1346 |
|
1347 |
|
1348 | 'use strict';
|
1349 |
|
1350 | var invariant = __webpack_require__(14);
|
1351 |
|
1352 | |
1353 |
|
1354 |
|
1355 |
|
1356 |
|
1357 |
|
1358 |
|
1359 |
|
1360 |
|
1361 |
|
1362 |
|
1363 |
|
1364 |
|
1365 |
|
1366 |
|
1367 |
|
1368 |
|
1369 |
|
1370 | var keyMirror = function (obj) {
|
1371 | var ret = {};
|
1372 | var key;
|
1373 | !(obj instanceof Object && !Array.isArray(obj)) ? process.env.NODE_ENV !== 'production' ? invariant(false, 'keyMirror(...): Argument must be an object.') : invariant(false) : undefined;
|
1374 | for (key in obj) {
|
1375 | if (!obj.hasOwnProperty(key)) {
|
1376 | continue;
|
1377 | }
|
1378 | ret[key] = key;
|
1379 | }
|
1380 | return ret;
|
1381 | };
|
1382 |
|
1383 | module.exports = keyMirror;
|
1384 | }.call(exports, __webpack_require__(5)))
|
1385 |
|
1386 | },
|
1387 |
|
1388 | function(module, exports, __webpack_require__) {
|
1389 |
|
1390 | (function(process) { |
1391 |
|
1392 |
|
1393 |
|
1394 |
|
1395 |
|
1396 |
|
1397 |
|
1398 |
|
1399 |
|
1400 |
|
1401 |
|
1402 | 'use strict';
|
1403 |
|
1404 | |
1405 |
|
1406 |
|
1407 |
|
1408 | var ReactPerf = {
|
1409 | |
1410 |
|
1411 |
|
1412 |
|
1413 | enableMeasure: false,
|
1414 |
|
1415 | |
1416 |
|
1417 |
|
1418 |
|
1419 | storedMeasure: _noMeasure,
|
1420 |
|
1421 | |
1422 |
|
1423 |
|
1424 |
|
1425 |
|
1426 | measureMethods: function (object, objectName, methodNames) {
|
1427 | if (process.env.NODE_ENV !== 'production') {
|
1428 | for (var key in methodNames) {
|
1429 | if (!methodNames.hasOwnProperty(key)) {
|
1430 | continue;
|
1431 | }
|
1432 | object[key] = ReactPerf.measure(objectName, methodNames[key], object[key]);
|
1433 | }
|
1434 | }
|
1435 | },
|
1436 |
|
1437 | |
1438 |
|
1439 |
|
1440 |
|
1441 |
|
1442 |
|
1443 |
|
1444 |
|
1445 | measure: function (objName, fnName, func) {
|
1446 | if (process.env.NODE_ENV !== 'production') {
|
1447 | var measuredFunc = null;
|
1448 | var wrapper = function () {
|
1449 | if (ReactPerf.enableMeasure) {
|
1450 | if (!measuredFunc) {
|
1451 | measuredFunc = ReactPerf.storedMeasure(objName, fnName, func);
|
1452 | }
|
1453 | return measuredFunc.apply(this, arguments);
|
1454 | }
|
1455 | return func.apply(this, arguments);
|
1456 | };
|
1457 | wrapper.displayName = objName + '_' + fnName;
|
1458 | return wrapper;
|
1459 | }
|
1460 | return func;
|
1461 | },
|
1462 |
|
1463 | injection: {
|
1464 | |
1465 |
|
1466 |
|
1467 | injectMeasure: function (measure) {
|
1468 | ReactPerf.storedMeasure = measure;
|
1469 | }
|
1470 | }
|
1471 | };
|
1472 |
|
1473 | |
1474 |
|
1475 |
|
1476 |
|
1477 |
|
1478 |
|
1479 |
|
1480 |
|
1481 | function _noMeasure(objName, fnName, func) {
|
1482 | return func;
|
1483 | }
|
1484 |
|
1485 | module.exports = ReactPerf;
|
1486 | }.call(exports, __webpack_require__(5)))
|
1487 |
|
1488 | },
|
1489 |
|
1490 | function(module, exports, __webpack_require__) {
|
1491 |
|
1492 | |
1493 |
|
1494 |
|
1495 |
|
1496 |
|
1497 |
|
1498 |
|
1499 |
|
1500 |
|
1501 |
|
1502 |
|
1503 |
|
1504 |
|
1505 | 'use strict';
|
1506 |
|
1507 | var ExecutionEnvironment = __webpack_require__(10);
|
1508 |
|
1509 | var WHITESPACE_TEST = /^[ \r\n\t\f]/;
|
1510 | var NONVISIBLE_TEST = /<(!--|link|noscript|meta|script|style)[ \r\n\t\f\/>]/;
|
1511 |
|
1512 | |
1513 |
|
1514 |
|
1515 |
|
1516 |
|
1517 |
|
1518 |
|
1519 |
|
1520 | var setInnerHTML = function (node, html) {
|
1521 | node.innerHTML = html;
|
1522 | };
|
1523 |
|
1524 |
|
1525 | if (typeof MSApp !== 'undefined' && MSApp.execUnsafeLocalFunction) {
|
1526 | setInnerHTML = function (node, html) {
|
1527 | MSApp.execUnsafeLocalFunction(function () {
|
1528 | node.innerHTML = html;
|
1529 | });
|
1530 | };
|
1531 | }
|
1532 |
|
1533 | if (ExecutionEnvironment.canUseDOM) {
|
1534 |
|
1535 |
|
1536 |
|
1537 |
|
1538 |
|
1539 |
|
1540 | var testElement = document.createElement('div');
|
1541 | testElement.innerHTML = ' ';
|
1542 | if (testElement.innerHTML === '') {
|
1543 | setInnerHTML = function (node, html) {
|
1544 |
|
1545 |
|
1546 |
|
1547 |
|
1548 |
|
1549 | if (node.parentNode) {
|
1550 | node.parentNode.replaceChild(node, node);
|
1551 | }
|
1552 |
|
1553 |
|
1554 |
|
1555 |
|
1556 |
|
1557 | if (WHITESPACE_TEST.test(html) || html[0] === '<' && NONVISIBLE_TEST.test(html)) {
|
1558 |
|
1559 |
|
1560 |
|
1561 |
|
1562 |
|
1563 |
|
1564 | node.innerHTML = String.fromCharCode(0xFEFF) + html;
|
1565 |
|
1566 |
|
1567 |
|
1568 | var textNode = node.firstChild;
|
1569 | if (textNode.data.length === 1) {
|
1570 | node.removeChild(textNode);
|
1571 | } else {
|
1572 | textNode.deleteData(0, 1);
|
1573 | }
|
1574 | } else {
|
1575 | node.innerHTML = html;
|
1576 | }
|
1577 | };
|
1578 | }
|
1579 | }
|
1580 |
|
1581 | module.exports = setInnerHTML;
|
1582 |
|
1583 | },
|
1584 |
|
1585 | function(module, exports, __webpack_require__) {
|
1586 |
|
1587 | |
1588 |
|
1589 |
|
1590 |
|
1591 |
|
1592 |
|
1593 |
|
1594 |
|
1595 |
|
1596 |
|
1597 |
|
1598 | 'use strict';
|
1599 |
|
1600 | var ExecutionEnvironment = __webpack_require__(10);
|
1601 | var escapeTextContentForBrowser = __webpack_require__(22);
|
1602 | var setInnerHTML = __webpack_require__(20);
|
1603 |
|
1604 | |
1605 |
|
1606 |
|
1607 |
|
1608 |
|
1609 |
|
1610 |
|
1611 |
|
1612 |
|
1613 |
|
1614 | var setTextContent = function (node, text) {
|
1615 | node.textContent = text;
|
1616 | };
|
1617 |
|
1618 | if (ExecutionEnvironment.canUseDOM) {
|
1619 | if (!('textContent' in document.documentElement)) {
|
1620 | setTextContent = function (node, text) {
|
1621 | setInnerHTML(node, escapeTextContentForBrowser(text));
|
1622 | };
|
1623 | }
|
1624 | }
|
1625 |
|
1626 | module.exports = setTextContent;
|
1627 |
|
1628 | },
|
1629 |
|
1630 | function(module, exports) {
|
1631 |
|
1632 | |
1633 |
|
1634 |
|
1635 |
|
1636 |
|
1637 |
|
1638 |
|
1639 |
|
1640 |
|
1641 |
|
1642 |
|
1643 | 'use strict';
|
1644 |
|
1645 | var ESCAPE_LOOKUP = {
|
1646 | '&': '&',
|
1647 | '>': '>',
|
1648 | '<': '<',
|
1649 | '"': '"',
|
1650 | '\'': '''
|
1651 | };
|
1652 |
|
1653 | var ESCAPE_REGEX = /[&><"']/g;
|
1654 |
|
1655 | function escaper(match) {
|
1656 | return ESCAPE_LOOKUP[match];
|
1657 | }
|
1658 |
|
1659 | |
1660 |
|
1661 |
|
1662 |
|
1663 |
|
1664 |
|
1665 | function escapeTextContentForBrowser(text) {
|
1666 | return ('' + text).replace(ESCAPE_REGEX, escaper);
|
1667 | }
|
1668 |
|
1669 | module.exports = escapeTextContentForBrowser;
|
1670 |
|
1671 | },
|
1672 |
|
1673 | function(module, exports, __webpack_require__) {
|
1674 |
|
1675 | (function(process) { |
1676 |
|
1677 |
|
1678 |
|
1679 |
|
1680 |
|
1681 |
|
1682 |
|
1683 |
|
1684 |
|
1685 |
|
1686 |
|
1687 | 'use strict';
|
1688 |
|
1689 | var DOMProperty = __webpack_require__(24);
|
1690 | var ReactPerf = __webpack_require__(19);
|
1691 |
|
1692 | var quoteAttributeValueForBrowser = __webpack_require__(25);
|
1693 | var warning = __webpack_require__(26);
|
1694 |
|
1695 |
|
1696 | var VALID_ATTRIBUTE_NAME_REGEX = /^[a-zA-Z_][\w\.\-]*$/;
|
1697 | var illegalAttributeNameCache = {};
|
1698 | var validatedAttributeNameCache = {};
|
1699 |
|
1700 | function isAttributeNameSafe(attributeName) {
|
1701 | if (validatedAttributeNameCache.hasOwnProperty(attributeName)) {
|
1702 | return true;
|
1703 | }
|
1704 | if (illegalAttributeNameCache.hasOwnProperty(attributeName)) {
|
1705 | return false;
|
1706 | }
|
1707 | if (VALID_ATTRIBUTE_NAME_REGEX.test(attributeName)) {
|
1708 | validatedAttributeNameCache[attributeName] = true;
|
1709 | return true;
|
1710 | }
|
1711 | illegalAttributeNameCache[attributeName] = true;
|
1712 | process.env.NODE_ENV !== 'production' ? warning(false, 'Invalid attribute name: `%s`', attributeName) : undefined;
|
1713 | return false;
|
1714 | }
|
1715 |
|
1716 | function shouldIgnoreValue(propertyInfo, value) {
|
1717 | return value == null || propertyInfo.hasBooleanValue && !value || propertyInfo.hasNumericValue && isNaN(value) || propertyInfo.hasPositiveNumericValue && value < 1 || propertyInfo.hasOverloadedBooleanValue && value === false;
|
1718 | }
|
1719 |
|
1720 | if (process.env.NODE_ENV !== 'production') {
|
1721 | var reactProps = {
|
1722 | children: true,
|
1723 | dangerouslySetInnerHTML: true,
|
1724 | key: true,
|
1725 | ref: true
|
1726 | };
|
1727 | var warnedProperties = {};
|
1728 |
|
1729 | var warnUnknownProperty = function (name) {
|
1730 | if (reactProps.hasOwnProperty(name) && reactProps[name] || warnedProperties.hasOwnProperty(name) && warnedProperties[name]) {
|
1731 | return;
|
1732 | }
|
1733 |
|
1734 | warnedProperties[name] = true;
|
1735 | var lowerCasedName = name.toLowerCase();
|
1736 |
|
1737 |
|
1738 | var standardName = DOMProperty.isCustomAttribute(lowerCasedName) ? lowerCasedName : DOMProperty.getPossibleStandardName.hasOwnProperty(lowerCasedName) ? DOMProperty.getPossibleStandardName[lowerCasedName] : null;
|
1739 |
|
1740 |
|
1741 |
|
1742 | process.env.NODE_ENV !== 'production' ? warning(standardName == null, 'Unknown DOM property %s. Did you mean %s?', name, standardName) : undefined;
|
1743 | };
|
1744 | }
|
1745 |
|
1746 | |
1747 |
|
1748 |
|
1749 | var DOMPropertyOperations = {
|
1750 |
|
1751 | |
1752 |
|
1753 |
|
1754 |
|
1755 |
|
1756 |
|
1757 | createMarkupForID: function (id) {
|
1758 | return DOMProperty.ID_ATTRIBUTE_NAME + '=' + quoteAttributeValueForBrowser(id);
|
1759 | },
|
1760 |
|
1761 | setAttributeForID: function (node, id) {
|
1762 | node.setAttribute(DOMProperty.ID_ATTRIBUTE_NAME, id);
|
1763 | },
|
1764 |
|
1765 | |
1766 |
|
1767 |
|
1768 |
|
1769 |
|
1770 |
|
1771 |
|
1772 | createMarkupForProperty: function (name, value) {
|
1773 | var propertyInfo = DOMProperty.properties.hasOwnProperty(name) ? DOMProperty.properties[name] : null;
|
1774 | if (propertyInfo) {
|
1775 | if (shouldIgnoreValue(propertyInfo, value)) {
|
1776 | return '';
|
1777 | }
|
1778 | var attributeName = propertyInfo.attributeName;
|
1779 | if (propertyInfo.hasBooleanValue || propertyInfo.hasOverloadedBooleanValue && value === true) {
|
1780 | return attributeName + '=""';
|
1781 | }
|
1782 | return attributeName + '=' + quoteAttributeValueForBrowser(value);
|
1783 | } else if (DOMProperty.isCustomAttribute(name)) {
|
1784 | if (value == null) {
|
1785 | return '';
|
1786 | }
|
1787 | return name + '=' + quoteAttributeValueForBrowser(value);
|
1788 | } else if (process.env.NODE_ENV !== 'production') {
|
1789 | warnUnknownProperty(name);
|
1790 | }
|
1791 | return null;
|
1792 | },
|
1793 |
|
1794 | |
1795 |
|
1796 |
|
1797 |
|
1798 |
|
1799 |
|
1800 |
|
1801 | createMarkupForCustomAttribute: function (name, value) {
|
1802 | if (!isAttributeNameSafe(name) || value == null) {
|
1803 | return '';
|
1804 | }
|
1805 | return name + '=' + quoteAttributeValueForBrowser(value);
|
1806 | },
|
1807 |
|
1808 | |
1809 |
|
1810 |
|
1811 |
|
1812 |
|
1813 |
|
1814 |
|
1815 | setValueForProperty: function (node, name, value) {
|
1816 | var propertyInfo = DOMProperty.properties.hasOwnProperty(name) ? DOMProperty.properties[name] : null;
|
1817 | if (propertyInfo) {
|
1818 | var mutationMethod = propertyInfo.mutationMethod;
|
1819 | if (mutationMethod) {
|
1820 | mutationMethod(node, value);
|
1821 | } else if (shouldIgnoreValue(propertyInfo, value)) {
|
1822 | this.deleteValueForProperty(node, name);
|
1823 | } else if (propertyInfo.mustUseAttribute) {
|
1824 | var attributeName = propertyInfo.attributeName;
|
1825 | var namespace = propertyInfo.attributeNamespace;
|
1826 |
|
1827 |
|
1828 | if (namespace) {
|
1829 | node.setAttributeNS(namespace, attributeName, '' + value);
|
1830 | } else if (propertyInfo.hasBooleanValue || propertyInfo.hasOverloadedBooleanValue && value === true) {
|
1831 | node.setAttribute(attributeName, '');
|
1832 | } else {
|
1833 | node.setAttribute(attributeName, '' + value);
|
1834 | }
|
1835 | } else {
|
1836 | var propName = propertyInfo.propertyName;
|
1837 |
|
1838 |
|
1839 | if (!propertyInfo.hasSideEffects || '' + node[propName] !== '' + value) {
|
1840 |
|
1841 |
|
1842 | node[propName] = value;
|
1843 | }
|
1844 | }
|
1845 | } else if (DOMProperty.isCustomAttribute(name)) {
|
1846 | DOMPropertyOperations.setValueForAttribute(node, name, value);
|
1847 | } else if (process.env.NODE_ENV !== 'production') {
|
1848 | warnUnknownProperty(name);
|
1849 | }
|
1850 | },
|
1851 |
|
1852 | setValueForAttribute: function (node, name, value) {
|
1853 | if (!isAttributeNameSafe(name)) {
|
1854 | return;
|
1855 | }
|
1856 | if (value == null) {
|
1857 | node.removeAttribute(name);
|
1858 | } else {
|
1859 | node.setAttribute(name, '' + value);
|
1860 | }
|
1861 | },
|
1862 |
|
1863 | |
1864 |
|
1865 |
|
1866 |
|
1867 |
|
1868 |
|
1869 | deleteValueForProperty: function (node, name) {
|
1870 | var propertyInfo = DOMProperty.properties.hasOwnProperty(name) ? DOMProperty.properties[name] : null;
|
1871 | if (propertyInfo) {
|
1872 | var mutationMethod = propertyInfo.mutationMethod;
|
1873 | if (mutationMethod) {
|
1874 | mutationMethod(node, undefined);
|
1875 | } else if (propertyInfo.mustUseAttribute) {
|
1876 | node.removeAttribute(propertyInfo.attributeName);
|
1877 | } else {
|
1878 | var propName = propertyInfo.propertyName;
|
1879 | var defaultValue = DOMProperty.getDefaultValueForProperty(node.nodeName, propName);
|
1880 | if (!propertyInfo.hasSideEffects || '' + node[propName] !== defaultValue) {
|
1881 | node[propName] = defaultValue;
|
1882 | }
|
1883 | }
|
1884 | } else if (DOMProperty.isCustomAttribute(name)) {
|
1885 | node.removeAttribute(name);
|
1886 | } else if (process.env.NODE_ENV !== 'production') {
|
1887 | warnUnknownProperty(name);
|
1888 | }
|
1889 | }
|
1890 |
|
1891 | };
|
1892 |
|
1893 | ReactPerf.measureMethods(DOMPropertyOperations, 'DOMPropertyOperations', {
|
1894 | setValueForProperty: 'setValueForProperty',
|
1895 | setValueForAttribute: 'setValueForAttribute',
|
1896 | deleteValueForProperty: 'deleteValueForProperty'
|
1897 | });
|
1898 |
|
1899 | module.exports = DOMPropertyOperations;
|
1900 | }.call(exports, __webpack_require__(5)))
|
1901 |
|
1902 | },
|
1903 |
|
1904 | function(module, exports, __webpack_require__) {
|
1905 |
|
1906 | (function(process) { |
1907 |
|
1908 |
|
1909 |
|
1910 |
|
1911 |
|
1912 |
|
1913 |
|
1914 |
|
1915 |
|
1916 |
|
1917 |
|
1918 | 'use strict';
|
1919 |
|
1920 | var invariant = __webpack_require__(14);
|
1921 |
|
1922 | function checkMask(value, bitmask) {
|
1923 | return (value & bitmask) === bitmask;
|
1924 | }
|
1925 |
|
1926 | var DOMPropertyInjection = {
|
1927 | |
1928 |
|
1929 |
|
1930 |
|
1931 | MUST_USE_ATTRIBUTE: 0x1,
|
1932 | MUST_USE_PROPERTY: 0x2,
|
1933 | HAS_SIDE_EFFECTS: 0x4,
|
1934 | HAS_BOOLEAN_VALUE: 0x8,
|
1935 | HAS_NUMERIC_VALUE: 0x10,
|
1936 | HAS_POSITIVE_NUMERIC_VALUE: 0x20 | 0x10,
|
1937 | HAS_OVERLOADED_BOOLEAN_VALUE: 0x40,
|
1938 |
|
1939 | |
1940 |
|
1941 |
|
1942 |
|
1943 |
|
1944 |
|
1945 |
|
1946 |
|
1947 |
|
1948 |
|
1949 |
|
1950 |
|
1951 |
|
1952 |
|
1953 |
|
1954 |
|
1955 |
|
1956 |
|
1957 |
|
1958 |
|
1959 |
|
1960 |
|
1961 |
|
1962 |
|
1963 |
|
1964 |
|
1965 |
|
1966 |
|
1967 | injectDOMPropertyConfig: function (domPropertyConfig) {
|
1968 | var Injection = DOMPropertyInjection;
|
1969 | var Properties = domPropertyConfig.Properties || {};
|
1970 | var DOMAttributeNamespaces = domPropertyConfig.DOMAttributeNamespaces || {};
|
1971 | var DOMAttributeNames = domPropertyConfig.DOMAttributeNames || {};
|
1972 | var DOMPropertyNames = domPropertyConfig.DOMPropertyNames || {};
|
1973 | var DOMMutationMethods = domPropertyConfig.DOMMutationMethods || {};
|
1974 |
|
1975 | if (domPropertyConfig.isCustomAttribute) {
|
1976 | DOMProperty._isCustomAttributeFunctions.push(domPropertyConfig.isCustomAttribute);
|
1977 | }
|
1978 |
|
1979 | for (var propName in Properties) {
|
1980 | !!DOMProperty.properties.hasOwnProperty(propName) ? process.env.NODE_ENV !== 'production' ? invariant(false, 'injectDOMPropertyConfig(...): You\'re trying to inject DOM property ' + '\'%s\' which has already been injected. You may be accidentally ' + 'injecting the same DOM property config twice, or you may be ' + 'injecting two configs that have conflicting property names.', propName) : invariant(false) : undefined;
|
1981 |
|
1982 | var lowerCased = propName.toLowerCase();
|
1983 | var propConfig = Properties[propName];
|
1984 |
|
1985 | var propertyInfo = {
|
1986 | attributeName: lowerCased,
|
1987 | attributeNamespace: null,
|
1988 | propertyName: propName,
|
1989 | mutationMethod: null,
|
1990 |
|
1991 | mustUseAttribute: checkMask(propConfig, Injection.MUST_USE_ATTRIBUTE),
|
1992 | mustUseProperty: checkMask(propConfig, Injection.MUST_USE_PROPERTY),
|
1993 | hasSideEffects: checkMask(propConfig, Injection.HAS_SIDE_EFFECTS),
|
1994 | hasBooleanValue: checkMask(propConfig, Injection.HAS_BOOLEAN_VALUE),
|
1995 | hasNumericValue: checkMask(propConfig, Injection.HAS_NUMERIC_VALUE),
|
1996 | hasPositiveNumericValue: checkMask(propConfig, Injection.HAS_POSITIVE_NUMERIC_VALUE),
|
1997 | hasOverloadedBooleanValue: checkMask(propConfig, Injection.HAS_OVERLOADED_BOOLEAN_VALUE)
|
1998 | };
|
1999 |
|
2000 | !(!propertyInfo.mustUseAttribute || !propertyInfo.mustUseProperty) ? process.env.NODE_ENV !== 'production' ? invariant(false, 'DOMProperty: Cannot require using both attribute and property: %s', propName) : invariant(false) : undefined;
|
2001 | !(propertyInfo.mustUseProperty || !propertyInfo.hasSideEffects) ? process.env.NODE_ENV !== 'production' ? invariant(false, 'DOMProperty: Properties that have side effects must use property: %s', propName) : invariant(false) : undefined;
|
2002 | !(propertyInfo.hasBooleanValue + propertyInfo.hasNumericValue + propertyInfo.hasOverloadedBooleanValue <= 1) ? process.env.NODE_ENV !== 'production' ? invariant(false, 'DOMProperty: Value can be one of boolean, overloaded boolean, or ' + 'numeric value, but not a combination: %s', propName) : invariant(false) : undefined;
|
2003 |
|
2004 | if (process.env.NODE_ENV !== 'production') {
|
2005 | DOMProperty.getPossibleStandardName[lowerCased] = propName;
|
2006 | }
|
2007 |
|
2008 | if (DOMAttributeNames.hasOwnProperty(propName)) {
|
2009 | var attributeName = DOMAttributeNames[propName];
|
2010 | propertyInfo.attributeName = attributeName;
|
2011 | if (process.env.NODE_ENV !== 'production') {
|
2012 | DOMProperty.getPossibleStandardName[attributeName] = propName;
|
2013 | }
|
2014 | }
|
2015 |
|
2016 | if (DOMAttributeNamespaces.hasOwnProperty(propName)) {
|
2017 | propertyInfo.attributeNamespace = DOMAttributeNamespaces[propName];
|
2018 | }
|
2019 |
|
2020 | if (DOMPropertyNames.hasOwnProperty(propName)) {
|
2021 | propertyInfo.propertyName = DOMPropertyNames[propName];
|
2022 | }
|
2023 |
|
2024 | if (DOMMutationMethods.hasOwnProperty(propName)) {
|
2025 | propertyInfo.mutationMethod = DOMMutationMethods[propName];
|
2026 | }
|
2027 |
|
2028 | DOMProperty.properties[propName] = propertyInfo;
|
2029 | }
|
2030 | }
|
2031 | };
|
2032 | var defaultValueCache = {};
|
2033 |
|
2034 | |
2035 |
|
2036 |
|
2037 |
|
2038 |
|
2039 |
|
2040 |
|
2041 |
|
2042 |
|
2043 |
|
2044 |
|
2045 |
|
2046 |
|
2047 | var DOMProperty = {
|
2048 |
|
2049 | ID_ATTRIBUTE_NAME: 'data-reactid',
|
2050 |
|
2051 | |
2052 |
|
2053 |
|
2054 |
|
2055 |
|
2056 |
|
2057 |
|
2058 |
|
2059 |
|
2060 |
|
2061 |
|
2062 |
|
2063 |
|
2064 |
|
2065 |
|
2066 |
|
2067 |
|
2068 |
|
2069 |
|
2070 |
|
2071 |
|
2072 |
|
2073 |
|
2074 |
|
2075 |
|
2076 |
|
2077 |
|
2078 |
|
2079 |
|
2080 |
|
2081 |
|
2082 |
|
2083 |
|
2084 |
|
2085 |
|
2086 |
|
2087 | properties: {},
|
2088 |
|
2089 | |
2090 |
|
2091 |
|
2092 |
|
2093 |
|
2094 | getPossibleStandardName: process.env.NODE_ENV !== 'production' ? {} : null,
|
2095 |
|
2096 | |
2097 |
|
2098 |
|
2099 | _isCustomAttributeFunctions: [],
|
2100 |
|
2101 | |
2102 |
|
2103 |
|
2104 |
|
2105 | isCustomAttribute: function (attributeName) {
|
2106 | for (var i = 0; i < DOMProperty._isCustomAttributeFunctions.length; i++) {
|
2107 | var isCustomAttributeFn = DOMProperty._isCustomAttributeFunctions[i];
|
2108 | if (isCustomAttributeFn(attributeName)) {
|
2109 | return true;
|
2110 | }
|
2111 | }
|
2112 | return false;
|
2113 | },
|
2114 |
|
2115 | |
2116 |
|
2117 |
|
2118 |
|
2119 |
|
2120 |
|
2121 |
|
2122 |
|
2123 | getDefaultValueForProperty: function (nodeName, prop) {
|
2124 | var nodeDefaults = defaultValueCache[nodeName];
|
2125 | var testElement;
|
2126 | if (!nodeDefaults) {
|
2127 | defaultValueCache[nodeName] = nodeDefaults = {};
|
2128 | }
|
2129 | if (!(prop in nodeDefaults)) {
|
2130 | testElement = document.createElement(nodeName);
|
2131 | nodeDefaults[prop] = testElement[prop];
|
2132 | }
|
2133 | return nodeDefaults[prop];
|
2134 | },
|
2135 |
|
2136 | injection: DOMPropertyInjection
|
2137 | };
|
2138 |
|
2139 | module.exports = DOMProperty;
|
2140 | }.call(exports, __webpack_require__(5)))
|
2141 |
|
2142 | },
|
2143 |
|
2144 | function(module, exports, __webpack_require__) {
|
2145 |
|
2146 | |
2147 |
|
2148 |
|
2149 |
|
2150 |
|
2151 |
|
2152 |
|
2153 |
|
2154 |
|
2155 |
|
2156 |
|
2157 | 'use strict';
|
2158 |
|
2159 | var escapeTextContentForBrowser = __webpack_require__(22);
|
2160 |
|
2161 | |
2162 |
|
2163 |
|
2164 |
|
2165 |
|
2166 |
|
2167 | function quoteAttributeValueForBrowser(value) {
|
2168 | return '"' + escapeTextContentForBrowser(value) + '"';
|
2169 | }
|
2170 |
|
2171 | module.exports = quoteAttributeValueForBrowser;
|
2172 |
|
2173 | },
|
2174 |
|
2175 | function(module, exports, __webpack_require__) {
|
2176 |
|
2177 | (function(process) { |
2178 |
|
2179 |
|
2180 |
|
2181 |
|
2182 |
|
2183 |
|
2184 |
|
2185 |
|
2186 |
|
2187 |
|
2188 | 'use strict';
|
2189 |
|
2190 | var emptyFunction = __webpack_require__(16);
|
2191 |
|
2192 | |
2193 |
|
2194 |
|
2195 |
|
2196 |
|
2197 |
|
2198 |
|
2199 | var warning = emptyFunction;
|
2200 |
|
2201 | if (process.env.NODE_ENV !== 'production') {
|
2202 | warning = function (condition, format) {
|
2203 | for (var _len = arguments.length, args = Array(_len > 2 ? _len - 2 : 0), _key = 2; _key < _len; _key++) {
|
2204 | args[_key - 2] = arguments[_key];
|
2205 | }
|
2206 |
|
2207 | if (format === undefined) {
|
2208 | throw new Error('`warning(condition, format, ...args)` requires a warning ' + 'message argument');
|
2209 | }
|
2210 |
|
2211 | if (format.indexOf('Failed Composite propType: ') === 0) {
|
2212 | return;
|
2213 | }
|
2214 |
|
2215 | if (!condition) {
|
2216 | var argIndex = 0;
|
2217 | var message = 'Warning: ' + format.replace(/%s/g, function () {
|
2218 | return args[argIndex++];
|
2219 | });
|
2220 | if (typeof console !== 'undefined') {
|
2221 | console.error(message);
|
2222 | }
|
2223 | try {
|
2224 |
|
2225 |
|
2226 |
|
2227 | throw new Error(message);
|
2228 | } catch (x) {}
|
2229 | }
|
2230 | };
|
2231 | }
|
2232 |
|
2233 | module.exports = warning;
|
2234 | }.call(exports, __webpack_require__(5)))
|
2235 |
|
2236 | },
|
2237 |
|
2238 | function(module, exports, __webpack_require__) {
|
2239 |
|
2240 | |
2241 |
|
2242 |
|
2243 |
|
2244 |
|
2245 |
|
2246 |
|
2247 |
|
2248 |
|
2249 |
|
2250 |
|
2251 | 'use strict';
|
2252 |
|
2253 | var ReactDOMIDOperations = __webpack_require__(28);
|
2254 | var ReactMount = __webpack_require__(29);
|
2255 |
|
2256 | |
2257 |
|
2258 |
|
2259 |
|
2260 |
|
2261 | var ReactComponentBrowserEnvironment = {
|
2262 |
|
2263 | processChildrenUpdates: ReactDOMIDOperations.dangerouslyProcessChildrenUpdates,
|
2264 |
|
2265 | replaceNodeWithMarkupByID: ReactDOMIDOperations.dangerouslyReplaceNodeWithMarkupByID,
|
2266 |
|
2267 | |
2268 |
|
2269 |
|
2270 |
|
2271 |
|
2272 |
|
2273 |
|
2274 | unmountIDFromEnvironment: function (rootNodeID) {
|
2275 | ReactMount.purgeID(rootNodeID);
|
2276 | }
|
2277 |
|
2278 | };
|
2279 |
|
2280 | module.exports = ReactComponentBrowserEnvironment;
|
2281 |
|
2282 | },
|
2283 |
|
2284 | function(module, exports, __webpack_require__) {
|
2285 |
|
2286 | (function(process) { |
2287 |
|
2288 |
|
2289 |
|
2290 |
|
2291 |
|
2292 |
|
2293 |
|
2294 |
|
2295 |
|
2296 |
|
2297 |
|
2298 | 'use strict';
|
2299 |
|
2300 | var DOMChildrenOperations = __webpack_require__(8);
|
2301 | var DOMPropertyOperations = __webpack_require__(23);
|
2302 | var ReactMount = __webpack_require__(29);
|
2303 | var ReactPerf = __webpack_require__(19);
|
2304 |
|
2305 | var invariant = __webpack_require__(14);
|
2306 |
|
2307 | |
2308 |
|
2309 |
|
2310 |
|
2311 |
|
2312 |
|
2313 | var INVALID_PROPERTY_ERRORS = {
|
2314 | dangerouslySetInnerHTML: '`dangerouslySetInnerHTML` must be set using `updateInnerHTMLByID()`.',
|
2315 | style: '`style` must be set using `updateStylesByID()`.'
|
2316 | };
|
2317 |
|
2318 | |
2319 |
|
2320 |
|
2321 | var ReactDOMIDOperations = {
|
2322 |
|
2323 | |
2324 |
|
2325 |
|
2326 |
|
2327 |
|
2328 |
|
2329 |
|
2330 |
|
2331 |
|
2332 | updatePropertyByID: function (id, name, value) {
|
2333 | var node = ReactMount.getNode(id);
|
2334 | !!INVALID_PROPERTY_ERRORS.hasOwnProperty(name) ? process.env.NODE_ENV !== 'production' ? invariant(false, 'updatePropertyByID(...): %s', INVALID_PROPERTY_ERRORS[name]) : invariant(false) : undefined;
|
2335 |
|
2336 |
|
2337 |
|
2338 |
|
2339 | if (value != null) {
|
2340 | DOMPropertyOperations.setValueForProperty(node, name, value);
|
2341 | } else {
|
2342 | DOMPropertyOperations.deleteValueForProperty(node, name);
|
2343 | }
|
2344 | },
|
2345 |
|
2346 | |
2347 |
|
2348 |
|
2349 |
|
2350 |
|
2351 |
|
2352 |
|
2353 |
|
2354 | dangerouslyReplaceNodeWithMarkupByID: function (id, markup) {
|
2355 | var node = ReactMount.getNode(id);
|
2356 | DOMChildrenOperations.dangerouslyReplaceNodeWithMarkup(node, markup);
|
2357 | },
|
2358 |
|
2359 | |
2360 |
|
2361 |
|
2362 |
|
2363 |
|
2364 |
|
2365 |
|
2366 | dangerouslyProcessChildrenUpdates: function (updates, markup) {
|
2367 | for (var i = 0; i < updates.length; i++) {
|
2368 | updates[i].parentNode = ReactMount.getNode(updates[i].parentID);
|
2369 | }
|
2370 | DOMChildrenOperations.processUpdates(updates, markup);
|
2371 | }
|
2372 | };
|
2373 |
|
2374 | ReactPerf.measureMethods(ReactDOMIDOperations, 'ReactDOMIDOperations', {
|
2375 | dangerouslyReplaceNodeWithMarkupByID: 'dangerouslyReplaceNodeWithMarkupByID',
|
2376 | dangerouslyProcessChildrenUpdates: 'dangerouslyProcessChildrenUpdates'
|
2377 | });
|
2378 |
|
2379 | module.exports = ReactDOMIDOperations;
|
2380 | }.call(exports, __webpack_require__(5)))
|
2381 |
|
2382 | },
|
2383 |
|
2384 | function(module, exports, __webpack_require__) {
|
2385 |
|
2386 | (function(process) { |
2387 |
|
2388 |
|
2389 |
|
2390 |
|
2391 |
|
2392 |
|
2393 |
|
2394 |
|
2395 |
|
2396 |
|
2397 | 'use strict';
|
2398 |
|
2399 | var DOMProperty = __webpack_require__(24);
|
2400 | var ReactBrowserEventEmitter = __webpack_require__(30);
|
2401 | var ReactCurrentOwner = __webpack_require__(6);
|
2402 | var ReactDOMFeatureFlags = __webpack_require__(42);
|
2403 | var ReactElement = __webpack_require__(43);
|
2404 | var ReactEmptyComponentRegistry = __webpack_require__(45);
|
2405 | var ReactInstanceHandles = __webpack_require__(46);
|
2406 | var ReactInstanceMap = __webpack_require__(48);
|
2407 | var ReactMarkupChecksum = __webpack_require__(49);
|
2408 | var ReactPerf = __webpack_require__(19);
|
2409 | var ReactReconciler = __webpack_require__(51);
|
2410 | var ReactUpdateQueue = __webpack_require__(54);
|
2411 | var ReactUpdates = __webpack_require__(55);
|
2412 |
|
2413 | var assign = __webpack_require__(40);
|
2414 | var emptyObject = __webpack_require__(59);
|
2415 | var containsNode = __webpack_require__(60);
|
2416 | var instantiateReactComponent = __webpack_require__(63);
|
2417 | var invariant = __webpack_require__(14);
|
2418 | var setInnerHTML = __webpack_require__(20);
|
2419 | var shouldUpdateReactComponent = __webpack_require__(68);
|
2420 | var validateDOMNesting = __webpack_require__(71);
|
2421 | var warning = __webpack_require__(26);
|
2422 |
|
2423 | var ATTR_NAME = DOMProperty.ID_ATTRIBUTE_NAME;
|
2424 | var nodeCache = {};
|
2425 |
|
2426 | var ELEMENT_NODE_TYPE = 1;
|
2427 | var DOC_NODE_TYPE = 9;
|
2428 | var DOCUMENT_FRAGMENT_NODE_TYPE = 11;
|
2429 |
|
2430 | var ownerDocumentContextKey = '__ReactMount_ownerDocument$' + Math.random().toString(36).slice(2);
|
2431 |
|
2432 |
|
2433 | var instancesByReactRootID = {};
|
2434 |
|
2435 |
|
2436 | var containersByReactRootID = {};
|
2437 |
|
2438 | if (process.env.NODE_ENV !== 'production') {
|
2439 |
|
2440 | var rootElementsByReactRootID = {};
|
2441 | }
|
2442 |
|
2443 |
|
2444 | var findComponentRootReusableArray = [];
|
2445 |
|
2446 | |
2447 |
|
2448 |
|
2449 |
|
2450 |
|
2451 |
|
2452 | function firstDifferenceIndex(string1, string2) {
|
2453 | var minLen = Math.min(string1.length, string2.length);
|
2454 | for (var i = 0; i < minLen; i++) {
|
2455 | if (string1.charAt(i) !== string2.charAt(i)) {
|
2456 | return i;
|
2457 | }
|
2458 | }
|
2459 | return string1.length === string2.length ? -1 : minLen;
|
2460 | }
|
2461 |
|
2462 | |
2463 |
|
2464 |
|
2465 |
|
2466 |
|
2467 | function getReactRootElementInContainer(container) {
|
2468 | if (!container) {
|
2469 | return null;
|
2470 | }
|
2471 |
|
2472 | if (container.nodeType === DOC_NODE_TYPE) {
|
2473 | return container.documentElement;
|
2474 | } else {
|
2475 | return container.firstChild;
|
2476 | }
|
2477 | }
|
2478 |
|
2479 | |
2480 |
|
2481 |
|
2482 |
|
2483 | function getReactRootID(container) {
|
2484 | var rootElement = getReactRootElementInContainer(container);
|
2485 | return rootElement && ReactMount.getID(rootElement);
|
2486 | }
|
2487 |
|
2488 | |
2489 |
|
2490 |
|
2491 |
|
2492 |
|
2493 |
|
2494 |
|
2495 |
|
2496 |
|
2497 |
|
2498 | function getID(node) {
|
2499 | var id = internalGetID(node);
|
2500 | if (id) {
|
2501 | if (nodeCache.hasOwnProperty(id)) {
|
2502 | var cached = nodeCache[id];
|
2503 | if (cached !== node) {
|
2504 | !!isValid(cached, id) ? process.env.NODE_ENV !== 'production' ? invariant(false, 'ReactMount: Two valid but unequal nodes with the same `%s`: %s', ATTR_NAME, id) : invariant(false) : undefined;
|
2505 |
|
2506 | nodeCache[id] = node;
|
2507 | }
|
2508 | } else {
|
2509 | nodeCache[id] = node;
|
2510 | }
|
2511 | }
|
2512 |
|
2513 | return id;
|
2514 | }
|
2515 |
|
2516 | function internalGetID(node) {
|
2517 |
|
2518 |
|
2519 |
|
2520 | return node && node.getAttribute && node.getAttribute(ATTR_NAME) || '';
|
2521 | }
|
2522 |
|
2523 | |
2524 |
|
2525 |
|
2526 |
|
2527 |
|
2528 |
|
2529 | function setID(node, id) {
|
2530 | var oldID = internalGetID(node);
|
2531 | if (oldID !== id) {
|
2532 | delete nodeCache[oldID];
|
2533 | }
|
2534 | node.setAttribute(ATTR_NAME, id);
|
2535 | nodeCache[id] = node;
|
2536 | }
|
2537 |
|
2538 | |
2539 |
|
2540 |
|
2541 |
|
2542 |
|
2543 |
|
2544 |
|
2545 | function getNode(id) {
|
2546 | if (!nodeCache.hasOwnProperty(id) || !isValid(nodeCache[id], id)) {
|
2547 | nodeCache[id] = ReactMount.findReactNodeByID(id);
|
2548 | }
|
2549 | return nodeCache[id];
|
2550 | }
|
2551 |
|
2552 | |
2553 |
|
2554 |
|
2555 |
|
2556 |
|
2557 |
|
2558 |
|
2559 | function getNodeFromInstance(instance) {
|
2560 | var id = ReactInstanceMap.get(instance)._rootNodeID;
|
2561 | if (ReactEmptyComponentRegistry.isNullComponentID(id)) {
|
2562 | return null;
|
2563 | }
|
2564 | if (!nodeCache.hasOwnProperty(id) || !isValid(nodeCache[id], id)) {
|
2565 | nodeCache[id] = ReactMount.findReactNodeByID(id);
|
2566 | }
|
2567 | return nodeCache[id];
|
2568 | }
|
2569 |
|
2570 | |
2571 |
|
2572 |
|
2573 |
|
2574 |
|
2575 |
|
2576 |
|
2577 |
|
2578 |
|
2579 |
|
2580 | function isValid(node, id) {
|
2581 | if (node) {
|
2582 | !(internalGetID(node) === id) ? process.env.NODE_ENV !== 'production' ? invariant(false, 'ReactMount: Unexpected modification of `%s`', ATTR_NAME) : invariant(false) : undefined;
|
2583 |
|
2584 | var container = ReactMount.findReactContainerForID(id);
|
2585 | if (container && containsNode(container, node)) {
|
2586 | return true;
|
2587 | }
|
2588 | }
|
2589 |
|
2590 | return false;
|
2591 | }
|
2592 |
|
2593 | |
2594 |
|
2595 |
|
2596 |
|
2597 |
|
2598 | function purgeID(id) {
|
2599 | delete nodeCache[id];
|
2600 | }
|
2601 |
|
2602 | var deepestNodeSoFar = null;
|
2603 | function findDeepestCachedAncestorImpl(ancestorID) {
|
2604 | var ancestor = nodeCache[ancestorID];
|
2605 | if (ancestor && isValid(ancestor, ancestorID)) {
|
2606 | deepestNodeSoFar = ancestor;
|
2607 | } else {
|
2608 |
|
2609 |
|
2610 | return false;
|
2611 | }
|
2612 | }
|
2613 |
|
2614 | |
2615 |
|
2616 |
|
2617 | function findDeepestCachedAncestor(targetID) {
|
2618 | deepestNodeSoFar = null;
|
2619 | ReactInstanceHandles.traverseAncestors(targetID, findDeepestCachedAncestorImpl);
|
2620 |
|
2621 | var foundNode = deepestNodeSoFar;
|
2622 | deepestNodeSoFar = null;
|
2623 | return foundNode;
|
2624 | }
|
2625 |
|
2626 | |
2627 |
|
2628 |
|
2629 |
|
2630 |
|
2631 |
|
2632 |
|
2633 |
|
2634 |
|
2635 | function mountComponentIntoNode(componentInstance, rootID, container, transaction, shouldReuseMarkup, context) {
|
2636 | if (ReactDOMFeatureFlags.useCreateElement) {
|
2637 | context = assign({}, context);
|
2638 | if (container.nodeType === DOC_NODE_TYPE) {
|
2639 | context[ownerDocumentContextKey] = container;
|
2640 | } else {
|
2641 | context[ownerDocumentContextKey] = container.ownerDocument;
|
2642 | }
|
2643 | }
|
2644 | if (process.env.NODE_ENV !== 'production') {
|
2645 | if (context === emptyObject) {
|
2646 | context = {};
|
2647 | }
|
2648 | var tag = container.nodeName.toLowerCase();
|
2649 | context[validateDOMNesting.ancestorInfoContextKey] = validateDOMNesting.updatedAncestorInfo(null, tag, null);
|
2650 | }
|
2651 | var markup = ReactReconciler.mountComponent(componentInstance, rootID, transaction, context);
|
2652 | componentInstance._renderedComponent._topLevelWrapper = componentInstance;
|
2653 | ReactMount._mountImageIntoNode(markup, container, shouldReuseMarkup, transaction);
|
2654 | }
|
2655 |
|
2656 | |
2657 |
|
2658 |
|
2659 |
|
2660 |
|
2661 |
|
2662 |
|
2663 |
|
2664 | function batchedMountComponentIntoNode(componentInstance, rootID, container, shouldReuseMarkup, context) {
|
2665 | var transaction = ReactUpdates.ReactReconcileTransaction.getPooled(
|
2666 | shouldReuseMarkup);
|
2667 | transaction.perform(mountComponentIntoNode, null, componentInstance, rootID, container, transaction, shouldReuseMarkup, context);
|
2668 | ReactUpdates.ReactReconcileTransaction.release(transaction);
|
2669 | }
|
2670 |
|
2671 | |
2672 |
|
2673 |
|
2674 |
|
2675 |
|
2676 |
|
2677 |
|
2678 |
|
2679 |
|
2680 | function unmountComponentFromNode(instance, container) {
|
2681 | ReactReconciler.unmountComponent(instance);
|
2682 |
|
2683 | if (container.nodeType === DOC_NODE_TYPE) {
|
2684 | container = container.documentElement;
|
2685 | }
|
2686 |
|
2687 |
|
2688 | while (container.lastChild) {
|
2689 | container.removeChild(container.lastChild);
|
2690 | }
|
2691 | }
|
2692 |
|
2693 | |
2694 |
|
2695 |
|
2696 |
|
2697 |
|
2698 |
|
2699 |
|
2700 |
|
2701 |
|
2702 |
|
2703 | function hasNonRootReactChild(node) {
|
2704 | var reactRootID = getReactRootID(node);
|
2705 | return reactRootID ? reactRootID !== ReactInstanceHandles.getReactRootIDFromNodeID(reactRootID) : false;
|
2706 | }
|
2707 |
|
2708 | |
2709 |
|
2710 |
|
2711 |
|
2712 | function findFirstReactDOMImpl(node) {
|
2713 |
|
2714 |
|
2715 | for (; node && node.parentNode !== node; node = node.parentNode) {
|
2716 | if (node.nodeType !== 1) {
|
2717 |
|
2718 | continue;
|
2719 | }
|
2720 | var nodeID = internalGetID(node);
|
2721 | if (!nodeID) {
|
2722 | continue;
|
2723 | }
|
2724 | var reactRootID = ReactInstanceHandles.getReactRootIDFromNodeID(nodeID);
|
2725 |
|
2726 |
|
2727 |
|
2728 |
|
2729 |
|
2730 | var current = node;
|
2731 | var lastID;
|
2732 | do {
|
2733 | lastID = internalGetID(current);
|
2734 | current = current.parentNode;
|
2735 | if (current == null) {
|
2736 |
|
2737 |
|
2738 | return null;
|
2739 | }
|
2740 | } while (lastID !== reactRootID);
|
2741 |
|
2742 | if (current === containersByReactRootID[reactRootID]) {
|
2743 | return node;
|
2744 | }
|
2745 | }
|
2746 | return null;
|
2747 | }
|
2748 |
|
2749 | |
2750 |
|
2751 |
|
2752 |
|
2753 |
|
2754 | var TopLevelWrapper = function () {};
|
2755 | TopLevelWrapper.prototype.isReactComponent = {};
|
2756 | if (process.env.NODE_ENV !== 'production') {
|
2757 | TopLevelWrapper.displayName = 'TopLevelWrapper';
|
2758 | }
|
2759 | TopLevelWrapper.prototype.render = function () {
|
2760 |
|
2761 | return this.props;
|
2762 | };
|
2763 |
|
2764 | |
2765 |
|
2766 |
|
2767 |
|
2768 |
|
2769 |
|
2770 |
|
2771 |
|
2772 |
|
2773 |
|
2774 |
|
2775 |
|
2776 |
|
2777 |
|
2778 |
|
2779 |
|
2780 |
|
2781 |
|
2782 | var ReactMount = {
|
2783 |
|
2784 | TopLevelWrapper: TopLevelWrapper,
|
2785 |
|
2786 |
|
2787 | _instancesByReactRootID: instancesByReactRootID,
|
2788 |
|
2789 | |
2790 |
|
2791 |
|
2792 |
|
2793 |
|
2794 |
|
2795 |
|
2796 |
|
2797 | scrollMonitor: function (container, renderCallback) {
|
2798 | renderCallback();
|
2799 | },
|
2800 |
|
2801 | |
2802 |
|
2803 |
|
2804 |
|
2805 |
|
2806 |
|
2807 |
|
2808 | _updateRootComponent: function (prevComponent, nextElement, container, callback) {
|
2809 | ReactMount.scrollMonitor(container, function () {
|
2810 | ReactUpdateQueue.enqueueElementInternal(prevComponent, nextElement);
|
2811 | if (callback) {
|
2812 | ReactUpdateQueue.enqueueCallbackInternal(prevComponent, callback);
|
2813 | }
|
2814 | });
|
2815 |
|
2816 | if (process.env.NODE_ENV !== 'production') {
|
2817 |
|
2818 | rootElementsByReactRootID[getReactRootID(container)] = getReactRootElementInContainer(container);
|
2819 | }
|
2820 |
|
2821 | return prevComponent;
|
2822 | },
|
2823 |
|
2824 | |
2825 |
|
2826 |
|
2827 |
|
2828 |
|
2829 |
|
2830 |
|
2831 | _registerComponent: function (nextComponent, container) {
|
2832 | !(container && (container.nodeType === ELEMENT_NODE_TYPE || container.nodeType === DOC_NODE_TYPE || container.nodeType === DOCUMENT_FRAGMENT_NODE_TYPE)) ? process.env.NODE_ENV !== 'production' ? invariant(false, '_registerComponent(...): Target container is not a DOM element.') : invariant(false) : undefined;
|
2833 |
|
2834 | ReactBrowserEventEmitter.ensureScrollValueMonitoring();
|
2835 |
|
2836 | var reactRootID = ReactMount.registerContainer(container);
|
2837 | instancesByReactRootID[reactRootID] = nextComponent;
|
2838 | return reactRootID;
|
2839 | },
|
2840 |
|
2841 | |
2842 |
|
2843 |
|
2844 |
|
2845 |
|
2846 |
|
2847 |
|
2848 | _renderNewRootComponent: function (nextElement, container, shouldReuseMarkup, context) {
|
2849 |
|
2850 |
|
2851 |
|
2852 | process.env.NODE_ENV !== 'production' ? warning(ReactCurrentOwner.current == null, '_renderNewRootComponent(): Render methods should be a pure function ' + 'of props and state; triggering nested component updates from ' + 'render is not allowed. If necessary, trigger nested updates in ' + 'componentDidUpdate. Check the render method of %s.', ReactCurrentOwner.current && ReactCurrentOwner.current.getName() || 'ReactCompositeComponent') : undefined;
|
2853 |
|
2854 | var componentInstance = instantiateReactComponent(nextElement, null);
|
2855 | var reactRootID = ReactMount._registerComponent(componentInstance, container);
|
2856 |
|
2857 |
|
2858 |
|
2859 |
|
2860 |
|
2861 | ReactUpdates.batchedUpdates(batchedMountComponentIntoNode, componentInstance, reactRootID, container, shouldReuseMarkup, context);
|
2862 |
|
2863 | if (process.env.NODE_ENV !== 'production') {
|
2864 |
|
2865 | rootElementsByReactRootID[reactRootID] = getReactRootElementInContainer(container);
|
2866 | }
|
2867 |
|
2868 | return componentInstance;
|
2869 | },
|
2870 |
|
2871 | |
2872 |
|
2873 |
|
2874 |
|
2875 |
|
2876 |
|
2877 |
|
2878 |
|
2879 |
|
2880 |
|
2881 |
|
2882 |
|
2883 |
|
2884 | renderSubtreeIntoContainer: function (parentComponent, nextElement, container, callback) {
|
2885 | !(parentComponent != null && parentComponent._reactInternalInstance != null) ? process.env.NODE_ENV !== 'production' ? invariant(false, 'parentComponent must be a valid React Component') : invariant(false) : undefined;
|
2886 | return ReactMount._renderSubtreeIntoContainer(parentComponent, nextElement, container, callback);
|
2887 | },
|
2888 |
|
2889 | _renderSubtreeIntoContainer: function (parentComponent, nextElement, container, callback) {
|
2890 | !ReactElement.isValidElement(nextElement) ? process.env.NODE_ENV !== 'production' ? invariant(false, 'ReactDOM.render(): Invalid component element.%s', typeof nextElement === 'string' ? ' Instead of passing an element string, make sure to instantiate ' + 'it by passing it to React.createElement.' : typeof nextElement === 'function' ? ' Instead of passing a component class, make sure to instantiate ' + 'it by passing it to React.createElement.' :
|
2891 |
|
2892 | nextElement != null && nextElement.props !== undefined ? ' This may be caused by unintentionally loading two independent ' + 'copies of React.' : '') : invariant(false) : undefined;
|
2893 |
|
2894 | process.env.NODE_ENV !== 'production' ? warning(!container || !container.tagName || container.tagName.toUpperCase() !== 'BODY', 'render(): Rendering components directly into document.body is ' + 'discouraged, since its children are often manipulated by third-party ' + 'scripts and browser extensions. This may lead to subtle ' + 'reconciliation issues. Try rendering into a container element created ' + 'for your app.') : undefined;
|
2895 |
|
2896 | var nextWrappedElement = new ReactElement(TopLevelWrapper, null, null, null, null, null, nextElement);
|
2897 |
|
2898 | var prevComponent = instancesByReactRootID[getReactRootID(container)];
|
2899 |
|
2900 | if (prevComponent) {
|
2901 | var prevWrappedElement = prevComponent._currentElement;
|
2902 | var prevElement = prevWrappedElement.props;
|
2903 | if (shouldUpdateReactComponent(prevElement, nextElement)) {
|
2904 | var publicInst = prevComponent._renderedComponent.getPublicInstance();
|
2905 | var updatedCallback = callback && function () {
|
2906 | callback.call(publicInst);
|
2907 | };
|
2908 | ReactMount._updateRootComponent(prevComponent, nextWrappedElement, container, updatedCallback);
|
2909 | return publicInst;
|
2910 | } else {
|
2911 | ReactMount.unmountComponentAtNode(container);
|
2912 | }
|
2913 | }
|
2914 |
|
2915 | var reactRootElement = getReactRootElementInContainer(container);
|
2916 | var containerHasReactMarkup = reactRootElement && !!internalGetID(reactRootElement);
|
2917 | var containerHasNonRootReactChild = hasNonRootReactChild(container);
|
2918 |
|
2919 | if (process.env.NODE_ENV !== 'production') {
|
2920 | process.env.NODE_ENV !== 'production' ? warning(!containerHasNonRootReactChild, 'render(...): Replacing React-rendered children with a new root ' + 'component. If you intended to update the children of this node, ' + 'you should instead have the existing children update their state ' + 'and render the new components instead of calling ReactDOM.render.') : undefined;
|
2921 |
|
2922 | if (!containerHasReactMarkup || reactRootElement.nextSibling) {
|
2923 | var rootElementSibling = reactRootElement;
|
2924 | while (rootElementSibling) {
|
2925 | if (internalGetID(rootElementSibling)) {
|
2926 | process.env.NODE_ENV !== 'production' ? warning(false, 'render(): Target node has markup rendered by React, but there ' + 'are unrelated nodes as well. This is most commonly caused by ' + 'white-space inserted around server-rendered markup.') : undefined;
|
2927 | break;
|
2928 | }
|
2929 | rootElementSibling = rootElementSibling.nextSibling;
|
2930 | }
|
2931 | }
|
2932 | }
|
2933 |
|
2934 | var shouldReuseMarkup = containerHasReactMarkup && !prevComponent && !containerHasNonRootReactChild;
|
2935 | var component = ReactMount._renderNewRootComponent(nextWrappedElement, container, shouldReuseMarkup, parentComponent != null ? parentComponent._reactInternalInstance._processChildContext(parentComponent._reactInternalInstance._context) : emptyObject)._renderedComponent.getPublicInstance();
|
2936 | if (callback) {
|
2937 | callback.call(component);
|
2938 | }
|
2939 | return component;
|
2940 | },
|
2941 |
|
2942 | |
2943 |
|
2944 |
|
2945 |
|
2946 |
|
2947 |
|
2948 |
|
2949 |
|
2950 |
|
2951 |
|
2952 |
|
2953 |
|
2954 | render: function (nextElement, container, callback) {
|
2955 | return ReactMount._renderSubtreeIntoContainer(null, nextElement, container, callback);
|
2956 | },
|
2957 |
|
2958 | |
2959 |
|
2960 |
|
2961 |
|
2962 |
|
2963 |
|
2964 |
|
2965 |
|
2966 | registerContainer: function (container) {
|
2967 | var reactRootID = getReactRootID(container);
|
2968 | if (reactRootID) {
|
2969 |
|
2970 | reactRootID = ReactInstanceHandles.getReactRootIDFromNodeID(reactRootID);
|
2971 | }
|
2972 | if (!reactRootID) {
|
2973 |
|
2974 | reactRootID = ReactInstanceHandles.createReactRootID();
|
2975 | }
|
2976 | containersByReactRootID[reactRootID] = container;
|
2977 | return reactRootID;
|
2978 | },
|
2979 |
|
2980 | |
2981 |
|
2982 |
|
2983 |
|
2984 |
|
2985 |
|
2986 |
|
2987 | unmountComponentAtNode: function (container) {
|
2988 |
|
2989 |
|
2990 |
|
2991 |
|
2992 | process.env.NODE_ENV !== 'production' ? warning(ReactCurrentOwner.current == null, 'unmountComponentAtNode(): Render methods should be a pure function ' + 'of props and state; triggering nested component updates from render ' + 'is not allowed. If necessary, trigger nested updates in ' + 'componentDidUpdate. Check the render method of %s.', ReactCurrentOwner.current && ReactCurrentOwner.current.getName() || 'ReactCompositeComponent') : undefined;
|
2993 |
|
2994 | !(container && (container.nodeType === ELEMENT_NODE_TYPE || container.nodeType === DOC_NODE_TYPE || container.nodeType === DOCUMENT_FRAGMENT_NODE_TYPE)) ? process.env.NODE_ENV !== 'production' ? invariant(false, 'unmountComponentAtNode(...): Target container is not a DOM element.') : invariant(false) : undefined;
|
2995 |
|
2996 | var reactRootID = getReactRootID(container);
|
2997 | var component = instancesByReactRootID[reactRootID];
|
2998 | if (!component) {
|
2999 |
|
3000 |
|
3001 | var containerHasNonRootReactChild = hasNonRootReactChild(container);
|
3002 |
|
3003 |
|
3004 | var containerID = internalGetID(container);
|
3005 | var isContainerReactRoot = containerID && containerID === ReactInstanceHandles.getReactRootIDFromNodeID(containerID);
|
3006 |
|
3007 | if (process.env.NODE_ENV !== 'production') {
|
3008 | process.env.NODE_ENV !== 'production' ? warning(!containerHasNonRootReactChild, 'unmountComponentAtNode(): The node you\'re attempting to unmount ' + 'was rendered by React and is not a top-level container. %s', isContainerReactRoot ? 'You may have accidentally passed in a React root node instead ' + 'of its container.' : 'Instead, have the parent component update its state and ' + 'rerender in order to remove this component.') : undefined;
|
3009 | }
|
3010 |
|
3011 | return false;
|
3012 | }
|
3013 | ReactUpdates.batchedUpdates(unmountComponentFromNode, component, container);
|
3014 | delete instancesByReactRootID[reactRootID];
|
3015 | delete containersByReactRootID[reactRootID];
|
3016 | if (process.env.NODE_ENV !== 'production') {
|
3017 | delete rootElementsByReactRootID[reactRootID];
|
3018 | }
|
3019 | return true;
|
3020 | },
|
3021 |
|
3022 | |
3023 |
|
3024 |
|
3025 |
|
3026 |
|
3027 |
|
3028 |
|
3029 | findReactContainerForID: function (id) {
|
3030 | var reactRootID = ReactInstanceHandles.getReactRootIDFromNodeID(id);
|
3031 | var container = containersByReactRootID[reactRootID];
|
3032 |
|
3033 | if (process.env.NODE_ENV !== 'production') {
|
3034 | var rootElement = rootElementsByReactRootID[reactRootID];
|
3035 | if (rootElement && rootElement.parentNode !== container) {
|
3036 | process.env.NODE_ENV !== 'production' ? warning(
|
3037 |
|
3038 |
|
3039 | internalGetID(rootElement) === reactRootID, 'ReactMount: Root element ID differed from reactRootID.') : undefined;
|
3040 | var containerChild = container.firstChild;
|
3041 | if (containerChild && reactRootID === internalGetID(containerChild)) {
|
3042 |
|
3043 |
|
3044 |
|
3045 |
|
3046 | rootElementsByReactRootID[reactRootID] = containerChild;
|
3047 | } else {
|
3048 | process.env.NODE_ENV !== 'production' ? warning(false, 'ReactMount: Root element has been removed from its original ' + 'container. New container: %s', rootElement.parentNode) : undefined;
|
3049 | }
|
3050 | }
|
3051 | }
|
3052 |
|
3053 | return container;
|
3054 | },
|
3055 |
|
3056 | |
3057 |
|
3058 |
|
3059 |
|
3060 |
|
3061 |
|
3062 | findReactNodeByID: function (id) {
|
3063 | var reactRoot = ReactMount.findReactContainerForID(id);
|
3064 | return ReactMount.findComponentRoot(reactRoot, id);
|
3065 | },
|
3066 |
|
3067 | |
3068 |
|
3069 |
|
3070 |
|
3071 |
|
3072 |
|
3073 |
|
3074 |
|
3075 | getFirstReactDOM: function (node) {
|
3076 | return findFirstReactDOMImpl(node);
|
3077 | },
|
3078 |
|
3079 | |
3080 |
|
3081 |
|
3082 |
|
3083 |
|
3084 |
|
3085 |
|
3086 |
|
3087 |
|
3088 |
|
3089 | findComponentRoot: function (ancestorNode, targetID) {
|
3090 | var firstChildren = findComponentRootReusableArray;
|
3091 | var childIndex = 0;
|
3092 |
|
3093 | var deepestAncestor = findDeepestCachedAncestor(targetID) || ancestorNode;
|
3094 |
|
3095 | if (process.env.NODE_ENV !== 'production') {
|
3096 |
|
3097 | process.env.NODE_ENV !== 'production' ? warning(deepestAncestor != null, 'React can\'t find the root component node for data-reactid value ' + '`%s`. If you\'re seeing this message, it probably means that ' + 'you\'ve loaded two copies of React on the page. At this time, only ' + 'a single copy of React can be loaded at a time.', targetID) : undefined;
|
3098 | }
|
3099 |
|
3100 | firstChildren[0] = deepestAncestor.firstChild;
|
3101 | firstChildren.length = 1;
|
3102 |
|
3103 | while (childIndex < firstChildren.length) {
|
3104 | var child = firstChildren[childIndex++];
|
3105 | var targetChild;
|
3106 |
|
3107 | while (child) {
|
3108 | var childID = ReactMount.getID(child);
|
3109 | if (childID) {
|
3110 |
|
3111 |
|
3112 |
|
3113 |
|
3114 |
|
3115 | if (targetID === childID) {
|
3116 | targetChild = child;
|
3117 | } else if (ReactInstanceHandles.isAncestorIDOf(childID, targetID)) {
|
3118 |
|
3119 |
|
3120 |
|
3121 |
|
3122 | firstChildren.length = childIndex = 0;
|
3123 | firstChildren.push(child.firstChild);
|
3124 | }
|
3125 | } else {
|
3126 |
|
3127 |
|
3128 |
|
3129 |
|
3130 |
|
3131 | firstChildren.push(child.firstChild);
|
3132 | }
|
3133 |
|
3134 | child = child.nextSibling;
|
3135 | }
|
3136 |
|
3137 | if (targetChild) {
|
3138 |
|
3139 |
|
3140 |
|
3141 | firstChildren.length = 0;
|
3142 |
|
3143 | return targetChild;
|
3144 | }
|
3145 | }
|
3146 |
|
3147 | firstChildren.length = 0;
|
3148 |
|
3149 | true ? process.env.NODE_ENV !== 'production' ? invariant(false, 'findComponentRoot(..., %s): Unable to find element. This probably ' + 'means the DOM was unexpectedly mutated (e.g., by the browser), ' + 'usually due to forgetting a <tbody> when using tables, nesting tags ' + 'like <form>, <p>, or <a>, or using non-SVG elements in an <svg> ' + 'parent. ' + 'Try inspecting the child nodes of the element with React ID `%s`.', targetID, ReactMount.getID(ancestorNode)) : invariant(false) : undefined;
|
3150 | },
|
3151 |
|
3152 | _mountImageIntoNode: function (markup, container, shouldReuseMarkup, transaction) {
|
3153 | !(container && (container.nodeType === ELEMENT_NODE_TYPE || container.nodeType === DOC_NODE_TYPE || container.nodeType === DOCUMENT_FRAGMENT_NODE_TYPE)) ? process.env.NODE_ENV !== 'production' ? invariant(false, 'mountComponentIntoNode(...): Target container is not valid.') : invariant(false) : undefined;
|
3154 |
|
3155 | if (shouldReuseMarkup) {
|
3156 | var rootElement = getReactRootElementInContainer(container);
|
3157 | if (ReactMarkupChecksum.canReuseMarkup(markup, rootElement)) {
|
3158 | return;
|
3159 | } else {
|
3160 | var checksum = rootElement.getAttribute(ReactMarkupChecksum.CHECKSUM_ATTR_NAME);
|
3161 | rootElement.removeAttribute(ReactMarkupChecksum.CHECKSUM_ATTR_NAME);
|
3162 |
|
3163 | var rootMarkup = rootElement.outerHTML;
|
3164 | rootElement.setAttribute(ReactMarkupChecksum.CHECKSUM_ATTR_NAME, checksum);
|
3165 |
|
3166 | var normalizedMarkup = markup;
|
3167 | if (process.env.NODE_ENV !== 'production') {
|
3168 |
|
3169 |
|
3170 |
|
3171 |
|
3172 | var normalizer;
|
3173 | if (container.nodeType === ELEMENT_NODE_TYPE) {
|
3174 | normalizer = document.createElement('div');
|
3175 | normalizer.innerHTML = markup;
|
3176 | normalizedMarkup = normalizer.innerHTML;
|
3177 | } else {
|
3178 | normalizer = document.createElement('iframe');
|
3179 | document.body.appendChild(normalizer);
|
3180 | normalizer.contentDocument.write(markup);
|
3181 | normalizedMarkup = normalizer.contentDocument.documentElement.outerHTML;
|
3182 | document.body.removeChild(normalizer);
|
3183 | }
|
3184 | }
|
3185 |
|
3186 | var diffIndex = firstDifferenceIndex(normalizedMarkup, rootMarkup);
|
3187 | var difference = ' (client) ' + normalizedMarkup.substring(diffIndex - 20, diffIndex + 20) + '\n (server) ' + rootMarkup.substring(diffIndex - 20, diffIndex + 20);
|
3188 |
|
3189 | !(container.nodeType !== DOC_NODE_TYPE) ? process.env.NODE_ENV !== 'production' ? invariant(false, 'You\'re trying to render a component to the document using ' + 'server rendering but the checksum was invalid. This usually ' + 'means you rendered a different component type or props on ' + 'the client from the one on the server, or your render() ' + 'methods are impure. React cannot handle this case due to ' + 'cross-browser quirks by rendering at the document root. You ' + 'should look for environment dependent code in your components ' + 'and ensure the props are the same client and server side:\n%s', difference) : invariant(false) : undefined;
|
3190 |
|
3191 | if (process.env.NODE_ENV !== 'production') {
|
3192 | process.env.NODE_ENV !== 'production' ? warning(false, 'React attempted to reuse markup in a container but the ' + 'checksum was invalid. This generally means that you are ' + 'using server rendering and the markup generated on the ' + 'server was not what the client was expecting. React injected ' + 'new markup to compensate which works but you have lost many ' + 'of the benefits of server rendering. Instead, figure out ' + 'why the markup being generated is different on the client ' + 'or server:\n%s', difference) : undefined;
|
3193 | }
|
3194 | }
|
3195 | }
|
3196 |
|
3197 | !(container.nodeType !== DOC_NODE_TYPE) ? process.env.NODE_ENV !== 'production' ? invariant(false, 'You\'re trying to render a component to the document but ' + 'you didn\'t use server rendering. We can\'t do this ' + 'without using server rendering due to cross-browser quirks. ' + 'See ReactDOMServer.renderToString() for server rendering.') : invariant(false) : undefined;
|
3198 |
|
3199 | if (transaction.useCreateElement) {
|
3200 | while (container.lastChild) {
|
3201 | container.removeChild(container.lastChild);
|
3202 | }
|
3203 | container.appendChild(markup);
|
3204 | } else {
|
3205 | setInnerHTML(container, markup);
|
3206 | }
|
3207 | },
|
3208 |
|
3209 | ownerDocumentContextKey: ownerDocumentContextKey,
|
3210 |
|
3211 | |
3212 |
|
3213 |
|
3214 |
|
3215 | getReactRootID: getReactRootID,
|
3216 |
|
3217 | getID: getID,
|
3218 |
|
3219 | setID: setID,
|
3220 |
|
3221 | getNode: getNode,
|
3222 |
|
3223 | getNodeFromInstance: getNodeFromInstance,
|
3224 |
|
3225 | isValid: isValid,
|
3226 |
|
3227 | purgeID: purgeID
|
3228 | };
|
3229 |
|
3230 | ReactPerf.measureMethods(ReactMount, 'ReactMount', {
|
3231 | _renderNewRootComponent: '_renderNewRootComponent',
|
3232 | _mountImageIntoNode: '_mountImageIntoNode'
|
3233 | });
|
3234 |
|
3235 | module.exports = ReactMount;
|
3236 | }.call(exports, __webpack_require__(5)))
|
3237 |
|
3238 | },
|
3239 |
|
3240 | function(module, exports, __webpack_require__) {
|
3241 |
|
3242 | |
3243 |
|
3244 |
|
3245 |
|
3246 |
|
3247 |
|
3248 |
|
3249 |
|
3250 |
|
3251 |
|
3252 |
|
3253 |
|
3254 | 'use strict';
|
3255 |
|
3256 | var EventConstants = __webpack_require__(31);
|
3257 | var EventPluginHub = __webpack_require__(32);
|
3258 | var EventPluginRegistry = __webpack_require__(33);
|
3259 | var ReactEventEmitterMixin = __webpack_require__(38);
|
3260 | var ReactPerf = __webpack_require__(19);
|
3261 | var ViewportMetrics = __webpack_require__(39);
|
3262 |
|
3263 | var assign = __webpack_require__(40);
|
3264 | var isEventSupported = __webpack_require__(41);
|
3265 |
|
3266 | |
3267 |
|
3268 |
|
3269 |
|
3270 |
|
3271 |
|
3272 |
|
3273 |
|
3274 |
|
3275 |
|
3276 |
|
3277 |
|
3278 |
|
3279 |
|
3280 |
|
3281 |
|
3282 |
|
3283 |
|
3284 |
|
3285 |
|
3286 |
|
3287 |
|
3288 |
|
3289 |
|
3290 |
|
3291 |
|
3292 |
|
3293 |
|
3294 |
|
3295 |
|
3296 |
|
3297 |
|
3298 |
|
3299 |
|
3300 |
|
3301 |
|
3302 |
|
3303 |
|
3304 |
|
3305 |
|
3306 |
|
3307 |
|
3308 |
|
3309 |
|
3310 |
|
3311 |
|
3312 |
|
3313 |
|
3314 |
|
3315 |
|
3316 |
|
3317 |
|
3318 |
|
3319 |
|
3320 |
|
3321 | var alreadyListeningTo = {};
|
3322 | var isMonitoringScrollValue = false;
|
3323 | var reactTopListenersCounter = 0;
|
3324 |
|
3325 |
|
3326 |
|
3327 |
|
3328 | var topEventMapping = {
|
3329 | topAbort: 'abort',
|
3330 | topBlur: 'blur',
|
3331 | topCanPlay: 'canplay',
|
3332 | topCanPlayThrough: 'canplaythrough',
|
3333 | topChange: 'change',
|
3334 | topClick: 'click',
|
3335 | topCompositionEnd: 'compositionend',
|
3336 | topCompositionStart: 'compositionstart',
|
3337 | topCompositionUpdate: 'compositionupdate',
|
3338 | topContextMenu: 'contextmenu',
|
3339 | topCopy: 'copy',
|
3340 | topCut: 'cut',
|
3341 | topDoubleClick: 'dblclick',
|
3342 | topDrag: 'drag',
|
3343 | topDragEnd: 'dragend',
|
3344 | topDragEnter: 'dragenter',
|
3345 | topDragExit: 'dragexit',
|
3346 | topDragLeave: 'dragleave',
|
3347 | topDragOver: 'dragover',
|
3348 | topDragStart: 'dragstart',
|
3349 | topDrop: 'drop',
|
3350 | topDurationChange: 'durationchange',
|
3351 | topEmptied: 'emptied',
|
3352 | topEncrypted: 'encrypted',
|
3353 | topEnded: 'ended',
|
3354 | topError: 'error',
|
3355 | topFocus: 'focus',
|
3356 | topInput: 'input',
|
3357 | topKeyDown: 'keydown',
|
3358 | topKeyPress: 'keypress',
|
3359 | topKeyUp: 'keyup',
|
3360 | topLoadedData: 'loadeddata',
|
3361 | topLoadedMetadata: 'loadedmetadata',
|
3362 | topLoadStart: 'loadstart',
|
3363 | topMouseDown: 'mousedown',
|
3364 | topMouseMove: 'mousemove',
|
3365 | topMouseOut: 'mouseout',
|
3366 | topMouseOver: 'mouseover',
|
3367 | topMouseUp: 'mouseup',
|
3368 | topPaste: 'paste',
|
3369 | topPause: 'pause',
|
3370 | topPlay: 'play',
|
3371 | topPlaying: 'playing',
|
3372 | topProgress: 'progress',
|
3373 | topRateChange: 'ratechange',
|
3374 | topScroll: 'scroll',
|
3375 | topSeeked: 'seeked',
|
3376 | topSeeking: 'seeking',
|
3377 | topSelectionChange: 'selectionchange',
|
3378 | topStalled: 'stalled',
|
3379 | topSuspend: 'suspend',
|
3380 | topTextInput: 'textInput',
|
3381 | topTimeUpdate: 'timeupdate',
|
3382 | topTouchCancel: 'touchcancel',
|
3383 | topTouchEnd: 'touchend',
|
3384 | topTouchMove: 'touchmove',
|
3385 | topTouchStart: 'touchstart',
|
3386 | topVolumeChange: 'volumechange',
|
3387 | topWaiting: 'waiting',
|
3388 | topWheel: 'wheel'
|
3389 | };
|
3390 |
|
3391 | |
3392 |
|
3393 |
|
3394 | var topListenersIDKey = '_reactListenersID' + String(Math.random()).slice(2);
|
3395 |
|
3396 | function getListeningForDocument(mountAt) {
|
3397 |
|
3398 |
|
3399 | if (!Object.prototype.hasOwnProperty.call(mountAt, topListenersIDKey)) {
|
3400 | mountAt[topListenersIDKey] = reactTopListenersCounter++;
|
3401 | alreadyListeningTo[mountAt[topListenersIDKey]] = {};
|
3402 | }
|
3403 | return alreadyListeningTo[mountAt[topListenersIDKey]];
|
3404 | }
|
3405 |
|
3406 | |
3407 |
|
3408 |
|
3409 |
|
3410 |
|
3411 |
|
3412 |
|
3413 |
|
3414 |
|
3415 |
|
3416 | var ReactBrowserEventEmitter = assign({}, ReactEventEmitterMixin, {
|
3417 |
|
3418 | |
3419 |
|
3420 |
|
3421 | ReactEventListener: null,
|
3422 |
|
3423 | injection: {
|
3424 | |
3425 |
|
3426 |
|
3427 | injectReactEventListener: function (ReactEventListener) {
|
3428 | ReactEventListener.setHandleTopLevel(ReactBrowserEventEmitter.handleTopLevel);
|
3429 | ReactBrowserEventEmitter.ReactEventListener = ReactEventListener;
|
3430 | }
|
3431 | },
|
3432 |
|
3433 | |
3434 |
|
3435 |
|
3436 |
|
3437 |
|
3438 | setEnabled: function (enabled) {
|
3439 | if (ReactBrowserEventEmitter.ReactEventListener) {
|
3440 | ReactBrowserEventEmitter.ReactEventListener.setEnabled(enabled);
|
3441 | }
|
3442 | },
|
3443 |
|
3444 | |
3445 |
|
3446 |
|
3447 | isEnabled: function () {
|
3448 | return !!(ReactBrowserEventEmitter.ReactEventListener && ReactBrowserEventEmitter.ReactEventListener.isEnabled());
|
3449 | },
|
3450 |
|
3451 | |
3452 |
|
3453 |
|
3454 |
|
3455 |
|
3456 |
|
3457 |
|
3458 |
|
3459 |
|
3460 |
|
3461 |
|
3462 |
|
3463 |
|
3464 |
|
3465 |
|
3466 |
|
3467 |
|
3468 |
|
3469 |
|
3470 |
|
3471 |
|
3472 | listenTo: function (registrationName, contentDocumentHandle) {
|
3473 | var mountAt = contentDocumentHandle;
|
3474 | var isListening = getListeningForDocument(mountAt);
|
3475 | var dependencies = EventPluginRegistry.registrationNameDependencies[registrationName];
|
3476 |
|
3477 | var topLevelTypes = EventConstants.topLevelTypes;
|
3478 | for (var i = 0; i < dependencies.length; i++) {
|
3479 | var dependency = dependencies[i];
|
3480 | if (!(isListening.hasOwnProperty(dependency) && isListening[dependency])) {
|
3481 | if (dependency === topLevelTypes.topWheel) {
|
3482 | if (isEventSupported('wheel')) {
|
3483 | ReactBrowserEventEmitter.ReactEventListener.trapBubbledEvent(topLevelTypes.topWheel, 'wheel', mountAt);
|
3484 | } else if (isEventSupported('mousewheel')) {
|
3485 | ReactBrowserEventEmitter.ReactEventListener.trapBubbledEvent(topLevelTypes.topWheel, 'mousewheel', mountAt);
|
3486 | } else {
|
3487 |
|
3488 |
|
3489 | ReactBrowserEventEmitter.ReactEventListener.trapBubbledEvent(topLevelTypes.topWheel, 'DOMMouseScroll', mountAt);
|
3490 | }
|
3491 | } else if (dependency === topLevelTypes.topScroll) {
|
3492 |
|
3493 | if (isEventSupported('scroll', true)) {
|
3494 | ReactBrowserEventEmitter.ReactEventListener.trapCapturedEvent(topLevelTypes.topScroll, 'scroll', mountAt);
|
3495 | } else {
|
3496 | ReactBrowserEventEmitter.ReactEventListener.trapBubbledEvent(topLevelTypes.topScroll, 'scroll', ReactBrowserEventEmitter.ReactEventListener.WINDOW_HANDLE);
|
3497 | }
|
3498 | } else if (dependency === topLevelTypes.topFocus || dependency === topLevelTypes.topBlur) {
|
3499 |
|
3500 | if (isEventSupported('focus', true)) {
|
3501 | ReactBrowserEventEmitter.ReactEventListener.trapCapturedEvent(topLevelTypes.topFocus, 'focus', mountAt);
|
3502 | ReactBrowserEventEmitter.ReactEventListener.trapCapturedEvent(topLevelTypes.topBlur, 'blur', mountAt);
|
3503 | } else if (isEventSupported('focusin')) {
|
3504 |
|
3505 |
|
3506 | ReactBrowserEventEmitter.ReactEventListener.trapBubbledEvent(topLevelTypes.topFocus, 'focusin', mountAt);
|
3507 | ReactBrowserEventEmitter.ReactEventListener.trapBubbledEvent(topLevelTypes.topBlur, 'focusout', mountAt);
|
3508 | }
|
3509 |
|
3510 |
|
3511 | isListening[topLevelTypes.topBlur] = true;
|
3512 | isListening[topLevelTypes.topFocus] = true;
|
3513 | } else if (topEventMapping.hasOwnProperty(dependency)) {
|
3514 | ReactBrowserEventEmitter.ReactEventListener.trapBubbledEvent(dependency, topEventMapping[dependency], mountAt);
|
3515 | }
|
3516 |
|
3517 | isListening[dependency] = true;
|
3518 | }
|
3519 | }
|
3520 | },
|
3521 |
|
3522 | trapBubbledEvent: function (topLevelType, handlerBaseName, handle) {
|
3523 | return ReactBrowserEventEmitter.ReactEventListener.trapBubbledEvent(topLevelType, handlerBaseName, handle);
|
3524 | },
|
3525 |
|
3526 | trapCapturedEvent: function (topLevelType, handlerBaseName, handle) {
|
3527 | return ReactBrowserEventEmitter.ReactEventListener.trapCapturedEvent(topLevelType, handlerBaseName, handle);
|
3528 | },
|
3529 |
|
3530 | |
3531 |
|
3532 |
|
3533 |
|
3534 |
|
3535 |
|
3536 |
|
3537 |
|
3538 | ensureScrollValueMonitoring: function () {
|
3539 | if (!isMonitoringScrollValue) {
|
3540 | var refresh = ViewportMetrics.refreshScrollValues;
|
3541 | ReactBrowserEventEmitter.ReactEventListener.monitorScrollValue(refresh);
|
3542 | isMonitoringScrollValue = true;
|
3543 | }
|
3544 | },
|
3545 |
|
3546 | eventNameDispatchConfigs: EventPluginHub.eventNameDispatchConfigs,
|
3547 |
|
3548 | registrationNameModules: EventPluginHub.registrationNameModules,
|
3549 |
|
3550 | putListener: EventPluginHub.putListener,
|
3551 |
|
3552 | getListener: EventPluginHub.getListener,
|
3553 |
|
3554 | deleteListener: EventPluginHub.deleteListener,
|
3555 |
|
3556 | deleteAllListeners: EventPluginHub.deleteAllListeners
|
3557 |
|
3558 | });
|
3559 |
|
3560 | ReactPerf.measureMethods(ReactBrowserEventEmitter, 'ReactBrowserEventEmitter', {
|
3561 | putListener: 'putListener',
|
3562 | deleteListener: 'deleteListener'
|
3563 | });
|
3564 |
|
3565 | module.exports = ReactBrowserEventEmitter;
|
3566 |
|
3567 | },
|
3568 |
|
3569 | function(module, exports, __webpack_require__) {
|
3570 |
|
3571 | |
3572 |
|
3573 |
|
3574 |
|
3575 |
|
3576 |
|
3577 |
|
3578 |
|
3579 |
|
3580 |
|
3581 |
|
3582 | 'use strict';
|
3583 |
|
3584 | var keyMirror = __webpack_require__(18);
|
3585 |
|
3586 | var PropagationPhases = keyMirror({ bubbled: null, captured: null });
|
3587 |
|
3588 | |
3589 |
|
3590 |
|
3591 | var topLevelTypes = keyMirror({
|
3592 | topAbort: null,
|
3593 | topBlur: null,
|
3594 | topCanPlay: null,
|
3595 | topCanPlayThrough: null,
|
3596 | topChange: null,
|
3597 | topClick: null,
|
3598 | topCompositionEnd: null,
|
3599 | topCompositionStart: null,
|
3600 | topCompositionUpdate: null,
|
3601 | topContextMenu: null,
|
3602 | topCopy: null,
|
3603 | topCut: null,
|
3604 | topDoubleClick: null,
|
3605 | topDrag: null,
|
3606 | topDragEnd: null,
|
3607 | topDragEnter: null,
|
3608 | topDragExit: null,
|
3609 | topDragLeave: null,
|
3610 | topDragOver: null,
|
3611 | topDragStart: null,
|
3612 | topDrop: null,
|
3613 | topDurationChange: null,
|
3614 | topEmptied: null,
|
3615 | topEncrypted: null,
|
3616 | topEnded: null,
|
3617 | topError: null,
|
3618 | topFocus: null,
|
3619 | topInput: null,
|
3620 | topKeyDown: null,
|
3621 | topKeyPress: null,
|
3622 | topKeyUp: null,
|
3623 | topLoad: null,
|
3624 | topLoadedData: null,
|
3625 | topLoadedMetadata: null,
|
3626 | topLoadStart: null,
|
3627 | topMouseDown: null,
|
3628 | topMouseMove: null,
|
3629 | topMouseOut: null,
|
3630 | topMouseOver: null,
|
3631 | topMouseUp: null,
|
3632 | topPaste: null,
|
3633 | topPause: null,
|
3634 | topPlay: null,
|
3635 | topPlaying: null,
|
3636 | topProgress: null,
|
3637 | topRateChange: null,
|
3638 | topReset: null,
|
3639 | topScroll: null,
|
3640 | topSeeked: null,
|
3641 | topSeeking: null,
|
3642 | topSelectionChange: null,
|
3643 | topStalled: null,
|
3644 | topSubmit: null,
|
3645 | topSuspend: null,
|
3646 | topTextInput: null,
|
3647 | topTimeUpdate: null,
|
3648 | topTouchCancel: null,
|
3649 | topTouchEnd: null,
|
3650 | topTouchMove: null,
|
3651 | topTouchStart: null,
|
3652 | topVolumeChange: null,
|
3653 | topWaiting: null,
|
3654 | topWheel: null
|
3655 | });
|
3656 |
|
3657 | var EventConstants = {
|
3658 | topLevelTypes: topLevelTypes,
|
3659 | PropagationPhases: PropagationPhases
|
3660 | };
|
3661 |
|
3662 | module.exports = EventConstants;
|
3663 |
|
3664 | },
|
3665 |
|
3666 | function(module, exports, __webpack_require__) {
|
3667 |
|
3668 | (function(process) { |
3669 |
|
3670 |
|
3671 |
|
3672 |
|
3673 |
|
3674 |
|
3675 |
|
3676 |
|
3677 |
|
3678 |
|
3679 | 'use strict';
|
3680 |
|
3681 | var EventPluginRegistry = __webpack_require__(33);
|
3682 | var EventPluginUtils = __webpack_require__(34);
|
3683 | var ReactErrorUtils = __webpack_require__(35);
|
3684 |
|
3685 | var accumulateInto = __webpack_require__(36);
|
3686 | var forEachAccumulated = __webpack_require__(37);
|
3687 | var invariant = __webpack_require__(14);
|
3688 | var warning = __webpack_require__(26);
|
3689 |
|
3690 | |
3691 |
|
3692 |
|
3693 | var listenerBank = {};
|
3694 |
|
3695 | |
3696 |
|
3697 |
|
3698 |
|
3699 | var eventQueue = null;
|
3700 |
|
3701 | |
3702 |
|
3703 |
|
3704 |
|
3705 |
|
3706 |
|
3707 |
|
3708 | var executeDispatchesAndRelease = function (event, simulated) {
|
3709 | if (event) {
|
3710 | EventPluginUtils.executeDispatchesInOrder(event, simulated);
|
3711 |
|
3712 | if (!event.isPersistent()) {
|
3713 | event.constructor.release(event);
|
3714 | }
|
3715 | }
|
3716 | };
|
3717 | var executeDispatchesAndReleaseSimulated = function (e) {
|
3718 | return executeDispatchesAndRelease(e, true);
|
3719 | };
|
3720 | var executeDispatchesAndReleaseTopLevel = function (e) {
|
3721 | return executeDispatchesAndRelease(e, false);
|
3722 | };
|
3723 |
|
3724 | |
3725 |
|
3726 |
|
3727 |
|
3728 | var InstanceHandle = null;
|
3729 |
|
3730 | function validateInstanceHandle() {
|
3731 | var valid = InstanceHandle && InstanceHandle.traverseTwoPhase && InstanceHandle.traverseEnterLeave;
|
3732 | process.env.NODE_ENV !== 'production' ? warning(valid, 'InstanceHandle not injected before use!') : undefined;
|
3733 | }
|
3734 |
|
3735 | |
3736 |
|
3737 |
|
3738 |
|
3739 |
|
3740 |
|
3741 |
|
3742 |
|
3743 |
|
3744 |
|
3745 |
|
3746 |
|
3747 |
|
3748 |
|
3749 |
|
3750 |
|
3751 |
|
3752 |
|
3753 |
|
3754 |
|
3755 |
|
3756 |
|
3757 | var EventPluginHub = {
|
3758 |
|
3759 | |
3760 |
|
3761 |
|
3762 | injection: {
|
3763 |
|
3764 | |
3765 |
|
3766 |
|
3767 |
|
3768 | injectMount: EventPluginUtils.injection.injectMount,
|
3769 |
|
3770 | |
3771 |
|
3772 |
|
3773 |
|
3774 | injectInstanceHandle: function (InjectedInstanceHandle) {
|
3775 | InstanceHandle = InjectedInstanceHandle;
|
3776 | if (process.env.NODE_ENV !== 'production') {
|
3777 | validateInstanceHandle();
|
3778 | }
|
3779 | },
|
3780 |
|
3781 | getInstanceHandle: function () {
|
3782 | if (process.env.NODE_ENV !== 'production') {
|
3783 | validateInstanceHandle();
|
3784 | }
|
3785 | return InstanceHandle;
|
3786 | },
|
3787 |
|
3788 | |
3789 |
|
3790 |
|
3791 |
|
3792 | injectEventPluginOrder: EventPluginRegistry.injectEventPluginOrder,
|
3793 |
|
3794 | |
3795 |
|
3796 |
|
3797 | injectEventPluginsByName: EventPluginRegistry.injectEventPluginsByName
|
3798 |
|
3799 | },
|
3800 |
|
3801 | eventNameDispatchConfigs: EventPluginRegistry.eventNameDispatchConfigs,
|
3802 |
|
3803 | registrationNameModules: EventPluginRegistry.registrationNameModules,
|
3804 |
|
3805 | |
3806 |
|
3807 |
|
3808 |
|
3809 |
|
3810 |
|
3811 |
|
3812 | putListener: function (id, registrationName, listener) {
|
3813 | !(typeof listener === 'function') ? process.env.NODE_ENV !== 'production' ? invariant(false, 'Expected %s listener to be a function, instead got type %s', registrationName, typeof listener) : invariant(false) : undefined;
|
3814 |
|
3815 | var bankForRegistrationName = listenerBank[registrationName] || (listenerBank[registrationName] = {});
|
3816 | bankForRegistrationName[id] = listener;
|
3817 |
|
3818 | var PluginModule = EventPluginRegistry.registrationNameModules[registrationName];
|
3819 | if (PluginModule && PluginModule.didPutListener) {
|
3820 | PluginModule.didPutListener(id, registrationName, listener);
|
3821 | }
|
3822 | },
|
3823 |
|
3824 | |
3825 |
|
3826 |
|
3827 |
|
3828 |
|
3829 | getListener: function (id, registrationName) {
|
3830 | var bankForRegistrationName = listenerBank[registrationName];
|
3831 | return bankForRegistrationName && bankForRegistrationName[id];
|
3832 | },
|
3833 |
|
3834 | |
3835 |
|
3836 |
|
3837 |
|
3838 |
|
3839 |
|
3840 | deleteListener: function (id, registrationName) {
|
3841 | var PluginModule = EventPluginRegistry.registrationNameModules[registrationName];
|
3842 | if (PluginModule && PluginModule.willDeleteListener) {
|
3843 | PluginModule.willDeleteListener(id, registrationName);
|
3844 | }
|
3845 |
|
3846 | var bankForRegistrationName = listenerBank[registrationName];
|
3847 |
|
3848 | if (bankForRegistrationName) {
|
3849 | delete bankForRegistrationName[id];
|
3850 | }
|
3851 | },
|
3852 |
|
3853 | |
3854 |
|
3855 |
|
3856 |
|
3857 |
|
3858 | deleteAllListeners: function (id) {
|
3859 | for (var registrationName in listenerBank) {
|
3860 | if (!listenerBank[registrationName][id]) {
|
3861 | continue;
|
3862 | }
|
3863 |
|
3864 | var PluginModule = EventPluginRegistry.registrationNameModules[registrationName];
|
3865 | if (PluginModule && PluginModule.willDeleteListener) {
|
3866 | PluginModule.willDeleteListener(id, registrationName);
|
3867 | }
|
3868 |
|
3869 | delete listenerBank[registrationName][id];
|
3870 | }
|
3871 | },
|
3872 |
|
3873 | |
3874 |
|
3875 |
|
3876 |
|
3877 |
|
3878 |
|
3879 |
|
3880 |
|
3881 |
|
3882 |
|
3883 |
|
3884 | extractEvents: function (topLevelType, topLevelTarget, topLevelTargetID, nativeEvent, nativeEventTarget) {
|
3885 | var events;
|
3886 | var plugins = EventPluginRegistry.plugins;
|
3887 | for (var i = 0; i < plugins.length; i++) {
|
3888 |
|
3889 | var possiblePlugin = plugins[i];
|
3890 | if (possiblePlugin) {
|
3891 | var extractedEvents = possiblePlugin.extractEvents(topLevelType, topLevelTarget, topLevelTargetID, nativeEvent, nativeEventTarget);
|
3892 | if (extractedEvents) {
|
3893 | events = accumulateInto(events, extractedEvents);
|
3894 | }
|
3895 | }
|
3896 | }
|
3897 | return events;
|
3898 | },
|
3899 |
|
3900 | |
3901 |
|
3902 |
|
3903 |
|
3904 |
|
3905 |
|
3906 |
|
3907 | enqueueEvents: function (events) {
|
3908 | if (events) {
|
3909 | eventQueue = accumulateInto(eventQueue, events);
|
3910 | }
|
3911 | },
|
3912 |
|
3913 | |
3914 |
|
3915 |
|
3916 |
|
3917 |
|
3918 | processEventQueue: function (simulated) {
|
3919 |
|
3920 |
|
3921 | var processingEventQueue = eventQueue;
|
3922 | eventQueue = null;
|
3923 | if (simulated) {
|
3924 | forEachAccumulated(processingEventQueue, executeDispatchesAndReleaseSimulated);
|
3925 | } else {
|
3926 | forEachAccumulated(processingEventQueue, executeDispatchesAndReleaseTopLevel);
|
3927 | }
|
3928 | !!eventQueue ? process.env.NODE_ENV !== 'production' ? invariant(false, 'processEventQueue(): Additional events were enqueued while processing ' + 'an event queue. Support for this has not yet been implemented.') : invariant(false) : undefined;
|
3929 |
|
3930 | ReactErrorUtils.rethrowCaughtError();
|
3931 | },
|
3932 |
|
3933 | |
3934 |
|
3935 |
|
3936 | __purge: function () {
|
3937 | listenerBank = {};
|
3938 | },
|
3939 |
|
3940 | __getListenerBank: function () {
|
3941 | return listenerBank;
|
3942 | }
|
3943 |
|
3944 | };
|
3945 |
|
3946 | module.exports = EventPluginHub;
|
3947 | }.call(exports, __webpack_require__(5)))
|
3948 |
|
3949 | },
|
3950 |
|
3951 | function(module, exports, __webpack_require__) {
|
3952 |
|
3953 | (function(process) { |
3954 |
|
3955 |
|
3956 |
|
3957 |
|
3958 |
|
3959 |
|
3960 |
|
3961 |
|
3962 |
|
3963 |
|
3964 |
|
3965 | 'use strict';
|
3966 |
|
3967 | var invariant = __webpack_require__(14);
|
3968 |
|
3969 | |
3970 |
|
3971 |
|
3972 | var EventPluginOrder = null;
|
3973 |
|
3974 | |
3975 |
|
3976 |
|
3977 | var namesToPlugins = {};
|
3978 |
|
3979 | |
3980 |
|
3981 |
|
3982 |
|
3983 |
|
3984 | function recomputePluginOrdering() {
|
3985 | if (!EventPluginOrder) {
|
3986 |
|
3987 | return;
|
3988 | }
|
3989 | for (var pluginName in namesToPlugins) {
|
3990 | var PluginModule = namesToPlugins[pluginName];
|
3991 | var pluginIndex = EventPluginOrder.indexOf(pluginName);
|
3992 | !(pluginIndex > -1) ? process.env.NODE_ENV !== 'production' ? invariant(false, 'EventPluginRegistry: Cannot inject event plugins that do not exist in ' + 'the plugin ordering, `%s`.', pluginName) : invariant(false) : undefined;
|
3993 | if (EventPluginRegistry.plugins[pluginIndex]) {
|
3994 | continue;
|
3995 | }
|
3996 | !PluginModule.extractEvents ? process.env.NODE_ENV !== 'production' ? invariant(false, 'EventPluginRegistry: Event plugins must implement an `extractEvents` ' + 'method, but `%s` does not.', pluginName) : invariant(false) : undefined;
|
3997 | EventPluginRegistry.plugins[pluginIndex] = PluginModule;
|
3998 | var publishedEvents = PluginModule.eventTypes;
|
3999 | for (var eventName in publishedEvents) {
|
4000 | !publishEventForPlugin(publishedEvents[eventName], PluginModule, eventName) ? process.env.NODE_ENV !== 'production' ? invariant(false, 'EventPluginRegistry: Failed to publish event `%s` for plugin `%s`.', eventName, pluginName) : invariant(false) : undefined;
|
4001 | }
|
4002 | }
|
4003 | }
|
4004 |
|
4005 | |
4006 |
|
4007 |
|
4008 |
|
4009 |
|
4010 |
|
4011 |
|
4012 |
|
4013 | function publishEventForPlugin(dispatchConfig, PluginModule, eventName) {
|
4014 | !!EventPluginRegistry.eventNameDispatchConfigs.hasOwnProperty(eventName) ? process.env.NODE_ENV !== 'production' ? invariant(false, 'EventPluginHub: More than one plugin attempted to publish the same ' + 'event name, `%s`.', eventName) : invariant(false) : undefined;
|
4015 | EventPluginRegistry.eventNameDispatchConfigs[eventName] = dispatchConfig;
|
4016 |
|
4017 | var phasedRegistrationNames = dispatchConfig.phasedRegistrationNames;
|
4018 | if (phasedRegistrationNames) {
|
4019 | for (var phaseName in phasedRegistrationNames) {
|
4020 | if (phasedRegistrationNames.hasOwnProperty(phaseName)) {
|
4021 | var phasedRegistrationName = phasedRegistrationNames[phaseName];
|
4022 | publishRegistrationName(phasedRegistrationName, PluginModule, eventName);
|
4023 | }
|
4024 | }
|
4025 | return true;
|
4026 | } else if (dispatchConfig.registrationName) {
|
4027 | publishRegistrationName(dispatchConfig.registrationName, PluginModule, eventName);
|
4028 | return true;
|
4029 | }
|
4030 | return false;
|
4031 | }
|
4032 |
|
4033 | |
4034 |
|
4035 |
|
4036 |
|
4037 |
|
4038 |
|
4039 |
|
4040 |
|
4041 | function publishRegistrationName(registrationName, PluginModule, eventName) {
|
4042 | !!EventPluginRegistry.registrationNameModules[registrationName] ? process.env.NODE_ENV !== 'production' ? invariant(false, 'EventPluginHub: More than one plugin attempted to publish the same ' + 'registration name, `%s`.', registrationName) : invariant(false) : undefined;
|
4043 | EventPluginRegistry.registrationNameModules[registrationName] = PluginModule;
|
4044 | EventPluginRegistry.registrationNameDependencies[registrationName] = PluginModule.eventTypes[eventName].dependencies;
|
4045 | }
|
4046 |
|
4047 | |
4048 |
|
4049 |
|
4050 |
|
4051 |
|
4052 | var EventPluginRegistry = {
|
4053 |
|
4054 | |
4055 |
|
4056 |
|
4057 | plugins: [],
|
4058 |
|
4059 | |
4060 |
|
4061 |
|
4062 | eventNameDispatchConfigs: {},
|
4063 |
|
4064 | |
4065 |
|
4066 |
|
4067 | registrationNameModules: {},
|
4068 |
|
4069 | |
4070 |
|
4071 |
|
4072 | registrationNameDependencies: {},
|
4073 |
|
4074 | |
4075 |
|
4076 |
|
4077 |
|
4078 |
|
4079 |
|
4080 |
|
4081 |
|
4082 |
|
4083 | injectEventPluginOrder: function (InjectedEventPluginOrder) {
|
4084 | !!EventPluginOrder ? process.env.NODE_ENV !== 'production' ? invariant(false, 'EventPluginRegistry: Cannot inject event plugin ordering more than ' + 'once. You are likely trying to load more than one copy of React.') : invariant(false) : undefined;
|
4085 |
|
4086 | EventPluginOrder = Array.prototype.slice.call(InjectedEventPluginOrder);
|
4087 | recomputePluginOrdering();
|
4088 | },
|
4089 |
|
4090 | |
4091 |
|
4092 |
|
4093 |
|
4094 |
|
4095 |
|
4096 |
|
4097 |
|
4098 |
|
4099 |
|
4100 | injectEventPluginsByName: function (injectedNamesToPlugins) {
|
4101 | var isOrderingDirty = false;
|
4102 | for (var pluginName in injectedNamesToPlugins) {
|
4103 | if (!injectedNamesToPlugins.hasOwnProperty(pluginName)) {
|
4104 | continue;
|
4105 | }
|
4106 | var PluginModule = injectedNamesToPlugins[pluginName];
|
4107 | if (!namesToPlugins.hasOwnProperty(pluginName) || namesToPlugins[pluginName] !== PluginModule) {
|
4108 | !!namesToPlugins[pluginName] ? process.env.NODE_ENV !== 'production' ? invariant(false, 'EventPluginRegistry: Cannot inject two different event plugins ' + 'using the same name, `%s`.', pluginName) : invariant(false) : undefined;
|
4109 | namesToPlugins[pluginName] = PluginModule;
|
4110 | isOrderingDirty = true;
|
4111 | }
|
4112 | }
|
4113 | if (isOrderingDirty) {
|
4114 | recomputePluginOrdering();
|
4115 | }
|
4116 | },
|
4117 |
|
4118 | |
4119 |
|
4120 |
|
4121 |
|
4122 |
|
4123 |
|
4124 |
|
4125 | getPluginModuleForEvent: function (event) {
|
4126 | var dispatchConfig = event.dispatchConfig;
|
4127 | if (dispatchConfig.registrationName) {
|
4128 | return EventPluginRegistry.registrationNameModules[dispatchConfig.registrationName] || null;
|
4129 | }
|
4130 | for (var phase in dispatchConfig.phasedRegistrationNames) {
|
4131 | if (!dispatchConfig.phasedRegistrationNames.hasOwnProperty(phase)) {
|
4132 | continue;
|
4133 | }
|
4134 | var PluginModule = EventPluginRegistry.registrationNameModules[dispatchConfig.phasedRegistrationNames[phase]];
|
4135 | if (PluginModule) {
|
4136 | return PluginModule;
|
4137 | }
|
4138 | }
|
4139 | return null;
|
4140 | },
|
4141 |
|
4142 | |
4143 |
|
4144 |
|
4145 |
|
4146 | _resetEventPlugins: function () {
|
4147 | EventPluginOrder = null;
|
4148 | for (var pluginName in namesToPlugins) {
|
4149 | if (namesToPlugins.hasOwnProperty(pluginName)) {
|
4150 | delete namesToPlugins[pluginName];
|
4151 | }
|
4152 | }
|
4153 | EventPluginRegistry.plugins.length = 0;
|
4154 |
|
4155 | var eventNameDispatchConfigs = EventPluginRegistry.eventNameDispatchConfigs;
|
4156 | for (var eventName in eventNameDispatchConfigs) {
|
4157 | if (eventNameDispatchConfigs.hasOwnProperty(eventName)) {
|
4158 | delete eventNameDispatchConfigs[eventName];
|
4159 | }
|
4160 | }
|
4161 |
|
4162 | var registrationNameModules = EventPluginRegistry.registrationNameModules;
|
4163 | for (var registrationName in registrationNameModules) {
|
4164 | if (registrationNameModules.hasOwnProperty(registrationName)) {
|
4165 | delete registrationNameModules[registrationName];
|
4166 | }
|
4167 | }
|
4168 | }
|
4169 |
|
4170 | };
|
4171 |
|
4172 | module.exports = EventPluginRegistry;
|
4173 | }.call(exports, __webpack_require__(5)))
|
4174 |
|
4175 | },
|
4176 |
|
4177 | function(module, exports, __webpack_require__) {
|
4178 |
|
4179 | (function(process) { |
4180 |
|
4181 |
|
4182 |
|
4183 |
|
4184 |
|
4185 |
|
4186 |
|
4187 |
|
4188 |
|
4189 |
|
4190 | 'use strict';
|
4191 |
|
4192 | var EventConstants = __webpack_require__(31);
|
4193 | var ReactErrorUtils = __webpack_require__(35);
|
4194 |
|
4195 | var invariant = __webpack_require__(14);
|
4196 | var warning = __webpack_require__(26);
|
4197 |
|
4198 | |
4199 |
|
4200 |
|
4201 |
|
4202 | |
4203 |
|
4204 |
|
4205 |
|
4206 | var injection = {
|
4207 | Mount: null,
|
4208 | injectMount: function (InjectedMount) {
|
4209 | injection.Mount = InjectedMount;
|
4210 | if (process.env.NODE_ENV !== 'production') {
|
4211 | process.env.NODE_ENV !== 'production' ? warning(InjectedMount && InjectedMount.getNode && InjectedMount.getID, 'EventPluginUtils.injection.injectMount(...): Injected Mount ' + 'module is missing getNode or getID.') : undefined;
|
4212 | }
|
4213 | }
|
4214 | };
|
4215 |
|
4216 | var topLevelTypes = EventConstants.topLevelTypes;
|
4217 |
|
4218 | function isEndish(topLevelType) {
|
4219 | return topLevelType === topLevelTypes.topMouseUp || topLevelType === topLevelTypes.topTouchEnd || topLevelType === topLevelTypes.topTouchCancel;
|
4220 | }
|
4221 |
|
4222 | function isMoveish(topLevelType) {
|
4223 | return topLevelType === topLevelTypes.topMouseMove || topLevelType === topLevelTypes.topTouchMove;
|
4224 | }
|
4225 | function isStartish(topLevelType) {
|
4226 | return topLevelType === topLevelTypes.topMouseDown || topLevelType === topLevelTypes.topTouchStart;
|
4227 | }
|
4228 |
|
4229 | var validateEventDispatches;
|
4230 | if (process.env.NODE_ENV !== 'production') {
|
4231 | validateEventDispatches = function (event) {
|
4232 | var dispatchListeners = event._dispatchListeners;
|
4233 | var dispatchIDs = event._dispatchIDs;
|
4234 |
|
4235 | var listenersIsArr = Array.isArray(dispatchListeners);
|
4236 | var idsIsArr = Array.isArray(dispatchIDs);
|
4237 | var IDsLen = idsIsArr ? dispatchIDs.length : dispatchIDs ? 1 : 0;
|
4238 | var listenersLen = listenersIsArr ? dispatchListeners.length : dispatchListeners ? 1 : 0;
|
4239 |
|
4240 | process.env.NODE_ENV !== 'production' ? warning(idsIsArr === listenersIsArr && IDsLen === listenersLen, 'EventPluginUtils: Invalid `event`.') : undefined;
|
4241 | };
|
4242 | }
|
4243 |
|
4244 | |
4245 |
|
4246 |
|
4247 |
|
4248 |
|
4249 |
|
4250 |
|
4251 | function executeDispatch(event, simulated, listener, domID) {
|
4252 | var type = event.type || 'unknown-event';
|
4253 | event.currentTarget = injection.Mount.getNode(domID);
|
4254 | if (simulated) {
|
4255 | ReactErrorUtils.invokeGuardedCallbackWithCatch(type, listener, event, domID);
|
4256 | } else {
|
4257 | ReactErrorUtils.invokeGuardedCallback(type, listener, event, domID);
|
4258 | }
|
4259 | event.currentTarget = null;
|
4260 | }
|
4261 |
|
4262 | |
4263 |
|
4264 |
|
4265 | function executeDispatchesInOrder(event, simulated) {
|
4266 | var dispatchListeners = event._dispatchListeners;
|
4267 | var dispatchIDs = event._dispatchIDs;
|
4268 | if (process.env.NODE_ENV !== 'production') {
|
4269 | validateEventDispatches(event);
|
4270 | }
|
4271 | if (Array.isArray(dispatchListeners)) {
|
4272 | for (var i = 0; i < dispatchListeners.length; i++) {
|
4273 | if (event.isPropagationStopped()) {
|
4274 | break;
|
4275 | }
|
4276 |
|
4277 | executeDispatch(event, simulated, dispatchListeners[i], dispatchIDs[i]);
|
4278 | }
|
4279 | } else if (dispatchListeners) {
|
4280 | executeDispatch(event, simulated, dispatchListeners, dispatchIDs);
|
4281 | }
|
4282 | event._dispatchListeners = null;
|
4283 | event._dispatchIDs = null;
|
4284 | }
|
4285 |
|
4286 | |
4287 |
|
4288 |
|
4289 |
|
4290 |
|
4291 |
|
4292 |
|
4293 | function executeDispatchesInOrderStopAtTrueImpl(event) {
|
4294 | var dispatchListeners = event._dispatchListeners;
|
4295 | var dispatchIDs = event._dispatchIDs;
|
4296 | if (process.env.NODE_ENV !== 'production') {
|
4297 | validateEventDispatches(event);
|
4298 | }
|
4299 | if (Array.isArray(dispatchListeners)) {
|
4300 | for (var i = 0; i < dispatchListeners.length; i++) {
|
4301 | if (event.isPropagationStopped()) {
|
4302 | break;
|
4303 | }
|
4304 |
|
4305 | if (dispatchListeners[i](event, dispatchIDs[i])) {
|
4306 | return dispatchIDs[i];
|
4307 | }
|
4308 | }
|
4309 | } else if (dispatchListeners) {
|
4310 | if (dispatchListeners(event, dispatchIDs)) {
|
4311 | return dispatchIDs;
|
4312 | }
|
4313 | }
|
4314 | return null;
|
4315 | }
|
4316 |
|
4317 | |
4318 |
|
4319 |
|
4320 | function executeDispatchesInOrderStopAtTrue(event) {
|
4321 | var ret = executeDispatchesInOrderStopAtTrueImpl(event);
|
4322 | event._dispatchIDs = null;
|
4323 | event._dispatchListeners = null;
|
4324 | return ret;
|
4325 | }
|
4326 |
|
4327 | |
4328 |
|
4329 |
|
4330 |
|
4331 |
|
4332 |
|
4333 |
|
4334 |
|
4335 |
|
4336 | function executeDirectDispatch(event) {
|
4337 | if (process.env.NODE_ENV !== 'production') {
|
4338 | validateEventDispatches(event);
|
4339 | }
|
4340 | var dispatchListener = event._dispatchListeners;
|
4341 | var dispatchID = event._dispatchIDs;
|
4342 | !!Array.isArray(dispatchListener) ? process.env.NODE_ENV !== 'production' ? invariant(false, 'executeDirectDispatch(...): Invalid `event`.') : invariant(false) : undefined;
|
4343 | var res = dispatchListener ? dispatchListener(event, dispatchID) : null;
|
4344 | event._dispatchListeners = null;
|
4345 | event._dispatchIDs = null;
|
4346 | return res;
|
4347 | }
|
4348 |
|
4349 | |
4350 |
|
4351 |
|
4352 |
|
4353 | function hasDispatches(event) {
|
4354 | return !!event._dispatchListeners;
|
4355 | }
|
4356 |
|
4357 | |
4358 |
|
4359 |
|
4360 | var EventPluginUtils = {
|
4361 | isEndish: isEndish,
|
4362 | isMoveish: isMoveish,
|
4363 | isStartish: isStartish,
|
4364 |
|
4365 | executeDirectDispatch: executeDirectDispatch,
|
4366 | executeDispatchesInOrder: executeDispatchesInOrder,
|
4367 | executeDispatchesInOrderStopAtTrue: executeDispatchesInOrderStopAtTrue,
|
4368 | hasDispatches: hasDispatches,
|
4369 |
|
4370 | getNode: function (id) {
|
4371 | return injection.Mount.getNode(id);
|
4372 | },
|
4373 | getID: function (node) {
|
4374 | return injection.Mount.getID(node);
|
4375 | },
|
4376 |
|
4377 | injection: injection
|
4378 | };
|
4379 |
|
4380 | module.exports = EventPluginUtils;
|
4381 | }.call(exports, __webpack_require__(5)))
|
4382 |
|
4383 | },
|
4384 |
|
4385 | function(module, exports, __webpack_require__) {
|
4386 |
|
4387 | (function(process) { |
4388 |
|
4389 |
|
4390 |
|
4391 |
|
4392 |
|
4393 |
|
4394 |
|
4395 |
|
4396 |
|
4397 |
|
4398 |
|
4399 | 'use strict';
|
4400 |
|
4401 | var caughtError = null;
|
4402 |
|
4403 | |
4404 |
|
4405 |
|
4406 |
|
4407 |
|
4408 |
|
4409 |
|
4410 |
|
4411 | function invokeGuardedCallback(name, func, a, b) {
|
4412 | try {
|
4413 | return func(a, b);
|
4414 | } catch (x) {
|
4415 | if (caughtError === null) {
|
4416 | caughtError = x;
|
4417 | }
|
4418 | return undefined;
|
4419 | }
|
4420 | }
|
4421 |
|
4422 | var ReactErrorUtils = {
|
4423 | invokeGuardedCallback: invokeGuardedCallback,
|
4424 |
|
4425 | |
4426 |
|
4427 |
|
4428 |
|
4429 | invokeGuardedCallbackWithCatch: invokeGuardedCallback,
|
4430 |
|
4431 | |
4432 |
|
4433 |
|
4434 |
|
4435 | rethrowCaughtError: function () {
|
4436 | if (caughtError) {
|
4437 | var error = caughtError;
|
4438 | caughtError = null;
|
4439 | throw error;
|
4440 | }
|
4441 | }
|
4442 | };
|
4443 |
|
4444 | if (process.env.NODE_ENV !== 'production') {
|
4445 | |
4446 |
|
4447 |
|
4448 |
|
4449 | if (typeof window !== 'undefined' && typeof window.dispatchEvent === 'function' && typeof document !== 'undefined' && typeof document.createEvent === 'function') {
|
4450 | var fakeNode = document.createElement('react');
|
4451 | ReactErrorUtils.invokeGuardedCallback = function (name, func, a, b) {
|
4452 | var boundFunc = func.bind(null, a, b);
|
4453 | var evtType = 'react-' + name;
|
4454 | fakeNode.addEventListener(evtType, boundFunc, false);
|
4455 | var evt = document.createEvent('Event');
|
4456 | evt.initEvent(evtType, false, false);
|
4457 | fakeNode.dispatchEvent(evt);
|
4458 | fakeNode.removeEventListener(evtType, boundFunc, false);
|
4459 | };
|
4460 | }
|
4461 | }
|
4462 |
|
4463 | module.exports = ReactErrorUtils;
|
4464 | }.call(exports, __webpack_require__(5)))
|
4465 |
|
4466 | },
|
4467 |
|
4468 | function(module, exports, __webpack_require__) {
|
4469 |
|
4470 | (function(process) { |
4471 |
|
4472 |
|
4473 |
|
4474 |
|
4475 |
|
4476 |
|
4477 |
|
4478 |
|
4479 |
|
4480 |
|
4481 | 'use strict';
|
4482 |
|
4483 | var invariant = __webpack_require__(14);
|
4484 |
|
4485 | |
4486 |
|
4487 |
|
4488 |
|
4489 |
|
4490 |
|
4491 |
|
4492 |
|
4493 |
|
4494 |
|
4495 |
|
4496 |
|
4497 |
|
4498 |
|
4499 | function accumulateInto(current, next) {
|
4500 | !(next != null) ? process.env.NODE_ENV !== 'production' ? invariant(false, 'accumulateInto(...): Accumulated items must not be null or undefined.') : invariant(false) : undefined;
|
4501 | if (current == null) {
|
4502 | return next;
|
4503 | }
|
4504 |
|
4505 |
|
4506 |
|
4507 | var currentIsArray = Array.isArray(current);
|
4508 | var nextIsArray = Array.isArray(next);
|
4509 |
|
4510 | if (currentIsArray && nextIsArray) {
|
4511 | current.push.apply(current, next);
|
4512 | return current;
|
4513 | }
|
4514 |
|
4515 | if (currentIsArray) {
|
4516 | current.push(next);
|
4517 | return current;
|
4518 | }
|
4519 |
|
4520 | if (nextIsArray) {
|
4521 |
|
4522 | return [current].concat(next);
|
4523 | }
|
4524 |
|
4525 | return [current, next];
|
4526 | }
|
4527 |
|
4528 | module.exports = accumulateInto;
|
4529 | }.call(exports, __webpack_require__(5)))
|
4530 |
|
4531 | },
|
4532 |
|
4533 | function(module, exports) {
|
4534 |
|
4535 | |
4536 |
|
4537 |
|
4538 |
|
4539 |
|
4540 |
|
4541 |
|
4542 |
|
4543 |
|
4544 |
|
4545 |
|
4546 | 'use strict';
|
4547 |
|
4548 | |
4549 |
|
4550 |
|
4551 |
|
4552 |
|
4553 |
|
4554 |
|
4555 | var forEachAccumulated = function (arr, cb, scope) {
|
4556 | if (Array.isArray(arr)) {
|
4557 | arr.forEach(cb, scope);
|
4558 | } else if (arr) {
|
4559 | cb.call(scope, arr);
|
4560 | }
|
4561 | };
|
4562 |
|
4563 | module.exports = forEachAccumulated;
|
4564 |
|
4565 | },
|
4566 |
|
4567 | function(module, exports, __webpack_require__) {
|
4568 |
|
4569 | |
4570 |
|
4571 |
|
4572 |
|
4573 |
|
4574 |
|
4575 |
|
4576 |
|
4577 |
|
4578 |
|
4579 |
|
4580 | 'use strict';
|
4581 |
|
4582 | var EventPluginHub = __webpack_require__(32);
|
4583 |
|
4584 | function runEventQueueInBatch(events) {
|
4585 | EventPluginHub.enqueueEvents(events);
|
4586 | EventPluginHub.processEventQueue(false);
|
4587 | }
|
4588 |
|
4589 | var ReactEventEmitterMixin = {
|
4590 |
|
4591 | |
4592 |
|
4593 |
|
4594 |
|
4595 |
|
4596 |
|
4597 |
|
4598 |
|
4599 |
|
4600 | handleTopLevel: function (topLevelType, topLevelTarget, topLevelTargetID, nativeEvent, nativeEventTarget) {
|
4601 | var events = EventPluginHub.extractEvents(topLevelType, topLevelTarget, topLevelTargetID, nativeEvent, nativeEventTarget);
|
4602 | runEventQueueInBatch(events);
|
4603 | }
|
4604 | };
|
4605 |
|
4606 | module.exports = ReactEventEmitterMixin;
|
4607 |
|
4608 | },
|
4609 |
|
4610 | function(module, exports) {
|
4611 |
|
4612 | |
4613 |
|
4614 |
|
4615 |
|
4616 |
|
4617 |
|
4618 |
|
4619 |
|
4620 |
|
4621 |
|
4622 |
|
4623 | 'use strict';
|
4624 |
|
4625 | var ViewportMetrics = {
|
4626 |
|
4627 | currentScrollLeft: 0,
|
4628 |
|
4629 | currentScrollTop: 0,
|
4630 |
|
4631 | refreshScrollValues: function (scrollPosition) {
|
4632 | ViewportMetrics.currentScrollLeft = scrollPosition.x;
|
4633 | ViewportMetrics.currentScrollTop = scrollPosition.y;
|
4634 | }
|
4635 |
|
4636 | };
|
4637 |
|
4638 | module.exports = ViewportMetrics;
|
4639 |
|
4640 | },
|
4641 |
|
4642 | function(module, exports) {
|
4643 |
|
4644 | |
4645 |
|
4646 |
|
4647 |
|
4648 |
|
4649 |
|
4650 |
|
4651 |
|
4652 |
|
4653 |
|
4654 |
|
4655 |
|
4656 |
|
4657 | 'use strict';
|
4658 |
|
4659 | function assign(target, sources) {
|
4660 | if (target == null) {
|
4661 | throw new TypeError('Object.assign target cannot be null or undefined');
|
4662 | }
|
4663 |
|
4664 | var to = Object(target);
|
4665 | var hasOwnProperty = Object.prototype.hasOwnProperty;
|
4666 |
|
4667 | for (var nextIndex = 1; nextIndex < arguments.length; nextIndex++) {
|
4668 | var nextSource = arguments[nextIndex];
|
4669 | if (nextSource == null) {
|
4670 | continue;
|
4671 | }
|
4672 |
|
4673 | var from = Object(nextSource);
|
4674 |
|
4675 |
|
4676 |
|
4677 |
|
4678 |
|
4679 |
|
4680 | for (var key in from) {
|
4681 | if (hasOwnProperty.call(from, key)) {
|
4682 | to[key] = from[key];
|
4683 | }
|
4684 | }
|
4685 | }
|
4686 |
|
4687 | return to;
|
4688 | }
|
4689 |
|
4690 | module.exports = assign;
|
4691 |
|
4692 | },
|
4693 |
|
4694 | function(module, exports, __webpack_require__) {
|
4695 |
|
4696 | |
4697 |
|
4698 |
|
4699 |
|
4700 |
|
4701 |
|
4702 |
|
4703 |
|
4704 |
|
4705 |
|
4706 |
|
4707 | 'use strict';
|
4708 |
|
4709 | var ExecutionEnvironment = __webpack_require__(10);
|
4710 |
|
4711 | var useHasFeature;
|
4712 | if (ExecutionEnvironment.canUseDOM) {
|
4713 | useHasFeature = document.implementation && document.implementation.hasFeature &&
|
4714 |
|
4715 |
|
4716 | document.implementation.hasFeature('', '') !== true;
|
4717 | }
|
4718 |
|
4719 | |
4720 |
|
4721 |
|
4722 |
|
4723 |
|
4724 |
|
4725 |
|
4726 |
|
4727 |
|
4728 |
|
4729 |
|
4730 |
|
4731 |
|
4732 |
|
4733 | function isEventSupported(eventNameSuffix, capture) {
|
4734 | if (!ExecutionEnvironment.canUseDOM || capture && !('addEventListener' in document)) {
|
4735 | return false;
|
4736 | }
|
4737 |
|
4738 | var eventName = 'on' + eventNameSuffix;
|
4739 | var isSupported = (eventName in document);
|
4740 |
|
4741 | if (!isSupported) {
|
4742 | var element = document.createElement('div');
|
4743 | element.setAttribute(eventName, 'return;');
|
4744 | isSupported = typeof element[eventName] === 'function';
|
4745 | }
|
4746 |
|
4747 | if (!isSupported && useHasFeature && eventNameSuffix === 'wheel') {
|
4748 |
|
4749 | isSupported = document.implementation.hasFeature('Events.wheel', '3.0');
|
4750 | }
|
4751 |
|
4752 | return isSupported;
|
4753 | }
|
4754 |
|
4755 | module.exports = isEventSupported;
|
4756 |
|
4757 | },
|
4758 |
|
4759 | function(module, exports) {
|
4760 |
|
4761 | |
4762 |
|
4763 |
|
4764 |
|
4765 |
|
4766 |
|
4767 |
|
4768 |
|
4769 |
|
4770 |
|
4771 |
|
4772 | 'use strict';
|
4773 |
|
4774 | var ReactDOMFeatureFlags = {
|
4775 | useCreateElement: false
|
4776 | };
|
4777 |
|
4778 | module.exports = ReactDOMFeatureFlags;
|
4779 |
|
4780 | },
|
4781 |
|
4782 | function(module, exports, __webpack_require__) {
|
4783 |
|
4784 | (function(process) { |
4785 |
|
4786 |
|
4787 |
|
4788 |
|
4789 |
|
4790 |
|
4791 |
|
4792 |
|
4793 |
|
4794 |
|
4795 | 'use strict';
|
4796 |
|
4797 | var ReactCurrentOwner = __webpack_require__(6);
|
4798 |
|
4799 | var assign = __webpack_require__(40);
|
4800 | var canDefineProperty = __webpack_require__(44);
|
4801 |
|
4802 |
|
4803 |
|
4804 | var REACT_ELEMENT_TYPE = typeof Symbol === 'function' && Symbol['for'] && Symbol['for']('react.element') || 0xeac7;
|
4805 |
|
4806 | var RESERVED_PROPS = {
|
4807 | key: true,
|
4808 | ref: true,
|
4809 | __self: true,
|
4810 | __source: true
|
4811 | };
|
4812 |
|
4813 | |
4814 |
|
4815 |
|
4816 |
|
4817 |
|
4818 |
|
4819 |
|
4820 |
|
4821 |
|
4822 |
|
4823 |
|
4824 |
|
4825 |
|
4826 |
|
4827 |
|
4828 |
|
4829 |
|
4830 |
|
4831 | var ReactElement = function (type, key, ref, self, source, owner, props) {
|
4832 | var element = {
|
4833 |
|
4834 | $$typeof: REACT_ELEMENT_TYPE,
|
4835 |
|
4836 |
|
4837 | type: type,
|
4838 | key: key,
|
4839 | ref: ref,
|
4840 | props: props,
|
4841 |
|
4842 |
|
4843 | _owner: owner
|
4844 | };
|
4845 |
|
4846 | if (process.env.NODE_ENV !== 'production') {
|
4847 |
|
4848 |
|
4849 |
|
4850 |
|
4851 | element._store = {};
|
4852 |
|
4853 |
|
4854 |
|
4855 |
|
4856 |
|
4857 | if (canDefineProperty) {
|
4858 | Object.defineProperty(element._store, 'validated', {
|
4859 | configurable: false,
|
4860 | enumerable: false,
|
4861 | writable: true,
|
4862 | value: false
|
4863 | });
|
4864 |
|
4865 | Object.defineProperty(element, '_self', {
|
4866 | configurable: false,
|
4867 | enumerable: false,
|
4868 | writable: false,
|
4869 | value: self
|
4870 | });
|
4871 |
|
4872 |
|
4873 | Object.defineProperty(element, '_source', {
|
4874 | configurable: false,
|
4875 | enumerable: false,
|
4876 | writable: false,
|
4877 | value: source
|
4878 | });
|
4879 | } else {
|
4880 | element._store.validated = false;
|
4881 | element._self = self;
|
4882 | element._source = source;
|
4883 | }
|
4884 | Object.freeze(element.props);
|
4885 | Object.freeze(element);
|
4886 | }
|
4887 |
|
4888 | return element;
|
4889 | };
|
4890 |
|
4891 | ReactElement.createElement = function (type, config, children) {
|
4892 | var propName;
|
4893 |
|
4894 |
|
4895 | var props = {};
|
4896 |
|
4897 | var key = null;
|
4898 | var ref = null;
|
4899 | var self = null;
|
4900 | var source = null;
|
4901 |
|
4902 | if (config != null) {
|
4903 | ref = config.ref === undefined ? null : config.ref;
|
4904 | key = config.key === undefined ? null : '' + config.key;
|
4905 | self = config.__self === undefined ? null : config.__self;
|
4906 | source = config.__source === undefined ? null : config.__source;
|
4907 |
|
4908 | for (propName in config) {
|
4909 | if (config.hasOwnProperty(propName) && !RESERVED_PROPS.hasOwnProperty(propName)) {
|
4910 | props[propName] = config[propName];
|
4911 | }
|
4912 | }
|
4913 | }
|
4914 |
|
4915 |
|
4916 |
|
4917 | var childrenLength = arguments.length - 2;
|
4918 | if (childrenLength === 1) {
|
4919 | props.children = children;
|
4920 | } else if (childrenLength > 1) {
|
4921 | var childArray = Array(childrenLength);
|
4922 | for (var i = 0; i < childrenLength; i++) {
|
4923 | childArray[i] = arguments[i + 2];
|
4924 | }
|
4925 | props.children = childArray;
|
4926 | }
|
4927 |
|
4928 |
|
4929 | if (type && type.defaultProps) {
|
4930 | var defaultProps = type.defaultProps;
|
4931 | for (propName in defaultProps) {
|
4932 | if (typeof props[propName] === 'undefined') {
|
4933 | props[propName] = defaultProps[propName];
|
4934 | }
|
4935 | }
|
4936 | }
|
4937 |
|
4938 | return ReactElement(type, key, ref, self, source, ReactCurrentOwner.current, props);
|
4939 | };
|
4940 |
|
4941 | ReactElement.createFactory = function (type) {
|
4942 | var factory = ReactElement.createElement.bind(null, type);
|
4943 |
|
4944 |
|
4945 |
|
4946 |
|
4947 |
|
4948 | factory.type = type;
|
4949 | return factory;
|
4950 | };
|
4951 |
|
4952 | ReactElement.cloneAndReplaceKey = function (oldElement, newKey) {
|
4953 | var newElement = ReactElement(oldElement.type, newKey, oldElement.ref, oldElement._self, oldElement._source, oldElement._owner, oldElement.props);
|
4954 |
|
4955 | return newElement;
|
4956 | };
|
4957 |
|
4958 | ReactElement.cloneAndReplaceProps = function (oldElement, newProps) {
|
4959 | var newElement = ReactElement(oldElement.type, oldElement.key, oldElement.ref, oldElement._self, oldElement._source, oldElement._owner, newProps);
|
4960 |
|
4961 | if (process.env.NODE_ENV !== 'production') {
|
4962 |
|
4963 | newElement._store.validated = oldElement._store.validated;
|
4964 | }
|
4965 |
|
4966 | return newElement;
|
4967 | };
|
4968 |
|
4969 | ReactElement.cloneElement = function (element, config, children) {
|
4970 | var propName;
|
4971 |
|
4972 |
|
4973 | var props = assign({}, element.props);
|
4974 |
|
4975 |
|
4976 | var key = element.key;
|
4977 | var ref = element.ref;
|
4978 |
|
4979 | var self = element._self;
|
4980 |
|
4981 |
|
4982 |
|
4983 | var source = element._source;
|
4984 |
|
4985 |
|
4986 | var owner = element._owner;
|
4987 |
|
4988 | if (config != null) {
|
4989 | if (config.ref !== undefined) {
|
4990 |
|
4991 | ref = config.ref;
|
4992 | owner = ReactCurrentOwner.current;
|
4993 | }
|
4994 | if (config.key !== undefined) {
|
4995 | key = '' + config.key;
|
4996 | }
|
4997 |
|
4998 | for (propName in config) {
|
4999 | if (config.hasOwnProperty(propName) && !RESERVED_PROPS.hasOwnProperty(propName)) {
|
5000 | props[propName] = config[propName];
|
5001 | }
|
5002 | }
|
5003 | }
|
5004 |
|
5005 |
|
5006 |
|
5007 | var childrenLength = arguments.length - 2;
|
5008 | if (childrenLength === 1) {
|
5009 | props.children = children;
|
5010 | } else if (childrenLength > 1) {
|
5011 | var childArray = Array(childrenLength);
|
5012 | for (var i = 0; i < childrenLength; i++) {
|
5013 | childArray[i] = arguments[i + 2];
|
5014 | }
|
5015 | props.children = childArray;
|
5016 | }
|
5017 |
|
5018 | return ReactElement(element.type, key, ref, self, source, owner, props);
|
5019 | };
|
5020 |
|
5021 | |
5022 |
|
5023 |
|
5024 |
|
5025 |
|
5026 | ReactElement.isValidElement = function (object) {
|
5027 | return typeof object === 'object' && object !== null && object.$$typeof === REACT_ELEMENT_TYPE;
|
5028 | };
|
5029 |
|
5030 | module.exports = ReactElement;
|
5031 | }.call(exports, __webpack_require__(5)))
|
5032 |
|
5033 | },
|
5034 |
|
5035 | function(module, exports, __webpack_require__) {
|
5036 |
|
5037 | (function(process) { |
5038 |
|
5039 |
|
5040 |
|
5041 |
|
5042 |
|
5043 |
|
5044 |
|
5045 |
|
5046 |
|
5047 |
|
5048 | 'use strict';
|
5049 |
|
5050 | var canDefineProperty = false;
|
5051 | if (process.env.NODE_ENV !== 'production') {
|
5052 | try {
|
5053 | Object.defineProperty({}, 'x', { get: function () {} });
|
5054 | canDefineProperty = true;
|
5055 | } catch (x) {
|
5056 |
|
5057 | }
|
5058 | }
|
5059 |
|
5060 | module.exports = canDefineProperty;
|
5061 | }.call(exports, __webpack_require__(5)))
|
5062 |
|
5063 | },
|
5064 |
|
5065 | function(module, exports) {
|
5066 |
|
5067 | |
5068 |
|
5069 |
|
5070 |
|
5071 |
|
5072 |
|
5073 |
|
5074 |
|
5075 |
|
5076 |
|
5077 |
|
5078 | 'use strict';
|
5079 |
|
5080 |
|
5081 |
|
5082 | var nullComponentIDsRegistry = {};
|
5083 |
|
5084 | |
5085 |
|
5086 |
|
5087 |
|
5088 | function isNullComponentID(id) {
|
5089 | return !!nullComponentIDsRegistry[id];
|
5090 | }
|
5091 |
|
5092 | |
5093 |
|
5094 |
|
5095 |
|
5096 | function registerNullComponentID(id) {
|
5097 | nullComponentIDsRegistry[id] = true;
|
5098 | }
|
5099 |
|
5100 | |
5101 |
|
5102 |
|
5103 |
|
5104 | function deregisterNullComponentID(id) {
|
5105 | delete nullComponentIDsRegistry[id];
|
5106 | }
|
5107 |
|
5108 | var ReactEmptyComponentRegistry = {
|
5109 | isNullComponentID: isNullComponentID,
|
5110 | registerNullComponentID: registerNullComponentID,
|
5111 | deregisterNullComponentID: deregisterNullComponentID
|
5112 | };
|
5113 |
|
5114 | module.exports = ReactEmptyComponentRegistry;
|
5115 |
|
5116 | },
|
5117 |
|
5118 | function(module, exports, __webpack_require__) {
|
5119 |
|
5120 | (function(process) { |
5121 |
|
5122 |
|
5123 |
|
5124 |
|
5125 |
|
5126 |
|
5127 |
|
5128 |
|
5129 |
|
5130 |
|
5131 |
|
5132 | 'use strict';
|
5133 |
|
5134 | var ReactRootIndex = __webpack_require__(47);
|
5135 |
|
5136 | var invariant = __webpack_require__(14);
|
5137 |
|
5138 | var SEPARATOR = '.';
|
5139 | var SEPARATOR_LENGTH = SEPARATOR.length;
|
5140 |
|
5141 | |
5142 |
|
5143 |
|
5144 | var MAX_TREE_DEPTH = 10000;
|
5145 |
|
5146 | |
5147 |
|
5148 |
|
5149 |
|
5150 |
|
5151 |
|
5152 |
|
5153 | function getReactRootIDString(index) {
|
5154 | return SEPARATOR + index.toString(36);
|
5155 | }
|
5156 |
|
5157 | |
5158 |
|
5159 |
|
5160 |
|
5161 |
|
5162 |
|
5163 |
|
5164 |
|
5165 | function isBoundary(id, index) {
|
5166 | return id.charAt(index) === SEPARATOR || index === id.length;
|
5167 | }
|
5168 |
|
5169 | |
5170 |
|
5171 |
|
5172 |
|
5173 |
|
5174 |
|
5175 |
|
5176 | function isValidID(id) {
|
5177 | return id === '' || id.charAt(0) === SEPARATOR && id.charAt(id.length - 1) !== SEPARATOR;
|
5178 | }
|
5179 |
|
5180 | |
5181 |
|
5182 |
|
5183 |
|
5184 |
|
5185 |
|
5186 |
|
5187 |
|
5188 | function isAncestorIDOf(ancestorID, descendantID) {
|
5189 | return descendantID.indexOf(ancestorID) === 0 && isBoundary(descendantID, ancestorID.length);
|
5190 | }
|
5191 |
|
5192 | |
5193 |
|
5194 |
|
5195 |
|
5196 |
|
5197 |
|
5198 |
|
5199 | function getParentID(id) {
|
5200 | return id ? id.substr(0, id.lastIndexOf(SEPARATOR)) : '';
|
5201 | }
|
5202 |
|
5203 | |
5204 |
|
5205 |
|
5206 |
|
5207 |
|
5208 |
|
5209 |
|
5210 |
|
5211 |
|
5212 | function getNextDescendantID(ancestorID, destinationID) {
|
5213 | !(isValidID(ancestorID) && isValidID(destinationID)) ? process.env.NODE_ENV !== 'production' ? invariant(false, 'getNextDescendantID(%s, %s): Received an invalid React DOM ID.', ancestorID, destinationID) : invariant(false) : undefined;
|
5214 | !isAncestorIDOf(ancestorID, destinationID) ? process.env.NODE_ENV !== 'production' ? invariant(false, 'getNextDescendantID(...): React has made an invalid assumption about ' + 'the DOM hierarchy. Expected `%s` to be an ancestor of `%s`.', ancestorID, destinationID) : invariant(false) : undefined;
|
5215 | if (ancestorID === destinationID) {
|
5216 | return ancestorID;
|
5217 | }
|
5218 |
|
5219 |
|
5220 | var start = ancestorID.length + SEPARATOR_LENGTH;
|
5221 | var i;
|
5222 | for (i = start; i < destinationID.length; i++) {
|
5223 | if (isBoundary(destinationID, i)) {
|
5224 | break;
|
5225 | }
|
5226 | }
|
5227 | return destinationID.substr(0, i);
|
5228 | }
|
5229 |
|
5230 | |
5231 |
|
5232 |
|
5233 |
|
5234 |
|
5235 |
|
5236 |
|
5237 |
|
5238 |
|
5239 |
|
5240 |
|
5241 | function getFirstCommonAncestorID(oneID, twoID) {
|
5242 | var minLength = Math.min(oneID.length, twoID.length);
|
5243 | if (minLength === 0) {
|
5244 | return '';
|
5245 | }
|
5246 | var lastCommonMarkerIndex = 0;
|
5247 |
|
5248 | for (var i = 0; i <= minLength; i++) {
|
5249 | if (isBoundary(oneID, i) && isBoundary(twoID, i)) {
|
5250 | lastCommonMarkerIndex = i;
|
5251 | } else if (oneID.charAt(i) !== twoID.charAt(i)) {
|
5252 | break;
|
5253 | }
|
5254 | }
|
5255 | var longestCommonID = oneID.substr(0, lastCommonMarkerIndex);
|
5256 | !isValidID(longestCommonID) ? process.env.NODE_ENV !== 'production' ? invariant(false, 'getFirstCommonAncestorID(%s, %s): Expected a valid React DOM ID: %s', oneID, twoID, longestCommonID) : invariant(false) : undefined;
|
5257 | return longestCommonID;
|
5258 | }
|
5259 |
|
5260 | |
5261 |
|
5262 |
|
5263 |
|
5264 |
|
5265 |
|
5266 |
|
5267 |
|
5268 |
|
5269 |
|
5270 |
|
5271 |
|
5272 |
|
5273 | function traverseParentPath(start, stop, cb, arg, skipFirst, skipLast) {
|
5274 | start = start || '';
|
5275 | stop = stop || '';
|
5276 | !(start !== stop) ? process.env.NODE_ENV !== 'production' ? invariant(false, 'traverseParentPath(...): Cannot traverse from and to the same ID, `%s`.', start) : invariant(false) : undefined;
|
5277 | var traverseUp = isAncestorIDOf(stop, start);
|
5278 | !(traverseUp || isAncestorIDOf(start, stop)) ? process.env.NODE_ENV !== 'production' ? invariant(false, 'traverseParentPath(%s, %s, ...): Cannot traverse from two IDs that do ' + 'not have a parent path.', start, stop) : invariant(false) : undefined;
|
5279 |
|
5280 | var depth = 0;
|
5281 | var traverse = traverseUp ? getParentID : getNextDescendantID;
|
5282 | for (var id = start;; id = traverse(id, stop)) {
|
5283 | var ret;
|
5284 | if ((!skipFirst || id !== start) && (!skipLast || id !== stop)) {
|
5285 | ret = cb(id, traverseUp, arg);
|
5286 | }
|
5287 | if (ret === false || id === stop) {
|
5288 |
|
5289 | break;
|
5290 | }
|
5291 | !(depth++ < MAX_TREE_DEPTH) ? process.env.NODE_ENV !== 'production' ? invariant(false, 'traverseParentPath(%s, %s, ...): Detected an infinite loop while ' + 'traversing the React DOM ID tree. This may be due to malformed IDs: %s', start, stop, id) : invariant(false) : undefined;
|
5292 | }
|
5293 | }
|
5294 |
|
5295 | /**
|
5296 | * Manages the IDs assigned to DOM representations of React components. This
|
5297 | * uses a specific scheme in order to traverse the DOM efficiently (e.g. in
|
5298 | * order to simulate events).
|
5299 | *
|
5300 | * @internal
|
5301 | */
|
5302 | var ReactInstanceHandles = {
|
5303 |
|
5304 | /**
|
5305 | * Constructs a React root ID
|
5306 | * @return {string} A React root ID.
|
5307 | */
|
5308 | createReactRootID: function () {
|
5309 | return getReactRootIDString(ReactRootIndex.createReactRootIndex());
|
5310 | },
|
5311 |
|
5312 | /**
|
5313 | * Constructs a React ID by joining a root ID with a name.
|
5314 | *
|
5315 | * @param {string} rootID Root ID of a parent component.
|
5316 | * @param {string} name A component's name (as flattened children).
|
5317 | * @return {string} A React ID.
|
5318 | * @internal
|
5319 | */
|
5320 | createReactID: function (rootID, name) {
|
5321 | return rootID + name;
|
5322 | },
|
5323 |
|
5324 | /**
|
5325 | * Gets the DOM ID of the React component that is the root of the tree that
|
5326 | * contains the React component with the supplied DOM ID.
|
5327 | *
|
5328 | * @param {string} id DOM ID of a React component.
|
5329 | * @return {?string} DOM ID of the React component that is the root.
|
5330 | * @internal
|
5331 | */
|
5332 | getReactRootIDFromNodeID: function (id) {
|
5333 | if (id && id.charAt(0) === SEPARATOR && id.length > 1) {
|
5334 | var index = id.indexOf(SEPARATOR, 1);
|
5335 | return index > -1 ? id.substr(0, index) : id;
|
5336 | }
|
5337 | return null;
|
5338 | },
|
5339 |
|
5340 | /**
|
5341 | * Traverses the ID hierarchy and invokes the supplied `cb` on any IDs that
|
5342 | * should would receive a `mouseEnter` or `mouseLeave` event.
|
5343 | *
|
5344 | * NOTE: Does not invoke the callback on the nearest common ancestor because
|
5345 | * nothing "entered" or "left" that element.
|
5346 | *
|
5347 | * @param {string} leaveID ID being left.
|
5348 | * @param {string} enterID ID being entered.
|
5349 | * @param {function} cb Callback to invoke on each entered/left ID.
|
5350 | * @param {*} upArg Argument to invoke the callback with on left IDs.
|
5351 | * @param {*} downArg Argument to invoke the callback with on entered IDs.
|
5352 | * @internal
|
5353 | */
|
5354 | traverseEnterLeave: function (leaveID, enterID, cb, upArg, downArg) {
|
5355 | var ancestorID = getFirstCommonAncestorID(leaveID, enterID);
|
5356 | if (ancestorID !== leaveID) {
|
5357 | traverseParentPath(leaveID, ancestorID, cb, upArg, false, true);
|
5358 | }
|
5359 | if (ancestorID !== enterID) {
|
5360 | traverseParentPath(ancestorID, enterID, cb, downArg, true, false);
|
5361 | }
|
5362 | },
|
5363 |
|
5364 | /**
|
5365 | * Simulates the traversal of a two-phase, capture/bubble event dispatch.
|
5366 | *
|
5367 | * NOTE: This traversal happens on IDs without touching the DOM.
|
5368 | *
|
5369 | * @param {string} targetID ID of the target node.
|
5370 | * @param {function} cb Callback to invoke.
|
5371 | * @param {*} arg Argument to invoke the callback with.
|
5372 | * @internal
|
5373 | */
|
5374 | traverseTwoPhase: function (targetID, cb, arg) {
|
5375 | if (targetID) {
|
5376 | traverseParentPath('', targetID, cb, arg, true, false);
|
5377 | traverseParentPath(targetID, '', cb, arg, false, true);
|
5378 | }
|
5379 | },
|
5380 |
|
5381 | /**
|
5382 | * Same as `traverseTwoPhase` but skips the `targetID`.
|
5383 | */
|
5384 | traverseTwoPhaseSkipTarget: function (targetID, cb, arg) {
|
5385 | if (targetID) {
|
5386 | traverseParentPath('', targetID, cb, arg, true, true);
|
5387 | traverseParentPath(targetID, '', cb, arg, true, true);
|
5388 | }
|
5389 | },
|
5390 |
|
5391 | /**
|
5392 | * Traverse a node ID, calling the supplied `cb` for each ancestor ID. For
|
5393 | * example, passing `.0.$row-0.1` would result in `cb` getting called
|
5394 | * with `.0`, `.0.$row-0`, and `.0.$row-0.1`.
|
5395 | *
|
5396 | * NOTE: This traversal happens on IDs without touching the DOM.
|
5397 | *
|
5398 | * @param {string} targetID ID of the target node.
|
5399 | * @param {function} cb Callback to invoke.
|
5400 | * @param {*} arg Argument to invoke the callback with.
|
5401 | * @internal
|
5402 | */
|
5403 | traverseAncestors: function (targetID, cb, arg) {
|
5404 | traverseParentPath('', targetID, cb, arg, true, false);
|
5405 | },
|
5406 |
|
5407 | getFirstCommonAncestorID: getFirstCommonAncestorID,
|
5408 |
|
5409 | /**
|
5410 | * Exposed for unit testing.
|
5411 | * @private
|
5412 | */
|
5413 | _getNextDescendantID: getNextDescendantID,
|
5414 |
|
5415 | isAncestorIDOf: isAncestorIDOf,
|
5416 |
|
5417 | SEPARATOR: SEPARATOR
|
5418 |
|
5419 | };
|
5420 |
|
5421 | module.exports = ReactInstanceHandles;
|
5422 | /* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(5)))
|
5423 |
|
5424 | /***/ },
|
5425 | /* 47 */
|
5426 | /***/ function(module, exports) {
|
5427 |
|
5428 | /**
|
5429 | * Copyright 2013-2015, Facebook, Inc.
|
5430 | * All rights reserved.
|
5431 | *
|
5432 | * This source code is licensed under the BSD-style license found in the
|
5433 | * LICENSE file in the root directory of this source tree. An additional grant
|
5434 | * of patent rights can be found in the PATENTS file in the same directory.
|
5435 | *
|
5436 | * @providesModule ReactRootIndex
|
5437 | * @typechecks
|
5438 | */
|
5439 |
|
5440 | 'use strict';
|
5441 |
|
5442 | var ReactRootIndexInjection = {
|
5443 | /**
|
5444 | * @param {function} _createReactRootIndex
|
5445 | */
|
5446 | injectCreateReactRootIndex: function (_createReactRootIndex) {
|
5447 | ReactRootIndex.createReactRootIndex = _createReactRootIndex;
|
5448 | }
|
5449 | };
|
5450 |
|
5451 | var ReactRootIndex = {
|
5452 | createReactRootIndex: null,
|
5453 | injection: ReactRootIndexInjection
|
5454 | };
|
5455 |
|
5456 | module.exports = ReactRootIndex;
|
5457 |
|
5458 | /***/ },
|
5459 | /* 48 */
|
5460 | /***/ function(module, exports) {
|
5461 |
|
5462 | /**
|
5463 | * Copyright 2013-2015, Facebook, Inc.
|
5464 | * All rights reserved.
|
5465 | *
|
5466 | * This source code is licensed under the BSD-style license found in the
|
5467 | * LICENSE file in the root directory of this source tree. An additional grant
|
5468 | * of patent rights can be found in the PATENTS file in the same directory.
|
5469 | *
|
5470 | * @providesModule ReactInstanceMap
|
5471 | */
|
5472 |
|
5473 | 'use strict';
|
5474 |
|
5475 | /**
|
5476 | * `ReactInstanceMap` maintains a mapping from a public facing stateful
|
5477 | * instance (key) and the internal representation (value). This allows public
|
5478 | * methods to accept the user facing instance as an argument and map them back
|
5479 | * to internal methods.
|
5480 | */
|
5481 |
|
5482 | // TODO: Replace this with ES6: var ReactInstanceMap = new Map();
|
5483 | var ReactInstanceMap = {
|
5484 |
|
5485 | /**
|
5486 | * This API should be called `delete` but we'd have to make sure to always
|
5487 | * transform these to strings for IE support. When this transform is fully
|
5488 | * supported we can rename it.
|
5489 | */
|
5490 | remove: function (key) {
|
5491 | key._reactInternalInstance = undefined;
|
5492 | },
|
5493 |
|
5494 | get: function (key) {
|
5495 | return key._reactInternalInstance;
|
5496 | },
|
5497 |
|
5498 | has: function (key) {
|
5499 | return key._reactInternalInstance !== undefined;
|
5500 | },
|
5501 |
|
5502 | set: function (key, value) {
|
5503 | key._reactInternalInstance = value;
|
5504 | }
|
5505 |
|
5506 | };
|
5507 |
|
5508 | module.exports = ReactInstanceMap;
|
5509 |
|
5510 | /***/ },
|
5511 | /* 49 */
|
5512 | /***/ function(module, exports, __webpack_require__) {
|
5513 |
|
5514 | /**
|
5515 | * Copyright 2013-2015, Facebook, Inc.
|
5516 | * All rights reserved.
|
5517 | *
|
5518 | * This source code is licensed under the BSD-style license found in the
|
5519 | * LICENSE file in the root directory of this source tree. An additional grant
|
5520 | * of patent rights can be found in the PATENTS file in the same directory.
|
5521 | *
|
5522 | * @providesModule ReactMarkupChecksum
|
5523 | */
|
5524 |
|
5525 | 'use strict';
|
5526 |
|
5527 | var adler32 = __webpack_require__(50);
|
5528 |
|
5529 | var TAG_END = /\/?>/;
|
5530 |
|
5531 | var ReactMarkupChecksum = {
|
5532 | CHECKSUM_ATTR_NAME: 'data-react-checksum',
|
5533 |
|
5534 | /**
|
5535 | * @param {string} markup Markup string
|
5536 | * @return {string} Markup string with checksum attribute attached
|
5537 | */
|
5538 | addChecksumToMarkup: function (markup) {
|
5539 | var checksum = adler32(markup);
|
5540 |
|
5541 | // Add checksum (handle both parent tags and self-closing tags)
|
5542 | return markup.replace(TAG_END, ' ' + ReactMarkupChecksum.CHECKSUM_ATTR_NAME + '="' + checksum + '"$&');
|
5543 | },
|
5544 |
|
5545 | /**
|
5546 | * @param {string} markup to use
|
5547 | * @param {DOMElement} element root React element
|
5548 | * @returns {boolean} whether or not the markup is the same
|
5549 | */
|
5550 | canReuseMarkup: function (markup, element) {
|
5551 | var existingChecksum = element.getAttribute(ReactMarkupChecksum.CHECKSUM_ATTR_NAME);
|
5552 | existingChecksum = existingChecksum && parseInt(existingChecksum, 10);
|
5553 | var markupChecksum = adler32(markup);
|
5554 | return markupChecksum === existingChecksum;
|
5555 | }
|
5556 | };
|
5557 |
|
5558 | module.exports = ReactMarkupChecksum;
|
5559 |
|
5560 | /***/ },
|
5561 | /* 50 */
|
5562 | /***/ function(module, exports) {
|
5563 |
|
5564 | /**
|
5565 | * Copyright 2013-2015, Facebook, Inc.
|
5566 | * All rights reserved.
|
5567 | *
|
5568 | * This source code is licensed under the BSD-style license found in the
|
5569 | * LICENSE file in the root directory of this source tree. An additional grant
|
5570 | * of patent rights can be found in the PATENTS file in the same directory.
|
5571 | *
|
5572 | * @providesModule adler32
|
5573 | */
|
5574 |
|
5575 | 'use strict';
|
5576 |
|
5577 | var MOD = 65521;
|
5578 |
|
5579 | // adler32 is not cryptographically strong, and is only used to sanity check that
|
5580 | // markup generated on the server matches the markup generated on the client.
|
5581 | // This implementation (a modified version of the SheetJS version) has been optimized
|
5582 | // for our use case, at the expense of conforming to the adler32 specification
|
5583 | // for non-ascii inputs.
|
5584 | function adler32(data) {
|
5585 | var a = 1;
|
5586 | var b = 0;
|
5587 | var i = 0;
|
5588 | var l = data.length;
|
5589 | var m = l & ~0x3;
|
5590 | while (i < m) {
|
5591 | for (; i < Math.min(i + 4096, m); i += 4) {
|
5592 | b += (a += data.charCodeAt(i)) + (a += data.charCodeAt(i + 1)) + (a += data.charCodeAt(i + 2)) + (a += data.charCodeAt(i + 3));
|
5593 | }
|
5594 | a %= MOD;
|
5595 | b %= MOD;
|
5596 | }
|
5597 | for (; i < l; i++) {
|
5598 | b += a += data.charCodeAt(i);
|
5599 | }
|
5600 | a %= MOD;
|
5601 | b %= MOD;
|
5602 | return a | b << 16;
|
5603 | }
|
5604 |
|
5605 | module.exports = adler32;
|
5606 |
|
5607 | /***/ },
|
5608 | /* 51 */
|
5609 | /***/ function(module, exports, __webpack_require__) {
|
5610 |
|
5611 | /**
|
5612 | * Copyright 2013-2015, Facebook, Inc.
|
5613 | * All rights reserved.
|
5614 | *
|
5615 | * This source code is licensed under the BSD-style license found in the
|
5616 | * LICENSE file in the root directory of this source tree. An additional grant
|
5617 | * of patent rights can be found in the PATENTS file in the same directory.
|
5618 | *
|
5619 | * @providesModule ReactReconciler
|
5620 | */
|
5621 |
|
5622 | 'use strict';
|
5623 |
|
5624 | var ReactRef = __webpack_require__(52);
|
5625 |
|
5626 | /**
|
5627 | * Helper to call ReactRef.attachRefs with this composite component, split out
|
5628 | * to avoid allocations in the transaction mount-ready queue.
|
5629 | */
|
5630 | function attachRefs() {
|
5631 | ReactRef.attachRefs(this, this._currentElement);
|
5632 | }
|
5633 |
|
5634 | var ReactReconciler = {
|
5635 |
|
5636 | /**
|
5637 | * Initializes the component, renders markup, and registers event listeners.
|
5638 | *
|
5639 | * @param {ReactComponent} internalInstance
|
5640 | * @param {string} rootID DOM ID of the root node.
|
5641 | * @param {ReactReconcileTransaction|ReactServerRenderingTransaction} transaction
|
5642 | * @return {?string} Rendered markup to be inserted into the DOM.
|
5643 | * @final
|
5644 | * @internal
|
5645 | */
|
5646 | mountComponent: function (internalInstance, rootID, transaction, context) {
|
5647 | var markup = internalInstance.mountComponent(rootID, transaction, context);
|
5648 | if (internalInstance._currentElement && internalInstance._currentElement.ref != null) {
|
5649 | transaction.getReactMountReady().enqueue(attachRefs, internalInstance);
|
5650 | }
|
5651 | return markup;
|
5652 | },
|
5653 |
|
5654 | /**
|
5655 | * Releases any resources allocated by `mountComponent`.
|
5656 | *
|
5657 | * @final
|
5658 | * @internal
|
5659 | */
|
5660 | unmountComponent: function (internalInstance) {
|
5661 | ReactRef.detachRefs(internalInstance, internalInstance._currentElement);
|
5662 | internalInstance.unmountComponent();
|
5663 | },
|
5664 |
|
5665 | /**
|
5666 | * Update a component using a new element.
|
5667 | *
|
5668 | * @param {ReactComponent} internalInstance
|
5669 | * @param {ReactElement} nextElement
|
5670 | * @param {ReactReconcileTransaction} transaction
|
5671 | * @param {object} context
|
5672 | * @internal
|
5673 | */
|
5674 | receiveComponent: function (internalInstance, nextElement, transaction, context) {
|
5675 | var prevElement = internalInstance._currentElement;
|
5676 |
|
5677 | if (nextElement === prevElement && context === internalInstance._context) {
|
5678 | // Since elements are immutable after the owner is rendered,
|
5679 | // we can do a cheap identity compare here to determine if this is a
|
5680 | // superfluous reconcile. It's possible for state to be mutable but such
|
5681 | // change should trigger an update of the owner which would recreate
|
5682 | // the element. We explicitly check for the existence of an owner since
|
5683 | // it's possible for an element created outside a composite to be
|
5684 | // deeply mutated and reused.
|
5685 |
|
5686 | // TODO: Bailing out early is just a perf optimization right?
|
5687 | // TODO: Removing the return statement should affect correctness?
|
5688 | return;
|
5689 | }
|
5690 |
|
5691 | var refsChanged = ReactRef.shouldUpdateRefs(prevElement, nextElement);
|
5692 |
|
5693 | if (refsChanged) {
|
5694 | ReactRef.detachRefs(internalInstance, prevElement);
|
5695 | }
|
5696 |
|
5697 | internalInstance.receiveComponent(nextElement, transaction, context);
|
5698 |
|
5699 | if (refsChanged && internalInstance._currentElement && internalInstance._currentElement.ref != null) {
|
5700 | transaction.getReactMountReady().enqueue(attachRefs, internalInstance);
|
5701 | }
|
5702 | },
|
5703 |
|
5704 | /**
|
5705 | * Flush any dirty changes in a component.
|
5706 | *
|
5707 | * @param {ReactComponent} internalInstance
|
5708 | * @param {ReactReconcileTransaction} transaction
|
5709 | * @internal
|
5710 | */
|
5711 | performUpdateIfNecessary: function (internalInstance, transaction) {
|
5712 | internalInstance.performUpdateIfNecessary(transaction);
|
5713 | }
|
5714 |
|
5715 | };
|
5716 |
|
5717 | module.exports = ReactReconciler;
|
5718 |
|
5719 | /***/ },
|
5720 | /* 52 */
|
5721 | /***/ function(module, exports, __webpack_require__) {
|
5722 |
|
5723 | /**
|
5724 | * Copyright 2013-2015, Facebook, Inc.
|
5725 | * All rights reserved.
|
5726 | *
|
5727 | * This source code is licensed under the BSD-style license found in the
|
5728 | * LICENSE file in the root directory of this source tree. An additional grant
|
5729 | * of patent rights can be found in the PATENTS file in the same directory.
|
5730 | *
|
5731 | * @providesModule ReactRef
|
5732 | */
|
5733 |
|
5734 | 'use strict';
|
5735 |
|
5736 | var ReactOwner = __webpack_require__(53);
|
5737 |
|
5738 | var ReactRef = {};
|
5739 |
|
5740 | function attachRef(ref, component, owner) {
|
5741 | if (typeof ref === 'function') {
|
5742 | ref(component.getPublicInstance());
|
5743 | } else {
|
5744 | // Legacy ref
|
5745 | ReactOwner.addComponentAsRefTo(component, ref, owner);
|
5746 | }
|
5747 | }
|
5748 |
|
5749 | function detachRef(ref, component, owner) {
|
5750 | if (typeof ref === 'function') {
|
5751 | ref(null);
|
5752 | } else {
|
5753 | // Legacy ref
|
5754 | ReactOwner.removeComponentAsRefFrom(component, ref, owner);
|
5755 | }
|
5756 | }
|
5757 |
|
5758 | ReactRef.attachRefs = function (instance, element) {
|
5759 | if (element === null || element === false) {
|
5760 | return;
|
5761 | }
|
5762 | var ref = element.ref;
|
5763 | if (ref != null) {
|
5764 | attachRef(ref, instance, element._owner);
|
5765 | }
|
5766 | };
|
5767 |
|
5768 | ReactRef.shouldUpdateRefs = function (prevElement, nextElement) {
|
5769 | // If either the owner or a `ref` has changed, make sure the newest owner
|
5770 | // has stored a reference to `this`, and the previous owner (if different)
|
5771 | // has forgotten the reference to `this`. We use the element instead
|
5772 | // of the public this.props because the post processing cannot determine
|
5773 | // a ref. The ref conceptually lives on the element.
|
5774 |
|
5775 | // TODO: Should this even be possible? The owner cannot change because
|
5776 | // it's forbidden by shouldUpdateReactComponent. The ref can change
|
5777 | // if you swap the keys of but not the refs. Reconsider where this check
|
5778 | // is made. It probably belongs where the key checking and
|
5779 | // instantiateReactComponent is done.
|
5780 |
|
5781 | var prevEmpty = prevElement === null || prevElement === false;
|
5782 | var nextEmpty = nextElement === null || nextElement === false;
|
5783 |
|
5784 | return(
|
5785 | // This has a few false positives w/r/t empty components.
|
5786 | prevEmpty || nextEmpty || nextElement._owner !== prevElement._owner || nextElement.ref !== prevElement.ref
|
5787 | );
|
5788 | };
|
5789 |
|
5790 | ReactRef.detachRefs = function (instance, element) {
|
5791 | if (element === null || element === false) {
|
5792 | return;
|
5793 | }
|
5794 | var ref = element.ref;
|
5795 | if (ref != null) {
|
5796 | detachRef(ref, instance, element._owner);
|
5797 | }
|
5798 | };
|
5799 |
|
5800 | module.exports = ReactRef;
|
5801 |
|
5802 | /***/ },
|
5803 | /* 53 */
|
5804 | /***/ function(module, exports, __webpack_require__) {
|
5805 |
|
5806 | /* WEBPACK VAR INJECTION */(function(process) {/**
|
5807 | * Copyright 2013-2015, Facebook, Inc.
|
5808 | * All rights reserved.
|
5809 | *
|
5810 | * This source code is licensed under the BSD-style license found in the
|
5811 | * LICENSE file in the root directory of this source tree. An additional grant
|
5812 | * of patent rights can be found in the PATENTS file in the same directory.
|
5813 | *
|
5814 | * @providesModule ReactOwner
|
5815 | */
|
5816 |
|
5817 | 'use strict';
|
5818 |
|
5819 | var invariant = __webpack_require__(14);
|
5820 |
|
5821 | /**
|
5822 | * ReactOwners are capable of storing references to owned components.
|
5823 | *
|
5824 | * All components are capable of //being// referenced by owner components, but
|
5825 | * only ReactOwner components are capable of //referencing// owned components.
|
5826 | * The named reference is known as a "ref".
|
5827 | *
|
5828 | * Refs are available when mounted and updated during reconciliation.
|
5829 | *
|
5830 | * var MyComponent = React.createClass({
|
5831 | * render: function() {
|
5832 | * return (
|
5833 | * <div onClick={this.handleClick}>
|
5834 | * <CustomComponent ref="custom" />
|
5835 | * </div>
|
5836 | * );
|
5837 | * },
|
5838 | * handleClick: function() {
|
5839 | * this.refs.custom.handleClick();
|
5840 | * },
|
5841 | * componentDidMount: function() {
|
5842 | * this.refs.custom.initialize();
|
5843 | * }
|
5844 | * });
|
5845 | *
|
5846 | * Refs should rarely be used. When refs are used, they should only be done to
|
5847 | * control data that is not handled by React's data flow.
|
5848 | *
|
5849 | * @class ReactOwner
|
5850 | */
|
5851 | var ReactOwner = {
|
5852 |
|
5853 | /**
|
5854 | * @param {?object} object
|
5855 | * @return {boolean} True if `object` is a valid owner.
|
5856 | * @final
|
5857 | */
|
5858 | isValidOwner: function (object) {
|
5859 | return !!(object && typeof object.attachRef === 'function' && typeof object.detachRef === 'function');
|
5860 | },
|
5861 |
|
5862 | /**
|
5863 | * Adds a component by ref to an owner component.
|
5864 | *
|
5865 | * @param {ReactComponent} component Component to reference.
|
5866 | * @param {string} ref Name by which to refer to the component.
|
5867 | * @param {ReactOwner} owner Component on which to record the ref.
|
5868 | * @final
|
5869 | * @internal
|
5870 | */
|
5871 | addComponentAsRefTo: function (component, ref, owner) {
|
5872 | !ReactOwner.isValidOwner(owner) ? process.env.NODE_ENV !== 'production' ? invariant(false, 'addComponentAsRefTo(...): Only a ReactOwner can have refs. You might ' + 'be adding a ref to a component that was not created inside a component\'s ' + '`render` method, or you have multiple copies of React loaded ' + '(details: https://fb.me/react-refs-must-have-owner).') : invariant(false) : undefined;
|
5873 | owner.attachRef(ref, component);
|
5874 | },
|
5875 |
|
5876 | /**
|
5877 | * Removes a component by ref from an owner component.
|
5878 | *
|
5879 | * @param {ReactComponent} component Component to dereference.
|
5880 | * @param {string} ref Name of the ref to remove.
|
5881 | * @param {ReactOwner} owner Component on which the ref is recorded.
|
5882 | * @final
|
5883 | * @internal
|
5884 | */
|
5885 | removeComponentAsRefFrom: function (component, ref, owner) {
|
5886 | !ReactOwner.isValidOwner(owner) ? process.env.NODE_ENV !== 'production' ? invariant(false, 'removeComponentAsRefFrom(...): Only a ReactOwner can have refs. You might ' + 'be removing a ref to a component that was not created inside a component\'s ' + '`render` method, or you have multiple copies of React loaded ' + '(details: https://fb.me/react-refs-must-have-owner).') : invariant(false) : undefined;
|
5887 | // Check that `component` is still the current ref because we do not want to
|
5888 | // detach the ref if another component stole it.
|
5889 | if (owner.getPublicInstance().refs[ref] === component.getPublicInstance()) {
|
5890 | owner.detachRef(ref);
|
5891 | }
|
5892 | }
|
5893 |
|
5894 | };
|
5895 |
|
5896 | module.exports = ReactOwner;
|
5897 | /* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(5)))
|
5898 |
|
5899 | /***/ },
|
5900 | /* 54 */
|
5901 | /***/ function(module, exports, __webpack_require__) {
|
5902 |
|
5903 | /* WEBPACK VAR INJECTION */(function(process) {/**
|
5904 | * Copyright 2015, Facebook, Inc.
|
5905 | * All rights reserved.
|
5906 | *
|
5907 | * This source code is licensed under the BSD-style license found in the
|
5908 | * LICENSE file in the root directory of this source tree. An additional grant
|
5909 | * of patent rights can be found in the PATENTS file in the same directory.
|
5910 | *
|
5911 | * @providesModule ReactUpdateQueue
|
5912 | */
|
5913 |
|
5914 | 'use strict';
|
5915 |
|
5916 | var ReactCurrentOwner = __webpack_require__(6);
|
5917 | var ReactElement = __webpack_require__(43);
|
5918 | var ReactInstanceMap = __webpack_require__(48);
|
5919 | var ReactUpdates = __webpack_require__(55);
|
5920 |
|
5921 | var assign = __webpack_require__(40);
|
5922 | var invariant = __webpack_require__(14);
|
5923 | var warning = __webpack_require__(26);
|
5924 |
|
5925 | function enqueueUpdate(internalInstance) {
|
5926 | ReactUpdates.enqueueUpdate(internalInstance);
|
5927 | }
|
5928 |
|
5929 | function getInternalInstanceReadyForUpdate(publicInstance, callerName) {
|
5930 | var internalInstance = ReactInstanceMap.get(publicInstance);
|
5931 | if (!internalInstance) {
|
5932 | if (process.env.NODE_ENV !== 'production') {
|
5933 | // Only warn when we have a callerName. Otherwise we should be silent.
|
5934 | // We're probably calling from enqueueCallback. We don't want to warn
|
5935 | // there because we already warned for the corresponding lifecycle method.
|
5936 | process.env.NODE_ENV !== 'production' ? warning(!callerName, '%s(...): Can only update a mounted or mounting component. ' + 'This usually means you called %s() on an unmounted component. ' + 'This is a no-op. Please check the code for the %s component.', callerName, callerName, publicInstance.constructor.displayName) : undefined;
|
5937 | }
|
5938 | return null;
|
5939 | }
|
5940 |
|
5941 | if (process.env.NODE_ENV !== 'production') {
|
5942 | process.env.NODE_ENV !== 'production' ? warning(ReactCurrentOwner.current == null, '%s(...): Cannot update during an existing state transition ' + '(such as within `render`). Render methods should be a pure function ' + 'of props and state.', callerName) : undefined;
|
5943 | }
|
5944 |
|
5945 | return internalInstance;
|
5946 | }
|
5947 |
|
5948 | /**
|
5949 | * ReactUpdateQueue allows for state updates to be scheduled into a later
|
5950 | * reconciliation step.
|
5951 | */
|
5952 | var ReactUpdateQueue = {
|
5953 |
|
5954 | /**
|
5955 | * Checks whether or not this composite component is mounted.
|
5956 | * @param {ReactClass} publicInstance The instance we want to test.
|
5957 | * @return {boolean} True if mounted, false otherwise.
|
5958 | * @protected
|
5959 | * @final
|
5960 | */
|
5961 | isMounted: function (publicInstance) {
|
5962 | if (process.env.NODE_ENV !== 'production') {
|
5963 | var owner = ReactCurrentOwner.current;
|
5964 | if (owner !== null) {
|
5965 | process.env.NODE_ENV !== 'production' ? warning(owner._warnedAboutRefsInRender, '%s is accessing isMounted inside its render() function. ' + 'render() should be a pure function of props and state. It should ' + 'never access something that requires stale data from the previous ' + 'render, such as refs. Move this logic to componentDidMount and ' + 'componentDidUpdate instead.', owner.getName() || 'A component') : undefined;
|
5966 | owner._warnedAboutRefsInRender = true;
|
5967 | }
|
5968 | }
|
5969 | var internalInstance = ReactInstanceMap.get(publicInstance);
|
5970 | if (internalInstance) {
|
5971 | // During componentWillMount and render this will still be null but after
|
5972 | // that will always render to something. At least for now. So we can use
|
5973 | // this hack.
|
5974 | return !!internalInstance._renderedComponent;
|
5975 | } else {
|
5976 | return false;
|
5977 | }
|
5978 | },
|
5979 |
|
5980 | /**
|
5981 | * Enqueue a callback that will be executed after all the pending updates
|
5982 | * have processed.
|
5983 | *
|
5984 | * @param {ReactClass} publicInstance The instance to use as `this` context.
|
5985 | * @param {?function} callback Called after state is updated.
|
5986 | * @internal
|
5987 | */
|
5988 | enqueueCallback: function (publicInstance, callback) {
|
5989 | !(typeof callback === 'function') ? process.env.NODE_ENV !== 'production' ? invariant(false, 'enqueueCallback(...): You called `setProps`, `replaceProps`, ' + '`setState`, `replaceState`, or `forceUpdate` with a callback that ' + 'isn\'t callable.') : invariant(false) : undefined;
|
5990 | var internalInstance = getInternalInstanceReadyForUpdate(publicInstance);
|
5991 |
|
5992 | // Previously we would throw an error if we didn't have an internal
|
5993 | // instance. Since we want to make it a no-op instead, we mirror the same
|
5994 | // behavior we have in other enqueue* methods.
|
5995 | // We also need to ignore callbacks in componentWillMount. See
|
5996 | // enqueueUpdates.
|
5997 | if (!internalInstance) {
|
5998 | return null;
|
5999 | }
|
6000 |
|
6001 | if (internalInstance._pendingCallbacks) {
|
6002 | internalInstance._pendingCallbacks.push(callback);
|
6003 | } else {
|
6004 | internalInstance._pendingCallbacks = [callback];
|
6005 | }
|
6006 | // TODO: The callback here is ignored when setState is called from
|
6007 | // componentWillMount. Either fix it or disallow doing so completely in
|
6008 | // favor of getInitialState. Alternatively, we can disallow
|
6009 | // componentWillMount during server-side rendering.
|
6010 | enqueueUpdate(internalInstance);
|
6011 | },
|
6012 |
|
6013 | enqueueCallbackInternal: function (internalInstance, callback) {
|
6014 | !(typeof callback === 'function') ? process.env.NODE_ENV !== 'production' ? invariant(false, 'enqueueCallback(...): You called `setProps`, `replaceProps`, ' + '`setState`, `replaceState`, or `forceUpdate` with a callback that ' + 'isn\'t callable.') : invariant(false) : undefined;
|
6015 | if (internalInstance._pendingCallbacks) {
|
6016 | internalInstance._pendingCallbacks.push(callback);
|
6017 | } else {
|
6018 | internalInstance._pendingCallbacks = [callback];
|
6019 | }
|
6020 | enqueueUpdate(internalInstance);
|
6021 | },
|
6022 |
|
6023 | /**
|
6024 | * Forces an update. This should only be invoked when it is known with
|
6025 | * certainty that we are **not** in a DOM transaction.
|
6026 | *
|
6027 | * You may want to call this when you know that some deeper aspect of the
|
6028 | * component's state has changed but `setState` was not called.
|
6029 | *
|
6030 | * This will not invoke `shouldComponentUpdate`, but it will invoke
|
6031 | * `componentWillUpdate` and `componentDidUpdate`.
|
6032 | *
|
6033 | * @param {ReactClass} publicInstance The instance that should rerender.
|
6034 | * @internal
|
6035 | */
|
6036 | enqueueForceUpdate: function (publicInstance) {
|
6037 | var internalInstance = getInternalInstanceReadyForUpdate(publicInstance, 'forceUpdate');
|
6038 |
|
6039 | if (!internalInstance) {
|
6040 | return;
|
6041 | }
|
6042 |
|
6043 | internalInstance._pendingForceUpdate = true;
|
6044 |
|
6045 | enqueueUpdate(internalInstance);
|
6046 | },
|
6047 |
|
6048 | /**
|
6049 | * Replaces all of the state. Always use this or `setState` to mutate state.
|
6050 | * You should treat `this.state` as immutable.
|
6051 | *
|
6052 | * There is no guarantee that `this.state` will be immediately updated, so
|
6053 | * accessing `this.state` after calling this method may return the old value.
|
6054 | *
|
6055 | * @param {ReactClass} publicInstance The instance that should rerender.
|
6056 | * @param {object} completeState Next state.
|
6057 | * @internal
|
6058 | */
|
6059 | enqueueReplaceState: function (publicInstance, completeState) {
|
6060 | var internalInstance = getInternalInstanceReadyForUpdate(publicInstance, 'replaceState');
|
6061 |
|
6062 | if (!internalInstance) {
|
6063 | return;
|
6064 | }
|
6065 |
|
6066 | internalInstance._pendingStateQueue = [completeState];
|
6067 | internalInstance._pendingReplaceState = true;
|
6068 |
|
6069 | enqueueUpdate(internalInstance);
|
6070 | },
|
6071 |
|
6072 | /**
|
6073 | * Sets a subset of the state. This only exists because _pendingState is
|
6074 | * internal. This provides a merging strategy that is not available to deep
|
6075 | * properties which is confusing. TODO: Expose pendingState or don't use it
|
6076 | * during the merge.
|
6077 | *
|
6078 | * @param {ReactClass} publicInstance The instance that should rerender.
|
6079 | * @param {object} partialState Next partial state to be merged with state.
|
6080 | * @internal
|
6081 | */
|
6082 | enqueueSetState: function (publicInstance, partialState) {
|
6083 | var internalInstance = getInternalInstanceReadyForUpdate(publicInstance, 'setState');
|
6084 |
|
6085 | if (!internalInstance) {
|
6086 | return;
|
6087 | }
|
6088 |
|
6089 | var queue = internalInstance._pendingStateQueue || (internalInstance._pendingStateQueue = []);
|
6090 | queue.push(partialState);
|
6091 |
|
6092 | enqueueUpdate(internalInstance);
|
6093 | },
|
6094 |
|
6095 | /**
|
6096 | * Sets a subset of the props.
|
6097 | *
|
6098 | * @param {ReactClass} publicInstance The instance that should rerender.
|
6099 | * @param {object} partialProps Subset of the next props.
|
6100 | * @internal
|
6101 | */
|
6102 | enqueueSetProps: function (publicInstance, partialProps) {
|
6103 | var internalInstance = getInternalInstanceReadyForUpdate(publicInstance, 'setProps');
|
6104 | if (!internalInstance) {
|
6105 | return;
|
6106 | }
|
6107 | ReactUpdateQueue.enqueueSetPropsInternal(internalInstance, partialProps);
|
6108 | },
|
6109 |
|
6110 | enqueueSetPropsInternal: function (internalInstance, partialProps) {
|
6111 | var topLevelWrapper = internalInstance._topLevelWrapper;
|
6112 | !topLevelWrapper ? process.env.NODE_ENV !== 'production' ? invariant(false, 'setProps(...): You called `setProps` on a ' + 'component with a parent. This is an anti-pattern since props will ' + 'get reactively updated when rendered. Instead, change the owner\'s ' + '`render` method to pass the correct value as props to the component ' + 'where it is created.') : invariant(false) : undefined;
|
6113 |
|
6114 | // Merge with the pending element if it exists, otherwise with existing
|
6115 | // element props.
|
6116 | var wrapElement = topLevelWrapper._pendingElement || topLevelWrapper._currentElement;
|
6117 | var element = wrapElement.props;
|
6118 | var props = assign({}, element.props, partialProps);
|
6119 | topLevelWrapper._pendingElement = ReactElement.cloneAndReplaceProps(wrapElement, ReactElement.cloneAndReplaceProps(element, props));
|
6120 |
|
6121 | enqueueUpdate(topLevelWrapper);
|
6122 | },
|
6123 |
|
6124 | /**
|
6125 | * Replaces all of the props.
|
6126 | *
|
6127 | * @param {ReactClass} publicInstance The instance that should rerender.
|
6128 | * @param {object} props New props.
|
6129 | * @internal
|
6130 | */
|
6131 | enqueueReplaceProps: function (publicInstance, props) {
|
6132 | var internalInstance = getInternalInstanceReadyForUpdate(publicInstance, 'replaceProps');
|
6133 | if (!internalInstance) {
|
6134 | return;
|
6135 | }
|
6136 | ReactUpdateQueue.enqueueReplacePropsInternal(internalInstance, props);
|
6137 | },
|
6138 |
|
6139 | enqueueReplacePropsInternal: function (internalInstance, props) {
|
6140 | var topLevelWrapper = internalInstance._topLevelWrapper;
|
6141 | !topLevelWrapper ? process.env.NODE_ENV !== 'production' ? invariant(false, 'replaceProps(...): You called `replaceProps` on a ' + 'component with a parent. This is an anti-pattern since props will ' + 'get reactively updated when rendered. Instead, change the owner\'s ' + '`render` method to pass the correct value as props to the component ' + 'where it is created.') : invariant(false) : undefined;
|
6142 |
|
6143 | // Merge with the pending element if it exists, otherwise with existing
|
6144 | // element props.
|
6145 | var wrapElement = topLevelWrapper._pendingElement || topLevelWrapper._currentElement;
|
6146 | var element = wrapElement.props;
|
6147 | topLevelWrapper._pendingElement = ReactElement.cloneAndReplaceProps(wrapElement, ReactElement.cloneAndReplaceProps(element, props));
|
6148 |
|
6149 | enqueueUpdate(topLevelWrapper);
|
6150 | },
|
6151 |
|
6152 | enqueueElementInternal: function (internalInstance, newElement) {
|
6153 | internalInstance._pendingElement = newElement;
|
6154 | enqueueUpdate(internalInstance);
|
6155 | }
|
6156 |
|
6157 | };
|
6158 |
|
6159 | module.exports = ReactUpdateQueue;
|
6160 | /* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(5)))
|
6161 |
|
6162 | /***/ },
|
6163 | /* 55 */
|
6164 | /***/ function(module, exports, __webpack_require__) {
|
6165 |
|
6166 | /* WEBPACK VAR INJECTION */(function(process) {/**
|
6167 | * Copyright 2013-2015, Facebook, Inc.
|
6168 | * All rights reserved.
|
6169 | *
|
6170 | * This source code is licensed under the BSD-style license found in the
|
6171 | * LICENSE file in the root directory of this source tree. An additional grant
|
6172 | * of patent rights can be found in the PATENTS file in the same directory.
|
6173 | *
|
6174 | * @providesModule ReactUpdates
|
6175 | */
|
6176 |
|
6177 | 'use strict';
|
6178 |
|
6179 | var CallbackQueue = __webpack_require__(56);
|
6180 | var PooledClass = __webpack_require__(57);
|
6181 | var ReactPerf = __webpack_require__(19);
|
6182 | var ReactReconciler = __webpack_require__(51);
|
6183 | var Transaction = __webpack_require__(58);
|
6184 |
|
6185 | var assign = __webpack_require__(40);
|
6186 | var invariant = __webpack_require__(14);
|
6187 |
|
6188 | var dirtyComponents = [];
|
6189 | var asapCallbackQueue = CallbackQueue.getPooled();
|
6190 | var asapEnqueued = false;
|
6191 |
|
6192 | var batchingStrategy = null;
|
6193 |
|
6194 | function ensureInjected() {
|
6195 | !(ReactUpdates.ReactReconcileTransaction && batchingStrategy) ? process.env.NODE_ENV !== 'production' ? invariant(false, 'ReactUpdates: must inject a reconcile transaction class and batching ' + 'strategy') : invariant(false) : undefined;
|
6196 | }
|
6197 |
|
6198 | var NESTED_UPDATES = {
|
6199 | initialize: function () {
|
6200 | this.dirtyComponentsLength = dirtyComponents.length;
|
6201 | },
|
6202 | close: function () {
|
6203 | if (this.dirtyComponentsLength !== dirtyComponents.length) {
|
6204 | // Additional updates were enqueued by componentDidUpdate handlers or
|
6205 | // similar; before our own UPDATE_QUEUEING wrapper closes, we want to run
|
6206 | // these new updates so that if A's componentDidUpdate calls setState on
|
6207 | // B, B will update before the callback A's updater provided when calling
|
6208 | // setState.
|
6209 | dirtyComponents.splice(0, this.dirtyComponentsLength);
|
6210 | flushBatchedUpdates();
|
6211 | } else {
|
6212 | dirtyComponents.length = 0;
|
6213 | }
|
6214 | }
|
6215 | };
|
6216 |
|
6217 | var UPDATE_QUEUEING = {
|
6218 | initialize: function () {
|
6219 | this.callbackQueue.reset();
|
6220 | },
|
6221 | close: function () {
|
6222 | this.callbackQueue.notifyAll();
|
6223 | }
|
6224 | };
|
6225 |
|
6226 | var TRANSACTION_WRAPPERS = [NESTED_UPDATES, UPDATE_QUEUEING];
|
6227 |
|
6228 | function ReactUpdatesFlushTransaction() {
|
6229 | this.reinitializeTransaction();
|
6230 | this.dirtyComponentsLength = null;
|
6231 | this.callbackQueue = CallbackQueue.getPooled();
|
6232 | this.reconcileTransaction = ReactUpdates.ReactReconcileTransaction.getPooled( /* forceHTML */false);
|
6233 | }
|
6234 |
|
6235 | assign(ReactUpdatesFlushTransaction.prototype, Transaction.Mixin, {
|
6236 | getTransactionWrappers: function () {
|
6237 | return TRANSACTION_WRAPPERS;
|
6238 | },
|
6239 |
|
6240 | destructor: function () {
|
6241 | this.dirtyComponentsLength = null;
|
6242 | CallbackQueue.release(this.callbackQueue);
|
6243 | this.callbackQueue = null;
|
6244 | ReactUpdates.ReactReconcileTransaction.release(this.reconcileTransaction);
|
6245 | this.reconcileTransaction = null;
|
6246 | },
|
6247 |
|
6248 | perform: function (method, scope, a) {
|
6249 | // Essentially calls `this.reconcileTransaction.perform(method, scope, a)`
|
6250 | // with this transaction's wrappers around it.
|
6251 | return Transaction.Mixin.perform.call(this, this.reconcileTransaction.perform, this.reconcileTransaction, method, scope, a);
|
6252 | }
|
6253 | });
|
6254 |
|
6255 | PooledClass.addPoolingTo(ReactUpdatesFlushTransaction);
|
6256 |
|
6257 | function batchedUpdates(callback, a, b, c, d, e) {
|
6258 | ensureInjected();
|
6259 | batchingStrategy.batchedUpdates(callback, a, b, c, d, e);
|
6260 | }
|
6261 |
|
6262 | /**
|
6263 | * Array comparator for ReactComponents by mount ordering.
|
6264 | *
|
6265 | * @param {ReactComponent} c1 first component you're comparing
|
6266 | * @param {ReactComponent} c2 second component you're comparing
|
6267 | * @return {number} Return value usable by Array.prototype.sort().
|
6268 | */
|
6269 | function mountOrderComparator(c1, c2) {
|
6270 | return c1._mountOrder - c2._mountOrder;
|
6271 | }
|
6272 |
|
6273 | function runBatchedUpdates(transaction) {
|
6274 | var len = transaction.dirtyComponentsLength;
|
6275 | !(len === dirtyComponents.length) ? process.env.NODE_ENV !== 'production' ? invariant(false, 'Expected flush transaction\'s stored dirty-components length (%s) to ' + 'match dirty-components array length (%s).', len, dirtyComponents.length) : invariant(false) : undefined;
|
6276 |
|
6277 | // Since reconciling a component higher in the owner hierarchy usually (not
|
6278 | // always -- see shouldComponentUpdate()) will reconcile children, reconcile
|
6279 | // them before their children by sorting the array.
|
6280 | dirtyComponents.sort(mountOrderComparator);
|
6281 |
|
6282 | for (var i = 0; i < len; i++) {
|
6283 | // If a component is unmounted before pending changes apply, it will still
|
6284 | // be here, but we assume that it has cleared its _pendingCallbacks and
|
6285 | // that performUpdateIfNecessary is a noop.
|
6286 | var component = dirtyComponents[i];
|
6287 |
|
6288 | // If performUpdateIfNecessary happens to enqueue any new updates, we
|
6289 | // shouldn't execute the callbacks until the next render happens, so
|
6290 | // stash the callbacks first
|
6291 | var callbacks = component._pendingCallbacks;
|
6292 | component._pendingCallbacks = null;
|
6293 |
|
6294 | ReactReconciler.performUpdateIfNecessary(component, transaction.reconcileTransaction);
|
6295 |
|
6296 | if (callbacks) {
|
6297 | for (var j = 0; j < callbacks.length; j++) {
|
6298 | transaction.callbackQueue.enqueue(callbacks[j], component.getPublicInstance());
|
6299 | }
|
6300 | }
|
6301 | }
|
6302 | }
|
6303 |
|
6304 | var flushBatchedUpdates = function () {
|
6305 | // ReactUpdatesFlushTransaction's wrappers will clear the dirtyComponents
|
6306 | // array and perform any updates enqueued by mount-ready handlers (i.e.,
|
6307 | // componentDidUpdate) but we need to check here too in order to catch
|
6308 | // updates enqueued by setState callbacks and asap calls.
|
6309 | while (dirtyComponents.length || asapEnqueued) {
|
6310 | if (dirtyComponents.length) {
|
6311 | var transaction = ReactUpdatesFlushTransaction.getPooled();
|
6312 | transaction.perform(runBatchedUpdates, null, transaction);
|
6313 | ReactUpdatesFlushTransaction.release(transaction);
|
6314 | }
|
6315 |
|
6316 | if (asapEnqueued) {
|
6317 | asapEnqueued = false;
|
6318 | var queue = asapCallbackQueue;
|
6319 | asapCallbackQueue = CallbackQueue.getPooled();
|
6320 | queue.notifyAll();
|
6321 | CallbackQueue.release(queue);
|
6322 | }
|
6323 | }
|
6324 | };
|
6325 | flushBatchedUpdates = ReactPerf.measure('ReactUpdates', 'flushBatchedUpdates', flushBatchedUpdates);
|
6326 |
|
6327 | /**
|
6328 | * Mark a component as needing a rerender, adding an optional callback to a
|
6329 | * list of functions which will be executed once the rerender occurs.
|
6330 | */
|
6331 | function enqueueUpdate(component) {
|
6332 | ensureInjected();
|
6333 |
|
6334 | // Various parts of our code (such as ReactCompositeComponent's
|
6335 | // _renderValidatedComponent) assume that calls to render aren't nested;
|
6336 | // verify that that's the case. (This is called by each top-level update
|
6337 | // function, like setProps, setState, forceUpdate, etc.; creation and
|
6338 | // destruction of top-level components is guarded in ReactMount.)
|
6339 |
|
6340 | if (!batchingStrategy.isBatchingUpdates) {
|
6341 | batchingStrategy.batchedUpdates(enqueueUpdate, component);
|
6342 | return;
|
6343 | }
|
6344 |
|
6345 | dirtyComponents.push(component);
|
6346 | }
|
6347 |
|
6348 | /**
|
6349 | * Enqueue a callback to be run at the end of the current batching cycle. Throws
|
6350 | * if no updates are currently being performed.
|
6351 | */
|
6352 | function asap(callback, context) {
|
6353 | !batchingStrategy.isBatchingUpdates ? process.env.NODE_ENV !== 'production' ? invariant(false, 'ReactUpdates.asap: Can\'t enqueue an asap callback in a context where' + 'updates are not being batched.') : invariant(false) : undefined;
|
6354 | asapCallbackQueue.enqueue(callback, context);
|
6355 | asapEnqueued = true;
|
6356 | }
|
6357 |
|
6358 | var ReactUpdatesInjection = {
|
6359 | injectReconcileTransaction: function (ReconcileTransaction) {
|
6360 | !ReconcileTransaction ? process.env.NODE_ENV !== 'production' ? invariant(false, 'ReactUpdates: must provide a reconcile transaction class') : invariant(false) : undefined;
|
6361 | ReactUpdates.ReactReconcileTransaction = ReconcileTransaction;
|
6362 | },
|
6363 |
|
6364 | injectBatchingStrategy: function (_batchingStrategy) {
|
6365 | !_batchingStrategy ? process.env.NODE_ENV !== 'production' ? invariant(false, 'ReactUpdates: must provide a batching strategy') : invariant(false) : undefined;
|
6366 | !(typeof _batchingStrategy.batchedUpdates === 'function') ? process.env.NODE_ENV !== 'production' ? invariant(false, 'ReactUpdates: must provide a batchedUpdates() function') : invariant(false) : undefined;
|
6367 | !(typeof _batchingStrategy.isBatchingUpdates === 'boolean') ? process.env.NODE_ENV !== 'production' ? invariant(false, 'ReactUpdates: must provide an isBatchingUpdates boolean attribute') : invariant(false) : undefined;
|
6368 | batchingStrategy = _batchingStrategy;
|
6369 | }
|
6370 | };
|
6371 |
|
6372 | var ReactUpdates = {
|
6373 | /**
|
6374 | * React references `ReactReconcileTransaction` using this property in order
|
6375 | * to allow dependency injection.
|
6376 | *
|
6377 | * @internal
|
6378 | */
|
6379 | ReactReconcileTransaction: null,
|
6380 |
|
6381 | batchedUpdates: batchedUpdates,
|
6382 | enqueueUpdate: enqueueUpdate,
|
6383 | flushBatchedUpdates: flushBatchedUpdates,
|
6384 | injection: ReactUpdatesInjection,
|
6385 | asap: asap
|
6386 | };
|
6387 |
|
6388 | module.exports = ReactUpdates;
|
6389 | /* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(5)))
|
6390 |
|
6391 | /***/ },
|
6392 | /* 56 */
|
6393 | /***/ function(module, exports, __webpack_require__) {
|
6394 |
|
6395 | /* WEBPACK VAR INJECTION */(function(process) {/**
|
6396 | * Copyright 2013-2015, Facebook, Inc.
|
6397 | * All rights reserved.
|
6398 | *
|
6399 | * This source code is licensed under the BSD-style license found in the
|
6400 | * LICENSE file in the root directory of this source tree. An additional grant
|
6401 | * of patent rights can be found in the PATENTS file in the same directory.
|
6402 | *
|
6403 | * @providesModule CallbackQueue
|
6404 | */
|
6405 |
|
6406 | 'use strict';
|
6407 |
|
6408 | var PooledClass = __webpack_require__(57);
|
6409 |
|
6410 | var assign = __webpack_require__(40);
|
6411 | var invariant = __webpack_require__(14);
|
6412 |
|
6413 | /**
|
6414 | * A specialized pseudo-event module to help keep track of components waiting to
|
6415 | * be notified when their DOM representations are available for use.
|
6416 | *
|
6417 | * This implements `PooledClass`, so you should never need to instantiate this.
|
6418 | * Instead, use `CallbackQueue.getPooled()`.
|
6419 | *
|
6420 | * @class ReactMountReady
|
6421 | * @implements PooledClass
|
6422 | * @internal
|
6423 | */
|
6424 | function CallbackQueue() {
|
6425 | this._callbacks = null;
|
6426 | this._contexts = null;
|
6427 | }
|
6428 |
|
6429 | assign(CallbackQueue.prototype, {
|
6430 |
|
6431 | /**
|
6432 | * Enqueues a callback to be invoked when `notifyAll` is invoked.
|
6433 | *
|
6434 | * @param {function} callback Invoked when `notifyAll` is invoked.
|
6435 | * @param {?object} context Context to call `callback` with.
|
6436 | * @internal
|
6437 | */
|
6438 | enqueue: function (callback, context) {
|
6439 | this._callbacks = this._callbacks || [];
|
6440 | this._contexts = this._contexts || [];
|
6441 | this._callbacks.push(callback);
|
6442 | this._contexts.push(context);
|
6443 | },
|
6444 |
|
6445 | /**
|
6446 | * Invokes all enqueued callbacks and clears the queue. This is invoked after
|
6447 | * the DOM representation of a component has been created or updated.
|
6448 | *
|
6449 | * @internal
|
6450 | */
|
6451 | notifyAll: function () {
|
6452 | var callbacks = this._callbacks;
|
6453 | var contexts = this._contexts;
|
6454 | if (callbacks) {
|
6455 | !(callbacks.length === contexts.length) ? process.env.NODE_ENV !== 'production' ? invariant(false, 'Mismatched list of contexts in callback queue') : invariant(false) : undefined;
|
6456 | this._callbacks = null;
|
6457 | this._contexts = null;
|
6458 | for (var i = 0; i < callbacks.length; i++) {
|
6459 | callbacks[i].call(contexts[i]);
|
6460 | }
|
6461 | callbacks.length = 0;
|
6462 | contexts.length = 0;
|
6463 | }
|
6464 | },
|
6465 |
|
6466 | /**
|
6467 | * Resets the internal queue.
|
6468 | *
|
6469 | * @internal
|
6470 | */
|
6471 | reset: function () {
|
6472 | this._callbacks = null;
|
6473 | this._contexts = null;
|
6474 | },
|
6475 |
|
6476 | /**
|
6477 | * `PooledClass` looks for this.
|
6478 | */
|
6479 | destructor: function () {
|
6480 | this.reset();
|
6481 | }
|
6482 |
|
6483 | });
|
6484 |
|
6485 | PooledClass.addPoolingTo(CallbackQueue);
|
6486 |
|
6487 | module.exports = CallbackQueue;
|
6488 | /* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(5)))
|
6489 |
|
6490 | /***/ },
|
6491 | /* 57 */
|
6492 | /***/ function(module, exports, __webpack_require__) {
|
6493 |
|
6494 | /* WEBPACK VAR INJECTION */(function(process) {/**
|
6495 | * Copyright 2013-2015, Facebook, Inc.
|
6496 | * All rights reserved.
|
6497 | *
|
6498 | * This source code is licensed under the BSD-style license found in the
|
6499 | * LICENSE file in the root directory of this source tree. An additional grant
|
6500 | * of patent rights can be found in the PATENTS file in the same directory.
|
6501 | *
|
6502 | * @providesModule PooledClass
|
6503 | */
|
6504 |
|
6505 | 'use strict';
|
6506 |
|
6507 | var invariant = __webpack_require__(14);
|
6508 |
|
6509 | /**
|
6510 | * Static poolers. Several custom versions for each potential number of
|
6511 | * arguments. A completely generic pooler is easy to implement, but would
|
6512 | * require accessing the `arguments` object. In each of these, `this` refers to
|
6513 | * the Class itself, not an instance. If any others are needed, simply add them
|
6514 | * here, or in their own files.
|
6515 | */
|
6516 | var oneArgumentPooler = function (copyFieldsFrom) {
|
6517 | var Klass = this;
|
6518 | if (Klass.instancePool.length) {
|
6519 | var instance = Klass.instancePool.pop();
|
6520 | Klass.call(instance, copyFieldsFrom);
|
6521 | return instance;
|
6522 | } else {
|
6523 | return new Klass(copyFieldsFrom);
|
6524 | }
|
6525 | };
|
6526 |
|
6527 | var twoArgumentPooler = function (a1, a2) {
|
6528 | var Klass = this;
|
6529 | if (Klass.instancePool.length) {
|
6530 | var instance = Klass.instancePool.pop();
|
6531 | Klass.call(instance, a1, a2);
|
6532 | return instance;
|
6533 | } else {
|
6534 | return new Klass(a1, a2);
|
6535 | }
|
6536 | };
|
6537 |
|
6538 | var threeArgumentPooler = function (a1, a2, a3) {
|
6539 | var Klass = this;
|
6540 | if (Klass.instancePool.length) {
|
6541 | var instance = Klass.instancePool.pop();
|
6542 | Klass.call(instance, a1, a2, a3);
|
6543 | return instance;
|
6544 | } else {
|
6545 | return new Klass(a1, a2, a3);
|
6546 | }
|
6547 | };
|
6548 |
|
6549 | var fourArgumentPooler = function (a1, a2, a3, a4) {
|
6550 | var Klass = this;
|
6551 | if (Klass.instancePool.length) {
|
6552 | var instance = Klass.instancePool.pop();
|
6553 | Klass.call(instance, a1, a2, a3, a4);
|
6554 | return instance;
|
6555 | } else {
|
6556 | return new Klass(a1, a2, a3, a4);
|
6557 | }
|
6558 | };
|
6559 |
|
6560 | var fiveArgumentPooler = function (a1, a2, a3, a4, a5) {
|
6561 | var Klass = this;
|
6562 | if (Klass.instancePool.length) {
|
6563 | var instance = Klass.instancePool.pop();
|
6564 | Klass.call(instance, a1, a2, a3, a4, a5);
|
6565 | return instance;
|
6566 | } else {
|
6567 | return new Klass(a1, a2, a3, a4, a5);
|
6568 | }
|
6569 | };
|
6570 |
|
6571 | var standardReleaser = function (instance) {
|
6572 | var Klass = this;
|
6573 | !(instance instanceof Klass) ? process.env.NODE_ENV !== 'production' ? invariant(false, 'Trying to release an instance into a pool of a different type.') : invariant(false) : undefined;
|
6574 | instance.destructor();
|
6575 | if (Klass.instancePool.length < Klass.poolSize) {
|
6576 | Klass.instancePool.push(instance);
|
6577 | }
|
6578 | };
|
6579 |
|
6580 | var DEFAULT_POOL_SIZE = 10;
|
6581 | var DEFAULT_POOLER = oneArgumentPooler;
|
6582 |
|
6583 | /**
|
6584 | * Augments `CopyConstructor` to be a poolable class, augmenting only the class
|
6585 | * itself (statically) not adding any prototypical fields. Any CopyConstructor
|
6586 | * you give this may have a `poolSize` property, and will look for a
|
6587 | * prototypical `destructor` on instances (optional).
|
6588 | *
|
6589 | * @param {Function} CopyConstructor Constructor that can be used to reset.
|
6590 | * @param {Function} pooler Customizable pooler.
|
6591 | */
|
6592 | var addPoolingTo = function (CopyConstructor, pooler) {
|
6593 | var NewKlass = CopyConstructor;
|
6594 | NewKlass.instancePool = [];
|
6595 | NewKlass.getPooled = pooler || DEFAULT_POOLER;
|
6596 | if (!NewKlass.poolSize) {
|
6597 | NewKlass.poolSize = DEFAULT_POOL_SIZE;
|
6598 | }
|
6599 | NewKlass.release = standardReleaser;
|
6600 | return NewKlass;
|
6601 | };
|
6602 |
|
6603 | var PooledClass = {
|
6604 | addPoolingTo: addPoolingTo,
|
6605 | oneArgumentPooler: oneArgumentPooler,
|
6606 | twoArgumentPooler: twoArgumentPooler,
|
6607 | threeArgumentPooler: threeArgumentPooler,
|
6608 | fourArgumentPooler: fourArgumentPooler,
|
6609 | fiveArgumentPooler: fiveArgumentPooler
|
6610 | };
|
6611 |
|
6612 | module.exports = PooledClass;
|
6613 | /* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(5)))
|
6614 |
|
6615 | /***/ },
|
6616 | /* 58 */
|
6617 | /***/ function(module, exports, __webpack_require__) {
|
6618 |
|
6619 | /* WEBPACK VAR INJECTION */(function(process) {/**
|
6620 | * Copyright 2013-2015, Facebook, Inc.
|
6621 | * All rights reserved.
|
6622 | *
|
6623 | * This source code is licensed under the BSD-style license found in the
|
6624 | * LICENSE file in the root directory of this source tree. An additional grant
|
6625 | * of patent rights can be found in the PATENTS file in the same directory.
|
6626 | *
|
6627 | * @providesModule Transaction
|
6628 | */
|
6629 |
|
6630 | 'use strict';
|
6631 |
|
6632 | var invariant = __webpack_require__(14);
|
6633 |
|
6634 | /**
|
6635 | * `Transaction` creates a black box that is able to wrap any method such that
|
6636 | * certain invariants are maintained before and after the method is invoked
|
6637 | * (Even if an exception is thrown while invoking the wrapped method). Whoever
|
6638 | * instantiates a transaction can provide enforcers of the invariants at
|
6639 | * creation time. The `Transaction` class itself will supply one additional
|
6640 | * automatic invariant for you - the invariant that any transaction instance
|
6641 | * should not be run while it is already being run. You would typically create a
|
6642 | * single instance of a `Transaction` for reuse multiple times, that potentially
|
6643 | * is used to wrap several different methods. Wrappers are extremely simple -
|
6644 | * they only require implementing two methods.
|
6645 | *
|
6646 | * <pre>
|
6647 | * wrappers (injected at creation time)
|
6648 | * + +
|
6649 | * | |
|
6650 | * +-----------------|--------|--------------+
|
6651 | * | v | |
|
6652 | * | +---------------+ | |
|
6653 | * | +--| wrapper1 |---|----+ |
|
6654 | * | | +---------------+ v | |
|
6655 | * | | +-------------+ | |
|
6656 | * | | +----| wrapper2 |--------+ |
|
6657 | * | | | +-------------+ | | |
|
6658 | * | | | | | |
|
6659 | * | v v v v | wrapper
|
6660 | * | +---+ +---+ +---------+ +---+ +---+ | invariants
|
6661 | * perform(anyMethod) | | | | | | | | | | | | maintained
|
6662 | * +----------------->|-|---|-|---|-->|anyMethod|---|---|-|---|-|-------->
|
6663 | * | | | | | | | | | | | |
|
6664 | * | | | | | | | | | | | |
|
6665 | * | | | | | | | | | | | |
|
6666 | * | +---+ +---+ +---------+ +---+ +---+ |
|
6667 | * | initialize close |
|
6668 | * +-----------------------------------------+
|
6669 | * </pre>
|
6670 | *
|
6671 | * Use cases:
|
6672 | * - Preserving the input selection ranges before/after reconciliation.
|
6673 | * Restoring selection even in the event of an unexpected error.
|
6674 | * - Deactivating events while rearranging the DOM, preventing blurs/focuses,
|
6675 | * while guaranteeing that afterwards, the event system is reactivated.
|
6676 | * - Flushing a queue of collected DOM mutations to the main UI thread after a
|
6677 | * reconciliation takes place in a worker thread.
|
6678 | * - Invoking any collected `componentDidUpdate` callbacks after rendering new
|
6679 | * content.
|
6680 | * - (Future use case): Wrapping particular flushes of the `ReactWorker` queue
|
6681 | * to preserve the `scrollTop` (an automatic scroll aware DOM).
|
6682 | * - (Future use case): Layout calculations before and after DOM updates.
|
6683 | *
|
6684 | * Transactional plugin API:
|
6685 | * - A module that has an `initialize` method that returns any precomputation.
|
6686 | * - and a `close` method that accepts the precomputation. `close` is invoked
|
6687 | * when the wrapped process is completed, or has failed.
|
6688 | *
|
6689 | * @param {Array<TransactionalWrapper>} transactionWrapper Wrapper modules
|
6690 | * that implement `initialize` and `close`.
|
6691 | * @return {Transaction} Single transaction for reuse in thread.
|
6692 | *
|
6693 | * @class Transaction
|
6694 | */
|
6695 | var Mixin = {
|
6696 | /**
|
6697 | * Sets up this instance so that it is prepared for collecting metrics. Does
|
6698 | * so such that this setup method may be used on an instance that is already
|
6699 | * initialized, in a way that does not consume additional memory upon reuse.
|
6700 | * That can be useful if you decide to make your subclass of this mixin a
|
6701 | * "PooledClass".
|
6702 | */
|
6703 | reinitializeTransaction: function () {
|
6704 | this.transactionWrappers = this.getTransactionWrappers();
|
6705 | if (this.wrapperInitData) {
|
6706 | this.wrapperInitData.length = 0;
|
6707 | } else {
|
6708 | this.wrapperInitData = [];
|
6709 | }
|
6710 | this._isInTransaction = false;
|
6711 | },
|
6712 |
|
6713 | _isInTransaction: false,
|
6714 |
|
6715 | /**
|
6716 | * @abstract
|
6717 | * @return {Array<TransactionWrapper>} Array of transaction wrappers.
|
6718 | */
|
6719 | getTransactionWrappers: null,
|
6720 |
|
6721 | isInTransaction: function () {
|
6722 | return !!this._isInTransaction;
|
6723 | },
|
6724 |
|
6725 | /**
|
6726 | * Executes the function within a safety window. Use this for the top level
|
6727 | * methods that result in large amounts of computation/mutations that would
|
6728 | * need to be safety checked. The optional arguments helps prevent the need
|
6729 | * to bind in many cases.
|
6730 | *
|
6731 | * @param {function} method Member of scope to call.
|
6732 | * @param {Object} scope Scope to invoke from.
|
6733 | * @param {Object?=} a Argument to pass to the method.
|
6734 | * @param {Object?=} b Argument to pass to the method.
|
6735 | * @param {Object?=} c Argument to pass to the method.
|
6736 | * @param {Object?=} d Argument to pass to the method.
|
6737 | * @param {Object?=} e Argument to pass to the method.
|
6738 | * @param {Object?=} f Argument to pass to the method.
|
6739 | *
|
6740 | * @return {*} Return value from `method`.
|
6741 | */
|
6742 | perform: function (method, scope, a, b, c, d, e, f) {
|
6743 | !!this.isInTransaction() ? process.env.NODE_ENV !== 'production' ? invariant(false, 'Transaction.perform(...): Cannot initialize a transaction when there ' + 'is already an outstanding transaction.') : invariant(false) : undefined;
|
6744 | var errorThrown;
|
6745 | var ret;
|
6746 | try {
|
6747 | this._isInTransaction = true;
|
6748 | // Catching errors makes debugging more difficult, so we start with
|
6749 | // errorThrown set to true before setting it to false after calling
|
6750 | // close -- if it's still set to true in the finally block, it means
|
6751 | // one of these calls threw.
|
6752 | errorThrown = true;
|
6753 | this.initializeAll(0);
|
6754 | ret = method.call(scope, a, b, c, d, e, f);
|
6755 | errorThrown = false;
|
6756 | } finally {
|
6757 | try {
|
6758 | if (errorThrown) {
|
6759 | // If `method` throws, prefer to show that stack trace over any thrown
|
6760 | // by invoking `closeAll`.
|
6761 | try {
|
6762 | this.closeAll(0);
|
6763 | } catch (err) {}
|
6764 | } else {
|
6765 | // Since `method` didn't throw, we don't want to silence the exception
|
6766 | // here.
|
6767 | this.closeAll(0);
|
6768 | }
|
6769 | } finally {
|
6770 | this._isInTransaction = false;
|
6771 | }
|
6772 | }
|
6773 | return ret;
|
6774 | },
|
6775 |
|
6776 | initializeAll: function (startIndex) {
|
6777 | var transactionWrappers = this.transactionWrappers;
|
6778 | for (var i = startIndex; i < transactionWrappers.length; i++) {
|
6779 | var wrapper = transactionWrappers[i];
|
6780 | try {
|
6781 | // Catching errors makes debugging more difficult, so we start with the
|
6782 | // OBSERVED_ERROR state before overwriting it with the real return value
|
6783 | // of initialize -- if it's still set to OBSERVED_ERROR in the finally
|
6784 | // block, it means wrapper.initialize threw.
|
6785 | this.wrapperInitData[i] = Transaction.OBSERVED_ERROR;
|
6786 | this.wrapperInitData[i] = wrapper.initialize ? wrapper.initialize.call(this) : null;
|
6787 | } finally {
|
6788 | if (this.wrapperInitData[i] === Transaction.OBSERVED_ERROR) {
|
6789 | // The initializer for wrapper i threw an error; initialize the
|
6790 | // remaining wrappers but silence any exceptions from them to ensure
|
6791 | // that the first error is the one to bubble up.
|
6792 | try {
|
6793 | this.initializeAll(i + 1);
|
6794 | } catch (err) {}
|
6795 | }
|
6796 | }
|
6797 | }
|
6798 | },
|
6799 |
|
6800 | /**
|
6801 | * Invokes each of `this.transactionWrappers.close[i]` functions, passing into
|
6802 | * them the respective return values of `this.transactionWrappers.init[i]`
|
6803 | * (`close`rs that correspond to initializers that failed will not be
|
6804 | * invoked).
|
6805 | */
|
6806 | closeAll: function (startIndex) {
|
6807 | !this.isInTransaction() ? process.env.NODE_ENV !== 'production' ? invariant(false, 'Transaction.closeAll(): Cannot close transaction when none are open.') : invariant(false) : undefined;
|
6808 | var transactionWrappers = this.transactionWrappers;
|
6809 | for (var i = startIndex; i < transactionWrappers.length; i++) {
|
6810 | var wrapper = transactionWrappers[i];
|
6811 | var initData = this.wrapperInitData[i];
|
6812 | var errorThrown;
|
6813 | try {
|
6814 | // Catching errors makes debugging more difficult, so we start with
|
6815 | // errorThrown set to true before setting it to false after calling
|
6816 | // close -- if it's still set to true in the finally block, it means
|
6817 | // wrapper.close threw.
|
6818 | errorThrown = true;
|
6819 | if (initData !== Transaction.OBSERVED_ERROR && wrapper.close) {
|
6820 | wrapper.close.call(this, initData);
|
6821 | }
|
6822 | errorThrown = false;
|
6823 | } finally {
|
6824 | if (errorThrown) {
|
6825 | // The closer for wrapper i threw an error; close the remaining
|
6826 | // wrappers but silence any exceptions from them to ensure that the
|
6827 | // first error is the one to bubble up.
|
6828 | try {
|
6829 | this.closeAll(i + 1);
|
6830 | } catch (e) {}
|
6831 | }
|
6832 | }
|
6833 | }
|
6834 | this.wrapperInitData.length = 0;
|
6835 | }
|
6836 | };
|
6837 |
|
6838 | var Transaction = {
|
6839 |
|
6840 | Mixin: Mixin,
|
6841 |
|
6842 | /**
|
6843 | * Token to look for to determine if an error occurred.
|
6844 | */
|
6845 | OBSERVED_ERROR: {}
|
6846 |
|
6847 | };
|
6848 |
|
6849 | module.exports = Transaction;
|
6850 | /* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(5)))
|
6851 |
|
6852 | /***/ },
|
6853 | /* 59 */
|
6854 | /***/ function(module, exports, __webpack_require__) {
|
6855 |
|
6856 | /* WEBPACK VAR INJECTION */(function(process) {/**
|
6857 | * Copyright 2013-2015, Facebook, Inc.
|
6858 | * All rights reserved.
|
6859 | *
|
6860 | * This source code is licensed under the BSD-style license found in the
|
6861 | * LICENSE file in the root directory of this source tree. An additional grant
|
6862 | * of patent rights can be found in the PATENTS file in the same directory.
|
6863 | *
|
6864 | * @providesModule emptyObject
|
6865 | */
|
6866 |
|
6867 | 'use strict';
|
6868 |
|
6869 | var emptyObject = {};
|
6870 |
|
6871 | if (process.env.NODE_ENV !== 'production') {
|
6872 | Object.freeze(emptyObject);
|
6873 | }
|
6874 |
|
6875 | module.exports = emptyObject;
|
6876 | /* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(5)))
|
6877 |
|
6878 | /***/ },
|
6879 | /* 60 */
|
6880 | /***/ function(module, exports, __webpack_require__) {
|
6881 |
|
6882 | /**
|
6883 | * Copyright 2013-2015, Facebook, Inc.
|
6884 | * All rights reserved.
|
6885 | *
|
6886 | * This source code is licensed under the BSD-style license found in the
|
6887 | * LICENSE file in the root directory of this source tree. An additional grant
|
6888 | * of patent rights can be found in the PATENTS file in the same directory.
|
6889 | *
|
6890 | * @providesModule containsNode
|
6891 | * @typechecks
|
6892 | */
|
6893 |
|
6894 | 'use strict';
|
6895 |
|
6896 | var isTextNode = __webpack_require__(61);
|
6897 |
|
6898 | /*eslint-disable no-bitwise */
|
6899 |
|
6900 | /**
|
6901 | * Checks if a given DOM node contains or is another DOM node.
|
6902 | *
|
6903 | * @param {?DOMNode} outerNode Outer DOM node.
|
6904 | * @param {?DOMNode} innerNode Inner DOM node.
|
6905 | * @return {boolean} True if `outerNode` contains or is `innerNode`.
|
6906 | */
|
6907 | function containsNode(_x, _x2) {
|
6908 | var _again = true;
|
6909 |
|
6910 | _function: while (_again) {
|
6911 | var outerNode = _x,
|
6912 | innerNode = _x2;
|
6913 | _again = false;
|
6914 |
|
6915 | if (!outerNode || !innerNode) {
|
6916 | return false;
|
6917 | } else if (outerNode === innerNode) {
|
6918 | return true;
|
6919 | } else if (isTextNode(outerNode)) {
|
6920 | return false;
|
6921 | } else if (isTextNode(innerNode)) {
|
6922 | _x = outerNode;
|
6923 | _x2 = innerNode.parentNode;
|
6924 | _again = true;
|
6925 | continue _function;
|
6926 | } else if (outerNode.contains) {
|
6927 | return outerNode.contains(innerNode);
|
6928 | } else if (outerNode.compareDocumentPosition) {
|
6929 | return !!(outerNode.compareDocumentPosition(innerNode) & 16);
|
6930 | } else {
|
6931 | return false;
|
6932 | }
|
6933 | }
|
6934 | }
|
6935 |
|
6936 | module.exports = containsNode;
|
6937 |
|
6938 | /***/ },
|
6939 | /* 61 */
|
6940 | /***/ function(module, exports, __webpack_require__) {
|
6941 |
|
6942 | /**
|
6943 | * Copyright 2013-2015, Facebook, Inc.
|
6944 | * All rights reserved.
|
6945 | *
|
6946 | * This source code is licensed under the BSD-style license found in the
|
6947 | * LICENSE file in the root directory of this source tree. An additional grant
|
6948 | * of patent rights can be found in the PATENTS file in the same directory.
|
6949 | *
|
6950 | * @providesModule isTextNode
|
6951 | * @typechecks
|
6952 | */
|
6953 |
|
6954 | 'use strict';
|
6955 |
|
6956 | var isNode = __webpack_require__(62);
|
6957 |
|
6958 | /**
|
6959 | * @param {*} object The object to check.
|
6960 | * @return {boolean} Whether or not the object is a DOM text node.
|
6961 | */
|
6962 | function isTextNode(object) {
|
6963 | return isNode(object) && object.nodeType == 3;
|
6964 | }
|
6965 |
|
6966 | module.exports = isTextNode;
|
6967 |
|
6968 | /***/ },
|
6969 | /* 62 */
|
6970 | /***/ function(module, exports) {
|
6971 |
|
6972 | /**
|
6973 | * Copyright 2013-2015, Facebook, Inc.
|
6974 | * All rights reserved.
|
6975 | *
|
6976 | * This source code is licensed under the BSD-style license found in the
|
6977 | * LICENSE file in the root directory of this source tree. An additional grant
|
6978 | * of patent rights can be found in the PATENTS file in the same directory.
|
6979 | *
|
6980 | * @providesModule isNode
|
6981 | * @typechecks
|
6982 | */
|
6983 |
|
6984 | /**
|
6985 | * @param {*} object The object to check.
|
6986 | * @return {boolean} Whether or not the object is a DOM node.
|
6987 | */
|
6988 | 'use strict';
|
6989 |
|
6990 | function isNode(object) {
|
6991 | return !!(object && (typeof Node === 'function' ? object instanceof Node : typeof object === 'object' && typeof object.nodeType === 'number' && typeof object.nodeName === 'string'));
|
6992 | }
|
6993 |
|
6994 | module.exports = isNode;
|
6995 |
|
6996 | /***/ },
|
6997 | /* 63 */
|
6998 | /***/ function(module, exports, __webpack_require__) {
|
6999 |
|
7000 | /* WEBPACK VAR INJECTION */(function(process) {/**
|
7001 | * Copyright 2013-2015, Facebook, Inc.
|
7002 | * All rights reserved.
|
7003 | *
|
7004 | * This source code is licensed under the BSD-style license found in the
|
7005 | * LICENSE file in the root directory of this source tree. An additional grant
|
7006 | * of patent rights can be found in the PATENTS file in the same directory.
|
7007 | *
|
7008 | * @providesModule instantiateReactComponent
|
7009 | * @typechecks static-only
|
7010 | */
|
7011 |
|
7012 | 'use strict';
|
7013 |
|
7014 | var ReactCompositeComponent = __webpack_require__(64);
|
7015 | var ReactEmptyComponent = __webpack_require__(69);
|
7016 | var ReactNativeComponent = __webpack_require__(70);
|
7017 |
|
7018 | var assign = __webpack_require__(40);
|
7019 | var invariant = __webpack_require__(14);
|
7020 | var warning = __webpack_require__(26);
|
7021 |
|
7022 | // To avoid a cyclic dependency, we create the final class in this module
|
7023 | var ReactCompositeComponentWrapper = function () {};
|
7024 | assign(ReactCompositeComponentWrapper.prototype, ReactCompositeComponent.Mixin, {
|
7025 | _instantiateReactComponent: instantiateReactComponent
|
7026 | });
|
7027 |
|
7028 | function getDeclarationErrorAddendum(owner) {
|
7029 | if (owner) {
|
7030 | var name = owner.getName();
|
7031 | if (name) {
|
7032 | return ' Check the render method of `' + name + '`.';
|
7033 | }
|
7034 | }
|
7035 | return '';
|
7036 | }
|
7037 |
|
7038 | /**
|
7039 | * Check if the type reference is a known internal type. I.e. not a user
|
7040 | * provided composite type.
|
7041 | *
|
7042 | * @param {function} type
|
7043 | * @return {boolean} Returns true if this is a valid internal type.
|
7044 | */
|
7045 | function isInternalComponentType(type) {
|
7046 | return typeof type === 'function' && typeof type.prototype !== 'undefined' && typeof type.prototype.mountComponent === 'function' && typeof type.prototype.receiveComponent === 'function';
|
7047 | }
|
7048 |
|
7049 | /**
|
7050 | * Given a ReactNode, create an instance that will actually be mounted.
|
7051 | *
|
7052 | * @param {ReactNode} node
|
7053 | * @return {object} A new instance of the element's constructor.
|
7054 | * @protected
|
7055 | */
|
7056 | function instantiateReactComponent(node) {
|
7057 | var instance;
|
7058 |
|
7059 | if (node === null || node === false) {
|
7060 | instance = new ReactEmptyComponent(instantiateReactComponent);
|
7061 | } else if (typeof node === 'object') {
|
7062 | var element = node;
|
7063 | !(element && (typeof element.type === 'function' || typeof element.type === 'string')) ? process.env.NODE_ENV !== 'production' ? invariant(false, 'Element type is invalid: expected a string (for built-in components) ' + 'or a class/function (for composite components) but got: %s.%s', element.type == null ? element.type : typeof element.type, getDeclarationErrorAddendum(element._owner)) : invariant(false) : undefined;
|
7064 |
|
7065 | // Special case string values
|
7066 | if (typeof element.type === 'string') {
|
7067 | instance = ReactNativeComponent.createInternalComponent(element);
|
7068 | } else if (isInternalComponentType(element.type)) {
|
7069 | // This is temporarily available for custom components that are not string
|
7070 | // representations. I.e. ART. Once those are updated to use the string
|
7071 | // representation, we can drop this code path.
|
7072 | instance = new element.type(element);
|
7073 | } else {
|
7074 | instance = new ReactCompositeComponentWrapper();
|
7075 | }
|
7076 | } else if (typeof node === 'string' || typeof node === 'number') {
|
7077 | instance = ReactNativeComponent.createInstanceForText(node);
|
7078 | } else {
|
7079 | true ? process.env.NODE_ENV !== 'production' ? invariant(false, 'Encountered invalid React node of type %s', typeof node) : invariant(false) : undefined;
|
7080 | }
|
7081 |
|
7082 | if (process.env.NODE_ENV !== 'production') {
|
7083 | process.env.NODE_ENV !== 'production' ? warning(typeof instance.construct === 'function' && typeof instance.mountComponent === 'function' && typeof instance.receiveComponent === 'function' && typeof instance.unmountComponent === 'function', 'Only React Components can be mounted.') : undefined;
|
7084 | }
|
7085 |
|
7086 | // Sets up the instance. This can probably just move into the constructor now.
|
7087 | instance.construct(node);
|
7088 |
|
7089 | // These two fields are used by the DOM and ART diffing algorithms
|
7090 | // respectively. Instead of using expandos on components, we should be
|
7091 | // storing the state needed by the diffing algorithms elsewhere.
|
7092 | instance._mountIndex = 0;
|
7093 | instance._mountImage = null;
|
7094 |
|
7095 | if (process.env.NODE_ENV !== 'production') {
|
7096 | instance._isOwnerNecessary = false;
|
7097 | instance._warnedAboutRefsInRender = false;
|
7098 | }
|
7099 |
|
7100 | // Internal instances should fully constructed at this point, so they should
|
7101 | // not get any new fields added to them at this point.
|
7102 | if (process.env.NODE_ENV !== 'production') {
|
7103 | if (Object.preventExtensions) {
|
7104 | Object.preventExtensions(instance);
|
7105 | }
|
7106 | }
|
7107 |
|
7108 | return instance;
|
7109 | }
|
7110 |
|
7111 | module.exports = instantiateReactComponent;
|
7112 | /* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(5)))
|
7113 |
|
7114 | /***/ },
|
7115 | /* 64 */
|
7116 | /***/ function(module, exports, __webpack_require__) {
|
7117 |
|
7118 | /* WEBPACK VAR INJECTION */(function(process) {/**
|
7119 | * Copyright 2013-2015, Facebook, Inc.
|
7120 | * All rights reserved.
|
7121 | *
|
7122 | * This source code is licensed under the BSD-style license found in the
|
7123 | * LICENSE file in the root directory of this source tree. An additional grant
|
7124 | * of patent rights can be found in the PATENTS file in the same directory.
|
7125 | *
|
7126 | * @providesModule ReactCompositeComponent
|
7127 | */
|
7128 |
|
7129 | 'use strict';
|
7130 |
|
7131 | var ReactComponentEnvironment = __webpack_require__(65);
|
7132 | var ReactCurrentOwner = __webpack_require__(6);
|
7133 | var ReactElement = __webpack_require__(43);
|
7134 | var ReactInstanceMap = __webpack_require__(48);
|
7135 | var ReactPerf = __webpack_require__(19);
|
7136 | var ReactPropTypeLocations = __webpack_require__(66);
|
7137 | var ReactPropTypeLocationNames = __webpack_require__(67);
|
7138 | var ReactReconciler = __webpack_require__(51);
|
7139 | var ReactUpdateQueue = __webpack_require__(54);
|
7140 |
|
7141 | var assign = __webpack_require__(40);
|
7142 | var emptyObject = __webpack_require__(59);
|
7143 | var invariant = __webpack_require__(14);
|
7144 | var shouldUpdateReactComponent = __webpack_require__(68);
|
7145 | var warning = __webpack_require__(26);
|
7146 |
|
7147 | function getDeclarationErrorAddendum(component) {
|
7148 | var owner = component._currentElement._owner || null;
|
7149 | if (owner) {
|
7150 | var name = owner.getName();
|
7151 | if (name) {
|
7152 | return ' Check the render method of `' + name + '`.';
|
7153 | }
|
7154 | }
|
7155 | return '';
|
7156 | }
|
7157 |
|
7158 | function StatelessComponent(Component) {}
|
7159 | StatelessComponent.prototype.render = function () {
|
7160 | var Component = ReactInstanceMap.get(this)._currentElement.type;
|
7161 | return Component(this.props, this.context, this.updater);
|
7162 | };
|
7163 |
|
7164 | /**
|
7165 | * ------------------ The Life-Cycle of a Composite Component ------------------
|
7166 | *
|
7167 | * - constructor: Initialization of state. The instance is now retained.
|
7168 | * - componentWillMount
|
7169 | * - render
|
7170 | * - [children's constructors]
|
7171 | * - [children's componentWillMount and render]
|
7172 | * - [children's componentDidMount]
|
7173 | * - componentDidMount
|
7174 | *
|
7175 | * Update Phases:
|
7176 | * - componentWillReceiveProps (only called if parent updated)
|
7177 | * - shouldComponentUpdate
|
7178 | * - componentWillUpdate
|
7179 | * - render
|
7180 | * - [children's constructors or receive props phases]
|
7181 | * - componentDidUpdate
|
7182 | *
|
7183 | * - componentWillUnmount
|
7184 | * - [children's componentWillUnmount]
|
7185 | * - [children destroyed]
|
7186 | * - (destroyed): The instance is now blank, released by React and ready for GC.
|
7187 | *
|
7188 | * -----------------------------------------------------------------------------
|
7189 | */
|
7190 |
|
7191 | /**
|
7192 | * An incrementing ID assigned to each component when it is mounted. This is
|
7193 | * used to enforce the order in which `ReactUpdates` updates dirty components.
|
7194 | *
|
7195 | * @private
|
7196 | */
|
7197 | var nextMountID = 1;
|
7198 |
|
7199 | /**
|
7200 | * @lends {ReactCompositeComponent.prototype}
|
7201 | */
|
7202 | var ReactCompositeComponentMixin = {
|
7203 |
|
7204 | /**
|
7205 | * Base constructor for all composite component.
|
7206 | *
|
7207 | * @param {ReactElement} element
|
7208 | * @final
|
7209 | * @internal
|
7210 | */
|
7211 | construct: function (element) {
|
7212 | this._currentElement = element;
|
7213 | this._rootNodeID = null;
|
7214 | this._instance = null;
|
7215 |
|
7216 | // See ReactUpdateQueue
|
7217 | this._pendingElement = null;
|
7218 | this._pendingStateQueue = null;
|
7219 | this._pendingReplaceState = false;
|
7220 | this._pendingForceUpdate = false;
|
7221 |
|
7222 | this._renderedComponent = null;
|
7223 |
|
7224 | this._context = null;
|
7225 | this._mountOrder = 0;
|
7226 | this._topLevelWrapper = null;
|
7227 |
|
7228 | // See ReactUpdates and ReactUpdateQueue.
|
7229 | this._pendingCallbacks = null;
|
7230 | },
|
7231 |
|
7232 | /**
|
7233 | * Initializes the component, renders markup, and registers event listeners.
|
7234 | *
|
7235 | * @param {string} rootID DOM ID of the root node.
|
7236 | * @param {ReactReconcileTransaction|ReactServerRenderingTransaction} transaction
|
7237 | * @return {?string} Rendered markup to be inserted into the DOM.
|
7238 | * @final
|
7239 | * @internal
|
7240 | */
|
7241 | mountComponent: function (rootID, transaction, context) {
|
7242 | this._context = context;
|
7243 | this._mountOrder = nextMountID++;
|
7244 | this._rootNodeID = rootID;
|
7245 |
|
7246 | var publicProps = this._processProps(this._currentElement.props);
|
7247 | var publicContext = this._processContext(context);
|
7248 |
|
7249 | var Component = this._currentElement.type;
|
7250 |
|
7251 | // Initialize the public class
|
7252 | var inst;
|
7253 | var renderedElement;
|
7254 |
|
7255 | // This is a way to detect if Component is a stateless arrow function
|
7256 | // component, which is not newable. It might not be 100% reliable but is
|
7257 | // something we can do until we start detecting that Component extends
|
7258 | // React.Component. We already assume that typeof Component === 'function'.
|
7259 | var canInstantiate = ('prototype' in Component);
|
7260 |
|
7261 | if (canInstantiate) {
|
7262 | if (process.env.NODE_ENV !== 'production') {
|
7263 | ReactCurrentOwner.current = this;
|
7264 | try {
|
7265 | inst = new Component(publicProps, publicContext, ReactUpdateQueue);
|
7266 | } finally {
|
7267 | ReactCurrentOwner.current = null;
|
7268 | }
|
7269 | } else {
|
7270 | inst = new Component(publicProps, publicContext, ReactUpdateQueue);
|
7271 | }
|
7272 | }
|
7273 |
|
7274 | if (!canInstantiate || inst === null || inst === false || ReactElement.isValidElement(inst)) {
|
7275 | renderedElement = inst;
|
7276 | inst = new StatelessComponent(Component);
|
7277 | }
|
7278 |
|
7279 | if (process.env.NODE_ENV !== 'production') {
|
7280 | // This will throw later in _renderValidatedComponent, but add an early
|
7281 | // warning now to help debugging
|
7282 | if (inst.render == null) {
|
7283 | process.env.NODE_ENV !== 'production' ? warning(false, '%s(...): No `render` method found on the returned component ' + 'instance: you may have forgotten to define `render`, returned ' + 'null/false from a stateless component, or tried to render an ' + 'element whose type is a function that isn\'t a React component.', Component.displayName || Component.name || 'Component') : undefined;
|
7284 | } else {
|
7285 | // We support ES6 inheriting from React.Component, the module pattern,
|
7286 | // and stateless components, but not ES6 classes that don't extend
|
7287 | process.env.NODE_ENV !== 'production' ? warning(Component.prototype && Component.prototype.isReactComponent || !canInstantiate || !(inst instanceof Component), '%s(...): React component classes must extend React.Component.', Component.displayName || Component.name || 'Component') : undefined;
|
7288 | }
|
7289 | }
|
7290 |
|
7291 | // These should be set up in the constructor, but as a convenience for
|
7292 | // simpler class abstractions, we set them up after the fact.
|
7293 | inst.props = publicProps;
|
7294 | inst.context = publicContext;
|
7295 | inst.refs = emptyObject;
|
7296 | inst.updater = ReactUpdateQueue;
|
7297 |
|
7298 | this._instance = inst;
|
7299 |
|
7300 | // Store a reference from the instance back to the internal representation
|
7301 | ReactInstanceMap.set(inst, this);
|
7302 |
|
7303 | if (process.env.NODE_ENV !== 'production') {
|
7304 | // Since plain JS classes are defined without any special initialization
|
7305 | // logic, we can not catch common errors early. Therefore, we have to
|
7306 | // catch them here, at initialization time, instead.
|
7307 | process.env.NODE_ENV !== 'production' ? warning(!inst.getInitialState || inst.getInitialState.isReactClassApproved, 'getInitialState was defined on %s, a plain JavaScript class. ' + 'This is only supported for classes created using React.createClass. ' + 'Did you mean to define a state property instead?', this.getName() || 'a component') : undefined;
|
7308 | process.env.NODE_ENV !== 'production' ? warning(!inst.getDefaultProps || inst.getDefaultProps.isReactClassApproved, 'getDefaultProps was defined on %s, a plain JavaScript class. ' + 'This is only supported for classes created using React.createClass. ' + 'Use a static property to define defaultProps instead.', this.getName() || 'a component') : undefined;
|
7309 | process.env.NODE_ENV !== 'production' ? warning(!inst.propTypes, 'propTypes was defined as an instance property on %s. Use a static ' + 'property to define propTypes instead.', this.getName() || 'a component') : undefined;
|
7310 | process.env.NODE_ENV !== 'production' ? warning(!inst.contextTypes, 'contextTypes was defined as an instance property on %s. Use a ' + 'static property to define contextTypes instead.', this.getName() || 'a component') : undefined;
|
7311 | process.env.NODE_ENV !== 'production' ? warning(typeof inst.componentShouldUpdate !== 'function', '%s has a method called ' + 'componentShouldUpdate(). Did you mean shouldComponentUpdate()? ' + 'The name is phrased as a question because the function is ' + 'expected to return a value.', this.getName() || 'A component') : undefined;
|
7312 | process.env.NODE_ENV !== 'production' ? warning(typeof inst.componentDidUnmount !== 'function', '%s has a method called ' + 'componentDidUnmount(). But there is no such lifecycle method. ' + 'Did you mean componentWillUnmount()?', this.getName() || 'A component') : undefined;
|
7313 | process.env.NODE_ENV !== 'production' ? warning(typeof inst.componentWillRecieveProps !== 'function', '%s has a method called ' + 'componentWillRecieveProps(). Did you mean componentWillReceiveProps()?', this.getName() || 'A component') : undefined;
|
7314 | }
|
7315 |
|
7316 | var initialState = inst.state;
|
7317 | if (initialState === undefined) {
|
7318 | inst.state = initialState = null;
|
7319 | }
|
7320 | !(typeof initialState === 'object' && !Array.isArray(initialState)) ? process.env.NODE_ENV !== 'production' ? invariant(false, '%s.state: must be set to an object or null', this.getName() || 'ReactCompositeComponent') : invariant(false) : undefined;
|
7321 |
|
7322 | this._pendingStateQueue = null;
|
7323 | this._pendingReplaceState = false;
|
7324 | this._pendingForceUpdate = false;
|
7325 |
|
7326 | if (inst.componentWillMount) {
|
7327 | inst.componentWillMount();
|
7328 | // When mounting, calls to `setState` by `componentWillMount` will set
|
7329 | // `this._pendingStateQueue` without triggering a re-render.
|
7330 | if (this._pendingStateQueue) {
|
7331 | inst.state = this._processPendingState(inst.props, inst.context);
|
7332 | }
|
7333 | }
|
7334 |
|
7335 | // If not a stateless component, we now render
|
7336 | if (renderedElement === undefined) {
|
7337 | renderedElement = this._renderValidatedComponent();
|
7338 | }
|
7339 |
|
7340 | this._renderedComponent = this._instantiateReactComponent(renderedElement);
|
7341 |
|
7342 | var markup = ReactReconciler.mountComponent(this._renderedComponent, rootID, transaction, this._processChildContext(context));
|
7343 | if (inst.componentDidMount) {
|
7344 | transaction.getReactMountReady().enqueue(inst.componentDidMount, inst);
|
7345 | }
|
7346 |
|
7347 | return markup;
|
7348 | },
|
7349 |
|
7350 | /**
|
7351 | * Releases any resources allocated by `mountComponent`.
|
7352 | *
|
7353 | * @final
|
7354 | * @internal
|
7355 | */
|
7356 | unmountComponent: function () {
|
7357 | var inst = this._instance;
|
7358 |
|
7359 | if (inst.componentWillUnmount) {
|
7360 | inst.componentWillUnmount();
|
7361 | }
|
7362 |
|
7363 | ReactReconciler.unmountComponent(this._renderedComponent);
|
7364 | this._renderedComponent = null;
|
7365 | this._instance = null;
|
7366 |
|
7367 | // Reset pending fields
|
7368 | // Even if this component is scheduled for another update in ReactUpdates,
|
7369 | // it would still be ignored because these fields are reset.
|
7370 | this._pendingStateQueue = null;
|
7371 | this._pendingReplaceState = false;
|
7372 | this._pendingForceUpdate = false;
|
7373 | this._pendingCallbacks = null;
|
7374 | this._pendingElement = null;
|
7375 |
|
7376 | // These fields do not really need to be reset since this object is no
|
7377 | // longer accessible.
|
7378 | this._context = null;
|
7379 | this._rootNodeID = null;
|
7380 | this._topLevelWrapper = null;
|
7381 |
|
7382 | // Delete the reference from the instance to this internal representation
|
7383 | // which allow the internals to be properly cleaned up even if the user
|
7384 | // leaks a reference to the public instance.
|
7385 | ReactInstanceMap.remove(inst);
|
7386 |
|
7387 | // Some existing components rely on inst.props even after they've been
|
7388 | // destroyed (in event handlers).
|
7389 | // TODO: inst.props = null;
|
7390 | // TODO: inst.state = null;
|
7391 | // TODO: inst.context = null;
|
7392 | },
|
7393 |
|
7394 | /**
|
7395 | * Filters the context object to only contain keys specified in
|
7396 | * `contextTypes`
|
7397 | *
|
7398 | * @param {object} context
|
7399 | * @return {?object}
|
7400 | * @private
|
7401 | */
|
7402 | _maskContext: function (context) {
|
7403 | var maskedContext = null;
|
7404 | var Component = this._currentElement.type;
|
7405 | var contextTypes = Component.contextTypes;
|
7406 | if (!contextTypes) {
|
7407 | return emptyObject;
|
7408 | }
|
7409 | maskedContext = {};
|
7410 | for (var contextName in contextTypes) {
|
7411 | maskedContext[contextName] = context[contextName];
|
7412 | }
|
7413 | return maskedContext;
|
7414 | },
|
7415 |
|
7416 | /**
|
7417 | * Filters the context object to only contain keys specified in
|
7418 | * `contextTypes`, and asserts that they are valid.
|
7419 | *
|
7420 | * @param {object} context
|
7421 | * @return {?object}
|
7422 | * @private
|
7423 | */
|
7424 | _processContext: function (context) {
|
7425 | var maskedContext = this._maskContext(context);
|
7426 | if (process.env.NODE_ENV !== 'production') {
|
7427 | var Component = this._currentElement.type;
|
7428 | if (Component.contextTypes) {
|
7429 | this._checkPropTypes(Component.contextTypes, maskedContext, ReactPropTypeLocations.context);
|
7430 | }
|
7431 | }
|
7432 | return maskedContext;
|
7433 | },
|
7434 |
|
7435 | /**
|
7436 | * @param {object} currentContext
|
7437 | * @return {object}
|
7438 | * @private
|
7439 | */
|
7440 | _processChildContext: function (currentContext) {
|
7441 | var Component = this._currentElement.type;
|
7442 | var inst = this._instance;
|
7443 | var childContext = inst.getChildContext && inst.getChildContext();
|
7444 | if (childContext) {
|
7445 | !(typeof Component.childContextTypes === 'object') ? process.env.NODE_ENV !== 'production' ? invariant(false, '%s.getChildContext(): childContextTypes must be defined in order to ' + 'use getChildContext().', this.getName() || 'ReactCompositeComponent') : invariant(false) : undefined;
|
7446 | if (process.env.NODE_ENV !== 'production') {
|
7447 | this._checkPropTypes(Component.childContextTypes, childContext, ReactPropTypeLocations.childContext);
|
7448 | }
|
7449 | for (var name in childContext) {
|
7450 | !(name in Component.childContextTypes) ? process.env.NODE_ENV !== 'production' ? invariant(false, '%s.getChildContext(): key "%s" is not defined in childContextTypes.', this.getName() || 'ReactCompositeComponent', name) : invariant(false) : undefined;
|
7451 | }
|
7452 | return assign({}, currentContext, childContext);
|
7453 | }
|
7454 | return currentContext;
|
7455 | },
|
7456 |
|
7457 | /**
|
7458 | * Processes props by setting default values for unspecified props and
|
7459 | * asserting that the props are valid. Does not mutate its argument; returns
|
7460 | * a new props object with defaults merged in.
|
7461 | *
|
7462 | * @param {object} newProps
|
7463 | * @return {object}
|
7464 | * @private
|
7465 | */
|
7466 | _processProps: function (newProps) {
|
7467 | if (process.env.NODE_ENV !== 'production') {
|
7468 | var Component = this._currentElement.type;
|
7469 | if (Component.propTypes) {
|
7470 | this._checkPropTypes(Component.propTypes, newProps, ReactPropTypeLocations.prop);
|
7471 | }
|
7472 | }
|
7473 | return newProps;
|
7474 | },
|
7475 |
|
7476 | /**
|
7477 | * Assert that the props are valid
|
7478 | *
|
7479 | * @param {object} propTypes Map of prop name to a ReactPropType
|
7480 | * @param {object} props
|
7481 | * @param {string} location e.g. "prop", "context", "child context"
|
7482 | * @private
|
7483 | */
|
7484 | _checkPropTypes: function (propTypes, props, location) {
|
7485 | // TODO: Stop validating prop types here and only use the element
|
7486 | // validation.
|
7487 | var componentName = this.getName();
|
7488 | for (var propName in propTypes) {
|
7489 | if (propTypes.hasOwnProperty(propName)) {
|
7490 | var error;
|
7491 | try {
|
7492 | // This is intentionally an invariant that gets caught. It's the same
|
7493 | // behavior as without this statement except with a better message.
|
7494 | !(typeof propTypes[propName] === 'function') ? process.env.NODE_ENV !== 'production' ? invariant(false, '%s: %s type `%s` is invalid; it must be a function, usually ' + 'from React.PropTypes.', componentName || 'React class', ReactPropTypeLocationNames[location], propName) : invariant(false) : undefined;
|
7495 | error = propTypes[propName](props, propName, componentName, location);
|
7496 | } catch (ex) {
|
7497 | error = ex;
|
7498 | }
|
7499 | if (error instanceof Error) {
|
7500 | // We may want to extend this logic for similar errors in
|
7501 | // top-level render calls, so I'm abstracting it away into
|
7502 | // a function to minimize refactoring in the future
|
7503 | var addendum = getDeclarationErrorAddendum(this);
|
7504 |
|
7505 | if (location === ReactPropTypeLocations.prop) {
|
7506 | // Preface gives us something to blacklist in warning module
|
7507 | process.env.NODE_ENV !== 'production' ? warning(false, 'Failed Composite propType: %s%s', error.message, addendum) : undefined;
|
7508 | } else {
|
7509 | process.env.NODE_ENV !== 'production' ? warning(false, 'Failed Context Types: %s%s', error.message, addendum) : undefined;
|
7510 | }
|
7511 | }
|
7512 | }
|
7513 | }
|
7514 | },
|
7515 |
|
7516 | receiveComponent: function (nextElement, transaction, nextContext) {
|
7517 | var prevElement = this._currentElement;
|
7518 | var prevContext = this._context;
|
7519 |
|
7520 | this._pendingElement = null;
|
7521 |
|
7522 | this.updateComponent(transaction, prevElement, nextElement, prevContext, nextContext);
|
7523 | },
|
7524 |
|
7525 | /**
|
7526 | * If any of `_pendingElement`, `_pendingStateQueue`, or `_pendingForceUpdate`
|
7527 | * is set, update the component.
|
7528 | *
|
7529 | * @param {ReactReconcileTransaction} transaction
|
7530 | * @internal
|
7531 | */
|
7532 | performUpdateIfNecessary: function (transaction) {
|
7533 | if (this._pendingElement != null) {
|
7534 | ReactReconciler.receiveComponent(this, this._pendingElement || this._currentElement, transaction, this._context);
|
7535 | }
|
7536 |
|
7537 | if (this._pendingStateQueue !== null || this._pendingForceUpdate) {
|
7538 | this.updateComponent(transaction, this._currentElement, this._currentElement, this._context, this._context);
|
7539 | }
|
7540 | },
|
7541 |
|
7542 | /**
|
7543 | * Perform an update to a mounted component. The componentWillReceiveProps and
|
7544 | * shouldComponentUpdate methods are called, then (assuming the update isn't
|
7545 | * skipped) the remaining update lifecycle methods are called and the DOM
|
7546 | * representation is updated.
|
7547 | *
|
7548 | * By default, this implements React's rendering and reconciliation algorithm.
|
7549 | * Sophisticated clients may wish to override this.
|
7550 | *
|
7551 | * @param {ReactReconcileTransaction} transaction
|
7552 | * @param {ReactElement} prevParentElement
|
7553 | * @param {ReactElement} nextParentElement
|
7554 | * @internal
|
7555 | * @overridable
|
7556 | */
|
7557 | updateComponent: function (transaction, prevParentElement, nextParentElement, prevUnmaskedContext, nextUnmaskedContext) {
|
7558 | var inst = this._instance;
|
7559 |
|
7560 | var nextContext = this._context === nextUnmaskedContext ? inst.context : this._processContext(nextUnmaskedContext);
|
7561 | var nextProps;
|
7562 |
|
7563 | // Distinguish between a props update versus a simple state update
|
7564 | if (prevParentElement === nextParentElement) {
|
7565 | // Skip checking prop types again -- we don't read inst.props to avoid
|
7566 | // warning for DOM component props in this upgrade
|
7567 | nextProps = nextParentElement.props;
|
7568 | } else {
|
7569 | nextProps = this._processProps(nextParentElement.props);
|
7570 | // An update here will schedule an update but immediately set
|
7571 | // _pendingStateQueue which will ensure that any state updates gets
|
7572 | // immediately reconciled instead of waiting for the next batch.
|
7573 |
|
7574 | if (inst.componentWillReceiveProps) {
|
7575 | inst.componentWillReceiveProps(nextProps, nextContext);
|
7576 | }
|
7577 | }
|
7578 |
|
7579 | var nextState = this._processPendingState(nextProps, nextContext);
|
7580 |
|
7581 | var shouldUpdate = this._pendingForceUpdate || !inst.shouldComponentUpdate || inst.shouldComponentUpdate(nextProps, nextState, nextContext);
|
7582 |
|
7583 | if (process.env.NODE_ENV !== 'production') {
|
7584 | process.env.NODE_ENV !== 'production' ? warning(typeof shouldUpdate !== 'undefined', '%s.shouldComponentUpdate(): Returned undefined instead of a ' + 'boolean value. Make sure to return true or false.', this.getName() || 'ReactCompositeComponent') : undefined;
|
7585 | }
|
7586 |
|
7587 | if (shouldUpdate) {
|
7588 | this._pendingForceUpdate = false;
|
7589 | // Will set `this.props`, `this.state` and `this.context`.
|
7590 | this._performComponentUpdate(nextParentElement, nextProps, nextState, nextContext, transaction, nextUnmaskedContext);
|
7591 | } else {
|
7592 | // If it's determined that a component should not update, we still want
|
7593 | // to set props and state but we shortcut the rest of the update.
|
7594 | this._currentElement = nextParentElement;
|
7595 | this._context = nextUnmaskedContext;
|
7596 | inst.props = nextProps;
|
7597 | inst.state = nextState;
|
7598 | inst.context = nextContext;
|
7599 | }
|
7600 | },
|
7601 |
|
7602 | _processPendingState: function (props, context) {
|
7603 | var inst = this._instance;
|
7604 | var queue = this._pendingStateQueue;
|
7605 | var replace = this._pendingReplaceState;
|
7606 | this._pendingReplaceState = false;
|
7607 | this._pendingStateQueue = null;
|
7608 |
|
7609 | if (!queue) {
|
7610 | return inst.state;
|
7611 | }
|
7612 |
|
7613 | if (replace && queue.length === 1) {
|
7614 | return queue[0];
|
7615 | }
|
7616 |
|
7617 | var nextState = assign({}, replace ? queue[0] : inst.state);
|
7618 | for (var i = replace ? 1 : 0; i < queue.length; i++) {
|
7619 | var partial = queue[i];
|
7620 | assign(nextState, typeof partial === 'function' ? partial.call(inst, nextState, props, context) : partial);
|
7621 | }
|
7622 |
|
7623 | return nextState;
|
7624 | },
|
7625 |
|
7626 | /**
|
7627 | * Merges new props and state, notifies delegate methods of update and
|
7628 | * performs update.
|
7629 | *
|
7630 | * @param {ReactElement} nextElement Next element
|
7631 | * @param {object} nextProps Next public object to set as properties.
|
7632 | * @param {?object} nextState Next object to set as state.
|
7633 | * @param {?object} nextContext Next public object to set as context.
|
7634 | * @param {ReactReconcileTransaction} transaction
|
7635 | * @param {?object} unmaskedContext
|
7636 | * @private
|
7637 | */
|
7638 | _performComponentUpdate: function (nextElement, nextProps, nextState, nextContext, transaction, unmaskedContext) {
|
7639 | var inst = this._instance;
|
7640 |
|
7641 | var hasComponentDidUpdate = Boolean(inst.componentDidUpdate);
|
7642 | var prevProps;
|
7643 | var prevState;
|
7644 | var prevContext;
|
7645 | if (hasComponentDidUpdate) {
|
7646 | prevProps = inst.props;
|
7647 | prevState = inst.state;
|
7648 | prevContext = inst.context;
|
7649 | }
|
7650 |
|
7651 | if (inst.componentWillUpdate) {
|
7652 | inst.componentWillUpdate(nextProps, nextState, nextContext);
|
7653 | }
|
7654 |
|
7655 | this._currentElement = nextElement;
|
7656 | this._context = unmaskedContext;
|
7657 | inst.props = nextProps;
|
7658 | inst.state = nextState;
|
7659 | inst.context = nextContext;
|
7660 |
|
7661 | this._updateRenderedComponent(transaction, unmaskedContext);
|
7662 |
|
7663 | if (hasComponentDidUpdate) {
|
7664 | transaction.getReactMountReady().enqueue(inst.componentDidUpdate.bind(inst, prevProps, prevState, prevContext), inst);
|
7665 | }
|
7666 | },
|
7667 |
|
7668 | /**
|
7669 | * Call the component's `render` method and update the DOM accordingly.
|
7670 | *
|
7671 | * @param {ReactReconcileTransaction} transaction
|
7672 | * @internal
|
7673 | */
|
7674 | _updateRenderedComponent: function (transaction, context) {
|
7675 | var prevComponentInstance = this._renderedComponent;
|
7676 | var prevRenderedElement = prevComponentInstance._currentElement;
|
7677 | var nextRenderedElement = this._renderValidatedComponent();
|
7678 | if (shouldUpdateReactComponent(prevRenderedElement, nextRenderedElement)) {
|
7679 | ReactReconciler.receiveComponent(prevComponentInstance, nextRenderedElement, transaction, this._processChildContext(context));
|
7680 | } else {
|
7681 | // These two IDs are actually the same! But nothing should rely on that.
|
7682 | var thisID = this._rootNodeID;
|
7683 | var prevComponentID = prevComponentInstance._rootNodeID;
|
7684 | ReactReconciler.unmountComponent(prevComponentInstance);
|
7685 |
|
7686 | this._renderedComponent = this._instantiateReactComponent(nextRenderedElement);
|
7687 | var nextMarkup = ReactReconciler.mountComponent(this._renderedComponent, thisID, transaction, this._processChildContext(context));
|
7688 | this._replaceNodeWithMarkupByID(prevComponentID, nextMarkup);
|
7689 | }
|
7690 | },
|
7691 |
|
7692 | /**
|
7693 | * @protected
|
7694 | */
|
7695 | _replaceNodeWithMarkupByID: function (prevComponentID, nextMarkup) {
|
7696 | ReactComponentEnvironment.replaceNodeWithMarkupByID(prevComponentID, nextMarkup);
|
7697 | },
|
7698 |
|
7699 | /**
|
7700 | * @protected
|
7701 | */
|
7702 | _renderValidatedComponentWithoutOwnerOrContext: function () {
|
7703 | var inst = this._instance;
|
7704 | var renderedComponent = inst.render();
|
7705 | if (process.env.NODE_ENV !== 'production') {
|
7706 | // We allow auto-mocks to proceed as if they're returning null.
|
7707 | if (typeof renderedComponent === 'undefined' && inst.render._isMockFunction) {
|
7708 | // This is probably bad practice. Consider warning here and
|
7709 | // deprecating this convenience.
|
7710 | renderedComponent = null;
|
7711 | }
|
7712 | }
|
7713 |
|
7714 | return renderedComponent;
|
7715 | },
|
7716 |
|
7717 | /**
|
7718 | * @private
|
7719 | */
|
7720 | _renderValidatedComponent: function () {
|
7721 | var renderedComponent;
|
7722 | ReactCurrentOwner.current = this;
|
7723 | try {
|
7724 | renderedComponent = this._renderValidatedComponentWithoutOwnerOrContext();
|
7725 | } finally {
|
7726 | ReactCurrentOwner.current = null;
|
7727 | }
|
7728 | !(
|
7729 | // TODO: An `isValidNode` function would probably be more appropriate
|
7730 | renderedComponent === null || renderedComponent === false || ReactElement.isValidElement(renderedComponent)) ? process.env.NODE_ENV !== 'production' ? invariant(false, '%s.render(): A valid ReactComponent must be returned. You may have ' + 'returned undefined, an array or some other invalid object.', this.getName() || 'ReactCompositeComponent') : invariant(false) : undefined;
|
7731 | return renderedComponent;
|
7732 | },
|
7733 |
|
7734 | /**
|
7735 | * Lazily allocates the refs object and stores `component` as `ref`.
|
7736 | *
|
7737 | * @param {string} ref Reference name.
|
7738 | * @param {component} component Component to store as `ref`.
|
7739 | * @final
|
7740 | * @private
|
7741 | */
|
7742 | attachRef: function (ref, component) {
|
7743 | var inst = this.getPublicInstance();
|
7744 | !(inst != null) ? process.env.NODE_ENV !== 'production' ? invariant(false, 'Stateless function components cannot have refs.') : invariant(false) : undefined;
|
7745 | var publicComponentInstance = component.getPublicInstance();
|
7746 | if (process.env.NODE_ENV !== 'production') {
|
7747 | var componentName = component && component.getName ? component.getName() : 'a component';
|
7748 | process.env.NODE_ENV !== 'production' ? warning(publicComponentInstance != null, 'Stateless function components cannot be given refs ' + '(See ref "%s" in %s created by %s). ' + 'Attempts to access this ref will fail.', ref, componentName, this.getName()) : undefined;
|
7749 | }
|
7750 | var refs = inst.refs === emptyObject ? inst.refs = {} : inst.refs;
|
7751 | refs[ref] = publicComponentInstance;
|
7752 | },
|
7753 |
|
7754 | /**
|
7755 | * Detaches a reference name.
|
7756 | *
|
7757 | * @param {string} ref Name to dereference.
|
7758 | * @final
|
7759 | * @private
|
7760 | */
|
7761 | detachRef: function (ref) {
|
7762 | var refs = this.getPublicInstance().refs;
|
7763 | delete refs[ref];
|
7764 | },
|
7765 |
|
7766 | /**
|
7767 | * Get a text description of the component that can be used to identify it
|
7768 | * in error messages.
|
7769 | * @return {string} The name or null.
|
7770 | * @internal
|
7771 | */
|
7772 | getName: function () {
|
7773 | var type = this._currentElement.type;
|
7774 | var constructor = this._instance && this._instance.constructor;
|
7775 | return type.displayName || constructor && constructor.displayName || type.name || constructor && constructor.name || null;
|
7776 | },
|
7777 |
|
7778 | /**
|
7779 | * Get the publicly accessible representation of this component - i.e. what
|
7780 | * is exposed by refs and returned by render. Can be null for stateless
|
7781 | * components.
|
7782 | *
|
7783 | * @return {ReactComponent} the public component instance.
|
7784 | * @internal
|
7785 | */
|
7786 | getPublicInstance: function () {
|
7787 | var inst = this._instance;
|
7788 | if (inst instanceof StatelessComponent) {
|
7789 | return null;
|
7790 | }
|
7791 | return inst;
|
7792 | },
|
7793 |
|
7794 | // Stub
|
7795 | _instantiateReactComponent: null
|
7796 |
|
7797 | };
|
7798 |
|
7799 | ReactPerf.measureMethods(ReactCompositeComponentMixin, 'ReactCompositeComponent', {
|
7800 | mountComponent: 'mountComponent',
|
7801 | updateComponent: 'updateComponent',
|
7802 | _renderValidatedComponent: '_renderValidatedComponent'
|
7803 | });
|
7804 |
|
7805 | var ReactCompositeComponent = {
|
7806 |
|
7807 | Mixin: ReactCompositeComponentMixin
|
7808 |
|
7809 | };
|
7810 |
|
7811 | module.exports = ReactCompositeComponent;
|
7812 | /* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(5)))
|
7813 |
|
7814 | /***/ },
|
7815 | /* 65 */
|
7816 | /***/ function(module, exports, __webpack_require__) {
|
7817 |
|
7818 | /* WEBPACK VAR INJECTION */(function(process) {/**
|
7819 | * Copyright 2014-2015, Facebook, Inc.
|
7820 | * All rights reserved.
|
7821 | *
|
7822 | * This source code is licensed under the BSD-style license found in the
|
7823 | * LICENSE file in the root directory of this source tree. An additional grant
|
7824 | * of patent rights can be found in the PATENTS file in the same directory.
|
7825 | *
|
7826 | * @providesModule ReactComponentEnvironment
|
7827 | */
|
7828 |
|
7829 | 'use strict';
|
7830 |
|
7831 | var invariant = __webpack_require__(14);
|
7832 |
|
7833 | var injected = false;
|
7834 |
|
7835 | var ReactComponentEnvironment = {
|
7836 |
|
7837 | /**
|
7838 | * Optionally injectable environment dependent cleanup hook. (server vs.
|
7839 | * browser etc). Example: A browser system caches DOM nodes based on component
|
7840 | * ID and must remove that cache entry when this instance is unmounted.
|
7841 | */
|
7842 | unmountIDFromEnvironment: null,
|
7843 |
|
7844 | /**
|
7845 | * Optionally injectable hook for swapping out mount images in the middle of
|
7846 | * the tree.
|
7847 | */
|
7848 | replaceNodeWithMarkupByID: null,
|
7849 |
|
7850 | /**
|
7851 | * Optionally injectable hook for processing a queue of child updates. Will
|
7852 | * later move into MultiChildComponents.
|
7853 | */
|
7854 | processChildrenUpdates: null,
|
7855 |
|
7856 | injection: {
|
7857 | injectEnvironment: function (environment) {
|
7858 | !!injected ? process.env.NODE_ENV !== 'production' ? invariant(false, 'ReactCompositeComponent: injectEnvironment() can only be called once.') : invariant(false) : undefined;
|
7859 | ReactComponentEnvironment.unmountIDFromEnvironment = environment.unmountIDFromEnvironment;
|
7860 | ReactComponentEnvironment.replaceNodeWithMarkupByID = environment.replaceNodeWithMarkupByID;
|
7861 | ReactComponentEnvironment.processChildrenUpdates = environment.processChildrenUpdates;
|
7862 | injected = true;
|
7863 | }
|
7864 | }
|
7865 |
|
7866 | };
|
7867 |
|
7868 | module.exports = ReactComponentEnvironment;
|
7869 | /* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(5)))
|
7870 |
|
7871 | /***/ },
|
7872 | /* 66 */
|
7873 | /***/ function(module, exports, __webpack_require__) {
|
7874 |
|
7875 | /**
|
7876 | * Copyright 2013-2015, Facebook, Inc.
|
7877 | * All rights reserved.
|
7878 | *
|
7879 | * This source code is licensed under the BSD-style license found in the
|
7880 | * LICENSE file in the root directory of this source tree. An additional grant
|
7881 | * of patent rights can be found in the PATENTS file in the same directory.
|
7882 | *
|
7883 | * @providesModule ReactPropTypeLocations
|
7884 | */
|
7885 |
|
7886 | 'use strict';
|
7887 |
|
7888 | var keyMirror = __webpack_require__(18);
|
7889 |
|
7890 | var ReactPropTypeLocations = keyMirror({
|
7891 | prop: null,
|
7892 | context: null,
|
7893 | childContext: null
|
7894 | });
|
7895 |
|
7896 | module.exports = ReactPropTypeLocations;
|
7897 |
|
7898 | /***/ },
|
7899 | /* 67 */
|
7900 | /***/ function(module, exports, __webpack_require__) {
|
7901 |
|
7902 | /* WEBPACK VAR INJECTION */(function(process) {/**
|
7903 | * Copyright 2013-2015, Facebook, Inc.
|
7904 | * All rights reserved.
|
7905 | *
|
7906 | * This source code is licensed under the BSD-style license found in the
|
7907 | * LICENSE file in the root directory of this source tree. An additional grant
|
7908 | * of patent rights can be found in the PATENTS file in the same directory.
|
7909 | *
|
7910 | * @providesModule ReactPropTypeLocationNames
|
7911 | */
|
7912 |
|
7913 | 'use strict';
|
7914 |
|
7915 | var ReactPropTypeLocationNames = {};
|
7916 |
|
7917 | if (process.env.NODE_ENV !== 'production') {
|
7918 | ReactPropTypeLocationNames = {
|
7919 | prop: 'prop',
|
7920 | context: 'context',
|
7921 | childContext: 'child context'
|
7922 | };
|
7923 | }
|
7924 |
|
7925 | module.exports = ReactPropTypeLocationNames;
|
7926 | /* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(5)))
|
7927 |
|
7928 | /***/ },
|
7929 | /* 68 */
|
7930 | /***/ function(module, exports) {
|
7931 |
|
7932 | /**
|
7933 | * Copyright 2013-2015, Facebook, Inc.
|
7934 | * All rights reserved.
|
7935 | *
|
7936 | * This source code is licensed under the BSD-style license found in the
|
7937 | * LICENSE file in the root directory of this source tree. An additional grant
|
7938 | * of patent rights can be found in the PATENTS file in the same directory.
|
7939 | *
|
7940 | * @providesModule shouldUpdateReactComponent
|
7941 | * @typechecks static-only
|
7942 | */
|
7943 |
|
7944 | 'use strict';
|
7945 |
|
7946 | /**
|
7947 | * Given a `prevElement` and `nextElement`, determines if the existing
|
7948 | * instance should be updated as opposed to being destroyed or replaced by a new
|
7949 | * instance. Both arguments are elements. This ensures that this logic can
|
7950 | * operate on stateless trees without any backing instance.
|
7951 | *
|
7952 | * @param {?object} prevElement
|
7953 | * @param {?object} nextElement
|
7954 | * @return {boolean} True if the existing instance should be updated.
|
7955 | * @protected
|
7956 | */
|
7957 | function shouldUpdateReactComponent(prevElement, nextElement) {
|
7958 | var prevEmpty = prevElement === null || prevElement === false;
|
7959 | var nextEmpty = nextElement === null || nextElement === false;
|
7960 | if (prevEmpty || nextEmpty) {
|
7961 | return prevEmpty === nextEmpty;
|
7962 | }
|
7963 |
|
7964 | var prevType = typeof prevElement;
|
7965 | var nextType = typeof nextElement;
|
7966 | if (prevType === 'string' || prevType === 'number') {
|
7967 | return nextType === 'string' || nextType === 'number';
|
7968 | } else {
|
7969 | return nextType === 'object' && prevElement.type === nextElement.type && prevElement.key === nextElement.key;
|
7970 | }
|
7971 | return false;
|
7972 | }
|
7973 |
|
7974 | module.exports = shouldUpdateReactComponent;
|
7975 |
|
7976 | /***/ },
|
7977 | /* 69 */
|
7978 | /***/ function(module, exports, __webpack_require__) {
|
7979 |
|
7980 | /**
|
7981 | * Copyright 2014-2015, Facebook, Inc.
|
7982 | * All rights reserved.
|
7983 | *
|
7984 | * This source code is licensed under the BSD-style license found in the
|
7985 | * LICENSE file in the root directory of this source tree. An additional grant
|
7986 | * of patent rights can be found in the PATENTS file in the same directory.
|
7987 | *
|
7988 | * @providesModule ReactEmptyComponent
|
7989 | */
|
7990 |
|
7991 | 'use strict';
|
7992 |
|
7993 | var ReactElement = __webpack_require__(43);
|
7994 | var ReactEmptyComponentRegistry = __webpack_require__(45);
|
7995 | var ReactReconciler = __webpack_require__(51);
|
7996 |
|
7997 | var assign = __webpack_require__(40);
|
7998 |
|
7999 | var placeholderElement;
|
8000 |
|
8001 | var ReactEmptyComponentInjection = {
|
8002 | injectEmptyComponent: function (component) {
|
8003 | placeholderElement = ReactElement.createElement(component);
|
8004 | }
|
8005 | };
|
8006 |
|
8007 | function registerNullComponentID() {
|
8008 | ReactEmptyComponentRegistry.registerNullComponentID(this._rootNodeID);
|
8009 | }
|
8010 |
|
8011 | var ReactEmptyComponent = function (instantiate) {
|
8012 | this._currentElement = null;
|
8013 | this._rootNodeID = null;
|
8014 | this._renderedComponent = instantiate(placeholderElement);
|
8015 | };
|
8016 | assign(ReactEmptyComponent.prototype, {
|
8017 | construct: function (element) {},
|
8018 | mountComponent: function (rootID, transaction, context) {
|
8019 | transaction.getReactMountReady().enqueue(registerNullComponentID, this);
|
8020 | this._rootNodeID = rootID;
|
8021 | return ReactReconciler.mountComponent(this._renderedComponent, rootID, transaction, context);
|
8022 | },
|
8023 | receiveComponent: function () {},
|
8024 | unmountComponent: function (rootID, transaction, context) {
|
8025 | ReactReconciler.unmountComponent(this._renderedComponent);
|
8026 | ReactEmptyComponentRegistry.deregisterNullComponentID(this._rootNodeID);
|
8027 | this._rootNodeID = null;
|
8028 | this._renderedComponent = null;
|
8029 | }
|
8030 | });
|
8031 |
|
8032 | ReactEmptyComponent.injection = ReactEmptyComponentInjection;
|
8033 |
|
8034 | module.exports = ReactEmptyComponent;
|
8035 |
|
8036 | /***/ },
|
8037 | /* 70 */
|
8038 | /***/ function(module, exports, __webpack_require__) {
|
8039 |
|
8040 | /* WEBPACK VAR INJECTION */(function(process) {/**
|
8041 | * Copyright 2014-2015, Facebook, Inc.
|
8042 | * All rights reserved.
|
8043 | *
|
8044 | * This source code is licensed under the BSD-style license found in the
|
8045 | * LICENSE file in the root directory of this source tree. An additional grant
|
8046 | * of patent rights can be found in the PATENTS file in the same directory.
|
8047 | *
|
8048 | * @providesModule ReactNativeComponent
|
8049 | */
|
8050 |
|
8051 | 'use strict';
|
8052 |
|
8053 | var assign = __webpack_require__(40);
|
8054 | var invariant = __webpack_require__(14);
|
8055 |
|
8056 | var autoGenerateWrapperClass = null;
|
8057 | var genericComponentClass = null;
|
8058 | // This registry keeps track of wrapper classes around native tags.
|
8059 | var tagToComponentClass = {};
|
8060 | var textComponentClass = null;
|
8061 |
|
8062 | var ReactNativeComponentInjection = {
|
8063 | // This accepts a class that receives the tag string. This is a catch all
|
8064 | // that can render any kind of tag.
|
8065 | injectGenericComponentClass: function (componentClass) {
|
8066 | genericComponentClass = componentClass;
|
8067 | },
|
8068 | // This accepts a text component class that takes the text string to be
|
8069 | // rendered as props.
|
8070 | injectTextComponentClass: function (componentClass) {
|
8071 | textComponentClass = componentClass;
|
8072 | },
|
8073 | // This accepts a keyed object with classes as values. Each key represents a
|
8074 | // tag. That particular tag will use this class instead of the generic one.
|
8075 | injectComponentClasses: function (componentClasses) {
|
8076 | assign(tagToComponentClass, componentClasses);
|
8077 | }
|
8078 | };
|
8079 |
|
8080 | /**
|
8081 | * Get a composite component wrapper class for a specific tag.
|
8082 | *
|
8083 | * @param {ReactElement} element The tag for which to get the class.
|
8084 | * @return {function} The React class constructor function.
|
8085 | */
|
8086 | function getComponentClassForElement(element) {
|
8087 | if (typeof element.type === 'function') {
|
8088 | return element.type;
|
8089 | }
|
8090 | var tag = element.type;
|
8091 | var componentClass = tagToComponentClass[tag];
|
8092 | if (componentClass == null) {
|
8093 | tagToComponentClass[tag] = componentClass = autoGenerateWrapperClass(tag);
|
8094 | }
|
8095 | return componentClass;
|
8096 | }
|
8097 |
|
8098 | /**
|
8099 | * Get a native internal component class for a specific tag.
|
8100 | *
|
8101 | * @param {ReactElement} element The element to create.
|
8102 | * @return {function} The internal class constructor function.
|
8103 | */
|
8104 | function createInternalComponent(element) {
|
8105 | !genericComponentClass ? process.env.NODE_ENV !== 'production' ? invariant(false, 'There is no registered component for the tag %s', element.type) : invariant(false) : undefined;
|
8106 | return new genericComponentClass(element.type, element.props);
|
8107 | }
|
8108 |
|
8109 | /**
|
8110 | * @param {ReactText} text
|
8111 | * @return {ReactComponent}
|
8112 | */
|
8113 | function createInstanceForText(text) {
|
8114 | return new textComponentClass(text);
|
8115 | }
|
8116 |
|
8117 | /**
|
8118 | * @param {ReactComponent} component
|
8119 | * @return {boolean}
|
8120 | */
|
8121 | function isTextComponent(component) {
|
8122 | return component instanceof textComponentClass;
|
8123 | }
|
8124 |
|
8125 | var ReactNativeComponent = {
|
8126 | getComponentClassForElement: getComponentClassForElement,
|
8127 | createInternalComponent: createInternalComponent,
|
8128 | createInstanceForText: createInstanceForText,
|
8129 | isTextComponent: isTextComponent,
|
8130 | injection: ReactNativeComponentInjection
|
8131 | };
|
8132 |
|
8133 | module.exports = ReactNativeComponent;
|
8134 | /* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(5)))
|
8135 |
|
8136 | /***/ },
|
8137 | /* 71 */
|
8138 | /***/ function(module, exports, __webpack_require__) {
|
8139 |
|
8140 | /* WEBPACK VAR INJECTION */(function(process) {/**
|
8141 | * Copyright 2015, Facebook, Inc.
|
8142 | * All rights reserved.
|
8143 | *
|
8144 | * This source code is licensed under the BSD-style license found in the
|
8145 | * LICENSE file in the root directory of this source tree. An additional grant
|
8146 | * of patent rights can be found in the PATENTS file in the same directory.
|
8147 | *
|
8148 | * @providesModule validateDOMNesting
|
8149 | */
|
8150 |
|
8151 | 'use strict';
|
8152 |
|
8153 | var assign = __webpack_require__(40);
|
8154 | var emptyFunction = __webpack_require__(16);
|
8155 | var warning = __webpack_require__(26);
|
8156 |
|
8157 | var validateDOMNesting = emptyFunction;
|
8158 |
|
8159 | if (process.env.NODE_ENV !== 'production') {
|
8160 | // This validation code was written based on the HTML5 parsing spec:
|
8161 | // https://html.spec.whatwg.org/multipage/syntax.html#has-an-element-in-scope
|
8162 | //
|
8163 | // Note: this does not catch all invalid nesting, nor does it try to (as it's
|
8164 | // not clear what practical benefit doing so provides); instead, we warn only
|
8165 | // for cases where the parser will give a parse tree differing from what React
|
8166 | // intended. For example, <b><div></div></b> is invalid but we don't warn
|
8167 | // because it still parses correctly; we do warn for other cases like nested
|
8168 | // <p> tags where the beginning of the second element implicitly closes the
|
8169 | // first, causing a confusing mess.
|
8170 |
|
8171 | // https://html.spec.whatwg.org/multipage/syntax.html#special
|
8172 | var specialTags = ['address', 'applet', 'area', 'article', 'aside', 'base', 'basefont', 'bgsound', 'blockquote', 'body', 'br', 'button', 'caption', 'center', 'col', 'colgroup', 'dd', 'details', 'dir', 'div', 'dl', 'dt', 'embed', 'fieldset', 'figcaption', 'figure', 'footer', 'form', 'frame', 'frameset', 'h1', 'h2', 'h3', 'h4', 'h5', 'h6', 'head', 'header', 'hgroup', 'hr', 'html', 'iframe', 'img', 'input', 'isindex', 'li', 'link', 'listing', 'main', 'marquee', 'menu', 'menuitem', 'meta', 'nav', 'noembed', 'noframes', 'noscript', 'object', 'ol', 'p', 'param', 'plaintext', 'pre', 'script', 'section', 'select', 'source', 'style', 'summary', 'table', 'tbody', 'td', 'template', 'textarea', 'tfoot', 'th', 'thead', 'title', 'tr', 'track', 'ul', 'wbr', 'xmp'];
|
8173 |
|
8174 | // https://html.spec.whatwg.org/multipage/syntax.html#has-an-element-in-scope
|
8175 | var inScopeTags = ['applet', 'caption', 'html', 'table', 'td', 'th', 'marquee', 'object', 'template',
|
8176 |
|
8177 | // https://html.spec.whatwg.org/multipage/syntax.html#html-integration-point
|
8178 | // TODO: Distinguish by namespace here -- for <title>, including it here
|
8179 | // errs on the side of fewer warnings
|
8180 | 'foreignObject', 'desc', 'title'];
|
8181 |
|
8182 | // https://html.spec.whatwg.org/multipage/syntax.html#has-an-element-in-button-scope
|
8183 | var buttonScopeTags = inScopeTags.concat(['button']);
|
8184 |
|
8185 | // https://html.spec.whatwg.org/multipage/syntax.html#generate-implied-end-tags
|
8186 | var impliedEndTags = ['dd', 'dt', 'li', 'option', 'optgroup', 'p', 'rp', 'rt'];
|
8187 |
|
8188 | var emptyAncestorInfo = {
|
8189 | parentTag: null,
|
8190 |
|
8191 | formTag: null,
|
8192 | aTagInScope: null,
|
8193 | buttonTagInScope: null,
|
8194 | nobrTagInScope: null,
|
8195 | pTagInButtonScope: null,
|
8196 |
|
8197 | listItemTagAutoclosing: null,
|
8198 | dlItemTagAutoclosing: null
|
8199 | };
|
8200 |
|
8201 | var updatedAncestorInfo = function (oldInfo, tag, instance) {
|
8202 | var ancestorInfo = assign({}, oldInfo || emptyAncestorInfo);
|
8203 | var info = { tag: tag, instance: instance };
|
8204 |
|
8205 | if (inScopeTags.indexOf(tag) !== -1) {
|
8206 | ancestorInfo.aTagInScope = null;
|
8207 | ancestorInfo.buttonTagInScope = null;
|
8208 | ancestorInfo.nobrTagInScope = null;
|
8209 | }
|
8210 | if (buttonScopeTags.indexOf(tag) !== -1) {
|
8211 | ancestorInfo.pTagInButtonScope = null;
|
8212 | }
|
8213 |
|
8214 | // See rules for 'li', 'dd', 'dt' start tags in
|
8215 | // https://html.spec.whatwg.org/multipage/syntax.html#parsing-main-inbody
|
8216 | if (specialTags.indexOf(tag) !== -1 && tag !== 'address' && tag !== 'div' && tag !== 'p') {
|
8217 | ancestorInfo.listItemTagAutoclosing = null;
|
8218 | ancestorInfo.dlItemTagAutoclosing = null;
|
8219 | }
|
8220 |
|
8221 | ancestorInfo.parentTag = info;
|
8222 |
|
8223 | if (tag === 'form') {
|
8224 | ancestorInfo.formTag = info;
|
8225 | }
|
8226 | if (tag === 'a') {
|
8227 | ancestorInfo.aTagInScope = info;
|
8228 | }
|
8229 | if (tag === 'button') {
|
8230 | ancestorInfo.buttonTagInScope = info;
|
8231 | }
|
8232 | if (tag === 'nobr') {
|
8233 | ancestorInfo.nobrTagInScope = info;
|
8234 | }
|
8235 | if (tag === 'p') {
|
8236 | ancestorInfo.pTagInButtonScope = info;
|
8237 | }
|
8238 | if (tag === 'li') {
|
8239 | ancestorInfo.listItemTagAutoclosing = info;
|
8240 | }
|
8241 | if (tag === 'dd' || tag === 'dt') {
|
8242 | ancestorInfo.dlItemTagAutoclosing = info;
|
8243 | }
|
8244 |
|
8245 | return ancestorInfo;
|
8246 | };
|
8247 |
|
8248 | /**
|
8249 | * Returns whether
|
8250 | */
|
8251 | var isTagValidWithParent = function (tag, parentTag) {
|
8252 | // First, let's check if we're in an unusual parsing mode...
|
8253 | switch (parentTag) {
|
8254 | // https://html.spec.whatwg.org/multipage/syntax.html#parsing-main-inselect
|
8255 | case 'select':
|
8256 | return tag === 'option' || tag === 'optgroup' || tag === '#text';
|
8257 | case 'optgroup':
|
8258 | return tag === 'option' || tag === '#text';
|
8259 | // Strictly speaking, seeing an <option> doesn't mean we're in a <select>
|
8260 | // but
|
8261 | case 'option':
|
8262 | return tag === '#text';
|
8263 |
|
8264 | // https://html.spec.whatwg.org/multipage/syntax.html#parsing-main-intd
|
8265 | // https://html.spec.whatwg.org/multipage/syntax.html#parsing-main-incaption
|
8266 | // No special behavior since these rules fall back to "in body" mode for
|
8267 | // all except special table nodes which cause bad parsing behavior anyway.
|
8268 |
|
8269 | // https://html.spec.whatwg.org/multipage/syntax.html#parsing-main-intr
|
8270 | case 'tr':
|
8271 | return tag === 'th' || tag === 'td' || tag === 'style' || tag === 'script' || tag === 'template';
|
8272 |
|
8273 | // https://html.spec.whatwg.org/multipage/syntax.html#parsing-main-intbody
|
8274 | case 'tbody':
|
8275 | case 'thead':
|
8276 | case 'tfoot':
|
8277 | return tag === 'tr' || tag === 'style' || tag === 'script' || tag === 'template';
|
8278 |
|
8279 | // https://html.spec.whatwg.org/multipage/syntax.html#parsing-main-incolgroup
|
8280 | case 'colgroup':
|
8281 | return tag === 'col' || tag === 'template';
|
8282 |
|
8283 | // https://html.spec.whatwg.org/multipage/syntax.html#parsing-main-intable
|
8284 | case 'table':
|
8285 | return tag === 'caption' || tag === 'colgroup' || tag === 'tbody' || tag === 'tfoot' || tag === 'thead' || tag === 'style' || tag === 'script' || tag === 'template';
|
8286 |
|
8287 | // https://html.spec.whatwg.org/multipage/syntax.html#parsing-main-inhead
|
8288 | case 'head':
|
8289 | return tag === 'base' || tag === 'basefont' || tag === 'bgsound' || tag === 'link' || tag === 'meta' || tag === 'title' || tag === 'noscript' || tag === 'noframes' || tag === 'style' || tag === 'script' || tag === 'template';
|
8290 |
|
8291 | // https://html.spec.whatwg.org/multipage/semantics.html#the-html-element
|
8292 | case 'html':
|
8293 | return tag === 'head' || tag === 'body';
|
8294 | }
|
8295 |
|
8296 | // Probably in the "in body" parsing mode, so we outlaw only tag combos
|
8297 | // where the parsing rules cause implicit opens or closes to be added.
|
8298 | // https://html.spec.whatwg.org/multipage/syntax.html#parsing-main-inbody
|
8299 | switch (tag) {
|
8300 | case 'h1':
|
8301 | case 'h2':
|
8302 | case 'h3':
|
8303 | case 'h4':
|
8304 | case 'h5':
|
8305 | case 'h6':
|
8306 | return parentTag !== 'h1' && parentTag !== 'h2' && parentTag !== 'h3' && parentTag !== 'h4' && parentTag !== 'h5' && parentTag !== 'h6';
|
8307 |
|
8308 | case 'rp':
|
8309 | case 'rt':
|
8310 | return impliedEndTags.indexOf(parentTag) === -1;
|
8311 |
|
8312 | case 'caption':
|
8313 | case 'col':
|
8314 | case 'colgroup':
|
8315 | case 'frame':
|
8316 | case 'head':
|
8317 | case 'tbody':
|
8318 | case 'td':
|
8319 | case 'tfoot':
|
8320 | case 'th':
|
8321 | case 'thead':
|
8322 | case 'tr':
|
8323 | // These tags are only valid with a few parents that have special child
|
8324 | // parsing rules -- if we're down here, then none of those matched and
|
8325 | // so we allow it only if we don't know what the parent is, as all other
|
8326 | // cases are invalid.
|
8327 | return parentTag == null;
|
8328 | }
|
8329 |
|
8330 | return true;
|
8331 | };
|
8332 |
|
8333 | /**
|
8334 | * Returns whether
|
8335 | */
|
8336 | var findInvalidAncestorForTag = function (tag, ancestorInfo) {
|
8337 | switch (tag) {
|
8338 | case 'address':
|
8339 | case 'article':
|
8340 | case 'aside':
|
8341 | case 'blockquote':
|
8342 | case 'center':
|
8343 | case 'details':
|
8344 | case 'dialog':
|
8345 | case 'dir':
|
8346 | case 'div':
|
8347 | case 'dl':
|
8348 | case 'fieldset':
|
8349 | case 'figcaption':
|
8350 | case 'figure':
|
8351 | case 'footer':
|
8352 | case 'header':
|
8353 | case 'hgroup':
|
8354 | case 'main':
|
8355 | case 'menu':
|
8356 | case 'nav':
|
8357 | case 'ol':
|
8358 | case 'p':
|
8359 | case 'section':
|
8360 | case 'summary':
|
8361 | case 'ul':
|
8362 |
|
8363 | case 'pre':
|
8364 | case 'listing':
|
8365 |
|
8366 | case 'table':
|
8367 |
|
8368 | case 'hr':
|
8369 |
|
8370 | case 'xmp':
|
8371 |
|
8372 | case 'h1':
|
8373 | case 'h2':
|
8374 | case 'h3':
|
8375 | case 'h4':
|
8376 | case 'h5':
|
8377 | case 'h6':
|
8378 | return ancestorInfo.pTagInButtonScope;
|
8379 |
|
8380 | case 'form':
|
8381 | return ancestorInfo.formTag || ancestorInfo.pTagInButtonScope;
|
8382 |
|
8383 | case 'li':
|
8384 | return ancestorInfo.listItemTagAutoclosing;
|
8385 |
|
8386 | case 'dd':
|
8387 | case 'dt':
|
8388 | return ancestorInfo.dlItemTagAutoclosing;
|
8389 |
|
8390 | case 'button':
|
8391 | return ancestorInfo.buttonTagInScope;
|
8392 |
|
8393 | case 'a':
|
8394 | // Spec says something about storing a list of markers, but it sounds
|
8395 | // equivalent to this check.
|
8396 | return ancestorInfo.aTagInScope;
|
8397 |
|
8398 | case 'nobr':
|
8399 | return ancestorInfo.nobrTagInScope;
|
8400 | }
|
8401 |
|
8402 | return null;
|
8403 | };
|
8404 |
|
8405 | /**
|
8406 | * Given a ReactCompositeComponent instance, return a list of its recursive
|
8407 | * owners, starting at the root and ending with the instance itself.
|
8408 | */
|
8409 | var findOwnerStack = function (instance) {
|
8410 | if (!instance) {
|
8411 | return [];
|
8412 | }
|
8413 |
|
8414 | var stack = [];
|
8415 | /*eslint-disable space-after-keywords */
|
8416 | do {
|
8417 | /*eslint-enable space-after-keywords */
|
8418 | stack.push(instance);
|
8419 | } while (instance = instance._currentElement._owner);
|
8420 | stack.reverse();
|
8421 | return stack;
|
8422 | };
|
8423 |
|
8424 | var didWarn = {};
|
8425 |
|
8426 | validateDOMNesting = function (childTag, childInstance, ancestorInfo) {
|
8427 | ancestorInfo = ancestorInfo || emptyAncestorInfo;
|
8428 | var parentInfo = ancestorInfo.parentTag;
|
8429 | var parentTag = parentInfo && parentInfo.tag;
|
8430 |
|
8431 | var invalidParent = isTagValidWithParent(childTag, parentTag) ? null : parentInfo;
|
8432 | var invalidAncestor = invalidParent ? null : findInvalidAncestorForTag(childTag, ancestorInfo);
|
8433 | var problematic = invalidParent || invalidAncestor;
|
8434 |
|
8435 | if (problematic) {
|
8436 | var ancestorTag = problematic.tag;
|
8437 | var ancestorInstance = problematic.instance;
|
8438 |
|
8439 | var childOwner = childInstance && childInstance._currentElement._owner;
|
8440 | var ancestorOwner = ancestorInstance && ancestorInstance._currentElement._owner;
|
8441 |
|
8442 | var childOwners = findOwnerStack(childOwner);
|
8443 | var ancestorOwners = findOwnerStack(ancestorOwner);
|
8444 |
|
8445 | var minStackLen = Math.min(childOwners.length, ancestorOwners.length);
|
8446 | var i;
|
8447 |
|
8448 | var deepestCommon = -1;
|
8449 | for (i = 0; i < minStackLen; i++) {
|
8450 | if (childOwners[i] === ancestorOwners[i]) {
|
8451 | deepestCommon = i;
|
8452 | } else {
|
8453 | break;
|
8454 | }
|
8455 | }
|
8456 |
|
8457 | var UNKNOWN = '(unknown)';
|
8458 | var childOwnerNames = childOwners.slice(deepestCommon + 1).map(function (inst) {
|
8459 | return inst.getName() || UNKNOWN;
|
8460 | });
|
8461 | var ancestorOwnerNames = ancestorOwners.slice(deepestCommon + 1).map(function (inst) {
|
8462 | return inst.getName() || UNKNOWN;
|
8463 | });
|
8464 | var ownerInfo = [].concat(
|
8465 | // If the parent and child instances have a common owner ancestor, start
|
8466 | // with that -- otherwise we just start with the parent's owners.
|
8467 | deepestCommon !== -1 ? childOwners[deepestCommon].getName() || UNKNOWN : [], ancestorOwnerNames, ancestorTag,
|
8468 | // If we're warning about an invalid (non-parent) ancestry, add '...'
|
8469 | invalidAncestor ? ['...'] : [], childOwnerNames, childTag).join(' > ');
|
8470 |
|
8471 | var warnKey = !!invalidParent + '|' + childTag + '|' + ancestorTag + '|' + ownerInfo;
|
8472 | if (didWarn[warnKey]) {
|
8473 | return;
|
8474 | }
|
8475 | didWarn[warnKey] = true;
|
8476 |
|
8477 | if (invalidParent) {
|
8478 | var info = '';
|
8479 | if (ancestorTag === 'table' && childTag === 'tr') {
|
8480 | info += ' Add a <tbody> to your code to match the DOM tree generated by ' + 'the browser.';
|
8481 | }
|
8482 | process.env.NODE_ENV !== 'production' ? warning(false, 'validateDOMNesting(...): <%s> cannot appear as a child of <%s>. ' + 'See %s.%s', childTag, ancestorTag, ownerInfo, info) : undefined;
|
8483 | } else {
|
8484 | process.env.NODE_ENV !== 'production' ? warning(false, 'validateDOMNesting(...): <%s> cannot appear as a descendant of ' + '<%s>. See %s.', childTag, ancestorTag, ownerInfo) : undefined;
|
8485 | }
|
8486 | }
|
8487 | };
|
8488 |
|
8489 | validateDOMNesting.ancestorInfoContextKey = '__validateDOMNesting_ancestorInfo$' + Math.random().toString(36).slice(2);
|
8490 |
|
8491 | validateDOMNesting.updatedAncestorInfo = updatedAncestorInfo;
|
8492 |
|
8493 | // For testing
|
8494 | validateDOMNesting.isTagValidInContext = function (tag, ancestorInfo) {
|
8495 | ancestorInfo = ancestorInfo || emptyAncestorInfo;
|
8496 | var parentInfo = ancestorInfo.parentTag;
|
8497 | var parentTag = parentInfo && parentInfo.tag;
|
8498 | return isTagValidWithParent(tag, parentTag) && !findInvalidAncestorForTag(tag, ancestorInfo);
|
8499 | };
|
8500 | }
|
8501 |
|
8502 | module.exports = validateDOMNesting;
|
8503 | /* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(5)))
|
8504 |
|
8505 | /***/ },
|
8506 | /* 72 */
|
8507 | /***/ function(module, exports, __webpack_require__) {
|
8508 |
|
8509 | /* WEBPACK VAR INJECTION */(function(process) {/**
|
8510 | * Copyright 2013-2015, Facebook, Inc.
|
8511 | * All rights reserved.
|
8512 | *
|
8513 | * This source code is licensed under the BSD-style license found in the
|
8514 | * LICENSE file in the root directory of this source tree. An additional grant
|
8515 | * of patent rights can be found in the PATENTS file in the same directory.
|
8516 | *
|
8517 | * @providesModule ReactDefaultInjection
|
8518 | */
|
8519 |
|
8520 | 'use strict';
|
8521 |
|
8522 | var BeforeInputEventPlugin = __webpack_require__(73);
|
8523 | var ChangeEventPlugin = __webpack_require__(81);
|
8524 | var ClientReactRootIndex = __webpack_require__(84);
|
8525 | var DefaultEventPluginOrder = __webpack_require__(85);
|
8526 | var EnterLeaveEventPlugin = __webpack_require__(86);
|
8527 | var ExecutionEnvironment = __webpack_require__(10);
|
8528 | var HTMLDOMPropertyConfig = __webpack_require__(90);
|
8529 | var ReactBrowserComponentMixin = __webpack_require__(91);
|
8530 | var ReactComponentBrowserEnvironment = __webpack_require__(27);
|
8531 | var ReactDefaultBatchingStrategy = __webpack_require__(93);
|
8532 | var ReactDOMComponent = __webpack_require__(94);
|
8533 | var ReactDOMTextComponent = __webpack_require__(7);
|
8534 | var ReactEventListener = __webpack_require__(119);
|
8535 | var ReactInjection = __webpack_require__(122);
|
8536 | var ReactInstanceHandles = __webpack_require__(46);
|
8537 | var ReactMount = __webpack_require__(29);
|
8538 | var ReactReconcileTransaction = __webpack_require__(126);
|
8539 | var SelectEventPlugin = __webpack_require__(131);
|
8540 | var ServerReactRootIndex = __webpack_require__(132);
|
8541 | var SimpleEventPlugin = __webpack_require__(133);
|
8542 | var SVGDOMPropertyConfig = __webpack_require__(142);
|
8543 |
|
8544 | var alreadyInjected = false;
|
8545 |
|
8546 | function inject() {
|
8547 | if (alreadyInjected) {
|
8548 | // TODO: This is currently true because these injections are shared between
|
8549 | // the client and the server package. They should be built independently
|
8550 | // and not share any injection state. Then this problem will be solved.
|
8551 | return;
|
8552 | }
|
8553 | alreadyInjected = true;
|
8554 |
|
8555 | ReactInjection.EventEmitter.injectReactEventListener(ReactEventListener);
|
8556 |
|
8557 | /**
|
8558 | * Inject modules for resolving DOM hierarchy and plugin ordering.
|
8559 | */
|
8560 | ReactInjection.EventPluginHub.injectEventPluginOrder(DefaultEventPluginOrder);
|
8561 | ReactInjection.EventPluginHub.injectInstanceHandle(ReactInstanceHandles);
|
8562 | ReactInjection.EventPluginHub.injectMount(ReactMount);
|
8563 |
|
8564 | /**
|
8565 | * Some important event plugins included by default (without having to require
|
8566 | * them).
|
8567 | */
|
8568 | ReactInjection.EventPluginHub.injectEventPluginsByName({
|
8569 | SimpleEventPlugin: SimpleEventPlugin,
|
8570 | EnterLeaveEventPlugin: EnterLeaveEventPlugin,
|
8571 | ChangeEventPlugin: ChangeEventPlugin,
|
8572 | SelectEventPlugin: SelectEventPlugin,
|
8573 | BeforeInputEventPlugin: BeforeInputEventPlugin
|
8574 | });
|
8575 |
|
8576 | ReactInjection.NativeComponent.injectGenericComponentClass(ReactDOMComponent);
|
8577 |
|
8578 | ReactInjection.NativeComponent.injectTextComponentClass(ReactDOMTextComponent);
|
8579 |
|
8580 | ReactInjection.Class.injectMixin(ReactBrowserComponentMixin);
|
8581 |
|
8582 | ReactInjection.DOMProperty.injectDOMPropertyConfig(HTMLDOMPropertyConfig);
|
8583 | ReactInjection.DOMProperty.injectDOMPropertyConfig(SVGDOMPropertyConfig);
|
8584 |
|
8585 | ReactInjection.EmptyComponent.injectEmptyComponent('noscript');
|
8586 |
|
8587 | ReactInjection.Updates.injectReconcileTransaction(ReactReconcileTransaction);
|
8588 | ReactInjection.Updates.injectBatchingStrategy(ReactDefaultBatchingStrategy);
|
8589 |
|
8590 | ReactInjection.RootIndex.injectCreateReactRootIndex(ExecutionEnvironment.canUseDOM ? ClientReactRootIndex.createReactRootIndex : ServerReactRootIndex.createReactRootIndex);
|
8591 |
|
8592 | ReactInjection.Component.injectEnvironment(ReactComponentBrowserEnvironment);
|
8593 |
|
8594 | if (process.env.NODE_ENV !== 'production') {
|
8595 | var url = ExecutionEnvironment.canUseDOM && window.location.href || '';
|
8596 | if (/[?&]react_perf\b/.test(url)) {
|
8597 | var ReactDefaultPerf = __webpack_require__(143);
|
8598 | ReactDefaultPerf.start();
|
8599 | }
|
8600 | }
|
8601 | }
|
8602 |
|
8603 | module.exports = {
|
8604 | inject: inject
|
8605 | };
|
8606 | /* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(5)))
|
8607 |
|
8608 | /***/ },
|
8609 | /* 73 */
|
8610 | /***/ function(module, exports, __webpack_require__) {
|
8611 |
|
8612 | /**
|
8613 | * Copyright 2013-2015 Facebook, Inc.
|
8614 | * All rights reserved.
|
8615 | *
|
8616 | * This source code is licensed under the BSD-style license found in the
|
8617 | * LICENSE file in the root directory of this source tree. An additional grant
|
8618 | * of patent rights can be found in the PATENTS file in the same directory.
|
8619 | *
|
8620 | * @providesModule BeforeInputEventPlugin
|
8621 | * @typechecks static-only
|
8622 | */
|
8623 |
|
8624 | 'use strict';
|
8625 |
|
8626 | var EventConstants = __webpack_require__(31);
|
8627 | var EventPropagators = __webpack_require__(74);
|
8628 | var ExecutionEnvironment = __webpack_require__(10);
|
8629 | var FallbackCompositionState = __webpack_require__(75);
|
8630 | var SyntheticCompositionEvent = __webpack_require__(77);
|
8631 | var SyntheticInputEvent = __webpack_require__(79);
|
8632 |
|
8633 | var keyOf = __webpack_require__(80);
|
8634 |
|
8635 | var END_KEYCODES = [9, 13, 27, 32]; // Tab, Return, Esc, Space
|
8636 | var START_KEYCODE = 229;
|
8637 |
|
8638 | var canUseCompositionEvent = ExecutionEnvironment.canUseDOM && 'CompositionEvent' in window;
|
8639 |
|
8640 | var documentMode = null;
|
8641 | if (ExecutionEnvironment.canUseDOM && 'documentMode' in document) {
|
8642 | documentMode = document.documentMode;
|
8643 | }
|
8644 |
|
8645 | // Webkit offers a very useful `textInput` event that can be used to
|
8646 | // directly represent `beforeInput`. The IE `textinput` event is not as
|
8647 | // useful, so we don't use it.
|
8648 | var canUseTextInputEvent = ExecutionEnvironment.canUseDOM && 'TextEvent' in window && !documentMode && !isPresto();
|
8649 |
|
8650 | // In IE9+, we have access to composition events, but the data supplied
|
8651 | // by the native compositionend event may be incorrect. Japanese ideographic
|
8652 | // spaces, for instance (\u3000) are not recorded correctly.
|
8653 | var useFallbackCompositionData = ExecutionEnvironment.canUseDOM && (!canUseCompositionEvent || documentMode && documentMode > 8 && documentMode <= 11);
|
8654 |
|
8655 | /**
|
8656 | * Opera <= 12 includes TextEvent in window, but does not fire
|
8657 | * text input events. Rely on keypress instead.
|
8658 | */
|
8659 | function isPresto() {
|
8660 | var opera = window.opera;
|
8661 | return typeof opera === 'object' && typeof opera.version === 'function' && parseInt(opera.version(), 10) <= 12;
|
8662 | }
|
8663 |
|
8664 | var SPACEBAR_CODE = 32;
|
8665 | var SPACEBAR_CHAR = String.fromCharCode(SPACEBAR_CODE);
|
8666 |
|
8667 | var topLevelTypes = EventConstants.topLevelTypes;
|
8668 |
|
8669 | // Events and their corresponding property names.
|
8670 | var eventTypes = {
|
8671 | beforeInput: {
|
8672 | phasedRegistrationNames: {
|
8673 | bubbled: keyOf({ onBeforeInput: null }),
|
8674 | captured: keyOf({ onBeforeInputCapture: null })
|
8675 | },
|
8676 | dependencies: [topLevelTypes.topCompositionEnd, topLevelTypes.topKeyPress, topLevelTypes.topTextInput, topLevelTypes.topPaste]
|
8677 | },
|
8678 | compositionEnd: {
|
8679 | phasedRegistrationNames: {
|
8680 | bubbled: keyOf({ onCompositionEnd: null }),
|
8681 | captured: keyOf({ onCompositionEndCapture: null })
|
8682 | },
|
8683 | dependencies: [topLevelTypes.topBlur, topLevelTypes.topCompositionEnd, topLevelTypes.topKeyDown, topLevelTypes.topKeyPress, topLevelTypes.topKeyUp, topLevelTypes.topMouseDown]
|
8684 | },
|
8685 | compositionStart: {
|
8686 | phasedRegistrationNames: {
|
8687 | bubbled: keyOf({ onCompositionStart: null }),
|
8688 | captured: keyOf({ onCompositionStartCapture: null })
|
8689 | },
|
8690 | dependencies: [topLevelTypes.topBlur, topLevelTypes.topCompositionStart, topLevelTypes.topKeyDown, topLevelTypes.topKeyPress, topLevelTypes.topKeyUp, topLevelTypes.topMouseDown]
|
8691 | },
|
8692 | compositionUpdate: {
|
8693 | phasedRegistrationNames: {
|
8694 | bubbled: keyOf({ onCompositionUpdate: null }),
|
8695 | captured: keyOf({ onCompositionUpdateCapture: null })
|
8696 | },
|
8697 | dependencies: [topLevelTypes.topBlur, topLevelTypes.topCompositionUpdate, topLevelTypes.topKeyDown, topLevelTypes.topKeyPress, topLevelTypes.topKeyUp, topLevelTypes.topMouseDown]
|
8698 | }
|
8699 | };
|
8700 |
|
8701 | // Track whether we've ever handled a keypress on the space key.
|
8702 | var hasSpaceKeypress = false;
|
8703 |
|
8704 | /**
|
8705 | * Return whether a native keypress event is assumed to be a command.
|
8706 | * This is required because Firefox fires `keypress` events for key commands
|
8707 | * (cut, copy, select-all, etc.) even though no character is inserted.
|
8708 | */
|
8709 | function isKeypressCommand(nativeEvent) {
|
8710 | return (nativeEvent.ctrlKey || nativeEvent.altKey || nativeEvent.metaKey) &&
|
8711 | // ctrlKey && altKey is equivalent to AltGr, and is not a command.
|
8712 | !(nativeEvent.ctrlKey && nativeEvent.altKey);
|
8713 | }
|
8714 |
|
8715 | /**
|
8716 | * Translate native top level events into event types.
|
8717 | *
|
8718 | * @param {string} topLevelType
|
8719 | * @return {object}
|
8720 | */
|
8721 | function getCompositionEventType(topLevelType) {
|
8722 | switch (topLevelType) {
|
8723 | case topLevelTypes.topCompositionStart:
|
8724 | return eventTypes.compositionStart;
|
8725 | case topLevelTypes.topCompositionEnd:
|
8726 | return eventTypes.compositionEnd;
|
8727 | case topLevelTypes.topCompositionUpdate:
|
8728 | return eventTypes.compositionUpdate;
|
8729 | }
|
8730 | }
|
8731 |
|
8732 | /**
|
8733 | * Does our fallback best-guess model think this event signifies that
|
8734 | * composition has begun?
|
8735 | *
|
8736 | * @param {string} topLevelType
|
8737 | * @param {object} nativeEvent
|
8738 | * @return {boolean}
|
8739 | */
|
8740 | function isFallbackCompositionStart(topLevelType, nativeEvent) {
|
8741 | return topLevelType === topLevelTypes.topKeyDown && nativeEvent.keyCode === START_KEYCODE;
|
8742 | }
|
8743 |
|
8744 | /**
|
8745 | * Does our fallback mode think that this event is the end of composition?
|
8746 | *
|
8747 | * @param {string} topLevelType
|
8748 | * @param {object} nativeEvent
|
8749 | * @return {boolean}
|
8750 | */
|
8751 | function isFallbackCompositionEnd(topLevelType, nativeEvent) {
|
8752 | switch (topLevelType) {
|
8753 | case topLevelTypes.topKeyUp:
|
8754 | // Command keys insert or clear IME input.
|
8755 | return END_KEYCODES.indexOf(nativeEvent.keyCode) !== -1;
|
8756 | case topLevelTypes.topKeyDown:
|
8757 | // Expect IME keyCode on each keydown. If we get any other
|
8758 | // code we must have exited earlier.
|
8759 | return nativeEvent.keyCode !== START_KEYCODE;
|
8760 | case topLevelTypes.topKeyPress:
|
8761 | case topLevelTypes.topMouseDown:
|
8762 | case topLevelTypes.topBlur:
|
8763 | // Events are not possible without cancelling IME.
|
8764 | return true;
|
8765 | default:
|
8766 | return false;
|
8767 | }
|
8768 | }
|
8769 |
|
8770 | /**
|
8771 | * Google Input Tools provides composition data via a CustomEvent,
|
8772 | * with the `data` property populated in the `detail` object. If this
|
8773 | * is available on the event object, use it. If not, this is a plain
|
8774 | * composition event and we have nothing special to extract.
|
8775 | *
|
8776 | * @param {object} nativeEvent
|
8777 | * @return {?string}
|
8778 | */
|
8779 | function getDataFromCustomEvent(nativeEvent) {
|
8780 | var detail = nativeEvent.detail;
|
8781 | if (typeof detail === 'object' && 'data' in detail) {
|
8782 | return detail.data;
|
8783 | }
|
8784 | return null;
|
8785 | }
|
8786 |
|
8787 | // Track the current IME composition fallback object, if any.
|
8788 | var currentComposition = null;
|
8789 |
|
8790 | /**
|
8791 | * @param {string} topLevelType Record from `EventConstants`.
|
8792 | * @param {DOMEventTarget} topLevelTarget The listening component root node.
|
8793 | * @param {string} topLevelTargetID ID of `topLevelTarget`.
|
8794 | * @param {object} nativeEvent Native browser event.
|
8795 | * @return {?object} A SyntheticCompositionEvent.
|
8796 | */
|
8797 | function extractCompositionEvent(topLevelType, topLevelTarget, topLevelTargetID, nativeEvent, nativeEventTarget) {
|
8798 | var eventType;
|
8799 | var fallbackData;
|
8800 |
|
8801 | if (canUseCompositionEvent) {
|
8802 | eventType = getCompositionEventType(topLevelType);
|
8803 | } else if (!currentComposition) {
|
8804 | if (isFallbackCompositionStart(topLevelType, nativeEvent)) {
|
8805 | eventType = eventTypes.compositionStart;
|
8806 | }
|
8807 | } else if (isFallbackCompositionEnd(topLevelType, nativeEvent)) {
|
8808 | eventType = eventTypes.compositionEnd;
|
8809 | }
|
8810 |
|
8811 | if (!eventType) {
|
8812 | return null;
|
8813 | }
|
8814 |
|
8815 | if (useFallbackCompositionData) {
|
8816 | // The current composition is stored statically and must not be
|
8817 | // overwritten while composition continues.
|
8818 | if (!currentComposition && eventType === eventTypes.compositionStart) {
|
8819 | currentComposition = FallbackCompositionState.getPooled(topLevelTarget);
|
8820 | } else if (eventType === eventTypes.compositionEnd) {
|
8821 | if (currentComposition) {
|
8822 | fallbackData = currentComposition.getData();
|
8823 | }
|
8824 | }
|
8825 | }
|
8826 |
|
8827 | var event = SyntheticCompositionEvent.getPooled(eventType, topLevelTargetID, nativeEvent, nativeEventTarget);
|
8828 |
|
8829 | if (fallbackData) {
|
8830 | // Inject data generated from fallback path into the synthetic event.
|
8831 | // This matches the property of native CompositionEventInterface.
|
8832 | event.data = fallbackData;
|
8833 | } else {
|
8834 | var customData = getDataFromCustomEvent(nativeEvent);
|
8835 | if (customData !== null) {
|
8836 | event.data = customData;
|
8837 | }
|
8838 | }
|
8839 |
|
8840 | EventPropagators.accumulateTwoPhaseDispatches(event);
|
8841 | return event;
|
8842 | }
|
8843 |
|
8844 | /**
|
8845 | * @param {string} topLevelType Record from `EventConstants`.
|
8846 | * @param {object} nativeEvent Native browser event.
|
8847 | * @return {?string} The string corresponding to this `beforeInput` event.
|
8848 | */
|
8849 | function getNativeBeforeInputChars(topLevelType, nativeEvent) {
|
8850 | switch (topLevelType) {
|
8851 | case topLevelTypes.topCompositionEnd:
|
8852 | return getDataFromCustomEvent(nativeEvent);
|
8853 | case topLevelTypes.topKeyPress:
|
8854 | /**
|
8855 | * If native `textInput` events are available, our goal is to make
|
8856 | * use of them. However, there is a special case: the spacebar key.
|
8857 | * In Webkit, preventing default on a spacebar `textInput` event
|
8858 | * cancels character insertion, but it *also* causes the browser
|
8859 | * to fall back to its default spacebar behavior of scrolling the
|
8860 | * page.
|
8861 | *
|
8862 | * Tracking at:
|
8863 | * https://code.google.com/p/chromium/issues/detail?id=355103
|
8864 | *
|
8865 | * To avoid this issue, use the keypress event as if no `textInput`
|
8866 | * event is available.
|
8867 | */
|
8868 | var which = nativeEvent.which;
|
8869 | if (which !== SPACEBAR_CODE) {
|
8870 | return null;
|
8871 | }
|
8872 |
|
8873 | hasSpaceKeypress = true;
|
8874 | return SPACEBAR_CHAR;
|
8875 |
|
8876 | case topLevelTypes.topTextInput:
|
8877 | // Record the characters to be added to the DOM.
|
8878 | var chars = nativeEvent.data;
|
8879 |
|
8880 | // If it's a spacebar character, assume that we have already handled
|
8881 | // it at the keypress level and bail immediately. Android Chrome
|
8882 | // doesn't give us keycodes, so we need to blacklist it.
|
8883 | if (chars === SPACEBAR_CHAR && hasSpaceKeypress) {
|
8884 | return null;
|
8885 | }
|
8886 |
|
8887 | return chars;
|
8888 |
|
8889 | default:
|
8890 | // For other native event types, do nothing.
|
8891 | return null;
|
8892 | }
|
8893 | }
|
8894 |
|
8895 | /**
|
8896 | * For browsers that do not provide the `textInput` event, extract the
|
8897 | * appropriate string to use for SyntheticInputEvent.
|
8898 | *
|
8899 | * @param {string} topLevelType Record from `EventConstants`.
|
8900 | * @param {object} nativeEvent Native browser event.
|
8901 | * @return {?string} The fallback string for this `beforeInput` event.
|
8902 | */
|
8903 | function getFallbackBeforeInputChars(topLevelType, nativeEvent) {
|
8904 | // If we are currently composing (IME) and using a fallback to do so,
|
8905 | // try to extract the composed characters from the fallback object.
|
8906 | if (currentComposition) {
|
8907 | if (topLevelType === topLevelTypes.topCompositionEnd || isFallbackCompositionEnd(topLevelType, nativeEvent)) {
|
8908 | var chars = currentComposition.getData();
|
8909 | FallbackCompositionState.release(currentComposition);
|
8910 | currentComposition = null;
|
8911 | return chars;
|
8912 | }
|
8913 | return null;
|
8914 | }
|
8915 |
|
8916 | switch (topLevelType) {
|
8917 | case topLevelTypes.topPaste:
|
8918 | // If a paste event occurs after a keypress, throw out the input
|
8919 | // chars. Paste events should not lead to BeforeInput events.
|
8920 | return null;
|
8921 | case topLevelTypes.topKeyPress:
|
8922 | /**
|
8923 | * As of v27, Firefox may fire keypress events even when no character
|
8924 | * will be inserted. A few possibilities:
|
8925 | *
|
8926 | * - `which` is `0`. Arrow keys, Esc key, etc.
|
8927 | *
|
8928 | * - `which` is the pressed key code, but no char is available.
|
8929 | * Ex: 'AltGr + d` in Polish. There is no modified character for
|
8930 | * this key combination and no character is inserted into the
|
8931 | * document, but FF fires the keypress for char code `100` anyway.
|
8932 | * No `input` event will occur.
|
8933 | *
|
8934 | * - `which` is the pressed key code, but a command combination is
|
8935 | * being used. Ex: `Cmd+C`. No character is inserted, and no
|
8936 | * `input` event will occur.
|
8937 | */
|
8938 | if (nativeEvent.which && !isKeypressCommand(nativeEvent)) {
|
8939 | return String.fromCharCode(nativeEvent.which);
|
8940 | }
|
8941 | return null;
|
8942 | case topLevelTypes.topCompositionEnd:
|
8943 | return useFallbackCompositionData ? null : nativeEvent.data;
|
8944 | default:
|
8945 | return null;
|
8946 | }
|
8947 | }
|
8948 |
|
8949 | /**
|
8950 | * Extract a SyntheticInputEvent for `beforeInput`, based on either native
|
8951 | * `textInput` or fallback behavior.
|
8952 | *
|
8953 | * @param {string} topLevelType Record from `EventConstants`.
|
8954 | * @param {DOMEventTarget} topLevelTarget The listening component root node.
|
8955 | * @param {string} topLevelTargetID ID of `topLevelTarget`.
|
8956 | * @param {object} nativeEvent Native browser event.
|
8957 | * @return {?object} A SyntheticInputEvent.
|
8958 | */
|
8959 | function extractBeforeInputEvent(topLevelType, topLevelTarget, topLevelTargetID, nativeEvent, nativeEventTarget) {
|
8960 | var chars;
|
8961 |
|
8962 | if (canUseTextInputEvent) {
|
8963 | chars = getNativeBeforeInputChars(topLevelType, nativeEvent);
|
8964 | } else {
|
8965 | chars = getFallbackBeforeInputChars(topLevelType, nativeEvent);
|
8966 | }
|
8967 |
|
8968 | // If no characters are being inserted, no BeforeInput event should
|
8969 | // be fired.
|
8970 | if (!chars) {
|
8971 | return null;
|
8972 | }
|
8973 |
|
8974 | var event = SyntheticInputEvent.getPooled(eventTypes.beforeInput, topLevelTargetID, nativeEvent, nativeEventTarget);
|
8975 |
|
8976 | event.data = chars;
|
8977 | EventPropagators.accumulateTwoPhaseDispatches(event);
|
8978 | return event;
|
8979 | }
|
8980 |
|
8981 | /**
|
8982 | * Create an `onBeforeInput` event to match
|
8983 | * http://www.w3.org/TR/2013/WD-DOM-Level-3-Events-20131105/#events-inputevents.
|
8984 | *
|
8985 | * This event plugin is based on the native `textInput` event
|
8986 | * available in Chrome, Safari, Opera, and IE. This event fires after
|
8987 | * `onKeyPress` and `onCompositionEnd`, but before `onInput`.
|
8988 | *
|
8989 | * `beforeInput` is spec'd but not implemented in any browsers, and
|
8990 | * the `input` event does not provide any useful information about what has
|
8991 | * actually been added, contrary to the spec. Thus, `textInput` is the best
|
8992 | * available event to identify the characters that have actually been inserted
|
8993 | * into the target node.
|
8994 | *
|
8995 | * This plugin is also responsible for emitting `composition` events, thus
|
8996 | * allowing us to share composition fallback code for both `beforeInput` and
|
8997 | * `composition` event types.
|
8998 | */
|
8999 | var BeforeInputEventPlugin = {
|
9000 |
|
9001 | eventTypes: eventTypes,
|
9002 |
|
9003 | /**
|
9004 | * @param {string} topLevelType Record from `EventConstants`.
|
9005 | * @param {DOMEventTarget} topLevelTarget The listening component root node.
|
9006 | * @param {string} topLevelTargetID ID of `topLevelTarget`.
|
9007 | * @param {object} nativeEvent Native browser event.
|
9008 | * @return {*} An accumulation of synthetic events.
|
9009 | * @see {EventPluginHub.extractEvents}
|
9010 | */
|
9011 | extractEvents: function (topLevelType, topLevelTarget, topLevelTargetID, nativeEvent, nativeEventTarget) {
|
9012 | return [extractCompositionEvent(topLevelType, topLevelTarget, topLevelTargetID, nativeEvent, nativeEventTarget), extractBeforeInputEvent(topLevelType, topLevelTarget, topLevelTargetID, nativeEvent, nativeEventTarget)];
|
9013 | }
|
9014 | };
|
9015 |
|
9016 | module.exports = BeforeInputEventPlugin;
|
9017 |
|
9018 | /***/ },
|
9019 | /* 74 */
|
9020 | /***/ function(module, exports, __webpack_require__) {
|
9021 |
|
9022 | /* WEBPACK VAR INJECTION */(function(process) {/**
|
9023 | * Copyright 2013-2015, Facebook, Inc.
|
9024 | * All rights reserved.
|
9025 | *
|
9026 | * This source code is licensed under the BSD-style license found in the
|
9027 | * LICENSE file in the root directory of this source tree. An additional grant
|
9028 | * of patent rights can be found in the PATENTS file in the same directory.
|
9029 | *
|
9030 | * @providesModule EventPropagators
|
9031 | */
|
9032 |
|
9033 | 'use strict';
|
9034 |
|
9035 | var EventConstants = __webpack_require__(31);
|
9036 | var EventPluginHub = __webpack_require__(32);
|
9037 |
|
9038 | var warning = __webpack_require__(26);
|
9039 |
|
9040 | var accumulateInto = __webpack_require__(36);
|
9041 | var forEachAccumulated = __webpack_require__(37);
|
9042 |
|
9043 | var PropagationPhases = EventConstants.PropagationPhases;
|
9044 | var getListener = EventPluginHub.getListener;
|
9045 |
|
9046 | /**
|
9047 | * Some event types have a notion of different registration names for different
|
9048 | * "phases" of propagation. This finds listeners by a given phase.
|
9049 | */
|
9050 | function listenerAtPhase(id, event, propagationPhase) {
|
9051 | var registrationName = event.dispatchConfig.phasedRegistrationNames[propagationPhase];
|
9052 | return getListener(id, registrationName);
|
9053 | }
|
9054 |
|
9055 | /**
|
9056 | * Tags a `SyntheticEvent` with dispatched listeners. Creating this function
|
9057 | * here, allows us to not have to bind or create functions for each event.
|
9058 | * Mutating the event's members allows us to not have to create a wrapping
|
9059 | * "dispatch" object that pairs the event with the listener.
|
9060 | */
|
9061 | function accumulateDirectionalDispatches(domID, upwards, event) {
|
9062 | if (process.env.NODE_ENV !== 'production') {
|
9063 | process.env.NODE_ENV !== 'production' ? warning(domID, 'Dispatching id must not be null') : undefined;
|
9064 | }
|
9065 | var phase = upwards ? PropagationPhases.bubbled : PropagationPhases.captured;
|
9066 | var listener = listenerAtPhase(domID, event, phase);
|
9067 | if (listener) {
|
9068 | event._dispatchListeners = accumulateInto(event._dispatchListeners, listener);
|
9069 | event._dispatchIDs = accumulateInto(event._dispatchIDs, domID);
|
9070 | }
|
9071 | }
|
9072 |
|
9073 | /**
|
9074 | * Collect dispatches (must be entirely collected before dispatching - see unit
|
9075 | * tests). Lazily allocate the array to conserve memory. We must loop through
|
9076 | * each event and perform the traversal for each one. We cannot perform a
|
9077 | * single traversal for the entire collection of events because each event may
|
9078 | * have a different target.
|
9079 | */
|
9080 | function accumulateTwoPhaseDispatchesSingle(event) {
|
9081 | if (event && event.dispatchConfig.phasedRegistrationNames) {
|
9082 | EventPluginHub.injection.getInstanceHandle().traverseTwoPhase(event.dispatchMarker, accumulateDirectionalDispatches, event);
|
9083 | }
|
9084 | }
|
9085 |
|
9086 | /**
|
9087 | * Same as `accumulateTwoPhaseDispatchesSingle`, but skips over the targetID.
|
9088 | */
|
9089 | function accumulateTwoPhaseDispatchesSingleSkipTarget(event) {
|
9090 | if (event && event.dispatchConfig.phasedRegistrationNames) {
|
9091 | EventPluginHub.injection.getInstanceHandle().traverseTwoPhaseSkipTarget(event.dispatchMarker, accumulateDirectionalDispatches, event);
|
9092 | }
|
9093 | }
|
9094 |
|
9095 | /**
|
9096 | * Accumulates without regard to direction, does not look for phased
|
9097 | * registration names. Same as `accumulateDirectDispatchesSingle` but without
|
9098 | * requiring that the `dispatchMarker` be the same as the dispatched ID.
|
9099 | */
|
9100 | function accumulateDispatches(id, ignoredDirection, event) {
|
9101 | if (event && event.dispatchConfig.registrationName) {
|
9102 | var registrationName = event.dispatchConfig.registrationName;
|
9103 | var listener = getListener(id, registrationName);
|
9104 | if (listener) {
|
9105 | event._dispatchListeners = accumulateInto(event._dispatchListeners, listener);
|
9106 | event._dispatchIDs = accumulateInto(event._dispatchIDs, id);
|
9107 | }
|
9108 | }
|
9109 | }
|
9110 |
|
9111 | /**
|
9112 | * Accumulates dispatches on an `SyntheticEvent`, but only for the
|
9113 | * `dispatchMarker`.
|
9114 | * @param {SyntheticEvent} event
|
9115 | */
|
9116 | function accumulateDirectDispatchesSingle(event) {
|
9117 | if (event && event.dispatchConfig.registrationName) {
|
9118 | accumulateDispatches(event.dispatchMarker, null, event);
|
9119 | }
|
9120 | }
|
9121 |
|
9122 | function accumulateTwoPhaseDispatches(events) {
|
9123 | forEachAccumulated(events, accumulateTwoPhaseDispatchesSingle);
|
9124 | }
|
9125 |
|
9126 | function accumulateTwoPhaseDispatchesSkipTarget(events) {
|
9127 | forEachAccumulated(events, accumulateTwoPhaseDispatchesSingleSkipTarget);
|
9128 | }
|
9129 |
|
9130 | function accumulateEnterLeaveDispatches(leave, enter, fromID, toID) {
|
9131 | EventPluginHub.injection.getInstanceHandle().traverseEnterLeave(fromID, toID, accumulateDispatches, leave, enter);
|
9132 | }
|
9133 |
|
9134 | function accumulateDirectDispatches(events) {
|
9135 | forEachAccumulated(events, accumulateDirectDispatchesSingle);
|
9136 | }
|
9137 |
|
9138 | /**
|
9139 | * A small set of propagation patterns, each of which will accept a small amount
|
9140 | * of information, and generate a set of "dispatch ready event objects" - which
|
9141 | * are sets of events that have already been annotated with a set of dispatched
|
9142 | * listener functions/ids. The API is designed this way to discourage these
|
9143 | * propagation strategies from actually executing the dispatches, since we
|
9144 | * always want to collect the entire set of dispatches before executing event a
|
9145 | * single one.
|
9146 | *
|
9147 | * @constructor EventPropagators
|
9148 | */
|
9149 | var EventPropagators = {
|
9150 | accumulateTwoPhaseDispatches: accumulateTwoPhaseDispatches,
|
9151 | accumulateTwoPhaseDispatchesSkipTarget: accumulateTwoPhaseDispatchesSkipTarget,
|
9152 | accumulateDirectDispatches: accumulateDirectDispatches,
|
9153 | accumulateEnterLeaveDispatches: accumulateEnterLeaveDispatches
|
9154 | };
|
9155 |
|
9156 | module.exports = EventPropagators;
|
9157 | /* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(5)))
|
9158 |
|
9159 | /***/ },
|
9160 | /* 75 */
|
9161 | /***/ function(module, exports, __webpack_require__) {
|
9162 |
|
9163 | /**
|
9164 | * Copyright 2013-2015, Facebook, Inc.
|
9165 | * All rights reserved.
|
9166 | *
|
9167 | * This source code is licensed under the BSD-style license found in the
|
9168 | * LICENSE file in the root directory of this source tree. An additional grant
|
9169 | * of patent rights can be found in the PATENTS file in the same directory.
|
9170 | *
|
9171 | * @providesModule FallbackCompositionState
|
9172 | * @typechecks static-only
|
9173 | */
|
9174 |
|
9175 | 'use strict';
|
9176 |
|
9177 | var PooledClass = __webpack_require__(57);
|
9178 |
|
9179 | var assign = __webpack_require__(40);
|
9180 | var getTextContentAccessor = __webpack_require__(76);
|
9181 |
|
9182 | /**
|
9183 | * This helper class stores information about text content of a target node,
|
9184 | * allowing comparison of content before and after a given event.
|
9185 | *
|
9186 | * Identify the node where selection currently begins, then observe
|
9187 | * both its text content and its current position in the DOM. Since the
|
9188 | * browser may natively replace the target node during composition, we can
|
9189 | * use its position to find its replacement.
|
9190 | *
|
9191 | * @param {DOMEventTarget} root
|
9192 | */
|
9193 | function FallbackCompositionState(root) {
|
9194 | this._root = root;
|
9195 | this._startText = this.getText();
|
9196 | this._fallbackText = null;
|
9197 | }
|
9198 |
|
9199 | assign(FallbackCompositionState.prototype, {
|
9200 | destructor: function () {
|
9201 | this._root = null;
|
9202 | this._startText = null;
|
9203 | this._fallbackText = null;
|
9204 | },
|
9205 |
|
9206 | /**
|
9207 | * Get current text of input.
|
9208 | *
|
9209 | * @return {string}
|
9210 | */
|
9211 | getText: function () {
|
9212 | if ('value' in this._root) {
|
9213 | return this._root.value;
|
9214 | }
|
9215 | return this._root[getTextContentAccessor()];
|
9216 | },
|
9217 |
|
9218 | /**
|
9219 | * Determine the differing substring between the initially stored
|
9220 | * text content and the current content.
|
9221 | *
|
9222 | * @return {string}
|
9223 | */
|
9224 | getData: function () {
|
9225 | if (this._fallbackText) {
|
9226 | return this._fallbackText;
|
9227 | }
|
9228 |
|
9229 | var start;
|
9230 | var startValue = this._startText;
|
9231 | var startLength = startValue.length;
|
9232 | var end;
|
9233 | var endValue = this.getText();
|
9234 | var endLength = endValue.length;
|
9235 |
|
9236 | for (start = 0; start < startLength; start++) {
|
9237 | if (startValue[start] !== endValue[start]) {
|
9238 | break;
|
9239 | }
|
9240 | }
|
9241 |
|
9242 | var minEnd = startLength - start;
|
9243 | for (end = 1; end <= minEnd; end++) {
|
9244 | if (startValue[startLength - end] !== endValue[endLength - end]) {
|
9245 | break;
|
9246 | }
|
9247 | }
|
9248 |
|
9249 | var sliceTail = end > 1 ? 1 - end : undefined;
|
9250 | this._fallbackText = endValue.slice(start, sliceTail);
|
9251 | return this._fallbackText;
|
9252 | }
|
9253 | });
|
9254 |
|
9255 | PooledClass.addPoolingTo(FallbackCompositionState);
|
9256 |
|
9257 | module.exports = FallbackCompositionState;
|
9258 |
|
9259 | /***/ },
|
9260 | /* 76 */
|
9261 | /***/ function(module, exports, __webpack_require__) {
|
9262 |
|
9263 | /**
|
9264 | * Copyright 2013-2015, Facebook, Inc.
|
9265 | * All rights reserved.
|
9266 | *
|
9267 | * This source code is licensed under the BSD-style license found in the
|
9268 | * LICENSE file in the root directory of this source tree. An additional grant
|
9269 | * of patent rights can be found in the PATENTS file in the same directory.
|
9270 | *
|
9271 | * @providesModule getTextContentAccessor
|
9272 | */
|
9273 |
|
9274 | 'use strict';
|
9275 |
|
9276 | var ExecutionEnvironment = __webpack_require__(10);
|
9277 |
|
9278 | var contentKey = null;
|
9279 |
|
9280 | /**
|
9281 | * Gets the key used to access text content on a DOM node.
|
9282 | *
|
9283 | * @return {?string} Key used to access text content.
|
9284 | * @internal
|
9285 | */
|
9286 | function getTextContentAccessor() {
|
9287 | if (!contentKey && ExecutionEnvironment.canUseDOM) {
|
9288 | // Prefer textContent to innerText because many browsers support both but
|
9289 | // SVG <text> elements don't support innerText even when <div> does.
|
9290 | contentKey = 'textContent' in document.documentElement ? 'textContent' : 'innerText';
|
9291 | }
|
9292 | return contentKey;
|
9293 | }
|
9294 |
|
9295 | module.exports = getTextContentAccessor;
|
9296 |
|
9297 | /***/ },
|
9298 | /* 77 */
|
9299 | /***/ function(module, exports, __webpack_require__) {
|
9300 |
|
9301 | /**
|
9302 | * Copyright 2013-2015, Facebook, Inc.
|
9303 | * All rights reserved.
|
9304 | *
|
9305 | * This source code is licensed under the BSD-style license found in the
|
9306 | * LICENSE file in the root directory of this source tree. An additional grant
|
9307 | * of patent rights can be found in the PATENTS file in the same directory.
|
9308 | *
|
9309 | * @providesModule SyntheticCompositionEvent
|
9310 | * @typechecks static-only
|
9311 | */
|
9312 |
|
9313 | 'use strict';
|
9314 |
|
9315 | var SyntheticEvent = __webpack_require__(78);
|
9316 |
|
9317 | /**
|
9318 | * @interface Event
|
9319 | * @see http://www.w3.org/TR/DOM-Level-3-Events/#events-compositionevents
|
9320 | */
|
9321 | var CompositionEventInterface = {
|
9322 | data: null
|
9323 | };
|
9324 |
|
9325 | /**
|
9326 | * @param {object} dispatchConfig Configuration used to dispatch this event.
|
9327 | * @param {string} dispatchMarker Marker identifying the event target.
|
9328 | * @param {object} nativeEvent Native browser event.
|
9329 | * @extends {SyntheticUIEvent}
|
9330 | */
|
9331 | function SyntheticCompositionEvent(dispatchConfig, dispatchMarker, nativeEvent, nativeEventTarget) {
|
9332 | SyntheticEvent.call(this, dispatchConfig, dispatchMarker, nativeEvent, nativeEventTarget);
|
9333 | }
|
9334 |
|
9335 | SyntheticEvent.augmentClass(SyntheticCompositionEvent, CompositionEventInterface);
|
9336 |
|
9337 | module.exports = SyntheticCompositionEvent;
|
9338 |
|
9339 | /***/ },
|
9340 | /* 78 */
|
9341 | /***/ function(module, exports, __webpack_require__) {
|
9342 |
|
9343 | /* WEBPACK VAR INJECTION */(function(process) {/**
|
9344 | * Copyright 2013-2015, Facebook, Inc.
|
9345 | * All rights reserved.
|
9346 | *
|
9347 | * This source code is licensed under the BSD-style license found in the
|
9348 | * LICENSE file in the root directory of this source tree. An additional grant
|
9349 | * of patent rights can be found in the PATENTS file in the same directory.
|
9350 | *
|
9351 | * @providesModule SyntheticEvent
|
9352 | * @typechecks static-only
|
9353 | */
|
9354 |
|
9355 | 'use strict';
|
9356 |
|
9357 | var PooledClass = __webpack_require__(57);
|
9358 |
|
9359 | var assign = __webpack_require__(40);
|
9360 | var emptyFunction = __webpack_require__(16);
|
9361 | var warning = __webpack_require__(26);
|
9362 |
|
9363 | /**
|
9364 | * @interface Event
|
9365 | * @see http://www.w3.org/TR/DOM-Level-3-Events/
|
9366 | */
|
9367 | var EventInterface = {
|
9368 | type: null,
|
9369 | target: null,
|
9370 | // currentTarget is set when dispatching; no use in copying it here
|
9371 | currentTarget: emptyFunction.thatReturnsNull,
|
9372 | eventPhase: null,
|
9373 | bubbles: null,
|
9374 | cancelable: null,
|
9375 | timeStamp: function (event) {
|
9376 | return event.timeStamp || Date.now();
|
9377 | },
|
9378 | defaultPrevented: null,
|
9379 | isTrusted: null
|
9380 | };
|
9381 |
|
9382 | /**
|
9383 | * Synthetic events are dispatched by event plugins, typically in response to a
|
9384 | * top-level event delegation handler.
|
9385 | *
|
9386 | * These systems should generally use pooling to reduce the frequency of garbage
|
9387 | * collection. The system should check `isPersistent` to determine whether the
|
9388 | * event should be released into the pool after being dispatched. Users that
|
9389 | * need a persisted event should invoke `persist`.
|
9390 | *
|
9391 | * Synthetic events (and subclasses) implement the DOM Level 3 Events API by
|
9392 | * normalizing browser quirks. Subclasses do not necessarily have to implement a
|
9393 | * DOM interface; custom application-specific events can also subclass this.
|
9394 | *
|
9395 | * @param {object} dispatchConfig Configuration used to dispatch this event.
|
9396 | * @param {string} dispatchMarker Marker identifying the event target.
|
9397 | * @param {object} nativeEvent Native browser event.
|
9398 | */
|
9399 | function SyntheticEvent(dispatchConfig, dispatchMarker, nativeEvent, nativeEventTarget) {
|
9400 | this.dispatchConfig = dispatchConfig;
|
9401 | this.dispatchMarker = dispatchMarker;
|
9402 | this.nativeEvent = nativeEvent;
|
9403 |
|
9404 | var Interface = this.constructor.Interface;
|
9405 | for (var propName in Interface) {
|
9406 | if (!Interface.hasOwnProperty(propName)) {
|
9407 | continue;
|
9408 | }
|
9409 | var normalize = Interface[propName];
|
9410 | if (normalize) {
|
9411 | this[propName] = normalize(nativeEvent);
|
9412 | } else {
|
9413 | if (propName === 'target') {
|
9414 | this.target = nativeEventTarget;
|
9415 | } else {
|
9416 | this[propName] = nativeEvent[propName];
|
9417 | }
|
9418 | }
|
9419 | }
|
9420 |
|
9421 | var defaultPrevented = nativeEvent.defaultPrevented != null ? nativeEvent.defaultPrevented : nativeEvent.returnValue === false;
|
9422 | if (defaultPrevented) {
|
9423 | this.isDefaultPrevented = emptyFunction.thatReturnsTrue;
|
9424 | } else {
|
9425 | this.isDefaultPrevented = emptyFunction.thatReturnsFalse;
|
9426 | }
|
9427 | this.isPropagationStopped = emptyFunction.thatReturnsFalse;
|
9428 | }
|
9429 |
|
9430 | assign(SyntheticEvent.prototype, {
|
9431 |
|
9432 | preventDefault: function () {
|
9433 | this.defaultPrevented = true;
|
9434 | var event = this.nativeEvent;
|
9435 | if (process.env.NODE_ENV !== 'production') {
|
9436 | process.env.NODE_ENV !== 'production' ? warning(event, 'This synthetic event is reused for performance reasons. If you\'re ' + 'seeing this, you\'re calling `preventDefault` on a ' + 'released/nullified synthetic event. This is a no-op. See ' + 'https://fb.me/react-event-pooling for more information.') : undefined;
|
9437 | }
|
9438 | if (!event) {
|
9439 | return;
|
9440 | }
|
9441 |
|
9442 | if (event.preventDefault) {
|
9443 | event.preventDefault();
|
9444 | } else {
|
9445 | event.returnValue = false;
|
9446 | }
|
9447 | this.isDefaultPrevented = emptyFunction.thatReturnsTrue;
|
9448 | },
|
9449 |
|
9450 | stopPropagation: function () {
|
9451 | var event = this.nativeEvent;
|
9452 | if (process.env.NODE_ENV !== 'production') {
|
9453 | process.env.NODE_ENV !== 'production' ? warning(event, 'This synthetic event is reused for performance reasons. If you\'re ' + 'seeing this, you\'re calling `stopPropagation` on a ' + 'released/nullified synthetic event. This is a no-op. See ' + 'https://fb.me/react-event-pooling for more information.') : undefined;
|
9454 | }
|
9455 | if (!event) {
|
9456 | return;
|
9457 | }
|
9458 |
|
9459 | if (event.stopPropagation) {
|
9460 | event.stopPropagation();
|
9461 | } else {
|
9462 | event.cancelBubble = true;
|
9463 | }
|
9464 | this.isPropagationStopped = emptyFunction.thatReturnsTrue;
|
9465 | },
|
9466 |
|
9467 | /**
|
9468 | * We release all dispatched `SyntheticEvent`s after each event loop, adding
|
9469 | * them back into the pool. This allows a way to hold onto a reference that
|
9470 | * won't be added back into the pool.
|
9471 | */
|
9472 | persist: function () {
|
9473 | this.isPersistent = emptyFunction.thatReturnsTrue;
|
9474 | },
|
9475 |
|
9476 | /**
|
9477 | * Checks if this event should be released back into the pool.
|
9478 | *
|
9479 | * @return {boolean} True if this should not be released, false otherwise.
|
9480 | */
|
9481 | isPersistent: emptyFunction.thatReturnsFalse,
|
9482 |
|
9483 | /**
|
9484 | * `PooledClass` looks for `destructor` on each instance it releases.
|
9485 | */
|
9486 | destructor: function () {
|
9487 | var Interface = this.constructor.Interface;
|
9488 | for (var propName in Interface) {
|
9489 | this[propName] = null;
|
9490 | }
|
9491 | this.dispatchConfig = null;
|
9492 | this.dispatchMarker = null;
|
9493 | this.nativeEvent = null;
|
9494 | }
|
9495 |
|
9496 | });
|
9497 |
|
9498 | SyntheticEvent.Interface = EventInterface;
|
9499 |
|
9500 | /**
|
9501 | * Helper to reduce boilerplate when creating subclasses.
|
9502 | *
|
9503 | * @param {function} Class
|
9504 | * @param {?object} Interface
|
9505 | */
|
9506 | SyntheticEvent.augmentClass = function (Class, Interface) {
|
9507 | var Super = this;
|
9508 |
|
9509 | var prototype = Object.create(Super.prototype);
|
9510 | assign(prototype, Class.prototype);
|
9511 | Class.prototype = prototype;
|
9512 | Class.prototype.constructor = Class;
|
9513 |
|
9514 | Class.Interface = assign({}, Super.Interface, Interface);
|
9515 | Class.augmentClass = Super.augmentClass;
|
9516 |
|
9517 | PooledClass.addPoolingTo(Class, PooledClass.fourArgumentPooler);
|
9518 | };
|
9519 |
|
9520 | PooledClass.addPoolingTo(SyntheticEvent, PooledClass.fourArgumentPooler);
|
9521 |
|
9522 | module.exports = SyntheticEvent;
|
9523 | /* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(5)))
|
9524 |
|
9525 | /***/ },
|
9526 | /* 79 */
|
9527 | /***/ function(module, exports, __webpack_require__) {
|
9528 |
|
9529 | /**
|
9530 | * Copyright 2013-2015, Facebook, Inc.
|
9531 | * All rights reserved.
|
9532 | *
|
9533 | * This source code is licensed under the BSD-style license found in the
|
9534 | * LICENSE file in the root directory of this source tree. An additional grant
|
9535 | * of patent rights can be found in the PATENTS file in the same directory.
|
9536 | *
|
9537 | * @providesModule SyntheticInputEvent
|
9538 | * @typechecks static-only
|
9539 | */
|
9540 |
|
9541 | 'use strict';
|
9542 |
|
9543 | var SyntheticEvent = __webpack_require__(78);
|
9544 |
|
9545 | /**
|
9546 | * @interface Event
|
9547 | * @see http://www.w3.org/TR/2013/WD-DOM-Level-3-Events-20131105
|
9548 | * /#events-inputevents
|
9549 | */
|
9550 | var InputEventInterface = {
|
9551 | data: null
|
9552 | };
|
9553 |
|
9554 | /**
|
9555 | * @param {object} dispatchConfig Configuration used to dispatch this event.
|
9556 | * @param {string} dispatchMarker Marker identifying the event target.
|
9557 | * @param {object} nativeEvent Native browser event.
|
9558 | * @extends {SyntheticUIEvent}
|
9559 | */
|
9560 | function SyntheticInputEvent(dispatchConfig, dispatchMarker, nativeEvent, nativeEventTarget) {
|
9561 | SyntheticEvent.call(this, dispatchConfig, dispatchMarker, nativeEvent, nativeEventTarget);
|
9562 | }
|
9563 |
|
9564 | SyntheticEvent.augmentClass(SyntheticInputEvent, InputEventInterface);
|
9565 |
|
9566 | module.exports = SyntheticInputEvent;
|
9567 |
|
9568 | /***/ },
|
9569 | /* 80 */
|
9570 | /***/ function(module, exports) {
|
9571 |
|
9572 | /**
|
9573 | * Copyright 2013-2015, Facebook, Inc.
|
9574 | * All rights reserved.
|
9575 | *
|
9576 | * This source code is licensed under the BSD-style license found in the
|
9577 | * LICENSE file in the root directory of this source tree. An additional grant
|
9578 | * of patent rights can be found in the PATENTS file in the same directory.
|
9579 | *
|
9580 | * @providesModule keyOf
|
9581 | */
|
9582 |
|
9583 | /**
|
9584 | * Allows extraction of a minified key. Let's the build system minify keys
|
9585 | * without losing the ability to dynamically use key strings as values
|
9586 | * themselves. Pass in an object with a single key/val pair and it will return
|
9587 | * you the string key of that single record. Suppose you want to grab the
|
9588 | * value for a key 'className' inside of an object. Key/val minification may
|
9589 | * have aliased that key to be 'xa12'. keyOf({className: null}) will return
|
9590 | * 'xa12' in that case. Resolve keys you want to use once at startup time, then
|
9591 | * reuse those resolutions.
|
9592 | */
|
9593 | "use strict";
|
9594 |
|
9595 | var keyOf = function (oneKeyObj) {
|
9596 | var key;
|
9597 | for (key in oneKeyObj) {
|
9598 | if (!oneKeyObj.hasOwnProperty(key)) {
|
9599 | continue;
|
9600 | }
|
9601 | return key;
|
9602 | }
|
9603 | return null;
|
9604 | };
|
9605 |
|
9606 | module.exports = keyOf;
|
9607 |
|
9608 | /***/ },
|
9609 | /* 81 */
|
9610 | /***/ function(module, exports, __webpack_require__) {
|
9611 |
|
9612 | /**
|
9613 | * Copyright 2013-2015, Facebook, Inc.
|
9614 | * All rights reserved.
|
9615 | *
|
9616 | * This source code is licensed under the BSD-style license found in the
|
9617 | * LICENSE file in the root directory of this source tree. An additional grant
|
9618 | * of patent rights can be found in the PATENTS file in the same directory.
|
9619 | *
|
9620 | * @providesModule ChangeEventPlugin
|
9621 | */
|
9622 |
|
9623 | 'use strict';
|
9624 |
|
9625 | var EventConstants = __webpack_require__(31);
|
9626 | var EventPluginHub = __webpack_require__(32);
|
9627 | var EventPropagators = __webpack_require__(74);
|
9628 | var ExecutionEnvironment = __webpack_require__(10);
|
9629 | var ReactUpdates = __webpack_require__(55);
|
9630 | var SyntheticEvent = __webpack_require__(78);
|
9631 |
|
9632 | var getEventTarget = __webpack_require__(82);
|
9633 | var isEventSupported = __webpack_require__(41);
|
9634 | var isTextInputElement = __webpack_require__(83);
|
9635 | var keyOf = __webpack_require__(80);
|
9636 |
|
9637 | var topLevelTypes = EventConstants.topLevelTypes;
|
9638 |
|
9639 | var eventTypes = {
|
9640 | change: {
|
9641 | phasedRegistrationNames: {
|
9642 | bubbled: keyOf({ onChange: null }),
|
9643 | captured: keyOf({ onChangeCapture: null })
|
9644 | },
|
9645 | dependencies: [topLevelTypes.topBlur, topLevelTypes.topChange, topLevelTypes.topClick, topLevelTypes.topFocus, topLevelTypes.topInput, topLevelTypes.topKeyDown, topLevelTypes.topKeyUp, topLevelTypes.topSelectionChange]
|
9646 | }
|
9647 | };
|
9648 |
|
9649 | /**
|
9650 | * For IE shims
|
9651 | */
|
9652 | var activeElement = null;
|
9653 | var activeElementID = null;
|
9654 | var activeElementValue = null;
|
9655 | var activeElementValueProp = null;
|
9656 |
|
9657 | /**
|
9658 | * SECTION: handle `change` event
|
9659 | */
|
9660 | function shouldUseChangeEvent(elem) {
|
9661 | var nodeName = elem.nodeName && elem.nodeName.toLowerCase();
|
9662 | return nodeName === 'select' || nodeName === 'input' && elem.type === 'file';
|
9663 | }
|
9664 |
|
9665 | var doesChangeEventBubble = false;
|
9666 | if (ExecutionEnvironment.canUseDOM) {
|
9667 | // See `handleChange` comment below
|
9668 | doesChangeEventBubble = isEventSupported('change') && (!('documentMode' in document) || document.documentMode > 8);
|
9669 | }
|
9670 |
|
9671 | function manualDispatchChangeEvent(nativeEvent) {
|
9672 | var event = SyntheticEvent.getPooled(eventTypes.change, activeElementID, nativeEvent, getEventTarget(nativeEvent));
|
9673 | EventPropagators.accumulateTwoPhaseDispatches(event);
|
9674 |
|
9675 | // If change and propertychange bubbled, we'd just bind to it like all the
|
9676 | // other events and have it go through ReactBrowserEventEmitter. Since it
|
9677 | // doesn't, we manually listen for the events and so we have to enqueue and
|
9678 | // process the abstract event manually.
|
9679 | //
|
9680 | // Batching is necessary here in order to ensure that all event handlers run
|
9681 | // before the next rerender (including event handlers attached to ancestor
|
9682 | // elements instead of directly on the input). Without this, controlled
|
9683 | // components don't work properly in conjunction with event bubbling because
|
9684 | // the component is rerendered and the value reverted before all the event
|
9685 | // handlers can run. See https://github.com/facebook/react/issues/708.
|
9686 | ReactUpdates.batchedUpdates(runEventInBatch, event);
|
9687 | }
|
9688 |
|
9689 | function runEventInBatch(event) {
|
9690 | EventPluginHub.enqueueEvents(event);
|
9691 | EventPluginHub.processEventQueue(false);
|
9692 | }
|
9693 |
|
9694 | function startWatchingForChangeEventIE8(target, targetID) {
|
9695 | activeElement = target;
|
9696 | activeElementID = targetID;
|
9697 | activeElement.attachEvent('onchange', manualDispatchChangeEvent);
|
9698 | }
|
9699 |
|
9700 | function stopWatchingForChangeEventIE8() {
|
9701 | if (!activeElement) {
|
9702 | return;
|
9703 | }
|
9704 | activeElement.detachEvent('onchange', manualDispatchChangeEvent);
|
9705 | activeElement = null;
|
9706 | activeElementID = null;
|
9707 | }
|
9708 |
|
9709 | function getTargetIDForChangeEvent(topLevelType, topLevelTarget, topLevelTargetID) {
|
9710 | if (topLevelType === topLevelTypes.topChange) {
|
9711 | return topLevelTargetID;
|
9712 | }
|
9713 | }
|
9714 | function handleEventsForChangeEventIE8(topLevelType, topLevelTarget, topLevelTargetID) {
|
9715 | if (topLevelType === topLevelTypes.topFocus) {
|
9716 | // stopWatching() should be a noop here but we call it just in case we
|
9717 | // missed a blur event somehow.
|
9718 | stopWatchingForChangeEventIE8();
|
9719 | startWatchingForChangeEventIE8(topLevelTarget, topLevelTargetID);
|
9720 | } else if (topLevelType === topLevelTypes.topBlur) {
|
9721 | stopWatchingForChangeEventIE8();
|
9722 | }
|
9723 | }
|
9724 |
|
9725 | /**
|
9726 | * SECTION: handle `input` event
|
9727 | */
|
9728 | var isInputEventSupported = false;
|
9729 | if (ExecutionEnvironment.canUseDOM) {
|
9730 | // IE9 claims to support the input event but fails to trigger it when
|
9731 | // deleting text, so we ignore its input events
|
9732 | isInputEventSupported = isEventSupported('input') && (!('documentMode' in document) || document.documentMode > 9);
|
9733 | }
|
9734 |
|
9735 | /**
|
9736 | * (For old IE.) Replacement getter/setter for the `value` property that gets
|
9737 | * set on the active element.
|
9738 | */
|
9739 | var newValueProp = {
|
9740 | get: function () {
|
9741 | return activeElementValueProp.get.call(this);
|
9742 | },
|
9743 | set: function (val) {
|
9744 | // Cast to a string so we can do equality checks.
|
9745 | activeElementValue = '' + val;
|
9746 | activeElementValueProp.set.call(this, val);
|
9747 | }
|
9748 | };
|
9749 |
|
9750 | /**
|
9751 | * (For old IE.) Starts tracking propertychange events on the passed-in element
|
9752 | * and override the value property so that we can distinguish user events from
|
9753 | * value changes in JS.
|
9754 | */
|
9755 | function startWatchingForValueChange(target, targetID) {
|
9756 | activeElement = target;
|
9757 | activeElementID = targetID;
|
9758 | activeElementValue = target.value;
|
9759 | activeElementValueProp = Object.getOwnPropertyDescriptor(target.constructor.prototype, 'value');
|
9760 |
|
9761 | // Not guarded in a canDefineProperty check: IE8 supports defineProperty only
|
9762 | // on DOM elements
|
9763 | Object.defineProperty(activeElement, 'value', newValueProp);
|
9764 | activeElement.attachEvent('onpropertychange', handlePropertyChange);
|
9765 | }
|
9766 |
|
9767 | /**
|
9768 | * (For old IE.) Removes the event listeners from the currently-tracked element,
|
9769 | * if any exists.
|
9770 | */
|
9771 | function stopWatchingForValueChange() {
|
9772 | if (!activeElement) {
|
9773 | return;
|
9774 | }
|
9775 |
|
9776 | // delete restores the original property definition
|
9777 | delete activeElement.value;
|
9778 | activeElement.detachEvent('onpropertychange', handlePropertyChange);
|
9779 |
|
9780 | activeElement = null;
|
9781 | activeElementID = null;
|
9782 | activeElementValue = null;
|
9783 | activeElementValueProp = null;
|
9784 | }
|
9785 |
|
9786 | /**
|
9787 | * (For old IE.) Handles a propertychange event, sending a `change` event if
|
9788 | * the value of the active element has changed.
|
9789 | */
|
9790 | function handlePropertyChange(nativeEvent) {
|
9791 | if (nativeEvent.propertyName !== 'value') {
|
9792 | return;
|
9793 | }
|
9794 | var value = nativeEvent.srcElement.value;
|
9795 | if (value === activeElementValue) {
|
9796 | return;
|
9797 | }
|
9798 | activeElementValue = value;
|
9799 |
|
9800 | manualDispatchChangeEvent(nativeEvent);
|
9801 | }
|
9802 |
|
9803 | /**
|
9804 | * If a `change` event should be fired, returns the target's ID.
|
9805 | */
|
9806 | function getTargetIDForInputEvent(topLevelType, topLevelTarget, topLevelTargetID) {
|
9807 | if (topLevelType === topLevelTypes.topInput) {
|
9808 | // In modern browsers (i.e., not IE8 or IE9), the input event is exactly
|
9809 | // what we want so fall through here and trigger an abstract event
|
9810 | return topLevelTargetID;
|
9811 | }
|
9812 | }
|
9813 |
|
9814 | // For IE8 and IE9.
|
9815 | function handleEventsForInputEventIE(topLevelType, topLevelTarget, topLevelTargetID) {
|
9816 | if (topLevelType === topLevelTypes.topFocus) {
|
9817 | // In IE8, we can capture almost all .value changes by adding a
|
9818 | // propertychange handler and looking for events with propertyName
|
9819 | // equal to 'value'
|
9820 | // In IE9, propertychange fires for most input events but is buggy and
|
9821 | // doesn't fire when text is deleted, but conveniently, selectionchange
|
9822 | // appears to fire in all of the remaining cases so we catch those and
|
9823 | // forward the event if the value has changed
|
9824 | // In either case, we don't want to call the event handler if the value
|
9825 | // is changed from JS so we redefine a setter for `.value` that updates
|
9826 | // our activeElementValue variable, allowing us to ignore those changes
|
9827 | //
|
9828 | // stopWatching() should be a noop here but we call it just in case we
|
9829 | // missed a blur event somehow.
|
9830 | stopWatchingForValueChange();
|
9831 | startWatchingForValueChange(topLevelTarget, topLevelTargetID);
|
9832 | } else if (topLevelType === topLevelTypes.topBlur) {
|
9833 | stopWatchingForValueChange();
|
9834 | }
|
9835 | }
|
9836 |
|
9837 | // For IE8 and IE9.
|
9838 | function getTargetIDForInputEventIE(topLevelType, topLevelTarget, topLevelTargetID) {
|
9839 | if (topLevelType === topLevelTypes.topSelectionChange || topLevelType === topLevelTypes.topKeyUp || topLevelType === topLevelTypes.topKeyDown) {
|
9840 | // On the selectionchange event, the target is just document which isn't
|
9841 | // helpful for us so just check activeElement instead.
|
9842 | //
|
9843 | // 99% of the time, keydown and keyup aren't necessary. IE8 fails to fire
|
9844 | // propertychange on the first input event after setting `value` from a
|
9845 | // script and fires only keydown, keypress, keyup. Catching keyup usually
|
9846 | // gets it and catching keydown lets us fire an event for the first
|
9847 | // keystroke if user does a key repeat (it'll be a little delayed: right
|
9848 | // before the second keystroke). Other input methods (e.g., paste) seem to
|
9849 | // fire selectionchange normally.
|
9850 | if (activeElement && activeElement.value !== activeElementValue) {
|
9851 | activeElementValue = activeElement.value;
|
9852 | return activeElementID;
|
9853 | }
|
9854 | }
|
9855 | }
|
9856 |
|
9857 | /**
|
9858 | * SECTION: handle `click` event
|
9859 | */
|
9860 | function shouldUseClickEvent(elem) {
|
9861 | // Use the `click` event to detect changes to checkbox and radio inputs.
|
9862 | // This approach works across all browsers, whereas `change` does not fire
|
9863 | // until `blur` in IE8.
|
9864 | return elem.nodeName && elem.nodeName.toLowerCase() === 'input' && (elem.type === 'checkbox' || elem.type === 'radio');
|
9865 | }
|
9866 |
|
9867 | function getTargetIDForClickEvent(topLevelType, topLevelTarget, topLevelTargetID) {
|
9868 | if (topLevelType === topLevelTypes.topClick) {
|
9869 | return topLevelTargetID;
|
9870 | }
|
9871 | }
|
9872 |
|
9873 | /**
|
9874 | * This plugin creates an `onChange` event that normalizes change events
|
9875 | * across form elements. This event fires at a time when it's possible to
|
9876 | * change the element's value without seeing a flicker.
|
9877 | *
|
9878 | * Supported elements are:
|
9879 | * - input (see `isTextInputElement`)
|
9880 | * - textarea
|
9881 | * - select
|
9882 | */
|
9883 | var ChangeEventPlugin = {
|
9884 |
|
9885 | eventTypes: eventTypes,
|
9886 |
|
9887 | /**
|
9888 | * @param {string} topLevelType Record from `EventConstants`.
|
9889 | * @param {DOMEventTarget} topLevelTarget The listening component root node.
|
9890 | * @param {string} topLevelTargetID ID of `topLevelTarget`.
|
9891 | * @param {object} nativeEvent Native browser event.
|
9892 | * @return {*} An accumulation of synthetic events.
|
9893 | * @see {EventPluginHub.extractEvents}
|
9894 | */
|
9895 | extractEvents: function (topLevelType, topLevelTarget, topLevelTargetID, nativeEvent, nativeEventTarget) {
|
9896 |
|
9897 | var getTargetIDFunc, handleEventFunc;
|
9898 | if (shouldUseChangeEvent(topLevelTarget)) {
|
9899 | if (doesChangeEventBubble) {
|
9900 | getTargetIDFunc = getTargetIDForChangeEvent;
|
9901 | } else {
|
9902 | handleEventFunc = handleEventsForChangeEventIE8;
|
9903 | }
|
9904 | } else if (isTextInputElement(topLevelTarget)) {
|
9905 | if (isInputEventSupported) {
|
9906 | getTargetIDFunc = getTargetIDForInputEvent;
|
9907 | } else {
|
9908 | getTargetIDFunc = getTargetIDForInputEventIE;
|
9909 | handleEventFunc = handleEventsForInputEventIE;
|
9910 | }
|
9911 | } else if (shouldUseClickEvent(topLevelTarget)) {
|
9912 | getTargetIDFunc = getTargetIDForClickEvent;
|
9913 | }
|
9914 |
|
9915 | if (getTargetIDFunc) {
|
9916 | var targetID = getTargetIDFunc(topLevelType, topLevelTarget, topLevelTargetID);
|
9917 | if (targetID) {
|
9918 | var event = SyntheticEvent.getPooled(eventTypes.change, targetID, nativeEvent, nativeEventTarget);
|
9919 | event.type = 'change';
|
9920 | EventPropagators.accumulateTwoPhaseDispatches(event);
|
9921 | return event;
|
9922 | }
|
9923 | }
|
9924 |
|
9925 | if (handleEventFunc) {
|
9926 | handleEventFunc(topLevelType, topLevelTarget, topLevelTargetID);
|
9927 | }
|
9928 | }
|
9929 |
|
9930 | };
|
9931 |
|
9932 | module.exports = ChangeEventPlugin;
|
9933 |
|
9934 | /***/ },
|
9935 | /* 82 */
|
9936 | /***/ function(module, exports) {
|
9937 |
|
9938 | /**
|
9939 | * Copyright 2013-2015, Facebook, Inc.
|
9940 | * All rights reserved.
|
9941 | *
|
9942 | * This source code is licensed under the BSD-style license found in the
|
9943 | * LICENSE file in the root directory of this source tree. An additional grant
|
9944 | * of patent rights can be found in the PATENTS file in the same directory.
|
9945 | *
|
9946 | * @providesModule getEventTarget
|
9947 | * @typechecks static-only
|
9948 | */
|
9949 |
|
9950 | 'use strict';
|
9951 |
|
9952 | /**
|
9953 | * Gets the target node from a native browser event by accounting for
|
9954 | * inconsistencies in browser DOM APIs.
|
9955 | *
|
9956 | * @param {object} nativeEvent Native browser event.
|
9957 | * @return {DOMEventTarget} Target node.
|
9958 | */
|
9959 | function getEventTarget(nativeEvent) {
|
9960 | var target = nativeEvent.target || nativeEvent.srcElement || window;
|
9961 | // Safari may fire events on text nodes (Node.TEXT_NODE is 3).
|
9962 | // @see http://www.quirksmode.org/js/events_properties.html
|
9963 | return target.nodeType === 3 ? target.parentNode : target;
|
9964 | }
|
9965 |
|
9966 | module.exports = getEventTarget;
|
9967 |
|
9968 | /***/ },
|
9969 | /* 83 */
|
9970 | /***/ function(module, exports) {
|
9971 |
|
9972 | /**
|
9973 | * Copyright 2013-2015, Facebook, Inc.
|
9974 | * All rights reserved.
|
9975 | *
|
9976 | * This source code is licensed under the BSD-style license found in the
|
9977 | * LICENSE file in the root directory of this source tree. An additional grant
|
9978 | * of patent rights can be found in the PATENTS file in the same directory.
|
9979 | *
|
9980 | * @providesModule isTextInputElement
|
9981 | */
|
9982 |
|
9983 | 'use strict';
|
9984 |
|
9985 | /**
|
9986 | * @see http://www.whatwg.org/specs/web-apps/current-work/multipage/the-input-element.html#input-type-attr-summary
|
9987 | */
|
9988 | var supportedInputTypes = {
|
9989 | 'color': true,
|
9990 | 'date': true,
|
9991 | 'datetime': true,
|
9992 | 'datetime-local': true,
|
9993 | 'email': true,
|
9994 | 'month': true,
|
9995 | 'number': true,
|
9996 | 'password': true,
|
9997 | 'range': true,
|
9998 | 'search': true,
|
9999 | 'tel': true,
|
10000 | 'text': true,
|
10001 | 'time': true,
|
10002 | 'url': true,
|
10003 | 'week': true
|
10004 | };
|
10005 |
|
10006 | function isTextInputElement(elem) {
|
10007 | var nodeName = elem && elem.nodeName && elem.nodeName.toLowerCase();
|
10008 | return nodeName && (nodeName === 'input' && supportedInputTypes[elem.type] || nodeName === 'textarea');
|
10009 | }
|
10010 |
|
10011 | module.exports = isTextInputElement;
|
10012 |
|
10013 | /***/ },
|
10014 | /* 84 */
|
10015 | /***/ function(module, exports) {
|
10016 |
|
10017 | /**
|
10018 | * Copyright 2013-2015, Facebook, Inc.
|
10019 | * All rights reserved.
|
10020 | *
|
10021 | * This source code is licensed under the BSD-style license found in the
|
10022 | * LICENSE file in the root directory of this source tree. An additional grant
|
10023 | * of patent rights can be found in the PATENTS file in the same directory.
|
10024 | *
|
10025 | * @providesModule ClientReactRootIndex
|
10026 | * @typechecks
|
10027 | */
|
10028 |
|
10029 | 'use strict';
|
10030 |
|
10031 | var nextReactRootIndex = 0;
|
10032 |
|
10033 | var ClientReactRootIndex = {
|
10034 | createReactRootIndex: function () {
|
10035 | return nextReactRootIndex++;
|
10036 | }
|
10037 | };
|
10038 |
|
10039 | module.exports = ClientReactRootIndex;
|
10040 |
|
10041 | /***/ },
|
10042 | /* 85 */
|
10043 | /***/ function(module, exports, __webpack_require__) {
|
10044 |
|
10045 | /**
|
10046 | * Copyright 2013-2015, Facebook, Inc.
|
10047 | * All rights reserved.
|
10048 | *
|
10049 | * This source code is licensed under the BSD-style license found in the
|
10050 | * LICENSE file in the root directory of this source tree. An additional grant
|
10051 | * of patent rights can be found in the PATENTS file in the same directory.
|
10052 | *
|
10053 | * @providesModule DefaultEventPluginOrder
|
10054 | */
|
10055 |
|
10056 | 'use strict';
|
10057 |
|
10058 | var keyOf = __webpack_require__(80);
|
10059 |
|
10060 | /**
|
10061 | * Module that is injectable into `EventPluginHub`, that specifies a
|
10062 | * deterministic ordering of `EventPlugin`s. A convenient way to reason about
|
10063 | * plugins, without having to package every one of them. This is better than
|
10064 | * having plugins be ordered in the same order that they are injected because
|
10065 | * that ordering would be influenced by the packaging order.
|
10066 | * `ResponderEventPlugin` must occur before `SimpleEventPlugin` so that
|
10067 | * preventing default on events is convenient in `SimpleEventPlugin` handlers.
|
10068 | */
|
10069 | var DefaultEventPluginOrder = [keyOf({ ResponderEventPlugin: null }), keyOf({ SimpleEventPlugin: null }), keyOf({ TapEventPlugin: null }), keyOf({ EnterLeaveEventPlugin: null }), keyOf({ ChangeEventPlugin: null }), keyOf({ SelectEventPlugin: null }), keyOf({ BeforeInputEventPlugin: null })];
|
10070 |
|
10071 | module.exports = DefaultEventPluginOrder;
|
10072 |
|
10073 | /***/ },
|
10074 | /* 86 */
|
10075 | /***/ function(module, exports, __webpack_require__) {
|
10076 |
|
10077 | /**
|
10078 | * Copyright 2013-2015, Facebook, Inc.
|
10079 | * All rights reserved.
|
10080 | *
|
10081 | * This source code is licensed under the BSD-style license found in the
|
10082 | * LICENSE file in the root directory of this source tree. An additional grant
|
10083 | * of patent rights can be found in the PATENTS file in the same directory.
|
10084 | *
|
10085 | * @providesModule EnterLeaveEventPlugin
|
10086 | * @typechecks static-only
|
10087 | */
|
10088 |
|
10089 | 'use strict';
|
10090 |
|
10091 | var EventConstants = __webpack_require__(31);
|
10092 | var EventPropagators = __webpack_require__(74);
|
10093 | var SyntheticMouseEvent = __webpack_require__(87);
|
10094 |
|
10095 | var ReactMount = __webpack_require__(29);
|
10096 | var keyOf = __webpack_require__(80);
|
10097 |
|
10098 | var topLevelTypes = EventConstants.topLevelTypes;
|
10099 | var getFirstReactDOM = ReactMount.getFirstReactDOM;
|
10100 |
|
10101 | var eventTypes = {
|
10102 | mouseEnter: {
|
10103 | registrationName: keyOf({ onMouseEnter: null }),
|
10104 | dependencies: [topLevelTypes.topMouseOut, topLevelTypes.topMouseOver]
|
10105 | },
|
10106 | mouseLeave: {
|
10107 | registrationName: keyOf({ onMouseLeave: null }),
|
10108 | dependencies: [topLevelTypes.topMouseOut, topLevelTypes.topMouseOver]
|
10109 | }
|
10110 | };
|
10111 |
|
10112 | var extractedEvents = [null, null];
|
10113 |
|
10114 | var EnterLeaveEventPlugin = {
|
10115 |
|
10116 | eventTypes: eventTypes,
|
10117 |
|
10118 | /**
|
10119 | * For almost every interaction we care about, there will be both a top-level
|
10120 | * `mouseover` and `mouseout` event that occurs. Only use `mouseout` so that
|
10121 | * we do not extract duplicate events. However, moving the mouse into the
|
10122 | * browser from outside will not fire a `mouseout` event. In this case, we use
|
10123 | * the `mouseover` top-level event.
|
10124 | *
|
10125 | * @param {string} topLevelType Record from `EventConstants`.
|
10126 | * @param {DOMEventTarget} topLevelTarget The listening component root node.
|
10127 | * @param {string} topLevelTargetID ID of `topLevelTarget`.
|
10128 | * @param {object} nativeEvent Native browser event.
|
10129 | * @return {*} An accumulation of synthetic events.
|
10130 | * @see {EventPluginHub.extractEvents}
|
10131 | */
|
10132 | extractEvents: function (topLevelType, topLevelTarget, topLevelTargetID, nativeEvent, nativeEventTarget) {
|
10133 | if (topLevelType === topLevelTypes.topMouseOver && (nativeEvent.relatedTarget || nativeEvent.fromElement)) {
|
10134 | return null;
|
10135 | }
|
10136 | if (topLevelType !== topLevelTypes.topMouseOut && topLevelType !== topLevelTypes.topMouseOver) {
|
10137 | // Must not be a mouse in or mouse out - ignoring.
|
10138 | return null;
|
10139 | }
|
10140 |
|
10141 | var win;
|
10142 | if (topLevelTarget.window === topLevelTarget) {
|
10143 | // `topLevelTarget` is probably a window object.
|
10144 | win = topLevelTarget;
|
10145 | } else {
|
10146 | // TODO: Figure out why `ownerDocument` is sometimes undefined in IE8.
|
10147 | var doc = topLevelTarget.ownerDocument;
|
10148 | if (doc) {
|
10149 | win = doc.defaultView || doc.parentWindow;
|
10150 | } else {
|
10151 | win = window;
|
10152 | }
|
10153 | }
|
10154 |
|
10155 | var from;
|
10156 | var to;
|
10157 | var fromID = '';
|
10158 | var toID = '';
|
10159 | if (topLevelType === topLevelTypes.topMouseOut) {
|
10160 | from = topLevelTarget;
|
10161 | fromID = topLevelTargetID;
|
10162 | to = getFirstReactDOM(nativeEvent.relatedTarget || nativeEvent.toElement);
|
10163 | if (to) {
|
10164 | toID = ReactMount.getID(to);
|
10165 | } else {
|
10166 | to = win;
|
10167 | }
|
10168 | to = to || win;
|
10169 | } else {
|
10170 | from = win;
|
10171 | to = topLevelTarget;
|
10172 | toID = topLevelTargetID;
|
10173 | }
|
10174 |
|
10175 | if (from === to) {
|
10176 | // Nothing pertains to our managed components.
|
10177 | return null;
|
10178 | }
|
10179 |
|
10180 | var leave = SyntheticMouseEvent.getPooled(eventTypes.mouseLeave, fromID, nativeEvent, nativeEventTarget);
|
10181 | leave.type = 'mouseleave';
|
10182 | leave.target = from;
|
10183 | leave.relatedTarget = to;
|
10184 |
|
10185 | var enter = SyntheticMouseEvent.getPooled(eventTypes.mouseEnter, toID, nativeEvent, nativeEventTarget);
|
10186 | enter.type = 'mouseenter';
|
10187 | enter.target = to;
|
10188 | enter.relatedTarget = from;
|
10189 |
|
10190 | EventPropagators.accumulateEnterLeaveDispatches(leave, enter, fromID, toID);
|
10191 |
|
10192 | extractedEvents[0] = leave;
|
10193 | extractedEvents[1] = enter;
|
10194 |
|
10195 | return extractedEvents;
|
10196 | }
|
10197 |
|
10198 | };
|
10199 |
|
10200 | module.exports = EnterLeaveEventPlugin;
|
10201 |
|
10202 | /***/ },
|
10203 | /* 87 */
|
10204 | /***/ function(module, exports, __webpack_require__) {
|
10205 |
|
10206 | /**
|
10207 | * Copyright 2013-2015, Facebook, Inc.
|
10208 | * All rights reserved.
|
10209 | *
|
10210 | * This source code is licensed under the BSD-style license found in the
|
10211 | * LICENSE file in the root directory of this source tree. An additional grant
|
10212 | * of patent rights can be found in the PATENTS file in the same directory.
|
10213 | *
|
10214 | * @providesModule SyntheticMouseEvent
|
10215 | * @typechecks static-only
|
10216 | */
|
10217 |
|
10218 | 'use strict';
|
10219 |
|
10220 | var SyntheticUIEvent = __webpack_require__(88);
|
10221 | var ViewportMetrics = __webpack_require__(39);
|
10222 |
|
10223 | var getEventModifierState = __webpack_require__(89);
|
10224 |
|
10225 | /**
|
10226 | * @interface MouseEvent
|
10227 | * @see http://www.w3.org/TR/DOM-Level-3-Events/
|
10228 | */
|
10229 | var MouseEventInterface = {
|
10230 | screenX: null,
|
10231 | screenY: null,
|
10232 | clientX: null,
|
10233 | clientY: null,
|
10234 | ctrlKey: null,
|
10235 | shiftKey: null,
|
10236 | altKey: null,
|
10237 | metaKey: null,
|
10238 | getModifierState: getEventModifierState,
|
10239 | button: function (event) {
|
10240 | // Webkit, Firefox, IE9+
|
10241 | // which: 1 2 3
|
10242 | // button: 0 1 2 (standard)
|
10243 | var button = event.button;
|
10244 | if ('which' in event) {
|
10245 | return button;
|
10246 | }
|
10247 | // IE<9
|
10248 | // which: undefined
|
10249 | // button: 0 0 0
|
10250 | // button: 1 4 2 (onmouseup)
|
10251 | return button === 2 ? 2 : button === 4 ? 1 : 0;
|
10252 | },
|
10253 | buttons: null,
|
10254 | relatedTarget: function (event) {
|
10255 | return event.relatedTarget || (event.fromElement === event.srcElement ? event.toElement : event.fromElement);
|
10256 | },
|
10257 | // "Proprietary" Interface.
|
10258 | pageX: function (event) {
|
10259 | return 'pageX' in event ? event.pageX : event.clientX + ViewportMetrics.currentScrollLeft;
|
10260 | },
|
10261 | pageY: function (event) {
|
10262 | return 'pageY' in event ? event.pageY : event.clientY + ViewportMetrics.currentScrollTop;
|
10263 | }
|
10264 | };
|
10265 |
|
10266 | /**
|
10267 | * @param {object} dispatchConfig Configuration used to dispatch this event.
|
10268 | * @param {string} dispatchMarker Marker identifying the event target.
|
10269 | * @param {object} nativeEvent Native browser event.
|
10270 | * @extends {SyntheticUIEvent}
|
10271 | */
|
10272 | function SyntheticMouseEvent(dispatchConfig, dispatchMarker, nativeEvent, nativeEventTarget) {
|
10273 | SyntheticUIEvent.call(this, dispatchConfig, dispatchMarker, nativeEvent, nativeEventTarget);
|
10274 | }
|
10275 |
|
10276 | SyntheticUIEvent.augmentClass(SyntheticMouseEvent, MouseEventInterface);
|
10277 |
|
10278 | module.exports = SyntheticMouseEvent;
|
10279 |
|
10280 | /***/ },
|
10281 | /* 88 */
|
10282 | /***/ function(module, exports, __webpack_require__) {
|
10283 |
|
10284 | /**
|
10285 | * Copyright 2013-2015, Facebook, Inc.
|
10286 | * All rights reserved.
|
10287 | *
|
10288 | * This source code is licensed under the BSD-style license found in the
|
10289 | * LICENSE file in the root directory of this source tree. An additional grant
|
10290 | * of patent rights can be found in the PATENTS file in the same directory.
|
10291 | *
|
10292 | * @providesModule SyntheticUIEvent
|
10293 | * @typechecks static-only
|
10294 | */
|
10295 |
|
10296 | 'use strict';
|
10297 |
|
10298 | var SyntheticEvent = __webpack_require__(78);
|
10299 |
|
10300 | var getEventTarget = __webpack_require__(82);
|
10301 |
|
10302 | /**
|
10303 | * @interface UIEvent
|
10304 | * @see http://www.w3.org/TR/DOM-Level-3-Events/
|
10305 | */
|
10306 | var UIEventInterface = {
|
10307 | view: function (event) {
|
10308 | if (event.view) {
|
10309 | return event.view;
|
10310 | }
|
10311 |
|
10312 | var target = getEventTarget(event);
|
10313 | if (target != null && target.window === target) {
|
10314 | // target is a window object
|
10315 | return target;
|
10316 | }
|
10317 |
|
10318 | var doc = target.ownerDocument;
|
10319 | // TODO: Figure out why `ownerDocument` is sometimes undefined in IE8.
|
10320 | if (doc) {
|
10321 | return doc.defaultView || doc.parentWindow;
|
10322 | } else {
|
10323 | return window;
|
10324 | }
|
10325 | },
|
10326 | detail: function (event) {
|
10327 | return event.detail || 0;
|
10328 | }
|
10329 | };
|
10330 |
|
10331 | /**
|
10332 | * @param {object} dispatchConfig Configuration used to dispatch this event.
|
10333 | * @param {string} dispatchMarker Marker identifying the event target.
|
10334 | * @param {object} nativeEvent Native browser event.
|
10335 | * @extends {SyntheticEvent}
|
10336 | */
|
10337 | function SyntheticUIEvent(dispatchConfig, dispatchMarker, nativeEvent, nativeEventTarget) {
|
10338 | SyntheticEvent.call(this, dispatchConfig, dispatchMarker, nativeEvent, nativeEventTarget);
|
10339 | }
|
10340 |
|
10341 | SyntheticEvent.augmentClass(SyntheticUIEvent, UIEventInterface);
|
10342 |
|
10343 | module.exports = SyntheticUIEvent;
|
10344 |
|
10345 | /***/ },
|
10346 | /* 89 */
|
10347 | /***/ function(module, exports) {
|
10348 |
|
10349 | /**
|
10350 | * Copyright 2013-2015, Facebook, Inc.
|
10351 | * All rights reserved.
|
10352 | *
|
10353 | * This source code is licensed under the BSD-style license found in the
|
10354 | * LICENSE file in the root directory of this source tree. An additional grant
|
10355 | * of patent rights can be found in the PATENTS file in the same directory.
|
10356 | *
|
10357 | * @providesModule getEventModifierState
|
10358 | * @typechecks static-only
|
10359 | */
|
10360 |
|
10361 | 'use strict';
|
10362 |
|
10363 | /**
|
10364 | * Translation from modifier key to the associated property in the event.
|
10365 | * @see http://www.w3.org/TR/DOM-Level-3-Events/#keys-Modifiers
|
10366 | */
|
10367 |
|
10368 | var modifierKeyToProp = {
|
10369 | 'Alt': 'altKey',
|
10370 | 'Control': 'ctrlKey',
|
10371 | 'Meta': 'metaKey',
|
10372 | 'Shift': 'shiftKey'
|
10373 | };
|
10374 |
|
10375 | // IE8 does not implement getModifierState so we simply map it to the only
|
10376 | // modifier keys exposed by the event itself, does not support Lock-keys.
|
10377 | // Currently, all major browsers except Chrome seems to support Lock-keys.
|
10378 | function modifierStateGetter(keyArg) {
|
10379 | var syntheticEvent = this;
|
10380 | var nativeEvent = syntheticEvent.nativeEvent;
|
10381 | if (nativeEvent.getModifierState) {
|
10382 | return nativeEvent.getModifierState(keyArg);
|
10383 | }
|
10384 | var keyProp = modifierKeyToProp[keyArg];
|
10385 | return keyProp ? !!nativeEvent[keyProp] : false;
|
10386 | }
|
10387 |
|
10388 | function getEventModifierState(nativeEvent) {
|
10389 | return modifierStateGetter;
|
10390 | }
|
10391 |
|
10392 | module.exports = getEventModifierState;
|
10393 |
|
10394 | /***/ },
|
10395 | /* 90 */
|
10396 | /***/ function(module, exports, __webpack_require__) {
|
10397 |
|
10398 | /**
|
10399 | * Copyright 2013-2015, Facebook, Inc.
|
10400 | * All rights reserved.
|
10401 | *
|
10402 | * This source code is licensed under the BSD-style license found in the
|
10403 | * LICENSE file in the root directory of this source tree. An additional grant
|
10404 | * of patent rights can be found in the PATENTS file in the same directory.
|
10405 | *
|
10406 | * @providesModule HTMLDOMPropertyConfig
|
10407 | */
|
10408 |
|
10409 | 'use strict';
|
10410 |
|
10411 | var DOMProperty = __webpack_require__(24);
|
10412 | var ExecutionEnvironment = __webpack_require__(10);
|
10413 |
|
10414 | var MUST_USE_ATTRIBUTE = DOMProperty.injection.MUST_USE_ATTRIBUTE;
|
10415 | var MUST_USE_PROPERTY = DOMProperty.injection.MUST_USE_PROPERTY;
|
10416 | var HAS_BOOLEAN_VALUE = DOMProperty.injection.HAS_BOOLEAN_VALUE;
|
10417 | var HAS_SIDE_EFFECTS = DOMProperty.injection.HAS_SIDE_EFFECTS;
|
10418 | var HAS_NUMERIC_VALUE = DOMProperty.injection.HAS_NUMERIC_VALUE;
|
10419 | var HAS_POSITIVE_NUMERIC_VALUE = DOMProperty.injection.HAS_POSITIVE_NUMERIC_VALUE;
|
10420 | var HAS_OVERLOADED_BOOLEAN_VALUE = DOMProperty.injection.HAS_OVERLOADED_BOOLEAN_VALUE;
|
10421 |
|
10422 | var hasSVG;
|
10423 | if (ExecutionEnvironment.canUseDOM) {
|
10424 | var implementation = document.implementation;
|
10425 | hasSVG = implementation && implementation.hasFeature && implementation.hasFeature('http://www.w3.org/TR/SVG11/feature#BasicStructure', '1.1');
|
10426 | }
|
10427 |
|
10428 | var HTMLDOMPropertyConfig = {
|
10429 | isCustomAttribute: RegExp.prototype.test.bind(/^(data|aria)-[a-z_][a-z\d_.\-]*$/),
|
10430 | Properties: {
|
10431 | /**
|
10432 | * Standard Properties
|
10433 | */
|
10434 | accept: null,
|
10435 | acceptCharset: null,
|
10436 | accessKey: null,
|
10437 | action: null,
|
10438 | allowFullScreen: MUST_USE_ATTRIBUTE | HAS_BOOLEAN_VALUE,
|
10439 | allowTransparency: MUST_USE_ATTRIBUTE,
|
10440 | alt: null,
|
10441 | async: HAS_BOOLEAN_VALUE,
|
10442 | autoComplete: null,
|
10443 | // autoFocus is polyfilled/normalized by AutoFocusUtils
|
10444 | // autoFocus: HAS_BOOLEAN_VALUE,
|
10445 | autoPlay: HAS_BOOLEAN_VALUE,
|
10446 | capture: MUST_USE_ATTRIBUTE | HAS_BOOLEAN_VALUE,
|
10447 | cellPadding: null,
|
10448 | cellSpacing: null,
|
10449 | charSet: MUST_USE_ATTRIBUTE,
|
10450 | challenge: MUST_USE_ATTRIBUTE,
|
10451 | checked: MUST_USE_PROPERTY | HAS_BOOLEAN_VALUE,
|
10452 | classID: MUST_USE_ATTRIBUTE,
|
10453 | // To set className on SVG elements, it's necessary to use .setAttribute;
|
10454 | // this works on HTML elements too in all browsers except IE8. Conveniently,
|
10455 | // IE8 doesn't support SVG and so we can simply use the attribute in
|
10456 | // browsers that support SVG and the property in browsers that don't,
|
10457 | // regardless of whether the element is HTML or SVG.
|
10458 | className: hasSVG ? MUST_USE_ATTRIBUTE : MUST_USE_PROPERTY,
|
10459 | cols: MUST_USE_ATTRIBUTE | HAS_POSITIVE_NUMERIC_VALUE,
|
10460 | colSpan: null,
|
10461 | content: null,
|
10462 | contentEditable: null,
|
10463 | contextMenu: MUST_USE_ATTRIBUTE,
|
10464 | controls: MUST_USE_PROPERTY | HAS_BOOLEAN_VALUE,
|
10465 | coords: null,
|
10466 | crossOrigin: null,
|
10467 | data: null, // For `<object />` acts as `src`.
|
10468 | dateTime: MUST_USE_ATTRIBUTE,
|
10469 | 'default': HAS_BOOLEAN_VALUE,
|
10470 | defer: HAS_BOOLEAN_VALUE,
|
10471 | dir: null,
|
10472 | disabled: MUST_USE_ATTRIBUTE | HAS_BOOLEAN_VALUE,
|
10473 | download: HAS_OVERLOADED_BOOLEAN_VALUE,
|
10474 | draggable: null,
|
10475 | encType: null,
|
10476 | form: MUST_USE_ATTRIBUTE,
|
10477 | formAction: MUST_USE_ATTRIBUTE,
|
10478 | formEncType: MUST_USE_ATTRIBUTE,
|
10479 | formMethod: MUST_USE_ATTRIBUTE,
|
10480 | formNoValidate: HAS_BOOLEAN_VALUE,
|
10481 | formTarget: MUST_USE_ATTRIBUTE,
|
10482 | frameBorder: MUST_USE_ATTRIBUTE,
|
10483 | headers: null,
|
10484 | height: MUST_USE_ATTRIBUTE,
|
10485 | hidden: MUST_USE_ATTRIBUTE | HAS_BOOLEAN_VALUE,
|
10486 | high: null,
|
10487 | href: null,
|
10488 | hrefLang: null,
|
10489 | htmlFor: null,
|
10490 | httpEquiv: null,
|
10491 | icon: null,
|
10492 | id: MUST_USE_PROPERTY,
|
10493 | inputMode: MUST_USE_ATTRIBUTE,
|
10494 | integrity: null,
|
10495 | is: MUST_USE_ATTRIBUTE,
|
10496 | keyParams: MUST_USE_ATTRIBUTE,
|
10497 | keyType: MUST_USE_ATTRIBUTE,
|
10498 | kind: null,
|
10499 | label: null,
|
10500 | lang: null,
|
10501 | list: MUST_USE_ATTRIBUTE,
|
10502 | loop: MUST_USE_PROPERTY | HAS_BOOLEAN_VALUE,
|
10503 | low: null,
|
10504 | manifest: MUST_USE_ATTRIBUTE,
|
10505 | marginHeight: null,
|
10506 | marginWidth: null,
|
10507 | max: null,
|
10508 | maxLength: MUST_USE_ATTRIBUTE,
|
10509 | media: MUST_USE_ATTRIBUTE,
|
10510 | mediaGroup: null,
|
10511 | method: null,
|
10512 | min: null,
|
10513 | minLength: MUST_USE_ATTRIBUTE,
|
10514 | multiple: MUST_USE_PROPERTY | HAS_BOOLEAN_VALUE,
|
10515 | muted: MUST_USE_PROPERTY | HAS_BOOLEAN_VALUE,
|
10516 | name: null,
|
10517 | nonce: MUST_USE_ATTRIBUTE,
|
10518 | noValidate: HAS_BOOLEAN_VALUE,
|
10519 | open: HAS_BOOLEAN_VALUE,
|
10520 | optimum: null,
|
10521 | pattern: null,
|
10522 | placeholder: null,
|
10523 | poster: null,
|
10524 | preload: null,
|
10525 | radioGroup: null,
|
10526 | readOnly: MUST_USE_PROPERTY | HAS_BOOLEAN_VALUE,
|
10527 | rel: null,
|
10528 | required: HAS_BOOLEAN_VALUE,
|
10529 | reversed: HAS_BOOLEAN_VALUE,
|
10530 | role: MUST_USE_ATTRIBUTE,
|
10531 | rows: MUST_USE_ATTRIBUTE | HAS_POSITIVE_NUMERIC_VALUE,
|
10532 | rowSpan: null,
|
10533 | sandbox: null,
|
10534 | scope: null,
|
10535 | scoped: HAS_BOOLEAN_VALUE,
|
10536 | scrolling: null,
|
10537 | seamless: MUST_USE_ATTRIBUTE | HAS_BOOLEAN_VALUE,
|
10538 | selected: MUST_USE_PROPERTY | HAS_BOOLEAN_VALUE,
|
10539 | shape: null,
|
10540 | size: MUST_USE_ATTRIBUTE | HAS_POSITIVE_NUMERIC_VALUE,
|
10541 | sizes: MUST_USE_ATTRIBUTE,
|
10542 | span: HAS_POSITIVE_NUMERIC_VALUE,
|
10543 | spellCheck: null,
|
10544 | src: null,
|
10545 | srcDoc: MUST_USE_PROPERTY,
|
10546 | srcLang: null,
|
10547 | srcSet: MUST_USE_ATTRIBUTE,
|
10548 | start: HAS_NUMERIC_VALUE,
|
10549 | step: null,
|
10550 | style: null,
|
10551 | summary: null,
|
10552 | tabIndex: null,
|
10553 | target: null,
|
10554 | title: null,
|
10555 | type: null,
|
10556 | useMap: null,
|
10557 | value: MUST_USE_PROPERTY | HAS_SIDE_EFFECTS,
|
10558 | width: MUST_USE_ATTRIBUTE,
|
10559 | wmode: MUST_USE_ATTRIBUTE,
|
10560 | wrap: null,
|
10561 |
|
10562 | /**
|
10563 | * RDFa Properties
|
10564 | */
|
10565 | about: MUST_USE_ATTRIBUTE,
|
10566 | datatype: MUST_USE_ATTRIBUTE,
|
10567 | inlist: MUST_USE_ATTRIBUTE,
|
10568 | prefix: MUST_USE_ATTRIBUTE,
|
10569 | // property is also supported for OpenGraph in meta tags.
|
10570 | property: MUST_USE_ATTRIBUTE,
|
10571 | resource: MUST_USE_ATTRIBUTE,
|
10572 | 'typeof': MUST_USE_ATTRIBUTE,
|
10573 | vocab: MUST_USE_ATTRIBUTE,
|
10574 |
|
10575 | /**
|
10576 | * Non-standard Properties
|
10577 | */
|
10578 | // autoCapitalize and autoCorrect are supported in Mobile Safari for
|
10579 | // keyboard hints.
|
10580 | autoCapitalize: MUST_USE_ATTRIBUTE,
|
10581 | autoCorrect: MUST_USE_ATTRIBUTE,
|
10582 | // autoSave allows WebKit/Blink to persist values of input fields on page reloads
|
10583 | autoSave: null,
|
10584 | // color is for Safari mask-icon link
|
10585 | color: null,
|
10586 | // itemProp, itemScope, itemType are for
|
10587 | // Microdata support. See http://schema.org/docs/gs.html
|
10588 | itemProp: MUST_USE_ATTRIBUTE,
|
10589 | itemScope: MUST_USE_ATTRIBUTE | HAS_BOOLEAN_VALUE,
|
10590 | itemType: MUST_USE_ATTRIBUTE,
|
10591 | // itemID and itemRef are for Microdata support as well but
|
10592 | // only specified in the the WHATWG spec document. See
|
10593 | // https://html.spec.whatwg.org/multipage/microdata.html#microdata-dom-api
|
10594 | itemID: MUST_USE_ATTRIBUTE,
|
10595 | itemRef: MUST_USE_ATTRIBUTE,
|
10596 | // results show looking glass icon and recent searches on input
|
10597 | // search fields in WebKit/Blink
|
10598 | results: null,
|
10599 | // IE-only attribute that specifies security restrictions on an iframe
|
10600 | // as an alternative to the sandbox attribute on IE<10
|
10601 | security: MUST_USE_ATTRIBUTE,
|
10602 | // IE-only attribute that controls focus behavior
|
10603 | unselectable: MUST_USE_ATTRIBUTE
|
10604 | },
|
10605 | DOMAttributeNames: {
|
10606 | acceptCharset: 'accept-charset',
|
10607 | className: 'class',
|
10608 | htmlFor: 'for',
|
10609 | httpEquiv: 'http-equiv'
|
10610 | },
|
10611 | DOMPropertyNames: {
|
10612 | autoComplete: 'autocomplete',
|
10613 | autoFocus: 'autofocus',
|
10614 | autoPlay: 'autoplay',
|
10615 | autoSave: 'autosave',
|
10616 | // `encoding` is equivalent to `enctype`, IE8 lacks an `enctype` setter.
|
10617 | // http://www.w3.org/TR/html5/forms.html#dom-fs-encoding
|
10618 | encType: 'encoding',
|
10619 | hrefLang: 'hreflang',
|
10620 | radioGroup: 'radiogroup',
|
10621 | spellCheck: 'spellcheck',
|
10622 | srcDoc: 'srcdoc',
|
10623 | srcSet: 'srcset'
|
10624 | }
|
10625 | };
|
10626 |
|
10627 | module.exports = HTMLDOMPropertyConfig;
|
10628 |
|
10629 | /***/ },
|
10630 | /* 91 */
|
10631 | /***/ function(module, exports, __webpack_require__) {
|
10632 |
|
10633 | /* WEBPACK VAR INJECTION */(function(process) {/**
|
10634 | * Copyright 2013-2015, Facebook, Inc.
|
10635 | * All rights reserved.
|
10636 | *
|
10637 | * This source code is licensed under the BSD-style license found in the
|
10638 | * LICENSE file in the root directory of this source tree. An additional grant
|
10639 | * of patent rights can be found in the PATENTS file in the same directory.
|
10640 | *
|
10641 | * @providesModule ReactBrowserComponentMixin
|
10642 | */
|
10643 |
|
10644 | 'use strict';
|
10645 |
|
10646 | var ReactInstanceMap = __webpack_require__(48);
|
10647 |
|
10648 | var findDOMNode = __webpack_require__(92);
|
10649 | var warning = __webpack_require__(26);
|
10650 |
|
10651 | var didWarnKey = '_getDOMNodeDidWarn';
|
10652 |
|
10653 | var ReactBrowserComponentMixin = {
|
10654 | /**
|
10655 | * Returns the DOM node rendered by this component.
|
10656 | *
|
10657 | * @return {DOMElement} The root node of this component.
|
10658 | * @final
|
10659 | * @protected
|
10660 | */
|
10661 | getDOMNode: function () {
|
10662 | process.env.NODE_ENV !== 'production' ? warning(this.constructor[didWarnKey], '%s.getDOMNode(...) is deprecated. Please use ' + 'ReactDOM.findDOMNode(instance) instead.', ReactInstanceMap.get(this).getName() || this.tagName || 'Unknown') : undefined;
|
10663 | this.constructor[didWarnKey] = true;
|
10664 | return findDOMNode(this);
|
10665 | }
|
10666 | };
|
10667 |
|
10668 | module.exports = ReactBrowserComponentMixin;
|
10669 | /* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(5)))
|
10670 |
|
10671 | /***/ },
|
10672 | /* 92 */
|
10673 | /***/ function(module, exports, __webpack_require__) {
|
10674 |
|
10675 | /* WEBPACK VAR INJECTION */(function(process) {/**
|
10676 | * Copyright 2013-2015, Facebook, Inc.
|
10677 | * All rights reserved.
|
10678 | *
|
10679 | * This source code is licensed under the BSD-style license found in the
|
10680 | * LICENSE file in the root directory of this source tree. An additional grant
|
10681 | * of patent rights can be found in the PATENTS file in the same directory.
|
10682 | *
|
10683 | * @providesModule findDOMNode
|
10684 | * @typechecks static-only
|
10685 | */
|
10686 |
|
10687 | 'use strict';
|
10688 |
|
10689 | var ReactCurrentOwner = __webpack_require__(6);
|
10690 | var ReactInstanceMap = __webpack_require__(48);
|
10691 | var ReactMount = __webpack_require__(29);
|
10692 |
|
10693 | var invariant = __webpack_require__(14);
|
10694 | var warning = __webpack_require__(26);
|
10695 |
|
10696 | /**
|
10697 | * Returns the DOM node rendered by this element.
|
10698 | *
|
10699 | * @param {ReactComponent|DOMElement} componentOrElement
|
10700 | * @return {?DOMElement} The root node of this element.
|
10701 | */
|
10702 | function findDOMNode(componentOrElement) {
|
10703 | if (process.env.NODE_ENV !== 'production') {
|
10704 | var owner = ReactCurrentOwner.current;
|
10705 | if (owner !== null) {
|
10706 | process.env.NODE_ENV !== 'production' ? warning(owner._warnedAboutRefsInRender, '%s is accessing getDOMNode or findDOMNode inside its render(). ' + 'render() should be a pure function of props and state. It should ' + 'never access something that requires stale data from the previous ' + 'render, such as refs. Move this logic to componentDidMount and ' + 'componentDidUpdate instead.', owner.getName() || 'A component') : undefined;
|
10707 | owner._warnedAboutRefsInRender = true;
|
10708 | }
|
10709 | }
|
10710 | if (componentOrElement == null) {
|
10711 | return null;
|
10712 | }
|
10713 | if (componentOrElement.nodeType === 1) {
|
10714 | return componentOrElement;
|
10715 | }
|
10716 | if (ReactInstanceMap.has(componentOrElement)) {
|
10717 | return ReactMount.getNodeFromInstance(componentOrElement);
|
10718 | }
|
10719 | !(componentOrElement.render == null || typeof componentOrElement.render !== 'function') ? process.env.NODE_ENV !== 'production' ? invariant(false, 'findDOMNode was called on an unmounted component.') : invariant(false) : undefined;
|
10720 | true ? process.env.NODE_ENV !== 'production' ? invariant(false, 'Element appears to be neither ReactComponent nor DOMNode (keys: %s)', Object.keys(componentOrElement)) : invariant(false) : undefined;
|
10721 | }
|
10722 |
|
10723 | module.exports = findDOMNode;
|
10724 | /* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(5)))
|
10725 |
|
10726 | /***/ },
|
10727 | /* 93 */
|
10728 | /***/ function(module, exports, __webpack_require__) {
|
10729 |
|
10730 | /**
|
10731 | * Copyright 2013-2015, Facebook, Inc.
|
10732 | * All rights reserved.
|
10733 | *
|
10734 | * This source code is licensed under the BSD-style license found in the
|
10735 | * LICENSE file in the root directory of this source tree. An additional grant
|
10736 | * of patent rights can be found in the PATENTS file in the same directory.
|
10737 | *
|
10738 | * @providesModule ReactDefaultBatchingStrategy
|
10739 | */
|
10740 |
|
10741 | 'use strict';
|
10742 |
|
10743 | var ReactUpdates = __webpack_require__(55);
|
10744 | var Transaction = __webpack_require__(58);
|
10745 |
|
10746 | var assign = __webpack_require__(40);
|
10747 | var emptyFunction = __webpack_require__(16);
|
10748 |
|
10749 | var RESET_BATCHED_UPDATES = {
|
10750 | initialize: emptyFunction,
|
10751 | close: function () {
|
10752 | ReactDefaultBatchingStrategy.isBatchingUpdates = false;
|
10753 | }
|
10754 | };
|
10755 |
|
10756 | var FLUSH_BATCHED_UPDATES = {
|
10757 | initialize: emptyFunction,
|
10758 | close: ReactUpdates.flushBatchedUpdates.bind(ReactUpdates)
|
10759 | };
|
10760 |
|
10761 | var TRANSACTION_WRAPPERS = [FLUSH_BATCHED_UPDATES, RESET_BATCHED_UPDATES];
|
10762 |
|
10763 | function ReactDefaultBatchingStrategyTransaction() {
|
10764 | this.reinitializeTransaction();
|
10765 | }
|
10766 |
|
10767 | assign(ReactDefaultBatchingStrategyTransaction.prototype, Transaction.Mixin, {
|
10768 | getTransactionWrappers: function () {
|
10769 | return TRANSACTION_WRAPPERS;
|
10770 | }
|
10771 | });
|
10772 |
|
10773 | var transaction = new ReactDefaultBatchingStrategyTransaction();
|
10774 |
|
10775 | var ReactDefaultBatchingStrategy = {
|
10776 | isBatchingUpdates: false,
|
10777 |
|
10778 | /**
|
10779 | * Call the provided function in a context within which calls to `setState`
|
10780 | * and friends are batched such that components aren't updated unnecessarily.
|
10781 | */
|
10782 | batchedUpdates: function (callback, a, b, c, d, e) {
|
10783 | var alreadyBatchingUpdates = ReactDefaultBatchingStrategy.isBatchingUpdates;
|
10784 |
|
10785 | ReactDefaultBatchingStrategy.isBatchingUpdates = true;
|
10786 |
|
10787 | // The code is written this way to avoid extra allocations
|
10788 | if (alreadyBatchingUpdates) {
|
10789 | callback(a, b, c, d, e);
|
10790 | } else {
|
10791 | transaction.perform(callback, null, a, b, c, d, e);
|
10792 | }
|
10793 | }
|
10794 | };
|
10795 |
|
10796 | module.exports = ReactDefaultBatchingStrategy;
|
10797 |
|
10798 | /***/ },
|
10799 | /* 94 */
|
10800 | /***/ function(module, exports, __webpack_require__) {
|
10801 |
|
10802 | /* WEBPACK VAR INJECTION */(function(process) {/**
|
10803 | * Copyright 2013-2015, Facebook, Inc.
|
10804 | * All rights reserved.
|
10805 | *
|
10806 | * This source code is licensed under the BSD-style license found in the
|
10807 | * LICENSE file in the root directory of this source tree. An additional grant
|
10808 | * of patent rights can be found in the PATENTS file in the same directory.
|
10809 | *
|
10810 | * @providesModule ReactDOMComponent
|
10811 | * @typechecks static-only
|
10812 | */
|
10813 |
|
10814 | /* global hasOwnProperty:true */
|
10815 |
|
10816 | 'use strict';
|
10817 |
|
10818 | var AutoFocusUtils = __webpack_require__(95);
|
10819 | var CSSPropertyOperations = __webpack_require__(97);
|
10820 | var DOMProperty = __webpack_require__(24);
|
10821 | var DOMPropertyOperations = __webpack_require__(23);
|
10822 | var EventConstants = __webpack_require__(31);
|
10823 | var ReactBrowserEventEmitter = __webpack_require__(30);
|
10824 | var ReactComponentBrowserEnvironment = __webpack_require__(27);
|
10825 | var ReactDOMButton = __webpack_require__(105);
|
10826 | var ReactDOMInput = __webpack_require__(106);
|
10827 | var ReactDOMOption = __webpack_require__(110);
|
10828 | var ReactDOMSelect = __webpack_require__(113);
|
10829 | var ReactDOMTextarea = __webpack_require__(114);
|
10830 | var ReactMount = __webpack_require__(29);
|
10831 | var ReactMultiChild = __webpack_require__(115);
|
10832 | var ReactPerf = __webpack_require__(19);
|
10833 | var ReactUpdateQueue = __webpack_require__(54);
|
10834 |
|
10835 | var assign = __webpack_require__(40);
|
10836 | var canDefineProperty = __webpack_require__(44);
|
10837 | var escapeTextContentForBrowser = __webpack_require__(22);
|
10838 | var invariant = __webpack_require__(14);
|
10839 | var isEventSupported = __webpack_require__(41);
|
10840 | var keyOf = __webpack_require__(80);
|
10841 | var setInnerHTML = __webpack_require__(20);
|
10842 | var setTextContent = __webpack_require__(21);
|
10843 | var shallowEqual = __webpack_require__(118);
|
10844 | var validateDOMNesting = __webpack_require__(71);
|
10845 | var warning = __webpack_require__(26);
|
10846 |
|
10847 | var deleteListener = ReactBrowserEventEmitter.deleteListener;
|
10848 | var listenTo = ReactBrowserEventEmitter.listenTo;
|
10849 | var registrationNameModules = ReactBrowserEventEmitter.registrationNameModules;
|
10850 |
|
10851 | // For quickly matching children type, to test if can be treated as content.
|
10852 | var CONTENT_TYPES = { 'string': true, 'number': true };
|
10853 |
|
10854 | var CHILDREN = keyOf({ children: null });
|
10855 | var STYLE = keyOf({ style: null });
|
10856 | var HTML = keyOf({ __html: null });
|
10857 |
|
10858 | var ELEMENT_NODE_TYPE = 1;
|
10859 |
|
10860 | function getDeclarationErrorAddendum(internalInstance) {
|
10861 | if (internalInstance) {
|
10862 | var owner = internalInstance._currentElement._owner || null;
|
10863 | if (owner) {
|
10864 | var name = owner.getName();
|
10865 | if (name) {
|
10866 | return ' This DOM node was rendered by `' + name + '`.';
|
10867 | }
|
10868 | }
|
10869 | }
|
10870 | return '';
|
10871 | }
|
10872 |
|
10873 | var legacyPropsDescriptor;
|
10874 | if (process.env.NODE_ENV !== 'production') {
|
10875 | legacyPropsDescriptor = {
|
10876 | props: {
|
10877 | enumerable: false,
|
10878 | get: function () {
|
10879 | var component = this._reactInternalComponent;
|
10880 | process.env.NODE_ENV !== 'production' ? warning(false, 'ReactDOMComponent: Do not access .props of a DOM node; instead, ' + 'recreate the props as `render` did originally or read the DOM ' + 'properties/attributes directly from this node (e.g., ' + 'this.refs.box.className).%s', getDeclarationErrorAddendum(component)) : undefined;
|
10881 | return component._currentElement.props;
|
10882 | }
|
10883 | }
|
10884 | };
|
10885 | }
|
10886 |
|
10887 | function legacyGetDOMNode() {
|
10888 | if (process.env.NODE_ENV !== 'production') {
|
10889 | var component = this._reactInternalComponent;
|
10890 | process.env.NODE_ENV !== 'production' ? warning(false, 'ReactDOMComponent: Do not access .getDOMNode() of a DOM node; ' + 'instead, use the node directly.%s', getDeclarationErrorAddendum(component)) : undefined;
|
10891 | }
|
10892 | return this;
|
10893 | }
|
10894 |
|
10895 | function legacyIsMounted() {
|
10896 | var component = this._reactInternalComponent;
|
10897 | if (process.env.NODE_ENV !== 'production') {
|
10898 | process.env.NODE_ENV !== 'production' ? warning(false, 'ReactDOMComponent: Do not access .isMounted() of a DOM node.%s', getDeclarationErrorAddendum(component)) : undefined;
|
10899 | }
|
10900 | return !!component;
|
10901 | }
|
10902 |
|
10903 | function legacySetStateEtc() {
|
10904 | if (process.env.NODE_ENV !== 'production') {
|
10905 | var component = this._reactInternalComponent;
|
10906 | process.env.NODE_ENV !== 'production' ? warning(false, 'ReactDOMComponent: Do not access .setState(), .replaceState(), or ' + '.forceUpdate() of a DOM node. This is a no-op.%s', getDeclarationErrorAddendum(component)) : undefined;
|
10907 | }
|
10908 | }
|
10909 |
|
10910 | function legacySetProps(partialProps, callback) {
|
10911 | var component = this._reactInternalComponent;
|
10912 | if (process.env.NODE_ENV !== 'production') {
|
10913 | process.env.NODE_ENV !== 'production' ? warning(false, 'ReactDOMComponent: Do not access .setProps() of a DOM node. ' + 'Instead, call ReactDOM.render again at the top level.%s', getDeclarationErrorAddendum(component)) : undefined;
|
10914 | }
|
10915 | if (!component) {
|
10916 | return;
|
10917 | }
|
10918 | ReactUpdateQueue.enqueueSetPropsInternal(component, partialProps);
|
10919 | if (callback) {
|
10920 | ReactUpdateQueue.enqueueCallbackInternal(component, callback);
|
10921 | }
|
10922 | }
|
10923 |
|
10924 | function legacyReplaceProps(partialProps, callback) {
|
10925 | var component = this._reactInternalComponent;
|
10926 | if (process.env.NODE_ENV !== 'production') {
|
10927 | process.env.NODE_ENV !== 'production' ? warning(false, 'ReactDOMComponent: Do not access .replaceProps() of a DOM node. ' + 'Instead, call ReactDOM.render again at the top level.%s', getDeclarationErrorAddendum(component)) : undefined;
|
10928 | }
|
10929 | if (!component) {
|
10930 | return;
|
10931 | }
|
10932 | ReactUpdateQueue.enqueueReplacePropsInternal(component, partialProps);
|
10933 | if (callback) {
|
10934 | ReactUpdateQueue.enqueueCallbackInternal(component, callback);
|
10935 | }
|
10936 | }
|
10937 |
|
10938 | function friendlyStringify(obj) {
|
10939 | if (typeof obj === 'object') {
|
10940 | if (Array.isArray(obj)) {
|
10941 | return '[' + obj.map(friendlyStringify).join(', ') + ']';
|
10942 | } else {
|
10943 | var pairs = [];
|
10944 | for (var key in obj) {
|
10945 | if (Object.prototype.hasOwnProperty.call(obj, key)) {
|
10946 | var keyEscaped = /^[a-z$_][\w$_]*$/i.test(key) ? key : JSON.stringify(key);
|
10947 | pairs.push(keyEscaped + ': ' + friendlyStringify(obj[key]));
|
10948 | }
|
10949 | }
|
10950 | return '{' + pairs.join(', ') + '}';
|
10951 | }
|
10952 | } else if (typeof obj === 'string') {
|
10953 | return JSON.stringify(obj);
|
10954 | } else if (typeof obj === 'function') {
|
10955 | return '[function object]';
|
10956 | }
|
10957 | // Differs from JSON.stringify in that undefined becauses undefined and that
|
10958 | // inf and nan don't become null
|
10959 | return String(obj);
|
10960 | }
|
10961 |
|
10962 | var styleMutationWarning = {};
|
10963 |
|
10964 | function checkAndWarnForMutatedStyle(style1, style2, component) {
|
10965 | if (style1 == null || style2 == null) {
|
10966 | return;
|
10967 | }
|
10968 | if (shallowEqual(style1, style2)) {
|
10969 | return;
|
10970 | }
|
10971 |
|
10972 | var componentName = component._tag;
|
10973 | var owner = component._currentElement._owner;
|
10974 | var ownerName;
|
10975 | if (owner) {
|
10976 | ownerName = owner.getName();
|
10977 | }
|
10978 |
|
10979 | var hash = ownerName + '|' + componentName;
|
10980 |
|
10981 | if (styleMutationWarning.hasOwnProperty(hash)) {
|
10982 | return;
|
10983 | }
|
10984 |
|
10985 | styleMutationWarning[hash] = true;
|
10986 |
|
10987 | process.env.NODE_ENV !== 'production' ? warning(false, '`%s` was passed a style object that has previously been mutated. ' + 'Mutating `style` is deprecated. Consider cloning it beforehand. Check ' + 'the `render` %s. Previous style: %s. Mutated style: %s.', componentName, owner ? 'of `' + ownerName + '`' : 'using <' + componentName + '>', friendlyStringify(style1), friendlyStringify(style2)) : undefined;
|
10988 | }
|
10989 |
|
10990 | /**
|
10991 | * @param {object} component
|
10992 | * @param {?object} props
|
10993 | */
|
10994 | function assertValidProps(component, props) {
|
10995 | if (!props) {
|
10996 | return;
|
10997 | }
|
10998 | // Note the use of `==` which checks for null or undefined.
|
10999 | if (process.env.NODE_ENV !== 'production') {
|
11000 | if (voidElementTags[component._tag]) {
|
11001 | process.env.NODE_ENV !== 'production' ? warning(props.children == null && props.dangerouslySetInnerHTML == null, '%s is a void element tag and must not have `children` or ' + 'use `props.dangerouslySetInnerHTML`.%s', component._tag, component._currentElement._owner ? ' Check the render method of ' + component._currentElement._owner.getName() + '.' : '') : undefined;
|
11002 | }
|
11003 | }
|
11004 | if (props.dangerouslySetInnerHTML != null) {
|
11005 | !(props.children == null) ? process.env.NODE_ENV !== 'production' ? invariant(false, 'Can only set one of `children` or `props.dangerouslySetInnerHTML`.') : invariant(false) : undefined;
|
11006 | !(typeof props.dangerouslySetInnerHTML === 'object' && HTML in props.dangerouslySetInnerHTML) ? process.env.NODE_ENV !== 'production' ? invariant(false, '`props.dangerouslySetInnerHTML` must be in the form `{__html: ...}`. ' + 'Please visit https://fb.me/react-invariant-dangerously-set-inner-html ' + 'for more information.') : invariant(false) : undefined;
|
11007 | }
|
11008 | if (process.env.NODE_ENV !== 'production') {
|
11009 | process.env.NODE_ENV !== 'production' ? warning(props.innerHTML == null, 'Directly setting property `innerHTML` is not permitted. ' + 'For more information, lookup documentation on `dangerouslySetInnerHTML`.') : undefined;
|
11010 | process.env.NODE_ENV !== 'production' ? warning(!props.contentEditable || props.children == null, 'A component is `contentEditable` and contains `children` managed by ' + 'React. It is now your responsibility to guarantee that none of ' + 'those nodes are unexpectedly modified or duplicated. This is ' + 'probably not intentional.') : undefined;
|
11011 | }
|
11012 | !(props.style == null || typeof props.style === 'object') ? process.env.NODE_ENV !== 'production' ? invariant(false, 'The `style` prop expects a mapping from style properties to values, ' + 'not a string. For example, style={{marginRight: spacing + \'em\'}} when ' + 'using JSX.%s', getDeclarationErrorAddendum(component)) : invariant(false) : undefined;
|
11013 | }
|
11014 |
|
11015 | function enqueuePutListener(id, registrationName, listener, transaction) {
|
11016 | if (process.env.NODE_ENV !== 'production') {
|
11017 | // IE8 has no API for event capturing and the `onScroll` event doesn't
|
11018 | // bubble.
|
11019 | process.env.NODE_ENV !== 'production' ? warning(registrationName !== 'onScroll' || isEventSupported('scroll', true), 'This browser doesn\'t support the `onScroll` event') : undefined;
|
11020 | }
|
11021 | var container = ReactMount.findReactContainerForID(id);
|
11022 | if (container) {
|
11023 | var doc = container.nodeType === ELEMENT_NODE_TYPE ? container.ownerDocument : container;
|
11024 | listenTo(registrationName, doc);
|
11025 | }
|
11026 | transaction.getReactMountReady().enqueue(putListener, {
|
11027 | id: id,
|
11028 | registrationName: registrationName,
|
11029 | listener: listener
|
11030 | });
|
11031 | }
|
11032 |
|
11033 | function putListener() {
|
11034 | var listenerToPut = this;
|
11035 | ReactBrowserEventEmitter.putListener(listenerToPut.id, listenerToPut.registrationName, listenerToPut.listener);
|
11036 | }
|
11037 |
|
11038 | // There are so many media events, it makes sense to just
|
11039 | // maintain a list rather than create a `trapBubbledEvent` for each
|
11040 | var mediaEvents = {
|
11041 | topAbort: 'abort',
|
11042 | topCanPlay: 'canplay',
|
11043 | topCanPlayThrough: 'canplaythrough',
|
11044 | topDurationChange: 'durationchange',
|
11045 | topEmptied: 'emptied',
|
11046 | topEncrypted: 'encrypted',
|
11047 | topEnded: 'ended',
|
11048 | topError: 'error',
|
11049 | topLoadedData: 'loadeddata',
|
11050 | topLoadedMetadata: 'loadedmetadata',
|
11051 | topLoadStart: 'loadstart',
|
11052 | topPause: 'pause',
|
11053 | topPlay: 'play',
|
11054 | topPlaying: 'playing',
|
11055 | topProgress: 'progress',
|
11056 | topRateChange: 'ratechange',
|
11057 | topSeeked: 'seeked',
|
11058 | topSeeking: 'seeking',
|
11059 | topStalled: 'stalled',
|
11060 | topSuspend: 'suspend',
|
11061 | topTimeUpdate: 'timeupdate',
|
11062 | topVolumeChange: 'volumechange',
|
11063 | topWaiting: 'waiting'
|
11064 | };
|
11065 |
|
11066 | function trapBubbledEventsLocal() {
|
11067 | var inst = this;
|
11068 | // If a component renders to null or if another component fatals and causes
|
11069 | // the state of the tree to be corrupted, `node` here can be null.
|
11070 | !inst._rootNodeID ? process.env.NODE_ENV !== 'production' ? invariant(false, 'Must be mounted to trap events') : invariant(false) : undefined;
|
11071 | var node = ReactMount.getNode(inst._rootNodeID);
|
11072 | !node ? process.env.NODE_ENV !== 'production' ? invariant(false, 'trapBubbledEvent(...): Requires node to be rendered.') : invariant(false) : undefined;
|
11073 |
|
11074 | switch (inst._tag) {
|
11075 | case 'iframe':
|
11076 | inst._wrapperState.listeners = [ReactBrowserEventEmitter.trapBubbledEvent(EventConstants.topLevelTypes.topLoad, 'load', node)];
|
11077 | break;
|
11078 | case 'video':
|
11079 | case 'audio':
|
11080 |
|
11081 | inst._wrapperState.listeners = [];
|
11082 | // create listener for each media event
|
11083 | for (var event in mediaEvents) {
|
11084 | if (mediaEvents.hasOwnProperty(event)) {
|
11085 | inst._wrapperState.listeners.push(ReactBrowserEventEmitter.trapBubbledEvent(EventConstants.topLevelTypes[event], mediaEvents[event], node));
|
11086 | }
|
11087 | }
|
11088 |
|
11089 | break;
|
11090 | case 'img':
|
11091 | inst._wrapperState.listeners = [ReactBrowserEventEmitter.trapBubbledEvent(EventConstants.topLevelTypes.topError, 'error', node), ReactBrowserEventEmitter.trapBubbledEvent(EventConstants.topLevelTypes.topLoad, 'load', node)];
|
11092 | break;
|
11093 | case 'form':
|
11094 | inst._wrapperState.listeners = [ReactBrowserEventEmitter.trapBubbledEvent(EventConstants.topLevelTypes.topReset, 'reset', node), ReactBrowserEventEmitter.trapBubbledEvent(EventConstants.topLevelTypes.topSubmit, 'submit', node)];
|
11095 | break;
|
11096 | }
|
11097 | }
|
11098 |
|
11099 | function mountReadyInputWrapper() {
|
11100 | ReactDOMInput.mountReadyWrapper(this);
|
11101 | }
|
11102 |
|
11103 | function postUpdateSelectWrapper() {
|
11104 | ReactDOMSelect.postUpdateWrapper(this);
|
11105 | }
|
11106 |
|
11107 | // For HTML, certain tags should omit their close tag. We keep a whitelist for
|
11108 | // those special cased tags.
|
11109 |
|
11110 | var omittedCloseTags = {
|
11111 | 'area': true,
|
11112 | 'base': true,
|
11113 | 'br': true,
|
11114 | 'col': true,
|
11115 | 'embed': true,
|
11116 | 'hr': true,
|
11117 | 'img': true,
|
11118 | 'input': true,
|
11119 | 'keygen': true,
|
11120 | 'link': true,
|
11121 | 'meta': true,
|
11122 | 'param': true,
|
11123 | 'source': true,
|
11124 | 'track': true,
|
11125 | 'wbr': true
|
11126 | };
|
11127 |
|
11128 | // NOTE: menuitem's close tag should be omitted, but that causes problems.
|
11129 | var newlineEatingTags = {
|
11130 | 'listing': true,
|
11131 | 'pre': true,
|
11132 | 'textarea': true
|
11133 | };
|
11134 |
|
11135 | // For HTML, certain tags cannot have children. This has the same purpose as
|
11136 | // `omittedCloseTags` except that `menuitem` should still have its closing tag.
|
11137 |
|
11138 | var voidElementTags = assign({
|
11139 | 'menuitem': true
|
11140 | }, omittedCloseTags);
|
11141 |
|
11142 | // We accept any tag to be rendered but since this gets injected into arbitrary
|
11143 | // HTML, we want to make sure that it's a safe tag.
|
11144 | // http://www.w3.org/TR/REC-xml/#NT-Name
|
11145 |
|
11146 | var VALID_TAG_REGEX = /^[a-zA-Z][a-zA-Z:_\.\-\d]*$/; // Simplified subset
|
11147 | var validatedTagCache = {};
|
11148 | var hasOwnProperty = ({}).hasOwnProperty;
|
11149 |
|
11150 | function validateDangerousTag(tag) {
|
11151 | if (!hasOwnProperty.call(validatedTagCache, tag)) {
|
11152 | !VALID_TAG_REGEX.test(tag) ? process.env.NODE_ENV !== 'production' ? invariant(false, 'Invalid tag: %s', tag) : invariant(false) : undefined;
|
11153 | validatedTagCache[tag] = true;
|
11154 | }
|
11155 | }
|
11156 |
|
11157 | function processChildContextDev(context, inst) {
|
11158 | // Pass down our tag name to child components for validation purposes
|
11159 | context = assign({}, context);
|
11160 | var info = context[validateDOMNesting.ancestorInfoContextKey];
|
11161 | context[validateDOMNesting.ancestorInfoContextKey] = validateDOMNesting.updatedAncestorInfo(info, inst._tag, inst);
|
11162 | return context;
|
11163 | }
|
11164 |
|
11165 | function isCustomComponent(tagName, props) {
|
11166 | return tagName.indexOf('-') >= 0 || props.is != null;
|
11167 | }
|
11168 |
|
11169 | /**
|
11170 | * Creates a new React class that is idempotent and capable of containing other
|
11171 | * React components. It accepts event listeners and DOM properties that are
|
11172 | * valid according to `DOMProperty`.
|
11173 | *
|
11174 | * - Event listeners: `onClick`, `onMouseDown`, etc.
|
11175 | * - DOM properties: `className`, `name`, `title`, etc.
|
11176 | *
|
11177 | * The `style` property functions differently from the DOM API. It accepts an
|
11178 | * object mapping of style properties to values.
|
11179 | *
|
11180 | * @constructor ReactDOMComponent
|
11181 | * @extends ReactMultiChild
|
11182 | */
|
11183 | function ReactDOMComponent(tag) {
|
11184 | validateDangerousTag(tag);
|
11185 | this._tag = tag.toLowerCase();
|
11186 | this._renderedChildren = null;
|
11187 | this._previousStyle = null;
|
11188 | this._previousStyleCopy = null;
|
11189 | this._rootNodeID = null;
|
11190 | this._wrapperState = null;
|
11191 | this._topLevelWrapper = null;
|
11192 | this._nodeWithLegacyProperties = null;
|
11193 | if (process.env.NODE_ENV !== 'production') {
|
11194 | this._unprocessedContextDev = null;
|
11195 | this._processedContextDev = null;
|
11196 | }
|
11197 | }
|
11198 |
|
11199 | ReactDOMComponent.displayName = 'ReactDOMComponent';
|
11200 |
|
11201 | ReactDOMComponent.Mixin = {
|
11202 |
|
11203 | construct: function (element) {
|
11204 | this._currentElement = element;
|
11205 | },
|
11206 |
|
11207 | /**
|
11208 | * Generates root tag markup then recurses. This method has side effects and
|
11209 | * is not idempotent.
|
11210 | *
|
11211 | * @internal
|
11212 | * @param {string} rootID The root DOM ID for this node.
|
11213 | * @param {ReactReconcileTransaction|ReactServerRenderingTransaction} transaction
|
11214 | * @param {object} context
|
11215 | * @return {string} The computed markup.
|
11216 | */
|
11217 | mountComponent: function (rootID, transaction, context) {
|
11218 | this._rootNodeID = rootID;
|
11219 |
|
11220 | var props = this._currentElement.props;
|
11221 |
|
11222 | switch (this._tag) {
|
11223 | case 'iframe':
|
11224 | case 'img':
|
11225 | case 'form':
|
11226 | case 'video':
|
11227 | case 'audio':
|
11228 | this._wrapperState = {
|
11229 | listeners: null
|
11230 | };
|
11231 | transaction.getReactMountReady().enqueue(trapBubbledEventsLocal, this);
|
11232 | break;
|
11233 | case 'button':
|
11234 | props = ReactDOMButton.getNativeProps(this, props, context);
|
11235 | break;
|
11236 | case 'input':
|
11237 | ReactDOMInput.mountWrapper(this, props, context);
|
11238 | props = ReactDOMInput.getNativeProps(this, props, context);
|
11239 | break;
|
11240 | case 'option':
|
11241 | ReactDOMOption.mountWrapper(this, props, context);
|
11242 | props = ReactDOMOption.getNativeProps(this, props, context);
|
11243 | break;
|
11244 | case 'select':
|
11245 | ReactDOMSelect.mountWrapper(this, props, context);
|
11246 | props = ReactDOMSelect.getNativeProps(this, props, context);
|
11247 | context = ReactDOMSelect.processChildContext(this, props, context);
|
11248 | break;
|
11249 | case 'textarea':
|
11250 | ReactDOMTextarea.mountWrapper(this, props, context);
|
11251 | props = ReactDOMTextarea.getNativeProps(this, props, context);
|
11252 | break;
|
11253 | }
|
11254 |
|
11255 | assertValidProps(this, props);
|
11256 | if (process.env.NODE_ENV !== 'production') {
|
11257 | if (context[validateDOMNesting.ancestorInfoContextKey]) {
|
11258 | validateDOMNesting(this._tag, this, context[validateDOMNesting.ancestorInfoContextKey]);
|
11259 | }
|
11260 | }
|
11261 |
|
11262 | if (process.env.NODE_ENV !== 'production') {
|
11263 | this._unprocessedContextDev = context;
|
11264 | this._processedContextDev = processChildContextDev(context, this);
|
11265 | context = this._processedContextDev;
|
11266 | }
|
11267 |
|
11268 | var mountImage;
|
11269 | if (transaction.useCreateElement) {
|
11270 | var ownerDocument = context[ReactMount.ownerDocumentContextKey];
|
11271 | var el = ownerDocument.createElement(this._currentElement.type);
|
11272 | DOMPropertyOperations.setAttributeForID(el, this._rootNodeID);
|
11273 | // Populate node cache
|
11274 | ReactMount.getID(el);
|
11275 | this._updateDOMProperties({}, props, transaction, el);
|
11276 | this._createInitialChildren(transaction, props, context, el);
|
11277 | mountImage = el;
|
11278 | } else {
|
11279 | var tagOpen = this._createOpenTagMarkupAndPutListeners(transaction, props);
|
11280 | var tagContent = this._createContentMarkup(transaction, props, context);
|
11281 | if (!tagContent && omittedCloseTags[this._tag]) {
|
11282 | mountImage = tagOpen + '/>';
|
11283 | } else {
|
11284 | mountImage = tagOpen + '>' + tagContent + '</' + this._currentElement.type + '>';
|
11285 | }
|
11286 | }
|
11287 |
|
11288 | switch (this._tag) {
|
11289 | case 'input':
|
11290 | transaction.getReactMountReady().enqueue(mountReadyInputWrapper, this);
|
11291 | // falls through
|
11292 | case 'button':
|
11293 | case 'select':
|
11294 | case 'textarea':
|
11295 | if (props.autoFocus) {
|
11296 | transaction.getReactMountReady().enqueue(AutoFocusUtils.focusDOMComponent, this);
|
11297 | }
|
11298 | break;
|
11299 | }
|
11300 |
|
11301 | return mountImage;
|
11302 | },
|
11303 |
|
11304 | /**
|
11305 | * Creates markup for the open tag and all attributes.
|
11306 | *
|
11307 | * This method has side effects because events get registered.
|
11308 | *
|
11309 | * Iterating over object properties is faster than iterating over arrays.
|
11310 | * @see http://jsperf.com/obj-vs-arr-iteration
|
11311 | *
|
11312 | * @private
|
11313 | * @param {ReactReconcileTransaction|ReactServerRenderingTransaction} transaction
|
11314 | * @param {object} props
|
11315 | * @return {string} Markup of opening tag.
|
11316 | */
|
11317 | _createOpenTagMarkupAndPutListeners: function (transaction, props) {
|
11318 | var ret = '<' + this._currentElement.type;
|
11319 |
|
11320 | for (var propKey in props) {
|
11321 | if (!props.hasOwnProperty(propKey)) {
|
11322 | continue;
|
11323 | }
|
11324 | var propValue = props[propKey];
|
11325 | if (propValue == null) {
|
11326 | continue;
|
11327 | }
|
11328 | if (registrationNameModules.hasOwnProperty(propKey)) {
|
11329 | if (propValue) {
|
11330 | enqueuePutListener(this._rootNodeID, propKey, propValue, transaction);
|
11331 | }
|
11332 | } else {
|
11333 | if (propKey === STYLE) {
|
11334 | if (propValue) {
|
11335 | if (process.env.NODE_ENV !== 'production') {
|
11336 | // See `_updateDOMProperties`. style block
|
11337 | this._previousStyle = propValue;
|
11338 | }
|
11339 | propValue = this._previousStyleCopy = assign({}, props.style);
|
11340 | }
|
11341 | propValue = CSSPropertyOperations.createMarkupForStyles(propValue);
|
11342 | }
|
11343 | var markup = null;
|
11344 | if (this._tag != null && isCustomComponent(this._tag, props)) {
|
11345 | if (propKey !== CHILDREN) {
|
11346 | markup = DOMPropertyOperations.createMarkupForCustomAttribute(propKey, propValue);
|
11347 | }
|
11348 | } else {
|
11349 | markup = DOMPropertyOperations.createMarkupForProperty(propKey, propValue);
|
11350 | }
|
11351 | if (markup) {
|
11352 | ret += ' ' + markup;
|
11353 | }
|
11354 | }
|
11355 | }
|
11356 |
|
11357 | // For static pages, no need to put React ID and checksum. Saves lots of
|
11358 | // bytes.
|
11359 | if (transaction.renderToStaticMarkup) {
|
11360 | return ret;
|
11361 | }
|
11362 |
|
11363 | var markupForID = DOMPropertyOperations.createMarkupForID(this._rootNodeID);
|
11364 | return ret + ' ' + markupForID;
|
11365 | },
|
11366 |
|
11367 | /**
|
11368 | * Creates markup for the content between the tags.
|
11369 | *
|
11370 | * @private
|
11371 | * @param {ReactReconcileTransaction|ReactServerRenderingTransaction} transaction
|
11372 | * @param {object} props
|
11373 | * @param {object} context
|
11374 | * @return {string} Content markup.
|
11375 | */
|
11376 | _createContentMarkup: function (transaction, props, context) {
|
11377 | var ret = '';
|
11378 |
|
11379 | // Intentional use of != to avoid catching zero/false.
|
11380 | var innerHTML = props.dangerouslySetInnerHTML;
|
11381 | if (innerHTML != null) {
|
11382 | if (innerHTML.__html != null) {
|
11383 | ret = innerHTML.__html;
|
11384 | }
|
11385 | } else {
|
11386 | var contentToUse = CONTENT_TYPES[typeof props.children] ? props.children : null;
|
11387 | var childrenToUse = contentToUse != null ? null : props.children;
|
11388 | if (contentToUse != null) {
|
11389 | // TODO: Validate that text is allowed as a child of this node
|
11390 | ret = escapeTextContentForBrowser(contentToUse);
|
11391 | } else if (childrenToUse != null) {
|
11392 | var mountImages = this.mountChildren(childrenToUse, transaction, context);
|
11393 | ret = mountImages.join('');
|
11394 | }
|
11395 | }
|
11396 | if (newlineEatingTags[this._tag] && ret.charAt(0) === '\n') {
|
11397 | // text/html ignores the first character in these tags if it's a newline
|
11398 | // Prefer to break application/xml over text/html (for now) by adding
|
11399 | // a newline specifically to get eaten by the parser. (Alternately for
|
11400 | // textareas, replacing "^\n" with "\r\n" doesn't get eaten, and the first
|
11401 | // \r is normalized out by HTMLTextAreaElement#value.)
|
11402 | // See: <http://www.w3.org/TR/html-polyglot/#newlines-in-textarea-and-pre>
|
11403 | // See: <http://www.w3.org/TR/html5/syntax.html#element-restrictions>
|
11404 | // See: <http://www.w3.org/TR/html5/syntax.html#newlines>
|
11405 | // See: Parsing of "textarea" "listing" and "pre" elements
|
11406 | // from <http://www.w3.org/TR/html5/syntax.html#parsing-main-inbody>
|
11407 | return '\n' + ret;
|
11408 | } else {
|
11409 | return ret;
|
11410 | }
|
11411 | },
|
11412 |
|
11413 | _createInitialChildren: function (transaction, props, context, el) {
|
11414 | // Intentional use of != to avoid catching zero/false.
|
11415 | var innerHTML = props.dangerouslySetInnerHTML;
|
11416 | if (innerHTML != null) {
|
11417 | if (innerHTML.__html != null) {
|
11418 | setInnerHTML(el, innerHTML.__html);
|
11419 | }
|
11420 | } else {
|
11421 | var contentToUse = CONTENT_TYPES[typeof props.children] ? props.children : null;
|
11422 | var childrenToUse = contentToUse != null ? null : props.children;
|
11423 | if (contentToUse != null) {
|
11424 | // TODO: Validate that text is allowed as a child of this node
|
11425 | setTextContent(el, contentToUse);
|
11426 | } else if (childrenToUse != null) {
|
11427 | var mountImages = this.mountChildren(childrenToUse, transaction, context);
|
11428 | for (var i = 0; i < mountImages.length; i++) {
|
11429 | el.appendChild(mountImages[i]);
|
11430 | }
|
11431 | }
|
11432 | }
|
11433 | },
|
11434 |
|
11435 | /**
|
11436 | * Receives a next element and updates the component.
|
11437 | *
|
11438 | * @internal
|
11439 | * @param {ReactElement} nextElement
|
11440 | * @param {ReactReconcileTransaction|ReactServerRenderingTransaction} transaction
|
11441 | * @param {object} context
|
11442 | */
|
11443 | receiveComponent: function (nextElement, transaction, context) {
|
11444 | var prevElement = this._currentElement;
|
11445 | this._currentElement = nextElement;
|
11446 | this.updateComponent(transaction, prevElement, nextElement, context);
|
11447 | },
|
11448 |
|
11449 | /**
|
11450 | * Updates a native DOM component after it has already been allocated and
|
11451 | * attached to the DOM. Reconciles the root DOM node, then recurses.
|
11452 | *
|
11453 | * @param {ReactReconcileTransaction} transaction
|
11454 | * @param {ReactElement} prevElement
|
11455 | * @param {ReactElement} nextElement
|
11456 | * @internal
|
11457 | * @overridable
|
11458 | */
|
11459 | updateComponent: function (transaction, prevElement, nextElement, context) {
|
11460 | var lastProps = prevElement.props;
|
11461 | var nextProps = this._currentElement.props;
|
11462 |
|
11463 | switch (this._tag) {
|
11464 | case 'button':
|
11465 | lastProps = ReactDOMButton.getNativeProps(this, lastProps);
|
11466 | nextProps = ReactDOMButton.getNativeProps(this, nextProps);
|
11467 | break;
|
11468 | case 'input':
|
11469 | ReactDOMInput.updateWrapper(this);
|
11470 | lastProps = ReactDOMInput.getNativeProps(this, lastProps);
|
11471 | nextProps = ReactDOMInput.getNativeProps(this, nextProps);
|
11472 | break;
|
11473 | case 'option':
|
11474 | lastProps = ReactDOMOption.getNativeProps(this, lastProps);
|
11475 | nextProps = ReactDOMOption.getNativeProps(this, nextProps);
|
11476 | break;
|
11477 | case 'select':
|
11478 | lastProps = ReactDOMSelect.getNativeProps(this, lastProps);
|
11479 | nextProps = ReactDOMSelect.getNativeProps(this, nextProps);
|
11480 | break;
|
11481 | case 'textarea':
|
11482 | ReactDOMTextarea.updateWrapper(this);
|
11483 | lastProps = ReactDOMTextarea.getNativeProps(this, lastProps);
|
11484 | nextProps = ReactDOMTextarea.getNativeProps(this, nextProps);
|
11485 | break;
|
11486 | }
|
11487 |
|
11488 | if (process.env.NODE_ENV !== 'production') {
|
11489 | // If the context is reference-equal to the old one, pass down the same
|
11490 | // processed object so the update bailout in ReactReconciler behaves
|
11491 | // correctly (and identically in dev and prod). See #5005.
|
11492 | if (this._unprocessedContextDev !== context) {
|
11493 | this._unprocessedContextDev = context;
|
11494 | this._processedContextDev = processChildContextDev(context, this);
|
11495 | }
|
11496 | context = this._processedContextDev;
|
11497 | }
|
11498 |
|
11499 | assertValidProps(this, nextProps);
|
11500 | this._updateDOMProperties(lastProps, nextProps, transaction, null);
|
11501 | this._updateDOMChildren(lastProps, nextProps, transaction, context);
|
11502 |
|
11503 | if (!canDefineProperty && this._nodeWithLegacyProperties) {
|
11504 | this._nodeWithLegacyProperties.props = nextProps;
|
11505 | }
|
11506 |
|
11507 | if (this._tag === 'select') {
|
11508 | // <select> value update needs to occur after <option> children
|
11509 | // reconciliation
|
11510 | transaction.getReactMountReady().enqueue(postUpdateSelectWrapper, this);
|
11511 | }
|
11512 | },
|
11513 |
|
11514 | /**
|
11515 | * Reconciles the properties by detecting differences in property values and
|
11516 | * updating the DOM as necessary. This function is probably the single most
|
11517 | * critical path for performance optimization.
|
11518 | *
|
11519 | * TODO: Benchmark whether checking for changed values in memory actually
|
11520 | * improves performance (especially statically positioned elements).
|
11521 | * TODO: Benchmark the effects of putting this at the top since 99% of props
|
11522 | * do not change for a given reconciliation.
|
11523 | * TODO: Benchmark areas that can be improved with caching.
|
11524 | *
|
11525 | * @private
|
11526 | * @param {object} lastProps
|
11527 | * @param {object} nextProps
|
11528 | * @param {ReactReconcileTransaction} transaction
|
11529 | * @param {?DOMElement} node
|
11530 | */
|
11531 | _updateDOMProperties: function (lastProps, nextProps, transaction, node) {
|
11532 | var propKey;
|
11533 | var styleName;
|
11534 | var styleUpdates;
|
11535 | for (propKey in lastProps) {
|
11536 | if (nextProps.hasOwnProperty(propKey) || !lastProps.hasOwnProperty(propKey)) {
|
11537 | continue;
|
11538 | }
|
11539 | if (propKey === STYLE) {
|
11540 | var lastStyle = this._previousStyleCopy;
|
11541 | for (styleName in lastStyle) {
|
11542 | if (lastStyle.hasOwnProperty(styleName)) {
|
11543 | styleUpdates = styleUpdates || {};
|
11544 | styleUpdates[styleName] = '';
|
11545 | }
|
11546 | }
|
11547 | this._previousStyleCopy = null;
|
11548 | } else if (registrationNameModules.hasOwnProperty(propKey)) {
|
11549 | if (lastProps[propKey]) {
|
11550 | // Only call deleteListener if there was a listener previously or
|
11551 | // else willDeleteListener gets called when there wasn't actually a
|
11552 | // listener (e.g., onClick={null})
|
11553 | deleteListener(this._rootNodeID, propKey);
|
11554 | }
|
11555 | } else if (DOMProperty.properties[propKey] || DOMProperty.isCustomAttribute(propKey)) {
|
11556 | if (!node) {
|
11557 | node = ReactMount.getNode(this._rootNodeID);
|
11558 | }
|
11559 | DOMPropertyOperations.deleteValueForProperty(node, propKey);
|
11560 | }
|
11561 | }
|
11562 | for (propKey in nextProps) {
|
11563 | var nextProp = nextProps[propKey];
|
11564 | var lastProp = propKey === STYLE ? this._previousStyleCopy : lastProps[propKey];
|
11565 | if (!nextProps.hasOwnProperty(propKey) || nextProp === lastProp) {
|
11566 | continue;
|
11567 | }
|
11568 | if (propKey === STYLE) {
|
11569 | if (nextProp) {
|
11570 | if (process.env.NODE_ENV !== 'production') {
|
11571 | checkAndWarnForMutatedStyle(this._previousStyleCopy, this._previousStyle, this);
|
11572 | this._previousStyle = nextProp;
|
11573 | }
|
11574 | nextProp = this._previousStyleCopy = assign({}, nextProp);
|
11575 | } else {
|
11576 | this._previousStyleCopy = null;
|
11577 | }
|
11578 | if (lastProp) {
|
11579 | // Unset styles on `lastProp` but not on `nextProp`.
|
11580 | for (styleName in lastProp) {
|
11581 | if (lastProp.hasOwnProperty(styleName) && (!nextProp || !nextProp.hasOwnProperty(styleName))) {
|
11582 | styleUpdates = styleUpdates || {};
|
11583 | styleUpdates[styleName] = '';
|
11584 | }
|
11585 | }
|
11586 | // Update styles that changed since `lastProp`.
|
11587 | for (styleName in nextProp) {
|
11588 | if (nextProp.hasOwnProperty(styleName) && lastProp[styleName] !== nextProp[styleName]) {
|
11589 | styleUpdates = styleUpdates || {};
|
11590 | styleUpdates[styleName] = nextProp[styleName];
|
11591 | }
|
11592 | }
|
11593 | } else {
|
11594 | // Relies on `updateStylesByID` not mutating `styleUpdates`.
|
11595 | styleUpdates = nextProp;
|
11596 | }
|
11597 | } else if (registrationNameModules.hasOwnProperty(propKey)) {
|
11598 | if (nextProp) {
|
11599 | enqueuePutListener(this._rootNodeID, propKey, nextProp, transaction);
|
11600 | } else if (lastProp) {
|
11601 | deleteListener(this._rootNodeID, propKey);
|
11602 | }
|
11603 | } else if (isCustomComponent(this._tag, nextProps)) {
|
11604 | if (!node) {
|
11605 | node = ReactMount.getNode(this._rootNodeID);
|
11606 | }
|
11607 | if (propKey === CHILDREN) {
|
11608 | nextProp = null;
|
11609 | }
|
11610 | DOMPropertyOperations.setValueForAttribute(node, propKey, nextProp);
|
11611 | } else if (DOMProperty.properties[propKey] || DOMProperty.isCustomAttribute(propKey)) {
|
11612 | if (!node) {
|
11613 | node = ReactMount.getNode(this._rootNodeID);
|
11614 | }
|
11615 | // If we're updating to null or undefined, we should remove the property
|
11616 | // from the DOM node instead of inadvertantly setting to a string. This
|
11617 | // brings us in line with the same behavior we have on initial render.
|
11618 | if (nextProp != null) {
|
11619 | DOMPropertyOperations.setValueForProperty(node, propKey, nextProp);
|
11620 | } else {
|
11621 | DOMPropertyOperations.deleteValueForProperty(node, propKey);
|
11622 | }
|
11623 | }
|
11624 | }
|
11625 | if (styleUpdates) {
|
11626 | if (!node) {
|
11627 | node = ReactMount.getNode(this._rootNodeID);
|
11628 | }
|
11629 | CSSPropertyOperations.setValueForStyles(node, styleUpdates);
|
11630 | }
|
11631 | },
|
11632 |
|
11633 | /**
|
11634 | * Reconciles the children with the various properties that affect the
|
11635 | * children content.
|
11636 | *
|
11637 | * @param {object} lastProps
|
11638 | * @param {object} nextProps
|
11639 | * @param {ReactReconcileTransaction} transaction
|
11640 | * @param {object} context
|
11641 | */
|
11642 | _updateDOMChildren: function (lastProps, nextProps, transaction, context) {
|
11643 | var lastContent = CONTENT_TYPES[typeof lastProps.children] ? lastProps.children : null;
|
11644 | var nextContent = CONTENT_TYPES[typeof nextProps.children] ? nextProps.children : null;
|
11645 |
|
11646 | var lastHtml = lastProps.dangerouslySetInnerHTML && lastProps.dangerouslySetInnerHTML.__html;
|
11647 | var nextHtml = nextProps.dangerouslySetInnerHTML && nextProps.dangerouslySetInnerHTML.__html;
|
11648 |
|
11649 | // Note the use of `!=` which checks for null or undefined.
|
11650 | var lastChildren = lastContent != null ? null : lastProps.children;
|
11651 | var nextChildren = nextContent != null ? null : nextProps.children;
|
11652 |
|
11653 | // If we're switching from children to content/html or vice versa, remove
|
11654 | // the old content
|
11655 | var lastHasContentOrHtml = lastContent != null || lastHtml != null;
|
11656 | var nextHasContentOrHtml = nextContent != null || nextHtml != null;
|
11657 | if (lastChildren != null && nextChildren == null) {
|
11658 | this.updateChildren(null, transaction, context);
|
11659 | } else if (lastHasContentOrHtml && !nextHasContentOrHtml) {
|
11660 | this.updateTextContent('');
|
11661 | }
|
11662 |
|
11663 | if (nextContent != null) {
|
11664 | if (lastContent !== nextContent) {
|
11665 | this.updateTextContent('' + nextContent);
|
11666 | }
|
11667 | } else if (nextHtml != null) {
|
11668 | if (lastHtml !== nextHtml) {
|
11669 | this.updateMarkup('' + nextHtml);
|
11670 | }
|
11671 | } else if (nextChildren != null) {
|
11672 | this.updateChildren(nextChildren, transaction, context);
|
11673 | }
|
11674 | },
|
11675 |
|
11676 | /**
|
11677 | * Destroys all event registrations for this instance. Does not remove from
|
11678 | * the DOM. That must be done by the parent.
|
11679 | *
|
11680 | * @internal
|
11681 | */
|
11682 | unmountComponent: function () {
|
11683 | switch (this._tag) {
|
11684 | case 'iframe':
|
11685 | case 'img':
|
11686 | case 'form':
|
11687 | case 'video':
|
11688 | case 'audio':
|
11689 | var listeners = this._wrapperState.listeners;
|
11690 | if (listeners) {
|
11691 | for (var i = 0; i < listeners.length; i++) {
|
11692 | listeners[i].remove();
|
11693 | }
|
11694 | }
|
11695 | break;
|
11696 | case 'input':
|
11697 | ReactDOMInput.unmountWrapper(this);
|
11698 | break;
|
11699 | case 'html':
|
11700 | case 'head':
|
11701 | case 'body':
|
11702 | /**
|
11703 | * Components like <html> <head> and <body> can't be removed or added
|
11704 | * easily in a cross-browser way, however it's valuable to be able to
|
11705 | * take advantage of React's reconciliation for styling and <title>
|
11706 | * management. So we just document it and throw in dangerous cases.
|
11707 | */
|
11708 | true ? process.env.NODE_ENV !== 'production' ? invariant(false, '<%s> tried to unmount. Because of cross-browser quirks it is ' + 'impossible to unmount some top-level components (eg <html>, ' + '<head>, and <body>) reliably and efficiently. To fix this, have a ' + 'single top-level component that never unmounts render these ' + 'elements.', this._tag) : invariant(false) : undefined;
|
11709 | break;
|
11710 | }
|
11711 |
|
11712 | this.unmountChildren();
|
11713 | ReactBrowserEventEmitter.deleteAllListeners(this._rootNodeID);
|
11714 | ReactComponentBrowserEnvironment.unmountIDFromEnvironment(this._rootNodeID);
|
11715 | this._rootNodeID = null;
|
11716 | this._wrapperState = null;
|
11717 | if (this._nodeWithLegacyProperties) {
|
11718 | var node = this._nodeWithLegacyProperties;
|
11719 | node._reactInternalComponent = null;
|
11720 | this._nodeWithLegacyProperties = null;
|
11721 | }
|
11722 | },
|
11723 |
|
11724 | getPublicInstance: function () {
|
11725 | if (!this._nodeWithLegacyProperties) {
|
11726 | var node = ReactMount.getNode(this._rootNodeID);
|
11727 |
|
11728 | node._reactInternalComponent = this;
|
11729 | node.getDOMNode = legacyGetDOMNode;
|
11730 | node.isMounted = legacyIsMounted;
|
11731 | node.setState = legacySetStateEtc;
|
11732 | node.replaceState = legacySetStateEtc;
|
11733 | node.forceUpdate = legacySetStateEtc;
|
11734 | node.setProps = legacySetProps;
|
11735 | node.replaceProps = legacyReplaceProps;
|
11736 |
|
11737 | if (process.env.NODE_ENV !== 'production') {
|
11738 | if (canDefineProperty) {
|
11739 | Object.defineProperties(node, legacyPropsDescriptor);
|
11740 | } else {
|
11741 | // updateComponent will update this property on subsequent renders
|
11742 | node.props = this._currentElement.props;
|
11743 | }
|
11744 | } else {
|
11745 | // updateComponent will update this property on subsequent renders
|
11746 | node.props = this._currentElement.props;
|
11747 | }
|
11748 |
|
11749 | this._nodeWithLegacyProperties = node;
|
11750 | }
|
11751 | return this._nodeWithLegacyProperties;
|
11752 | }
|
11753 |
|
11754 | };
|
11755 |
|
11756 | ReactPerf.measureMethods(ReactDOMComponent, 'ReactDOMComponent', {
|
11757 | mountComponent: 'mountComponent',
|
11758 | updateComponent: 'updateComponent'
|
11759 | });
|
11760 |
|
11761 | assign(ReactDOMComponent.prototype, ReactDOMComponent.Mixin, ReactMultiChild.Mixin);
|
11762 |
|
11763 | module.exports = ReactDOMComponent;
|
11764 | /* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(5)))
|
11765 |
|
11766 | /***/ },
|
11767 | /* 95 */
|
11768 | /***/ function(module, exports, __webpack_require__) {
|
11769 |
|
11770 | /**
|
11771 | * Copyright 2013-2015, Facebook, Inc.
|
11772 | * All rights reserved.
|
11773 | *
|
11774 | * This source code is licensed under the BSD-style license found in the
|
11775 | * LICENSE file in the root directory of this source tree. An additional grant
|
11776 | * of patent rights can be found in the PATENTS file in the same directory.
|
11777 | *
|
11778 | * @providesModule AutoFocusUtils
|
11779 | * @typechecks static-only
|
11780 | */
|
11781 |
|
11782 | 'use strict';
|
11783 |
|
11784 | var ReactMount = __webpack_require__(29);
|
11785 |
|
11786 | var findDOMNode = __webpack_require__(92);
|
11787 | var focusNode = __webpack_require__(96);
|
11788 |
|
11789 | var Mixin = {
|
11790 | componentDidMount: function () {
|
11791 | if (this.props.autoFocus) {
|
11792 | focusNode(findDOMNode(this));
|
11793 | }
|
11794 | }
|
11795 | };
|
11796 |
|
11797 | var AutoFocusUtils = {
|
11798 | Mixin: Mixin,
|
11799 |
|
11800 | focusDOMComponent: function () {
|
11801 | focusNode(ReactMount.getNode(this._rootNodeID));
|
11802 | }
|
11803 | };
|
11804 |
|
11805 | module.exports = AutoFocusUtils;
|
11806 |
|
11807 | /***/ },
|
11808 | /* 96 */
|
11809 | /***/ function(module, exports) {
|
11810 |
|
11811 | /**
|
11812 | * Copyright 2013-2015, Facebook, Inc.
|
11813 | * All rights reserved.
|
11814 | *
|
11815 | * This source code is licensed under the BSD-style license found in the
|
11816 | * LICENSE file in the root directory of this source tree. An additional grant
|
11817 | * of patent rights can be found in the PATENTS file in the same directory.
|
11818 | *
|
11819 | * @providesModule focusNode
|
11820 | */
|
11821 |
|
11822 | 'use strict';
|
11823 |
|
11824 | /**
|
11825 | * @param {DOMElement} node input/textarea to focus
|
11826 | */
|
11827 | function focusNode(node) {
|
11828 | // IE8 can throw "Can't move focus to the control because it is invisible,
|
11829 | // not enabled, or of a type that does not accept the focus." for all kinds of
|
11830 | // reasons that are too expensive and fragile to test.
|
11831 | try {
|
11832 | node.focus();
|
11833 | } catch (e) {}
|
11834 | }
|
11835 |
|
11836 | module.exports = focusNode;
|
11837 |
|
11838 | /***/ },
|
11839 | /* 97 */
|
11840 | /***/ function(module, exports, __webpack_require__) {
|
11841 |
|
11842 | /* WEBPACK VAR INJECTION */(function(process) {/**
|
11843 | * Copyright 2013-2015, Facebook, Inc.
|
11844 | * All rights reserved.
|
11845 | *
|
11846 | * This source code is licensed under the BSD-style license found in the
|
11847 | * LICENSE file in the root directory of this source tree. An additional grant
|
11848 | * of patent rights can be found in the PATENTS file in the same directory.
|
11849 | *
|
11850 | * @providesModule CSSPropertyOperations
|
11851 | * @typechecks static-only
|
11852 | */
|
11853 |
|
11854 | 'use strict';
|
11855 |
|
11856 | var CSSProperty = __webpack_require__(98);
|
11857 | var ExecutionEnvironment = __webpack_require__(10);
|
11858 | var ReactPerf = __webpack_require__(19);
|
11859 |
|
11860 | var camelizeStyleName = __webpack_require__(99);
|
11861 | var dangerousStyleValue = __webpack_require__(101);
|
11862 | var hyphenateStyleName = __webpack_require__(102);
|
11863 | var memoizeStringOnly = __webpack_require__(104);
|
11864 | var warning = __webpack_require__(26);
|
11865 |
|
11866 | var processStyleName = memoizeStringOnly(function (styleName) {
|
11867 | return hyphenateStyleName(styleName);
|
11868 | });
|
11869 |
|
11870 | var hasShorthandPropertyBug = false;
|
11871 | var styleFloatAccessor = 'cssFloat';
|
11872 | if (ExecutionEnvironment.canUseDOM) {
|
11873 | var tempStyle = document.createElement('div').style;
|
11874 | try {
|
11875 | // IE8 throws "Invalid argument." if resetting shorthand style properties.
|
11876 | tempStyle.font = '';
|
11877 | } catch (e) {
|
11878 | hasShorthandPropertyBug = true;
|
11879 | }
|
11880 | // IE8 only supports accessing cssFloat (standard) as styleFloat
|
11881 | if (document.documentElement.style.cssFloat === undefined) {
|
11882 | styleFloatAccessor = 'styleFloat';
|
11883 | }
|
11884 | }
|
11885 |
|
11886 | if (process.env.NODE_ENV !== 'production') {
|
11887 | // 'msTransform' is correct, but the other prefixes should be capitalized
|
11888 | var badVendoredStyleNamePattern = /^(?:webkit|moz|o)[A-Z]/;
|
11889 |
|
11890 | // style values shouldn't contain a semicolon
|
11891 | var badStyleValueWithSemicolonPattern = /;\s*$/;
|
11892 |
|
11893 | var warnedStyleNames = {};
|
11894 | var warnedStyleValues = {};
|
11895 |
|
11896 | var warnHyphenatedStyleName = function (name) {
|
11897 | if (warnedStyleNames.hasOwnProperty(name) && warnedStyleNames[name]) {
|
11898 | return;
|
11899 | }
|
11900 |
|
11901 | warnedStyleNames[name] = true;
|
11902 | process.env.NODE_ENV !== 'production' ? warning(false, 'Unsupported style property %s. Did you mean %s?', name, camelizeStyleName(name)) : undefined;
|
11903 | };
|
11904 |
|
11905 | var warnBadVendoredStyleName = function (name) {
|
11906 | if (warnedStyleNames.hasOwnProperty(name) && warnedStyleNames[name]) {
|
11907 | return;
|
11908 | }
|
11909 |
|
11910 | warnedStyleNames[name] = true;
|
11911 | process.env.NODE_ENV !== 'production' ? warning(false, 'Unsupported vendor-prefixed style property %s. Did you mean %s?', name, name.charAt(0).toUpperCase() + name.slice(1)) : undefined;
|
11912 | };
|
11913 |
|
11914 | var warnStyleValueWithSemicolon = function (name, value) {
|
11915 | if (warnedStyleValues.hasOwnProperty(value) && warnedStyleValues[value]) {
|
11916 | return;
|
11917 | }
|
11918 |
|
11919 | warnedStyleValues[value] = true;
|
11920 | process.env.NODE_ENV !== 'production' ? warning(false, 'Style property values shouldn\'t contain a semicolon. ' + 'Try "%s: %s" instead.', name, value.replace(badStyleValueWithSemicolonPattern, '')) : undefined;
|
11921 | };
|
11922 |
|
11923 | /**
|
11924 | * @param {string} name
|
11925 | * @param {*} value
|
11926 | */
|
11927 | var warnValidStyle = function (name, value) {
|
11928 | if (name.indexOf('-') > -1) {
|
11929 | warnHyphenatedStyleName(name);
|
11930 | } else if (badVendoredStyleNamePattern.test(name)) {
|
11931 | warnBadVendoredStyleName(name);
|
11932 | } else if (badStyleValueWithSemicolonPattern.test(value)) {
|
11933 | warnStyleValueWithSemicolon(name, value);
|
11934 | }
|
11935 | };
|
11936 | }
|
11937 |
|
11938 | /**
|
11939 | * Operations for dealing with CSS properties.
|
11940 | */
|
11941 | var CSSPropertyOperations = {
|
11942 |
|
11943 | /**
|
11944 | * Serializes a mapping of style properties for use as inline styles:
|
11945 | *
|
11946 | * > createMarkupForStyles({width: '200px', height: 0})
|
11947 | * "width:200px;height:0;"
|
11948 | *
|
11949 | * Undefined values are ignored so that declarative programming is easier.
|
11950 | * The result should be HTML-escaped before insertion into the DOM.
|
11951 | *
|
11952 | * @param {object} styles
|
11953 | * @return {?string}
|
11954 | */
|
11955 | createMarkupForStyles: function (styles) {
|
11956 | var serialized = '';
|
11957 | for (var styleName in styles) {
|
11958 | if (!styles.hasOwnProperty(styleName)) {
|
11959 | continue;
|
11960 | }
|
11961 | var styleValue = styles[styleName];
|
11962 | if (process.env.NODE_ENV !== 'production') {
|
11963 | warnValidStyle(styleName, styleValue);
|
11964 | }
|
11965 | if (styleValue != null) {
|
11966 | serialized += processStyleName(styleName) + ':';
|
11967 | serialized += dangerousStyleValue(styleName, styleValue) + ';';
|
11968 | }
|
11969 | }
|
11970 | return serialized || null;
|
11971 | },
|
11972 |
|
11973 | /**
|
11974 | * Sets the value for multiple styles on a node. If a value is specified as
|
11975 | * '' (empty string), the corresponding style property will be unset.
|
11976 | *
|
11977 | * @param {DOMElement} node
|
11978 | * @param {object} styles
|
11979 | */
|
11980 | setValueForStyles: function (node, styles) {
|
11981 | var style = node.style;
|
11982 | for (var styleName in styles) {
|
11983 | if (!styles.hasOwnProperty(styleName)) {
|
11984 | continue;
|
11985 | }
|
11986 | if (process.env.NODE_ENV !== 'production') {
|
11987 | warnValidStyle(styleName, styles[styleName]);
|
11988 | }
|
11989 | var styleValue = dangerousStyleValue(styleName, styles[styleName]);
|
11990 | if (styleName === 'float') {
|
11991 | styleName = styleFloatAccessor;
|
11992 | }
|
11993 | if (styleValue) {
|
11994 | style[styleName] = styleValue;
|
11995 | } else {
|
11996 | var expansion = hasShorthandPropertyBug && CSSProperty.shorthandPropertyExpansions[styleName];
|
11997 | if (expansion) {
|
11998 | // Shorthand property that IE8 won't like unsetting, so unset each
|
11999 | // component to placate it
|
12000 | for (var individualStyleName in expansion) {
|
12001 | style[individualStyleName] = '';
|
12002 | }
|
12003 | } else {
|
12004 | style[styleName] = '';
|
12005 | }
|
12006 | }
|
12007 | }
|
12008 | }
|
12009 |
|
12010 | };
|
12011 |
|
12012 | ReactPerf.measureMethods(CSSPropertyOperations, 'CSSPropertyOperations', {
|
12013 | setValueForStyles: 'setValueForStyles'
|
12014 | });
|
12015 |
|
12016 | module.exports = CSSPropertyOperations;
|
12017 | /* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(5)))
|
12018 |
|
12019 | /***/ },
|
12020 | /* 98 */
|
12021 | /***/ function(module, exports) {
|
12022 |
|
12023 | /**
|
12024 | * Copyright 2013-2015, Facebook, Inc.
|
12025 | * All rights reserved.
|
12026 | *
|
12027 | * This source code is licensed under the BSD-style license found in the
|
12028 | * LICENSE file in the root directory of this source tree. An additional grant
|
12029 | * of patent rights can be found in the PATENTS file in the same directory.
|
12030 | *
|
12031 | * @providesModule CSSProperty
|
12032 | */
|
12033 |
|
12034 | 'use strict';
|
12035 |
|
12036 | /**
|
12037 | * CSS properties which accept numbers but are not in units of "px".
|
12038 | */
|
12039 | var isUnitlessNumber = {
|
12040 | animationIterationCount: true,
|
12041 | boxFlex: true,
|
12042 | boxFlexGroup: true,
|
12043 | boxOrdinalGroup: true,
|
12044 | columnCount: true,
|
12045 | flex: true,
|
12046 | flexGrow: true,
|
12047 | flexPositive: true,
|
12048 | flexShrink: true,
|
12049 | flexNegative: true,
|
12050 | flexOrder: true,
|
12051 | fontWeight: true,
|
12052 | lineClamp: true,
|
12053 | lineHeight: true,
|
12054 | opacity: true,
|
12055 | order: true,
|
12056 | orphans: true,
|
12057 | tabSize: true,
|
12058 | widows: true,
|
12059 | zIndex: true,
|
12060 | zoom: true,
|
12061 |
|
12062 | // SVG-related properties
|
12063 | fillOpacity: true,
|
12064 | stopOpacity: true,
|
12065 | strokeDashoffset: true,
|
12066 | strokeOpacity: true,
|
12067 | strokeWidth: true
|
12068 | };
|
12069 |
|
12070 | /**
|
12071 | * @param {string} prefix vendor-specific prefix, eg: Webkit
|
12072 | * @param {string} key style name, eg: transitionDuration
|
12073 | * @return {string} style name prefixed with `prefix`, properly camelCased, eg:
|
12074 | * WebkitTransitionDuration
|
12075 | */
|
12076 | function prefixKey(prefix, key) {
|
12077 | return prefix + key.charAt(0).toUpperCase() + key.substring(1);
|
12078 | }
|
12079 |
|
12080 | /**
|
12081 | * Support style names that may come passed in prefixed by adding permutations
|
12082 | * of vendor prefixes.
|
12083 | */
|
12084 | var prefixes = ['Webkit', 'ms', 'Moz', 'O'];
|
12085 |
|
12086 | // Using Object.keys here, or else the vanilla for-in loop makes IE8 go into an
|
12087 | // infinite loop, because it iterates over the newly added props too.
|
12088 | Object.keys(isUnitlessNumber).forEach(function (prop) {
|
12089 | prefixes.forEach(function (prefix) {
|
12090 | isUnitlessNumber[prefixKey(prefix, prop)] = isUnitlessNumber[prop];
|
12091 | });
|
12092 | });
|
12093 |
|
12094 | /**
|
12095 | * Most style properties can be unset by doing .style[prop] = '' but IE8
|
12096 | * doesn't like doing that with shorthand properties so for the properties that
|
12097 | * IE8 breaks on, which are listed here, we instead unset each of the
|
12098 | * individual properties. See http://bugs.jquery.com/ticket/12385.
|
12099 | * The 4-value 'clock' properties like margin, padding, border-width seem to
|
12100 | * behave without any problems. Curiously, list-style works too without any
|
12101 | * special prodding.
|
12102 | */
|
12103 | var shorthandPropertyExpansions = {
|
12104 | background: {
|
12105 | backgroundAttachment: true,
|
12106 | backgroundColor: true,
|
12107 | backgroundImage: true,
|
12108 | backgroundPositionX: true,
|
12109 | backgroundPositionY: true,
|
12110 | backgroundRepeat: true
|
12111 | },
|
12112 | backgroundPosition: {
|
12113 | backgroundPositionX: true,
|
12114 | backgroundPositionY: true
|
12115 | },
|
12116 | border: {
|
12117 | borderWidth: true,
|
12118 | borderStyle: true,
|
12119 | borderColor: true
|
12120 | },
|
12121 | borderBottom: {
|
12122 | borderBottomWidth: true,
|
12123 | borderBottomStyle: true,
|
12124 | borderBottomColor: true
|
12125 | },
|
12126 | borderLeft: {
|
12127 | borderLeftWidth: true,
|
12128 | borderLeftStyle: true,
|
12129 | borderLeftColor: true
|
12130 | },
|
12131 | borderRight: {
|
12132 | borderRightWidth: true,
|
12133 | borderRightStyle: true,
|
12134 | borderRightColor: true
|
12135 | },
|
12136 | borderTop: {
|
12137 | borderTopWidth: true,
|
12138 | borderTopStyle: true,
|
12139 | borderTopColor: true
|
12140 | },
|
12141 | font: {
|
12142 | fontStyle: true,
|
12143 | fontVariant: true,
|
12144 | fontWeight: true,
|
12145 | fontSize: true,
|
12146 | lineHeight: true,
|
12147 | fontFamily: true
|
12148 | },
|
12149 | outline: {
|
12150 | outlineWidth: true,
|
12151 | outlineStyle: true,
|
12152 | outlineColor: true
|
12153 | }
|
12154 | };
|
12155 |
|
12156 | var CSSProperty = {
|
12157 | isUnitlessNumber: isUnitlessNumber,
|
12158 | shorthandPropertyExpansions: shorthandPropertyExpansions
|
12159 | };
|
12160 |
|
12161 | module.exports = CSSProperty;
|
12162 |
|
12163 | /***/ },
|
12164 | /* 99 */
|
12165 | /***/ function(module, exports, __webpack_require__) {
|
12166 |
|
12167 | /**
|
12168 | * Copyright 2013-2015, Facebook, Inc.
|
12169 | * All rights reserved.
|
12170 | *
|
12171 | * This source code is licensed under the BSD-style license found in the
|
12172 | * LICENSE file in the root directory of this source tree. An additional grant
|
12173 | * of patent rights can be found in the PATENTS file in the same directory.
|
12174 | *
|
12175 | * @providesModule camelizeStyleName
|
12176 | * @typechecks
|
12177 | */
|
12178 |
|
12179 | 'use strict';
|
12180 |
|
12181 | var camelize = __webpack_require__(100);
|
12182 |
|
12183 | var msPattern = /^-ms-/;
|
12184 |
|
12185 | /**
|
12186 | * Camelcases a hyphenated CSS property name, for example:
|
12187 | *
|
12188 | * > camelizeStyleName('background-color')
|
12189 | * < "backgroundColor"
|
12190 | * > camelizeStyleName('-moz-transition')
|
12191 | * < "MozTransition"
|
12192 | * > camelizeStyleName('-ms-transition')
|
12193 | * < "msTransition"
|
12194 | *
|
12195 | * As Andi Smith suggests
|
12196 | * (http://www.andismith.com/blog/2012/02/modernizr-prefixed/), an `-ms` prefix
|
12197 | * is converted to lowercase `ms`.
|
12198 | *
|
12199 | * @param {string} string
|
12200 | * @return {string}
|
12201 | */
|
12202 | function camelizeStyleName(string) {
|
12203 | return camelize(string.replace(msPattern, 'ms-'));
|
12204 | }
|
12205 |
|
12206 | module.exports = camelizeStyleName;
|
12207 |
|
12208 | /***/ },
|
12209 | /* 100 */
|
12210 | /***/ function(module, exports) {
|
12211 |
|
12212 | /**
|
12213 | * Copyright 2013-2015, Facebook, Inc.
|
12214 | * All rights reserved.
|
12215 | *
|
12216 | * This source code is licensed under the BSD-style license found in the
|
12217 | * LICENSE file in the root directory of this source tree. An additional grant
|
12218 | * of patent rights can be found in the PATENTS file in the same directory.
|
12219 | *
|
12220 | * @providesModule camelize
|
12221 | * @typechecks
|
12222 | */
|
12223 |
|
12224 | "use strict";
|
12225 |
|
12226 | var _hyphenPattern = /-(.)/g;
|
12227 |
|
12228 | /**
|
12229 | * Camelcases a hyphenated string, for example:
|
12230 | *
|
12231 | * > camelize('background-color')
|
12232 | * < "backgroundColor"
|
12233 | *
|
12234 | * @param {string} string
|
12235 | * @return {string}
|
12236 | */
|
12237 | function camelize(string) {
|
12238 | return string.replace(_hyphenPattern, function (_, character) {
|
12239 | return character.toUpperCase();
|
12240 | });
|
12241 | }
|
12242 |
|
12243 | module.exports = camelize;
|
12244 |
|
12245 | /***/ },
|
12246 | /* 101 */
|
12247 | /***/ function(module, exports, __webpack_require__) {
|
12248 |
|
12249 | /**
|
12250 | * Copyright 2013-2015, Facebook, Inc.
|
12251 | * All rights reserved.
|
12252 | *
|
12253 | * This source code is licensed under the BSD-style license found in the
|
12254 | * LICENSE file in the root directory of this source tree. An additional grant
|
12255 | * of patent rights can be found in the PATENTS file in the same directory.
|
12256 | *
|
12257 | * @providesModule dangerousStyleValue
|
12258 | * @typechecks static-only
|
12259 | */
|
12260 |
|
12261 | 'use strict';
|
12262 |
|
12263 | var CSSProperty = __webpack_require__(98);
|
12264 |
|
12265 | var isUnitlessNumber = CSSProperty.isUnitlessNumber;
|
12266 |
|
12267 | /**
|
12268 | * Convert a value into the proper css writable value. The style name `name`
|
12269 | * should be logical (no hyphens), as specified
|
12270 | * in `CSSProperty.isUnitlessNumber`.
|
12271 | *
|
12272 | * @param {string} name CSS property name such as `topMargin`.
|
12273 | * @param {*} value CSS property value such as `10px`.
|
12274 | * @return {string} Normalized style value with dimensions applied.
|
12275 | */
|
12276 | function dangerousStyleValue(name, value) {
|
12277 | // Note that we've removed escapeTextForBrowser() calls here since the
|
12278 | // whole string will be escaped when the attribute is injected into
|
12279 | // the markup. If you provide unsafe user data here they can inject
|
12280 | // arbitrary CSS which may be problematic (I couldn't repro this):
|
12281 | // https://www.owasp.org/index.php/XSS_Filter_Evasion_Cheat_Sheet
|
12282 | // http://www.thespanner.co.uk/2007/11/26/ultimate-xss-css-injection/
|
12283 | // This is not an XSS hole but instead a potential CSS injection issue
|
12284 | // which has lead to a greater discussion about how we're going to
|
12285 | // trust URLs moving forward. See #2115901
|
12286 |
|
12287 | var isEmpty = value == null || typeof value === 'boolean' || value === '';
|
12288 | if (isEmpty) {
|
12289 | return '';
|
12290 | }
|
12291 |
|
12292 | var isNonNumeric = isNaN(value);
|
12293 | if (isNonNumeric || value === 0 || isUnitlessNumber.hasOwnProperty(name) && isUnitlessNumber[name]) {
|
12294 | return '' + value; // cast to string
|
12295 | }
|
12296 |
|
12297 | if (typeof value === 'string') {
|
12298 | value = value.trim();
|
12299 | }
|
12300 | return value + 'px';
|
12301 | }
|
12302 |
|
12303 | module.exports = dangerousStyleValue;
|
12304 |
|
12305 | /***/ },
|
12306 | /* 102 */
|
12307 | /***/ function(module, exports, __webpack_require__) {
|
12308 |
|
12309 | /**
|
12310 | * Copyright 2013-2015, Facebook, Inc.
|
12311 | * All rights reserved.
|
12312 | *
|
12313 | * This source code is licensed under the BSD-style license found in the
|
12314 | * LICENSE file in the root directory of this source tree. An additional grant
|
12315 | * of patent rights can be found in the PATENTS file in the same directory.
|
12316 | *
|
12317 | * @providesModule hyphenateStyleName
|
12318 | * @typechecks
|
12319 | */
|
12320 |
|
12321 | 'use strict';
|
12322 |
|
12323 | var hyphenate = __webpack_require__(103);
|
12324 |
|
12325 | var msPattern = /^ms-/;
|
12326 |
|
12327 | /**
|
12328 | * Hyphenates a camelcased CSS property name, for example:
|
12329 | *
|
12330 | * > hyphenateStyleName('backgroundColor')
|
12331 | * < "background-color"
|
12332 | * > hyphenateStyleName('MozTransition')
|
12333 | * < "-moz-transition"
|
12334 | * > hyphenateStyleName('msTransition')
|
12335 | * < "-ms-transition"
|
12336 | *
|
12337 | * As Modernizr suggests (http://modernizr.com/docs/#prefixed), an `ms` prefix
|
12338 | * is converted to `-ms-`.
|
12339 | *
|
12340 | * @param {string} string
|
12341 | * @return {string}
|
12342 | */
|
12343 | function hyphenateStyleName(string) {
|
12344 | return hyphenate(string).replace(msPattern, '-ms-');
|
12345 | }
|
12346 |
|
12347 | module.exports = hyphenateStyleName;
|
12348 |
|
12349 | /***/ },
|
12350 | /* 103 */
|
12351 | /***/ function(module, exports) {
|
12352 |
|
12353 | /**
|
12354 | * Copyright 2013-2015, Facebook, Inc.
|
12355 | * All rights reserved.
|
12356 | *
|
12357 | * This source code is licensed under the BSD-style license found in the
|
12358 | * LICENSE file in the root directory of this source tree. An additional grant
|
12359 | * of patent rights can be found in the PATENTS file in the same directory.
|
12360 | *
|
12361 | * @providesModule hyphenate
|
12362 | * @typechecks
|
12363 | */
|
12364 |
|
12365 | 'use strict';
|
12366 |
|
12367 | var _uppercasePattern = /([A-Z])/g;
|
12368 |
|
12369 | /**
|
12370 | * Hyphenates a camelcased string, for example:
|
12371 | *
|
12372 | * > hyphenate('backgroundColor')
|
12373 | * < "background-color"
|
12374 | *
|
12375 | * For CSS style names, use `hyphenateStyleName` instead which works properly
|
12376 | * with all vendor prefixes, including `ms`.
|
12377 | *
|
12378 | * @param {string} string
|
12379 | * @return {string}
|
12380 | */
|
12381 | function hyphenate(string) {
|
12382 | return string.replace(_uppercasePattern, '-$1').toLowerCase();
|
12383 | }
|
12384 |
|
12385 | module.exports = hyphenate;
|
12386 |
|
12387 | /***/ },
|
12388 | /* 104 */
|
12389 | /***/ function(module, exports) {
|
12390 |
|
12391 | /**
|
12392 | * Copyright 2013-2015, Facebook, Inc.
|
12393 | * All rights reserved.
|
12394 | *
|
12395 | * This source code is licensed under the BSD-style license found in the
|
12396 | * LICENSE file in the root directory of this source tree. An additional grant
|
12397 | * of patent rights can be found in the PATENTS file in the same directory.
|
12398 | *
|
12399 | * @providesModule memoizeStringOnly
|
12400 | * @typechecks static-only
|
12401 | */
|
12402 |
|
12403 | 'use strict';
|
12404 |
|
12405 | /**
|
12406 | * Memoizes the return value of a function that accepts one string argument.
|
12407 | *
|
12408 | * @param {function} callback
|
12409 | * @return {function}
|
12410 | */
|
12411 | function memoizeStringOnly(callback) {
|
12412 | var cache = {};
|
12413 | return function (string) {
|
12414 | if (!cache.hasOwnProperty(string)) {
|
12415 | cache[string] = callback.call(this, string);
|
12416 | }
|
12417 | return cache[string];
|
12418 | };
|
12419 | }
|
12420 |
|
12421 | module.exports = memoizeStringOnly;
|
12422 |
|
12423 | /***/ },
|
12424 | /* 105 */
|
12425 | /***/ function(module, exports) {
|
12426 |
|
12427 | /**
|
12428 | * Copyright 2013-2015, Facebook, Inc.
|
12429 | * All rights reserved.
|
12430 | *
|
12431 | * This source code is licensed under the BSD-style license found in the
|
12432 | * LICENSE file in the root directory of this source tree. An additional grant
|
12433 | * of patent rights can be found in the PATENTS file in the same directory.
|
12434 | *
|
12435 | * @providesModule ReactDOMButton
|
12436 | */
|
12437 |
|
12438 | 'use strict';
|
12439 |
|
12440 | var mouseListenerNames = {
|
12441 | onClick: true,
|
12442 | onDoubleClick: true,
|
12443 | onMouseDown: true,
|
12444 | onMouseMove: true,
|
12445 | onMouseUp: true,
|
12446 |
|
12447 | onClickCapture: true,
|
12448 | onDoubleClickCapture: true,
|
12449 | onMouseDownCapture: true,
|
12450 | onMouseMoveCapture: true,
|
12451 | onMouseUpCapture: true
|
12452 | };
|
12453 |
|
12454 | /**
|
12455 | * Implements a <button> native component that does not receive mouse events
|
12456 | * when `disabled` is set.
|
12457 | */
|
12458 | var ReactDOMButton = {
|
12459 | getNativeProps: function (inst, props, context) {
|
12460 | if (!props.disabled) {
|
12461 | return props;
|
12462 | }
|
12463 |
|
12464 | // Copy the props, except the mouse listeners
|
12465 | var nativeProps = {};
|
12466 | for (var key in props) {
|
12467 | if (props.hasOwnProperty(key) && !mouseListenerNames[key]) {
|
12468 | nativeProps[key] = props[key];
|
12469 | }
|
12470 | }
|
12471 |
|
12472 | return nativeProps;
|
12473 | }
|
12474 | };
|
12475 |
|
12476 | module.exports = ReactDOMButton;
|
12477 |
|
12478 | /***/ },
|
12479 | /* 106 */
|
12480 | /***/ function(module, exports, __webpack_require__) {
|
12481 |
|
12482 | /* WEBPACK VAR INJECTION */(function(process) {/**
|
12483 | * Copyright 2013-2015, Facebook, Inc.
|
12484 | * All rights reserved.
|
12485 | *
|
12486 | * This source code is licensed under the BSD-style license found in the
|
12487 | * LICENSE file in the root directory of this source tree. An additional grant
|
12488 | * of patent rights can be found in the PATENTS file in the same directory.
|
12489 | *
|
12490 | * @providesModule ReactDOMInput
|
12491 | */
|
12492 |
|
12493 | 'use strict';
|
12494 |
|
12495 | var ReactDOMIDOperations = __webpack_require__(28);
|
12496 | var LinkedValueUtils = __webpack_require__(107);
|
12497 | var ReactMount = __webpack_require__(29);
|
12498 | var ReactUpdates = __webpack_require__(55);
|
12499 |
|
12500 | var assign = __webpack_require__(40);
|
12501 | var invariant = __webpack_require__(14);
|
12502 |
|
12503 | var instancesByReactID = {};
|
12504 |
|
12505 | function forceUpdateIfMounted() {
|
12506 | if (this._rootNodeID) {
|
12507 | // DOM component is still mounted; update
|
12508 | ReactDOMInput.updateWrapper(this);
|
12509 | }
|
12510 | }
|
12511 |
|
12512 | /**
|
12513 | * Implements an <input> native component that allows setting these optional
|
12514 | * props: `checked`, `value`, `defaultChecked`, and `defaultValue`.
|
12515 | *
|
12516 | * If `checked` or `value` are not supplied (or null/undefined), user actions
|
12517 | * that affect the checked state or value will trigger updates to the element.
|
12518 | *
|
12519 | * If they are supplied (and not null/undefined), the rendered element will not
|
12520 | * trigger updates to the element. Instead, the props must change in order for
|
12521 | * the rendered element to be updated.
|
12522 | *
|
12523 | * The rendered element will be initialized as unchecked (or `defaultChecked`)
|
12524 | * with an empty value (or `defaultValue`).
|
12525 | *
|
12526 | * @see http://www.w3.org/TR/2012/WD-html5-20121025/the-input-element.html
|
12527 | */
|
12528 | var ReactDOMInput = {
|
12529 | getNativeProps: function (inst, props, context) {
|
12530 | var value = LinkedValueUtils.getValue(props);
|
12531 | var checked = LinkedValueUtils.getChecked(props);
|
12532 |
|
12533 | var nativeProps = assign({}, props, {
|
12534 | defaultChecked: undefined,
|
12535 | defaultValue: undefined,
|
12536 | value: value != null ? value : inst._wrapperState.initialValue,
|
12537 | checked: checked != null ? checked : inst._wrapperState.initialChecked,
|
12538 | onChange: inst._wrapperState.onChange
|
12539 | });
|
12540 |
|
12541 | return nativeProps;
|
12542 | },
|
12543 |
|
12544 | mountWrapper: function (inst, props) {
|
12545 | if (process.env.NODE_ENV !== 'production') {
|
12546 | LinkedValueUtils.checkPropTypes('input', props, inst._currentElement._owner);
|
12547 | }
|
12548 |
|
12549 | var defaultValue = props.defaultValue;
|
12550 | inst._wrapperState = {
|
12551 | initialChecked: props.defaultChecked || false,
|
12552 | initialValue: defaultValue != null ? defaultValue : null,
|
12553 | onChange: _handleChange.bind(inst)
|
12554 | };
|
12555 | },
|
12556 |
|
12557 | mountReadyWrapper: function (inst) {
|
12558 | // Can't be in mountWrapper or else server rendering leaks.
|
12559 | instancesByReactID[inst._rootNodeID] = inst;
|
12560 | },
|
12561 |
|
12562 | unmountWrapper: function (inst) {
|
12563 | delete instancesByReactID[inst._rootNodeID];
|
12564 | },
|
12565 |
|
12566 | updateWrapper: function (inst) {
|
12567 | var props = inst._currentElement.props;
|
12568 |
|
12569 | // TODO: Shouldn't this be getChecked(props)?
|
12570 | var checked = props.checked;
|
12571 | if (checked != null) {
|
12572 | ReactDOMIDOperations.updatePropertyByID(inst._rootNodeID, 'checked', checked || false);
|
12573 | }
|
12574 |
|
12575 | var value = LinkedValueUtils.getValue(props);
|
12576 | if (value != null) {
|
12577 | // Cast `value` to a string to ensure the value is set correctly. While
|
12578 | // browsers typically do this as necessary, jsdom doesn't.
|
12579 | ReactDOMIDOperations.updatePropertyByID(inst._rootNodeID, 'value', '' + value);
|
12580 | }
|
12581 | }
|
12582 | };
|
12583 |
|
12584 | function _handleChange(event) {
|
12585 | var props = this._currentElement.props;
|
12586 |
|
12587 | var returnValue = LinkedValueUtils.executeOnChange(props, event);
|
12588 |
|
12589 | // Here we use asap to wait until all updates have propagated, which
|
12590 | // is important when using controlled components within layers:
|
12591 | // https://github.com/facebook/react/issues/1698
|
12592 | ReactUpdates.asap(forceUpdateIfMounted, this);
|
12593 |
|
12594 | var name = props.name;
|
12595 | if (props.type === 'radio' && name != null) {
|
12596 | var rootNode = ReactMount.getNode(this._rootNodeID);
|
12597 | var queryRoot = rootNode;
|
12598 |
|
12599 | while (queryRoot.parentNode) {
|
12600 | queryRoot = queryRoot.parentNode;
|
12601 | }
|
12602 |
|
12603 | // If `rootNode.form` was non-null, then we could try `form.elements`,
|
12604 | // but that sometimes behaves strangely in IE8. We could also try using
|
12605 | // `form.getElementsByName`, but that will only return direct children
|
12606 | // and won't include inputs that use the HTML5 `form=` attribute. Since
|
12607 | // the input might not even be in a form, let's just use the global
|
12608 | // `querySelectorAll` to ensure we don't miss anything.
|
12609 | var group = queryRoot.querySelectorAll('input[name=' + JSON.stringify('' + name) + '][type="radio"]');
|
12610 |
|
12611 | for (var i = 0; i < group.length; i++) {
|
12612 | var otherNode = group[i];
|
12613 | if (otherNode === rootNode || otherNode.form !== rootNode.form) {
|
12614 | continue;
|
12615 | }
|
12616 | // This will throw if radio buttons rendered by different copies of React
|
12617 | // and the same name are rendered into the same form (same as #1939).
|
12618 | // That's probably okay; we don't support it just as we don't support
|
12619 | // mixing React with non-React.
|
12620 | var otherID = ReactMount.getID(otherNode);
|
12621 | !otherID ? process.env.NODE_ENV !== 'production' ? invariant(false, 'ReactDOMInput: Mixing React and non-React radio inputs with the ' + 'same `name` is not supported.') : invariant(false) : undefined;
|
12622 | var otherInstance = instancesByReactID[otherID];
|
12623 | !otherInstance ? process.env.NODE_ENV !== 'production' ? invariant(false, 'ReactDOMInput: Unknown radio button ID %s.', otherID) : invariant(false) : undefined;
|
12624 | // If this is a controlled radio button group, forcing the input that
|
12625 | // was previously checked to update will cause it to be come re-checked
|
12626 | // as appropriate.
|
12627 | ReactUpdates.asap(forceUpdateIfMounted, otherInstance);
|
12628 | }
|
12629 | }
|
12630 |
|
12631 | return returnValue;
|
12632 | }
|
12633 |
|
12634 | module.exports = ReactDOMInput;
|
12635 | /* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(5)))
|
12636 |
|
12637 | /***/ },
|
12638 | /* 107 */
|
12639 | /***/ function(module, exports, __webpack_require__) {
|
12640 |
|
12641 | /* WEBPACK VAR INJECTION */(function(process) {/**
|
12642 | * Copyright 2013-2015, Facebook, Inc.
|
12643 | * All rights reserved.
|
12644 | *
|
12645 | * This source code is licensed under the BSD-style license found in the
|
12646 | * LICENSE file in the root directory of this source tree. An additional grant
|
12647 | * of patent rights can be found in the PATENTS file in the same directory.
|
12648 | *
|
12649 | * @providesModule LinkedValueUtils
|
12650 | * @typechecks static-only
|
12651 | */
|
12652 |
|
12653 | 'use strict';
|
12654 |
|
12655 | var ReactPropTypes = __webpack_require__(108);
|
12656 | var ReactPropTypeLocations = __webpack_require__(66);
|
12657 |
|
12658 | var invariant = __webpack_require__(14);
|
12659 | var warning = __webpack_require__(26);
|
12660 |
|
12661 | var hasReadOnlyValue = {
|
12662 | 'button': true,
|
12663 | 'checkbox': true,
|
12664 | 'image': true,
|
12665 | 'hidden': true,
|
12666 | 'radio': true,
|
12667 | 'reset': true,
|
12668 | 'submit': true
|
12669 | };
|
12670 |
|
12671 | function _assertSingleLink(inputProps) {
|
12672 | !(inputProps.checkedLink == null || inputProps.valueLink == null) ? process.env.NODE_ENV !== 'production' ? invariant(false, 'Cannot provide a checkedLink and a valueLink. If you want to use ' + 'checkedLink, you probably don\'t want to use valueLink and vice versa.') : invariant(false) : undefined;
|
12673 | }
|
12674 | function _assertValueLink(inputProps) {
|
12675 | _assertSingleLink(inputProps);
|
12676 | !(inputProps.value == null && inputProps.onChange == null) ? process.env.NODE_ENV !== 'production' ? invariant(false, 'Cannot provide a valueLink and a value or onChange event. If you want ' + 'to use value or onChange, you probably don\'t want to use valueLink.') : invariant(false) : undefined;
|
12677 | }
|
12678 |
|
12679 | function _assertCheckedLink(inputProps) {
|
12680 | _assertSingleLink(inputProps);
|
12681 | !(inputProps.checked == null && inputProps.onChange == null) ? process.env.NODE_ENV !== 'production' ? invariant(false, 'Cannot provide a checkedLink and a checked property or onChange event. ' + 'If you want to use checked or onChange, you probably don\'t want to ' + 'use checkedLink') : invariant(false) : undefined;
|
12682 | }
|
12683 |
|
12684 | var propTypes = {
|
12685 | value: function (props, propName, componentName) {
|
12686 | if (!props[propName] || hasReadOnlyValue[props.type] || props.onChange || props.readOnly || props.disabled) {
|
12687 | return null;
|
12688 | }
|
12689 | return new Error('You provided a `value` prop to a form field without an ' + '`onChange` handler. This will render a read-only field. If ' + 'the field should be mutable use `defaultValue`. Otherwise, ' + 'set either `onChange` or `readOnly`.');
|
12690 | },
|
12691 | checked: function (props, propName, componentName) {
|
12692 | if (!props[propName] || props.onChange || props.readOnly || props.disabled) {
|
12693 | return null;
|
12694 | }
|
12695 | return new Error('You provided a `checked` prop to a form field without an ' + '`onChange` handler. This will render a read-only field. If ' + 'the field should be mutable use `defaultChecked`. Otherwise, ' + 'set either `onChange` or `readOnly`.');
|
12696 | },
|
12697 | onChange: ReactPropTypes.func
|
12698 | };
|
12699 |
|
12700 | var loggedTypeFailures = {};
|
12701 | function getDeclarationErrorAddendum(owner) {
|
12702 | if (owner) {
|
12703 | var name = owner.getName();
|
12704 | if (name) {
|
12705 | return ' Check the render method of `' + name + '`.';
|
12706 | }
|
12707 | }
|
12708 | return '';
|
12709 | }
|
12710 |
|
12711 | /**
|
12712 | * Provide a linked `value` attribute for controlled forms. You should not use
|
12713 | * this outside of the ReactDOM controlled form components.
|
12714 | */
|
12715 | var LinkedValueUtils = {
|
12716 | checkPropTypes: function (tagName, props, owner) {
|
12717 | for (var propName in propTypes) {
|
12718 | if (propTypes.hasOwnProperty(propName)) {
|
12719 | var error = propTypes[propName](props, propName, tagName, ReactPropTypeLocations.prop);
|
12720 | }
|
12721 | if (error instanceof Error && !(error.message in loggedTypeFailures)) {
|
12722 | // Only monitor this failure once because there tends to be a lot of the
|
12723 | // same error.
|
12724 | loggedTypeFailures[error.message] = true;
|
12725 |
|
12726 | var addendum = getDeclarationErrorAddendum(owner);
|
12727 | process.env.NODE_ENV !== 'production' ? warning(false, 'Failed form propType: %s%s', error.message, addendum) : undefined;
|
12728 | }
|
12729 | }
|
12730 | },
|
12731 |
|
12732 | /**
|
12733 | * @param {object} inputProps Props for form component
|
12734 | * @return {*} current value of the input either from value prop or link.
|
12735 | */
|
12736 | getValue: function (inputProps) {
|
12737 | if (inputProps.valueLink) {
|
12738 | _assertValueLink(inputProps);
|
12739 | return inputProps.valueLink.value;
|
12740 | }
|
12741 | return inputProps.value;
|
12742 | },
|
12743 |
|
12744 | /**
|
12745 | * @param {object} inputProps Props for form component
|
12746 | * @return {*} current checked status of the input either from checked prop
|
12747 | * or link.
|
12748 | */
|
12749 | getChecked: function (inputProps) {
|
12750 | if (inputProps.checkedLink) {
|
12751 | _assertCheckedLink(inputProps);
|
12752 | return inputProps.checkedLink.value;
|
12753 | }
|
12754 | return inputProps.checked;
|
12755 | },
|
12756 |
|
12757 | /**
|
12758 | * @param {object} inputProps Props for form component
|
12759 | * @param {SyntheticEvent} event change event to handle
|
12760 | */
|
12761 | executeOnChange: function (inputProps, event) {
|
12762 | if (inputProps.valueLink) {
|
12763 | _assertValueLink(inputProps);
|
12764 | return inputProps.valueLink.requestChange(event.target.value);
|
12765 | } else if (inputProps.checkedLink) {
|
12766 | _assertCheckedLink(inputProps);
|
12767 | return inputProps.checkedLink.requestChange(event.target.checked);
|
12768 | } else if (inputProps.onChange) {
|
12769 | return inputProps.onChange.call(undefined, event);
|
12770 | }
|
12771 | }
|
12772 | };
|
12773 |
|
12774 | module.exports = LinkedValueUtils;
|
12775 | /* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(5)))
|
12776 |
|
12777 | /***/ },
|
12778 | /* 108 */
|
12779 | /***/ function(module, exports, __webpack_require__) {
|
12780 |
|
12781 | /**
|
12782 | * Copyright 2013-2015, Facebook, Inc.
|
12783 | * All rights reserved.
|
12784 | *
|
12785 | * This source code is licensed under the BSD-style license found in the
|
12786 | * LICENSE file in the root directory of this source tree. An additional grant
|
12787 | * of patent rights can be found in the PATENTS file in the same directory.
|
12788 | *
|
12789 | * @providesModule ReactPropTypes
|
12790 | */
|
12791 |
|
12792 | 'use strict';
|
12793 |
|
12794 | var ReactElement = __webpack_require__(43);
|
12795 | var ReactPropTypeLocationNames = __webpack_require__(67);
|
12796 |
|
12797 | var emptyFunction = __webpack_require__(16);
|
12798 | var getIteratorFn = __webpack_require__(109);
|
12799 |
|
12800 | /**
|
12801 | * Collection of methods that allow declaration and validation of props that are
|
12802 | * supplied to React components. Example usage:
|
12803 | *
|
12804 | * var Props = require('ReactPropTypes');
|
12805 | * var MyArticle = React.createClass({
|
12806 | * propTypes: {
|
12807 | * // An optional string prop named "description".
|
12808 | * description: Props.string,
|
12809 | *
|
12810 | * // A required enum prop named "category".
|
12811 | * category: Props.oneOf(['News','Photos']).isRequired,
|
12812 | *
|
12813 | * // A prop named "dialog" that requires an instance of Dialog.
|
12814 | * dialog: Props.instanceOf(Dialog).isRequired
|
12815 | * },
|
12816 | * render: function() { ... }
|
12817 | * });
|
12818 | *
|
12819 | * A more formal specification of how these methods are used:
|
12820 | *
|
12821 | * type := array|bool|func|object|number|string|oneOf([...])|instanceOf(...)
|
12822 | * decl := ReactPropTypes.{type}(.isRequired)?
|
12823 | *
|
12824 | * Each and every declaration produces a function with the same signature. This
|
12825 | * allows the creation of custom validation functions. For example:
|
12826 | *
|
12827 | * var MyLink = React.createClass({
|
12828 | * propTypes: {
|
12829 | * // An optional string or URI prop named "href".
|
12830 | * href: function(props, propName, componentName) {
|
12831 | * var propValue = props[propName];
|
12832 | * if (propValue != null && typeof propValue !== 'string' &&
|
12833 | * !(propValue instanceof URI)) {
|
12834 | * return new Error(
|
12835 | * 'Expected a string or an URI for ' + propName + ' in ' +
|
12836 | * componentName
|
12837 | * );
|
12838 | * }
|
12839 | * }
|
12840 | * },
|
12841 | * render: function() {...}
|
12842 | * });
|
12843 | *
|
12844 | * @internal
|
12845 | */
|
12846 |
|
12847 | var ANONYMOUS = '<<anonymous>>';
|
12848 |
|
12849 | var ReactPropTypes = {
|
12850 | array: createPrimitiveTypeChecker('array'),
|
12851 | bool: createPrimitiveTypeChecker('boolean'),
|
12852 | func: createPrimitiveTypeChecker('function'),
|
12853 | number: createPrimitiveTypeChecker('number'),
|
12854 | object: createPrimitiveTypeChecker('object'),
|
12855 | string: createPrimitiveTypeChecker('string'),
|
12856 |
|
12857 | any: createAnyTypeChecker(),
|
12858 | arrayOf: createArrayOfTypeChecker,
|
12859 | element: createElementTypeChecker(),
|
12860 | instanceOf: createInstanceTypeChecker,
|
12861 | node: createNodeChecker(),
|
12862 | objectOf: createObjectOfTypeChecker,
|
12863 | oneOf: createEnumTypeChecker,
|
12864 | oneOfType: createUnionTypeChecker,
|
12865 | shape: createShapeTypeChecker
|
12866 | };
|
12867 |
|
12868 | function createChainableTypeChecker(validate) {
|
12869 | function checkType(isRequired, props, propName, componentName, location, propFullName) {
|
12870 | componentName = componentName || ANONYMOUS;
|
12871 | propFullName = propFullName || propName;
|
12872 | if (props[propName] == null) {
|
12873 | var locationName = ReactPropTypeLocationNames[location];
|
12874 | if (isRequired) {
|
12875 | return new Error('Required ' + locationName + ' `' + propFullName + '` was not specified in ' + ('`' + componentName + '`.'));
|
12876 | }
|
12877 | return null;
|
12878 | } else {
|
12879 | return validate(props, propName, componentName, location, propFullName);
|
12880 | }
|
12881 | }
|
12882 |
|
12883 | var chainedCheckType = checkType.bind(null, false);
|
12884 | chainedCheckType.isRequired = checkType.bind(null, true);
|
12885 |
|
12886 | return chainedCheckType;
|
12887 | }
|
12888 |
|
12889 | function createPrimitiveTypeChecker(expectedType) {
|
12890 | function validate(props, propName, componentName, location, propFullName) {
|
12891 | var propValue = props[propName];
|
12892 | var propType = getPropType(propValue);
|
12893 | if (propType !== expectedType) {
|
12894 | var locationName = ReactPropTypeLocationNames[location];
|
12895 | // `propValue` being instance of, say, date/regexp, pass the 'object'
|
12896 | // check, but we can offer a more precise error message here rather than
|
12897 | // 'of type `object`'.
|
12898 | var preciseType = getPreciseType(propValue);
|
12899 |
|
12900 | return new Error('Invalid ' + locationName + ' `' + propFullName + '` of type ' + ('`' + preciseType + '` supplied to `' + componentName + '`, expected ') + ('`' + expectedType + '`.'));
|
12901 | }
|
12902 | return null;
|
12903 | }
|
12904 | return createChainableTypeChecker(validate);
|
12905 | }
|
12906 |
|
12907 | function createAnyTypeChecker() {
|
12908 | return createChainableTypeChecker(emptyFunction.thatReturns(null));
|
12909 | }
|
12910 |
|
12911 | function createArrayOfTypeChecker(typeChecker) {
|
12912 | function validate(props, propName, componentName, location, propFullName) {
|
12913 | var propValue = props[propName];
|
12914 | if (!Array.isArray(propValue)) {
|
12915 | var locationName = ReactPropTypeLocationNames[location];
|
12916 | var propType = getPropType(propValue);
|
12917 | return new Error('Invalid ' + locationName + ' `' + propFullName + '` of type ' + ('`' + propType + '` supplied to `' + componentName + '`, expected an array.'));
|
12918 | }
|
12919 | for (var i = 0; i < propValue.length; i++) {
|
12920 | var error = typeChecker(propValue, i, componentName, location, propFullName + '[' + i + ']');
|
12921 | if (error instanceof Error) {
|
12922 | return error;
|
12923 | }
|
12924 | }
|
12925 | return null;
|
12926 | }
|
12927 | return createChainableTypeChecker(validate);
|
12928 | }
|
12929 |
|
12930 | function createElementTypeChecker() {
|
12931 | function validate(props, propName, componentName, location, propFullName) {
|
12932 | if (!ReactElement.isValidElement(props[propName])) {
|
12933 | var locationName = ReactPropTypeLocationNames[location];
|
12934 | return new Error('Invalid ' + locationName + ' `' + propFullName + '` supplied to ' + ('`' + componentName + '`, expected a single ReactElement.'));
|
12935 | }
|
12936 | return null;
|
12937 | }
|
12938 | return createChainableTypeChecker(validate);
|
12939 | }
|
12940 |
|
12941 | function createInstanceTypeChecker(expectedClass) {
|
12942 | function validate(props, propName, componentName, location, propFullName) {
|
12943 | if (!(props[propName] instanceof expectedClass)) {
|
12944 | var locationName = ReactPropTypeLocationNames[location];
|
12945 | var expectedClassName = expectedClass.name || ANONYMOUS;
|
12946 | var actualClassName = getClassName(props[propName]);
|
12947 | return new Error('Invalid ' + locationName + ' `' + propFullName + '` of type ' + ('`' + actualClassName + '` supplied to `' + componentName + '`, expected ') + ('instance of `' + expectedClassName + '`.'));
|
12948 | }
|
12949 | return null;
|
12950 | }
|
12951 | return createChainableTypeChecker(validate);
|
12952 | }
|
12953 |
|
12954 | function createEnumTypeChecker(expectedValues) {
|
12955 | if (!Array.isArray(expectedValues)) {
|
12956 | return createChainableTypeChecker(function () {
|
12957 | return new Error('Invalid argument supplied to oneOf, expected an instance of array.');
|
12958 | });
|
12959 | }
|
12960 |
|
12961 | function validate(props, propName, componentName, location, propFullName) {
|
12962 | var propValue = props[propName];
|
12963 | for (var i = 0; i < expectedValues.length; i++) {
|
12964 | if (propValue === expectedValues[i]) {
|
12965 | return null;
|
12966 | }
|
12967 | }
|
12968 |
|
12969 | var locationName = ReactPropTypeLocationNames[location];
|
12970 | var valuesString = JSON.stringify(expectedValues);
|
12971 | return new Error('Invalid ' + locationName + ' `' + propFullName + '` of value `' + propValue + '` ' + ('supplied to `' + componentName + '`, expected one of ' + valuesString + '.'));
|
12972 | }
|
12973 | return createChainableTypeChecker(validate);
|
12974 | }
|
12975 |
|
12976 | function createObjectOfTypeChecker(typeChecker) {
|
12977 | function validate(props, propName, componentName, location, propFullName) {
|
12978 | var propValue = props[propName];
|
12979 | var propType = getPropType(propValue);
|
12980 | if (propType !== 'object') {
|
12981 | var locationName = ReactPropTypeLocationNames[location];
|
12982 | return new Error('Invalid ' + locationName + ' `' + propFullName + '` of type ' + ('`' + propType + '` supplied to `' + componentName + '`, expected an object.'));
|
12983 | }
|
12984 | for (var key in propValue) {
|
12985 | if (propValue.hasOwnProperty(key)) {
|
12986 | var error = typeChecker(propValue, key, componentName, location, propFullName + '.' + key);
|
12987 | if (error instanceof Error) {
|
12988 | return error;
|
12989 | }
|
12990 | }
|
12991 | }
|
12992 | return null;
|
12993 | }
|
12994 | return createChainableTypeChecker(validate);
|
12995 | }
|
12996 |
|
12997 | function createUnionTypeChecker(arrayOfTypeCheckers) {
|
12998 | if (!Array.isArray(arrayOfTypeCheckers)) {
|
12999 | return createChainableTypeChecker(function () {
|
13000 | return new Error('Invalid argument supplied to oneOfType, expected an instance of array.');
|
13001 | });
|
13002 | }
|
13003 |
|
13004 | function validate(props, propName, componentName, location, propFullName) {
|
13005 | for (var i = 0; i < arrayOfTypeCheckers.length; i++) {
|
13006 | var checker = arrayOfTypeCheckers[i];
|
13007 | if (checker(props, propName, componentName, location, propFullName) == null) {
|
13008 | return null;
|
13009 | }
|
13010 | }
|
13011 |
|
13012 | var locationName = ReactPropTypeLocationNames[location];
|
13013 | return new Error('Invalid ' + locationName + ' `' + propFullName + '` supplied to ' + ('`' + componentName + '`.'));
|
13014 | }
|
13015 | return createChainableTypeChecker(validate);
|
13016 | }
|
13017 |
|
13018 | function createNodeChecker() {
|
13019 | function validate(props, propName, componentName, location, propFullName) {
|
13020 | if (!isNode(props[propName])) {
|
13021 | var locationName = ReactPropTypeLocationNames[location];
|
13022 | return new Error('Invalid ' + locationName + ' `' + propFullName + '` supplied to ' + ('`' + componentName + '`, expected a ReactNode.'));
|
13023 | }
|
13024 | return null;
|
13025 | }
|
13026 | return createChainableTypeChecker(validate);
|
13027 | }
|
13028 |
|
13029 | function createShapeTypeChecker(shapeTypes) {
|
13030 | function validate(props, propName, componentName, location, propFullName) {
|
13031 | var propValue = props[propName];
|
13032 | var propType = getPropType(propValue);
|
13033 | if (propType !== 'object') {
|
13034 | var locationName = ReactPropTypeLocationNames[location];
|
13035 | return new Error('Invalid ' + locationName + ' `' + propFullName + '` of type `' + propType + '` ' + ('supplied to `' + componentName + '`, expected `object`.'));
|
13036 | }
|
13037 | for (var key in shapeTypes) {
|
13038 | var checker = shapeTypes[key];
|
13039 | if (!checker) {
|
13040 | continue;
|
13041 | }
|
13042 | var error = checker(propValue, key, componentName, location, propFullName + '.' + key);
|
13043 | if (error) {
|
13044 | return error;
|
13045 | }
|
13046 | }
|
13047 | return null;
|
13048 | }
|
13049 | return createChainableTypeChecker(validate);
|
13050 | }
|
13051 |
|
13052 | function isNode(propValue) {
|
13053 | switch (typeof propValue) {
|
13054 | case 'number':
|
13055 | case 'string':
|
13056 | case 'undefined':
|
13057 | return true;
|
13058 | case 'boolean':
|
13059 | return !propValue;
|
13060 | case 'object':
|
13061 | if (Array.isArray(propValue)) {
|
13062 | return propValue.every(isNode);
|
13063 | }
|
13064 | if (propValue === null || ReactElement.isValidElement(propValue)) {
|
13065 | return true;
|
13066 | }
|
13067 |
|
13068 | var iteratorFn = getIteratorFn(propValue);
|
13069 | if (iteratorFn) {
|
13070 | var iterator = iteratorFn.call(propValue);
|
13071 | var step;
|
13072 | if (iteratorFn !== propValue.entries) {
|
13073 | while (!(step = iterator.next()).done) {
|
13074 | if (!isNode(step.value)) {
|
13075 | return false;
|
13076 | }
|
13077 | }
|
13078 | } else {
|
13079 | // Iterator will provide entry [k,v] tuples rather than values.
|
13080 | while (!(step = iterator.next()).done) {
|
13081 | var entry = step.value;
|
13082 | if (entry) {
|
13083 | if (!isNode(entry[1])) {
|
13084 | return false;
|
13085 | }
|
13086 | }
|
13087 | }
|
13088 | }
|
13089 | } else {
|
13090 | return false;
|
13091 | }
|
13092 |
|
13093 | return true;
|
13094 | default:
|
13095 | return false;
|
13096 | }
|
13097 | }
|
13098 |
|
13099 | // Equivalent of `typeof` but with special handling for array and regexp.
|
13100 | function getPropType(propValue) {
|
13101 | var propType = typeof propValue;
|
13102 | if (Array.isArray(propValue)) {
|
13103 | return 'array';
|
13104 | }
|
13105 | if (propValue instanceof RegExp) {
|
13106 | // Old webkits (at least until Android 4.0) return 'function' rather than
|
13107 | // 'object' for typeof a RegExp. We'll normalize this here so that /bla/
|
13108 | // passes PropTypes.object.
|
13109 | return 'object';
|
13110 | }
|
13111 | return propType;
|
13112 | }
|
13113 |
|
13114 | // This handles more types than `getPropType`. Only used for error messages.
|
13115 | // See `createPrimitiveTypeChecker`.
|
13116 | function getPreciseType(propValue) {
|
13117 | var propType = getPropType(propValue);
|
13118 | if (propType === 'object') {
|
13119 | if (propValue instanceof Date) {
|
13120 | return 'date';
|
13121 | } else if (propValue instanceof RegExp) {
|
13122 | return 'regexp';
|
13123 | }
|
13124 | }
|
13125 | return propType;
|
13126 | }
|
13127 |
|
13128 | // Returns class name of the object, if any.
|
13129 | function getClassName(propValue) {
|
13130 | if (!propValue.constructor || !propValue.constructor.name) {
|
13131 | return '<<anonymous>>';
|
13132 | }
|
13133 | return propValue.constructor.name;
|
13134 | }
|
13135 |
|
13136 | module.exports = ReactPropTypes;
|
13137 |
|
13138 | /***/ },
|
13139 | /* 109 */
|
13140 | /***/ function(module, exports) {
|
13141 |
|
13142 | /**
|
13143 | * Copyright 2013-2015, Facebook, Inc.
|
13144 | * All rights reserved.
|
13145 | *
|
13146 | * This source code is licensed under the BSD-style license found in the
|
13147 | * LICENSE file in the root directory of this source tree. An additional grant
|
13148 | * of patent rights can be found in the PATENTS file in the same directory.
|
13149 | *
|
13150 | * @providesModule getIteratorFn
|
13151 | * @typechecks static-only
|
13152 | */
|
13153 |
|
13154 | 'use strict';
|
13155 |
|
13156 | /* global Symbol */
|
13157 | var ITERATOR_SYMBOL = typeof Symbol === 'function' && Symbol.iterator;
|
13158 | var FAUX_ITERATOR_SYMBOL = '@@iterator'; // Before Symbol spec.
|
13159 |
|
13160 | /**
|
13161 | * Returns the iterator method function contained on the iterable object.
|
13162 | *
|
13163 | * Be sure to invoke the function with the iterable as context:
|
13164 | *
|
13165 | * var iteratorFn = getIteratorFn(myIterable);
|
13166 | * if (iteratorFn) {
|
13167 | * var iterator = iteratorFn.call(myIterable);
|
13168 | * ...
|
13169 | * }
|
13170 | *
|
13171 | * @param {?object} maybeIterable
|
13172 | * @return {?function}
|
13173 | */
|
13174 | function getIteratorFn(maybeIterable) {
|
13175 | var iteratorFn = maybeIterable && (ITERATOR_SYMBOL && maybeIterable[ITERATOR_SYMBOL] || maybeIterable[FAUX_ITERATOR_SYMBOL]);
|
13176 | if (typeof iteratorFn === 'function') {
|
13177 | return iteratorFn;
|
13178 | }
|
13179 | }
|
13180 |
|
13181 | module.exports = getIteratorFn;
|
13182 |
|
13183 | /***/ },
|
13184 | /* 110 */
|
13185 | /***/ function(module, exports, __webpack_require__) {
|
13186 |
|
13187 | /* WEBPACK VAR INJECTION */(function(process) {/**
|
13188 | * Copyright 2013-2015, Facebook, Inc.
|
13189 | * All rights reserved.
|
13190 | *
|
13191 | * This source code is licensed under the BSD-style license found in the
|
13192 | * LICENSE file in the root directory of this source tree. An additional grant
|
13193 | * of patent rights can be found in the PATENTS file in the same directory.
|
13194 | *
|
13195 | * @providesModule ReactDOMOption
|
13196 | */
|
13197 |
|
13198 | 'use strict';
|
13199 |
|
13200 | var ReactChildren = __webpack_require__(111);
|
13201 | var ReactDOMSelect = __webpack_require__(113);
|
13202 |
|
13203 | var assign = __webpack_require__(40);
|
13204 | var warning = __webpack_require__(26);
|
13205 |
|
13206 | var valueContextKey = ReactDOMSelect.valueContextKey;
|
13207 |
|
13208 | /**
|
13209 | * Implements an <option> native component that warns when `selected` is set.
|
13210 | */
|
13211 | var ReactDOMOption = {
|
13212 | mountWrapper: function (inst, props, context) {
|
13213 | // TODO (yungsters): Remove support for `selected` in <option>.
|
13214 | if (process.env.NODE_ENV !== 'production') {
|
13215 | process.env.NODE_ENV !== 'production' ? warning(props.selected == null, 'Use the `defaultValue` or `value` props on <select> instead of ' + 'setting `selected` on <option>.') : undefined;
|
13216 | }
|
13217 |
|
13218 | // Look up whether this option is 'selected' via context
|
13219 | var selectValue = context[valueContextKey];
|
13220 |
|
13221 | // If context key is null (e.g., no specified value or after initial mount)
|
13222 | // or missing (e.g., for <datalist>), we don't change props.selected
|
13223 | var selected = null;
|
13224 | if (selectValue != null) {
|
13225 | selected = false;
|
13226 | if (Array.isArray(selectValue)) {
|
13227 | // multiple
|
13228 | for (var i = 0; i < selectValue.length; i++) {
|
13229 | if ('' + selectValue[i] === '' + props.value) {
|
13230 | selected = true;
|
13231 | break;
|
13232 | }
|
13233 | }
|
13234 | } else {
|
13235 | selected = '' + selectValue === '' + props.value;
|
13236 | }
|
13237 | }
|
13238 |
|
13239 | inst._wrapperState = { selected: selected };
|
13240 | },
|
13241 |
|
13242 | getNativeProps: function (inst, props, context) {
|
13243 | var nativeProps = assign({ selected: undefined, children: undefined }, props);
|
13244 |
|
13245 | // Read state only from initial mount because <select> updates value
|
13246 | // manually; we need the initial state only for server rendering
|
13247 | if (inst._wrapperState.selected != null) {
|
13248 | nativeProps.selected = inst._wrapperState.selected;
|
13249 | }
|
13250 |
|
13251 | var content = '';
|
13252 |
|
13253 | // Flatten children and warn if they aren't strings or numbers;
|
13254 | // invalid types are ignored.
|
13255 | ReactChildren.forEach(props.children, function (child) {
|
13256 | if (child == null) {
|
13257 | return;
|
13258 | }
|
13259 | if (typeof child === 'string' || typeof child === 'number') {
|
13260 | content += child;
|
13261 | } else {
|
13262 | process.env.NODE_ENV !== 'production' ? warning(false, 'Only strings and numbers are supported as <option> children.') : undefined;
|
13263 | }
|
13264 | });
|
13265 |
|
13266 | if (content) {
|
13267 | nativeProps.children = content;
|
13268 | }
|
13269 |
|
13270 | return nativeProps;
|
13271 | }
|
13272 |
|
13273 | };
|
13274 |
|
13275 | module.exports = ReactDOMOption;
|
13276 | /* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(5)))
|
13277 |
|
13278 | /***/ },
|
13279 | /* 111 */
|
13280 | /***/ function(module, exports, __webpack_require__) {
|
13281 |
|
13282 | /**
|
13283 | * Copyright 2013-2015, Facebook, Inc.
|
13284 | * All rights reserved.
|
13285 | *
|
13286 | * This source code is licensed under the BSD-style license found in the
|
13287 | * LICENSE file in the root directory of this source tree. An additional grant
|
13288 | * of patent rights can be found in the PATENTS file in the same directory.
|
13289 | *
|
13290 | * @providesModule ReactChildren
|
13291 | */
|
13292 |
|
13293 | 'use strict';
|
13294 |
|
13295 | var PooledClass = __webpack_require__(57);
|
13296 | var ReactElement = __webpack_require__(43);
|
13297 |
|
13298 | var emptyFunction = __webpack_require__(16);
|
13299 | var traverseAllChildren = __webpack_require__(112);
|
13300 |
|
13301 | var twoArgumentPooler = PooledClass.twoArgumentPooler;
|
13302 | var fourArgumentPooler = PooledClass.fourArgumentPooler;
|
13303 |
|
13304 | var userProvidedKeyEscapeRegex = /\/(?!\/)/g;
|
13305 | function escapeUserProvidedKey(text) {
|
13306 | return ('' + text).replace(userProvidedKeyEscapeRegex, '//');
|
13307 | }
|
13308 |
|
13309 | /**
|
13310 | * PooledClass representing the bookkeeping associated with performing a child
|
13311 | * traversal. Allows avoiding binding callbacks.
|
13312 | *
|
13313 | * @constructor ForEachBookKeeping
|
13314 | * @param {!function} forEachFunction Function to perform traversal with.
|
13315 | * @param {?*} forEachContext Context to perform context with.
|
13316 | */
|
13317 | function ForEachBookKeeping(forEachFunction, forEachContext) {
|
13318 | this.func = forEachFunction;
|
13319 | this.context = forEachContext;
|
13320 | this.count = 0;
|
13321 | }
|
13322 | ForEachBookKeeping.prototype.destructor = function () {
|
13323 | this.func = null;
|
13324 | this.context = null;
|
13325 | this.count = 0;
|
13326 | };
|
13327 | PooledClass.addPoolingTo(ForEachBookKeeping, twoArgumentPooler);
|
13328 |
|
13329 | function forEachSingleChild(bookKeeping, child, name) {
|
13330 | var func = bookKeeping.func;
|
13331 | var context = bookKeeping.context;
|
13332 |
|
13333 | func.call(context, child, bookKeeping.count++);
|
13334 | }
|
13335 |
|
13336 | /**
|
13337 | * Iterates through children that are typically specified as `props.children`.
|
13338 | *
|
13339 | * The provided forEachFunc(child, index) will be called for each
|
13340 | * leaf child.
|
13341 | *
|
13342 | * @param {?*} children Children tree container.
|
13343 | * @param {function(*, int)} forEachFunc
|
13344 | * @param {*} forEachContext Context for forEachContext.
|
13345 | */
|
13346 | function forEachChildren(children, forEachFunc, forEachContext) {
|
13347 | if (children == null) {
|
13348 | return children;
|
13349 | }
|
13350 | var traverseContext = ForEachBookKeeping.getPooled(forEachFunc, forEachContext);
|
13351 | traverseAllChildren(children, forEachSingleChild, traverseContext);
|
13352 | ForEachBookKeeping.release(traverseContext);
|
13353 | }
|
13354 |
|
13355 | /**
|
13356 | * PooledClass representing the bookkeeping associated with performing a child
|
13357 | * mapping. Allows avoiding binding callbacks.
|
13358 | *
|
13359 | * @constructor MapBookKeeping
|
13360 | * @param {!*} mapResult Object containing the ordered map of results.
|
13361 | * @param {!function} mapFunction Function to perform mapping with.
|
13362 | * @param {?*} mapContext Context to perform mapping with.
|
13363 | */
|
13364 | function MapBookKeeping(mapResult, keyPrefix, mapFunction, mapContext) {
|
13365 | this.result = mapResult;
|
13366 | this.keyPrefix = keyPrefix;
|
13367 | this.func = mapFunction;
|
13368 | this.context = mapContext;
|
13369 | this.count = 0;
|
13370 | }
|
13371 | MapBookKeeping.prototype.destructor = function () {
|
13372 | this.result = null;
|
13373 | this.keyPrefix = null;
|
13374 | this.func = null;
|
13375 | this.context = null;
|
13376 | this.count = 0;
|
13377 | };
|
13378 | PooledClass.addPoolingTo(MapBookKeeping, fourArgumentPooler);
|
13379 |
|
13380 | function mapSingleChildIntoContext(bookKeeping, child, childKey) {
|
13381 | var result = bookKeeping.result;
|
13382 | var keyPrefix = bookKeeping.keyPrefix;
|
13383 | var func = bookKeeping.func;
|
13384 | var context = bookKeeping.context;
|
13385 |
|
13386 | var mappedChild = func.call(context, child, bookKeeping.count++);
|
13387 | if (Array.isArray(mappedChild)) {
|
13388 | mapIntoWithKeyPrefixInternal(mappedChild, result, childKey, emptyFunction.thatReturnsArgument);
|
13389 | } else if (mappedChild != null) {
|
13390 | if (ReactElement.isValidElement(mappedChild)) {
|
13391 | mappedChild = ReactElement.cloneAndReplaceKey(mappedChild,
|
13392 | // Keep both the (mapped) and old keys if they differ, just as
|
13393 | // traverseAllChildren used to do for objects as children
|
13394 | keyPrefix + (mappedChild !== child ? escapeUserProvidedKey(mappedChild.key || '') + '/' : '') + childKey);
|
13395 | }
|
13396 | result.push(mappedChild);
|
13397 | }
|
13398 | }
|
13399 |
|
13400 | function mapIntoWithKeyPrefixInternal(children, array, prefix, func, context) {
|
13401 | var escapedPrefix = '';
|
13402 | if (prefix != null) {
|
13403 | escapedPrefix = escapeUserProvidedKey(prefix) + '/';
|
13404 | }
|
13405 | var traverseContext = MapBookKeeping.getPooled(array, escapedPrefix, func, context);
|
13406 | traverseAllChildren(children, mapSingleChildIntoContext, traverseContext);
|
13407 | MapBookKeeping.release(traverseContext);
|
13408 | }
|
13409 |
|
13410 | /**
|
13411 | * Maps children that are typically specified as `props.children`.
|
13412 | *
|
13413 | * The provided mapFunction(child, key, index) will be called for each
|
13414 | * leaf child.
|
13415 | *
|
13416 | * @param {?*} children Children tree container.
|
13417 | * @param {function(*, int)} func The map function.
|
13418 | * @param {*} context Context for mapFunction.
|
13419 | * @return {object} Object containing the ordered map of results.
|
13420 | */
|
13421 | function mapChildren(children, func, context) {
|
13422 | if (children == null) {
|
13423 | return children;
|
13424 | }
|
13425 | var result = [];
|
13426 | mapIntoWithKeyPrefixInternal(children, result, null, func, context);
|
13427 | return result;
|
13428 | }
|
13429 |
|
13430 | function forEachSingleChildDummy(traverseContext, child, name) {
|
13431 | return null;
|
13432 | }
|
13433 |
|
13434 | /**
|
13435 | * Count the number of children that are typically specified as
|
13436 | * `props.children`.
|
13437 | *
|
13438 | * @param {?*} children Children tree container.
|
13439 | * @return {number} The number of children.
|
13440 | */
|
13441 | function countChildren(children, context) {
|
13442 | return traverseAllChildren(children, forEachSingleChildDummy, null);
|
13443 | }
|
13444 |
|
13445 | /**
|
13446 | * Flatten a children object (typically specified as `props.children`) and
|
13447 | * return an array with appropriately re-keyed children.
|
13448 | */
|
13449 | function toArray(children) {
|
13450 | var result = [];
|
13451 | mapIntoWithKeyPrefixInternal(children, result, null, emptyFunction.thatReturnsArgument);
|
13452 | return result;
|
13453 | }
|
13454 |
|
13455 | var ReactChildren = {
|
13456 | forEach: forEachChildren,
|
13457 | map: mapChildren,
|
13458 | mapIntoWithKeyPrefixInternal: mapIntoWithKeyPrefixInternal,
|
13459 | count: countChildren,
|
13460 | toArray: toArray
|
13461 | };
|
13462 |
|
13463 | module.exports = ReactChildren;
|
13464 |
|
13465 | /***/ },
|
13466 | /* 112 */
|
13467 | /***/ function(module, exports, __webpack_require__) {
|
13468 |
|
13469 | /* WEBPACK VAR INJECTION */(function(process) {/**
|
13470 | * Copyright 2013-2015, Facebook, Inc.
|
13471 | * All rights reserved.
|
13472 | *
|
13473 | * This source code is licensed under the BSD-style license found in the
|
13474 | * LICENSE file in the root directory of this source tree. An additional grant
|
13475 | * of patent rights can be found in the PATENTS file in the same directory.
|
13476 | *
|
13477 | * @providesModule traverseAllChildren
|
13478 | */
|
13479 |
|
13480 | 'use strict';
|
13481 |
|
13482 | var ReactCurrentOwner = __webpack_require__(6);
|
13483 | var ReactElement = __webpack_require__(43);
|
13484 | var ReactInstanceHandles = __webpack_require__(46);
|
13485 |
|
13486 | var getIteratorFn = __webpack_require__(109);
|
13487 | var invariant = __webpack_require__(14);
|
13488 | var warning = __webpack_require__(26);
|
13489 |
|
13490 | var SEPARATOR = ReactInstanceHandles.SEPARATOR;
|
13491 | var SUBSEPARATOR = ':';
|
13492 |
|
13493 | /**
|
13494 | * TODO: Test that a single child and an array with one item have the same key
|
13495 | * pattern.
|
13496 | */
|
13497 |
|
13498 | var userProvidedKeyEscaperLookup = {
|
13499 | '=': '=0',
|
13500 | '.': '=1',
|
13501 | ':': '=2'
|
13502 | };
|
13503 |
|
13504 | var userProvidedKeyEscapeRegex = /[=.:]/g;
|
13505 |
|
13506 | var didWarnAboutMaps = false;
|
13507 |
|
13508 | function userProvidedKeyEscaper(match) {
|
13509 | return userProvidedKeyEscaperLookup[match];
|
13510 | }
|
13511 |
|
13512 | /**
|
13513 | * Generate a key string that identifies a component within a set.
|
13514 | *
|
13515 | * @param {*} component A component that could contain a manual key.
|
13516 | * @param {number} index Index that is used if a manual key is not provided.
|
13517 | * @return {string}
|
13518 | */
|
13519 | function getComponentKey(component, index) {
|
13520 | if (component && component.key != null) {
|
13521 | // Explicit key
|
13522 | return wrapUserProvidedKey(component.key);
|
13523 | }
|
13524 | // Implicit key determined by the index in the set
|
13525 | return index.toString(36);
|
13526 | }
|
13527 |
|
13528 | /**
|
13529 | * Escape a component key so that it is safe to use in a reactid.
|
13530 | *
|
13531 | * @param {*} text Component key to be escaped.
|
13532 | * @return {string} An escaped string.
|
13533 | */
|
13534 | function escapeUserProvidedKey(text) {
|
13535 | return ('' + text).replace(userProvidedKeyEscapeRegex, userProvidedKeyEscaper);
|
13536 | }
|
13537 |
|
13538 | /**
|
13539 | * Wrap a `key` value explicitly provided by the user to distinguish it from
|
13540 | * implicitly-generated keys generated by a component's index in its parent.
|
13541 | *
|
13542 | * @param {string} key Value of a user-provided `key` attribute
|
13543 | * @return {string}
|
13544 | */
|
13545 | function wrapUserProvidedKey(key) {
|
13546 | return '$' + escapeUserProvidedKey(key);
|
13547 | }
|
13548 |
|
13549 | /**
|
13550 | * @param {?*} children Children tree container.
|
13551 | * @param {!string} nameSoFar Name of the key path so far.
|
13552 | * @param {!function} callback Callback to invoke with each child found.
|
13553 | * @param {?*} traverseContext Used to pass information throughout the traversal
|
13554 | * process.
|
13555 | * @return {!number} The number of children in this subtree.
|
13556 | */
|
13557 | function traverseAllChildrenImpl(children, nameSoFar, callback, traverseContext) {
|
13558 | var type = typeof children;
|
13559 |
|
13560 | if (type === 'undefined' || type === 'boolean') {
|
13561 | // All of the above are perceived as null.
|
13562 | children = null;
|
13563 | }
|
13564 |
|
13565 | if (children === null || type === 'string' || type === 'number' || ReactElement.isValidElement(children)) {
|
13566 | callback(traverseContext, children,
|
13567 | // If it's the only child, treat the name as if it was wrapped in an array
|
13568 | // so that it's consistent if the number of children grows.
|
13569 | nameSoFar === '' ? SEPARATOR + getComponentKey(children, 0) : nameSoFar);
|
13570 | return 1;
|
13571 | }
|
13572 |
|
13573 | var child;
|
13574 | var nextName;
|
13575 | var subtreeCount = 0; // Count of children found in the current subtree.
|
13576 | var nextNamePrefix = nameSoFar === '' ? SEPARATOR : nameSoFar + SUBSEPARATOR;
|
13577 |
|
13578 | if (Array.isArray(children)) {
|
13579 | for (var i = 0; i < children.length; i++) {
|
13580 | child = children[i];
|
13581 | nextName = nextNamePrefix + getComponentKey(child, i);
|
13582 | subtreeCount += traverseAllChildrenImpl(child, nextName, callback, traverseContext);
|
13583 | }
|
13584 | } else {
|
13585 | var iteratorFn = getIteratorFn(children);
|
13586 | if (iteratorFn) {
|
13587 | var iterator = iteratorFn.call(children);
|
13588 | var step;
|
13589 | if (iteratorFn !== children.entries) {
|
13590 | var ii = 0;
|
13591 | while (!(step = iterator.next()).done) {
|
13592 | child = step.value;
|
13593 | nextName = nextNamePrefix + getComponentKey(child, ii++);
|
13594 | subtreeCount += traverseAllChildrenImpl(child, nextName, callback, traverseContext);
|
13595 | }
|
13596 | } else {
|
13597 | if (process.env.NODE_ENV !== 'production') {
|
13598 | process.env.NODE_ENV !== 'production' ? warning(didWarnAboutMaps, 'Using Maps as children is not yet fully supported. It is an ' + 'experimental feature that might be removed. Convert it to a ' + 'sequence / iterable of keyed ReactElements instead.') : undefined;
|
13599 | didWarnAboutMaps = true;
|
13600 | }
|
13601 | // Iterator will provide entry [k,v] tuples rather than values.
|
13602 | while (!(step = iterator.next()).done) {
|
13603 | var entry = step.value;
|
13604 | if (entry) {
|
13605 | child = entry[1];
|
13606 | nextName = nextNamePrefix + wrapUserProvidedKey(entry[0]) + SUBSEPARATOR + getComponentKey(child, 0);
|
13607 | subtreeCount += traverseAllChildrenImpl(child, nextName, callback, traverseContext);
|
13608 | }
|
13609 | }
|
13610 | }
|
13611 | } else if (type === 'object') {
|
13612 | var addendum = '';
|
13613 | if (process.env.NODE_ENV !== 'production') {
|
13614 | addendum = ' If you meant to render a collection of children, use an array ' + 'instead or wrap the object using createFragment(object) from the ' + 'React add-ons.';
|
13615 | if (children._isReactElement) {
|
13616 | addendum = ' It looks like you\'re using an element created by a different ' + 'version of React. Make sure to use only one copy of React.';
|
13617 | }
|
13618 | if (ReactCurrentOwner.current) {
|
13619 | var name = ReactCurrentOwner.current.getName();
|
13620 | if (name) {
|
13621 | addendum += ' Check the render method of `' + name + '`.';
|
13622 | }
|
13623 | }
|
13624 | }
|
13625 | var childrenString = String(children);
|
13626 | true ? process.env.NODE_ENV !== 'production' ? invariant(false, 'Objects are not valid as a React child (found: %s).%s', childrenString === '[object Object]' ? 'object with keys {' + Object.keys(children).join(', ') + '}' : childrenString, addendum) : invariant(false) : undefined;
|
13627 | }
|
13628 | }
|
13629 |
|
13630 | return subtreeCount;
|
13631 | }
|
13632 |
|
13633 | /**
|
13634 | * Traverses children that are typically specified as `props.children`, but
|
13635 | * might also be specified through attributes:
|
13636 | *
|
13637 | * - `traverseAllChildren(this.props.children, ...)`
|
13638 | * - `traverseAllChildren(this.props.leftPanelChildren, ...)`
|
13639 | *
|
13640 | * The `traverseContext` is an optional argument that is passed through the
|
13641 | * entire traversal. It can be used to store accumulations or anything else that
|
13642 | * the callback might find relevant.
|
13643 | *
|
13644 | * @param {?*} children Children tree object.
|
13645 | * @param {!function} callback To invoke upon traversing each child.
|
13646 | * @param {?*} traverseContext Context for traversal.
|
13647 | * @return {!number} The number of children in this subtree.
|
13648 | */
|
13649 | function traverseAllChildren(children, callback, traverseContext) {
|
13650 | if (children == null) {
|
13651 | return 0;
|
13652 | }
|
13653 |
|
13654 | return traverseAllChildrenImpl(children, '', callback, traverseContext);
|
13655 | }
|
13656 |
|
13657 | module.exports = traverseAllChildren;
|
13658 | /* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(5)))
|
13659 |
|
13660 | /***/ },
|
13661 | /* 113 */
|
13662 | /***/ function(module, exports, __webpack_require__) {
|
13663 |
|
13664 | /* WEBPACK VAR INJECTION */(function(process) {/**
|
13665 | * Copyright 2013-2015, Facebook, Inc.
|
13666 | * All rights reserved.
|
13667 | *
|
13668 | * This source code is licensed under the BSD-style license found in the
|
13669 | * LICENSE file in the root directory of this source tree. An additional grant
|
13670 | * of patent rights can be found in the PATENTS file in the same directory.
|
13671 | *
|
13672 | * @providesModule ReactDOMSelect
|
13673 | */
|
13674 |
|
13675 | 'use strict';
|
13676 |
|
13677 | var LinkedValueUtils = __webpack_require__(107);
|
13678 | var ReactMount = __webpack_require__(29);
|
13679 | var ReactUpdates = __webpack_require__(55);
|
13680 |
|
13681 | var assign = __webpack_require__(40);
|
13682 | var warning = __webpack_require__(26);
|
13683 |
|
13684 | var valueContextKey = '__ReactDOMSelect_value$' + Math.random().toString(36).slice(2);
|
13685 |
|
13686 | function updateOptionsIfPendingUpdateAndMounted() {
|
13687 | if (this._rootNodeID && this._wrapperState.pendingUpdate) {
|
13688 | this._wrapperState.pendingUpdate = false;
|
13689 |
|
13690 | var props = this._currentElement.props;
|
13691 | var value = LinkedValueUtils.getValue(props);
|
13692 |
|
13693 | if (value != null) {
|
13694 | updateOptions(this, Boolean(props.multiple), value);
|
13695 | }
|
13696 | }
|
13697 | }
|
13698 |
|
13699 | function getDeclarationErrorAddendum(owner) {
|
13700 | if (owner) {
|
13701 | var name = owner.getName();
|
13702 | if (name) {
|
13703 | return ' Check the render method of `' + name + '`.';
|
13704 | }
|
13705 | }
|
13706 | return '';
|
13707 | }
|
13708 |
|
13709 | var valuePropNames = ['value', 'defaultValue'];
|
13710 |
|
13711 | /**
|
13712 | * Validation function for `value` and `defaultValue`.
|
13713 | * @private
|
13714 | */
|
13715 | function checkSelectPropTypes(inst, props) {
|
13716 | var owner = inst._currentElement._owner;
|
13717 | LinkedValueUtils.checkPropTypes('select', props, owner);
|
13718 |
|
13719 | for (var i = 0; i < valuePropNames.length; i++) {
|
13720 | var propName = valuePropNames[i];
|
13721 | if (props[propName] == null) {
|
13722 | continue;
|
13723 | }
|
13724 | if (props.multiple) {
|
13725 | process.env.NODE_ENV !== 'production' ? warning(Array.isArray(props[propName]), 'The `%s` prop supplied to <select> must be an array if ' + '`multiple` is true.%s', propName, getDeclarationErrorAddendum(owner)) : undefined;
|
13726 | } else {
|
13727 | process.env.NODE_ENV !== 'production' ? warning(!Array.isArray(props[propName]), 'The `%s` prop supplied to <select> must be a scalar ' + 'value if `multiple` is false.%s', propName, getDeclarationErrorAddendum(owner)) : undefined;
|
13728 | }
|
13729 | }
|
13730 | }
|
13731 |
|
13732 | /**
|
13733 | * @param {ReactDOMComponent} inst
|
13734 | * @param {boolean} multiple
|
13735 | * @param {*} propValue A stringable (with `multiple`, a list of stringables).
|
13736 | * @private
|
13737 | */
|
13738 | function updateOptions(inst, multiple, propValue) {
|
13739 | var selectedValue, i;
|
13740 | var options = ReactMount.getNode(inst._rootNodeID).options;
|
13741 |
|
13742 | if (multiple) {
|
13743 | selectedValue = {};
|
13744 | for (i = 0; i < propValue.length; i++) {
|
13745 | selectedValue['' + propValue[i]] = true;
|
13746 | }
|
13747 | for (i = 0; i < options.length; i++) {
|
13748 | var selected = selectedValue.hasOwnProperty(options[i].value);
|
13749 | if (options[i].selected !== selected) {
|
13750 | options[i].selected = selected;
|
13751 | }
|
13752 | }
|
13753 | } else {
|
13754 | // Do not set `select.value` as exact behavior isn't consistent across all
|
13755 | // browsers for all cases.
|
13756 | selectedValue = '' + propValue;
|
13757 | for (i = 0; i < options.length; i++) {
|
13758 | if (options[i].value === selectedValue) {
|
13759 | options[i].selected = true;
|
13760 | return;
|
13761 | }
|
13762 | }
|
13763 | if (options.length) {
|
13764 | options[0].selected = true;
|
13765 | }
|
13766 | }
|
13767 | }
|
13768 |
|
13769 | /**
|
13770 | * Implements a <select> native component that allows optionally setting the
|
13771 | * props `value` and `defaultValue`. If `multiple` is false, the prop must be a
|
13772 | * stringable. If `multiple` is true, the prop must be an array of stringables.
|
13773 | *
|
13774 | * If `value` is not supplied (or null/undefined), user actions that change the
|
13775 | * selected option will trigger updates to the rendered options.
|
13776 | *
|
13777 | * If it is supplied (and not null/undefined), the rendered options will not
|
13778 | * update in response to user actions. Instead, the `value` prop must change in
|
13779 | * order for the rendered options to update.
|
13780 | *
|
13781 | * If `defaultValue` is provided, any options with the supplied values will be
|
13782 | * selected.
|
13783 | */
|
13784 | var ReactDOMSelect = {
|
13785 | valueContextKey: valueContextKey,
|
13786 |
|
13787 | getNativeProps: function (inst, props, context) {
|
13788 | return assign({}, props, {
|
13789 | onChange: inst._wrapperState.onChange,
|
13790 | value: undefined
|
13791 | });
|
13792 | },
|
13793 |
|
13794 | mountWrapper: function (inst, props) {
|
13795 | if (process.env.NODE_ENV !== 'production') {
|
13796 | checkSelectPropTypes(inst, props);
|
13797 | }
|
13798 |
|
13799 | var value = LinkedValueUtils.getValue(props);
|
13800 | inst._wrapperState = {
|
13801 | pendingUpdate: false,
|
13802 | initialValue: value != null ? value : props.defaultValue,
|
13803 | onChange: _handleChange.bind(inst),
|
13804 | wasMultiple: Boolean(props.multiple)
|
13805 | };
|
13806 | },
|
13807 |
|
13808 | processChildContext: function (inst, props, context) {
|
13809 | // Pass down initial value so initial generated markup has correct
|
13810 | // `selected` attributes
|
13811 | var childContext = assign({}, context);
|
13812 | childContext[valueContextKey] = inst._wrapperState.initialValue;
|
13813 | return childContext;
|
13814 | },
|
13815 |
|
13816 | postUpdateWrapper: function (inst) {
|
13817 | var props = inst._currentElement.props;
|
13818 |
|
13819 | // After the initial mount, we control selected-ness manually so don't pass
|
13820 | // the context value down
|
13821 | inst._wrapperState.initialValue = undefined;
|
13822 |
|
13823 | var wasMultiple = inst._wrapperState.wasMultiple;
|
13824 | inst._wrapperState.wasMultiple = Boolean(props.multiple);
|
13825 |
|
13826 | var value = LinkedValueUtils.getValue(props);
|
13827 | if (value != null) {
|
13828 | inst._wrapperState.pendingUpdate = false;
|
13829 | updateOptions(inst, Boolean(props.multiple), value);
|
13830 | } else if (wasMultiple !== Boolean(props.multiple)) {
|
13831 | // For simplicity, reapply `defaultValue` if `multiple` is toggled.
|
13832 | if (props.defaultValue != null) {
|
13833 | updateOptions(inst, Boolean(props.multiple), props.defaultValue);
|
13834 | } else {
|
13835 | // Revert the select back to its default unselected state.
|
13836 | updateOptions(inst, Boolean(props.multiple), props.multiple ? [] : '');
|
13837 | }
|
13838 | }
|
13839 | }
|
13840 | };
|
13841 |
|
13842 | function _handleChange(event) {
|
13843 | var props = this._currentElement.props;
|
13844 | var returnValue = LinkedValueUtils.executeOnChange(props, event);
|
13845 |
|
13846 | this._wrapperState.pendingUpdate = true;
|
13847 | ReactUpdates.asap(updateOptionsIfPendingUpdateAndMounted, this);
|
13848 | return returnValue;
|
13849 | }
|
13850 |
|
13851 | module.exports = ReactDOMSelect;
|
13852 | /* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(5)))
|
13853 |
|
13854 | /***/ },
|
13855 | /* 114 */
|
13856 | /***/ function(module, exports, __webpack_require__) {
|
13857 |
|
13858 | /* WEBPACK VAR INJECTION */(function(process) {/**
|
13859 | * Copyright 2013-2015, Facebook, Inc.
|
13860 | * All rights reserved.
|
13861 | *
|
13862 | * This source code is licensed under the BSD-style license found in the
|
13863 | * LICENSE file in the root directory of this source tree. An additional grant
|
13864 | * of patent rights can be found in the PATENTS file in the same directory.
|
13865 | *
|
13866 | * @providesModule ReactDOMTextarea
|
13867 | */
|
13868 |
|
13869 | 'use strict';
|
13870 |
|
13871 | var LinkedValueUtils = __webpack_require__(107);
|
13872 | var ReactDOMIDOperations = __webpack_require__(28);
|
13873 | var ReactUpdates = __webpack_require__(55);
|
13874 |
|
13875 | var assign = __webpack_require__(40);
|
13876 | var invariant = __webpack_require__(14);
|
13877 | var warning = __webpack_require__(26);
|
13878 |
|
13879 | function forceUpdateIfMounted() {
|
13880 | if (this._rootNodeID) {
|
13881 | // DOM component is still mounted; update
|
13882 | ReactDOMTextarea.updateWrapper(this);
|
13883 | }
|
13884 | }
|
13885 |
|
13886 | /**
|
13887 | * Implements a <textarea> native component that allows setting `value`, and
|
13888 | * `defaultValue`. This differs from the traditional DOM API because value is
|
13889 | * usually set as PCDATA children.
|
13890 | *
|
13891 | * If `value` is not supplied (or null/undefined), user actions that affect the
|
13892 | * value will trigger updates to the element.
|
13893 | *
|
13894 | * If `value` is supplied (and not null/undefined), the rendered element will
|
13895 | * not trigger updates to the element. Instead, the `value` prop must change in
|
13896 | * order for the rendered element to be updated.
|
13897 | *
|
13898 | * The rendered element will be initialized with an empty value, the prop
|
13899 | * `defaultValue` if specified, or the children content (deprecated).
|
13900 | */
|
13901 | var ReactDOMTextarea = {
|
13902 | getNativeProps: function (inst, props, context) {
|
13903 | !(props.dangerouslySetInnerHTML == null) ? process.env.NODE_ENV !== 'production' ? invariant(false, '`dangerouslySetInnerHTML` does not make sense on <textarea>.') : invariant(false) : undefined;
|
13904 |
|
13905 | // Always set children to the same thing. In IE9, the selection range will
|
13906 | // get reset if `textContent` is mutated.
|
13907 | var nativeProps = assign({}, props, {
|
13908 | defaultValue: undefined,
|
13909 | value: undefined,
|
13910 | children: inst._wrapperState.initialValue,
|
13911 | onChange: inst._wrapperState.onChange
|
13912 | });
|
13913 |
|
13914 | return nativeProps;
|
13915 | },
|
13916 |
|
13917 | mountWrapper: function (inst, props) {
|
13918 | if (process.env.NODE_ENV !== 'production') {
|
13919 | LinkedValueUtils.checkPropTypes('textarea', props, inst._currentElement._owner);
|
13920 | }
|
13921 |
|
13922 | var defaultValue = props.defaultValue;
|
13923 | // TODO (yungsters): Remove support for children content in <textarea>.
|
13924 | var children = props.children;
|
13925 | if (children != null) {
|
13926 | if (process.env.NODE_ENV !== 'production') {
|
13927 | process.env.NODE_ENV !== 'production' ? warning(false, 'Use the `defaultValue` or `value` props instead of setting ' + 'children on <textarea>.') : undefined;
|
13928 | }
|
13929 | !(defaultValue == null) ? process.env.NODE_ENV !== 'production' ? invariant(false, 'If you supply `defaultValue` on a <textarea>, do not pass children.') : invariant(false) : undefined;
|
13930 | if (Array.isArray(children)) {
|
13931 | !(children.length <= 1) ? process.env.NODE_ENV !== 'production' ? invariant(false, '<textarea> can only have at most one child.') : invariant(false) : undefined;
|
13932 | children = children[0];
|
13933 | }
|
13934 |
|
13935 | defaultValue = '' + children;
|
13936 | }
|
13937 | if (defaultValue == null) {
|
13938 | defaultValue = '';
|
13939 | }
|
13940 | var value = LinkedValueUtils.getValue(props);
|
13941 |
|
13942 | inst._wrapperState = {
|
13943 | // We save the initial value so that `ReactDOMComponent` doesn't update
|
13944 | // `textContent` (unnecessary since we update value).
|
13945 | // The initial value can be a boolean or object so that's why it's
|
13946 | // forced to be a string.
|
13947 | initialValue: '' + (value != null ? value : defaultValue),
|
13948 | onChange: _handleChange.bind(inst)
|
13949 | };
|
13950 | },
|
13951 |
|
13952 | updateWrapper: function (inst) {
|
13953 | var props = inst._currentElement.props;
|
13954 | var value = LinkedValueUtils.getValue(props);
|
13955 | if (value != null) {
|
13956 | // Cast `value` to a string to ensure the value is set correctly. While
|
13957 | // browsers typically do this as necessary, jsdom doesn't.
|
13958 | ReactDOMIDOperations.updatePropertyByID(inst._rootNodeID, 'value', '' + value);
|
13959 | }
|
13960 | }
|
13961 | };
|
13962 |
|
13963 | function _handleChange(event) {
|
13964 | var props = this._currentElement.props;
|
13965 | var returnValue = LinkedValueUtils.executeOnChange(props, event);
|
13966 | ReactUpdates.asap(forceUpdateIfMounted, this);
|
13967 | return returnValue;
|
13968 | }
|
13969 |
|
13970 | module.exports = ReactDOMTextarea;
|
13971 | /* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(5)))
|
13972 |
|
13973 | /***/ },
|
13974 | /* 115 */
|
13975 | /***/ function(module, exports, __webpack_require__) {
|
13976 |
|
13977 | /* WEBPACK VAR INJECTION */(function(process) {/**
|
13978 | * Copyright 2013-2015, Facebook, Inc.
|
13979 | * All rights reserved.
|
13980 | *
|
13981 | * This source code is licensed under the BSD-style license found in the
|
13982 | * LICENSE file in the root directory of this source tree. An additional grant
|
13983 | * of patent rights can be found in the PATENTS file in the same directory.
|
13984 | *
|
13985 | * @providesModule ReactMultiChild
|
13986 | * @typechecks static-only
|
13987 | */
|
13988 |
|
13989 | 'use strict';
|
13990 |
|
13991 | var ReactComponentEnvironment = __webpack_require__(65);
|
13992 | var ReactMultiChildUpdateTypes = __webpack_require__(17);
|
13993 |
|
13994 | var ReactCurrentOwner = __webpack_require__(6);
|
13995 | var ReactReconciler = __webpack_require__(51);
|
13996 | var ReactChildReconciler = __webpack_require__(116);
|
13997 |
|
13998 | var flattenChildren = __webpack_require__(117);
|
13999 |
|
14000 | /**
|
14001 | * Updating children of a component may trigger recursive updates. The depth is
|
14002 | * used to batch recursive updates to render markup more efficiently.
|
14003 | *
|
14004 | * @type {number}
|
14005 | * @private
|
14006 | */
|
14007 | var updateDepth = 0;
|
14008 |
|
14009 | /**
|
14010 | * Queue of update configuration objects.
|
14011 | *
|
14012 | * Each object has a `type` property that is in `ReactMultiChildUpdateTypes`.
|
14013 | *
|
14014 | * @type {array<object>}
|
14015 | * @private
|
14016 | */
|
14017 | var updateQueue = [];
|
14018 |
|
14019 | /**
|
14020 | * Queue of markup to be rendered.
|
14021 | *
|
14022 | * @type {array<string>}
|
14023 | * @private
|
14024 | */
|
14025 | var markupQueue = [];
|
14026 |
|
14027 | /**
|
14028 | * Enqueues markup to be rendered and inserted at a supplied index.
|
14029 | *
|
14030 | * @param {string} parentID ID of the parent component.
|
14031 | * @param {string} markup Markup that renders into an element.
|
14032 | * @param {number} toIndex Destination index.
|
14033 | * @private
|
14034 | */
|
14035 | function enqueueInsertMarkup(parentID, markup, toIndex) {
|
14036 | // NOTE: Null values reduce hidden classes.
|
14037 | updateQueue.push({
|
14038 | parentID: parentID,
|
14039 | parentNode: null,
|
14040 | type: ReactMultiChildUpdateTypes.INSERT_MARKUP,
|
14041 | markupIndex: markupQueue.push(markup) - 1,
|
14042 | content: null,
|
14043 | fromIndex: null,
|
14044 | toIndex: toIndex
|
14045 | });
|
14046 | }
|
14047 |
|
14048 | /**
|
14049 | * Enqueues moving an existing element to another index.
|
14050 | *
|
14051 | * @param {string} parentID ID of the parent component.
|
14052 | * @param {number} fromIndex Source index of the existing element.
|
14053 | * @param {number} toIndex Destination index of the element.
|
14054 | * @private
|
14055 | */
|
14056 | function enqueueMove(parentID, fromIndex, toIndex) {
|
14057 | // NOTE: Null values reduce hidden classes.
|
14058 | updateQueue.push({
|
14059 | parentID: parentID,
|
14060 | parentNode: null,
|
14061 | type: ReactMultiChildUpdateTypes.MOVE_EXISTING,
|
14062 | markupIndex: null,
|
14063 | content: null,
|
14064 | fromIndex: fromIndex,
|
14065 | toIndex: toIndex
|
14066 | });
|
14067 | }
|
14068 |
|
14069 | /**
|
14070 | * Enqueues removing an element at an index.
|
14071 | *
|
14072 | * @param {string} parentID ID of the parent component.
|
14073 | * @param {number} fromIndex Index of the element to remove.
|
14074 | * @private
|
14075 | */
|
14076 | function enqueueRemove(parentID, fromIndex) {
|
14077 | // NOTE: Null values reduce hidden classes.
|
14078 | updateQueue.push({
|
14079 | parentID: parentID,
|
14080 | parentNode: null,
|
14081 | type: ReactMultiChildUpdateTypes.REMOVE_NODE,
|
14082 | markupIndex: null,
|
14083 | content: null,
|
14084 | fromIndex: fromIndex,
|
14085 | toIndex: null
|
14086 | });
|
14087 | }
|
14088 |
|
14089 | /**
|
14090 | * Enqueues setting the markup of a node.
|
14091 | *
|
14092 | * @param {string} parentID ID of the parent component.
|
14093 | * @param {string} markup Markup that renders into an element.
|
14094 | * @private
|
14095 | */
|
14096 | function enqueueSetMarkup(parentID, markup) {
|
14097 | // NOTE: Null values reduce hidden classes.
|
14098 | updateQueue.push({
|
14099 | parentID: parentID,
|
14100 | parentNode: null,
|
14101 | type: ReactMultiChildUpdateTypes.SET_MARKUP,
|
14102 | markupIndex: null,
|
14103 | content: markup,
|
14104 | fromIndex: null,
|
14105 | toIndex: null
|
14106 | });
|
14107 | }
|
14108 |
|
14109 | /**
|
14110 | * Enqueues setting the text content.
|
14111 | *
|
14112 | * @param {string} parentID ID of the parent component.
|
14113 | * @param {string} textContent Text content to set.
|
14114 | * @private
|
14115 | */
|
14116 | function enqueueTextContent(parentID, textContent) {
|
14117 | // NOTE: Null values reduce hidden classes.
|
14118 | updateQueue.push({
|
14119 | parentID: parentID,
|
14120 | parentNode: null,
|
14121 | type: ReactMultiChildUpdateTypes.TEXT_CONTENT,
|
14122 | markupIndex: null,
|
14123 | content: textContent,
|
14124 | fromIndex: null,
|
14125 | toIndex: null
|
14126 | });
|
14127 | }
|
14128 |
|
14129 | /**
|
14130 | * Processes any enqueued updates.
|
14131 | *
|
14132 | * @private
|
14133 | */
|
14134 | function processQueue() {
|
14135 | if (updateQueue.length) {
|
14136 | ReactComponentEnvironment.processChildrenUpdates(updateQueue, markupQueue);
|
14137 | clearQueue();
|
14138 | }
|
14139 | }
|
14140 |
|
14141 | /**
|
14142 | * Clears any enqueued updates.
|
14143 | *
|
14144 | * @private
|
14145 | */
|
14146 | function clearQueue() {
|
14147 | updateQueue.length = 0;
|
14148 | markupQueue.length = 0;
|
14149 | }
|
14150 |
|
14151 | /**
|
14152 | * ReactMultiChild are capable of reconciling multiple children.
|
14153 | *
|
14154 | * @class ReactMultiChild
|
14155 | * @internal
|
14156 | */
|
14157 | var ReactMultiChild = {
|
14158 |
|
14159 | /**
|
14160 | * Provides common functionality for components that must reconcile multiple
|
14161 | * children. This is used by `ReactDOMComponent` to mount, update, and
|
14162 | * unmount child components.
|
14163 | *
|
14164 | * @lends {ReactMultiChild.prototype}
|
14165 | */
|
14166 | Mixin: {
|
14167 |
|
14168 | _reconcilerInstantiateChildren: function (nestedChildren, transaction, context) {
|
14169 | if (process.env.NODE_ENV !== 'production') {
|
14170 | if (this._currentElement) {
|
14171 | try {
|
14172 | ReactCurrentOwner.current = this._currentElement._owner;
|
14173 | return ReactChildReconciler.instantiateChildren(nestedChildren, transaction, context);
|
14174 | } finally {
|
14175 | ReactCurrentOwner.current = null;
|
14176 | }
|
14177 | }
|
14178 | }
|
14179 | return ReactChildReconciler.instantiateChildren(nestedChildren, transaction, context);
|
14180 | },
|
14181 |
|
14182 | _reconcilerUpdateChildren: function (prevChildren, nextNestedChildrenElements, transaction, context) {
|
14183 | var nextChildren;
|
14184 | if (process.env.NODE_ENV !== 'production') {
|
14185 | if (this._currentElement) {
|
14186 | try {
|
14187 | ReactCurrentOwner.current = this._currentElement._owner;
|
14188 | nextChildren = flattenChildren(nextNestedChildrenElements);
|
14189 | } finally {
|
14190 | ReactCurrentOwner.current = null;
|
14191 | }
|
14192 | return ReactChildReconciler.updateChildren(prevChildren, nextChildren, transaction, context);
|
14193 | }
|
14194 | }
|
14195 | nextChildren = flattenChildren(nextNestedChildrenElements);
|
14196 | return ReactChildReconciler.updateChildren(prevChildren, nextChildren, transaction, context);
|
14197 | },
|
14198 |
|
14199 | /**
|
14200 | * Generates a "mount image" for each of the supplied children. In the case
|
14201 | * of `ReactDOMComponent`, a mount image is a string of markup.
|
14202 | *
|
14203 | * @param {?object} nestedChildren Nested child maps.
|
14204 | * @return {array} An array of mounted representations.
|
14205 | * @internal
|
14206 | */
|
14207 | mountChildren: function (nestedChildren, transaction, context) {
|
14208 | var children = this._reconcilerInstantiateChildren(nestedChildren, transaction, context);
|
14209 | this._renderedChildren = children;
|
14210 | var mountImages = [];
|
14211 | var index = 0;
|
14212 | for (var name in children) {
|
14213 | if (children.hasOwnProperty(name)) {
|
14214 | var child = children[name];
|
14215 | // Inlined for performance, see `ReactInstanceHandles.createReactID`.
|
14216 | var rootID = this._rootNodeID + name;
|
14217 | var mountImage = ReactReconciler.mountComponent(child, rootID, transaction, context);
|
14218 | child._mountIndex = index++;
|
14219 | mountImages.push(mountImage);
|
14220 | }
|
14221 | }
|
14222 | return mountImages;
|
14223 | },
|
14224 |
|
14225 | /**
|
14226 | * Replaces any rendered children with a text content string.
|
14227 | *
|
14228 | * @param {string} nextContent String of content.
|
14229 | * @internal
|
14230 | */
|
14231 | updateTextContent: function (nextContent) {
|
14232 | updateDepth++;
|
14233 | var errorThrown = true;
|
14234 | try {
|
14235 | var prevChildren = this._renderedChildren;
|
14236 | // Remove any rendered children.
|
14237 | ReactChildReconciler.unmountChildren(prevChildren);
|
14238 | // TODO: The setTextContent operation should be enough
|
14239 | for (var name in prevChildren) {
|
14240 | if (prevChildren.hasOwnProperty(name)) {
|
14241 | this._unmountChild(prevChildren[name]);
|
14242 | }
|
14243 | }
|
14244 | // Set new text content.
|
14245 | this.setTextContent(nextContent);
|
14246 | errorThrown = false;
|
14247 | } finally {
|
14248 | updateDepth--;
|
14249 | if (!updateDepth) {
|
14250 | if (errorThrown) {
|
14251 | clearQueue();
|
14252 | } else {
|
14253 | processQueue();
|
14254 | }
|
14255 | }
|
14256 | }
|
14257 | },
|
14258 |
|
14259 | /**
|
14260 | * Replaces any rendered children with a markup string.
|
14261 | *
|
14262 | * @param {string} nextMarkup String of markup.
|
14263 | * @internal
|
14264 | */
|
14265 | updateMarkup: function (nextMarkup) {
|
14266 | updateDepth++;
|
14267 | var errorThrown = true;
|
14268 | try {
|
14269 | var prevChildren = this._renderedChildren;
|
14270 | // Remove any rendered children.
|
14271 | ReactChildReconciler.unmountChildren(prevChildren);
|
14272 | for (var name in prevChildren) {
|
14273 | if (prevChildren.hasOwnProperty(name)) {
|
14274 | this._unmountChildByName(prevChildren[name], name);
|
14275 | }
|
14276 | }
|
14277 | this.setMarkup(nextMarkup);
|
14278 | errorThrown = false;
|
14279 | } finally {
|
14280 | updateDepth--;
|
14281 | if (!updateDepth) {
|
14282 | if (errorThrown) {
|
14283 | clearQueue();
|
14284 | } else {
|
14285 | processQueue();
|
14286 | }
|
14287 | }
|
14288 | }
|
14289 | },
|
14290 |
|
14291 | /**
|
14292 | * Updates the rendered children with new children.
|
14293 | *
|
14294 | * @param {?object} nextNestedChildrenElements Nested child element maps.
|
14295 | * @param {ReactReconcileTransaction} transaction
|
14296 | * @internal
|
14297 | */
|
14298 | updateChildren: function (nextNestedChildrenElements, transaction, context) {
|
14299 | updateDepth++;
|
14300 | var errorThrown = true;
|
14301 | try {
|
14302 | this._updateChildren(nextNestedChildrenElements, transaction, context);
|
14303 | errorThrown = false;
|
14304 | } finally {
|
14305 | updateDepth--;
|
14306 | if (!updateDepth) {
|
14307 | if (errorThrown) {
|
14308 | clearQueue();
|
14309 | } else {
|
14310 | processQueue();
|
14311 | }
|
14312 | }
|
14313 | }
|
14314 | },
|
14315 |
|
14316 | /**
|
14317 | * Improve performance by isolating this hot code path from the try/catch
|
14318 | * block in `updateChildren`.
|
14319 | *
|
14320 | * @param {?object} nextNestedChildrenElements Nested child element maps.
|
14321 | * @param {ReactReconcileTransaction} transaction
|
14322 | * @final
|
14323 | * @protected
|
14324 | */
|
14325 | _updateChildren: function (nextNestedChildrenElements, transaction, context) {
|
14326 | var prevChildren = this._renderedChildren;
|
14327 | var nextChildren = this._reconcilerUpdateChildren(prevChildren, nextNestedChildrenElements, transaction, context);
|
14328 | this._renderedChildren = nextChildren;
|
14329 | if (!nextChildren && !prevChildren) {
|
14330 | return;
|
14331 | }
|
14332 | var name;
|
14333 | // `nextIndex` will increment for each child in `nextChildren`, but
|
14334 | // `lastIndex` will be the last index visited in `prevChildren`.
|
14335 | var lastIndex = 0;
|
14336 | var nextIndex = 0;
|
14337 | for (name in nextChildren) {
|
14338 | if (!nextChildren.hasOwnProperty(name)) {
|
14339 | continue;
|
14340 | }
|
14341 | var prevChild = prevChildren && prevChildren[name];
|
14342 | var nextChild = nextChildren[name];
|
14343 | if (prevChild === nextChild) {
|
14344 | this.moveChild(prevChild, nextIndex, lastIndex);
|
14345 | lastIndex = Math.max(prevChild._mountIndex, lastIndex);
|
14346 | prevChild._mountIndex = nextIndex;
|
14347 | } else {
|
14348 | if (prevChild) {
|
14349 | // Update `lastIndex` before `_mountIndex` gets unset by unmounting.
|
14350 | lastIndex = Math.max(prevChild._mountIndex, lastIndex);
|
14351 | this._unmountChild(prevChild);
|
14352 | }
|
14353 | // The child must be instantiated before it's mounted.
|
14354 | this._mountChildByNameAtIndex(nextChild, name, nextIndex, transaction, context);
|
14355 | }
|
14356 | nextIndex++;
|
14357 | }
|
14358 | // Remove children that are no longer present.
|
14359 | for (name in prevChildren) {
|
14360 | if (prevChildren.hasOwnProperty(name) && !(nextChildren && nextChildren.hasOwnProperty(name))) {
|
14361 | this._unmountChild(prevChildren[name]);
|
14362 | }
|
14363 | }
|
14364 | },
|
14365 |
|
14366 | /**
|
14367 | * Unmounts all rendered children. This should be used to clean up children
|
14368 | * when this component is unmounted.
|
14369 | *
|
14370 | * @internal
|
14371 | */
|
14372 | unmountChildren: function () {
|
14373 | var renderedChildren = this._renderedChildren;
|
14374 | ReactChildReconciler.unmountChildren(renderedChildren);
|
14375 | this._renderedChildren = null;
|
14376 | },
|
14377 |
|
14378 | /**
|
14379 | * Moves a child component to the supplied index.
|
14380 | *
|
14381 | * @param {ReactComponent} child Component to move.
|
14382 | * @param {number} toIndex Destination index of the element.
|
14383 | * @param {number} lastIndex Last index visited of the siblings of `child`.
|
14384 | * @protected
|
14385 | */
|
14386 | moveChild: function (child, toIndex, lastIndex) {
|
14387 | // If the index of `child` is less than `lastIndex`, then it needs to
|
14388 | // be moved. Otherwise, we do not need to move it because a child will be
|
14389 | // inserted or moved before `child`.
|
14390 | if (child._mountIndex < lastIndex) {
|
14391 | enqueueMove(this._rootNodeID, child._mountIndex, toIndex);
|
14392 | }
|
14393 | },
|
14394 |
|
14395 | /**
|
14396 | * Creates a child component.
|
14397 | *
|
14398 | * @param {ReactComponent} child Component to create.
|
14399 | * @param {string} mountImage Markup to insert.
|
14400 | * @protected
|
14401 | */
|
14402 | createChild: function (child, mountImage) {
|
14403 | enqueueInsertMarkup(this._rootNodeID, mountImage, child._mountIndex);
|
14404 | },
|
14405 |
|
14406 | /**
|
14407 | * Removes a child component.
|
14408 | *
|
14409 | * @param {ReactComponent} child Child to remove.
|
14410 | * @protected
|
14411 | */
|
14412 | removeChild: function (child) {
|
14413 | enqueueRemove(this._rootNodeID, child._mountIndex);
|
14414 | },
|
14415 |
|
14416 | /**
|
14417 | * Sets this text content string.
|
14418 | *
|
14419 | * @param {string} textContent Text content to set.
|
14420 | * @protected
|
14421 | */
|
14422 | setTextContent: function (textContent) {
|
14423 | enqueueTextContent(this._rootNodeID, textContent);
|
14424 | },
|
14425 |
|
14426 | /**
|
14427 | * Sets this markup string.
|
14428 | *
|
14429 | * @param {string} markup Markup to set.
|
14430 | * @protected
|
14431 | */
|
14432 | setMarkup: function (markup) {
|
14433 | enqueueSetMarkup(this._rootNodeID, markup);
|
14434 | },
|
14435 |
|
14436 | /**
|
14437 | * Mounts a child with the supplied name.
|
14438 | *
|
14439 | * NOTE: This is part of `updateChildren` and is here for readability.
|
14440 | *
|
14441 | * @param {ReactComponent} child Component to mount.
|
14442 | * @param {string} name Name of the child.
|
14443 | * @param {number} index Index at which to insert the child.
|
14444 | * @param {ReactReconcileTransaction} transaction
|
14445 | * @private
|
14446 | */
|
14447 | _mountChildByNameAtIndex: function (child, name, index, transaction, context) {
|
14448 | // Inlined for performance, see `ReactInstanceHandles.createReactID`.
|
14449 | var rootID = this._rootNodeID + name;
|
14450 | var mountImage = ReactReconciler.mountComponent(child, rootID, transaction, context);
|
14451 | child._mountIndex = index;
|
14452 | this.createChild(child, mountImage);
|
14453 | },
|
14454 |
|
14455 | /**
|
14456 | * Unmounts a rendered child.
|
14457 | *
|
14458 | * NOTE: This is part of `updateChildren` and is here for readability.
|
14459 | *
|
14460 | * @param {ReactComponent} child Component to unmount.
|
14461 | * @private
|
14462 | */
|
14463 | _unmountChild: function (child) {
|
14464 | this.removeChild(child);
|
14465 | child._mountIndex = null;
|
14466 | }
|
14467 |
|
14468 | }
|
14469 |
|
14470 | };
|
14471 |
|
14472 | module.exports = ReactMultiChild;
|
14473 | /* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(5)))
|
14474 |
|
14475 | /***/ },
|
14476 | /* 116 */
|
14477 | /***/ function(module, exports, __webpack_require__) {
|
14478 |
|
14479 | /* WEBPACK VAR INJECTION */(function(process) {/**
|
14480 | * Copyright 2014-2015, Facebook, Inc.
|
14481 | * All rights reserved.
|
14482 | *
|
14483 | * This source code is licensed under the BSD-style license found in the
|
14484 | * LICENSE file in the root directory of this source tree. An additional grant
|
14485 | * of patent rights can be found in the PATENTS file in the same directory.
|
14486 | *
|
14487 | * @providesModule ReactChildReconciler
|
14488 | * @typechecks static-only
|
14489 | */
|
14490 |
|
14491 | 'use strict';
|
14492 |
|
14493 | var ReactReconciler = __webpack_require__(51);
|
14494 |
|
14495 | var instantiateReactComponent = __webpack_require__(63);
|
14496 | var shouldUpdateReactComponent = __webpack_require__(68);
|
14497 | var traverseAllChildren = __webpack_require__(112);
|
14498 | var warning = __webpack_require__(26);
|
14499 |
|
14500 | function instantiateChild(childInstances, child, name) {
|
14501 | // We found a component instance.
|
14502 | var keyUnique = childInstances[name] === undefined;
|
14503 | if (process.env.NODE_ENV !== 'production') {
|
14504 | process.env.NODE_ENV !== 'production' ? warning(keyUnique, 'flattenChildren(...): Encountered two children with the same key, ' + '`%s`. Child keys must be unique; when two children share a key, only ' + 'the first child will be used.', name) : undefined;
|
14505 | }
|
14506 | if (child != null && keyUnique) {
|
14507 | childInstances[name] = instantiateReactComponent(child, null);
|
14508 | }
|
14509 | }
|
14510 |
|
14511 | /**
|
14512 | * ReactChildReconciler provides helpers for initializing or updating a set of
|
14513 | * children. Its output is suitable for passing it onto ReactMultiChild which
|
14514 | * does diffed reordering and insertion.
|
14515 | */
|
14516 | var ReactChildReconciler = {
|
14517 | /**
|
14518 | * Generates a "mount image" for each of the supplied children. In the case
|
14519 | * of `ReactDOMComponent`, a mount image is a string of markup.
|
14520 | *
|
14521 | * @param {?object} nestedChildNodes Nested child maps.
|
14522 | * @return {?object} A set of child instances.
|
14523 | * @internal
|
14524 | */
|
14525 | instantiateChildren: function (nestedChildNodes, transaction, context) {
|
14526 | if (nestedChildNodes == null) {
|
14527 | return null;
|
14528 | }
|
14529 | var childInstances = {};
|
14530 | traverseAllChildren(nestedChildNodes, instantiateChild, childInstances);
|
14531 | return childInstances;
|
14532 | },
|
14533 |
|
14534 | /**
|
14535 | * Updates the rendered children and returns a new set of children.
|
14536 | *
|
14537 | * @param {?object} prevChildren Previously initialized set of children.
|
14538 | * @param {?object} nextChildren Flat child element maps.
|
14539 | * @param {ReactReconcileTransaction} transaction
|
14540 | * @param {object} context
|
14541 | * @return {?object} A new set of child instances.
|
14542 | * @internal
|
14543 | */
|
14544 | updateChildren: function (prevChildren, nextChildren, transaction, context) {
|
14545 | // We currently don't have a way to track moves here but if we use iterators
|
14546 | // instead of for..in we can zip the iterators and check if an item has
|
14547 | // moved.
|
14548 | // TODO: If nothing has changed, return the prevChildren object so that we
|
14549 | // can quickly bailout if nothing has changed.
|
14550 | if (!nextChildren && !prevChildren) {
|
14551 | return null;
|
14552 | }
|
14553 | var name;
|
14554 | for (name in nextChildren) {
|
14555 | if (!nextChildren.hasOwnProperty(name)) {
|
14556 | continue;
|
14557 | }
|
14558 | var prevChild = prevChildren && prevChildren[name];
|
14559 | var prevElement = prevChild && prevChild._currentElement;
|
14560 | var nextElement = nextChildren[name];
|
14561 | if (prevChild != null && shouldUpdateReactComponent(prevElement, nextElement)) {
|
14562 | ReactReconciler.receiveComponent(prevChild, nextElement, transaction, context);
|
14563 | nextChildren[name] = prevChild;
|
14564 | } else {
|
14565 | if (prevChild) {
|
14566 | ReactReconciler.unmountComponent(prevChild, name);
|
14567 | }
|
14568 | // The child must be instantiated before it's mounted.
|
14569 | var nextChildInstance = instantiateReactComponent(nextElement, null);
|
14570 | nextChildren[name] = nextChildInstance;
|
14571 | }
|
14572 | }
|
14573 | // Unmount children that are no longer present.
|
14574 | for (name in prevChildren) {
|
14575 | if (prevChildren.hasOwnProperty(name) && !(nextChildren && nextChildren.hasOwnProperty(name))) {
|
14576 | ReactReconciler.unmountComponent(prevChildren[name]);
|
14577 | }
|
14578 | }
|
14579 | return nextChildren;
|
14580 | },
|
14581 |
|
14582 | /**
|
14583 | * Unmounts all rendered children. This should be used to clean up children
|
14584 | * when this component is unmounted.
|
14585 | *
|
14586 | * @param {?object} renderedChildren Previously initialized set of children.
|
14587 | * @internal
|
14588 | */
|
14589 | unmountChildren: function (renderedChildren) {
|
14590 | for (var name in renderedChildren) {
|
14591 | if (renderedChildren.hasOwnProperty(name)) {
|
14592 | var renderedChild = renderedChildren[name];
|
14593 | ReactReconciler.unmountComponent(renderedChild);
|
14594 | }
|
14595 | }
|
14596 | }
|
14597 |
|
14598 | };
|
14599 |
|
14600 | module.exports = ReactChildReconciler;
|
14601 | /* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(5)))
|
14602 |
|
14603 | /***/ },
|
14604 | /* 117 */
|
14605 | /***/ function(module, exports, __webpack_require__) {
|
14606 |
|
14607 | /* WEBPACK VAR INJECTION */(function(process) {/**
|
14608 | * Copyright 2013-2015, Facebook, Inc.
|
14609 | * All rights reserved.
|
14610 | *
|
14611 | * This source code is licensed under the BSD-style license found in the
|
14612 | * LICENSE file in the root directory of this source tree. An additional grant
|
14613 | * of patent rights can be found in the PATENTS file in the same directory.
|
14614 | *
|
14615 | * @providesModule flattenChildren
|
14616 | */
|
14617 |
|
14618 | 'use strict';
|
14619 |
|
14620 | var traverseAllChildren = __webpack_require__(112);
|
14621 | var warning = __webpack_require__(26);
|
14622 |
|
14623 | /**
|
14624 | * @param {function} traverseContext Context passed through traversal.
|
14625 | * @param {?ReactComponent} child React child component.
|
14626 | * @param {!string} name String name of key path to child.
|
14627 | */
|
14628 | function flattenSingleChildIntoContext(traverseContext, child, name) {
|
14629 | // We found a component instance.
|
14630 | var result = traverseContext;
|
14631 | var keyUnique = result[name] === undefined;
|
14632 | if (process.env.NODE_ENV !== 'production') {
|
14633 | process.env.NODE_ENV !== 'production' ? warning(keyUnique, 'flattenChildren(...): Encountered two children with the same key, ' + '`%s`. Child keys must be unique; when two children share a key, only ' + 'the first child will be used.', name) : undefined;
|
14634 | }
|
14635 | if (keyUnique && child != null) {
|
14636 | result[name] = child;
|
14637 | }
|
14638 | }
|
14639 |
|
14640 | /**
|
14641 | * Flattens children that are typically specified as `props.children`. Any null
|
14642 | * children will not be included in the resulting object.
|
14643 | * @return {!object} flattened children keyed by name.
|
14644 | */
|
14645 | function flattenChildren(children) {
|
14646 | if (children == null) {
|
14647 | return children;
|
14648 | }
|
14649 | var result = {};
|
14650 | traverseAllChildren(children, flattenSingleChildIntoContext, result);
|
14651 | return result;
|
14652 | }
|
14653 |
|
14654 | module.exports = flattenChildren;
|
14655 | /* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(5)))
|
14656 |
|
14657 | /***/ },
|
14658 | /* 118 */
|
14659 | /***/ function(module, exports) {
|
14660 |
|
14661 | /**
|
14662 | * Copyright 2013-2015, Facebook, Inc.
|
14663 | * All rights reserved.
|
14664 | *
|
14665 | * This source code is licensed under the BSD-style license found in the
|
14666 | * LICENSE file in the root directory of this source tree. An additional grant
|
14667 | * of patent rights can be found in the PATENTS file in the same directory.
|
14668 | *
|
14669 | * @providesModule shallowEqual
|
14670 | * @typechecks
|
14671 | *
|
14672 | */
|
14673 |
|
14674 | 'use strict';
|
14675 |
|
14676 | var hasOwnProperty = Object.prototype.hasOwnProperty;
|
14677 |
|
14678 | /**
|
14679 | * Performs equality by iterating through keys on an object and returning false
|
14680 | * when any key has values which are not strictly equal between the arguments.
|
14681 | * Returns true when the values of all keys are strictly equal.
|
14682 | */
|
14683 | function shallowEqual(objA, objB) {
|
14684 | if (objA === objB) {
|
14685 | return true;
|
14686 | }
|
14687 |
|
14688 | if (typeof objA !== 'object' || objA === null || typeof objB !== 'object' || objB === null) {
|
14689 | return false;
|
14690 | }
|
14691 |
|
14692 | var keysA = Object.keys(objA);
|
14693 | var keysB = Object.keys(objB);
|
14694 |
|
14695 | if (keysA.length !== keysB.length) {
|
14696 | return false;
|
14697 | }
|
14698 |
|
14699 | // Test for A's keys different from B.
|
14700 | var bHasOwnProperty = hasOwnProperty.bind(objB);
|
14701 | for (var i = 0; i < keysA.length; i++) {
|
14702 | if (!bHasOwnProperty(keysA[i]) || objA[keysA[i]] !== objB[keysA[i]]) {
|
14703 | return false;
|
14704 | }
|
14705 | }
|
14706 |
|
14707 | return true;
|
14708 | }
|
14709 |
|
14710 | module.exports = shallowEqual;
|
14711 |
|
14712 | /***/ },
|
14713 | /* 119 */
|
14714 | /***/ function(module, exports, __webpack_require__) {
|
14715 |
|
14716 | /**
|
14717 | * Copyright 2013-2015, Facebook, Inc.
|
14718 | * All rights reserved.
|
14719 | *
|
14720 | * This source code is licensed under the BSD-style license found in the
|
14721 | * LICENSE file in the root directory of this source tree. An additional grant
|
14722 | * of patent rights can be found in the PATENTS file in the same directory.
|
14723 | *
|
14724 | * @providesModule ReactEventListener
|
14725 | * @typechecks static-only
|
14726 | */
|
14727 |
|
14728 | 'use strict';
|
14729 |
|
14730 | var EventListener = __webpack_require__(120);
|
14731 | var ExecutionEnvironment = __webpack_require__(10);
|
14732 | var PooledClass = __webpack_require__(57);
|
14733 | var ReactInstanceHandles = __webpack_require__(46);
|
14734 | var ReactMount = __webpack_require__(29);
|
14735 | var ReactUpdates = __webpack_require__(55);
|
14736 |
|
14737 | var assign = __webpack_require__(40);
|
14738 | var getEventTarget = __webpack_require__(82);
|
14739 | var getUnboundedScrollPosition = __webpack_require__(121);
|
14740 |
|
14741 | var DOCUMENT_FRAGMENT_NODE_TYPE = 11;
|
14742 |
|
14743 | /**
|
14744 | * Finds the parent React component of `node`.
|
14745 | *
|
14746 | * @param {*} node
|
14747 | * @return {?DOMEventTarget} Parent container, or `null` if the specified node
|
14748 | * is not nested.
|
14749 | */
|
14750 | function findParent(node) {
|
14751 | // TODO: It may be a good idea to cache this to prevent unnecessary DOM
|
14752 | // traversal, but caching is difficult to do correctly without using a
|
14753 | // mutation observer to listen for all DOM changes.
|
14754 | var nodeID = ReactMount.getID(node);
|
14755 | var rootID = ReactInstanceHandles.getReactRootIDFromNodeID(nodeID);
|
14756 | var container = ReactMount.findReactContainerForID(rootID);
|
14757 | var parent = ReactMount.getFirstReactDOM(container);
|
14758 | return parent;
|
14759 | }
|
14760 |
|
14761 | // Used to store ancestor hierarchy in top level callback
|
14762 | function TopLevelCallbackBookKeeping(topLevelType, nativeEvent) {
|
14763 | this.topLevelType = topLevelType;
|
14764 | this.nativeEvent = nativeEvent;
|
14765 | this.ancestors = [];
|
14766 | }
|
14767 | assign(TopLevelCallbackBookKeeping.prototype, {
|
14768 | destructor: function () {
|
14769 | this.topLevelType = null;
|
14770 | this.nativeEvent = null;
|
14771 | this.ancestors.length = 0;
|
14772 | }
|
14773 | });
|
14774 | PooledClass.addPoolingTo(TopLevelCallbackBookKeeping, PooledClass.twoArgumentPooler);
|
14775 |
|
14776 | function handleTopLevelImpl(bookKeeping) {
|
14777 | // TODO: Re-enable event.path handling
|
14778 | //
|
14779 | // if (bookKeeping.nativeEvent.path && bookKeeping.nativeEvent.path.length > 1) {
|
14780 | // // New browsers have a path attribute on native events
|
14781 | // handleTopLevelWithPath(bookKeeping);
|
14782 | // } else {
|
14783 | // // Legacy browsers don't have a path attribute on native events
|
14784 | // handleTopLevelWithoutPath(bookKeeping);
|
14785 | // }
|
14786 |
|
14787 | void handleTopLevelWithPath; // temporarily unused
|
14788 | handleTopLevelWithoutPath(bookKeeping);
|
14789 | }
|
14790 |
|
14791 | // Legacy browsers don't have a path attribute on native events
|
14792 | function handleTopLevelWithoutPath(bookKeeping) {
|
14793 | var topLevelTarget = ReactMount.getFirstReactDOM(getEventTarget(bookKeeping.nativeEvent)) || window;
|
14794 |
|
14795 | // Loop through the hierarchy, in case there's any nested components.
|
14796 | // It's important that we build the array of ancestors before calling any
|
14797 | // event handlers, because event handlers can modify the DOM, leading to
|
14798 | // inconsistencies with ReactMount's node cache. See #1105.
|
14799 | var ancestor = topLevelTarget;
|
14800 | while (ancestor) {
|
14801 | bookKeeping.ancestors.push(ancestor);
|
14802 | ancestor = findParent(ancestor);
|
14803 | }
|
14804 |
|
14805 | for (var i = 0; i < bookKeeping.ancestors.length; i++) {
|
14806 | topLevelTarget = bookKeeping.ancestors[i];
|
14807 | var topLevelTargetID = ReactMount.getID(topLevelTarget) || '';
|
14808 | ReactEventListener._handleTopLevel(bookKeeping.topLevelType, topLevelTarget, topLevelTargetID, bookKeeping.nativeEvent, getEventTarget(bookKeeping.nativeEvent));
|
14809 | }
|
14810 | }
|
14811 |
|
14812 | // New browsers have a path attribute on native events
|
14813 | function handleTopLevelWithPath(bookKeeping) {
|
14814 | var path = bookKeeping.nativeEvent.path;
|
14815 | var currentNativeTarget = path[0];
|
14816 | var eventsFired = 0;
|
14817 | for (var i = 0; i < path.length; i++) {
|
14818 | var currentPathElement = path[i];
|
14819 | if (currentPathElement.nodeType === DOCUMENT_FRAGMENT_NODE_TYPE) {
|
14820 | currentNativeTarget = path[i + 1];
|
14821 | }
|
14822 | // TODO: slow
|
14823 | var reactParent = ReactMount.getFirstReactDOM(currentPathElement);
|
14824 | if (reactParent === currentPathElement) {
|
14825 | var currentPathElementID = ReactMount.getID(currentPathElement);
|
14826 | var newRootID = ReactInstanceHandles.getReactRootIDFromNodeID(currentPathElementID);
|
14827 | bookKeeping.ancestors.push(currentPathElement);
|
14828 |
|
14829 | var topLevelTargetID = ReactMount.getID(currentPathElement) || '';
|
14830 | eventsFired++;
|
14831 | ReactEventListener._handleTopLevel(bookKeeping.topLevelType, currentPathElement, topLevelTargetID, bookKeeping.nativeEvent, currentNativeTarget);
|
14832 |
|
14833 | // Jump to the root of this React render tree
|
14834 | while (currentPathElementID !== newRootID) {
|
14835 | i++;
|
14836 | currentPathElement = path[i];
|
14837 | currentPathElementID = ReactMount.getID(currentPathElement);
|
14838 | }
|
14839 | }
|
14840 | }
|
14841 | if (eventsFired === 0) {
|
14842 | ReactEventListener._handleTopLevel(bookKeeping.topLevelType, window, '', bookKeeping.nativeEvent, getEventTarget(bookKeeping.nativeEvent));
|
14843 | }
|
14844 | }
|
14845 |
|
14846 | function scrollValueMonitor(cb) {
|
14847 | var scrollPosition = getUnboundedScrollPosition(window);
|
14848 | cb(scrollPosition);
|
14849 | }
|
14850 |
|
14851 | var ReactEventListener = {
|
14852 | _enabled: true,
|
14853 | _handleTopLevel: null,
|
14854 |
|
14855 | WINDOW_HANDLE: ExecutionEnvironment.canUseDOM ? window : null,
|
14856 |
|
14857 | setHandleTopLevel: function (handleTopLevel) {
|
14858 | ReactEventListener._handleTopLevel = handleTopLevel;
|
14859 | },
|
14860 |
|
14861 | setEnabled: function (enabled) {
|
14862 | ReactEventListener._enabled = !!enabled;
|
14863 | },
|
14864 |
|
14865 | isEnabled: function () {
|
14866 | return ReactEventListener._enabled;
|
14867 | },
|
14868 |
|
14869 | /**
|
14870 | * Traps top-level events by using event bubbling.
|
14871 | *
|
14872 | * @param {string} topLevelType Record from `EventConstants`.
|
14873 | * @param {string} handlerBaseName Event name (e.g. "click").
|
14874 | * @param {object} handle Element on which to attach listener.
|
14875 | * @return {?object} An object with a remove function which will forcefully
|
14876 | * remove the listener.
|
14877 | * @internal
|
14878 | */
|
14879 | trapBubbledEvent: function (topLevelType, handlerBaseName, handle) {
|
14880 | var element = handle;
|
14881 | if (!element) {
|
14882 | return null;
|
14883 | }
|
14884 | return EventListener.listen(element, handlerBaseName, ReactEventListener.dispatchEvent.bind(null, topLevelType));
|
14885 | },
|
14886 |
|
14887 | /**
|
14888 | * Traps a top-level event by using event capturing.
|
14889 | *
|
14890 | * @param {string} topLevelType Record from `EventConstants`.
|
14891 | * @param {string} handlerBaseName Event name (e.g. "click").
|
14892 | * @param {object} handle Element on which to attach listener.
|
14893 | * @return {?object} An object with a remove function which will forcefully
|
14894 | * remove the listener.
|
14895 | * @internal
|
14896 | */
|
14897 | trapCapturedEvent: function (topLevelType, handlerBaseName, handle) {
|
14898 | var element = handle;
|
14899 | if (!element) {
|
14900 | return null;
|
14901 | }
|
14902 | return EventListener.capture(element, handlerBaseName, ReactEventListener.dispatchEvent.bind(null, topLevelType));
|
14903 | },
|
14904 |
|
14905 | monitorScrollValue: function (refresh) {
|
14906 | var callback = scrollValueMonitor.bind(null, refresh);
|
14907 | EventListener.listen(window, 'scroll', callback);
|
14908 | },
|
14909 |
|
14910 | dispatchEvent: function (topLevelType, nativeEvent) {
|
14911 | if (!ReactEventListener._enabled) {
|
14912 | return;
|
14913 | }
|
14914 |
|
14915 | var bookKeeping = TopLevelCallbackBookKeeping.getPooled(topLevelType, nativeEvent);
|
14916 | try {
|
14917 | // Event queue being processed in the same cycle allows
|
14918 | // `preventDefault`.
|
14919 | ReactUpdates.batchedUpdates(handleTopLevelImpl, bookKeeping);
|
14920 | } finally {
|
14921 | TopLevelCallbackBookKeeping.release(bookKeeping);
|
14922 | }
|
14923 | }
|
14924 | };
|
14925 |
|
14926 | module.exports = ReactEventListener;
|
14927 |
|
14928 | /***/ },
|
14929 | /* 120 */
|
14930 | /***/ function(module, exports, __webpack_require__) {
|
14931 |
|
14932 | /* WEBPACK VAR INJECTION */(function(process) {/**
|
14933 | * Copyright 2013-2015, Facebook, Inc.
|
14934 | *
|
14935 | * Licensed under the Apache License, Version 2.0 (the "License");
|
14936 | * you may not use this file except in compliance with the License.
|
14937 | * You may obtain a copy of the License at
|
14938 | *
|
14939 | * http://www.apache.org/licenses/LICENSE-2.0
|
14940 | *
|
14941 | * Unless required by applicable law or agreed to in writing, software
|
14942 | * distributed under the License is distributed on an "AS IS" BASIS,
|
14943 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
14944 | * See the License for the specific language governing permissions and
|
14945 | * limitations under the License.
|
14946 | *
|
14947 | * @providesModule EventListener
|
14948 | * @typechecks
|
14949 | */
|
14950 |
|
14951 | 'use strict';
|
14952 |
|
14953 | var emptyFunction = __webpack_require__(16);
|
14954 |
|
14955 | /**
|
14956 | * Upstream version of event listener. Does not take into account specific
|
14957 | * nature of platform.
|
14958 | */
|
14959 | var EventListener = {
|
14960 | /**
|
14961 | * Listen to DOM events during the bubble phase.
|
14962 | *
|
14963 | * @param {DOMEventTarget} target DOM element to register listener on.
|
14964 | * @param {string} eventType Event type, e.g. 'click' or 'mouseover'.
|
14965 | * @param {function} callback Callback function.
|
14966 | * @return {object} Object with a `remove` method.
|
14967 | */
|
14968 | listen: function (target, eventType, callback) {
|
14969 | if (target.addEventListener) {
|
14970 | target.addEventListener(eventType, callback, false);
|
14971 | return {
|
14972 | remove: function () {
|
14973 | target.removeEventListener(eventType, callback, false);
|
14974 | }
|
14975 | };
|
14976 | } else if (target.attachEvent) {
|
14977 | target.attachEvent('on' + eventType, callback);
|
14978 | return {
|
14979 | remove: function () {
|
14980 | target.detachEvent('on' + eventType, callback);
|
14981 | }
|
14982 | };
|
14983 | }
|
14984 | },
|
14985 |
|
14986 | /**
|
14987 | * Listen to DOM events during the capture phase.
|
14988 | *
|
14989 | * @param {DOMEventTarget} target DOM element to register listener on.
|
14990 | * @param {string} eventType Event type, e.g. 'click' or 'mouseover'.
|
14991 | * @param {function} callback Callback function.
|
14992 | * @return {object} Object with a `remove` method.
|
14993 | */
|
14994 | capture: function (target, eventType, callback) {
|
14995 | if (target.addEventListener) {
|
14996 | target.addEventListener(eventType, callback, true);
|
14997 | return {
|
14998 | remove: function () {
|
14999 | target.removeEventListener(eventType, callback, true);
|
15000 | }
|
15001 | };
|
15002 | } else {
|
15003 | if (process.env.NODE_ENV !== 'production') {
|
15004 | console.error('Attempted to listen to events during the capture phase on a ' + 'browser that does not support the capture phase. Your application ' + 'will not receive some events.');
|
15005 | }
|
15006 | return {
|
15007 | remove: emptyFunction
|
15008 | };
|
15009 | }
|
15010 | },
|
15011 |
|
15012 | registerDefault: function () {}
|
15013 | };
|
15014 |
|
15015 | module.exports = EventListener;
|
15016 | /* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(5)))
|
15017 |
|
15018 | /***/ },
|
15019 | /* 121 */
|
15020 | /***/ function(module, exports) {
|
15021 |
|
15022 | /**
|
15023 | * Copyright 2013-2015, Facebook, Inc.
|
15024 | * All rights reserved.
|
15025 | *
|
15026 | * This source code is licensed under the BSD-style license found in the
|
15027 | * LICENSE file in the root directory of this source tree. An additional grant
|
15028 | * of patent rights can be found in the PATENTS file in the same directory.
|
15029 | *
|
15030 | * @providesModule getUnboundedScrollPosition
|
15031 | * @typechecks
|
15032 | */
|
15033 |
|
15034 | 'use strict';
|
15035 |
|
15036 | /**
|
15037 | * Gets the scroll position of the supplied element or window.
|
15038 | *
|
15039 | * The return values are unbounded, unlike `getScrollPosition`. This means they
|
15040 | * may be negative or exceed the element boundaries (which is possible using
|
15041 | * inertial scrolling).
|
15042 | *
|
15043 | * @param {DOMWindow|DOMElement} scrollable
|
15044 | * @return {object} Map with `x` and `y` keys.
|
15045 | */
|
15046 | function getUnboundedScrollPosition(scrollable) {
|
15047 | if (scrollable === window) {
|
15048 | return {
|
15049 | x: window.pageXOffset || document.documentElement.scrollLeft,
|
15050 | y: window.pageYOffset || document.documentElement.scrollTop
|
15051 | };
|
15052 | }
|
15053 | return {
|
15054 | x: scrollable.scrollLeft,
|
15055 | y: scrollable.scrollTop
|
15056 | };
|
15057 | }
|
15058 |
|
15059 | module.exports = getUnboundedScrollPosition;
|
15060 |
|
15061 | /***/ },
|
15062 | /* 122 */
|
15063 | /***/ function(module, exports, __webpack_require__) {
|
15064 |
|
15065 | /**
|
15066 | * Copyright 2013-2015, Facebook, Inc.
|
15067 | * All rights reserved.
|
15068 | *
|
15069 | * This source code is licensed under the BSD-style license found in the
|
15070 | * LICENSE file in the root directory of this source tree. An additional grant
|
15071 | * of patent rights can be found in the PATENTS file in the same directory.
|
15072 | *
|
15073 | * @providesModule ReactInjection
|
15074 | */
|
15075 |
|
15076 | 'use strict';
|
15077 |
|
15078 | var DOMProperty = __webpack_require__(24);
|
15079 | var EventPluginHub = __webpack_require__(32);
|
15080 | var ReactComponentEnvironment = __webpack_require__(65);
|
15081 | var ReactClass = __webpack_require__(123);
|
15082 | var ReactEmptyComponent = __webpack_require__(69);
|
15083 | var ReactBrowserEventEmitter = __webpack_require__(30);
|
15084 | var ReactNativeComponent = __webpack_require__(70);
|
15085 | var ReactPerf = __webpack_require__(19);
|
15086 | var ReactRootIndex = __webpack_require__(47);
|
15087 | var ReactUpdates = __webpack_require__(55);
|
15088 |
|
15089 | var ReactInjection = {
|
15090 | Component: ReactComponentEnvironment.injection,
|
15091 | Class: ReactClass.injection,
|
15092 | DOMProperty: DOMProperty.injection,
|
15093 | EmptyComponent: ReactEmptyComponent.injection,
|
15094 | EventPluginHub: EventPluginHub.injection,
|
15095 | EventEmitter: ReactBrowserEventEmitter.injection,
|
15096 | NativeComponent: ReactNativeComponent.injection,
|
15097 | Perf: ReactPerf.injection,
|
15098 | RootIndex: ReactRootIndex.injection,
|
15099 | Updates: ReactUpdates.injection
|
15100 | };
|
15101 |
|
15102 | module.exports = ReactInjection;
|
15103 |
|
15104 | /***/ },
|
15105 | /* 123 */
|
15106 | /***/ function(module, exports, __webpack_require__) {
|
15107 |
|
15108 | /* WEBPACK VAR INJECTION */(function(process) {/**
|
15109 | * Copyright 2013-2015, Facebook, Inc.
|
15110 | * All rights reserved.
|
15111 | *
|
15112 | * This source code is licensed under the BSD-style license found in the
|
15113 | * LICENSE file in the root directory of this source tree. An additional grant
|
15114 | * of patent rights can be found in the PATENTS file in the same directory.
|
15115 | *
|
15116 | * @providesModule ReactClass
|
15117 | */
|
15118 |
|
15119 | 'use strict';
|
15120 |
|
15121 | var ReactComponent = __webpack_require__(124);
|
15122 | var ReactElement = __webpack_require__(43);
|
15123 | var ReactPropTypeLocations = __webpack_require__(66);
|
15124 | var ReactPropTypeLocationNames = __webpack_require__(67);
|
15125 | var ReactNoopUpdateQueue = __webpack_require__(125);
|
15126 |
|
15127 | var assign = __webpack_require__(40);
|
15128 | var emptyObject = __webpack_require__(59);
|
15129 | var invariant = __webpack_require__(14);
|
15130 | var keyMirror = __webpack_require__(18);
|
15131 | var keyOf = __webpack_require__(80);
|
15132 | var warning = __webpack_require__(26);
|
15133 |
|
15134 | var MIXINS_KEY = keyOf({ mixins: null });
|
15135 |
|
15136 | /**
|
15137 | * Policies that describe methods in `ReactClassInterface`.
|
15138 | */
|
15139 | var SpecPolicy = keyMirror({
|
15140 | /**
|
15141 | * These methods may be defined only once by the class specification or mixin.
|
15142 | */
|
15143 | DEFINE_ONCE: null,
|
15144 | /**
|
15145 | * These methods may be defined by both the class specification and mixins.
|
15146 | * Subsequent definitions will be chained. These methods must return void.
|
15147 | */
|
15148 | DEFINE_MANY: null,
|
15149 | /**
|
15150 | * These methods are overriding the base class.
|
15151 | */
|
15152 | OVERRIDE_BASE: null,
|
15153 | /**
|
15154 | * These methods are similar to DEFINE_MANY, except we assume they return
|
15155 | * objects. We try to merge the keys of the return values of all the mixed in
|
15156 | * functions. If there is a key conflict we throw.
|
15157 | */
|
15158 | DEFINE_MANY_MERGED: null
|
15159 | });
|
15160 |
|
15161 | var injectedMixins = [];
|
15162 |
|
15163 | var warnedSetProps = false;
|
15164 | function warnSetProps() {
|
15165 | if (!warnedSetProps) {
|
15166 | warnedSetProps = true;
|
15167 | process.env.NODE_ENV !== 'production' ? warning(false, 'setProps(...) and replaceProps(...) are deprecated. ' + 'Instead, call render again at the top level.') : undefined;
|
15168 | }
|
15169 | }
|
15170 |
|
15171 | /**
|
15172 | * Composite components are higher-level components that compose other composite
|
15173 | * or native components.
|
15174 | *
|
15175 | * To create a new type of `ReactClass`, pass a specification of
|
15176 | * your new class to `React.createClass`. The only requirement of your class
|
15177 | * specification is that you implement a `render` method.
|
15178 | *
|
15179 | * var MyComponent = React.createClass({
|
15180 | * render: function() {
|
15181 | * return <div>Hello World</div>;
|
15182 | * }
|
15183 | * });
|
15184 | *
|
15185 | * The class specification supports a specific protocol of methods that have
|
15186 | * special meaning (e.g. `render`). See `ReactClassInterface` for
|
15187 | * more the comprehensive protocol. Any other properties and methods in the
|
15188 | * class specification will be available on the prototype.
|
15189 | *
|
15190 | * @interface ReactClassInterface
|
15191 | * @internal
|
15192 | */
|
15193 | var ReactClassInterface = {
|
15194 |
|
15195 | /**
|
15196 | * An array of Mixin objects to include when defining your component.
|
15197 | *
|
15198 | * @type {array}
|
15199 | * @optional
|
15200 | */
|
15201 | mixins: SpecPolicy.DEFINE_MANY,
|
15202 |
|
15203 | /**
|
15204 | * An object containing properties and methods that should be defined on
|
15205 | * the component's constructor instead of its prototype (static methods).
|
15206 | *
|
15207 | * @type {object}
|
15208 | * @optional
|
15209 | */
|
15210 | statics: SpecPolicy.DEFINE_MANY,
|
15211 |
|
15212 | /**
|
15213 | * Definition of prop types for this component.
|
15214 | *
|
15215 | * @type {object}
|
15216 | * @optional
|
15217 | */
|
15218 | propTypes: SpecPolicy.DEFINE_MANY,
|
15219 |
|
15220 | /**
|
15221 | * Definition of context types for this component.
|
15222 | *
|
15223 | * @type {object}
|
15224 | * @optional
|
15225 | */
|
15226 | contextTypes: SpecPolicy.DEFINE_MANY,
|
15227 |
|
15228 | /**
|
15229 | * Definition of context types this component sets for its children.
|
15230 | *
|
15231 | * @type {object}
|
15232 | * @optional
|
15233 | */
|
15234 | childContextTypes: SpecPolicy.DEFINE_MANY,
|
15235 |
|
15236 | // ==== Definition methods ====
|
15237 |
|
15238 | /**
|
15239 | * Invoked when the component is mounted. Values in the mapping will be set on
|
15240 | * `this.props` if that prop is not specified (i.e. using an `in` check).
|
15241 | *
|
15242 | * This method is invoked before `getInitialState` and therefore cannot rely
|
15243 | * on `this.state` or use `this.setState`.
|
15244 | *
|
15245 | * @return {object}
|
15246 | * @optional
|
15247 | */
|
15248 | getDefaultProps: SpecPolicy.DEFINE_MANY_MERGED,
|
15249 |
|
15250 | /**
|
15251 | * Invoked once before the component is mounted. The return value will be used
|
15252 | * as the initial value of `this.state`.
|
15253 | *
|
15254 | * getInitialState: function() {
|
15255 | * return {
|
15256 | * isOn: false,
|
15257 | * fooBaz: new BazFoo()
|
15258 | * }
|
15259 | * }
|
15260 | *
|
15261 | * @return {object}
|
15262 | * @optional
|
15263 | */
|
15264 | getInitialState: SpecPolicy.DEFINE_MANY_MERGED,
|
15265 |
|
15266 | /**
|
15267 | * @return {object}
|
15268 | * @optional
|
15269 | */
|
15270 | getChildContext: SpecPolicy.DEFINE_MANY_MERGED,
|
15271 |
|
15272 | /**
|
15273 | * Uses props from `this.props` and state from `this.state` to render the
|
15274 | * structure of the component.
|
15275 | *
|
15276 | * No guarantees are made about when or how often this method is invoked, so
|
15277 | * it must not have side effects.
|
15278 | *
|
15279 | * render: function() {
|
15280 | * var name = this.props.name;
|
15281 | * return <div>Hello, {name}!</div>;
|
15282 | * }
|
15283 | *
|
15284 | * @return {ReactComponent}
|
15285 | * @nosideeffects
|
15286 | * @required
|
15287 | */
|
15288 | render: SpecPolicy.DEFINE_ONCE,
|
15289 |
|
15290 | // ==== Delegate methods ====
|
15291 |
|
15292 | /**
|
15293 | * Invoked when the component is initially created and about to be mounted.
|
15294 | * This may have side effects, but any external subscriptions or data created
|
15295 | * by this method must be cleaned up in `componentWillUnmount`.
|
15296 | *
|
15297 | * @optional
|
15298 | */
|
15299 | componentWillMount: SpecPolicy.DEFINE_MANY,
|
15300 |
|
15301 | /**
|
15302 | * Invoked when the component has been mounted and has a DOM representation.
|
15303 | * However, there is no guarantee that the DOM node is in the document.
|
15304 | *
|
15305 | * Use this as an opportunity to operate on the DOM when the component has
|
15306 | * been mounted (initialized and rendered) for the first time.
|
15307 | *
|
15308 | * @param {DOMElement} rootNode DOM element representing the component.
|
15309 | * @optional
|
15310 | */
|
15311 | componentDidMount: SpecPolicy.DEFINE_MANY,
|
15312 |
|
15313 | /**
|
15314 | * Invoked before the component receives new props.
|
15315 | *
|
15316 | * Use this as an opportunity to react to a prop transition by updating the
|
15317 | * state using `this.setState`. Current props are accessed via `this.props`.
|
15318 | *
|
15319 | * componentWillReceiveProps: function(nextProps, nextContext) {
|
15320 | * this.setState({
|
15321 | * likesIncreasing: nextProps.likeCount > this.props.likeCount
|
15322 | * });
|
15323 | * }
|
15324 | *
|
15325 | * NOTE: There is no equivalent `componentWillReceiveState`. An incoming prop
|
15326 | * transition may cause a state change, but the opposite is not true. If you
|
15327 | * need it, you are probably looking for `componentWillUpdate`.
|
15328 | *
|
15329 | * @param {object} nextProps
|
15330 | * @optional
|
15331 | */
|
15332 | componentWillReceiveProps: SpecPolicy.DEFINE_MANY,
|
15333 |
|
15334 | /**
|
15335 | * Invoked while deciding if the component should be updated as a result of
|
15336 | * receiving new props, state and/or context.
|
15337 | *
|
15338 | * Use this as an opportunity to `return false` when you're certain that the
|
15339 | * transition to the new props/state/context will not require a component
|
15340 | * update.
|
15341 | *
|
15342 | * shouldComponentUpdate: function(nextProps, nextState, nextContext) {
|
15343 | * return !equal(nextProps, this.props) ||
|
15344 | * !equal(nextState, this.state) ||
|
15345 | * !equal(nextContext, this.context);
|
15346 | * }
|
15347 | *
|
15348 | * @param {object} nextProps
|
15349 | * @param {?object} nextState
|
15350 | * @param {?object} nextContext
|
15351 | * @return {boolean} True if the component should update.
|
15352 | * @optional
|
15353 | */
|
15354 | shouldComponentUpdate: SpecPolicy.DEFINE_ONCE,
|
15355 |
|
15356 | /**
|
15357 | * Invoked when the component is about to update due to a transition from
|
15358 | * `this.props`, `this.state` and `this.context` to `nextProps`, `nextState`
|
15359 | * and `nextContext`.
|
15360 | *
|
15361 | * Use this as an opportunity to perform preparation before an update occurs.
|
15362 | *
|
15363 | * NOTE: You **cannot** use `this.setState()` in this method.
|
15364 | *
|
15365 | * @param {object} nextProps
|
15366 | * @param {?object} nextState
|
15367 | * @param {?object} nextContext
|
15368 | * @param {ReactReconcileTransaction} transaction
|
15369 | * @optional
|
15370 | */
|
15371 | componentWillUpdate: SpecPolicy.DEFINE_MANY,
|
15372 |
|
15373 | /**
|
15374 | * Invoked when the component's DOM representation has been updated.
|
15375 | *
|
15376 | * Use this as an opportunity to operate on the DOM when the component has
|
15377 | * been updated.
|
15378 | *
|
15379 | * @param {object} prevProps
|
15380 | * @param {?object} prevState
|
15381 | * @param {?object} prevContext
|
15382 | * @param {DOMElement} rootNode DOM element representing the component.
|
15383 | * @optional
|
15384 | */
|
15385 | componentDidUpdate: SpecPolicy.DEFINE_MANY,
|
15386 |
|
15387 | /**
|
15388 | * Invoked when the component is about to be removed from its parent and have
|
15389 | * its DOM representation destroyed.
|
15390 | *
|
15391 | * Use this as an opportunity to deallocate any external resources.
|
15392 | *
|
15393 | * NOTE: There is no `componentDidUnmount` since your component will have been
|
15394 | * destroyed by that point.
|
15395 | *
|
15396 | * @optional
|
15397 | */
|
15398 | componentWillUnmount: SpecPolicy.DEFINE_MANY,
|
15399 |
|
15400 | // ==== Advanced methods ====
|
15401 |
|
15402 | /**
|
15403 | * Updates the component's currently mounted DOM representation.
|
15404 | *
|
15405 | * By default, this implements React's rendering and reconciliation algorithm.
|
15406 | * Sophisticated clients may wish to override this.
|
15407 | *
|
15408 | * @param {ReactReconcileTransaction} transaction
|
15409 | * @internal
|
15410 | * @overridable
|
15411 | */
|
15412 | updateComponent: SpecPolicy.OVERRIDE_BASE
|
15413 |
|
15414 | };
|
15415 |
|
15416 | /**
|
15417 | * Mapping from class specification keys to special processing functions.
|
15418 | *
|
15419 | * Although these are declared like instance properties in the specification
|
15420 | * when defining classes using `React.createClass`, they are actually static
|
15421 | * and are accessible on the constructor instead of the prototype. Despite
|
15422 | * being static, they must be defined outside of the "statics" key under
|
15423 | * which all other static methods are defined.
|
15424 | */
|
15425 | var RESERVED_SPEC_KEYS = {
|
15426 | displayName: function (Constructor, displayName) {
|
15427 | Constructor.displayName = displayName;
|
15428 | },
|
15429 | mixins: function (Constructor, mixins) {
|
15430 | if (mixins) {
|
15431 | for (var i = 0; i < mixins.length; i++) {
|
15432 | mixSpecIntoComponent(Constructor, mixins[i]);
|
15433 | }
|
15434 | }
|
15435 | },
|
15436 | childContextTypes: function (Constructor, childContextTypes) {
|
15437 | if (process.env.NODE_ENV !== 'production') {
|
15438 | validateTypeDef(Constructor, childContextTypes, ReactPropTypeLocations.childContext);
|
15439 | }
|
15440 | Constructor.childContextTypes = assign({}, Constructor.childContextTypes, childContextTypes);
|
15441 | },
|
15442 | contextTypes: function (Constructor, contextTypes) {
|
15443 | if (process.env.NODE_ENV !== 'production') {
|
15444 | validateTypeDef(Constructor, contextTypes, ReactPropTypeLocations.context);
|
15445 | }
|
15446 | Constructor.contextTypes = assign({}, Constructor.contextTypes, contextTypes);
|
15447 | },
|
15448 | /**
|
15449 | * Special case getDefaultProps which should move into statics but requires
|
15450 | * automatic merging.
|
15451 | */
|
15452 | getDefaultProps: function (Constructor, getDefaultProps) {
|
15453 | if (Constructor.getDefaultProps) {
|
15454 | Constructor.getDefaultProps = createMergedResultFunction(Constructor.getDefaultProps, getDefaultProps);
|
15455 | } else {
|
15456 | Constructor.getDefaultProps = getDefaultProps;
|
15457 | }
|
15458 | },
|
15459 | propTypes: function (Constructor, propTypes) {
|
15460 | if (process.env.NODE_ENV !== 'production') {
|
15461 | validateTypeDef(Constructor, propTypes, ReactPropTypeLocations.prop);
|
15462 | }
|
15463 | Constructor.propTypes = assign({}, Constructor.propTypes, propTypes);
|
15464 | },
|
15465 | statics: function (Constructor, statics) {
|
15466 | mixStaticSpecIntoComponent(Constructor, statics);
|
15467 | },
|
15468 | autobind: function () {} };
|
15469 |
|
15470 | // noop
|
15471 | function validateTypeDef(Constructor, typeDef, location) {
|
15472 | for (var propName in typeDef) {
|
15473 | if (typeDef.hasOwnProperty(propName)) {
|
15474 | // use a warning instead of an invariant so components
|
15475 | // don't show up in prod but not in __DEV__
|
15476 | process.env.NODE_ENV !== 'production' ? warning(typeof typeDef[propName] === 'function', '%s: %s type `%s` is invalid; it must be a function, usually from ' + 'React.PropTypes.', Constructor.displayName || 'ReactClass', ReactPropTypeLocationNames[location], propName) : undefined;
|
15477 | }
|
15478 | }
|
15479 | }
|
15480 |
|
15481 | function validateMethodOverride(proto, name) {
|
15482 | var specPolicy = ReactClassInterface.hasOwnProperty(name) ? ReactClassInterface[name] : null;
|
15483 |
|
15484 | // Disallow overriding of base class methods unless explicitly allowed.
|
15485 | if (ReactClassMixin.hasOwnProperty(name)) {
|
15486 | !(specPolicy === SpecPolicy.OVERRIDE_BASE) ? process.env.NODE_ENV !== 'production' ? invariant(false, 'ReactClassInterface: You are attempting to override ' + '`%s` from your class specification. Ensure that your method names ' + 'do not overlap with React methods.', name) : invariant(false) : undefined;
|
15487 | }
|
15488 |
|
15489 | // Disallow defining methods more than once unless explicitly allowed.
|
15490 | if (proto.hasOwnProperty(name)) {
|
15491 | !(specPolicy === SpecPolicy.DEFINE_MANY || specPolicy === SpecPolicy.DEFINE_MANY_MERGED) ? process.env.NODE_ENV !== 'production' ? invariant(false, 'ReactClassInterface: You are attempting to define ' + '`%s` on your component more than once. This conflict may be due ' + 'to a mixin.', name) : invariant(false) : undefined;
|
15492 | }
|
15493 | }
|
15494 |
|
15495 | /**
|
15496 | * Mixin helper which handles policy validation and reserved
|
15497 | * specification keys when building React classses.
|
15498 | */
|
15499 | function mixSpecIntoComponent(Constructor, spec) {
|
15500 | if (!spec) {
|
15501 | return;
|
15502 | }
|
15503 |
|
15504 | !(typeof spec !== 'function') ? process.env.NODE_ENV !== 'production' ? invariant(false, 'ReactClass: You\'re attempting to ' + 'use a component class as a mixin. Instead, just use a regular object.') : invariant(false) : undefined;
|
15505 | !!ReactElement.isValidElement(spec) ? process.env.NODE_ENV !== 'production' ? invariant(false, 'ReactClass: You\'re attempting to ' + 'use a component as a mixin. Instead, just use a regular object.') : invariant(false) : undefined;
|
15506 |
|
15507 | var proto = Constructor.prototype;
|
15508 |
|
15509 | // By handling mixins before any other properties, we ensure the same
|
15510 | // chaining order is applied to methods with DEFINE_MANY policy, whether
|
15511 | // mixins are listed before or after these methods in the spec.
|
15512 | if (spec.hasOwnProperty(MIXINS_KEY)) {
|
15513 | RESERVED_SPEC_KEYS.mixins(Constructor, spec.mixins);
|
15514 | }
|
15515 |
|
15516 | for (var name in spec) {
|
15517 | if (!spec.hasOwnProperty(name)) {
|
15518 | continue;
|
15519 | }
|
15520 |
|
15521 | if (name === MIXINS_KEY) {
|
15522 | // We have already handled mixins in a special case above.
|
15523 | continue;
|
15524 | }
|
15525 |
|
15526 | var property = spec[name];
|
15527 | validateMethodOverride(proto, name);
|
15528 |
|
15529 | if (RESERVED_SPEC_KEYS.hasOwnProperty(name)) {
|
15530 | RESERVED_SPEC_KEYS[name](Constructor, property);
|
15531 | } else {
|
15532 | // Setup methods on prototype:
|
15533 | // The following member methods should not be automatically bound:
|
15534 | // 1. Expected ReactClass methods (in the "interface").
|
15535 | // 2. Overridden methods (that were mixed in).
|
15536 | var isReactClassMethod = ReactClassInterface.hasOwnProperty(name);
|
15537 | var isAlreadyDefined = proto.hasOwnProperty(name);
|
15538 | var isFunction = typeof property === 'function';
|
15539 | var shouldAutoBind = isFunction && !isReactClassMethod && !isAlreadyDefined && spec.autobind !== false;
|
15540 |
|
15541 | if (shouldAutoBind) {
|
15542 | if (!proto.__reactAutoBindMap) {
|
15543 | proto.__reactAutoBindMap = {};
|
15544 | }
|
15545 | proto.__reactAutoBindMap[name] = property;
|
15546 | proto[name] = property;
|
15547 | } else {
|
15548 | if (isAlreadyDefined) {
|
15549 | var specPolicy = ReactClassInterface[name];
|
15550 |
|
15551 | // These cases should already be caught by validateMethodOverride.
|
15552 | !(isReactClassMethod && (specPolicy === SpecPolicy.DEFINE_MANY_MERGED || specPolicy === SpecPolicy.DEFINE_MANY)) ? process.env.NODE_ENV !== 'production' ? invariant(false, 'ReactClass: Unexpected spec policy %s for key %s ' + 'when mixing in component specs.', specPolicy, name) : invariant(false) : undefined;
|
15553 |
|
15554 | // For methods which are defined more than once, call the existing
|
15555 | // methods before calling the new property, merging if appropriate.
|
15556 | if (specPolicy === SpecPolicy.DEFINE_MANY_MERGED) {
|
15557 | proto[name] = createMergedResultFunction(proto[name], property);
|
15558 | } else if (specPolicy === SpecPolicy.DEFINE_MANY) {
|
15559 | proto[name] = createChainedFunction(proto[name], property);
|
15560 | }
|
15561 | } else {
|
15562 | proto[name] = property;
|
15563 | if (process.env.NODE_ENV !== 'production') {
|
15564 | // Add verbose displayName to the function, which helps when looking
|
15565 | // at profiling tools.
|
15566 | if (typeof property === 'function' && spec.displayName) {
|
15567 | proto[name].displayName = spec.displayName + '_' + name;
|
15568 | }
|
15569 | }
|
15570 | }
|
15571 | }
|
15572 | }
|
15573 | }
|
15574 | }
|
15575 |
|
15576 | function mixStaticSpecIntoComponent(Constructor, statics) {
|
15577 | if (!statics) {
|
15578 | return;
|
15579 | }
|
15580 | for (var name in statics) {
|
15581 | var property = statics[name];
|
15582 | if (!statics.hasOwnProperty(name)) {
|
15583 | continue;
|
15584 | }
|
15585 |
|
15586 | var isReserved = (name in RESERVED_SPEC_KEYS);
|
15587 | !!isReserved ? process.env.NODE_ENV !== 'production' ? invariant(false, 'ReactClass: You are attempting to define a reserved ' + 'property, `%s`, that shouldn\'t be on the "statics" key. Define it ' + 'as an instance property instead; it will still be accessible on the ' + 'constructor.', name) : invariant(false) : undefined;
|
15588 |
|
15589 | var isInherited = (name in Constructor);
|
15590 | !!isInherited ? process.env.NODE_ENV !== 'production' ? invariant(false, 'ReactClass: You are attempting to define ' + '`%s` on your component more than once. This conflict may be ' + 'due to a mixin.', name) : invariant(false) : undefined;
|
15591 | Constructor[name] = property;
|
15592 | }
|
15593 | }
|
15594 |
|
15595 | /**
|
15596 | * Merge two objects, but throw if both contain the same key.
|
15597 | *
|
15598 | * @param {object} one The first object, which is mutated.
|
15599 | * @param {object} two The second object
|
15600 | * @return {object} one after it has been mutated to contain everything in two.
|
15601 | */
|
15602 | function mergeIntoWithNoDuplicateKeys(one, two) {
|
15603 | !(one && two && typeof one === 'object' && typeof two === 'object') ? process.env.NODE_ENV !== 'production' ? invariant(false, 'mergeIntoWithNoDuplicateKeys(): Cannot merge non-objects.') : invariant(false) : undefined;
|
15604 |
|
15605 | for (var key in two) {
|
15606 | if (two.hasOwnProperty(key)) {
|
15607 | !(one[key] === undefined) ? process.env.NODE_ENV !== 'production' ? invariant(false, 'mergeIntoWithNoDuplicateKeys(): ' + 'Tried to merge two objects with the same key: `%s`. This conflict ' + 'may be due to a mixin; in particular, this may be caused by two ' + 'getInitialState() or getDefaultProps() methods returning objects ' + 'with clashing keys.', key) : invariant(false) : undefined;
|
15608 | one[key] = two[key];
|
15609 | }
|
15610 | }
|
15611 | return one;
|
15612 | }
|
15613 |
|
15614 | /**
|
15615 | * Creates a function that invokes two functions and merges their return values.
|
15616 | *
|
15617 | * @param {function} one Function to invoke first.
|
15618 | * @param {function} two Function to invoke second.
|
15619 | * @return {function} Function that invokes the two argument functions.
|
15620 | * @private
|
15621 | */
|
15622 | function createMergedResultFunction(one, two) {
|
15623 | return function mergedResult() {
|
15624 | var a = one.apply(this, arguments);
|
15625 | var b = two.apply(this, arguments);
|
15626 | if (a == null) {
|
15627 | return b;
|
15628 | } else if (b == null) {
|
15629 | return a;
|
15630 | }
|
15631 | var c = {};
|
15632 | mergeIntoWithNoDuplicateKeys(c, a);
|
15633 | mergeIntoWithNoDuplicateKeys(c, b);
|
15634 | return c;
|
15635 | };
|
15636 | }
|
15637 |
|
15638 | /**
|
15639 | * Creates a function that invokes two functions and ignores their return vales.
|
15640 | *
|
15641 | * @param {function} one Function to invoke first.
|
15642 | * @param {function} two Function to invoke second.
|
15643 | * @return {function} Function that invokes the two argument functions.
|
15644 | * @private
|
15645 | */
|
15646 | function createChainedFunction(one, two) {
|
15647 | return function chainedFunction() {
|
15648 | one.apply(this, arguments);
|
15649 | two.apply(this, arguments);
|
15650 | };
|
15651 | }
|
15652 |
|
15653 | /**
|
15654 | * Binds a method to the component.
|
15655 | *
|
15656 | * @param {object} component Component whose method is going to be bound.
|
15657 | * @param {function} method Method to be bound.
|
15658 | * @return {function} The bound method.
|
15659 | */
|
15660 | function bindAutoBindMethod(component, method) {
|
15661 | var boundMethod = method.bind(component);
|
15662 | if (process.env.NODE_ENV !== 'production') {
|
15663 | boundMethod.__reactBoundContext = component;
|
15664 | boundMethod.__reactBoundMethod = method;
|
15665 | boundMethod.__reactBoundArguments = null;
|
15666 | var componentName = component.constructor.displayName;
|
15667 | var _bind = boundMethod.bind;
|
15668 | /* eslint-disable block-scoped-var, no-undef */
|
15669 | boundMethod.bind = function (newThis) {
|
15670 | for (var _len = arguments.length, args = Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {
|
15671 | args[_key - 1] = arguments[_key];
|
15672 | }
|
15673 |
|
15674 | // User is trying to bind() an autobound method; we effectively will
|
15675 | // ignore the value of "this" that the user is trying to use, so
|
15676 | // let's warn.
|
15677 | if (newThis !== component && newThis !== null) {
|
15678 | process.env.NODE_ENV !== 'production' ? warning(false, 'bind(): React component methods may only be bound to the ' + 'component instance. See %s', componentName) : undefined;
|
15679 | } else if (!args.length) {
|
15680 | process.env.NODE_ENV !== 'production' ? warning(false, 'bind(): You are binding a component method to the component. ' + 'React does this for you automatically in a high-performance ' + 'way, so you can safely remove this call. See %s', componentName) : undefined;
|
15681 | return boundMethod;
|
15682 | }
|
15683 | var reboundMethod = _bind.apply(boundMethod, arguments);
|
15684 | reboundMethod.__reactBoundContext = component;
|
15685 | reboundMethod.__reactBoundMethod = method;
|
15686 | reboundMethod.__reactBoundArguments = args;
|
15687 | return reboundMethod;
|
15688 | /* eslint-enable */
|
15689 | };
|
15690 | }
|
15691 | return boundMethod;
|
15692 | }
|
15693 |
|
15694 | /**
|
15695 | * Binds all auto-bound methods in a component.
|
15696 | *
|
15697 | * @param {object} component Component whose method is going to be bound.
|
15698 | */
|
15699 | function bindAutoBindMethods(component) {
|
15700 | for (var autoBindKey in component.__reactAutoBindMap) {
|
15701 | if (component.__reactAutoBindMap.hasOwnProperty(autoBindKey)) {
|
15702 | var method = component.__reactAutoBindMap[autoBindKey];
|
15703 | component[autoBindKey] = bindAutoBindMethod(component, method);
|
15704 | }
|
15705 | }
|
15706 | }
|
15707 |
|
15708 | /**
|
15709 | * Add more to the ReactClass base class. These are all legacy features and
|
15710 | * therefore not already part of the modern ReactComponent.
|
15711 | */
|
15712 | var ReactClassMixin = {
|
15713 |
|
15714 | /**
|
15715 | * TODO: This will be deprecated because state should always keep a consistent
|
15716 | * type signature and the only use case for this, is to avoid that.
|
15717 | */
|
15718 | replaceState: function (newState, callback) {
|
15719 | this.updater.enqueueReplaceState(this, newState);
|
15720 | if (callback) {
|
15721 | this.updater.enqueueCallback(this, callback);
|
15722 | }
|
15723 | },
|
15724 |
|
15725 | /**
|
15726 | * Checks whether or not this composite component is mounted.
|
15727 | * @return {boolean} True if mounted, false otherwise.
|
15728 | * @protected
|
15729 | * @final
|
15730 | */
|
15731 | isMounted: function () {
|
15732 | return this.updater.isMounted(this);
|
15733 | },
|
15734 |
|
15735 | /**
|
15736 | * Sets a subset of the props.
|
15737 | *
|
15738 | * @param {object} partialProps Subset of the next props.
|
15739 | * @param {?function} callback Called after props are updated.
|
15740 | * @final
|
15741 | * @public
|
15742 | * @deprecated
|
15743 | */
|
15744 | setProps: function (partialProps, callback) {
|
15745 | if (process.env.NODE_ENV !== 'production') {
|
15746 | warnSetProps();
|
15747 | }
|
15748 | this.updater.enqueueSetProps(this, partialProps);
|
15749 | if (callback) {
|
15750 | this.updater.enqueueCallback(this, callback);
|
15751 | }
|
15752 | },
|
15753 |
|
15754 | /**
|
15755 | * Replace all the props.
|
15756 | *
|
15757 | * @param {object} newProps Subset of the next props.
|
15758 | * @param {?function} callback Called after props are updated.
|
15759 | * @final
|
15760 | * @public
|
15761 | * @deprecated
|
15762 | */
|
15763 | replaceProps: function (newProps, callback) {
|
15764 | if (process.env.NODE_ENV !== 'production') {
|
15765 | warnSetProps();
|
15766 | }
|
15767 | this.updater.enqueueReplaceProps(this, newProps);
|
15768 | if (callback) {
|
15769 | this.updater.enqueueCallback(this, callback);
|
15770 | }
|
15771 | }
|
15772 | };
|
15773 |
|
15774 | var ReactClassComponent = function () {};
|
15775 | assign(ReactClassComponent.prototype, ReactComponent.prototype, ReactClassMixin);
|
15776 |
|
15777 | /**
|
15778 | * Module for creating composite components.
|
15779 | *
|
15780 | * @class ReactClass
|
15781 | */
|
15782 | var ReactClass = {
|
15783 |
|
15784 | /**
|
15785 | * Creates a composite component class given a class specification.
|
15786 | *
|
15787 | * @param {object} spec Class specification (which must define `render`).
|
15788 | * @return {function} Component constructor function.
|
15789 | * @public
|
15790 | */
|
15791 | createClass: function (spec) {
|
15792 | var Constructor = function (props, context, updater) {
|
15793 | // This constructor is overridden by mocks. The argument is used
|
15794 | // by mocks to assert on what gets mounted.
|
15795 |
|
15796 | if (process.env.NODE_ENV !== 'production') {
|
15797 | process.env.NODE_ENV !== 'production' ? warning(this instanceof Constructor, 'Something is calling a React component directly. Use a factory or ' + 'JSX instead. See: https://fb.me/react-legacyfactory') : undefined;
|
15798 | }
|
15799 |
|
15800 | // Wire up auto-binding
|
15801 | if (this.__reactAutoBindMap) {
|
15802 | bindAutoBindMethods(this);
|
15803 | }
|
15804 |
|
15805 | this.props = props;
|
15806 | this.context = context;
|
15807 | this.refs = emptyObject;
|
15808 | this.updater = updater || ReactNoopUpdateQueue;
|
15809 |
|
15810 | this.state = null;
|
15811 |
|
15812 | // ReactClasses doesn't have constructors. Instead, they use the
|
15813 | // getInitialState and componentWillMount methods for initialization.
|
15814 |
|
15815 | var initialState = this.getInitialState ? this.getInitialState() : null;
|
15816 | if (process.env.NODE_ENV !== 'production') {
|
15817 | // We allow auto-mocks to proceed as if they're returning null.
|
15818 | if (typeof initialState === 'undefined' && this.getInitialState._isMockFunction) {
|
15819 | // This is probably bad practice. Consider warning here and
|
15820 | // deprecating this convenience.
|
15821 | initialState = null;
|
15822 | }
|
15823 | }
|
15824 | !(typeof initialState === 'object' && !Array.isArray(initialState)) ? process.env.NODE_ENV !== 'production' ? invariant(false, '%s.getInitialState(): must return an object or null', Constructor.displayName || 'ReactCompositeComponent') : invariant(false) : undefined;
|
15825 |
|
15826 | this.state = initialState;
|
15827 | };
|
15828 | Constructor.prototype = new ReactClassComponent();
|
15829 | Constructor.prototype.constructor = Constructor;
|
15830 |
|
15831 | injectedMixins.forEach(mixSpecIntoComponent.bind(null, Constructor));
|
15832 |
|
15833 | mixSpecIntoComponent(Constructor, spec);
|
15834 |
|
15835 | // Initialize the defaultProps property after all mixins have been merged.
|
15836 | if (Constructor.getDefaultProps) {
|
15837 | Constructor.defaultProps = Constructor.getDefaultProps();
|
15838 | }
|
15839 |
|
15840 | if (process.env.NODE_ENV !== 'production') {
|
15841 | // This is a tag to indicate that the use of these method names is ok,
|
15842 | // since it's used with createClass. If it's not, then it's likely a
|
15843 | // mistake so we'll warn you to use the static property, property
|
15844 | // initializer or constructor respectively.
|
15845 | if (Constructor.getDefaultProps) {
|
15846 | Constructor.getDefaultProps.isReactClassApproved = {};
|
15847 | }
|
15848 | if (Constructor.prototype.getInitialState) {
|
15849 | Constructor.prototype.getInitialState.isReactClassApproved = {};
|
15850 | }
|
15851 | }
|
15852 |
|
15853 | !Constructor.prototype.render ? process.env.NODE_ENV !== 'production' ? invariant(false, 'createClass(...): Class specification must implement a `render` method.') : invariant(false) : undefined;
|
15854 |
|
15855 | if (process.env.NODE_ENV !== 'production') {
|
15856 | process.env.NODE_ENV !== 'production' ? warning(!Constructor.prototype.componentShouldUpdate, '%s has a method called ' + 'componentShouldUpdate(). Did you mean shouldComponentUpdate()? ' + 'The name is phrased as a question because the function is ' + 'expected to return a value.', spec.displayName || 'A component') : undefined;
|
15857 | process.env.NODE_ENV !== 'production' ? warning(!Constructor.prototype.componentWillRecieveProps, '%s has a method called ' + 'componentWillRecieveProps(). Did you mean componentWillReceiveProps()?', spec.displayName || 'A component') : undefined;
|
15858 | }
|
15859 |
|
15860 | // Reduce time spent doing lookups by setting these on the prototype.
|
15861 | for (var methodName in ReactClassInterface) {
|
15862 | if (!Constructor.prototype[methodName]) {
|
15863 | Constructor.prototype[methodName] = null;
|
15864 | }
|
15865 | }
|
15866 |
|
15867 | return Constructor;
|
15868 | },
|
15869 |
|
15870 | injection: {
|
15871 | injectMixin: function (mixin) {
|
15872 | injectedMixins.push(mixin);
|
15873 | }
|
15874 | }
|
15875 |
|
15876 | };
|
15877 |
|
15878 | module.exports = ReactClass;
|
15879 | /* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(5)))
|
15880 |
|
15881 | /***/ },
|
15882 | /* 124 */
|
15883 | /***/ function(module, exports, __webpack_require__) {
|
15884 |
|
15885 | /* WEBPACK VAR INJECTION */(function(process) {/**
|
15886 | * Copyright 2013-2015, Facebook, Inc.
|
15887 | * All rights reserved.
|
15888 | *
|
15889 | * This source code is licensed under the BSD-style license found in the
|
15890 | * LICENSE file in the root directory of this source tree. An additional grant
|
15891 | * of patent rights can be found in the PATENTS file in the same directory.
|
15892 | *
|
15893 | * @providesModule ReactComponent
|
15894 | */
|
15895 |
|
15896 | 'use strict';
|
15897 |
|
15898 | var ReactNoopUpdateQueue = __webpack_require__(125);
|
15899 |
|
15900 | var canDefineProperty = __webpack_require__(44);
|
15901 | var emptyObject = __webpack_require__(59);
|
15902 | var invariant = __webpack_require__(14);
|
15903 | var warning = __webpack_require__(26);
|
15904 |
|
15905 | /**
|
15906 | * Base class helpers for the updating state of a component.
|
15907 | */
|
15908 | function ReactComponent(props, context, updater) {
|
15909 | this.props = props;
|
15910 | this.context = context;
|
15911 | this.refs = emptyObject;
|
15912 | // We initialize the default updater but the real one gets injected by the
|
15913 | // renderer.
|
15914 | this.updater = updater || ReactNoopUpdateQueue;
|
15915 | }
|
15916 |
|
15917 | ReactComponent.prototype.isReactComponent = {};
|
15918 |
|
15919 | /**
|
15920 | * Sets a subset of the state. Always use this to mutate
|
15921 | * state. You should treat `this.state` as immutable.
|
15922 | *
|
15923 | * There is no guarantee that `this.state` will be immediately updated, so
|
15924 | * accessing `this.state` after calling this method may return the old value.
|
15925 | *
|
15926 | * There is no guarantee that calls to `setState` will run synchronously,
|
15927 | * as they may eventually be batched together. You can provide an optional
|
15928 | * callback that will be executed when the call to setState is actually
|
15929 | * completed.
|
15930 | *
|
15931 | * When a function is provided to setState, it will be called at some point in
|
15932 | * the future (not synchronously). It will be called with the up to date
|
15933 | * component arguments (state, props, context). These values can be different
|
15934 | * from this.* because your function may be called after receiveProps but before
|
15935 | * shouldComponentUpdate, and this new state, props, and context will not yet be
|
15936 | * assigned to this.
|
15937 | *
|
15938 | * @param {object|function} partialState Next partial state or function to
|
15939 | * produce next partial state to be merged with current state.
|
15940 | * @param {?function} callback Called after state is updated.
|
15941 | * @final
|
15942 | * @protected
|
15943 | */
|
15944 | ReactComponent.prototype.setState = function (partialState, callback) {
|
15945 | !(typeof partialState === 'object' || typeof partialState === 'function' || partialState == null) ? process.env.NODE_ENV !== 'production' ? invariant(false, 'setState(...): takes an object of state variables to update or a ' + 'function which returns an object of state variables.') : invariant(false) : undefined;
|
15946 | if (process.env.NODE_ENV !== 'production') {
|
15947 | process.env.NODE_ENV !== 'production' ? warning(partialState != null, 'setState(...): You passed an undefined or null state object; ' + 'instead, use forceUpdate().') : undefined;
|
15948 | }
|
15949 | this.updater.enqueueSetState(this, partialState);
|
15950 | if (callback) {
|
15951 | this.updater.enqueueCallback(this, callback);
|
15952 | }
|
15953 | };
|
15954 |
|
15955 | /**
|
15956 | * Forces an update. This should only be invoked when it is known with
|
15957 | * certainty that we are **not** in a DOM transaction.
|
15958 | *
|
15959 | * You may want to call this when you know that some deeper aspect of the
|
15960 | * component's state has changed but `setState` was not called.
|
15961 | *
|
15962 | * This will not invoke `shouldComponentUpdate`, but it will invoke
|
15963 | * `componentWillUpdate` and `componentDidUpdate`.
|
15964 | *
|
15965 | * @param {?function} callback Called after update is complete.
|
15966 | * @final
|
15967 | * @protected
|
15968 | */
|
15969 | ReactComponent.prototype.forceUpdate = function (callback) {
|
15970 | this.updater.enqueueForceUpdate(this);
|
15971 | if (callback) {
|
15972 | this.updater.enqueueCallback(this, callback);
|
15973 | }
|
15974 | };
|
15975 |
|
15976 | /**
|
15977 | * Deprecated APIs. These APIs used to exist on classic React classes but since
|
15978 | * we would like to deprecate them, we're not going to move them over to this
|
15979 | * modern base class. Instead, we define a getter that warns if it's accessed.
|
15980 | */
|
15981 | if (process.env.NODE_ENV !== 'production') {
|
15982 | var deprecatedAPIs = {
|
15983 | getDOMNode: ['getDOMNode', 'Use ReactDOM.findDOMNode(component) instead.'],
|
15984 | isMounted: ['isMounted', 'Instead, make sure to clean up subscriptions and pending requests in ' + 'componentWillUnmount to prevent memory leaks.'],
|
15985 | replaceProps: ['replaceProps', 'Instead, call render again at the top level.'],
|
15986 | replaceState: ['replaceState', 'Refactor your code to use setState instead (see ' + 'https://github.com/facebook/react/issues/3236).'],
|
15987 | setProps: ['setProps', 'Instead, call render again at the top level.']
|
15988 | };
|
15989 | var defineDeprecationWarning = function (methodName, info) {
|
15990 | if (canDefineProperty) {
|
15991 | Object.defineProperty(ReactComponent.prototype, methodName, {
|
15992 | get: function () {
|
15993 | process.env.NODE_ENV !== 'production' ? warning(false, '%s(...) is deprecated in plain JavaScript React classes. %s', info[0], info[1]) : undefined;
|
15994 | return undefined;
|
15995 | }
|
15996 | });
|
15997 | }
|
15998 | };
|
15999 | for (var fnName in deprecatedAPIs) {
|
16000 | if (deprecatedAPIs.hasOwnProperty(fnName)) {
|
16001 | defineDeprecationWarning(fnName, deprecatedAPIs[fnName]);
|
16002 | }
|
16003 | }
|
16004 | }
|
16005 |
|
16006 | module.exports = ReactComponent;
|
16007 | /* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(5)))
|
16008 |
|
16009 | /***/ },
|
16010 | /* 125 */
|
16011 | /***/ function(module, exports, __webpack_require__) {
|
16012 |
|
16013 | /* WEBPACK VAR INJECTION */(function(process) {/**
|
16014 | * Copyright 2015, Facebook, Inc.
|
16015 | * All rights reserved.
|
16016 | *
|
16017 | * This source code is licensed under the BSD-style license found in the
|
16018 | * LICENSE file in the root directory of this source tree. An additional grant
|
16019 | * of patent rights can be found in the PATENTS file in the same directory.
|
16020 | *
|
16021 | * @providesModule ReactNoopUpdateQueue
|
16022 | */
|
16023 |
|
16024 | 'use strict';
|
16025 |
|
16026 | var warning = __webpack_require__(26);
|
16027 |
|
16028 | function warnTDZ(publicInstance, callerName) {
|
16029 | if (process.env.NODE_ENV !== 'production') {
|
16030 | process.env.NODE_ENV !== 'production' ? warning(false, '%s(...): Can only update a mounted or mounting component. ' + 'This usually means you called %s() on an unmounted component. ' + 'This is a no-op. Please check the code for the %s component.', callerName, callerName, publicInstance.constructor && publicInstance.constructor.displayName || '') : undefined;
|
16031 | }
|
16032 | }
|
16033 |
|
16034 | /**
|
16035 | * This is the abstract API for an update queue.
|
16036 | */
|
16037 | var ReactNoopUpdateQueue = {
|
16038 |
|
16039 | /**
|
16040 | * Checks whether or not this composite component is mounted.
|
16041 | * @param {ReactClass} publicInstance The instance we want to test.
|
16042 | * @return {boolean} True if mounted, false otherwise.
|
16043 | * @protected
|
16044 | * @final
|
16045 | */
|
16046 | isMounted: function (publicInstance) {
|
16047 | return false;
|
16048 | },
|
16049 |
|
16050 | /**
|
16051 | * Enqueue a callback that will be executed after all the pending updates
|
16052 | * have processed.
|
16053 | *
|
16054 | * @param {ReactClass} publicInstance The instance to use as `this` context.
|
16055 | * @param {?function} callback Called after state is updated.
|
16056 | * @internal
|
16057 | */
|
16058 | enqueueCallback: function (publicInstance, callback) {},
|
16059 |
|
16060 | /**
|
16061 | * Forces an update. This should only be invoked when it is known with
|
16062 | * certainty that we are **not** in a DOM transaction.
|
16063 | *
|
16064 | * You may want to call this when you know that some deeper aspect of the
|
16065 | * component's state has changed but `setState` was not called.
|
16066 | *
|
16067 | * This will not invoke `shouldComponentUpdate`, but it will invoke
|
16068 | * `componentWillUpdate` and `componentDidUpdate`.
|
16069 | *
|
16070 | * @param {ReactClass} publicInstance The instance that should rerender.
|
16071 | * @internal
|
16072 | */
|
16073 | enqueueForceUpdate: function (publicInstance) {
|
16074 | warnTDZ(publicInstance, 'forceUpdate');
|
16075 | },
|
16076 |
|
16077 | /**
|
16078 | * Replaces all of the state. Always use this or `setState` to mutate state.
|
16079 | * You should treat `this.state` as immutable.
|
16080 | *
|
16081 | * There is no guarantee that `this.state` will be immediately updated, so
|
16082 | * accessing `this.state` after calling this method may return the old value.
|
16083 | *
|
16084 | * @param {ReactClass} publicInstance The instance that should rerender.
|
16085 | * @param {object} completeState Next state.
|
16086 | * @internal
|
16087 | */
|
16088 | enqueueReplaceState: function (publicInstance, completeState) {
|
16089 | warnTDZ(publicInstance, 'replaceState');
|
16090 | },
|
16091 |
|
16092 | /**
|
16093 | * Sets a subset of the state. This only exists because _pendingState is
|
16094 | * internal. This provides a merging strategy that is not available to deep
|
16095 | * properties which is confusing. TODO: Expose pendingState or don't use it
|
16096 | * during the merge.
|
16097 | *
|
16098 | * @param {ReactClass} publicInstance The instance that should rerender.
|
16099 | * @param {object} partialState Next partial state to be merged with state.
|
16100 | * @internal
|
16101 | */
|
16102 | enqueueSetState: function (publicInstance, partialState) {
|
16103 | warnTDZ(publicInstance, 'setState');
|
16104 | },
|
16105 |
|
16106 | /**
|
16107 | * Sets a subset of the props.
|
16108 | *
|
16109 | * @param {ReactClass} publicInstance The instance that should rerender.
|
16110 | * @param {object} partialProps Subset of the next props.
|
16111 | * @internal
|
16112 | */
|
16113 | enqueueSetProps: function (publicInstance, partialProps) {
|
16114 | warnTDZ(publicInstance, 'setProps');
|
16115 | },
|
16116 |
|
16117 | /**
|
16118 | * Replaces all of the props.
|
16119 | *
|
16120 | * @param {ReactClass} publicInstance The instance that should rerender.
|
16121 | * @param {object} props New props.
|
16122 | * @internal
|
16123 | */
|
16124 | enqueueReplaceProps: function (publicInstance, props) {
|
16125 | warnTDZ(publicInstance, 'replaceProps');
|
16126 | }
|
16127 |
|
16128 | };
|
16129 |
|
16130 | module.exports = ReactNoopUpdateQueue;
|
16131 | /* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(5)))
|
16132 |
|
16133 | /***/ },
|
16134 | /* 126 */
|
16135 | /***/ function(module, exports, __webpack_require__) {
|
16136 |
|
16137 | /**
|
16138 | * Copyright 2013-2015, Facebook, Inc.
|
16139 | * All rights reserved.
|
16140 | *
|
16141 | * This source code is licensed under the BSD-style license found in the
|
16142 | * LICENSE file in the root directory of this source tree. An additional grant
|
16143 | * of patent rights can be found in the PATENTS file in the same directory.
|
16144 | *
|
16145 | * @providesModule ReactReconcileTransaction
|
16146 | * @typechecks static-only
|
16147 | */
|
16148 |
|
16149 | 'use strict';
|
16150 |
|
16151 | var CallbackQueue = __webpack_require__(56);
|
16152 | var PooledClass = __webpack_require__(57);
|
16153 | var ReactBrowserEventEmitter = __webpack_require__(30);
|
16154 | var ReactDOMFeatureFlags = __webpack_require__(42);
|
16155 | var ReactInputSelection = __webpack_require__(127);
|
16156 | var Transaction = __webpack_require__(58);
|
16157 |
|
16158 | var assign = __webpack_require__(40);
|
16159 |
|
16160 | /**
|
16161 | * Ensures that, when possible, the selection range (currently selected text
|
16162 | * input) is not disturbed by performing the transaction.
|
16163 | */
|
16164 | var SELECTION_RESTORATION = {
|
16165 | /**
|
16166 | * @return {Selection} Selection information.
|
16167 | */
|
16168 | initialize: ReactInputSelection.getSelectionInformation,
|
16169 | /**
|
16170 | * @param {Selection} sel Selection information returned from `initialize`.
|
16171 | */
|
16172 | close: ReactInputSelection.restoreSelection
|
16173 | };
|
16174 |
|
16175 | /**
|
16176 | * Suppresses events (blur/focus) that could be inadvertently dispatched due to
|
16177 | * high level DOM manipulations (like temporarily removing a text input from the
|
16178 | * DOM).
|
16179 | */
|
16180 | var EVENT_SUPPRESSION = {
|
16181 | /**
|
16182 | * @return {boolean} The enabled status of `ReactBrowserEventEmitter` before
|
16183 | * the reconciliation.
|
16184 | */
|
16185 | initialize: function () {
|
16186 | var currentlyEnabled = ReactBrowserEventEmitter.isEnabled();
|
16187 | ReactBrowserEventEmitter.setEnabled(false);
|
16188 | return currentlyEnabled;
|
16189 | },
|
16190 |
|
16191 | /**
|
16192 | * @param {boolean} previouslyEnabled Enabled status of
|
16193 | * `ReactBrowserEventEmitter` before the reconciliation occurred. `close`
|
16194 | * restores the previous value.
|
16195 | */
|
16196 | close: function (previouslyEnabled) {
|
16197 | ReactBrowserEventEmitter.setEnabled(previouslyEnabled);
|
16198 | }
|
16199 | };
|
16200 |
|
16201 | /**
|
16202 | * Provides a queue for collecting `componentDidMount` and
|
16203 | * `componentDidUpdate` callbacks during the the transaction.
|
16204 | */
|
16205 | var ON_DOM_READY_QUEUEING = {
|
16206 | /**
|
16207 | * Initializes the internal `onDOMReady` queue.
|
16208 | */
|
16209 | initialize: function () {
|
16210 | this.reactMountReady.reset();
|
16211 | },
|
16212 |
|
16213 | /**
|
16214 | * After DOM is flushed, invoke all registered `onDOMReady` callbacks.
|
16215 | */
|
16216 | close: function () {
|
16217 | this.reactMountReady.notifyAll();
|
16218 | }
|
16219 | };
|
16220 |
|
16221 | /**
|
16222 | * Executed within the scope of the `Transaction` instance. Consider these as
|
16223 | * being member methods, but with an implied ordering while being isolated from
|
16224 | * each other.
|
16225 | */
|
16226 | var TRANSACTION_WRAPPERS = [SELECTION_RESTORATION, EVENT_SUPPRESSION, ON_DOM_READY_QUEUEING];
|
16227 |
|
16228 | /**
|
16229 | * Currently:
|
16230 | * - The order that these are listed in the transaction is critical:
|
16231 | * - Suppresses events.
|
16232 | * - Restores selection range.
|
16233 | *
|
16234 | * Future:
|
16235 | * - Restore document/overflow scroll positions that were unintentionally
|
16236 | * modified via DOM insertions above the top viewport boundary.
|
16237 | * - Implement/integrate with customized constraint based layout system and keep
|
16238 | * track of which dimensions must be remeasured.
|
16239 | *
|
16240 | * @class ReactReconcileTransaction
|
16241 | */
|
16242 | function ReactReconcileTransaction(forceHTML) {
|
16243 | this.reinitializeTransaction();
|
16244 | // Only server-side rendering really needs this option (see
|
16245 | // `ReactServerRendering`), but server-side uses
|
16246 | // `ReactServerRenderingTransaction` instead. This option is here so that it's
|
16247 | // accessible and defaults to false when `ReactDOMComponent` and
|
16248 | // `ReactTextComponent` checks it in `mountComponent`.`
|
16249 | this.renderToStaticMarkup = false;
|
16250 | this.reactMountReady = CallbackQueue.getPooled(null);
|
16251 | this.useCreateElement = !forceHTML && ReactDOMFeatureFlags.useCreateElement;
|
16252 | }
|
16253 |
|
16254 | var Mixin = {
|
16255 | /**
|
16256 | * @see Transaction
|
16257 | * @abstract
|
16258 | * @final
|
16259 | * @return {array<object>} List of operation wrap procedures.
|
16260 | * TODO: convert to array<TransactionWrapper>
|
16261 | */
|
16262 | getTransactionWrappers: function () {
|
16263 | return TRANSACTION_WRAPPERS;
|
16264 | },
|
16265 |
|
16266 | /**
|
16267 | * @return {object} The queue to collect `onDOMReady` callbacks with.
|
16268 | */
|
16269 | getReactMountReady: function () {
|
16270 | return this.reactMountReady;
|
16271 | },
|
16272 |
|
16273 | /**
|
16274 | * `PooledClass` looks for this, and will invoke this before allowing this
|
16275 | * instance to be reused.
|
16276 | */
|
16277 | destructor: function () {
|
16278 | CallbackQueue.release(this.reactMountReady);
|
16279 | this.reactMountReady = null;
|
16280 | }
|
16281 | };
|
16282 |
|
16283 | assign(ReactReconcileTransaction.prototype, Transaction.Mixin, Mixin);
|
16284 |
|
16285 | PooledClass.addPoolingTo(ReactReconcileTransaction);
|
16286 |
|
16287 | module.exports = ReactReconcileTransaction;
|
16288 |
|
16289 | /***/ },
|
16290 | /* 127 */
|
16291 | /***/ function(module, exports, __webpack_require__) {
|
16292 |
|
16293 | /**
|
16294 | * Copyright 2013-2015, Facebook, Inc.
|
16295 | * All rights reserved.
|
16296 | *
|
16297 | * This source code is licensed under the BSD-style license found in the
|
16298 | * LICENSE file in the root directory of this source tree. An additional grant
|
16299 | * of patent rights can be found in the PATENTS file in the same directory.
|
16300 | *
|
16301 | * @providesModule ReactInputSelection
|
16302 | */
|
16303 |
|
16304 | 'use strict';
|
16305 |
|
16306 | var ReactDOMSelection = __webpack_require__(128);
|
16307 |
|
16308 | var containsNode = __webpack_require__(60);
|
16309 | var focusNode = __webpack_require__(96);
|
16310 | var getActiveElement = __webpack_require__(130);
|
16311 |
|
16312 | function isInDocument(node) {
|
16313 | return containsNode(document.documentElement, node);
|
16314 | }
|
16315 |
|
16316 | /**
|
16317 | * @ReactInputSelection: React input selection module. Based on Selection.js,
|
16318 | * but modified to be suitable for react and has a couple of bug fixes (doesn't
|
16319 | * assume buttons have range selections allowed).
|
16320 | * Input selection module for React.
|
16321 | */
|
16322 | var ReactInputSelection = {
|
16323 |
|
16324 | hasSelectionCapabilities: function (elem) {
|
16325 | var nodeName = elem && elem.nodeName && elem.nodeName.toLowerCase();
|
16326 | return nodeName && (nodeName === 'input' && elem.type === 'text' || nodeName === 'textarea' || elem.contentEditable === 'true');
|
16327 | },
|
16328 |
|
16329 | getSelectionInformation: function () {
|
16330 | var focusedElem = getActiveElement();
|
16331 | return {
|
16332 | focusedElem: focusedElem,
|
16333 | selectionRange: ReactInputSelection.hasSelectionCapabilities(focusedElem) ? ReactInputSelection.getSelection(focusedElem) : null
|
16334 | };
|
16335 | },
|
16336 |
|
16337 | /**
|
16338 | * @restoreSelection: If any selection information was potentially lost,
|
16339 | * restore it. This is useful when performing operations that could remove dom
|
16340 | * nodes and place them back in, resulting in focus being lost.
|
16341 | */
|
16342 | restoreSelection: function (priorSelectionInformation) {
|
16343 | var curFocusedElem = getActiveElement();
|
16344 | var priorFocusedElem = priorSelectionInformation.focusedElem;
|
16345 | var priorSelectionRange = priorSelectionInformation.selectionRange;
|
16346 | if (curFocusedElem !== priorFocusedElem && isInDocument(priorFocusedElem)) {
|
16347 | if (ReactInputSelection.hasSelectionCapabilities(priorFocusedElem)) {
|
16348 | ReactInputSelection.setSelection(priorFocusedElem, priorSelectionRange);
|
16349 | }
|
16350 | focusNode(priorFocusedElem);
|
16351 | }
|
16352 | },
|
16353 |
|
16354 | /**
|
16355 | * @getSelection: Gets the selection bounds of a focused textarea, input or
|
16356 | * contentEditable node.
|
16357 | * -@input: Look up selection bounds of this input
|
16358 | * -@return {start: selectionStart, end: selectionEnd}
|
16359 | */
|
16360 | getSelection: function (input) {
|
16361 | var selection;
|
16362 |
|
16363 | if ('selectionStart' in input) {
|
16364 | // Modern browser with input or textarea.
|
16365 | selection = {
|
16366 | start: input.selectionStart,
|
16367 | end: input.selectionEnd
|
16368 | };
|
16369 | } else if (document.selection && (input.nodeName && input.nodeName.toLowerCase() === 'input')) {
|
16370 | // IE8 input.
|
16371 | var range = document.selection.createRange();
|
16372 | // There can only be one selection per document in IE, so it must
|
16373 | // be in our element.
|
16374 | if (range.parentElement() === input) {
|
16375 | selection = {
|
16376 | start: -range.moveStart('character', -input.value.length),
|
16377 | end: -range.moveEnd('character', -input.value.length)
|
16378 | };
|
16379 | }
|
16380 | } else {
|
16381 | // Content editable or old IE textarea.
|
16382 | selection = ReactDOMSelection.getOffsets(input);
|
16383 | }
|
16384 |
|
16385 | return selection || { start: 0, end: 0 };
|
16386 | },
|
16387 |
|
16388 | /**
|
16389 | * @setSelection: Sets the selection bounds of a textarea or input and focuses
|
16390 | * the input.
|
16391 | * -@input Set selection bounds of this input or textarea
|
16392 | * -@offsets Object of same form that is returned from get*
|
16393 | */
|
16394 | setSelection: function (input, offsets) {
|
16395 | var start = offsets.start;
|
16396 | var end = offsets.end;
|
16397 | if (typeof end === 'undefined') {
|
16398 | end = start;
|
16399 | }
|
16400 |
|
16401 | if ('selectionStart' in input) {
|
16402 | input.selectionStart = start;
|
16403 | input.selectionEnd = Math.min(end, input.value.length);
|
16404 | } else if (document.selection && (input.nodeName && input.nodeName.toLowerCase() === 'input')) {
|
16405 | var range = input.createTextRange();
|
16406 | range.collapse(true);
|
16407 | range.moveStart('character', start);
|
16408 | range.moveEnd('character', end - start);
|
16409 | range.select();
|
16410 | } else {
|
16411 | ReactDOMSelection.setOffsets(input, offsets);
|
16412 | }
|
16413 | }
|
16414 | };
|
16415 |
|
16416 | module.exports = ReactInputSelection;
|
16417 |
|
16418 | /***/ },
|
16419 | /* 128 */
|
16420 | /***/ function(module, exports, __webpack_require__) {
|
16421 |
|
16422 | /**
|
16423 | * Copyright 2013-2015, Facebook, Inc.
|
16424 | * All rights reserved.
|
16425 | *
|
16426 | * This source code is licensed under the BSD-style license found in the
|
16427 | * LICENSE file in the root directory of this source tree. An additional grant
|
16428 | * of patent rights can be found in the PATENTS file in the same directory.
|
16429 | *
|
16430 | * @providesModule ReactDOMSelection
|
16431 | */
|
16432 |
|
16433 | 'use strict';
|
16434 |
|
16435 | var ExecutionEnvironment = __webpack_require__(10);
|
16436 |
|
16437 | var getNodeForCharacterOffset = __webpack_require__(129);
|
16438 | var getTextContentAccessor = __webpack_require__(76);
|
16439 |
|
16440 | /**
|
16441 | * While `isCollapsed` is available on the Selection object and `collapsed`
|
16442 | * is available on the Range object, IE11 sometimes gets them wrong.
|
16443 | * If the anchor/focus nodes and offsets are the same, the range is collapsed.
|
16444 | */
|
16445 | function isCollapsed(anchorNode, anchorOffset, focusNode, focusOffset) {
|
16446 | return anchorNode === focusNode && anchorOffset === focusOffset;
|
16447 | }
|
16448 |
|
16449 | /**
|
16450 | * Get the appropriate anchor and focus node/offset pairs for IE.
|
16451 | *
|
16452 | * The catch here is that IE's selection API doesn't provide information
|
16453 | * about whether the selection is forward or backward, so we have to
|
16454 | * behave as though it's always forward.
|
16455 | *
|
16456 | * IE text differs from modern selection in that it behaves as though
|
16457 | * block elements end with a new line. This means character offsets will
|
16458 | * differ between the two APIs.
|
16459 | *
|
16460 | * @param {DOMElement} node
|
16461 | * @return {object}
|
16462 | */
|
16463 | function getIEOffsets(node) {
|
16464 | var selection = document.selection;
|
16465 | var selectedRange = selection.createRange();
|
16466 | var selectedLength = selectedRange.text.length;
|
16467 |
|
16468 | // Duplicate selection so we can move range without breaking user selection.
|
16469 | var fromStart = selectedRange.duplicate();
|
16470 | fromStart.moveToElementText(node);
|
16471 | fromStart.setEndPoint('EndToStart', selectedRange);
|
16472 |
|
16473 | var startOffset = fromStart.text.length;
|
16474 | var endOffset = startOffset + selectedLength;
|
16475 |
|
16476 | return {
|
16477 | start: startOffset,
|
16478 | end: endOffset
|
16479 | };
|
16480 | }
|
16481 |
|
16482 | /**
|
16483 | * @param {DOMElement} node
|
16484 | * @return {?object}
|
16485 | */
|
16486 | function getModernOffsets(node) {
|
16487 | var selection = window.getSelection && window.getSelection();
|
16488 |
|
16489 | if (!selection || selection.rangeCount === 0) {
|
16490 | return null;
|
16491 | }
|
16492 |
|
16493 | var anchorNode = selection.anchorNode;
|
16494 | var anchorOffset = selection.anchorOffset;
|
16495 | var focusNode = selection.focusNode;
|
16496 | var focusOffset = selection.focusOffset;
|
16497 |
|
16498 | var currentRange = selection.getRangeAt(0);
|
16499 |
|
16500 | // In Firefox, range.startContainer and range.endContainer can be "anonymous
|
16501 | // divs", e.g. the up/down buttons on an <input type="number">. Anonymous
|
16502 | // divs do not seem to expose properties, triggering a "Permission denied
|
16503 | // error" if any of its properties are accessed. The only seemingly possible
|
16504 | // way to avoid erroring is to access a property that typically works for
|
16505 | // non-anonymous divs and catch any error that may otherwise arise. See
|
16506 | // https://bugzilla.mozilla.org/show_bug.cgi?id=208427
|
16507 | try {
|
16508 | /* eslint-disable no-unused-expressions */
|
16509 | currentRange.startContainer.nodeType;
|
16510 | currentRange.endContainer.nodeType;
|
16511 | /* eslint-enable no-unused-expressions */
|
16512 | } catch (e) {
|
16513 | return null;
|
16514 | }
|
16515 |
|
16516 | // If the node and offset values are the same, the selection is collapsed.
|
16517 | // `Selection.isCollapsed` is available natively, but IE sometimes gets
|
16518 | // this value wrong.
|
16519 | var isSelectionCollapsed = isCollapsed(selection.anchorNode, selection.anchorOffset, selection.focusNode, selection.focusOffset);
|
16520 |
|
16521 | var rangeLength = isSelectionCollapsed ? 0 : currentRange.toString().length;
|
16522 |
|
16523 | var tempRange = currentRange.cloneRange();
|
16524 | tempRange.selectNodeContents(node);
|
16525 | tempRange.setEnd(currentRange.startContainer, currentRange.startOffset);
|
16526 |
|
16527 | var isTempRangeCollapsed = isCollapsed(tempRange.startContainer, tempRange.startOffset, tempRange.endContainer, tempRange.endOffset);
|
16528 |
|
16529 | var start = isTempRangeCollapsed ? 0 : tempRange.toString().length;
|
16530 | var end = start + rangeLength;
|
16531 |
|
16532 | // Detect whether the selection is backward.
|
16533 | var detectionRange = document.createRange();
|
16534 | detectionRange.setStart(anchorNode, anchorOffset);
|
16535 | detectionRange.setEnd(focusNode, focusOffset);
|
16536 | var isBackward = detectionRange.collapsed;
|
16537 |
|
16538 | return {
|
16539 | start: isBackward ? end : start,
|
16540 | end: isBackward ? start : end
|
16541 | };
|
16542 | }
|
16543 |
|
16544 | /**
|
16545 | * @param {DOMElement|DOMTextNode} node
|
16546 | * @param {object} offsets
|
16547 | */
|
16548 | function setIEOffsets(node, offsets) {
|
16549 | var range = document.selection.createRange().duplicate();
|
16550 | var start, end;
|
16551 |
|
16552 | if (typeof offsets.end === 'undefined') {
|
16553 | start = offsets.start;
|
16554 | end = start;
|
16555 | } else if (offsets.start > offsets.end) {
|
16556 | start = offsets.end;
|
16557 | end = offsets.start;
|
16558 | } else {
|
16559 | start = offsets.start;
|
16560 | end = offsets.end;
|
16561 | }
|
16562 |
|
16563 | range.moveToElementText(node);
|
16564 | range.moveStart('character', start);
|
16565 | range.setEndPoint('EndToStart', range);
|
16566 | range.moveEnd('character', end - start);
|
16567 | range.select();
|
16568 | }
|
16569 |
|
16570 | /**
|
16571 | * In modern non-IE browsers, we can support both forward and backward
|
16572 | * selections.
|
16573 | *
|
16574 | * Note: IE10+ supports the Selection object, but it does not support
|
16575 | * the `extend` method, which means that even in modern IE, it's not possible
|
16576 | * to programatically create a backward selection. Thus, for all IE
|
16577 | * versions, we use the old IE API to create our selections.
|
16578 | *
|
16579 | * @param {DOMElement|DOMTextNode} node
|
16580 | * @param {object} offsets
|
16581 | */
|
16582 | function setModernOffsets(node, offsets) {
|
16583 | if (!window.getSelection) {
|
16584 | return;
|
16585 | }
|
16586 |
|
16587 | var selection = window.getSelection();
|
16588 | var length = node[getTextContentAccessor()].length;
|
16589 | var start = Math.min(offsets.start, length);
|
16590 | var end = typeof offsets.end === 'undefined' ? start : Math.min(offsets.end, length);
|
16591 |
|
16592 | // IE 11 uses modern selection, but doesn't support the extend method.
|
16593 | // Flip backward selections, so we can set with a single range.
|
16594 | if (!selection.extend && start > end) {
|
16595 | var temp = end;
|
16596 | end = start;
|
16597 | start = temp;
|
16598 | }
|
16599 |
|
16600 | var startMarker = getNodeForCharacterOffset(node, start);
|
16601 | var endMarker = getNodeForCharacterOffset(node, end);
|
16602 |
|
16603 | if (startMarker && endMarker) {
|
16604 | var range = document.createRange();
|
16605 | range.setStart(startMarker.node, startMarker.offset);
|
16606 | selection.removeAllRanges();
|
16607 |
|
16608 | if (start > end) {
|
16609 | selection.addRange(range);
|
16610 | selection.extend(endMarker.node, endMarker.offset);
|
16611 | } else {
|
16612 | range.setEnd(endMarker.node, endMarker.offset);
|
16613 | selection.addRange(range);
|
16614 | }
|
16615 | }
|
16616 | }
|
16617 |
|
16618 | var useIEOffsets = ExecutionEnvironment.canUseDOM && 'selection' in document && !('getSelection' in window);
|
16619 |
|
16620 | var ReactDOMSelection = {
|
16621 | /**
|
16622 | * @param {DOMElement} node
|
16623 | */
|
16624 | getOffsets: useIEOffsets ? getIEOffsets : getModernOffsets,
|
16625 |
|
16626 | /**
|
16627 | * @param {DOMElement|DOMTextNode} node
|
16628 | * @param {object} offsets
|
16629 | */
|
16630 | setOffsets: useIEOffsets ? setIEOffsets : setModernOffsets
|
16631 | };
|
16632 |
|
16633 | module.exports = ReactDOMSelection;
|
16634 |
|
16635 | /***/ },
|
16636 | /* 129 */
|
16637 | /***/ function(module, exports) {
|
16638 |
|
16639 | /**
|
16640 | * Copyright 2013-2015, Facebook, Inc.
|
16641 | * All rights reserved.
|
16642 | *
|
16643 | * This source code is licensed under the BSD-style license found in the
|
16644 | * LICENSE file in the root directory of this source tree. An additional grant
|
16645 | * of patent rights can be found in the PATENTS file in the same directory.
|
16646 | *
|
16647 | * @providesModule getNodeForCharacterOffset
|
16648 | */
|
16649 |
|
16650 | 'use strict';
|
16651 |
|
16652 | /**
|
16653 | * Given any node return the first leaf node without children.
|
16654 | *
|
16655 | * @param {DOMElement|DOMTextNode} node
|
16656 | * @return {DOMElement|DOMTextNode}
|
16657 | */
|
16658 | function getLeafNode(node) {
|
16659 | while (node && node.firstChild) {
|
16660 | node = node.firstChild;
|
16661 | }
|
16662 | return node;
|
16663 | }
|
16664 |
|
16665 | /**
|
16666 | * Get the next sibling within a container. This will walk up the
|
16667 | * DOM if a node's siblings have been exhausted.
|
16668 | *
|
16669 | * @param {DOMElement|DOMTextNode} node
|
16670 | * @return {?DOMElement|DOMTextNode}
|
16671 | */
|
16672 | function getSiblingNode(node) {
|
16673 | while (node) {
|
16674 | if (node.nextSibling) {
|
16675 | return node.nextSibling;
|
16676 | }
|
16677 | node = node.parentNode;
|
16678 | }
|
16679 | }
|
16680 |
|
16681 | /**
|
16682 | * Get object describing the nodes which contain characters at offset.
|
16683 | *
|
16684 | * @param {DOMElement|DOMTextNode} root
|
16685 | * @param {number} offset
|
16686 | * @return {?object}
|
16687 | */
|
16688 | function getNodeForCharacterOffset(root, offset) {
|
16689 | var node = getLeafNode(root);
|
16690 | var nodeStart = 0;
|
16691 | var nodeEnd = 0;
|
16692 |
|
16693 | while (node) {
|
16694 | if (node.nodeType === 3) {
|
16695 | nodeEnd = nodeStart + node.textContent.length;
|
16696 |
|
16697 | if (nodeStart <= offset && nodeEnd >= offset) {
|
16698 | return {
|
16699 | node: node,
|
16700 | offset: offset - nodeStart
|
16701 | };
|
16702 | }
|
16703 |
|
16704 | nodeStart = nodeEnd;
|
16705 | }
|
16706 |
|
16707 | node = getLeafNode(getSiblingNode(node));
|
16708 | }
|
16709 | }
|
16710 |
|
16711 | module.exports = getNodeForCharacterOffset;
|
16712 |
|
16713 | /***/ },
|
16714 | /* 130 */
|
16715 | /***/ function(module, exports) {
|
16716 |
|
16717 | /**
|
16718 | * Copyright 2013-2015, Facebook, Inc.
|
16719 | * All rights reserved.
|
16720 | *
|
16721 | * This source code is licensed under the BSD-style license found in the
|
16722 | * LICENSE file in the root directory of this source tree. An additional grant
|
16723 | * of patent rights can be found in the PATENTS file in the same directory.
|
16724 | *
|
16725 | * @providesModule getActiveElement
|
16726 | * @typechecks
|
16727 | */
|
16728 |
|
16729 | /* eslint-disable fb-www/typeof-undefined */
|
16730 |
|
16731 | /**
|
16732 | * Same as document.activeElement but wraps in a try-catch block. In IE it is
|
16733 | * not safe to call document.activeElement if there is nothing focused.
|
16734 | *
|
16735 | * The activeElement will be null only if the document or document body is not
|
16736 | * yet defined.
|
16737 | */
|
16738 | 'use strict';
|
16739 |
|
16740 | function getActiveElement() /*?DOMElement*/{
|
16741 | if (typeof document === 'undefined') {
|
16742 | return null;
|
16743 | }
|
16744 | try {
|
16745 | return document.activeElement || document.body;
|
16746 | } catch (e) {
|
16747 | return document.body;
|
16748 | }
|
16749 | }
|
16750 |
|
16751 | module.exports = getActiveElement;
|
16752 |
|
16753 | /***/ },
|
16754 | /* 131 */
|
16755 | /***/ function(module, exports, __webpack_require__) {
|
16756 |
|
16757 | /**
|
16758 | * Copyright 2013-2015, Facebook, Inc.
|
16759 | * All rights reserved.
|
16760 | *
|
16761 | * This source code is licensed under the BSD-style license found in the
|
16762 | * LICENSE file in the root directory of this source tree. An additional grant
|
16763 | * of patent rights can be found in the PATENTS file in the same directory.
|
16764 | *
|
16765 | * @providesModule SelectEventPlugin
|
16766 | */
|
16767 |
|
16768 | 'use strict';
|
16769 |
|
16770 | var EventConstants = __webpack_require__(31);
|
16771 | var EventPropagators = __webpack_require__(74);
|
16772 | var ExecutionEnvironment = __webpack_require__(10);
|
16773 | var ReactInputSelection = __webpack_require__(127);
|
16774 | var SyntheticEvent = __webpack_require__(78);
|
16775 |
|
16776 | var getActiveElement = __webpack_require__(130);
|
16777 | var isTextInputElement = __webpack_require__(83);
|
16778 | var keyOf = __webpack_require__(80);
|
16779 | var shallowEqual = __webpack_require__(118);
|
16780 |
|
16781 | var topLevelTypes = EventConstants.topLevelTypes;
|
16782 |
|
16783 | var skipSelectionChangeEvent = ExecutionEnvironment.canUseDOM && 'documentMode' in document && document.documentMode <= 11;
|
16784 |
|
16785 | var eventTypes = {
|
16786 | select: {
|
16787 | phasedRegistrationNames: {
|
16788 | bubbled: keyOf({ onSelect: null }),
|
16789 | captured: keyOf({ onSelectCapture: null })
|
16790 | },
|
16791 | dependencies: [topLevelTypes.topBlur, topLevelTypes.topContextMenu, topLevelTypes.topFocus, topLevelTypes.topKeyDown, topLevelTypes.topMouseDown, topLevelTypes.topMouseUp, topLevelTypes.topSelectionChange]
|
16792 | }
|
16793 | };
|
16794 |
|
16795 | var activeElement = null;
|
16796 | var activeElementID = null;
|
16797 | var lastSelection = null;
|
16798 | var mouseDown = false;
|
16799 |
|
16800 | // Track whether a listener exists for this plugin. If none exist, we do
|
16801 | // not extract events.
|
16802 | var hasListener = false;
|
16803 | var ON_SELECT_KEY = keyOf({ onSelect: null });
|
16804 |
|
16805 | /**
|
16806 | * Get an object which is a unique representation of the current selection.
|
16807 | *
|
16808 | * The return value will not be consistent across nodes or browsers, but
|
16809 | * two identical selections on the same node will return identical objects.
|
16810 | *
|
16811 | * @param {DOMElement} node
|
16812 | * @return {object}
|
16813 | */
|
16814 | function getSelection(node) {
|
16815 | if ('selectionStart' in node && ReactInputSelection.hasSelectionCapabilities(node)) {
|
16816 | return {
|
16817 | start: node.selectionStart,
|
16818 | end: node.selectionEnd
|
16819 | };
|
16820 | } else if (window.getSelection) {
|
16821 | var selection = window.getSelection();
|
16822 | return {
|
16823 | anchorNode: selection.anchorNode,
|
16824 | anchorOffset: selection.anchorOffset,
|
16825 | focusNode: selection.focusNode,
|
16826 | focusOffset: selection.focusOffset
|
16827 | };
|
16828 | } else if (document.selection) {
|
16829 | var range = document.selection.createRange();
|
16830 | return {
|
16831 | parentElement: range.parentElement(),
|
16832 | text: range.text,
|
16833 | top: range.boundingTop,
|
16834 | left: range.boundingLeft
|
16835 | };
|
16836 | }
|
16837 | }
|
16838 |
|
16839 | /**
|
16840 | * Poll selection to see whether it's changed.
|
16841 | *
|
16842 | * @param {object} nativeEvent
|
16843 | * @return {?SyntheticEvent}
|
16844 | */
|
16845 | function constructSelectEvent(nativeEvent, nativeEventTarget) {
|
16846 | // Ensure we have the right element, and that the user is not dragging a
|
16847 | // selection (this matches native `select` event behavior). In HTML5, select
|
16848 | // fires only on input and textarea thus if there's no focused element we
|
16849 | // won't dispatch.
|
16850 | if (mouseDown || activeElement == null || activeElement !== getActiveElement()) {
|
16851 | return null;
|
16852 | }
|
16853 |
|
16854 | // Only fire when selection has actually changed.
|
16855 | var currentSelection = getSelection(activeElement);
|
16856 | if (!lastSelection || !shallowEqual(lastSelection, currentSelection)) {
|
16857 | lastSelection = currentSelection;
|
16858 |
|
16859 | var syntheticEvent = SyntheticEvent.getPooled(eventTypes.select, activeElementID, nativeEvent, nativeEventTarget);
|
16860 |
|
16861 | syntheticEvent.type = 'select';
|
16862 | syntheticEvent.target = activeElement;
|
16863 |
|
16864 | EventPropagators.accumulateTwoPhaseDispatches(syntheticEvent);
|
16865 |
|
16866 | return syntheticEvent;
|
16867 | }
|
16868 |
|
16869 | return null;
|
16870 | }
|
16871 |
|
16872 | /**
|
16873 | * This plugin creates an `onSelect` event that normalizes select events
|
16874 | * across form elements.
|
16875 | *
|
16876 | * Supported elements are:
|
16877 | * - input (see `isTextInputElement`)
|
16878 | * - textarea
|
16879 | * - contentEditable
|
16880 | *
|
16881 | * This differs from native browser implementations in the following ways:
|
16882 | * - Fires on contentEditable fields as well as inputs.
|
16883 | * - Fires for collapsed selection.
|
16884 | * - Fires after user input.
|
16885 | */
|
16886 | var SelectEventPlugin = {
|
16887 |
|
16888 | eventTypes: eventTypes,
|
16889 |
|
16890 | /**
|
16891 | * @param {string} topLevelType Record from `EventConstants`.
|
16892 | * @param {DOMEventTarget} topLevelTarget The listening component root node.
|
16893 | * @param {string} topLevelTargetID ID of `topLevelTarget`.
|
16894 | * @param {object} nativeEvent Native browser event.
|
16895 | * @return {*} An accumulation of synthetic events.
|
16896 | * @see {EventPluginHub.extractEvents}
|
16897 | */
|
16898 | extractEvents: function (topLevelType, topLevelTarget, topLevelTargetID, nativeEvent, nativeEventTarget) {
|
16899 | if (!hasListener) {
|
16900 | return null;
|
16901 | }
|
16902 |
|
16903 | switch (topLevelType) {
|
16904 | // Track the input node that has focus.
|
16905 | case topLevelTypes.topFocus:
|
16906 | if (isTextInputElement(topLevelTarget) || topLevelTarget.contentEditable === 'true') {
|
16907 | activeElement = topLevelTarget;
|
16908 | activeElementID = topLevelTargetID;
|
16909 | lastSelection = null;
|
16910 | }
|
16911 | break;
|
16912 | case topLevelTypes.topBlur:
|
16913 | activeElement = null;
|
16914 | activeElementID = null;
|
16915 | lastSelection = null;
|
16916 | break;
|
16917 |
|
16918 | // Don't fire the event while the user is dragging. This matches the
|
16919 | // semantics of the native select event.
|
16920 | case topLevelTypes.topMouseDown:
|
16921 | mouseDown = true;
|
16922 | break;
|
16923 | case topLevelTypes.topContextMenu:
|
16924 | case topLevelTypes.topMouseUp:
|
16925 | mouseDown = false;
|
16926 | return constructSelectEvent(nativeEvent, nativeEventTarget);
|
16927 |
|
16928 | // Chrome and IE fire non-standard event when selection is changed (and
|
16929 | // sometimes when it hasn't). IE's event fires out of order with respect
|
16930 | // to key and input events on deletion, so we discard it.
|
16931 | //
|
16932 | // Firefox doesn't support selectionchange, so check selection status
|
16933 | // after each key entry. The selection changes after keydown and before
|
16934 | // keyup, but we check on keydown as well in the case of holding down a
|
16935 | // key, when multiple keydown events are fired but only one keyup is.
|
16936 | // This is also our approach for IE handling, for the reason above.
|
16937 | case topLevelTypes.topSelectionChange:
|
16938 | if (skipSelectionChangeEvent) {
|
16939 | break;
|
16940 | }
|
16941 | // falls through
|
16942 | case topLevelTypes.topKeyDown:
|
16943 | case topLevelTypes.topKeyUp:
|
16944 | return constructSelectEvent(nativeEvent, nativeEventTarget);
|
16945 | }
|
16946 |
|
16947 | return null;
|
16948 | },
|
16949 |
|
16950 | didPutListener: function (id, registrationName, listener) {
|
16951 | if (registrationName === ON_SELECT_KEY) {
|
16952 | hasListener = true;
|
16953 | }
|
16954 | }
|
16955 | };
|
16956 |
|
16957 | module.exports = SelectEventPlugin;
|
16958 |
|
16959 | /***/ },
|
16960 | /* 132 */
|
16961 | /***/ function(module, exports) {
|
16962 |
|
16963 | /**
|
16964 | * Copyright 2013-2015, Facebook, Inc.
|
16965 | * All rights reserved.
|
16966 | *
|
16967 | * This source code is licensed under the BSD-style license found in the
|
16968 | * LICENSE file in the root directory of this source tree. An additional grant
|
16969 | * of patent rights can be found in the PATENTS file in the same directory.
|
16970 | *
|
16971 | * @providesModule ServerReactRootIndex
|
16972 | * @typechecks
|
16973 | */
|
16974 |
|
16975 | 'use strict';
|
16976 |
|
16977 | /**
|
16978 | * Size of the reactRoot ID space. We generate random numbers for React root
|
16979 | * IDs and if there's a collision the events and DOM update system will
|
16980 | * get confused. In the future we need a way to generate GUIDs but for
|
16981 | * now this will work on a smaller scale.
|
16982 | */
|
16983 | var GLOBAL_MOUNT_POINT_MAX = Math.pow(2, 53);
|
16984 |
|
16985 | var ServerReactRootIndex = {
|
16986 | createReactRootIndex: function () {
|
16987 | return Math.ceil(Math.random() * GLOBAL_MOUNT_POINT_MAX);
|
16988 | }
|
16989 | };
|
16990 |
|
16991 | module.exports = ServerReactRootIndex;
|
16992 |
|
16993 | /***/ },
|
16994 | /* 133 */
|
16995 | /***/ function(module, exports, __webpack_require__) {
|
16996 |
|
16997 | /* WEBPACK VAR INJECTION */(function(process) {/**
|
16998 | * Copyright 2013-2015, Facebook, Inc.
|
16999 | * All rights reserved.
|
17000 | *
|
17001 | * This source code is licensed under the BSD-style license found in the
|
17002 | * LICENSE file in the root directory of this source tree. An additional grant
|
17003 | * of patent rights can be found in the PATENTS file in the same directory.
|
17004 | *
|
17005 | * @providesModule SimpleEventPlugin
|
17006 | */
|
17007 |
|
17008 | 'use strict';
|
17009 |
|
17010 | var EventConstants = __webpack_require__(31);
|
17011 | var EventListener = __webpack_require__(120);
|
17012 | var EventPropagators = __webpack_require__(74);
|
17013 | var ReactMount = __webpack_require__(29);
|
17014 | var SyntheticClipboardEvent = __webpack_require__(134);
|
17015 | var SyntheticEvent = __webpack_require__(78);
|
17016 | var SyntheticFocusEvent = __webpack_require__(135);
|
17017 | var SyntheticKeyboardEvent = __webpack_require__(136);
|
17018 | var SyntheticMouseEvent = __webpack_require__(87);
|
17019 | var SyntheticDragEvent = __webpack_require__(139);
|
17020 | var SyntheticTouchEvent = __webpack_require__(140);
|
17021 | var SyntheticUIEvent = __webpack_require__(88);
|
17022 | var SyntheticWheelEvent = __webpack_require__(141);
|
17023 |
|
17024 | var emptyFunction = __webpack_require__(16);
|
17025 | var getEventCharCode = __webpack_require__(137);
|
17026 | var invariant = __webpack_require__(14);
|
17027 | var keyOf = __webpack_require__(80);
|
17028 |
|
17029 | var topLevelTypes = EventConstants.topLevelTypes;
|
17030 |
|
17031 | var eventTypes = {
|
17032 | abort: {
|
17033 | phasedRegistrationNames: {
|
17034 | bubbled: keyOf({ onAbort: true }),
|
17035 | captured: keyOf({ onAbortCapture: true })
|
17036 | }
|
17037 | },
|
17038 | blur: {
|
17039 | phasedRegistrationNames: {
|
17040 | bubbled: keyOf({ onBlur: true }),
|
17041 | captured: keyOf({ onBlurCapture: true })
|
17042 | }
|
17043 | },
|
17044 | canPlay: {
|
17045 | phasedRegistrationNames: {
|
17046 | bubbled: keyOf({ onCanPlay: true }),
|
17047 | captured: keyOf({ onCanPlayCapture: true })
|
17048 | }
|
17049 | },
|
17050 | canPlayThrough: {
|
17051 | phasedRegistrationNames: {
|
17052 | bubbled: keyOf({ onCanPlayThrough: true }),
|
17053 | captured: keyOf({ onCanPlayThroughCapture: true })
|
17054 | }
|
17055 | },
|
17056 | click: {
|
17057 | phasedRegistrationNames: {
|
17058 | bubbled: keyOf({ onClick: true }),
|
17059 | captured: keyOf({ onClickCapture: true })
|
17060 | }
|
17061 | },
|
17062 | contextMenu: {
|
17063 | phasedRegistrationNames: {
|
17064 | bubbled: keyOf({ onContextMenu: true }),
|
17065 | captured: keyOf({ onContextMenuCapture: true })
|
17066 | }
|
17067 | },
|
17068 | copy: {
|
17069 | phasedRegistrationNames: {
|
17070 | bubbled: keyOf({ onCopy: true }),
|
17071 | captured: keyOf({ onCopyCapture: true })
|
17072 | }
|
17073 | },
|
17074 | cut: {
|
17075 | phasedRegistrationNames: {
|
17076 | bubbled: keyOf({ onCut: true }),
|
17077 | captured: keyOf({ onCutCapture: true })
|
17078 | }
|
17079 | },
|
17080 | doubleClick: {
|
17081 | phasedRegistrationNames: {
|
17082 | bubbled: keyOf({ onDoubleClick: true }),
|
17083 | captured: keyOf({ onDoubleClickCapture: true })
|
17084 | }
|
17085 | },
|
17086 | drag: {
|
17087 | phasedRegistrationNames: {
|
17088 | bubbled: keyOf({ onDrag: true }),
|
17089 | captured: keyOf({ onDragCapture: true })
|
17090 | }
|
17091 | },
|
17092 | dragEnd: {
|
17093 | phasedRegistrationNames: {
|
17094 | bubbled: keyOf({ onDragEnd: true }),
|
17095 | captured: keyOf({ onDragEndCapture: true })
|
17096 | }
|
17097 | },
|
17098 | dragEnter: {
|
17099 | phasedRegistrationNames: {
|
17100 | bubbled: keyOf({ onDragEnter: true }),
|
17101 | captured: keyOf({ onDragEnterCapture: true })
|
17102 | }
|
17103 | },
|
17104 | dragExit: {
|
17105 | phasedRegistrationNames: {
|
17106 | bubbled: keyOf({ onDragExit: true }),
|
17107 | captured: keyOf({ onDragExitCapture: true })
|
17108 | }
|
17109 | },
|
17110 | dragLeave: {
|
17111 | phasedRegistrationNames: {
|
17112 | bubbled: keyOf({ onDragLeave: true }),
|
17113 | captured: keyOf({ onDragLeaveCapture: true })
|
17114 | }
|
17115 | },
|
17116 | dragOver: {
|
17117 | phasedRegistrationNames: {
|
17118 | bubbled: keyOf({ onDragOver: true }),
|
17119 | captured: keyOf({ onDragOverCapture: true })
|
17120 | }
|
17121 | },
|
17122 | dragStart: {
|
17123 | phasedRegistrationNames: {
|
17124 | bubbled: keyOf({ onDragStart: true }),
|
17125 | captured: keyOf({ onDragStartCapture: true })
|
17126 | }
|
17127 | },
|
17128 | drop: {
|
17129 | phasedRegistrationNames: {
|
17130 | bubbled: keyOf({ onDrop: true }),
|
17131 | captured: keyOf({ onDropCapture: true })
|
17132 | }
|
17133 | },
|
17134 | durationChange: {
|
17135 | phasedRegistrationNames: {
|
17136 | bubbled: keyOf({ onDurationChange: true }),
|
17137 | captured: keyOf({ onDurationChangeCapture: true })
|
17138 | }
|
17139 | },
|
17140 | emptied: {
|
17141 | phasedRegistrationNames: {
|
17142 | bubbled: keyOf({ onEmptied: true }),
|
17143 | captured: keyOf({ onEmptiedCapture: true })
|
17144 | }
|
17145 | },
|
17146 | encrypted: {
|
17147 | phasedRegistrationNames: {
|
17148 | bubbled: keyOf({ onEncrypted: true }),
|
17149 | captured: keyOf({ onEncryptedCapture: true })
|
17150 | }
|
17151 | },
|
17152 | ended: {
|
17153 | phasedRegistrationNames: {
|
17154 | bubbled: keyOf({ onEnded: true }),
|
17155 | captured: keyOf({ onEndedCapture: true })
|
17156 | }
|
17157 | },
|
17158 | error: {
|
17159 | phasedRegistrationNames: {
|
17160 | bubbled: keyOf({ onError: true }),
|
17161 | captured: keyOf({ onErrorCapture: true })
|
17162 | }
|
17163 | },
|
17164 | focus: {
|
17165 | phasedRegistrationNames: {
|
17166 | bubbled: keyOf({ onFocus: true }),
|
17167 | captured: keyOf({ onFocusCapture: true })
|
17168 | }
|
17169 | },
|
17170 | input: {
|
17171 | phasedRegistrationNames: {
|
17172 | bubbled: keyOf({ onInput: true }),
|
17173 | captured: keyOf({ onInputCapture: true })
|
17174 | }
|
17175 | },
|
17176 | keyDown: {
|
17177 | phasedRegistrationNames: {
|
17178 | bubbled: keyOf({ onKeyDown: true }),
|
17179 | captured: keyOf({ onKeyDownCapture: true })
|
17180 | }
|
17181 | },
|
17182 | keyPress: {
|
17183 | phasedRegistrationNames: {
|
17184 | bubbled: keyOf({ onKeyPress: true }),
|
17185 | captured: keyOf({ onKeyPressCapture: true })
|
17186 | }
|
17187 | },
|
17188 | keyUp: {
|
17189 | phasedRegistrationNames: {
|
17190 | bubbled: keyOf({ onKeyUp: true }),
|
17191 | captured: keyOf({ onKeyUpCapture: true })
|
17192 | }
|
17193 | },
|
17194 | load: {
|
17195 | phasedRegistrationNames: {
|
17196 | bubbled: keyOf({ onLoad: true }),
|
17197 | captured: keyOf({ onLoadCapture: true })
|
17198 | }
|
17199 | },
|
17200 | loadedData: {
|
17201 | phasedRegistrationNames: {
|
17202 | bubbled: keyOf({ onLoadedData: true }),
|
17203 | captured: keyOf({ onLoadedDataCapture: true })
|
17204 | }
|
17205 | },
|
17206 | loadedMetadata: {
|
17207 | phasedRegistrationNames: {
|
17208 | bubbled: keyOf({ onLoadedMetadata: true }),
|
17209 | captured: keyOf({ onLoadedMetadataCapture: true })
|
17210 | }
|
17211 | },
|
17212 | loadStart: {
|
17213 | phasedRegistrationNames: {
|
17214 | bubbled: keyOf({ onLoadStart: true }),
|
17215 | captured: keyOf({ onLoadStartCapture: true })
|
17216 | }
|
17217 | },
|
17218 | // Note: We do not allow listening to mouseOver events. Instead, use the
|
17219 | // onMouseEnter/onMouseLeave created by `EnterLeaveEventPlugin`.
|
17220 | mouseDown: {
|
17221 | phasedRegistrationNames: {
|
17222 | bubbled: keyOf({ onMouseDown: true }),
|
17223 | captured: keyOf({ onMouseDownCapture: true })
|
17224 | }
|
17225 | },
|
17226 | mouseMove: {
|
17227 | phasedRegistrationNames: {
|
17228 | bubbled: keyOf({ onMouseMove: true }),
|
17229 | captured: keyOf({ onMouseMoveCapture: true })
|
17230 | }
|
17231 | },
|
17232 | mouseOut: {
|
17233 | phasedRegistrationNames: {
|
17234 | bubbled: keyOf({ onMouseOut: true }),
|
17235 | captured: keyOf({ onMouseOutCapture: true })
|
17236 | }
|
17237 | },
|
17238 | mouseOver: {
|
17239 | phasedRegistrationNames: {
|
17240 | bubbled: keyOf({ onMouseOver: true }),
|
17241 | captured: keyOf({ onMouseOverCapture: true })
|
17242 | }
|
17243 | },
|
17244 | mouseUp: {
|
17245 | phasedRegistrationNames: {
|
17246 | bubbled: keyOf({ onMouseUp: true }),
|
17247 | captured: keyOf({ onMouseUpCapture: true })
|
17248 | }
|
17249 | },
|
17250 | paste: {
|
17251 | phasedRegistrationNames: {
|
17252 | bubbled: keyOf({ onPaste: true }),
|
17253 | captured: keyOf({ onPasteCapture: true })
|
17254 | }
|
17255 | },
|
17256 | pause: {
|
17257 | phasedRegistrationNames: {
|
17258 | bubbled: keyOf({ onPause: true }),
|
17259 | captured: keyOf({ onPauseCapture: true })
|
17260 | }
|
17261 | },
|
17262 | play: {
|
17263 | phasedRegistrationNames: {
|
17264 | bubbled: keyOf({ onPlay: true }),
|
17265 | captured: keyOf({ onPlayCapture: true })
|
17266 | }
|
17267 | },
|
17268 | playing: {
|
17269 | phasedRegistrationNames: {
|
17270 | bubbled: keyOf({ onPlaying: true }),
|
17271 | captured: keyOf({ onPlayingCapture: true })
|
17272 | }
|
17273 | },
|
17274 | progress: {
|
17275 | phasedRegistrationNames: {
|
17276 | bubbled: keyOf({ onProgress: true }),
|
17277 | captured: keyOf({ onProgressCapture: true })
|
17278 | }
|
17279 | },
|
17280 | rateChange: {
|
17281 | phasedRegistrationNames: {
|
17282 | bubbled: keyOf({ onRateChange: true }),
|
17283 | captured: keyOf({ onRateChangeCapture: true })
|
17284 | }
|
17285 | },
|
17286 | reset: {
|
17287 | phasedRegistrationNames: {
|
17288 | bubbled: keyOf({ onReset: true }),
|
17289 | captured: keyOf({ onResetCapture: true })
|
17290 | }
|
17291 | },
|
17292 | scroll: {
|
17293 | phasedRegistrationNames: {
|
17294 | bubbled: keyOf({ onScroll: true }),
|
17295 | captured: keyOf({ onScrollCapture: true })
|
17296 | }
|
17297 | },
|
17298 | seeked: {
|
17299 | phasedRegistrationNames: {
|
17300 | bubbled: keyOf({ onSeeked: true }),
|
17301 | captured: keyOf({ onSeekedCapture: true })
|
17302 | }
|
17303 | },
|
17304 | seeking: {
|
17305 | phasedRegistrationNames: {
|
17306 | bubbled: keyOf({ onSeeking: true }),
|
17307 | captured: keyOf({ onSeekingCapture: true })
|
17308 | }
|
17309 | },
|
17310 | stalled: {
|
17311 | phasedRegistrationNames: {
|
17312 | bubbled: keyOf({ onStalled: true }),
|
17313 | captured: keyOf({ onStalledCapture: true })
|
17314 | }
|
17315 | },
|
17316 | submit: {
|
17317 | phasedRegistrationNames: {
|
17318 | bubbled: keyOf({ onSubmit: true }),
|
17319 | captured: keyOf({ onSubmitCapture: true })
|
17320 | }
|
17321 | },
|
17322 | suspend: {
|
17323 | phasedRegistrationNames: {
|
17324 | bubbled: keyOf({ onSuspend: true }),
|
17325 | captured: keyOf({ onSuspendCapture: true })
|
17326 | }
|
17327 | },
|
17328 | timeUpdate: {
|
17329 | phasedRegistrationNames: {
|
17330 | bubbled: keyOf({ onTimeUpdate: true }),
|
17331 | captured: keyOf({ onTimeUpdateCapture: true })
|
17332 | }
|
17333 | },
|
17334 | touchCancel: {
|
17335 | phasedRegistrationNames: {
|
17336 | bubbled: keyOf({ onTouchCancel: true }),
|
17337 | captured: keyOf({ onTouchCancelCapture: true })
|
17338 | }
|
17339 | },
|
17340 | touchEnd: {
|
17341 | phasedRegistrationNames: {
|
17342 | bubbled: keyOf({ onTouchEnd: true }),
|
17343 | captured: keyOf({ onTouchEndCapture: true })
|
17344 | }
|
17345 | },
|
17346 | touchMove: {
|
17347 | phasedRegistrationNames: {
|
17348 | bubbled: keyOf({ onTouchMove: true }),
|
17349 | captured: keyOf({ onTouchMoveCapture: true })
|
17350 | }
|
17351 | },
|
17352 | touchStart: {
|
17353 | phasedRegistrationNames: {
|
17354 | bubbled: keyOf({ onTouchStart: true }),
|
17355 | captured: keyOf({ onTouchStartCapture: true })
|
17356 | }
|
17357 | },
|
17358 | volumeChange: {
|
17359 | phasedRegistrationNames: {
|
17360 | bubbled: keyOf({ onVolumeChange: true }),
|
17361 | captured: keyOf({ onVolumeChangeCapture: true })
|
17362 | }
|
17363 | },
|
17364 | waiting: {
|
17365 | phasedRegistrationNames: {
|
17366 | bubbled: keyOf({ onWaiting: true }),
|
17367 | captured: keyOf({ onWaitingCapture: true })
|
17368 | }
|
17369 | },
|
17370 | wheel: {
|
17371 | phasedRegistrationNames: {
|
17372 | bubbled: keyOf({ onWheel: true }),
|
17373 | captured: keyOf({ onWheelCapture: true })
|
17374 | }
|
17375 | }
|
17376 | };
|
17377 |
|
17378 | var topLevelEventsToDispatchConfig = {
|
17379 | topAbort: eventTypes.abort,
|
17380 | topBlur: eventTypes.blur,
|
17381 | topCanPlay: eventTypes.canPlay,
|
17382 | topCanPlayThrough: eventTypes.canPlayThrough,
|
17383 | topClick: eventTypes.click,
|
17384 | topContextMenu: eventTypes.contextMenu,
|
17385 | topCopy: eventTypes.copy,
|
17386 | topCut: eventTypes.cut,
|
17387 | topDoubleClick: eventTypes.doubleClick,
|
17388 | topDrag: eventTypes.drag,
|
17389 | topDragEnd: eventTypes.dragEnd,
|
17390 | topDragEnter: eventTypes.dragEnter,
|
17391 | topDragExit: eventTypes.dragExit,
|
17392 | topDragLeave: eventTypes.dragLeave,
|
17393 | topDragOver: eventTypes.dragOver,
|
17394 | topDragStart: eventTypes.dragStart,
|
17395 | topDrop: eventTypes.drop,
|
17396 | topDurationChange: eventTypes.durationChange,
|
17397 | topEmptied: eventTypes.emptied,
|
17398 | topEncrypted: eventTypes.encrypted,
|
17399 | topEnded: eventTypes.ended,
|
17400 | topError: eventTypes.error,
|
17401 | topFocus: eventTypes.focus,
|
17402 | topInput: eventTypes.input,
|
17403 | topKeyDown: eventTypes.keyDown,
|
17404 | topKeyPress: eventTypes.keyPress,
|
17405 | topKeyUp: eventTypes.keyUp,
|
17406 | topLoad: eventTypes.load,
|
17407 | topLoadedData: eventTypes.loadedData,
|
17408 | topLoadedMetadata: eventTypes.loadedMetadata,
|
17409 | topLoadStart: eventTypes.loadStart,
|
17410 | topMouseDown: eventTypes.mouseDown,
|
17411 | topMouseMove: eventTypes.mouseMove,
|
17412 | topMouseOut: eventTypes.mouseOut,
|
17413 | topMouseOver: eventTypes.mouseOver,
|
17414 | topMouseUp: eventTypes.mouseUp,
|
17415 | topPaste: eventTypes.paste,
|
17416 | topPause: eventTypes.pause,
|
17417 | topPlay: eventTypes.play,
|
17418 | topPlaying: eventTypes.playing,
|
17419 | topProgress: eventTypes.progress,
|
17420 | topRateChange: eventTypes.rateChange,
|
17421 | topReset: eventTypes.reset,
|
17422 | topScroll: eventTypes.scroll,
|
17423 | topSeeked: eventTypes.seeked,
|
17424 | topSeeking: eventTypes.seeking,
|
17425 | topStalled: eventTypes.stalled,
|
17426 | topSubmit: eventTypes.submit,
|
17427 | topSuspend: eventTypes.suspend,
|
17428 | topTimeUpdate: eventTypes.timeUpdate,
|
17429 | topTouchCancel: eventTypes.touchCancel,
|
17430 | topTouchEnd: eventTypes.touchEnd,
|
17431 | topTouchMove: eventTypes.touchMove,
|
17432 | topTouchStart: eventTypes.touchStart,
|
17433 | topVolumeChange: eventTypes.volumeChange,
|
17434 | topWaiting: eventTypes.waiting,
|
17435 | topWheel: eventTypes.wheel
|
17436 | };
|
17437 |
|
17438 | for (var type in topLevelEventsToDispatchConfig) {
|
17439 | topLevelEventsToDispatchConfig[type].dependencies = [type];
|
17440 | }
|
17441 |
|
17442 | var ON_CLICK_KEY = keyOf({ onClick: null });
|
17443 | var onClickListeners = {};
|
17444 |
|
17445 | var SimpleEventPlugin = {
|
17446 |
|
17447 | eventTypes: eventTypes,
|
17448 |
|
17449 | /**
|
17450 | * @param {string} topLevelType Record from `EventConstants`.
|
17451 | * @param {DOMEventTarget} topLevelTarget The listening component root node.
|
17452 | * @param {string} topLevelTargetID ID of `topLevelTarget`.
|
17453 | * @param {object} nativeEvent Native browser event.
|
17454 | * @return {*} An accumulation of synthetic events.
|
17455 | * @see {EventPluginHub.extractEvents}
|
17456 | */
|
17457 | extractEvents: function (topLevelType, topLevelTarget, topLevelTargetID, nativeEvent, nativeEventTarget) {
|
17458 | var dispatchConfig = topLevelEventsToDispatchConfig[topLevelType];
|
17459 | if (!dispatchConfig) {
|
17460 | return null;
|
17461 | }
|
17462 | var EventConstructor;
|
17463 | switch (topLevelType) {
|
17464 | case topLevelTypes.topAbort:
|
17465 | case topLevelTypes.topCanPlay:
|
17466 | case topLevelTypes.topCanPlayThrough:
|
17467 | case topLevelTypes.topDurationChange:
|
17468 | case topLevelTypes.topEmptied:
|
17469 | case topLevelTypes.topEncrypted:
|
17470 | case topLevelTypes.topEnded:
|
17471 | case topLevelTypes.topError:
|
17472 | case topLevelTypes.topInput:
|
17473 | case topLevelTypes.topLoad:
|
17474 | case topLevelTypes.topLoadedData:
|
17475 | case topLevelTypes.topLoadedMetadata:
|
17476 | case topLevelTypes.topLoadStart:
|
17477 | case topLevelTypes.topPause:
|
17478 | case topLevelTypes.topPlay:
|
17479 | case topLevelTypes.topPlaying:
|
17480 | case topLevelTypes.topProgress:
|
17481 | case topLevelTypes.topRateChange:
|
17482 | case topLevelTypes.topReset:
|
17483 | case topLevelTypes.topSeeked:
|
17484 | case topLevelTypes.topSeeking:
|
17485 | case topLevelTypes.topStalled:
|
17486 | case topLevelTypes.topSubmit:
|
17487 | case topLevelTypes.topSuspend:
|
17488 | case topLevelTypes.topTimeUpdate:
|
17489 | case topLevelTypes.topVolumeChange:
|
17490 | case topLevelTypes.topWaiting:
|
17491 | // HTML Events
|
17492 | // @see http://www.w3.org/TR/html5/index.html#events-0
|
17493 | EventConstructor = SyntheticEvent;
|
17494 | break;
|
17495 | case topLevelTypes.topKeyPress:
|
17496 | // FireFox creates a keypress event for function keys too. This removes
|
17497 | // the unwanted keypress events. Enter is however both printable and
|
17498 | // non-printable. One would expect Tab to be as well (but it isn't).
|
17499 | if (getEventCharCode(nativeEvent) === 0) {
|
17500 | return null;
|
17501 | }
|
17502 | /* falls through */
|
17503 | case topLevelTypes.topKeyDown:
|
17504 | case topLevelTypes.topKeyUp:
|
17505 | EventConstructor = SyntheticKeyboardEvent;
|
17506 | break;
|
17507 | case topLevelTypes.topBlur:
|
17508 | case topLevelTypes.topFocus:
|
17509 | EventConstructor = SyntheticFocusEvent;
|
17510 | break;
|
17511 | case topLevelTypes.topClick:
|
17512 | // Firefox creates a click event on right mouse clicks. This removes the
|
17513 | // unwanted click events.
|
17514 | if (nativeEvent.button === 2) {
|
17515 | return null;
|
17516 | }
|
17517 | /* falls through */
|
17518 | case topLevelTypes.topContextMenu:
|
17519 | case topLevelTypes.topDoubleClick:
|
17520 | case topLevelTypes.topMouseDown:
|
17521 | case topLevelTypes.topMouseMove:
|
17522 | case topLevelTypes.topMouseOut:
|
17523 | case topLevelTypes.topMouseOver:
|
17524 | case topLevelTypes.topMouseUp:
|
17525 | EventConstructor = SyntheticMouseEvent;
|
17526 | break;
|
17527 | case topLevelTypes.topDrag:
|
17528 | case topLevelTypes.topDragEnd:
|
17529 | case topLevelTypes.topDragEnter:
|
17530 | case topLevelTypes.topDragExit:
|
17531 | case topLevelTypes.topDragLeave:
|
17532 | case topLevelTypes.topDragOver:
|
17533 | case topLevelTypes.topDragStart:
|
17534 | case topLevelTypes.topDrop:
|
17535 | EventConstructor = SyntheticDragEvent;
|
17536 | break;
|
17537 | case topLevelTypes.topTouchCancel:
|
17538 | case topLevelTypes.topTouchEnd:
|
17539 | case topLevelTypes.topTouchMove:
|
17540 | case topLevelTypes.topTouchStart:
|
17541 | EventConstructor = SyntheticTouchEvent;
|
17542 | break;
|
17543 | case topLevelTypes.topScroll:
|
17544 | EventConstructor = SyntheticUIEvent;
|
17545 | break;
|
17546 | case topLevelTypes.topWheel:
|
17547 | EventConstructor = SyntheticWheelEvent;
|
17548 | break;
|
17549 | case topLevelTypes.topCopy:
|
17550 | case topLevelTypes.topCut:
|
17551 | case topLevelTypes.topPaste:
|
17552 | EventConstructor = SyntheticClipboardEvent;
|
17553 | break;
|
17554 | }
|
17555 | !EventConstructor ? process.env.NODE_ENV !== 'production' ? invariant(false, 'SimpleEventPlugin: Unhandled event type, `%s`.', topLevelType) : invariant(false) : undefined;
|
17556 | var event = EventConstructor.getPooled(dispatchConfig, topLevelTargetID, nativeEvent, nativeEventTarget);
|
17557 | EventPropagators.accumulateTwoPhaseDispatches(event);
|
17558 | return event;
|
17559 | },
|
17560 |
|
17561 | didPutListener: function (id, registrationName, listener) {
|
17562 | // Mobile Safari does not fire properly bubble click events on
|
17563 | // non-interactive elements, which means delegated click listeners do not
|
17564 | // fire. The workaround for this bug involves attaching an empty click
|
17565 | // listener on the target node.
|
17566 | if (registrationName === ON_CLICK_KEY) {
|
17567 | var node = ReactMount.getNode(id);
|
17568 | if (!onClickListeners[id]) {
|
17569 | onClickListeners[id] = EventListener.listen(node, 'click', emptyFunction);
|
17570 | }
|
17571 | }
|
17572 | },
|
17573 |
|
17574 | willDeleteListener: function (id, registrationName) {
|
17575 | if (registrationName === ON_CLICK_KEY) {
|
17576 | onClickListeners[id].remove();
|
17577 | delete onClickListeners[id];
|
17578 | }
|
17579 | }
|
17580 |
|
17581 | };
|
17582 |
|
17583 | module.exports = SimpleEventPlugin;
|
17584 | /* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(5)))
|
17585 |
|
17586 | /***/ },
|
17587 | /* 134 */
|
17588 | /***/ function(module, exports, __webpack_require__) {
|
17589 |
|
17590 | /**
|
17591 | * Copyright 2013-2015, Facebook, Inc.
|
17592 | * All rights reserved.
|
17593 | *
|
17594 | * This source code is licensed under the BSD-style license found in the
|
17595 | * LICENSE file in the root directory of this source tree. An additional grant
|
17596 | * of patent rights can be found in the PATENTS file in the same directory.
|
17597 | *
|
17598 | * @providesModule SyntheticClipboardEvent
|
17599 | * @typechecks static-only
|
17600 | */
|
17601 |
|
17602 | 'use strict';
|
17603 |
|
17604 | var SyntheticEvent = __webpack_require__(78);
|
17605 |
|
17606 | /**
|
17607 | * @interface Event
|
17608 | * @see http://www.w3.org/TR/clipboard-apis/
|
17609 | */
|
17610 | var ClipboardEventInterface = {
|
17611 | clipboardData: function (event) {
|
17612 | return 'clipboardData' in event ? event.clipboardData : window.clipboardData;
|
17613 | }
|
17614 | };
|
17615 |
|
17616 | /**
|
17617 | * @param {object} dispatchConfig Configuration used to dispatch this event.
|
17618 | * @param {string} dispatchMarker Marker identifying the event target.
|
17619 | * @param {object} nativeEvent Native browser event.
|
17620 | * @extends {SyntheticUIEvent}
|
17621 | */
|
17622 | function SyntheticClipboardEvent(dispatchConfig, dispatchMarker, nativeEvent, nativeEventTarget) {
|
17623 | SyntheticEvent.call(this, dispatchConfig, dispatchMarker, nativeEvent, nativeEventTarget);
|
17624 | }
|
17625 |
|
17626 | SyntheticEvent.augmentClass(SyntheticClipboardEvent, ClipboardEventInterface);
|
17627 |
|
17628 | module.exports = SyntheticClipboardEvent;
|
17629 |
|
17630 | /***/ },
|
17631 | /* 135 */
|
17632 | /***/ function(module, exports, __webpack_require__) {
|
17633 |
|
17634 | /**
|
17635 | * Copyright 2013-2015, Facebook, Inc.
|
17636 | * All rights reserved.
|
17637 | *
|
17638 | * This source code is licensed under the BSD-style license found in the
|
17639 | * LICENSE file in the root directory of this source tree. An additional grant
|
17640 | * of patent rights can be found in the PATENTS file in the same directory.
|
17641 | *
|
17642 | * @providesModule SyntheticFocusEvent
|
17643 | * @typechecks static-only
|
17644 | */
|
17645 |
|
17646 | 'use strict';
|
17647 |
|
17648 | var SyntheticUIEvent = __webpack_require__(88);
|
17649 |
|
17650 | /**
|
17651 | * @interface FocusEvent
|
17652 | * @see http://www.w3.org/TR/DOM-Level-3-Events/
|
17653 | */
|
17654 | var FocusEventInterface = {
|
17655 | relatedTarget: null
|
17656 | };
|
17657 |
|
17658 | /**
|
17659 | * @param {object} dispatchConfig Configuration used to dispatch this event.
|
17660 | * @param {string} dispatchMarker Marker identifying the event target.
|
17661 | * @param {object} nativeEvent Native browser event.
|
17662 | * @extends {SyntheticUIEvent}
|
17663 | */
|
17664 | function SyntheticFocusEvent(dispatchConfig, dispatchMarker, nativeEvent, nativeEventTarget) {
|
17665 | SyntheticUIEvent.call(this, dispatchConfig, dispatchMarker, nativeEvent, nativeEventTarget);
|
17666 | }
|
17667 |
|
17668 | SyntheticUIEvent.augmentClass(SyntheticFocusEvent, FocusEventInterface);
|
17669 |
|
17670 | module.exports = SyntheticFocusEvent;
|
17671 |
|
17672 | /***/ },
|
17673 | /* 136 */
|
17674 | /***/ function(module, exports, __webpack_require__) {
|
17675 |
|
17676 | /**
|
17677 | * Copyright 2013-2015, Facebook, Inc.
|
17678 | * All rights reserved.
|
17679 | *
|
17680 | * This source code is licensed under the BSD-style license found in the
|
17681 | * LICENSE file in the root directory of this source tree. An additional grant
|
17682 | * of patent rights can be found in the PATENTS file in the same directory.
|
17683 | *
|
17684 | * @providesModule SyntheticKeyboardEvent
|
17685 | * @typechecks static-only
|
17686 | */
|
17687 |
|
17688 | 'use strict';
|
17689 |
|
17690 | var SyntheticUIEvent = __webpack_require__(88);
|
17691 |
|
17692 | var getEventCharCode = __webpack_require__(137);
|
17693 | var getEventKey = __webpack_require__(138);
|
17694 | var getEventModifierState = __webpack_require__(89);
|
17695 |
|
17696 | /**
|
17697 | * @interface KeyboardEvent
|
17698 | * @see http://www.w3.org/TR/DOM-Level-3-Events/
|
17699 | */
|
17700 | var KeyboardEventInterface = {
|
17701 | key: getEventKey,
|
17702 | location: null,
|
17703 | ctrlKey: null,
|
17704 | shiftKey: null,
|
17705 | altKey: null,
|
17706 | metaKey: null,
|
17707 | repeat: null,
|
17708 | locale: null,
|
17709 | getModifierState: getEventModifierState,
|
17710 | // Legacy Interface
|
17711 | charCode: function (event) {
|
17712 | // `charCode` is the result of a KeyPress event and represents the value of
|
17713 | // the actual printable character.
|
17714 |
|
17715 | // KeyPress is deprecated, but its replacement is not yet final and not
|
17716 | // implemented in any major browser. Only KeyPress has charCode.
|
17717 | if (event.type === 'keypress') {
|
17718 | return getEventCharCode(event);
|
17719 | }
|
17720 | return 0;
|
17721 | },
|
17722 | keyCode: function (event) {
|
17723 | // `keyCode` is the result of a KeyDown/Up event and represents the value of
|
17724 | // physical keyboard key.
|
17725 |
|
17726 | // The actual meaning of the value depends on the users' keyboard layout
|
17727 | // which cannot be detected. Assuming that it is a US keyboard layout
|
17728 | // provides a surprisingly accurate mapping for US and European users.
|
17729 | // Due to this, it is left to the user to implement at this time.
|
17730 | if (event.type === 'keydown' || event.type === 'keyup') {
|
17731 | return event.keyCode;
|
17732 | }
|
17733 | return 0;
|
17734 | },
|
17735 | which: function (event) {
|
17736 | // `which` is an alias for either `keyCode` or `charCode` depending on the
|
17737 | // type of the event.
|
17738 | if (event.type === 'keypress') {
|
17739 | return getEventCharCode(event);
|
17740 | }
|
17741 | if (event.type === 'keydown' || event.type === 'keyup') {
|
17742 | return event.keyCode;
|
17743 | }
|
17744 | return 0;
|
17745 | }
|
17746 | };
|
17747 |
|
17748 | /**
|
17749 | * @param {object} dispatchConfig Configuration used to dispatch this event.
|
17750 | * @param {string} dispatchMarker Marker identifying the event target.
|
17751 | * @param {object} nativeEvent Native browser event.
|
17752 | * @extends {SyntheticUIEvent}
|
17753 | */
|
17754 | function SyntheticKeyboardEvent(dispatchConfig, dispatchMarker, nativeEvent, nativeEventTarget) {
|
17755 | SyntheticUIEvent.call(this, dispatchConfig, dispatchMarker, nativeEvent, nativeEventTarget);
|
17756 | }
|
17757 |
|
17758 | SyntheticUIEvent.augmentClass(SyntheticKeyboardEvent, KeyboardEventInterface);
|
17759 |
|
17760 | module.exports = SyntheticKeyboardEvent;
|
17761 |
|
17762 | /***/ },
|
17763 | /* 137 */
|
17764 | /***/ function(module, exports) {
|
17765 |
|
17766 | /**
|
17767 | * Copyright 2013-2015, Facebook, Inc.
|
17768 | * All rights reserved.
|
17769 | *
|
17770 | * This source code is licensed under the BSD-style license found in the
|
17771 | * LICENSE file in the root directory of this source tree. An additional grant
|
17772 | * of patent rights can be found in the PATENTS file in the same directory.
|
17773 | *
|
17774 | * @providesModule getEventCharCode
|
17775 | * @typechecks static-only
|
17776 | */
|
17777 |
|
17778 | 'use strict';
|
17779 |
|
17780 | /**
|
17781 | * `charCode` represents the actual "character code" and is safe to use with
|
17782 | * `String.fromCharCode`. As such, only keys that correspond to printable
|
17783 | * characters produce a valid `charCode`, the only exception to this is Enter.
|
17784 | * The Tab-key is considered non-printable and does not have a `charCode`,
|
17785 | * presumably because it does not produce a tab-character in browsers.
|
17786 | *
|
17787 | * @param {object} nativeEvent Native browser event.
|
17788 | * @return {number} Normalized `charCode` property.
|
17789 | */
|
17790 | function getEventCharCode(nativeEvent) {
|
17791 | var charCode;
|
17792 | var keyCode = nativeEvent.keyCode;
|
17793 |
|
17794 | if ('charCode' in nativeEvent) {
|
17795 | charCode = nativeEvent.charCode;
|
17796 |
|
17797 | // FF does not set `charCode` for the Enter-key, check against `keyCode`.
|
17798 | if (charCode === 0 && keyCode === 13) {
|
17799 | charCode = 13;
|
17800 | }
|
17801 | } else {
|
17802 | // IE8 does not implement `charCode`, but `keyCode` has the correct value.
|
17803 | charCode = keyCode;
|
17804 | }
|
17805 |
|
17806 | // Some non-printable keys are reported in `charCode`/`keyCode`, discard them.
|
17807 | // Must not discard the (non-)printable Enter-key.
|
17808 | if (charCode >= 32 || charCode === 13) {
|
17809 | return charCode;
|
17810 | }
|
17811 |
|
17812 | return 0;
|
17813 | }
|
17814 |
|
17815 | module.exports = getEventCharCode;
|
17816 |
|
17817 | /***/ },
|
17818 | /* 138 */
|
17819 | /***/ function(module, exports, __webpack_require__) {
|
17820 |
|
17821 | /**
|
17822 | * Copyright 2013-2015, Facebook, Inc.
|
17823 | * All rights reserved.
|
17824 | *
|
17825 | * This source code is licensed under the BSD-style license found in the
|
17826 | * LICENSE file in the root directory of this source tree. An additional grant
|
17827 | * of patent rights can be found in the PATENTS file in the same directory.
|
17828 | *
|
17829 | * @providesModule getEventKey
|
17830 | * @typechecks static-only
|
17831 | */
|
17832 |
|
17833 | 'use strict';
|
17834 |
|
17835 | var getEventCharCode = __webpack_require__(137);
|
17836 |
|
17837 | /**
|
17838 | * Normalization of deprecated HTML5 `key` values
|
17839 | * @see https://developer.mozilla.org/en-US/docs/Web/API/KeyboardEvent#Key_names
|
17840 | */
|
17841 | var normalizeKey = {
|
17842 | 'Esc': 'Escape',
|
17843 | 'Spacebar': ' ',
|
17844 | 'Left': 'ArrowLeft',
|
17845 | 'Up': 'ArrowUp',
|
17846 | 'Right': 'ArrowRight',
|
17847 | 'Down': 'ArrowDown',
|
17848 | 'Del': 'Delete',
|
17849 | 'Win': 'OS',
|
17850 | 'Menu': 'ContextMenu',
|
17851 | 'Apps': 'ContextMenu',
|
17852 | 'Scroll': 'ScrollLock',
|
17853 | 'MozPrintableKey': 'Unidentified'
|
17854 | };
|
17855 |
|
17856 | /**
|
17857 | * Translation from legacy `keyCode` to HTML5 `key`
|
17858 | * Only special keys supported, all others depend on keyboard layout or browser
|
17859 | * @see https://developer.mozilla.org/en-US/docs/Web/API/KeyboardEvent#Key_names
|
17860 | */
|
17861 | var translateToKey = {
|
17862 | 8: 'Backspace',
|
17863 | 9: 'Tab',
|
17864 | 12: 'Clear',
|
17865 | 13: 'Enter',
|
17866 | 16: 'Shift',
|
17867 | 17: 'Control',
|
17868 | 18: 'Alt',
|
17869 | 19: 'Pause',
|
17870 | 20: 'CapsLock',
|
17871 | 27: 'Escape',
|
17872 | 32: ' ',
|
17873 | 33: 'PageUp',
|
17874 | 34: 'PageDown',
|
17875 | 35: 'End',
|
17876 | 36: 'Home',
|
17877 | 37: 'ArrowLeft',
|
17878 | 38: 'ArrowUp',
|
17879 | 39: 'ArrowRight',
|
17880 | 40: 'ArrowDown',
|
17881 | 45: 'Insert',
|
17882 | 46: 'Delete',
|
17883 | 112: 'F1', 113: 'F2', 114: 'F3', 115: 'F4', 116: 'F5', 117: 'F6',
|
17884 | 118: 'F7', 119: 'F8', 120: 'F9', 121: 'F10', 122: 'F11', 123: 'F12',
|
17885 | 144: 'NumLock',
|
17886 | 145: 'ScrollLock',
|
17887 | 224: 'Meta'
|
17888 | };
|
17889 |
|
17890 | /**
|
17891 | * @param {object} nativeEvent Native browser event.
|
17892 | * @return {string} Normalized `key` property.
|
17893 | */
|
17894 | function getEventKey(nativeEvent) {
|
17895 | if (nativeEvent.key) {
|
17896 | // Normalize inconsistent values reported by browsers due to
|
17897 | // implementations of a working draft specification.
|
17898 |
|
17899 | // FireFox implements `key` but returns `MozPrintableKey` for all
|
17900 | // printable characters (normalized to `Unidentified`), ignore it.
|
17901 | var key = normalizeKey[nativeEvent.key] || nativeEvent.key;
|
17902 | if (key !== 'Unidentified') {
|
17903 | return key;
|
17904 | }
|
17905 | }
|
17906 |
|
17907 | // Browser does not implement `key`, polyfill as much of it as we can.
|
17908 | if (nativeEvent.type === 'keypress') {
|
17909 | var charCode = getEventCharCode(nativeEvent);
|
17910 |
|
17911 | // The enter-key is technically both printable and non-printable and can
|
17912 | // thus be captured by `keypress`, no other non-printable key should.
|
17913 | return charCode === 13 ? 'Enter' : String.fromCharCode(charCode);
|
17914 | }
|
17915 | if (nativeEvent.type === 'keydown' || nativeEvent.type === 'keyup') {
|
17916 | // While user keyboard layout determines the actual meaning of each
|
17917 | // `keyCode` value, almost all function keys have a universal value.
|
17918 | return translateToKey[nativeEvent.keyCode] || 'Unidentified';
|
17919 | }
|
17920 | return '';
|
17921 | }
|
17922 |
|
17923 | module.exports = getEventKey;
|
17924 |
|
17925 | /***/ },
|
17926 | /* 139 */
|
17927 | /***/ function(module, exports, __webpack_require__) {
|
17928 |
|
17929 | /**
|
17930 | * Copyright 2013-2015, Facebook, Inc.
|
17931 | * All rights reserved.
|
17932 | *
|
17933 | * This source code is licensed under the BSD-style license found in the
|
17934 | * LICENSE file in the root directory of this source tree. An additional grant
|
17935 | * of patent rights can be found in the PATENTS file in the same directory.
|
17936 | *
|
17937 | * @providesModule SyntheticDragEvent
|
17938 | * @typechecks static-only
|
17939 | */
|
17940 |
|
17941 | 'use strict';
|
17942 |
|
17943 | var SyntheticMouseEvent = __webpack_require__(87);
|
17944 |
|
17945 | /**
|
17946 | * @interface DragEvent
|
17947 | * @see http://www.w3.org/TR/DOM-Level-3-Events/
|
17948 | */
|
17949 | var DragEventInterface = {
|
17950 | dataTransfer: null
|
17951 | };
|
17952 |
|
17953 | /**
|
17954 | * @param {object} dispatchConfig Configuration used to dispatch this event.
|
17955 | * @param {string} dispatchMarker Marker identifying the event target.
|
17956 | * @param {object} nativeEvent Native browser event.
|
17957 | * @extends {SyntheticUIEvent}
|
17958 | */
|
17959 | function SyntheticDragEvent(dispatchConfig, dispatchMarker, nativeEvent, nativeEventTarget) {
|
17960 | SyntheticMouseEvent.call(this, dispatchConfig, dispatchMarker, nativeEvent, nativeEventTarget);
|
17961 | }
|
17962 |
|
17963 | SyntheticMouseEvent.augmentClass(SyntheticDragEvent, DragEventInterface);
|
17964 |
|
17965 | module.exports = SyntheticDragEvent;
|
17966 |
|
17967 | /***/ },
|
17968 | /* 140 */
|
17969 | /***/ function(module, exports, __webpack_require__) {
|
17970 |
|
17971 | /**
|
17972 | * Copyright 2013-2015, Facebook, Inc.
|
17973 | * All rights reserved.
|
17974 | *
|
17975 | * This source code is licensed under the BSD-style license found in the
|
17976 | * LICENSE file in the root directory of this source tree. An additional grant
|
17977 | * of patent rights can be found in the PATENTS file in the same directory.
|
17978 | *
|
17979 | * @providesModule SyntheticTouchEvent
|
17980 | * @typechecks static-only
|
17981 | */
|
17982 |
|
17983 | 'use strict';
|
17984 |
|
17985 | var SyntheticUIEvent = __webpack_require__(88);
|
17986 |
|
17987 | var getEventModifierState = __webpack_require__(89);
|
17988 |
|
17989 | /**
|
17990 | * @interface TouchEvent
|
17991 | * @see http://www.w3.org/TR/touch-events/
|
17992 | */
|
17993 | var TouchEventInterface = {
|
17994 | touches: null,
|
17995 | targetTouches: null,
|
17996 | changedTouches: null,
|
17997 | altKey: null,
|
17998 | metaKey: null,
|
17999 | ctrlKey: null,
|
18000 | shiftKey: null,
|
18001 | getModifierState: getEventModifierState
|
18002 | };
|
18003 |
|
18004 | /**
|
18005 | * @param {object} dispatchConfig Configuration used to dispatch this event.
|
18006 | * @param {string} dispatchMarker Marker identifying the event target.
|
18007 | * @param {object} nativeEvent Native browser event.
|
18008 | * @extends {SyntheticUIEvent}
|
18009 | */
|
18010 | function SyntheticTouchEvent(dispatchConfig, dispatchMarker, nativeEvent, nativeEventTarget) {
|
18011 | SyntheticUIEvent.call(this, dispatchConfig, dispatchMarker, nativeEvent, nativeEventTarget);
|
18012 | }
|
18013 |
|
18014 | SyntheticUIEvent.augmentClass(SyntheticTouchEvent, TouchEventInterface);
|
18015 |
|
18016 | module.exports = SyntheticTouchEvent;
|
18017 |
|
18018 | /***/ },
|
18019 | /* 141 */
|
18020 | /***/ function(module, exports, __webpack_require__) {
|
18021 |
|
18022 | /**
|
18023 | * Copyright 2013-2015, Facebook, Inc.
|
18024 | * All rights reserved.
|
18025 | *
|
18026 | * This source code is licensed under the BSD-style license found in the
|
18027 | * LICENSE file in the root directory of this source tree. An additional grant
|
18028 | * of patent rights can be found in the PATENTS file in the same directory.
|
18029 | *
|
18030 | * @providesModule SyntheticWheelEvent
|
18031 | * @typechecks static-only
|
18032 | */
|
18033 |
|
18034 | 'use strict';
|
18035 |
|
18036 | var SyntheticMouseEvent = __webpack_require__(87);
|
18037 |
|
18038 | /**
|
18039 | * @interface WheelEvent
|
18040 | * @see http://www.w3.org/TR/DOM-Level-3-Events/
|
18041 | */
|
18042 | var WheelEventInterface = {
|
18043 | deltaX: function (event) {
|
18044 | return 'deltaX' in event ? event.deltaX :
|
18045 | // Fallback to `wheelDeltaX` for Webkit and normalize (right is positive).
|
18046 | 'wheelDeltaX' in event ? -event.wheelDeltaX : 0;
|
18047 | },
|
18048 | deltaY: function (event) {
|
18049 | return 'deltaY' in event ? event.deltaY :
|
18050 | // Fallback to `wheelDeltaY` for Webkit and normalize (down is positive).
|
18051 | 'wheelDeltaY' in event ? -event.wheelDeltaY :
|
18052 | // Fallback to `wheelDelta` for IE<9 and normalize (down is positive).
|
18053 | 'wheelDelta' in event ? -event.wheelDelta : 0;
|
18054 | },
|
18055 | deltaZ: null,
|
18056 |
|
18057 | // Browsers without "deltaMode" is reporting in raw wheel delta where one
|
18058 | // notch on the scroll is always +/- 120, roughly equivalent to pixels.
|
18059 | // A good approximation of DOM_DELTA_LINE (1) is 5% of viewport size or
|
18060 | // ~40 pixels, for DOM_DELTA_SCREEN (2) it is 87.5% of viewport size.
|
18061 | deltaMode: null
|
18062 | };
|
18063 |
|
18064 | /**
|
18065 | * @param {object} dispatchConfig Configuration used to dispatch this event.
|
18066 | * @param {string} dispatchMarker Marker identifying the event target.
|
18067 | * @param {object} nativeEvent Native browser event.
|
18068 | * @extends {SyntheticMouseEvent}
|
18069 | */
|
18070 | function SyntheticWheelEvent(dispatchConfig, dispatchMarker, nativeEvent, nativeEventTarget) {
|
18071 | SyntheticMouseEvent.call(this, dispatchConfig, dispatchMarker, nativeEvent, nativeEventTarget);
|
18072 | }
|
18073 |
|
18074 | SyntheticMouseEvent.augmentClass(SyntheticWheelEvent, WheelEventInterface);
|
18075 |
|
18076 | module.exports = SyntheticWheelEvent;
|
18077 |
|
18078 | /***/ },
|
18079 | /* 142 */
|
18080 | /***/ function(module, exports, __webpack_require__) {
|
18081 |
|
18082 | /**
|
18083 | * Copyright 2013-2015, Facebook, Inc.
|
18084 | * All rights reserved.
|
18085 | *
|
18086 | * This source code is licensed under the BSD-style license found in the
|
18087 | * LICENSE file in the root directory of this source tree. An additional grant
|
18088 | * of patent rights can be found in the PATENTS file in the same directory.
|
18089 | *
|
18090 | * @providesModule SVGDOMPropertyConfig
|
18091 | */
|
18092 |
|
18093 | 'use strict';
|
18094 |
|
18095 | var DOMProperty = __webpack_require__(24);
|
18096 |
|
18097 | var MUST_USE_ATTRIBUTE = DOMProperty.injection.MUST_USE_ATTRIBUTE;
|
18098 |
|
18099 | var NS = {
|
18100 | xlink: 'http://www.w3.org/1999/xlink',
|
18101 | xml: 'http://www.w3.org/XML/1998/namespace'
|
18102 | };
|
18103 |
|
18104 | var SVGDOMPropertyConfig = {
|
18105 | Properties: {
|
18106 | clipPath: MUST_USE_ATTRIBUTE,
|
18107 | cx: MUST_USE_ATTRIBUTE,
|
18108 | cy: MUST_USE_ATTRIBUTE,
|
18109 | d: MUST_USE_ATTRIBUTE,
|
18110 | dx: MUST_USE_ATTRIBUTE,
|
18111 | dy: MUST_USE_ATTRIBUTE,
|
18112 | fill: MUST_USE_ATTRIBUTE,
|
18113 | fillOpacity: MUST_USE_ATTRIBUTE,
|
18114 | fontFamily: MUST_USE_ATTRIBUTE,
|
18115 | fontSize: MUST_USE_ATTRIBUTE,
|
18116 | fx: MUST_USE_ATTRIBUTE,
|
18117 | fy: MUST_USE_ATTRIBUTE,
|
18118 | gradientTransform: MUST_USE_ATTRIBUTE,
|
18119 | gradientUnits: MUST_USE_ATTRIBUTE,
|
18120 | markerEnd: MUST_USE_ATTRIBUTE,
|
18121 | markerMid: MUST_USE_ATTRIBUTE,
|
18122 | markerStart: MUST_USE_ATTRIBUTE,
|
18123 | offset: MUST_USE_ATTRIBUTE,
|
18124 | opacity: MUST_USE_ATTRIBUTE,
|
18125 | patternContentUnits: MUST_USE_ATTRIBUTE,
|
18126 | patternUnits: MUST_USE_ATTRIBUTE,
|
18127 | points: MUST_USE_ATTRIBUTE,
|
18128 | preserveAspectRatio: MUST_USE_ATTRIBUTE,
|
18129 | r: MUST_USE_ATTRIBUTE,
|
18130 | rx: MUST_USE_ATTRIBUTE,
|
18131 | ry: MUST_USE_ATTRIBUTE,
|
18132 | spreadMethod: MUST_USE_ATTRIBUTE,
|
18133 | stopColor: MUST_USE_ATTRIBUTE,
|
18134 | stopOpacity: MUST_USE_ATTRIBUTE,
|
18135 | stroke: MUST_USE_ATTRIBUTE,
|
18136 | strokeDasharray: MUST_USE_ATTRIBUTE,
|
18137 | strokeLinecap: MUST_USE_ATTRIBUTE,
|
18138 | strokeOpacity: MUST_USE_ATTRIBUTE,
|
18139 | strokeWidth: MUST_USE_ATTRIBUTE,
|
18140 | textAnchor: MUST_USE_ATTRIBUTE,
|
18141 | transform: MUST_USE_ATTRIBUTE,
|
18142 | version: MUST_USE_ATTRIBUTE,
|
18143 | viewBox: MUST_USE_ATTRIBUTE,
|
18144 | x1: MUST_USE_ATTRIBUTE,
|
18145 | x2: MUST_USE_ATTRIBUTE,
|
18146 | x: MUST_USE_ATTRIBUTE,
|
18147 | xlinkActuate: MUST_USE_ATTRIBUTE,
|
18148 | xlinkArcrole: MUST_USE_ATTRIBUTE,
|
18149 | xlinkHref: MUST_USE_ATTRIBUTE,
|
18150 | xlinkRole: MUST_USE_ATTRIBUTE,
|
18151 | xlinkShow: MUST_USE_ATTRIBUTE,
|
18152 | xlinkTitle: MUST_USE_ATTRIBUTE,
|
18153 | xlinkType: MUST_USE_ATTRIBUTE,
|
18154 | xmlBase: MUST_USE_ATTRIBUTE,
|
18155 | xmlLang: MUST_USE_ATTRIBUTE,
|
18156 | xmlSpace: MUST_USE_ATTRIBUTE,
|
18157 | y1: MUST_USE_ATTRIBUTE,
|
18158 | y2: MUST_USE_ATTRIBUTE,
|
18159 | y: MUST_USE_ATTRIBUTE
|
18160 | },
|
18161 | DOMAttributeNamespaces: {
|
18162 | xlinkActuate: NS.xlink,
|
18163 | xlinkArcrole: NS.xlink,
|
18164 | xlinkHref: NS.xlink,
|
18165 | xlinkRole: NS.xlink,
|
18166 | xlinkShow: NS.xlink,
|
18167 | xlinkTitle: NS.xlink,
|
18168 | xlinkType: NS.xlink,
|
18169 | xmlBase: NS.xml,
|
18170 | xmlLang: NS.xml,
|
18171 | xmlSpace: NS.xml
|
18172 | },
|
18173 | DOMAttributeNames: {
|
18174 | clipPath: 'clip-path',
|
18175 | fillOpacity: 'fill-opacity',
|
18176 | fontFamily: 'font-family',
|
18177 | fontSize: 'font-size',
|
18178 | gradientTransform: 'gradientTransform',
|
18179 | gradientUnits: 'gradientUnits',
|
18180 | markerEnd: 'marker-end',
|
18181 | markerMid: 'marker-mid',
|
18182 | markerStart: 'marker-start',
|
18183 | patternContentUnits: 'patternContentUnits',
|
18184 | patternUnits: 'patternUnits',
|
18185 | preserveAspectRatio: 'preserveAspectRatio',
|
18186 | spreadMethod: 'spreadMethod',
|
18187 | stopColor: 'stop-color',
|
18188 | stopOpacity: 'stop-opacity',
|
18189 | strokeDasharray: 'stroke-dasharray',
|
18190 | strokeLinecap: 'stroke-linecap',
|
18191 | strokeOpacity: 'stroke-opacity',
|
18192 | strokeWidth: 'stroke-width',
|
18193 | textAnchor: 'text-anchor',
|
18194 | viewBox: 'viewBox',
|
18195 | xlinkActuate: 'xlink:actuate',
|
18196 | xlinkArcrole: 'xlink:arcrole',
|
18197 | xlinkHref: 'xlink:href',
|
18198 | xlinkRole: 'xlink:role',
|
18199 | xlinkShow: 'xlink:show',
|
18200 | xlinkTitle: 'xlink:title',
|
18201 | xlinkType: 'xlink:type',
|
18202 | xmlBase: 'xml:base',
|
18203 | xmlLang: 'xml:lang',
|
18204 | xmlSpace: 'xml:space'
|
18205 | }
|
18206 | };
|
18207 |
|
18208 | module.exports = SVGDOMPropertyConfig;
|
18209 |
|
18210 | /***/ },
|
18211 | /* 143 */
|
18212 | /***/ function(module, exports, __webpack_require__) {
|
18213 |
|
18214 | /**
|
18215 | * Copyright 2013-2015, Facebook, Inc.
|
18216 | * All rights reserved.
|
18217 | *
|
18218 | * This source code is licensed under the BSD-style license found in the
|
18219 | * LICENSE file in the root directory of this source tree. An additional grant
|
18220 | * of patent rights can be found in the PATENTS file in the same directory.
|
18221 | *
|
18222 | * @providesModule ReactDefaultPerf
|
18223 | * @typechecks static-only
|
18224 | */
|
18225 |
|
18226 | 'use strict';
|
18227 |
|
18228 | var DOMProperty = __webpack_require__(24);
|
18229 | var ReactDefaultPerfAnalysis = __webpack_require__(144);
|
18230 | var ReactMount = __webpack_require__(29);
|
18231 | var ReactPerf = __webpack_require__(19);
|
18232 |
|
18233 | var performanceNow = __webpack_require__(145);
|
18234 |
|
18235 | function roundFloat(val) {
|
18236 | return Math.floor(val * 100) / 100;
|
18237 | }
|
18238 |
|
18239 | function addValue(obj, key, val) {
|
18240 | obj[key] = (obj[key] || 0) + val;
|
18241 | }
|
18242 |
|
18243 | var ReactDefaultPerf = {
|
18244 | _allMeasurements: [], // last item in the list is the current one
|
18245 | _mountStack: [0],
|
18246 | _injected: false,
|
18247 |
|
18248 | start: function () {
|
18249 | if (!ReactDefaultPerf._injected) {
|
18250 | ReactPerf.injection.injectMeasure(ReactDefaultPerf.measure);
|
18251 | }
|
18252 |
|
18253 | ReactDefaultPerf._allMeasurements.length = 0;
|
18254 | ReactPerf.enableMeasure = true;
|
18255 | },
|
18256 |
|
18257 | stop: function () {
|
18258 | ReactPerf.enableMeasure = false;
|
18259 | },
|
18260 |
|
18261 | getLastMeasurements: function () {
|
18262 | return ReactDefaultPerf._allMeasurements;
|
18263 | },
|
18264 |
|
18265 | printExclusive: function (measurements) {
|
18266 | measurements = measurements || ReactDefaultPerf._allMeasurements;
|
18267 | var summary = ReactDefaultPerfAnalysis.getExclusiveSummary(measurements);
|
18268 | console.table(summary.map(function (item) {
|
18269 | return {
|
18270 | 'Component class name': item.componentName,
|
18271 | 'Total inclusive time (ms)': roundFloat(item.inclusive),
|
18272 | 'Exclusive mount time (ms)': roundFloat(item.exclusive),
|
18273 | 'Exclusive render time (ms)': roundFloat(item.render),
|
18274 | 'Mount time per instance (ms)': roundFloat(item.exclusive / item.count),
|
18275 | 'Render time per instance (ms)': roundFloat(item.render / item.count),
|
18276 | 'Instances': item.count
|
18277 | };
|
18278 | }));
|
18279 | // TODO: ReactDefaultPerfAnalysis.getTotalTime() does not return the correct
|
18280 | // number.
|
18281 | },
|
18282 |
|
18283 | printInclusive: function (measurements) {
|
18284 | measurements = measurements || ReactDefaultPerf._allMeasurements;
|
18285 | var summary = ReactDefaultPerfAnalysis.getInclusiveSummary(measurements);
|
18286 | console.table(summary.map(function (item) {
|
18287 | return {
|
18288 | 'Owner > component': item.componentName,
|
18289 | 'Inclusive time (ms)': roundFloat(item.time),
|
18290 | 'Instances': item.count
|
18291 | };
|
18292 | }));
|
18293 | console.log('Total time:', ReactDefaultPerfAnalysis.getTotalTime(measurements).toFixed(2) + ' ms');
|
18294 | },
|
18295 |
|
18296 | getMeasurementsSummaryMap: function (measurements) {
|
18297 | var summary = ReactDefaultPerfAnalysis.getInclusiveSummary(measurements, true);
|
18298 | return summary.map(function (item) {
|
18299 | return {
|
18300 | 'Owner > component': item.componentName,
|
18301 | 'Wasted time (ms)': item.time,
|
18302 | 'Instances': item.count
|
18303 | };
|
18304 | });
|
18305 | },
|
18306 |
|
18307 | printWasted: function (measurements) {
|
18308 | measurements = measurements || ReactDefaultPerf._allMeasurements;
|
18309 | console.table(ReactDefaultPerf.getMeasurementsSummaryMap(measurements));
|
18310 | console.log('Total time:', ReactDefaultPerfAnalysis.getTotalTime(measurements).toFixed(2) + ' ms');
|
18311 | },
|
18312 |
|
18313 | printDOM: function (measurements) {
|
18314 | measurements = measurements || ReactDefaultPerf._allMeasurements;
|
18315 | var summary = ReactDefaultPerfAnalysis.getDOMSummary(measurements);
|
18316 | console.table(summary.map(function (item) {
|
18317 | var result = {};
|
18318 | result[DOMProperty.ID_ATTRIBUTE_NAME] = item.id;
|
18319 | result.type = item.type;
|
18320 | result.args = JSON.stringify(item.args);
|
18321 | return result;
|
18322 | }));
|
18323 | console.log('Total time:', ReactDefaultPerfAnalysis.getTotalTime(measurements).toFixed(2) + ' ms');
|
18324 | },
|
18325 |
|
18326 | _recordWrite: function (id, fnName, totalTime, args) {
|
18327 | // TODO: totalTime isn't that useful since it doesn't count paints/reflows
|
18328 | var writes = ReactDefaultPerf._allMeasurements[ReactDefaultPerf._allMeasurements.length - 1].writes;
|
18329 | writes[id] = writes[id] || [];
|
18330 | writes[id].push({
|
18331 | type: fnName,
|
18332 | time: totalTime,
|
18333 | args: args
|
18334 | });
|
18335 | },
|
18336 |
|
18337 | measure: function (moduleName, fnName, func) {
|
18338 | return function () {
|
18339 | for (var _len = arguments.length, args = Array(_len), _key = 0; _key < _len; _key++) {
|
18340 | args[_key] = arguments[_key];
|
18341 | }
|
18342 |
|
18343 | var totalTime;
|
18344 | var rv;
|
18345 | var start;
|
18346 |
|
18347 | if (fnName === '_renderNewRootComponent' || fnName === 'flushBatchedUpdates') {
|
18348 | // A "measurement" is a set of metrics recorded for each flush. We want
|
18349 | // to group the metrics for a given flush together so we can look at the
|
18350 | // components that rendered and the DOM operations that actually
|
18351 | // happened to determine the amount of "wasted work" performed.
|
18352 | ReactDefaultPerf._allMeasurements.push({
|
18353 | exclusive: {},
|
18354 | inclusive: {},
|
18355 | render: {},
|
18356 | counts: {},
|
18357 | writes: {},
|
18358 | displayNames: {},
|
18359 | totalTime: 0,
|
18360 | created: {}
|
18361 | });
|
18362 | start = performanceNow();
|
18363 | rv = func.apply(this, args);
|
18364 | ReactDefaultPerf._allMeasurements[ReactDefaultPerf._allMeasurements.length - 1].totalTime = performanceNow() - start;
|
18365 | return rv;
|
18366 | } else if (fnName === '_mountImageIntoNode' || moduleName === 'ReactBrowserEventEmitter' || moduleName === 'ReactDOMIDOperations' || moduleName === 'CSSPropertyOperations' || moduleName === 'DOMChildrenOperations' || moduleName === 'DOMPropertyOperations') {
|
18367 | start = performanceNow();
|
18368 | rv = func.apply(this, args);
|
18369 | totalTime = performanceNow() - start;
|
18370 |
|
18371 | if (fnName === '_mountImageIntoNode') {
|
18372 | var mountID = ReactMount.getID(args[1]);
|
18373 | ReactDefaultPerf._recordWrite(mountID, fnName, totalTime, args[0]);
|
18374 | } else if (fnName === 'dangerouslyProcessChildrenUpdates') {
|
18375 | // special format
|
18376 | args[0].forEach(function (update) {
|
18377 | var writeArgs = {};
|
18378 | if (update.fromIndex !== null) {
|
18379 | writeArgs.fromIndex = update.fromIndex;
|
18380 | }
|
18381 | if (update.toIndex !== null) {
|
18382 | writeArgs.toIndex = update.toIndex;
|
18383 | }
|
18384 | if (update.textContent !== null) {
|
18385 | writeArgs.textContent = update.textContent;
|
18386 | }
|
18387 | if (update.markupIndex !== null) {
|
18388 | writeArgs.markup = args[1][update.markupIndex];
|
18389 | }
|
18390 | ReactDefaultPerf._recordWrite(update.parentID, update.type, totalTime, writeArgs);
|
18391 | });
|
18392 | } else {
|
18393 | // basic format
|
18394 | var id = args[0];
|
18395 | if (typeof id === 'object') {
|
18396 | id = ReactMount.getID(args[0]);
|
18397 | }
|
18398 | ReactDefaultPerf._recordWrite(id, fnName, totalTime, Array.prototype.slice.call(args, 1));
|
18399 | }
|
18400 | return rv;
|
18401 | } else if (moduleName === 'ReactCompositeComponent' && (fnName === 'mountComponent' || fnName === 'updateComponent' || // TODO: receiveComponent()?
|
18402 | fnName === '_renderValidatedComponent')) {
|
18403 |
|
18404 | if (this._currentElement.type === ReactMount.TopLevelWrapper) {
|
18405 | return func.apply(this, args);
|
18406 | }
|
18407 |
|
18408 | var rootNodeID = fnName === 'mountComponent' ? args[0] : this._rootNodeID;
|
18409 | var isRender = fnName === '_renderValidatedComponent';
|
18410 | var isMount = fnName === 'mountComponent';
|
18411 |
|
18412 | var mountStack = ReactDefaultPerf._mountStack;
|
18413 | var entry = ReactDefaultPerf._allMeasurements[ReactDefaultPerf._allMeasurements.length - 1];
|
18414 |
|
18415 | if (isRender) {
|
18416 | addValue(entry.counts, rootNodeID, 1);
|
18417 | } else if (isMount) {
|
18418 | entry.created[rootNodeID] = true;
|
18419 | mountStack.push(0);
|
18420 | }
|
18421 |
|
18422 | start = performanceNow();
|
18423 | rv = func.apply(this, args);
|
18424 | totalTime = performanceNow() - start;
|
18425 |
|
18426 | if (isRender) {
|
18427 | addValue(entry.render, rootNodeID, totalTime);
|
18428 | } else if (isMount) {
|
18429 | var subMountTime = mountStack.pop();
|
18430 | mountStack[mountStack.length - 1] += totalTime;
|
18431 | addValue(entry.exclusive, rootNodeID, totalTime - subMountTime);
|
18432 | addValue(entry.inclusive, rootNodeID, totalTime);
|
18433 | } else {
|
18434 | addValue(entry.inclusive, rootNodeID, totalTime);
|
18435 | }
|
18436 |
|
18437 | entry.displayNames[rootNodeID] = {
|
18438 | current: this.getName(),
|
18439 | owner: this._currentElement._owner ? this._currentElement._owner.getName() : '<root>'
|
18440 | };
|
18441 |
|
18442 | return rv;
|
18443 | } else {
|
18444 | return func.apply(this, args);
|
18445 | }
|
18446 | };
|
18447 | }
|
18448 | };
|
18449 |
|
18450 | module.exports = ReactDefaultPerf;
|
18451 |
|
18452 | /***/ },
|
18453 | /* 144 */
|
18454 | /***/ function(module, exports, __webpack_require__) {
|
18455 |
|
18456 | /**
|
18457 | * Copyright 2013-2015, Facebook, Inc.
|
18458 | * All rights reserved.
|
18459 | *
|
18460 | * This source code is licensed under the BSD-style license found in the
|
18461 | * LICENSE file in the root directory of this source tree. An additional grant
|
18462 | * of patent rights can be found in the PATENTS file in the same directory.
|
18463 | *
|
18464 | * @providesModule ReactDefaultPerfAnalysis
|
18465 | */
|
18466 |
|
18467 | 'use strict';
|
18468 |
|
18469 | var assign = __webpack_require__(40);
|
18470 |
|
18471 | // Don't try to save users less than 1.2ms (a number I made up)
|
18472 | var DONT_CARE_THRESHOLD = 1.2;
|
18473 | var DOM_OPERATION_TYPES = {
|
18474 | '_mountImageIntoNode': 'set innerHTML',
|
18475 | INSERT_MARKUP: 'set innerHTML',
|
18476 | MOVE_EXISTING: 'move',
|
18477 | REMOVE_NODE: 'remove',
|
18478 | SET_MARKUP: 'set innerHTML',
|
18479 | TEXT_CONTENT: 'set textContent',
|
18480 | 'setValueForProperty': 'update attribute',
|
18481 | 'setValueForAttribute': 'update attribute',
|
18482 | 'deleteValueForProperty': 'remove attribute',
|
18483 | 'setValueForStyles': 'update styles',
|
18484 | 'replaceNodeWithMarkup': 'replace',
|
18485 | 'updateTextContent': 'set textContent'
|
18486 | };
|
18487 |
|
18488 | function getTotalTime(measurements) {
|
18489 | // TODO: return number of DOM ops? could be misleading.
|
18490 | // TODO: measure dropped frames after reconcile?
|
18491 | // TODO: log total time of each reconcile and the top-level component
|
18492 | // class that triggered it.
|
18493 | var totalTime = 0;
|
18494 | for (var i = 0; i < measurements.length; i++) {
|
18495 | var measurement = measurements[i];
|
18496 | totalTime += measurement.totalTime;
|
18497 | }
|
18498 | return totalTime;
|
18499 | }
|
18500 |
|
18501 | function getDOMSummary(measurements) {
|
18502 | var items = [];
|
18503 | measurements.forEach(function (measurement) {
|
18504 | Object.keys(measurement.writes).forEach(function (id) {
|
18505 | measurement.writes[id].forEach(function (write) {
|
18506 | items.push({
|
18507 | id: id,
|
18508 | type: DOM_OPERATION_TYPES[write.type] || write.type,
|
18509 | args: write.args
|
18510 | });
|
18511 | });
|
18512 | });
|
18513 | });
|
18514 | return items;
|
18515 | }
|
18516 |
|
18517 | function getExclusiveSummary(measurements) {
|
18518 | var candidates = {};
|
18519 | var displayName;
|
18520 |
|
18521 | for (var i = 0; i < measurements.length; i++) {
|
18522 | var measurement = measurements[i];
|
18523 | var allIDs = assign({}, measurement.exclusive, measurement.inclusive);
|
18524 |
|
18525 | for (var id in allIDs) {
|
18526 | displayName = measurement.displayNames[id].current;
|
18527 |
|
18528 | candidates[displayName] = candidates[displayName] || {
|
18529 | componentName: displayName,
|
18530 | inclusive: 0,
|
18531 | exclusive: 0,
|
18532 | render: 0,
|
18533 | count: 0
|
18534 | };
|
18535 | if (measurement.render[id]) {
|
18536 | candidates[displayName].render += measurement.render[id];
|
18537 | }
|
18538 | if (measurement.exclusive[id]) {
|
18539 | candidates[displayName].exclusive += measurement.exclusive[id];
|
18540 | }
|
18541 | if (measurement.inclusive[id]) {
|
18542 | candidates[displayName].inclusive += measurement.inclusive[id];
|
18543 | }
|
18544 | if (measurement.counts[id]) {
|
18545 | candidates[displayName].count += measurement.counts[id];
|
18546 | }
|
18547 | }
|
18548 | }
|
18549 |
|
18550 | // Now make a sorted array with the results.
|
18551 | var arr = [];
|
18552 | for (displayName in candidates) {
|
18553 | if (candidates[displayName].exclusive >= DONT_CARE_THRESHOLD) {
|
18554 | arr.push(candidates[displayName]);
|
18555 | }
|
18556 | }
|
18557 |
|
18558 | arr.sort(function (a, b) {
|
18559 | return b.exclusive - a.exclusive;
|
18560 | });
|
18561 |
|
18562 | return arr;
|
18563 | }
|
18564 |
|
18565 | function getInclusiveSummary(measurements, onlyClean) {
|
18566 | var candidates = {};
|
18567 | var inclusiveKey;
|
18568 |
|
18569 | for (var i = 0; i < measurements.length; i++) {
|
18570 | var measurement = measurements[i];
|
18571 | var allIDs = assign({}, measurement.exclusive, measurement.inclusive);
|
18572 | var cleanComponents;
|
18573 |
|
18574 | if (onlyClean) {
|
18575 | cleanComponents = getUnchangedComponents(measurement);
|
18576 | }
|
18577 |
|
18578 | for (var id in allIDs) {
|
18579 | if (onlyClean && !cleanComponents[id]) {
|
18580 | continue;
|
18581 | }
|
18582 |
|
18583 | var displayName = measurement.displayNames[id];
|
18584 |
|
18585 | // Inclusive time is not useful for many components without knowing where
|
18586 | // they are instantiated. So we aggregate inclusive time with both the
|
18587 | // owner and current displayName as the key.
|
18588 | inclusiveKey = displayName.owner + ' > ' + displayName.current;
|
18589 |
|
18590 | candidates[inclusiveKey] = candidates[inclusiveKey] || {
|
18591 | componentName: inclusiveKey,
|
18592 | time: 0,
|
18593 | count: 0
|
18594 | };
|
18595 |
|
18596 | if (measurement.inclusive[id]) {
|
18597 | candidates[inclusiveKey].time += measurement.inclusive[id];
|
18598 | }
|
18599 | if (measurement.counts[id]) {
|
18600 | candidates[inclusiveKey].count += measurement.counts[id];
|
18601 | }
|
18602 | }
|
18603 | }
|
18604 |
|
18605 | // Now make a sorted array with the results.
|
18606 | var arr = [];
|
18607 | for (inclusiveKey in candidates) {
|
18608 | if (candidates[inclusiveKey].time >= DONT_CARE_THRESHOLD) {
|
18609 | arr.push(candidates[inclusiveKey]);
|
18610 | }
|
18611 | }
|
18612 |
|
18613 | arr.sort(function (a, b) {
|
18614 | return b.time - a.time;
|
18615 | });
|
18616 |
|
18617 | return arr;
|
18618 | }
|
18619 |
|
18620 | function getUnchangedComponents(measurement) {
|
18621 | // For a given reconcile, look at which components did not actually
|
18622 | // render anything to the DOM and return a mapping of their ID to
|
18623 | // the amount of time it took to render the entire subtree.
|
18624 | var cleanComponents = {};
|
18625 | var dirtyLeafIDs = Object.keys(measurement.writes);
|
18626 | var allIDs = assign({}, measurement.exclusive, measurement.inclusive);
|
18627 |
|
18628 | for (var id in allIDs) {
|
18629 | var isDirty = false;
|
18630 | // For each component that rendered, see if a component that triggered
|
18631 | // a DOM op is in its subtree.
|
18632 | for (var i = 0; i < dirtyLeafIDs.length; i++) {
|
18633 | if (dirtyLeafIDs[i].indexOf(id) === 0) {
|
18634 | isDirty = true;
|
18635 | break;
|
18636 | }
|
18637 | }
|
18638 | // check if component newly created
|
18639 | if (measurement.created[id]) {
|
18640 | isDirty = true;
|
18641 | }
|
18642 | if (!isDirty && measurement.counts[id] > 0) {
|
18643 | cleanComponents[id] = true;
|
18644 | }
|
18645 | }
|
18646 | return cleanComponents;
|
18647 | }
|
18648 |
|
18649 | var ReactDefaultPerfAnalysis = {
|
18650 | getExclusiveSummary: getExclusiveSummary,
|
18651 | getInclusiveSummary: getInclusiveSummary,
|
18652 | getDOMSummary: getDOMSummary,
|
18653 | getTotalTime: getTotalTime
|
18654 | };
|
18655 |
|
18656 | module.exports = ReactDefaultPerfAnalysis;
|
18657 |
|
18658 | /***/ },
|
18659 | /* 145 */
|
18660 | /***/ function(module, exports, __webpack_require__) {
|
18661 |
|
18662 | /**
|
18663 | * Copyright 2013-2015, Facebook, Inc.
|
18664 | * All rights reserved.
|
18665 | *
|
18666 | * This source code is licensed under the BSD-style license found in the
|
18667 | * LICENSE file in the root directory of this source tree. An additional grant
|
18668 | * of patent rights can be found in the PATENTS file in the same directory.
|
18669 | *
|
18670 | * @providesModule performanceNow
|
18671 | * @typechecks
|
18672 | */
|
18673 |
|
18674 | 'use strict';
|
18675 |
|
18676 | var performance = __webpack_require__(146);
|
18677 |
|
18678 | var performanceNow;
|
18679 |
|
18680 | /**
|
18681 | * Detect if we can use `window.performance.now()` and gracefully fallback to
|
18682 | * `Date.now()` if it doesn't exist. We need to support Firefox < 15 for now
|
18683 | * because of Facebook's testing infrastructure.
|
18684 | */
|
18685 | if (performance.now) {
|
18686 | performanceNow = function () {
|
18687 | return performance.now();
|
18688 | };
|
18689 | } else {
|
18690 | performanceNow = function () {
|
18691 | return Date.now();
|
18692 | };
|
18693 | }
|
18694 |
|
18695 | module.exports = performanceNow;
|
18696 |
|
18697 | /***/ },
|
18698 | /* 146 */
|
18699 | /***/ function(module, exports, __webpack_require__) {
|
18700 |
|
18701 | /**
|
18702 | * Copyright 2013-2015, Facebook, Inc.
|
18703 | * All rights reserved.
|
18704 | *
|
18705 | * This source code is licensed under the BSD-style license found in the
|
18706 | * LICENSE file in the root directory of this source tree. An additional grant
|
18707 | * of patent rights can be found in the PATENTS file in the same directory.
|
18708 | *
|
18709 | * @providesModule performance
|
18710 | * @typechecks
|
18711 | */
|
18712 |
|
18713 | 'use strict';
|
18714 |
|
18715 | var ExecutionEnvironment = __webpack_require__(10);
|
18716 |
|
18717 | var performance;
|
18718 |
|
18719 | if (ExecutionEnvironment.canUseDOM) {
|
18720 | performance = window.performance || window.msPerformance || window.webkitPerformance;
|
18721 | }
|
18722 |
|
18723 | module.exports = performance || {};
|
18724 |
|
18725 | /***/ },
|
18726 | /* 147 */
|
18727 | /***/ function(module, exports) {
|
18728 |
|
18729 | /**
|
18730 | * Copyright 2013-2015, Facebook, Inc.
|
18731 | * All rights reserved.
|
18732 | *
|
18733 | * This source code is licensed under the BSD-style license found in the
|
18734 | * LICENSE file in the root directory of this source tree. An additional grant
|
18735 | * of patent rights can be found in the PATENTS file in the same directory.
|
18736 | *
|
18737 | * @providesModule ReactVersion
|
18738 | */
|
18739 |
|
18740 | 'use strict';
|
18741 |
|
18742 | module.exports = '0.14.8';
|
18743 |
|
18744 | /***/ },
|
18745 | /* 148 */
|
18746 | /***/ function(module, exports, __webpack_require__) {
|
18747 |
|
18748 | /**
|
18749 | * Copyright 2013-2015, Facebook, Inc.
|
18750 | * All rights reserved.
|
18751 | *
|
18752 | * This source code is licensed under the BSD-style license found in the
|
18753 | * LICENSE file in the root directory of this source tree. An additional grant
|
18754 | * of patent rights can be found in the PATENTS file in the same directory.
|
18755 | *
|
18756 | * @providesModule renderSubtreeIntoContainer
|
18757 | */
|
18758 |
|
18759 | 'use strict';
|
18760 |
|
18761 | var ReactMount = __webpack_require__(29);
|
18762 |
|
18763 | module.exports = ReactMount.renderSubtreeIntoContainer;
|
18764 |
|
18765 | /***/ },
|
18766 | /* 149 */
|
18767 | /***/ function(module, exports, __webpack_require__) {
|
18768 |
|
18769 | /**
|
18770 | * Copyright 2013-2015, Facebook, Inc.
|
18771 | * All rights reserved.
|
18772 | *
|
18773 | * This source code is licensed under the BSD-style license found in the
|
18774 | * LICENSE file in the root directory of this source tree. An additional grant
|
18775 | * of patent rights can be found in the PATENTS file in the same directory.
|
18776 | *
|
18777 | * @providesModule ReactDOMServer
|
18778 | */
|
18779 |
|
18780 | 'use strict';
|
18781 |
|
18782 | var ReactDefaultInjection = __webpack_require__(72);
|
18783 | var ReactServerRendering = __webpack_require__(150);
|
18784 | var ReactVersion = __webpack_require__(147);
|
18785 |
|
18786 | ReactDefaultInjection.inject();
|
18787 |
|
18788 | var ReactDOMServer = {
|
18789 | renderToString: ReactServerRendering.renderToString,
|
18790 | renderToStaticMarkup: ReactServerRendering.renderToStaticMarkup,
|
18791 | version: ReactVersion
|
18792 | };
|
18793 |
|
18794 | module.exports = ReactDOMServer;
|
18795 |
|
18796 | /***/ },
|
18797 | /* 150 */
|
18798 | /***/ function(module, exports, __webpack_require__) {
|
18799 |
|
18800 | /* WEBPACK VAR INJECTION */(function(process) {/**
|
18801 | * Copyright 2013-2015, Facebook, Inc.
|
18802 | * All rights reserved.
|
18803 | *
|
18804 | * This source code is licensed under the BSD-style license found in the
|
18805 | * LICENSE file in the root directory of this source tree. An additional grant
|
18806 | * of patent rights can be found in the PATENTS file in the same directory.
|
18807 | *
|
18808 | * @typechecks static-only
|
18809 | * @providesModule ReactServerRendering
|
18810 | */
|
18811 | 'use strict';
|
18812 |
|
18813 | var ReactDefaultBatchingStrategy = __webpack_require__(93);
|
18814 | var ReactElement = __webpack_require__(43);
|
18815 | var ReactInstanceHandles = __webpack_require__(46);
|
18816 | var ReactMarkupChecksum = __webpack_require__(49);
|
18817 | var ReactServerBatchingStrategy = __webpack_require__(151);
|
18818 | var ReactServerRenderingTransaction = __webpack_require__(152);
|
18819 | var ReactUpdates = __webpack_require__(55);
|
18820 |
|
18821 | var emptyObject = __webpack_require__(59);
|
18822 | var instantiateReactComponent = __webpack_require__(63);
|
18823 | var invariant = __webpack_require__(14);
|
18824 |
|
18825 | /**
|
18826 | * @param {ReactElement} element
|
18827 | * @return {string} the HTML markup
|
18828 | */
|
18829 | function renderToString(element) {
|
18830 | !ReactElement.isValidElement(element) ? process.env.NODE_ENV !== 'production' ? invariant(false, 'renderToString(): You must pass a valid ReactElement.') : invariant(false) : undefined;
|
18831 |
|
18832 | var transaction;
|
18833 | try {
|
18834 | ReactUpdates.injection.injectBatchingStrategy(ReactServerBatchingStrategy);
|
18835 |
|
18836 | var id = ReactInstanceHandles.createReactRootID();
|
18837 | transaction = ReactServerRenderingTransaction.getPooled(false);
|
18838 |
|
18839 | return transaction.perform(function () {
|
18840 | var componentInstance = instantiateReactComponent(element, null);
|
18841 | var markup = componentInstance.mountComponent(id, transaction, emptyObject);
|
18842 | return ReactMarkupChecksum.addChecksumToMarkup(markup);
|
18843 | }, null);
|
18844 | } finally {
|
18845 | ReactServerRenderingTransaction.release(transaction);
|
18846 | // Revert to the DOM batching strategy since these two renderers
|
18847 | // currently share these stateful modules.
|
18848 | ReactUpdates.injection.injectBatchingStrategy(ReactDefaultBatchingStrategy);
|
18849 | }
|
18850 | }
|
18851 |
|
18852 | /**
|
18853 | * @param {ReactElement} element
|
18854 | * @return {string} the HTML markup, without the extra React ID and checksum
|
18855 | * (for generating static pages)
|
18856 | */
|
18857 | function renderToStaticMarkup(element) {
|
18858 | !ReactElement.isValidElement(element) ? process.env.NODE_ENV !== 'production' ? invariant(false, 'renderToStaticMarkup(): You must pass a valid ReactElement.') : invariant(false) : undefined;
|
18859 |
|
18860 | var transaction;
|
18861 | try {
|
18862 | ReactUpdates.injection.injectBatchingStrategy(ReactServerBatchingStrategy);
|
18863 |
|
18864 | var id = ReactInstanceHandles.createReactRootID();
|
18865 | transaction = ReactServerRenderingTransaction.getPooled(true);
|
18866 |
|
18867 | return transaction.perform(function () {
|
18868 | var componentInstance = instantiateReactComponent(element, null);
|
18869 | return componentInstance.mountComponent(id, transaction, emptyObject);
|
18870 | }, null);
|
18871 | } finally {
|
18872 | ReactServerRenderingTransaction.release(transaction);
|
18873 | // Revert to the DOM batching strategy since these two renderers
|
18874 | // currently share these stateful modules.
|
18875 | ReactUpdates.injection.injectBatchingStrategy(ReactDefaultBatchingStrategy);
|
18876 | }
|
18877 | }
|
18878 |
|
18879 | module.exports = {
|
18880 | renderToString: renderToString,
|
18881 | renderToStaticMarkup: renderToStaticMarkup
|
18882 | };
|
18883 | /* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(5)))
|
18884 |
|
18885 | /***/ },
|
18886 | /* 151 */
|
18887 | /***/ function(module, exports) {
|
18888 |
|
18889 | /**
|
18890 | * Copyright 2014-2015, Facebook, Inc.
|
18891 | * All rights reserved.
|
18892 | *
|
18893 | * This source code is licensed under the BSD-style license found in the
|
18894 | * LICENSE file in the root directory of this source tree. An additional grant
|
18895 | * of patent rights can be found in the PATENTS file in the same directory.
|
18896 | *
|
18897 | * @providesModule ReactServerBatchingStrategy
|
18898 | * @typechecks
|
18899 | */
|
18900 |
|
18901 | 'use strict';
|
18902 |
|
18903 | var ReactServerBatchingStrategy = {
|
18904 | isBatchingUpdates: false,
|
18905 | batchedUpdates: function (callback) {
|
18906 | // Don't do anything here. During the server rendering we don't want to
|
18907 | // schedule any updates. We will simply ignore them.
|
18908 | }
|
18909 | };
|
18910 |
|
18911 | module.exports = ReactServerBatchingStrategy;
|
18912 |
|
18913 | /***/ },
|
18914 | /* 152 */
|
18915 | /***/ function(module, exports, __webpack_require__) {
|
18916 |
|
18917 | /**
|
18918 | * Copyright 2014-2015, Facebook, Inc.
|
18919 | * All rights reserved.
|
18920 | *
|
18921 | * This source code is licensed under the BSD-style license found in the
|
18922 | * LICENSE file in the root directory of this source tree. An additional grant
|
18923 | * of patent rights can be found in the PATENTS file in the same directory.
|
18924 | *
|
18925 | * @providesModule ReactServerRenderingTransaction
|
18926 | * @typechecks
|
18927 | */
|
18928 |
|
18929 | 'use strict';
|
18930 |
|
18931 | var PooledClass = __webpack_require__(57);
|
18932 | var CallbackQueue = __webpack_require__(56);
|
18933 | var Transaction = __webpack_require__(58);
|
18934 |
|
18935 | var assign = __webpack_require__(40);
|
18936 | var emptyFunction = __webpack_require__(16);
|
18937 |
|
18938 | /**
|
18939 | * Provides a `CallbackQueue` queue for collecting `onDOMReady` callbacks
|
18940 | * during the performing of the transaction.
|
18941 | */
|
18942 | var ON_DOM_READY_QUEUEING = {
|
18943 | /**
|
18944 | * Initializes the internal `onDOMReady` queue.
|
18945 | */
|
18946 | initialize: function () {
|
18947 | this.reactMountReady.reset();
|
18948 | },
|
18949 |
|
18950 | close: emptyFunction
|
18951 | };
|
18952 |
|
18953 | /**
|
18954 | * Executed within the scope of the `Transaction` instance. Consider these as
|
18955 | * being member methods, but with an implied ordering while being isolated from
|
18956 | * each other.
|
18957 | */
|
18958 | var TRANSACTION_WRAPPERS = [ON_DOM_READY_QUEUEING];
|
18959 |
|
18960 | /**
|
18961 | * @class ReactServerRenderingTransaction
|
18962 | * @param {boolean} renderToStaticMarkup
|
18963 | */
|
18964 | function ReactServerRenderingTransaction(renderToStaticMarkup) {
|
18965 | this.reinitializeTransaction();
|
18966 | this.renderToStaticMarkup = renderToStaticMarkup;
|
18967 | this.reactMountReady = CallbackQueue.getPooled(null);
|
18968 | this.useCreateElement = false;
|
18969 | }
|
18970 |
|
18971 | var Mixin = {
|
18972 | /**
|
18973 | * @see Transaction
|
18974 | * @abstract
|
18975 | * @final
|
18976 | * @return {array} Empty list of operation wrap procedures.
|
18977 | */
|
18978 | getTransactionWrappers: function () {
|
18979 | return TRANSACTION_WRAPPERS;
|
18980 | },
|
18981 |
|
18982 | /**
|
18983 | * @return {object} The queue to collect `onDOMReady` callbacks with.
|
18984 | */
|
18985 | getReactMountReady: function () {
|
18986 | return this.reactMountReady;
|
18987 | },
|
18988 |
|
18989 | /**
|
18990 | * `PooledClass` looks for this, and will invoke this before allowing this
|
18991 | * instance to be reused.
|
18992 | */
|
18993 | destructor: function () {
|
18994 | CallbackQueue.release(this.reactMountReady);
|
18995 | this.reactMountReady = null;
|
18996 | }
|
18997 | };
|
18998 |
|
18999 | assign(ReactServerRenderingTransaction.prototype, Transaction.Mixin, Mixin);
|
19000 |
|
19001 | PooledClass.addPoolingTo(ReactServerRenderingTransaction);
|
19002 |
|
19003 | module.exports = ReactServerRenderingTransaction;
|
19004 |
|
19005 | /***/ },
|
19006 | /* 153 */
|
19007 | /***/ function(module, exports, __webpack_require__) {
|
19008 |
|
19009 | /* WEBPACK VAR INJECTION */(function(process) {/**
|
19010 | * Copyright 2013-2015, Facebook, Inc.
|
19011 | * All rights reserved.
|
19012 | *
|
19013 | * This source code is licensed under the BSD-style license found in the
|
19014 | * LICENSE file in the root directory of this source tree. An additional grant
|
19015 | * of patent rights can be found in the PATENTS file in the same directory.
|
19016 | *
|
19017 | * @providesModule ReactIsomorphic
|
19018 | */
|
19019 |
|
19020 | 'use strict';
|
19021 |
|
19022 | var ReactChildren = __webpack_require__(111);
|
19023 | var ReactComponent = __webpack_require__(124);
|
19024 | var ReactClass = __webpack_require__(123);
|
19025 | var ReactDOMFactories = __webpack_require__(154);
|
19026 | var ReactElement = __webpack_require__(43);
|
19027 | var ReactElementValidator = __webpack_require__(155);
|
19028 | var ReactPropTypes = __webpack_require__(108);
|
19029 | var ReactVersion = __webpack_require__(147);
|
19030 |
|
19031 | var assign = __webpack_require__(40);
|
19032 | var onlyChild = __webpack_require__(157);
|
19033 |
|
19034 | var createElement = ReactElement.createElement;
|
19035 | var createFactory = ReactElement.createFactory;
|
19036 | var cloneElement = ReactElement.cloneElement;
|
19037 |
|
19038 | if (process.env.NODE_ENV !== 'production') {
|
19039 | createElement = ReactElementValidator.createElement;
|
19040 | createFactory = ReactElementValidator.createFactory;
|
19041 | cloneElement = ReactElementValidator.cloneElement;
|
19042 | }
|
19043 |
|
19044 | var React = {
|
19045 |
|
19046 | // Modern
|
19047 |
|
19048 | Children: {
|
19049 | map: ReactChildren.map,
|
19050 | forEach: ReactChildren.forEach,
|
19051 | count: ReactChildren.count,
|
19052 | toArray: ReactChildren.toArray,
|
19053 | only: onlyChild
|
19054 | },
|
19055 |
|
19056 | Component: ReactComponent,
|
19057 |
|
19058 | createElement: createElement,
|
19059 | cloneElement: cloneElement,
|
19060 | isValidElement: ReactElement.isValidElement,
|
19061 |
|
19062 | // Classic
|
19063 |
|
19064 | PropTypes: ReactPropTypes,
|
19065 | createClass: ReactClass.createClass,
|
19066 | createFactory: createFactory,
|
19067 | createMixin: function (mixin) {
|
19068 | // Currently a noop. Will be used to validate and trace mixins.
|
19069 | return mixin;
|
19070 | },
|
19071 |
|
19072 | // This looks DOM specific but these are actually isomorphic helpers
|
19073 | // since they are just generating DOM strings.
|
19074 | DOM: ReactDOMFactories,
|
19075 |
|
19076 | version: ReactVersion,
|
19077 |
|
19078 | // Hook for JSX spread, don't use this for anything else.
|
19079 | __spread: assign
|
19080 | };
|
19081 |
|
19082 | module.exports = React;
|
19083 | /* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(5)))
|
19084 |
|
19085 | /***/ },
|
19086 | /* 154 */
|
19087 | /***/ function(module, exports, __webpack_require__) {
|
19088 |
|
19089 | /* WEBPACK VAR INJECTION */(function(process) {/**
|
19090 | * Copyright 2013-2015, Facebook, Inc.
|
19091 | * All rights reserved.
|
19092 | *
|
19093 | * This source code is licensed under the BSD-style license found in the
|
19094 | * LICENSE file in the root directory of this source tree. An additional grant
|
19095 | * of patent rights can be found in the PATENTS file in the same directory.
|
19096 | *
|
19097 | * @providesModule ReactDOMFactories
|
19098 | * @typechecks static-only
|
19099 | */
|
19100 |
|
19101 | 'use strict';
|
19102 |
|
19103 | var ReactElement = __webpack_require__(43);
|
19104 | var ReactElementValidator = __webpack_require__(155);
|
19105 |
|
19106 | var mapObject = __webpack_require__(156);
|
19107 |
|
19108 | /**
|
19109 | * Create a factory that creates HTML tag elements.
|
19110 | *
|
19111 | * @param {string} tag Tag name (e.g. `div`).
|
19112 | * @private
|
19113 | */
|
19114 | function createDOMFactory(tag) {
|
19115 | if (process.env.NODE_ENV !== 'production') {
|
19116 | return ReactElementValidator.createFactory(tag);
|
19117 | }
|
19118 | return ReactElement.createFactory(tag);
|
19119 | }
|
19120 |
|
19121 | /**
|
19122 | * Creates a mapping from supported HTML tags to `ReactDOMComponent` classes.
|
19123 | * This is also accessible via `React.DOM`.
|
19124 | *
|
19125 | * @public
|
19126 | */
|
19127 | var ReactDOMFactories = mapObject({
|
19128 | a: 'a',
|
19129 | abbr: 'abbr',
|
19130 | address: 'address',
|
19131 | area: 'area',
|
19132 | article: 'article',
|
19133 | aside: 'aside',
|
19134 | audio: 'audio',
|
19135 | b: 'b',
|
19136 | base: 'base',
|
19137 | bdi: 'bdi',
|
19138 | bdo: 'bdo',
|
19139 | big: 'big',
|
19140 | blockquote: 'blockquote',
|
19141 | body: 'body',
|
19142 | br: 'br',
|
19143 | button: 'button',
|
19144 | canvas: 'canvas',
|
19145 | caption: 'caption',
|
19146 | cite: 'cite',
|
19147 | code: 'code',
|
19148 | col: 'col',
|
19149 | colgroup: 'colgroup',
|
19150 | data: 'data',
|
19151 | datalist: 'datalist',
|
19152 | dd: 'dd',
|
19153 | del: 'del',
|
19154 | details: 'details',
|
19155 | dfn: 'dfn',
|
19156 | dialog: 'dialog',
|
19157 | div: 'div',
|
19158 | dl: 'dl',
|
19159 | dt: 'dt',
|
19160 | em: 'em',
|
19161 | embed: 'embed',
|
19162 | fieldset: 'fieldset',
|
19163 | figcaption: 'figcaption',
|
19164 | figure: 'figure',
|
19165 | footer: 'footer',
|
19166 | form: 'form',
|
19167 | h1: 'h1',
|
19168 | h2: 'h2',
|
19169 | h3: 'h3',
|
19170 | h4: 'h4',
|
19171 | h5: 'h5',
|
19172 | h6: 'h6',
|
19173 | head: 'head',
|
19174 | header: 'header',
|
19175 | hgroup: 'hgroup',
|
19176 | hr: 'hr',
|
19177 | html: 'html',
|
19178 | i: 'i',
|
19179 | iframe: 'iframe',
|
19180 | img: 'img',
|
19181 | input: 'input',
|
19182 | ins: 'ins',
|
19183 | kbd: 'kbd',
|
19184 | keygen: 'keygen',
|
19185 | label: 'label',
|
19186 | legend: 'legend',
|
19187 | li: 'li',
|
19188 | link: 'link',
|
19189 | main: 'main',
|
19190 | map: 'map',
|
19191 | mark: 'mark',
|
19192 | menu: 'menu',
|
19193 | menuitem: 'menuitem',
|
19194 | meta: 'meta',
|
19195 | meter: 'meter',
|
19196 | nav: 'nav',
|
19197 | noscript: 'noscript',
|
19198 | object: 'object',
|
19199 | ol: 'ol',
|
19200 | optgroup: 'optgroup',
|
19201 | option: 'option',
|
19202 | output: 'output',
|
19203 | p: 'p',
|
19204 | param: 'param',
|
19205 | picture: 'picture',
|
19206 | pre: 'pre',
|
19207 | progress: 'progress',
|
19208 | q: 'q',
|
19209 | rp: 'rp',
|
19210 | rt: 'rt',
|
19211 | ruby: 'ruby',
|
19212 | s: 's',
|
19213 | samp: 'samp',
|
19214 | script: 'script',
|
19215 | section: 'section',
|
19216 | select: 'select',
|
19217 | small: 'small',
|
19218 | source: 'source',
|
19219 | span: 'span',
|
19220 | strong: 'strong',
|
19221 | style: 'style',
|
19222 | sub: 'sub',
|
19223 | summary: 'summary',
|
19224 | sup: 'sup',
|
19225 | table: 'table',
|
19226 | tbody: 'tbody',
|
19227 | td: 'td',
|
19228 | textarea: 'textarea',
|
19229 | tfoot: 'tfoot',
|
19230 | th: 'th',
|
19231 | thead: 'thead',
|
19232 | time: 'time',
|
19233 | title: 'title',
|
19234 | tr: 'tr',
|
19235 | track: 'track',
|
19236 | u: 'u',
|
19237 | ul: 'ul',
|
19238 | 'var': 'var',
|
19239 | video: 'video',
|
19240 | wbr: 'wbr',
|
19241 |
|
19242 | // SVG
|
19243 | circle: 'circle',
|
19244 | clipPath: 'clipPath',
|
19245 | defs: 'defs',
|
19246 | ellipse: 'ellipse',
|
19247 | g: 'g',
|
19248 | image: 'image',
|
19249 | line: 'line',
|
19250 | linearGradient: 'linearGradient',
|
19251 | mask: 'mask',
|
19252 | path: 'path',
|
19253 | pattern: 'pattern',
|
19254 | polygon: 'polygon',
|
19255 | polyline: 'polyline',
|
19256 | radialGradient: 'radialGradient',
|
19257 | rect: 'rect',
|
19258 | stop: 'stop',
|
19259 | svg: 'svg',
|
19260 | text: 'text',
|
19261 | tspan: 'tspan'
|
19262 |
|
19263 | }, createDOMFactory);
|
19264 |
|
19265 | module.exports = ReactDOMFactories;
|
19266 | /* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(5)))
|
19267 |
|
19268 | /***/ },
|
19269 | /* 155 */
|
19270 | /***/ function(module, exports, __webpack_require__) {
|
19271 |
|
19272 | /* WEBPACK VAR INJECTION */(function(process) {/**
|
19273 | * Copyright 2014-2015, Facebook, Inc.
|
19274 | * All rights reserved.
|
19275 | *
|
19276 | * This source code is licensed under the BSD-style license found in the
|
19277 | * LICENSE file in the root directory of this source tree. An additional grant
|
19278 | * of patent rights can be found in the PATENTS file in the same directory.
|
19279 | *
|
19280 | * @providesModule ReactElementValidator
|
19281 | */
|
19282 |
|
19283 | /**
|
19284 | * ReactElementValidator provides a wrapper around a element factory
|
19285 | * which validates the props passed to the element. This is intended to be
|
19286 | * used only in DEV and could be replaced by a static type checker for languages
|
19287 | * that support it.
|
19288 | */
|
19289 |
|
19290 | 'use strict';
|
19291 |
|
19292 | var ReactElement = __webpack_require__(43);
|
19293 | var ReactPropTypeLocations = __webpack_require__(66);
|
19294 | var ReactPropTypeLocationNames = __webpack_require__(67);
|
19295 | var ReactCurrentOwner = __webpack_require__(6);
|
19296 |
|
19297 | var canDefineProperty = __webpack_require__(44);
|
19298 | var getIteratorFn = __webpack_require__(109);
|
19299 | var invariant = __webpack_require__(14);
|
19300 | var warning = __webpack_require__(26);
|
19301 |
|
19302 | function getDeclarationErrorAddendum() {
|
19303 | if (ReactCurrentOwner.current) {
|
19304 | var name = ReactCurrentOwner.current.getName();
|
19305 | if (name) {
|
19306 | return ' Check the render method of `' + name + '`.';
|
19307 | }
|
19308 | }
|
19309 | return '';
|
19310 | }
|
19311 |
|
19312 | /**
|
19313 | * Warn if there's no key explicitly set on dynamic arrays of children or
|
19314 | * object keys are not valid. This allows us to keep track of children between
|
19315 | * updates.
|
19316 | */
|
19317 | var ownerHasKeyUseWarning = {};
|
19318 |
|
19319 | var loggedTypeFailures = {};
|
19320 |
|
19321 | /**
|
19322 | * Warn if the element doesn't have an explicit key assigned to it.
|
19323 | * This element is in an array. The array could grow and shrink or be
|
19324 | * reordered. All children that haven't already been validated are required to
|
19325 | * have a "key" property assigned to it.
|
19326 | *
|
19327 | * @internal
|
19328 | * @param {ReactElement} element Element that requires a key.
|
19329 | * @param {*} parentType element's parent's type.
|
19330 | */
|
19331 | function validateExplicitKey(element, parentType) {
|
19332 | if (!element._store || element._store.validated || element.key != null) {
|
19333 | return;
|
19334 | }
|
19335 | element._store.validated = true;
|
19336 |
|
19337 | var addenda = getAddendaForKeyUse('uniqueKey', element, parentType);
|
19338 | if (addenda === null) {
|
19339 | // we already showed the warning
|
19340 | return;
|
19341 | }
|
19342 | process.env.NODE_ENV !== 'production' ? warning(false, 'Each child in an array or iterator should have a unique "key" prop.' + '%s%s%s', addenda.parentOrOwner || '', addenda.childOwner || '', addenda.url || '') : undefined;
|
19343 | }
|
19344 |
|
19345 | /**
|
19346 | * Shared warning and monitoring code for the key warnings.
|
19347 | *
|
19348 | * @internal
|
19349 | * @param {string} messageType A key used for de-duping warnings.
|
19350 | * @param {ReactElement} element Component that requires a key.
|
19351 | * @param {*} parentType element's parent's type.
|
19352 | * @returns {?object} A set of addenda to use in the warning message, or null
|
19353 | * if the warning has already been shown before (and shouldn't be shown again).
|
19354 | */
|
19355 | function getAddendaForKeyUse(messageType, element, parentType) {
|
19356 | var addendum = getDeclarationErrorAddendum();
|
19357 | if (!addendum) {
|
19358 | var parentName = typeof parentType === 'string' ? parentType : parentType.displayName || parentType.name;
|
19359 | if (parentName) {
|
19360 | addendum = ' Check the top-level render call using <' + parentName + '>.';
|
19361 | }
|
19362 | }
|
19363 |
|
19364 | var memoizer = ownerHasKeyUseWarning[messageType] || (ownerHasKeyUseWarning[messageType] = {});
|
19365 | if (memoizer[addendum]) {
|
19366 | return null;
|
19367 | }
|
19368 | memoizer[addendum] = true;
|
19369 |
|
19370 | var addenda = {
|
19371 | parentOrOwner: addendum,
|
19372 | url: ' See https://fb.me/react-warning-keys for more information.',
|
19373 | childOwner: null
|
19374 | };
|
19375 |
|
19376 | // Usually the current owner is the offender, but if it accepts children as a
|
19377 | // property, it may be the creator of the child that's responsible for
|
19378 | // assigning it a key.
|
19379 | if (element && element._owner && element._owner !== ReactCurrentOwner.current) {
|
19380 | // Give the component that originally created this child.
|
19381 | addenda.childOwner = ' It was passed a child from ' + element._owner.getName() + '.';
|
19382 | }
|
19383 |
|
19384 | return addenda;
|
19385 | }
|
19386 |
|
19387 | /**
|
19388 | * Ensure that every element either is passed in a static location, in an
|
19389 | * array with an explicit keys property defined, or in an object literal
|
19390 | * with valid key property.
|
19391 | *
|
19392 | * @internal
|
19393 | * @param {ReactNode} node Statically passed child of any type.
|
19394 | * @param {*} parentType node's parent's type.
|
19395 | */
|
19396 | function validateChildKeys(node, parentType) {
|
19397 | if (typeof node !== 'object') {
|
19398 | return;
|
19399 | }
|
19400 | if (Array.isArray(node)) {
|
19401 | for (var i = 0; i < node.length; i++) {
|
19402 | var child = node[i];
|
19403 | if (ReactElement.isValidElement(child)) {
|
19404 | validateExplicitKey(child, parentType);
|
19405 | }
|
19406 | }
|
19407 | } else if (ReactElement.isValidElement(node)) {
|
19408 | // This element was passed in a valid location.
|
19409 | if (node._store) {
|
19410 | node._store.validated = true;
|
19411 | }
|
19412 | } else if (node) {
|
19413 | var iteratorFn = getIteratorFn(node);
|
19414 | // Entry iterators provide implicit keys.
|
19415 | if (iteratorFn) {
|
19416 | if (iteratorFn !== node.entries) {
|
19417 | var iterator = iteratorFn.call(node);
|
19418 | var step;
|
19419 | while (!(step = iterator.next()).done) {
|
19420 | if (ReactElement.isValidElement(step.value)) {
|
19421 | validateExplicitKey(step.value, parentType);
|
19422 | }
|
19423 | }
|
19424 | }
|
19425 | }
|
19426 | }
|
19427 | }
|
19428 |
|
19429 | /**
|
19430 | * Assert that the props are valid
|
19431 | *
|
19432 | * @param {string} componentName Name of the component for error messages.
|
19433 | * @param {object} propTypes Map of prop name to a ReactPropType
|
19434 | * @param {object} props
|
19435 | * @param {string} location e.g. "prop", "context", "child context"
|
19436 | * @private
|
19437 | */
|
19438 | function checkPropTypes(componentName, propTypes, props, location) {
|
19439 | for (var propName in propTypes) {
|
19440 | if (propTypes.hasOwnProperty(propName)) {
|
19441 | var error;
|
19442 | // Prop type validation may throw. In case they do, we don't want to
|
19443 | // fail the render phase where it didn't fail before. So we log it.
|
19444 | // After these have been cleaned up, we'll let them throw.
|
19445 | try {
|
19446 | // This is intentionally an invariant that gets caught. It's the same
|
19447 | // behavior as without this statement except with a better message.
|
19448 | !(typeof propTypes[propName] === 'function') ? process.env.NODE_ENV !== 'production' ? invariant(false, '%s: %s type `%s` is invalid; it must be a function, usually from ' + 'React.PropTypes.', componentName || 'React class', ReactPropTypeLocationNames[location], propName) : invariant(false) : undefined;
|
19449 | error = propTypes[propName](props, propName, componentName, location);
|
19450 | } catch (ex) {
|
19451 | error = ex;
|
19452 | }
|
19453 | process.env.NODE_ENV !== 'production' ? warning(!error || error instanceof Error, '%s: type specification of %s `%s` is invalid; the type checker ' + 'function must return `null` or an `Error` but returned a %s. ' + 'You may have forgotten to pass an argument to the type checker ' + 'creator (arrayOf, instanceOf, objectOf, oneOf, oneOfType, and ' + 'shape all require an argument).', componentName || 'React class', ReactPropTypeLocationNames[location], propName, typeof error) : undefined;
|
19454 | if (error instanceof Error && !(error.message in loggedTypeFailures)) {
|
19455 | // Only monitor this failure once because there tends to be a lot of the
|
19456 | // same error.
|
19457 | loggedTypeFailures[error.message] = true;
|
19458 |
|
19459 | var addendum = getDeclarationErrorAddendum();
|
19460 | process.env.NODE_ENV !== 'production' ? warning(false, 'Failed propType: %s%s', error.message, addendum) : undefined;
|
19461 | }
|
19462 | }
|
19463 | }
|
19464 | }
|
19465 |
|
19466 | /**
|
19467 | * Given an element, validate that its props follow the propTypes definition,
|
19468 | * provided by the type.
|
19469 | *
|
19470 | * @param {ReactElement} element
|
19471 | */
|
19472 | function validatePropTypes(element) {
|
19473 | var componentClass = element.type;
|
19474 | if (typeof componentClass !== 'function') {
|
19475 | return;
|
19476 | }
|
19477 | var name = componentClass.displayName || componentClass.name;
|
19478 | if (componentClass.propTypes) {
|
19479 | checkPropTypes(name, componentClass.propTypes, element.props, ReactPropTypeLocations.prop);
|
19480 | }
|
19481 | if (typeof componentClass.getDefaultProps === 'function') {
|
19482 | process.env.NODE_ENV !== 'production' ? warning(componentClass.getDefaultProps.isReactClassApproved, 'getDefaultProps is only used on classic React.createClass ' + 'definitions. Use a static property named `defaultProps` instead.') : undefined;
|
19483 | }
|
19484 | }
|
19485 |
|
19486 | var ReactElementValidator = {
|
19487 |
|
19488 | createElement: function (type, props, children) {
|
19489 | var validType = typeof type === 'string' || typeof type === 'function';
|
19490 | // We warn in this case but don't throw. We expect the element creation to
|
19491 | // succeed and there will likely be errors in render.
|
19492 | process.env.NODE_ENV !== 'production' ? warning(validType, 'React.createElement: type should not be null, undefined, boolean, or ' + 'number. It should be a string (for DOM elements) or a ReactClass ' + '(for composite components).%s', getDeclarationErrorAddendum()) : undefined;
|
19493 |
|
19494 | var element = ReactElement.createElement.apply(this, arguments);
|
19495 |
|
19496 | // The result can be nullish if a mock or a custom function is used.
|
19497 | // TODO: Drop this when these are no longer allowed as the type argument.
|
19498 | if (element == null) {
|
19499 | return element;
|
19500 | }
|
19501 |
|
19502 | // Skip key warning if the type isn't valid since our key validation logic
|
19503 | // doesn't expect a non-string/function type and can throw confusing errors.
|
19504 | // We don't want exception behavior to differ between dev and prod.
|
19505 | // (Rendering will throw with a helpful message and as soon as the type is
|
19506 | // fixed, the key warnings will appear.)
|
19507 | if (validType) {
|
19508 | for (var i = 2; i < arguments.length; i++) {
|
19509 | validateChildKeys(arguments[i], type);
|
19510 | }
|
19511 | }
|
19512 |
|
19513 | validatePropTypes(element);
|
19514 |
|
19515 | return element;
|
19516 | },
|
19517 |
|
19518 | createFactory: function (type) {
|
19519 | var validatedFactory = ReactElementValidator.createElement.bind(null, type);
|
19520 | // Legacy hook TODO: Warn if this is accessed
|
19521 | validatedFactory.type = type;
|
19522 |
|
19523 | if (process.env.NODE_ENV !== 'production') {
|
19524 | if (canDefineProperty) {
|
19525 | Object.defineProperty(validatedFactory, 'type', {
|
19526 | enumerable: false,
|
19527 | get: function () {
|
19528 | process.env.NODE_ENV !== 'production' ? warning(false, 'Factory.type is deprecated. Access the class directly ' + 'before passing it to createFactory.') : undefined;
|
19529 | Object.defineProperty(this, 'type', {
|
19530 | value: type
|
19531 | });
|
19532 | return type;
|
19533 | }
|
19534 | });
|
19535 | }
|
19536 | }
|
19537 |
|
19538 | return validatedFactory;
|
19539 | },
|
19540 |
|
19541 | cloneElement: function (element, props, children) {
|
19542 | var newElement = ReactElement.cloneElement.apply(this, arguments);
|
19543 | for (var i = 2; i < arguments.length; i++) {
|
19544 | validateChildKeys(arguments[i], newElement.type);
|
19545 | }
|
19546 | validatePropTypes(newElement);
|
19547 | return newElement;
|
19548 | }
|
19549 |
|
19550 | };
|
19551 |
|
19552 | module.exports = ReactElementValidator;
|
19553 | /* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(5)))
|
19554 |
|
19555 | /***/ },
|
19556 | /* 156 */
|
19557 | /***/ function(module, exports) {
|
19558 |
|
19559 | /**
|
19560 | * Copyright 2013-2015, Facebook, Inc.
|
19561 | * All rights reserved.
|
19562 | *
|
19563 | * This source code is licensed under the BSD-style license found in the
|
19564 | * LICENSE file in the root directory of this source tree. An additional grant
|
19565 | * of patent rights can be found in the PATENTS file in the same directory.
|
19566 | *
|
19567 | * @providesModule mapObject
|
19568 | */
|
19569 |
|
19570 | 'use strict';
|
19571 |
|
19572 | var hasOwnProperty = Object.prototype.hasOwnProperty;
|
19573 |
|
19574 | /**
|
19575 | * Executes the provided `callback` once for each enumerable own property in the
|
19576 | * object and constructs a new object from the results. The `callback` is
|
19577 | * invoked with three arguments:
|
19578 | *
|
19579 | * - the property value
|
19580 | * - the property name
|
19581 | * - the object being traversed
|
19582 | *
|
19583 | * Properties that are added after the call to `mapObject` will not be visited
|
19584 | * by `callback`. If the values of existing properties are changed, the value
|
19585 | * passed to `callback` will be the value at the time `mapObject` visits them.
|
19586 | * Properties that are deleted before being visited are not visited.
|
19587 | *
|
19588 | * @grep function objectMap()
|
19589 | * @grep function objMap()
|
19590 | *
|
19591 | * @param {?object} object
|
19592 | * @param {function} callback
|
19593 | * @param {*} context
|
19594 | * @return {?object}
|
19595 | */
|
19596 | function mapObject(object, callback, context) {
|
19597 | if (!object) {
|
19598 | return null;
|
19599 | }
|
19600 | var result = {};
|
19601 | for (var name in object) {
|
19602 | if (hasOwnProperty.call(object, name)) {
|
19603 | result[name] = callback.call(context, object[name], name, object);
|
19604 | }
|
19605 | }
|
19606 | return result;
|
19607 | }
|
19608 |
|
19609 | module.exports = mapObject;
|
19610 |
|
19611 | /***/ },
|
19612 | /* 157 */
|
19613 | /***/ function(module, exports, __webpack_require__) {
|
19614 |
|
19615 | /* WEBPACK VAR INJECTION */(function(process) {/**
|
19616 | * Copyright 2013-2015, Facebook, Inc.
|
19617 | * All rights reserved.
|
19618 | *
|
19619 | * This source code is licensed under the BSD-style license found in the
|
19620 | * LICENSE file in the root directory of this source tree. An additional grant
|
19621 | * of patent rights can be found in the PATENTS file in the same directory.
|
19622 | *
|
19623 | * @providesModule onlyChild
|
19624 | */
|
19625 | 'use strict';
|
19626 |
|
19627 | var ReactElement = __webpack_require__(43);
|
19628 |
|
19629 | var invariant = __webpack_require__(14);
|
19630 |
|
19631 | /**
|
19632 | * Returns the first child in a collection of children and verifies that there
|
19633 | * is only one child in the collection. The current implementation of this
|
19634 | * function assumes that a single child gets passed without a wrapper, but the
|
19635 | * purpose of this helper function is to abstract away the particular structure
|
19636 | * of children.
|
19637 | *
|
19638 | * @param {?object} children Child collection structure.
|
19639 | * @return {ReactComponent} The first and only `ReactComponent` contained in the
|
19640 | * structure.
|
19641 | */
|
19642 | function onlyChild(children) {
|
19643 | !ReactElement.isValidElement(children) ? process.env.NODE_ENV !== 'production' ? invariant(false, 'onlyChild must be passed a children with exactly one child.') : invariant(false) : undefined;
|
19644 | return children;
|
19645 | }
|
19646 |
|
19647 | module.exports = onlyChild;
|
19648 | /* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(5)))
|
19649 |
|
19650 | /***/ },
|
19651 | /* 158 */
|
19652 | /***/ function(module, exports, __webpack_require__) {
|
19653 |
|
19654 | /* WEBPACK VAR INJECTION */(function(process) {/**
|
19655 | * Copyright 2013-2015, Facebook, Inc.
|
19656 | * All rights reserved.
|
19657 | *
|
19658 | * This source code is licensed under the BSD-style license found in the
|
19659 | * LICENSE file in the root directory of this source tree. An additional grant
|
19660 | * of patent rights can be found in the PATENTS file in the same directory.
|
19661 | *
|
19662 | * @providesModule deprecated
|
19663 | */
|
19664 |
|
19665 | 'use strict';
|
19666 |
|
19667 | var assign = __webpack_require__(40);
|
19668 | var warning = __webpack_require__(26);
|
19669 |
|
19670 | /**
|
19671 | * This will log a single deprecation notice per function and forward the call
|
19672 | * on to the new API.
|
19673 | *
|
19674 | * @param {string} fnName The name of the function
|
19675 | * @param {string} newModule The module that fn will exist in
|
19676 | * @param {string} newPackage The module that fn will exist in
|
19677 | * @param {*} ctx The context this forwarded call should run in
|
19678 | * @param {function} fn The function to forward on to
|
19679 | * @return {function} The function that will warn once and then call fn
|
19680 | */
|
19681 | function deprecated(fnName, newModule, newPackage, ctx, fn) {
|
19682 | var warned = false;
|
19683 | if (process.env.NODE_ENV !== 'production') {
|
19684 | var newFn = function () {
|
19685 | process.env.NODE_ENV !== 'production' ? warning(warned,
|
19686 | // Require examples in this string must be split to prevent React's
|
19687 | // build tools from mistaking them for real requires.
|
19688 | // Otherwise the build tools will attempt to build a '%s' module.
|
19689 | 'React.%s is deprecated. Please use %s.%s from require' + '(\'%s\') ' + 'instead.', fnName, newModule, fnName, newPackage) : undefined;
|
19690 | warned = true;
|
19691 | return fn.apply(ctx, arguments);
|
19692 | };
|
19693 | // We need to make sure all properties of the original fn are copied over.
|
19694 | // In particular, this is needed to support PropTypes
|
19695 | return assign(newFn, fn);
|
19696 | }
|
19697 |
|
19698 | return fn;
|
19699 | }
|
19700 |
|
19701 | module.exports = deprecated;
|
19702 | /* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(5)))
|
19703 |
|
19704 | /***/ },
|
19705 | /* 159 */
|
19706 | /***/ function(module, exports, __webpack_require__) {
|
19707 |
|
19708 | 'use strict';
|
19709 |
|
19710 | module.exports = __webpack_require__(4);
|
19711 |
|
19712 |
|
19713 | /***/ },
|
19714 | /* 160 */
|
19715 | /***/ function(module, exports, __webpack_require__) {
|
19716 |
|
19717 | 'use strict';
|
19718 |
|
19719 | var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();
|
19720 |
|
19721 | var _react = __webpack_require__(2);
|
19722 |
|
19723 | var _react2 = _interopRequireDefault(_react);
|
19724 |
|
19725 | var _reactDom = __webpack_require__(159);
|
19726 |
|
19727 | var _index = __webpack_require__(1);
|
19728 |
|
19729 | var _index2 = _interopRequireDefault(_index);
|
19730 |
|
19731 | function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
19732 |
|
19733 | function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
19734 |
|
19735 | function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }
|
19736 |
|
19737 | function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }
|
19738 |
|
19739 | var Demo = function (_Component) {
|
19740 | _inherits(Demo, _Component);
|
19741 |
|
19742 | function Demo() {
|
19743 | _classCallCheck(this, Demo);
|
19744 |
|
19745 | return _possibleConstructorReturn(this, Object.getPrototypeOf(Demo).apply(this, arguments));
|
19746 | }
|
19747 |
|
19748 | _createClass(Demo, [{
|
19749 | key: 'render',
|
19750 | value: function render() {
|
19751 | return _react2.default.createElement(
|
19752 | 'div',
|
19753 | null,
|
19754 | _react2.default.createElement(_index2.default, null)
|
19755 | );
|
19756 | }
|
19757 | }]);
|
19758 |
|
19759 | return Demo;
|
19760 | }(_react.Component);
|
19761 |
|
19762 | (0, _reactDom.render)(_react2.default.createElement(Demo, null), document.getElementById('content'));
|
19763 |
|
19764 | /***/ }
|
19765 | /******/ ])
|
19766 | });
|
19767 | ; |
\ | No newline at end of file |