├── LICENSE ├── LICENSE-react ├── LICENSE-react-examples ├── README.md ├── css └── base.css ├── fiber.html ├── index.html ├── js ├── react-dom-fiber.js ├── react-dom.js └── react.js └── stack.html /LICENSE: -------------------------------------------------------------------------------- 1 | Copyright (c) 2017 Claudio Procida 2 | 3 | Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: 4 | 5 | The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. 6 | 7 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. -------------------------------------------------------------------------------- /LICENSE-react: -------------------------------------------------------------------------------- 1 | BSD License 2 | 3 | For React software 4 | 5 | Copyright (c) 2013-present, Facebook, Inc. 6 | All rights reserved. 7 | 8 | Redistribution and use in source and binary forms, with or without modification, 9 | are permitted provided that the following conditions are met: 10 | 11 | * Redistributions of source code must retain the above copyright notice, this 12 | list of conditions and the following disclaimer. 13 | 14 | * Redistributions in binary form must reproduce the above copyright notice, 15 | this list of conditions and the following disclaimer in the documentation 16 | and/or other materials provided with the distribution. 17 | 18 | * Neither the name Facebook nor the names of its contributors may be used to 19 | endorse or promote products derived from this software without specific 20 | prior written permission. 21 | 22 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND 23 | ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 24 | WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 25 | DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR 26 | ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 27 | (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 28 | LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON 29 | ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 30 | (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 31 | SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 32 | -------------------------------------------------------------------------------- /LICENSE-react-examples: -------------------------------------------------------------------------------- 1 | The examples provided by Facebook are for non-commercial testing and evaluation 2 | purposes only. Facebook reserves all rights not expressly granted. 3 | 4 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 5 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 6 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL 7 | FACEBOOK BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN 8 | ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION 9 | WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 10 | 11 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # React Fiber vs Stack Demo 2 | 3 | This demo shows the differences between Stack and Fiber by rendering a Sierpinski triangle that constantly shrinks and grows, and whose nodes have a value that increments by one every second. 4 | 5 | Used as a demo during the ReactJS Dublin Lightning Talks meetup of February 22nd 2017. 6 | 7 | ## License 8 | 9 | [MIT](https://opensource.org/licenses/MIT) 10 | 11 | Copyright (c) 2017 Claudio Procida 12 | 13 | React and Fiber example Copyright (c) 2013-present, Facebook, Inc. 14 | All rights reserved. 15 | -------------------------------------------------------------------------------- /css/base.css: -------------------------------------------------------------------------------- 1 | body { 2 | background: #fff; 3 | font-family: "Helvetica Neue", Helvetica, Arial, sans-serif; 4 | font-size: 15px; 5 | line-height: 1.7; 6 | margin: 0; 7 | padding: 30px; 8 | } 9 | 10 | a { 11 | color: #4183c4; 12 | text-decoration: none; 13 | } 14 | 15 | a:hover { 16 | text-decoration: underline; 17 | } 18 | 19 | code { 20 | background-color: #f8f8f8; 21 | border: 1px solid #ddd; 22 | border-radius: 3px; 23 | font-family: "Bitstream Vera Sans Mono", Consolas, Courier, monospace; 24 | font-size: 12px; 25 | margin: 0 2px; 26 | padding: 0px 5px; 27 | } 28 | 29 | h1, h2, h3, h4 { 30 | font-weight: bold; 31 | margin: 0 0 15px; 32 | padding: 0; 33 | } 34 | 35 | h1 { 36 | border-bottom: 1px solid #ddd; 37 | font-size: 2.5em; 38 | font-weight: bold; 39 | margin: 0 0 15px; 40 | padding: 0; 41 | } 42 | 43 | h2 { 44 | border-bottom: 1px solid #eee; 45 | font-size: 2em; 46 | } 47 | 48 | h3 { 49 | font-size: 1.5em; 50 | } 51 | 52 | h4 { 53 | font-size: 1.2em; 54 | } 55 | 56 | p, ul { 57 | margin: 15px 0; 58 | } 59 | 60 | ul { 61 | padding-left: 30px; 62 | } 63 | -------------------------------------------------------------------------------- /fiber.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | Fiber Example 6 | 7 | 8 | 9 |

Fiber Example

10 |
11 |

12 | To install React, follow the instructions on 13 | GitHub. 14 |

15 |

16 | If you can see this, React is not working right. 17 | If you checked out the source from GitHub make sure to run grunt. 18 |

19 |
20 | 21 | 22 | 23 | 171 | 172 | 173 | -------------------------------------------------------------------------------- /index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | Fiber vs Stack Demo 6 | 7 | 8 | 9 |

Fiber vs Stack Demo

10 |
11 |

12 | This demo shows the differences between Stack and Fiber by rendering a Sierpinski triangle 13 | that constantly shrinks and grows, and whose nodes have a value that increments by one every second. 14 |

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

Stack Example

10 |
11 |

12 | To install React, follow the instructions on 13 | GitHub. 14 |

15 |

16 | If you can see this, React is not working right. 17 | If you checked out the source from GitHub make sure to run grunt. 18 |

19 |
20 | 21 | 22 | 23 | 171 | 172 | 173 | --------------------------------------------------------------------------------