diff options
author | Florian Dold <florian.dold@gmail.com> | 2017-08-14 05:01:11 +0200 |
---|---|---|
committer | Florian Dold <florian.dold@gmail.com> | 2017-08-14 05:02:09 +0200 |
commit | 363723fc84f7b8477592e0105aeb331ec9a017af (patch) | |
tree | 29f92724f34131bac64d6a318dd7e30612e631c7 /node_modules/react/dist/react-with-addons.js | |
parent | 5634e77ad96bfe1818f6b6ee70b7379652e5487f (diff) |
node_modules
Diffstat (limited to 'node_modules/react/dist/react-with-addons.js')
-rw-r--r-- | node_modules/react/dist/react-with-addons.js | 2475 |
1 files changed, 1395 insertions, 1080 deletions
diff --git a/node_modules/react/dist/react-with-addons.js b/node_modules/react/dist/react-with-addons.js index 34eddc834..cba1e87d0 100644 --- a/node_modules/react/dist/react-with-addons.js +++ b/node_modules/react/dist/react-with-addons.js @@ -1,5 +1,5 @@ /** - * React (with addons) v15.5.4 + * React (with addons) v15.6.1 */ (function(f){if(typeof exports==="object"&&typeof module!=="undefined"){module.exports=f()}else if(typeof define==="function"&&define.amd){define([],f)}else{var g;if(typeof window!=="undefined"){g=window}else if(typeof global!=="undefined"){g=global}else if(typeof self!=="undefined"){g=self}else{g=this}g.React = f()}})(function(){var define,module,exports;return (function e(t,n,r){function s(o,u){if(!n[o]){if(!t[o]){var a=typeof require=="function"&&require;if(!u&&a)return a(o,!0);if(i)return i(o,!0);var f=new Error("Cannot find module '"+o+"'");throw f.code="MODULE_NOT_FOUND",f}var l=n[o]={exports:{}};t[o][0].call(l.exports,function(e){var n=t[o][1][e];return s(n?n:e)},l,l.exports,e,t,n,r)}return n[o].exports}var i=typeof require=="function"&&require;for(var o=0;o<r.length;o++)s(r[o]);return s})({1:[function(_dereq_,module,exports){ /** @@ -14,7 +14,7 @@ 'use strict'; -var ExecutionEnvironment = _dereq_(44); +var ExecutionEnvironment = _dereq_(45); /** * Generate a mapping of standard vendor prefixes using the defined style property and event name. @@ -102,7 +102,7 @@ function getVendorPrefixedEventName(eventName) { } module.exports = getVendorPrefixedEventName; -},{"44":44}],2:[function(_dereq_,module,exports){ +},{"45":45}],2:[function(_dereq_,module,exports){ /** * Copyright 2013-present, Facebook, Inc. * All rights reserved. @@ -174,8 +174,8 @@ module.exports = KeyEscapeUtils; 'use strict'; -var ReactLink = _dereq_(20); -var ReactStateSetters = _dereq_(26); +var ReactLink = _dereq_(19); +var ReactStateSetters = _dereq_(24); /** * A simple mixin around ReactLink.forState(). @@ -196,7 +196,7 @@ var LinkedStateMixin = { }; module.exports = LinkedStateMixin; -},{"20":20,"26":26}],4:[function(_dereq_,module,exports){ +},{"19":19,"24":24}],4:[function(_dereq_,module,exports){ /** * Copyright 2013-present, Facebook, Inc. * All rights reserved. @@ -212,7 +212,7 @@ module.exports = LinkedStateMixin; var _prodInvariant = _dereq_(39); -var invariant = _dereq_(47); +var invariant = _dereq_(48); /** * Static poolers. Several custom versions for each potential number of @@ -308,7 +308,7 @@ var PooledClass = { }; module.exports = PooledClass; -},{"39":39,"47":47}],5:[function(_dereq_,module,exports){ +},{"39":39,"48":48}],5:[function(_dereq_,module,exports){ /** * Copyright 2013-present, Facebook, Inc. * All rights reserved. @@ -321,27 +321,26 @@ module.exports = PooledClass; 'use strict'; -var _assign = _dereq_(50); +var _assign = _dereq_(51); -var ReactChildren = _dereq_(9); -var ReactComponent = _dereq_(11); -var ReactPureComponent = _dereq_(25); -var ReactClass = _dereq_(10); -var ReactDOMFactories = _dereq_(15); -var ReactElement = _dereq_(16); -var ReactPropTypes = _dereq_(23); -var ReactVersion = _dereq_(30); +var ReactBaseClasses = _dereq_(7); +var ReactChildren = _dereq_(10); +var ReactDOMFactories = _dereq_(14); +var ReactElement = _dereq_(15); +var ReactPropTypes = _dereq_(22); +var ReactVersion = _dereq_(28); +var createReactClass = _dereq_(33); var onlyChild = _dereq_(38); -var warning = _dereq_(49); var createElement = ReactElement.createElement; var createFactory = ReactElement.createFactory; var cloneElement = ReactElement.cloneElement; if ("development" !== 'production') { - var canDefineProperty = _dereq_(33); - var ReactElementValidator = _dereq_(18); + var lowPriorityWarning = _dereq_(37); + var canDefineProperty = _dereq_(31); + var ReactElementValidator = _dereq_(17); var didWarnPropTypesDeprecated = false; createElement = ReactElementValidator.createElement; createFactory = ReactElementValidator.createFactory; @@ -349,18 +348,27 @@ if ("development" !== 'production') { } var __spread = _assign; +var createMixin = function (mixin) { + return mixin; +}; if ("development" !== 'production') { - var warned = false; + var warnedForSpread = false; + var warnedForCreateMixin = false; __spread = function () { - "development" !== 'production' ? warning(warned, 'React.__spread is deprecated and should not be used. Use ' + 'Object.assign directly or another helper function with similar ' + 'semantics. You may be seeing this warning due to your compiler. ' + 'See https://fb.me/react-spread-deprecation for more details.') : void 0; - warned = true; + lowPriorityWarning(warnedForSpread, 'React.__spread is deprecated and should not be used. Use ' + 'Object.assign directly or another helper function with similar ' + 'semantics. You may be seeing this warning due to your compiler. ' + 'See https://fb.me/react-spread-deprecation for more details.'); + warnedForSpread = true; return _assign.apply(null, arguments); }; + + createMixin = function (mixin) { + lowPriorityWarning(warnedForCreateMixin, 'React.createMixin is deprecated and should not be used. ' + 'In React v16.0, it will be removed. ' + 'You can use this mixin directly instead. ' + 'See https://fb.me/createmixin-was-never-implemented for more info.'); + warnedForCreateMixin = true; + return mixin; + }; } var React = { - // Modern Children: { @@ -371,8 +379,8 @@ var React = { only: onlyChild }, - Component: ReactComponent, - PureComponent: ReactPureComponent, + Component: ReactBaseClasses.Component, + PureComponent: ReactBaseClasses.PureComponent, createElement: createElement, cloneElement: cloneElement, @@ -381,12 +389,9 @@ var React = { // Classic PropTypes: ReactPropTypes, - createClass: ReactClass.createClass, + createClass: createReactClass, createFactory: createFactory, - createMixin: function (mixin) { - // Currently a noop. Will be used to validate and trace mixins. - return mixin; - }, + createMixin: createMixin, // This looks DOM specific but these are actually isomorphic helpers // since they are just generating DOM strings. @@ -398,21 +403,44 @@ var React = { __spread: __spread }; -// TODO: Fix tests so that this deprecation warning doesn't cause failures. if ("development" !== 'production') { + var warnedForCreateClass = false; if (canDefineProperty) { Object.defineProperty(React, 'PropTypes', { get: function () { - "development" !== 'production' ? warning(didWarnPropTypesDeprecated, 'Accessing PropTypes via the main React package is deprecated. Use ' + 'the prop-types package from npm instead.') : void 0; + lowPriorityWarning(didWarnPropTypesDeprecated, 'Accessing PropTypes via the main React package is deprecated,' + ' and will be removed in React v16.0.' + ' Use the latest available v15.* prop-types package from npm instead.' + ' For info on usage, compatibility, migration and more, see ' + 'https://fb.me/prop-types-docs'); didWarnPropTypesDeprecated = true; return ReactPropTypes; } }); + + Object.defineProperty(React, 'createClass', { + get: function () { + lowPriorityWarning(warnedForCreateClass, 'Accessing createClass via the main React package is deprecated,' + ' and will be removed in React v16.0.' + " Use a plain JavaScript class instead. If you're not yet " + 'ready to migrate, create-react-class v15.* is available ' + 'on npm as a temporary, drop-in replacement. ' + 'For more info see https://fb.me/react-create-class'); + warnedForCreateClass = true; + return createReactClass; + } + }); } + + // React.DOM factories are deprecated. Wrap these methods so that + // invocations of the React.DOM namespace and alert users to switch + // to the `react-dom-factories` package. + React.DOM = {}; + var warnedForFactories = false; + Object.keys(ReactDOMFactories).forEach(function (factory) { + React.DOM[factory] = function () { + if (!warnedForFactories) { + lowPriorityWarning(false, 'Accessing factories like React.DOM.%s has been deprecated ' + 'and will be removed in v16.0+. Use the ' + 'react-dom-factories package instead. ' + ' Version 1.0 provides a drop-in replacement.' + ' For more info, see https://fb.me/react-dom-factories', factory); + warnedForFactories = true; + } + return ReactDOMFactories[factory].apply(ReactDOMFactories, arguments); + }; + }); } module.exports = React; -},{"10":10,"11":11,"15":15,"16":16,"18":18,"23":23,"25":25,"30":30,"33":33,"38":38,"49":49,"50":50,"9":9}],6:[function(_dereq_,module,exports){ +},{"10":10,"14":14,"15":15,"17":17,"22":22,"28":28,"31":31,"33":33,"37":37,"38":38,"51":51,"7":7}],6:[function(_dereq_,module,exports){ /** * Copyright 2013-present, Facebook, Inc. * All rights reserved. @@ -430,7 +458,7 @@ var ReactDOM; function getReactDOM() { if (!ReactDOM) { // This is safe to use because current module only exists in the addons build: - var ReactWithAddonsUMDEntry = _dereq_(32); + var ReactWithAddonsUMDEntry = _dereq_(30); // This is injected by the ReactDOM UMD build: ReactDOM = ReactWithAddonsUMDEntry.__SECRET_INJECTED_REACT_DOM_DO_NOT_USE_OR_YOU_WILL_BE_FIRED; } @@ -448,7 +476,150 @@ if ("development" !== 'production') { return getReactDOM().__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactTestUtils; }; } -},{"32":32}],7:[function(_dereq_,module,exports){ +},{"30":30}],7:[function(_dereq_,module,exports){ +/** + * Copyright 2013-present, Facebook, Inc. + * All rights reserved. + * + * This source code is licensed under the BSD-style license found in the + * LICENSE file in the root directory of this source tree. An additional grant + * of patent rights can be found in the PATENTS file in the same directory. + * + */ + +'use strict'; + +var _prodInvariant = _dereq_(39), + _assign = _dereq_(51); + +var ReactNoopUpdateQueue = _dereq_(20); + +var canDefineProperty = _dereq_(31); +var emptyObject = _dereq_(47); +var invariant = _dereq_(48); +var lowPriorityWarning = _dereq_(37); + +/** + * Base class helpers for the updating state of a component. + */ +function ReactComponent(props, context, updater) { + this.props = props; + this.context = context; + this.refs = emptyObject; + // We initialize the default updater but the real one gets injected by the + // renderer. + this.updater = updater || ReactNoopUpdateQueue; +} + +ReactComponent.prototype.isReactComponent = {}; + +/** + * Sets a subset of the state. Always use this to mutate + * state. You should treat `this.state` as immutable. + * + * There is no guarantee that `this.state` will be immediately updated, so + * accessing `this.state` after calling this method may return the old value. + * + * There is no guarantee that calls to `setState` will run synchronously, + * as they may eventually be batched together. You can provide an optional + * callback that will be executed when the call to setState is actually + * completed. + * + * When a function is provided to setState, it will be called at some point in + * the future (not synchronously). It will be called with the up to date + * component arguments (state, props, context). These values can be different + * from this.* because your function may be called after receiveProps but before + * shouldComponentUpdate, and this new state, props, and context will not yet be + * assigned to this. + * + * @param {object|function} partialState Next partial state or function to + * produce next partial state to be merged with current state. + * @param {?function} callback Called after state is updated. + * @final + * @protected + */ +ReactComponent.prototype.setState = function (partialState, callback) { + !(typeof partialState === 'object' || typeof partialState === 'function' || partialState == null) ? "development" !== 'production' ? invariant(false, 'setState(...): takes an object of state variables to update or a function which returns an object of state variables.') : _prodInvariant('85') : void 0; + this.updater.enqueueSetState(this, partialState); + if (callback) { + this.updater.enqueueCallback(this, callback, 'setState'); + } +}; + +/** + * Forces an update. This should only be invoked when it is known with + * certainty that we are **not** in a DOM transaction. + * + * You may want to call this when you know that some deeper aspect of the + * component's state has changed but `setState` was not called. + * + * This will not invoke `shouldComponentUpdate`, but it will invoke + * `componentWillUpdate` and `componentDidUpdate`. + * + * @param {?function} callback Called after update is complete. + * @final + * @protected + */ +ReactComponent.prototype.forceUpdate = function (callback) { + this.updater.enqueueForceUpdate(this); + if (callback) { + this.updater.enqueueCallback(this, callback, 'forceUpdate'); + } +}; + +/** + * Deprecated APIs. These APIs used to exist on classic React classes but since + * we would like to deprecate them, we're not going to move them over to this + * modern base class. Instead, we define a getter that warns if it's accessed. + */ +if ("development" !== 'production') { + var deprecatedAPIs = { + isMounted: ['isMounted', 'Instead, make sure to clean up subscriptions and pending requests in ' + 'componentWillUnmount to prevent memory leaks.'], + replaceState: ['replaceState', 'Refactor your code to use setState instead (see ' + 'https://github.com/facebook/react/issues/3236).'] + }; + var defineDeprecationWarning = function (methodName, info) { + if (canDefineProperty) { + Object.defineProperty(ReactComponent.prototype, methodName, { + get: function () { + lowPriorityWarning(false, '%s(...) is deprecated in plain JavaScript React classes. %s', info[0], info[1]); + return undefined; + } + }); + } + }; + for (var fnName in deprecatedAPIs) { + if (deprecatedAPIs.hasOwnProperty(fnName)) { + defineDeprecationWarning(fnName, deprecatedAPIs[fnName]); + } + } +} + +/** + * Base class helpers for the updating state of a component. + */ +function ReactPureComponent(props, context, updater) { + // Duplicated from ReactComponent. + this.props = props; + this.context = context; + this.refs = emptyObject; + // We initialize the default updater but the real one gets injected by the + // renderer. + this.updater = updater || ReactNoopUpdateQueue; +} + +function ComponentDummy() {} +ComponentDummy.prototype = ReactComponent.prototype; +ReactPureComponent.prototype = new ComponentDummy(); +ReactPureComponent.prototype.constructor = ReactPureComponent; +// Avoid an extra prototype jump for these methods. +_assign(ReactPureComponent.prototype, ReactComponent.prototype); +ReactPureComponent.prototype.isPureReactComponent = true; + +module.exports = { + Component: ReactComponent, + PureComponent: ReactPureComponent +}; +},{"20":20,"31":31,"37":37,"39":39,"47":47,"48":48,"51":51}],8:[function(_dereq_,module,exports){ /** * Copyright 2013-present, Facebook, Inc. * All rights reserved. @@ -461,7 +632,7 @@ if ("development" !== 'production') { 'use strict'; -var _assign = _dereq_(50); +var _assign = _dereq_(51); function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } @@ -470,11 +641,11 @@ function _possibleConstructorReturn(self, call) { if (!self) { throw new Referen function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; } var React = _dereq_(5); -var propTypesFactory = _dereq_(52); +var propTypesFactory = _dereq_(53); var PropTypes = propTypesFactory(React.isValidElement); -var ReactTransitionGroup = _dereq_(29); -var ReactCSSTransitionGroupChild = _dereq_(8); +var ReactTransitionGroup = _dereq_(27); +var ReactCSSTransitionGroupChild = _dereq_(9); function createTransitionTimeoutPropValidator(transitionType) { var timeoutPropName = 'transition' + transitionType + 'Timeout'; @@ -485,7 +656,7 @@ function createTransitionTimeoutPropValidator(transitionType) { if (props[enabledPropName]) { // If no timeout duration is provided if (props[timeoutPropName] == null) { - return new Error(timeoutPropName + ' wasn\'t supplied to ReactCSSTransitionGroup: ' + 'this can cause unreliable animations and won\'t be supported in ' + 'a future version of React. See ' + 'https://fb.me/react-animation-transition-group-timeout for more ' + 'information.'); + return new Error(timeoutPropName + " wasn't supplied to ReactCSSTransitionGroup: " + "this can cause unreliable animations and won't be supported in " + 'a future version of React. See ' + 'https://fb.me/react-animation-transition-group-timeout for more ' + 'information.'); // If the duration isn't a number } else if (typeof props[timeoutPropName] !== 'number') { @@ -555,7 +726,7 @@ ReactCSSTransitionGroup.defaultProps = { module.exports = ReactCSSTransitionGroup; -},{"29":29,"5":5,"50":50,"52":52,"8":8}],8:[function(_dereq_,module,exports){ +},{"27":27,"5":5,"51":51,"53":53,"9":9}],9:[function(_dereq_,module,exports){ /** * Copyright 2013-present, Facebook, Inc. * All rights reserved. @@ -577,11 +748,11 @@ function _inherits(subClass, superClass) { if (typeof superClass !== "function" var React = _dereq_(5); var ReactAddonsDOMDependencies = _dereq_(6); -var propTypesFactory = _dereq_(52); +var propTypesFactory = _dereq_(53); var PropTypes = propTypesFactory(React.isValidElement); -var CSSCore = _dereq_(43); -var ReactTransitionEvents = _dereq_(28); +var CSSCore = _dereq_(44); +var ReactTransitionEvents = _dereq_(26); var onlyChild = _dereq_(38); @@ -740,7 +911,7 @@ ReactCSSTransitionGroupChild.propTypes = { module.exports = ReactCSSTransitionGroupChild; -},{"28":28,"38":38,"43":43,"5":5,"52":52,"6":6}],9:[function(_dereq_,module,exports){ +},{"26":26,"38":38,"44":44,"5":5,"53":53,"6":6}],10:[function(_dereq_,module,exports){ /** * Copyright 2013-present, Facebook, Inc. * All rights reserved. @@ -754,9 +925,9 @@ module.exports = ReactCSSTransitionGroupChild; 'use strict'; var PooledClass = _dereq_(4); -var ReactElement = _dereq_(16); +var ReactElement = _dereq_(15); -var emptyFunction = _dereq_(45); +var emptyFunction = _dereq_(46); var traverseAllChildren = _dereq_(41); var twoArgumentPooler = PooledClass.twoArgumentPooler; @@ -931,848 +1102,7 @@ var ReactChildren = { }; module.exports = ReactChildren; -},{"16":16,"4":4,"41":41,"45":45}],10:[function(_dereq_,module,exports){ -/** - * Copyright 2013-present, Facebook, Inc. - * All rights reserved. - * - * This source code is licensed under the BSD-style license found in the - * LICENSE file in the root directory of this source tree. An additional grant - * of patent rights can be found in the PATENTS file in the same directory. - * - */ - -'use strict'; - -var _prodInvariant = _dereq_(39), - _assign = _dereq_(50); - -var ReactComponent = _dereq_(11); -var ReactElement = _dereq_(16); -var ReactPropTypeLocationNames = _dereq_(22); -var ReactNoopUpdateQueue = _dereq_(21); - -var emptyObject = _dereq_(46); -var invariant = _dereq_(47); -var warning = _dereq_(49); - -var MIXINS_KEY = 'mixins'; - -// Helper function to allow the creation of anonymous functions which do not -// have .name set to the name of the variable being assigned to. -function identity(fn) { - return fn; -} - -/** - * Policies that describe methods in `ReactClassInterface`. - */ - - -var injectedMixins = []; - -/** - * Composite components are higher-level components that compose other composite - * or host components. - * - * To create a new type of `ReactClass`, pass a specification of - * your new class to `React.createClass`. The only requirement of your class - * specification is that you implement a `render` method. - * - * var MyComponent = React.createClass({ - * render: function() { - * return <div>Hello World</div>; - * } - * }); - * - * The class specification supports a specific protocol of methods that have - * special meaning (e.g. `render`). See `ReactClassInterface` for - * more the comprehensive protocol. Any other properties and methods in the - * class specification will be available on the prototype. - * - * @interface ReactClassInterface - * @internal - */ -var ReactClassInterface = { - - /** - * An array of Mixin objects to include when defining your component. - * - * @type {array} - * @optional - */ - mixins: 'DEFINE_MANY', - - /** - * An object containing properties and methods that should be defined on - * the component's constructor instead of its prototype (static methods). - * - * @type {object} - * @optional - */ - statics: 'DEFINE_MANY', - - /** - * Definition of prop types for this component. - * - * @type {object} - * @optional - */ - propTypes: 'DEFINE_MANY', - - /** - * Definition of context types for this component. - * - * @type {object} - * @optional - */ - contextTypes: 'DEFINE_MANY', - - /** - * Definition of context types this component sets for its children. - * - * @type {object} - * @optional - */ - childContextTypes: 'DEFINE_MANY', - - // ==== Definition methods ==== - - /** - * Invoked when the component is mounted. Values in the mapping will be set on - * `this.props` if that prop is not specified (i.e. using an `in` check). - * - * This method is invoked before `getInitialState` and therefore cannot rely - * on `this.state` or use `this.setState`. - * - * @return {object} - * @optional - */ - getDefaultProps: 'DEFINE_MANY_MERGED', - - /** - * Invoked once before the component is mounted. The return value will be used - * as the initial value of `this.state`. - * - * getInitialState: function() { - * return { - * isOn: false, - * fooBaz: new BazFoo() - * } - * } - * - * @return {object} - * @optional - */ - getInitialState: 'DEFINE_MANY_MERGED', - - /** - * @return {object} - * @optional - */ - getChildContext: 'DEFINE_MANY_MERGED', - - /** - * Uses props from `this.props` and state from `this.state` to render the - * structure of the component. - * - * No guarantees are made about when or how often this method is invoked, so - * it must not have side effects. - * - * render: function() { - * var name = this.props.name; - * return <div>Hello, {name}!</div>; - * } - * - * @return {ReactComponent} - * @required - */ - render: 'DEFINE_ONCE', - - // ==== Delegate methods ==== - - /** - * Invoked when the component is initially created and about to be mounted. - * This may have side effects, but any external subscriptions or data created - * by this method must be cleaned up in `componentWillUnmount`. - * - * @optional - */ - componentWillMount: 'DEFINE_MANY', - - /** - * Invoked when the component has been mounted and has a DOM representation. - * However, there is no guarantee that the DOM node is in the document. - * - * Use this as an opportunity to operate on the DOM when the component has - * been mounted (initialized and rendered) for the first time. - * - * @param {DOMElement} rootNode DOM element representing the component. - * @optional - */ - componentDidMount: 'DEFINE_MANY', - - /** - * Invoked before the component receives new props. - * - * Use this as an opportunity to react to a prop transition by updating the - * state using `this.setState`. Current props are accessed via `this.props`. - * - * componentWillReceiveProps: function(nextProps, nextContext) { - * this.setState({ - * likesIncreasing: nextProps.likeCount > this.props.likeCount - * }); - * } - * - * NOTE: There is no equivalent `componentWillReceiveState`. An incoming prop - * transition may cause a state change, but the opposite is not true. If you - * need it, you are probably looking for `componentWillUpdate`. - * - * @param {object} nextProps - * @optional - */ - componentWillReceiveProps: 'DEFINE_MANY', - - /** - * Invoked while deciding if the component should be updated as a result of - * receiving new props, state and/or context. - * - * Use this as an opportunity to `return false` when you're certain that the - * transition to the new props/state/context will not require a component - * update. - * - * shouldComponentUpdate: function(nextProps, nextState, nextContext) { - * return !equal(nextProps, this.props) || - * !equal(nextState, this.state) || - * !equal(nextContext, this.context); - * } - * - * @param {object} nextProps - * @param {?object} nextState - * @param {?object} nextContext - * @return {boolean} True if the component should update. - * @optional - */ - shouldComponentUpdate: 'DEFINE_ONCE', - - /** - * Invoked when the component is about to update due to a transition from - * `this.props`, `this.state` and `this.context` to `nextProps`, `nextState` - * and `nextContext`. - * - * Use this as an opportunity to perform preparation before an update occurs. - * - * NOTE: You **cannot** use `this.setState()` in this method. - * - * @param {object} nextProps - * @param {?object} nextState - * @param {?object} nextContext - * @param {ReactReconcileTransaction} transaction - * @optional - */ - componentWillUpdate: 'DEFINE_MANY', - - /** - * Invoked when the component's DOM representation has been updated. - * - * Use this as an opportunity to operate on the DOM when the component has - * been updated. - * - * @param {object} prevProps - * @param {?object} prevState - * @param {?object} prevContext - * @param {DOMElement} rootNode DOM element representing the component. - * @optional - */ - componentDidUpdate: 'DEFINE_MANY', - - /** - * Invoked when the component is about to be removed from its parent and have - * its DOM representation destroyed. - * - * Use this as an opportunity to deallocate any external resources. - * - * NOTE: There is no `componentDidUnmount` since your component will have been - * destroyed by that point. - * - * @optional - */ - componentWillUnmount: 'DEFINE_MANY', - - // ==== Advanced methods ==== - - /** - * Updates the component's currently mounted DOM representation. - * - * By default, this implements React's rendering and reconciliation algorithm. - * Sophisticated clients may wish to override this. - * - * @param {ReactReconcileTransaction} transaction - * @internal - * @overridable - */ - updateComponent: 'OVERRIDE_BASE' - -}; - -/** - * Mapping from class specification keys to special processing functions. - * - * Although these are declared like instance properties in the specification - * when defining classes using `React.createClass`, they are actually static - * and are accessible on the constructor instead of the prototype. Despite - * being static, they must be defined outside of the "statics" key under - * which all other static methods are defined. - */ -var RESERVED_SPEC_KEYS = { - displayName: function (Constructor, displayName) { - Constructor.displayName = displayName; - }, - mixins: function (Constructor, mixins) { - if (mixins) { - for (var i = 0; i < mixins.length; i++) { - mixSpecIntoComponent(Constructor, mixins[i]); - } - } - }, - childContextTypes: function (Constructor, childContextTypes) { - if ("development" !== 'production') { - validateTypeDef(Constructor, childContextTypes, 'childContext'); - } - Constructor.childContextTypes = _assign({}, Constructor.childContextTypes, childContextTypes); - }, - contextTypes: function (Constructor, contextTypes) { - if ("development" !== 'production') { - validateTypeDef(Constructor, contextTypes, 'context'); - } - Constructor.contextTypes = _assign({}, Constructor.contextTypes, contextTypes); - }, - /** - * Special case getDefaultProps which should move into statics but requires - * automatic merging. - */ - getDefaultProps: function (Constructor, getDefaultProps) { - if (Constructor.getDefaultProps) { - Constructor.getDefaultProps = createMergedResultFunction(Constructor.getDefaultProps, getDefaultProps); - } else { - Constructor.getDefaultProps = getDefaultProps; - } - }, - propTypes: function (Constructor, propTypes) { - if ("development" !== 'production') { - validateTypeDef(Constructor, propTypes, 'prop'); - } - Constructor.propTypes = _assign({}, Constructor.propTypes, propTypes); - }, - statics: function (Constructor, statics) { - mixStaticSpecIntoComponent(Constructor, statics); - }, - autobind: function () {} }; - -function validateTypeDef(Constructor, typeDef, location) { - for (var propName in typeDef) { - if (typeDef.hasOwnProperty(propName)) { - // use a warning instead of an invariant so components - // don't show up in prod but only in __DEV__ - "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; - } - } -} - -function validateMethodOverride(isAlreadyDefined, name) { - var specPolicy = ReactClassInterface.hasOwnProperty(name) ? ReactClassInterface[name] : null; - - // Disallow overriding of base class methods unless explicitly allowed. - if (ReactClassMixin.hasOwnProperty(name)) { - !(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; - } - - // Disallow defining methods more than once unless explicitly allowed. - if (isAlreadyDefined) { - !(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; - } -} - -/** - * Mixin helper which handles policy validation and reserved - * specification keys when building React classes. - */ -function mixSpecIntoComponent(Constructor, spec) { - if (!spec) { - if ("development" !== 'production') { - var typeofSpec = typeof spec; - var isMixinValid = typeofSpec === 'object' && spec !== null; - - "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; - } - - return; - } - - !(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; - !!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; - - var proto = Constructor.prototype; - var autoBindPairs = proto.__reactAutoBindPairs; - - // By handling mixins before any other properties, we ensure the same - // chaining order is applied to methods with DEFINE_MANY policy, whether - // mixins are listed before or after these methods in the spec. - if (spec.hasOwnProperty(MIXINS_KEY)) { - RESERVED_SPEC_KEYS.mixins(Constructor, spec.mixins); - } - - for (var name in spec) { - if (!spec.hasOwnProperty(name)) { - continue; - } - - if (name === MIXINS_KEY) { - // We have already handled mixins in a special case above. - continue; - } - - var property = spec[name]; - var isAlreadyDefined = proto.hasOwnProperty(name); - validateMethodOverride(isAlreadyDefined, name); - - if (RESERVED_SPEC_KEYS.hasOwnProperty(name)) { - RESERVED_SPEC_KEYS[name](Constructor, property); - } else { - // Setup methods on prototype: - // The following member methods should not be automatically bound: - // 1. Expected ReactClass methods (in the "interface"). - // 2. Overridden methods (that were mixed in). - var isReactClassMethod = ReactClassInterface.hasOwnProperty(name); - var isFunction = typeof property === 'function'; - var shouldAutoBind = isFunction && !isReactClassMethod && !isAlreadyDefined && spec.autobind !== false; - - if (shouldAutoBind) { - autoBindPairs.push(name, property); - proto[name] = property; - } else { - if (isAlreadyDefined) { - var specPolicy = ReactClassInterface[name]; - - // These cases should already be caught by validateMethodOverride. - !(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; - - // For methods which are defined more than once, call the existing - // methods before calling the new property, merging if appropriate. - if (specPolicy === 'DEFINE_MANY_MERGED') { - proto[name] = createMergedResultFunction(proto[name], property); - } else if (specPolicy === 'DEFINE_MANY') { - proto[name] = createChainedFunction(proto[name], property); - } - } else { - proto[name] = property; - if ("development" !== 'production') { - // Add verbose displayName to the function, which helps when looking - // at profiling tools. - if (typeof property === 'function' && spec.displayName) { - proto[name].displayName = spec.displayName + '_' + name; - } - } - } - } - } - } -} - -function mixStaticSpecIntoComponent(Constructor, statics) { - if (!statics) { - return; - } - for (var name in statics) { - var property = statics[name]; - if (!statics.hasOwnProperty(name)) { - continue; - } - - var isReserved = name in RESERVED_SPEC_KEYS; - !!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; - - var isInherited = name in Constructor; - !!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; - Constructor[name] = property; - } -} - -/** - * Merge two objects, but throw if both contain the same key. - * - * @param {object} one The first object, which is mutated. - * @param {object} two The second object - * @return {object} one after it has been mutated to contain everything in two. - */ -function mergeIntoWithNoDuplicateKeys(one, two) { - !(one && two && typeof one === 'object' && typeof two === 'object') ? "development" !== 'production' ? invariant(false, 'mergeIntoWithNoDuplicateKeys(): Cannot merge non-objects.') : _prodInvariant('80') : void 0; - - for (var key in two) { - if (two.hasOwnProperty(key)) { - !(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; - one[key] = two[key]; - } - } - return one; -} - -/** - * Creates a function that invokes two functions and merges their return values. - * - * @param {function} one Function to invoke first. - * @param {function} two Function to invoke second. - * @return {function} Function that invokes the two argument functions. - * @private - */ -function createMergedResultFunction(one, two) { - return function mergedResult() { - var a = one.apply(this, arguments); - var b = two.apply(this, arguments); - if (a == null) { - return b; - } else if (b == null) { - return a; - } - var c = {}; - mergeIntoWithNoDuplicateKeys(c, a); - mergeIntoWithNoDuplicateKeys(c, b); - return c; - }; -} - -/** - * Creates a function that invokes two functions and ignores their return vales. - * - * @param {function} one Function to invoke first. - * @param {function} two Function to invoke second. - * @return {function} Function that invokes the two argument functions. - * @private - */ -function createChainedFunction(one, two) { - return function chainedFunction() { - one.apply(this, arguments); - two.apply(this, arguments); - }; -} - -/** - * Binds a method to the component. - * - * @param {object} component Component whose method is going to be bound. - * @param {function} method Method to be bound. - * @return {function} The bound method. - */ -function bindAutoBindMethod(component, method) { - var boundMethod = method.bind(component); - if ("development" !== 'production') { - boundMethod.__reactBoundContext = component; - boundMethod.__reactBoundMethod = method; - boundMethod.__reactBoundArguments = null; - var componentName = component.constructor.displayName; - var _bind = boundMethod.bind; - boundMethod.bind = function (newThis) { - for (var _len = arguments.length, args = Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) { - args[_key - 1] = arguments[_key]; - } - - // User is trying to bind() an autobound method; we effectively will - // ignore the value of "this" that the user is trying to use, so - // let's warn. - if (newThis !== component && newThis !== null) { - "development" !== 'production' ? warning(false, 'bind(): React component methods may only be bound to the ' + 'component instance. See %s', componentName) : void 0; - } else if (!args.length) { - "development" !== 'production' ? warning(false, 'bind(): You are binding a component method to the component. ' + 'React does this for you automatically in a high-performance ' + 'way, so you can safely remove this call. See %s', componentName) : void 0; - return boundMethod; - } - var reboundMethod = _bind.apply(boundMethod, arguments); - reboundMethod.__reactBoundContext = component; - reboundMethod.__reactBoundMethod = method; - reboundMethod.__reactBoundArguments = args; - return reboundMethod; - }; - } - return boundMethod; -} - -/** - * Binds all auto-bound methods in a component. - * - * @param {object} component Component whose method is going to be bound. - */ -function bindAutoBindMethods(component) { - var pairs = component.__reactAutoBindPairs; - for (var i = 0; i < pairs.length; i += 2) { - var autoBindKey = pairs[i]; - var method = pairs[i + 1]; - component[autoBindKey] = bindAutoBindMethod(component, method); - } -} - -/** - * Add more to the ReactClass base class. These are all legacy features and - * therefore not already part of the modern ReactComponent. - */ -var ReactClassMixin = { - - /** - * TODO: This will be deprecated because state should always keep a consistent - * type signature and the only use case for this, is to avoid that. - */ - replaceState: function (newState, callback) { - this.updater.enqueueReplaceState(this, newState); - if (callback) { - this.updater.enqueueCallback(this, callback, 'replaceState'); - } - }, - - /** - * Checks whether or not this composite component is mounted. - * @return {boolean} True if mounted, false otherwise. - * @protected - * @final - */ - isMounted: function () { - return this.updater.isMounted(this); - } -}; - -var ReactClassComponent = function () {}; -_assign(ReactClassComponent.prototype, ReactComponent.prototype, ReactClassMixin); - -var didWarnDeprecated = false; - -/** - * Module for creating composite components. - * - * @class ReactClass - */ -var ReactClass = { - - /** - * Creates a composite component class given a class specification. - * See https://facebook.github.io/react/docs/top-level-api.html#react.createclass - * - * @param {object} spec Class specification (which must define `render`). - * @return {function} Component constructor function. - * @public - */ - createClass: function (spec) { - if ("development" !== 'production') { - "development" !== 'production' ? warning(didWarnDeprecated, '%s: React.createClass is deprecated and will be removed in version 16. ' + 'Use plain JavaScript classes instead. If you\'re not yet ready to ' + 'migrate, create-react-class is available on npm as a ' + 'drop-in replacement.', spec && spec.displayName || 'A Component') : void 0; - didWarnDeprecated = true; - } - - // To keep our warnings more understandable, we'll use a little hack here to - // ensure that Constructor.name !== 'Constructor'. This makes sure we don't - // unnecessarily identify a class without displayName as 'Constructor'. - var Constructor = identity(function (props, context, updater) { - // This constructor gets overridden by mocks. The argument is used - // by mocks to assert on what gets mounted. - - if ("development" !== 'production') { - "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; - } - - // Wire up auto-binding - if (this.__reactAutoBindPairs.length) { - bindAutoBindMethods(this); - } - - this.props = props; - this.context = context; - this.refs = emptyObject; - this.updater = updater || ReactNoopUpdateQueue; - - this.state = null; - - // ReactClasses doesn't have constructors. Instead, they use the - // getInitialState and componentWillMount methods for initialization. - - var initialState = this.getInitialState ? this.getInitialState() : null; - if ("development" !== 'production') { - // We allow auto-mocks to proceed as if they're returning null. - if (initialState === undefined && this.getInitialState._isMockFunction) { - // This is probably bad practice. Consider warning here and - // deprecating this convenience. - initialState = null; - } - } - !(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; - - this.state = initialState; - }); - Constructor.prototype = new ReactClassComponent(); - Constructor.prototype.constructor = Constructor; - Constructor.prototype.__reactAutoBindPairs = []; - - injectedMixins.forEach(mixSpecIntoComponent.bind(null, Constructor)); - - mixSpecIntoComponent(Constructor, spec); - - // Initialize the defaultProps property after all mixins have been merged. - if (Constructor.getDefaultProps) { - Constructor.defaultProps = Constructor.getDefaultProps(); - } - - if ("development" !== 'production') { - // This is a tag to indicate that the use of these method names is ok, - // since it's used with createClass. If it's not, then it's likely a - // mistake so we'll warn you to use the static property, property - // initializer or constructor respectively. - if (Constructor.getDefaultProps) { - Constructor.getDefaultProps.isReactClassApproved = {}; - } - if (Constructor.prototype.getInitialState) { - Constructor.prototype.getInitialState.isReactClassApproved = {}; - } - } - - !Constructor.prototype.render ? "development" !== 'production' ? invariant(false, 'createClass(...): Class specification must implement a `render` method.') : _prodInvariant('83') : void 0; - - if ("development" !== 'production') { - "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; - "development" !== 'production' ? warning(!Constructor.prototype.componentWillRecieveProps, '%s has a method called ' + 'componentWillRecieveProps(). Did you mean componentWillReceiveProps()?', spec.displayName || 'A component') : void 0; - } - - // Reduce time spent doing lookups by setting these on the prototype. - for (var methodName in ReactClassInterface) { - if (!Constructor.prototype[methodName]) { - Constructor.prototype[methodName] = null; - } - } - - return Constructor; - }, - - injection: { - injectMixin: function (mixin) { - injectedMixins.push(mixin); - } - } - -}; - -module.exports = ReactClass; -},{"11":11,"16":16,"21":21,"22":22,"39":39,"46":46,"47":47,"49":49,"50":50}],11:[function(_dereq_,module,exports){ -/** - * Copyright 2013-present, Facebook, Inc. - * All rights reserved. - * - * This source code is licensed under the BSD-style license found in the - * LICENSE file in the root directory of this source tree. An additional grant - * of patent rights can be found in the PATENTS file in the same directory. - * - */ - -'use strict'; - -var _prodInvariant = _dereq_(39); - -var ReactNoopUpdateQueue = _dereq_(21); - -var canDefineProperty = _dereq_(33); -var emptyObject = _dereq_(46); -var invariant = _dereq_(47); -var warning = _dereq_(49); - -/** - * Base class helpers for the updating state of a component. - */ -function ReactComponent(props, context, updater) { - this.props = props; - this.context = context; - this.refs = emptyObject; - // We initialize the default updater but the real one gets injected by the - // renderer. - this.updater = updater || ReactNoopUpdateQueue; -} - -ReactComponent.prototype.isReactComponent = {}; - -/** - * Sets a subset of the state. Always use this to mutate - * state. You should treat `this.state` as immutable. - * - * There is no guarantee that `this.state` will be immediately updated, so - * accessing `this.state` after calling this method may return the old value. - * - * There is no guarantee that calls to `setState` will run synchronously, - * as they may eventually be batched together. You can provide an optional - * callback that will be executed when the call to setState is actually - * completed. - * - * When a function is provided to setState, it will be called at some point in - * the future (not synchronously). It will be called with the up to date - * component arguments (state, props, context). These values can be different - * from this.* because your function may be called after receiveProps but before - * shouldComponentUpdate, and this new state, props, and context will not yet be - * assigned to this. - * - * @param {object|function} partialState Next partial state or function to - * produce next partial state to be merged with current state. - * @param {?function} callback Called after state is updated. - * @final - * @protected - */ -ReactComponent.prototype.setState = function (partialState, callback) { - !(typeof partialState === 'object' || typeof partialState === 'function' || partialState == null) ? "development" !== 'production' ? invariant(false, 'setState(...): takes an object of state variables to update or a function which returns an object of state variables.') : _prodInvariant('85') : void 0; - this.updater.enqueueSetState(this, partialState); - if (callback) { - this.updater.enqueueCallback(this, callback, 'setState'); - } -}; - -/** - * Forces an update. This should only be invoked when it is known with - * certainty that we are **not** in a DOM transaction. - * - * You may want to call this when you know that some deeper aspect of the - * component's state has changed but `setState` was not called. - * - * This will not invoke `shouldComponentUpdate`, but it will invoke - * `componentWillUpdate` and `componentDidUpdate`. - * - * @param {?function} callback Called after update is complete. - * @final - * @protected - */ -ReactComponent.prototype.forceUpdate = function (callback) { - this.updater.enqueueForceUpdate(this); - if (callback) { - this.updater.enqueueCallback(this, callback, 'forceUpdate'); - } -}; - -/** - * Deprecated APIs. These APIs used to exist on classic React classes but since - * we would like to deprecate them, we're not going to move them over to this - * modern base class. Instead, we define a getter that warns if it's accessed. - */ -if ("development" !== 'production') { - var deprecatedAPIs = { - isMounted: ['isMounted', 'Instead, make sure to clean up subscriptions and pending requests in ' + 'componentWillUnmount to prevent memory leaks.'], - replaceState: ['replaceState', 'Refactor your code to use setState instead (see ' + 'https://github.com/facebook/react/issues/3236).'] - }; - var defineDeprecationWarning = function (methodName, info) { - if (canDefineProperty) { - Object.defineProperty(ReactComponent.prototype, methodName, { - get: function () { - "development" !== 'production' ? warning(false, '%s(...) is deprecated in plain JavaScript React classes. %s', info[0], info[1]) : void 0; - return undefined; - } - }); - } - }; - for (var fnName in deprecatedAPIs) { - if (deprecatedAPIs.hasOwnProperty(fnName)) { - defineDeprecationWarning(fnName, deprecatedAPIs[fnName]); - } - } -} - -module.exports = ReactComponent; -},{"21":21,"33":33,"39":39,"46":46,"47":47,"49":49}],12:[function(_dereq_,module,exports){ +},{"15":15,"4":4,"41":41,"46":46}],11:[function(_dereq_,module,exports){ /** * Copyright 2016-present, Facebook, Inc. * All rights reserved. @@ -1788,10 +1118,10 @@ module.exports = ReactComponent; var _prodInvariant = _dereq_(39); -var ReactCurrentOwner = _dereq_(14); +var ReactCurrentOwner = _dereq_(13); -var invariant = _dereq_(47); -var warning = _dereq_(49); +var invariant = _dereq_(48); +var warning = _dereq_(50); function isNative(fn) { // Based on isNative() from Lodash @@ -1799,11 +1129,11 @@ function isNative(fn) { var hasOwnProperty = Object.prototype.hasOwnProperty; var reIsNative = RegExp('^' + funcToString // Take an example native function source for comparison - .call(hasOwnProperty) + .call(hasOwnProperty // Strip regex characters so we can use it for regex - .replace(/[\\^$.*+?()[\]{}|]/g, '\\$&') + ).replace(/[\\^$.*+?()[\]{}|]/g, '\\$&' // Remove hasOwnProperty from the template to make it generic - .replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g, '$1.*?') + '$'); + ).replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g, '$1.*?') + '$'); try { var source = funcToString.call(fn); return reIsNative.test(source); @@ -2102,11 +1432,56 @@ var ReactComponentTreeHook = { getRootIDs: getRootIDs, - getRegisteredIDs: getItemIDs + getRegisteredIDs: getItemIDs, + + pushNonStandardWarningStack: function (isCreatingElement, currentSource) { + if (typeof console.reactStack !== 'function') { + return; + } + + var stack = []; + var currentOwner = ReactCurrentOwner.current; + var id = currentOwner && currentOwner._debugID; + + try { + if (isCreatingElement) { + stack.push({ + name: id ? ReactComponentTreeHook.getDisplayName(id) : null, + fileName: currentSource ? currentSource.fileName : null, + lineNumber: currentSource ? currentSource.lineNumber : null + }); + } + + while (id) { + var element = ReactComponentTreeHook.getElement(id); + var parentID = ReactComponentTreeHook.getParentID(id); + var ownerID = ReactComponentTreeHook.getOwnerID(id); + var ownerName = ownerID ? ReactComponentTreeHook.getDisplayName(ownerID) : null; + var source = element && element._source; + stack.push({ + name: ownerName, + fileName: source ? source.fileName : null, + lineNumber: source ? source.lineNumber : null + }); + id = parentID; + } + } catch (err) { + // Internal state is messed up. + // Stop building the stack (it's just a nice to have). + } + + console.reactStack(stack); + }, + popNonStandardWarningStack: function () { + if (typeof console.reactStackEnd !== 'function') { + return; + } + console.reactStackEnd(); + } }; module.exports = ReactComponentTreeHook; -},{"14":14,"39":39,"47":47,"49":49}],13:[function(_dereq_,module,exports){ +},{"13":13,"39":39,"48":48,"50":50}],12:[function(_dereq_,module,exports){ /** * Copyright 2013-present, Facebook, Inc. * All rights reserved. @@ -2154,7 +1529,7 @@ var ReactComponentWithPureRenderMixin = { }; module.exports = ReactComponentWithPureRenderMixin; -},{"40":40}],14:[function(_dereq_,module,exports){ +},{"40":40}],13:[function(_dereq_,module,exports){ /** * Copyright 2013-present, Facebook, Inc. * All rights reserved. @@ -2175,17 +1550,15 @@ module.exports = ReactComponentWithPureRenderMixin; * currently being constructed. */ var ReactCurrentOwner = { - /** * @internal * @type {ReactComponent} */ current: null - }; module.exports = ReactCurrentOwner; -},{}],15:[function(_dereq_,module,exports){ +},{}],14:[function(_dereq_,module,exports){ /** * Copyright 2013-present, Facebook, Inc. * All rights reserved. @@ -2198,7 +1571,7 @@ module.exports = ReactCurrentOwner; 'use strict'; -var ReactElement = _dereq_(16); +var ReactElement = _dereq_(15); /** * Create a factory that creates HTML tag elements. @@ -2207,13 +1580,12 @@ var ReactElement = _dereq_(16); */ var createDOMFactory = ReactElement.createFactory; if ("development" !== 'production') { - var ReactElementValidator = _dereq_(18); + var ReactElementValidator = _dereq_(17); createDOMFactory = ReactElementValidator.createFactory; } /** * Creates a mapping from supported HTML tags to `ReactDOMComponent` classes. - * This is also accessible via `React.DOM`. * * @public */ @@ -2355,7 +1727,7 @@ var ReactDOMFactories = { }; module.exports = ReactDOMFactories; -},{"16":16,"18":18}],16:[function(_dereq_,module,exports){ +},{"15":15,"17":17}],15:[function(_dereq_,module,exports){ /** * Copyright 2014-present, Facebook, Inc. * All rights reserved. @@ -2368,15 +1740,15 @@ module.exports = ReactDOMFactories; 'use strict'; -var _assign = _dereq_(50); +var _assign = _dereq_(51); -var ReactCurrentOwner = _dereq_(14); +var ReactCurrentOwner = _dereq_(13); -var warning = _dereq_(49); -var canDefineProperty = _dereq_(33); +var warning = _dereq_(50); +var canDefineProperty = _dereq_(31); var hasOwnProperty = Object.prototype.hasOwnProperty; -var REACT_ELEMENT_TYPE = _dereq_(17); +var REACT_ELEMENT_TYPE = _dereq_(16); var RESERVED_PROPS = { key: true, @@ -2696,7 +2068,7 @@ ReactElement.isValidElement = function (object) { }; module.exports = ReactElement; -},{"14":14,"17":17,"33":33,"49":49,"50":50}],17:[function(_dereq_,module,exports){ +},{"13":13,"16":16,"31":31,"50":50,"51":51}],16:[function(_dereq_,module,exports){ /** * Copyright 2014-present, Facebook, Inc. * All rights reserved. @@ -2716,7 +2088,7 @@ module.exports = ReactElement; var REACT_ELEMENT_TYPE = typeof Symbol === 'function' && Symbol['for'] && Symbol['for']('react.element') || 0xeac7; module.exports = REACT_ELEMENT_TYPE; -},{}],18:[function(_dereq_,module,exports){ +},{}],17:[function(_dereq_,module,exports){ /** * Copyright 2014-present, Facebook, Inc. * All rights reserved. @@ -2736,15 +2108,16 @@ module.exports = REACT_ELEMENT_TYPE; 'use strict'; -var ReactCurrentOwner = _dereq_(14); -var ReactComponentTreeHook = _dereq_(12); -var ReactElement = _dereq_(16); +var ReactCurrentOwner = _dereq_(13); +var ReactComponentTreeHook = _dereq_(11); +var ReactElement = _dereq_(15); -var checkReactTypeSpec = _dereq_(34); +var checkReactTypeSpec = _dereq_(32); -var canDefineProperty = _dereq_(33); -var getIteratorFn = _dereq_(36); -var warning = _dereq_(49); +var canDefineProperty = _dereq_(31); +var getIteratorFn = _dereq_(35); +var warning = _dereq_(50); +var lowPriorityWarning = _dereq_(37); function getDeclarationErrorAddendum() { if (ReactCurrentOwner.current) { @@ -2885,7 +2258,6 @@ function validatePropTypes(element) { } var ReactElementValidator = { - createElement: function (type, props, children) { var validType = typeof type === 'string' || typeof type === 'function'; // We warn in this case but don't throw. We expect the element creation to @@ -2894,7 +2266,7 @@ var ReactElementValidator = { if (typeof type !== 'function' && typeof type !== 'string') { var info = ''; if (type === undefined || typeof type === 'object' && type !== null && Object.keys(type).length === 0) { - info += ' You likely forgot to export your component from the file ' + 'it\'s defined in.'; + info += ' You likely forgot to export your component from the file ' + "it's defined in."; } var sourceInfo = getSourceInfoErrorAddendum(props); @@ -2906,7 +2278,10 @@ var ReactElementValidator = { info += ReactComponentTreeHook.getCurrentStackAddendum(); + var currentSource = props !== null && props !== undefined && props.__source !== undefined ? props.__source : null; + ReactComponentTreeHook.pushNonStandardWarningStack(true, currentSource); "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; + ReactComponentTreeHook.popNonStandardWarningStack(); } } @@ -2944,7 +2319,7 @@ var ReactElementValidator = { Object.defineProperty(validatedFactory, 'type', { enumerable: false, get: function () { - "development" !== 'production' ? warning(false, 'Factory.type is deprecated. Access the class directly ' + 'before passing it to createFactory.') : void 0; + lowPriorityWarning(false, 'Factory.type is deprecated. Access the class directly ' + 'before passing it to createFactory.'); Object.defineProperty(this, 'type', { value: type }); @@ -2965,11 +2340,10 @@ var ReactElementValidator = { validatePropTypes(newElement); return newElement; } - }; module.exports = ReactElementValidator; -},{"12":12,"14":14,"16":16,"33":33,"34":34,"36":36,"49":49}],19:[function(_dereq_,module,exports){ +},{"11":11,"13":13,"15":15,"31":31,"32":32,"35":35,"37":37,"50":50}],18:[function(_dereq_,module,exports){ /** * Copyright 2015-present, Facebook, Inc. * All rights reserved. @@ -2984,12 +2358,12 @@ module.exports = ReactElementValidator; var _prodInvariant = _dereq_(39); -var ReactChildren = _dereq_(9); -var ReactElement = _dereq_(16); +var ReactChildren = _dereq_(10); +var ReactElement = _dereq_(15); -var emptyFunction = _dereq_(45); -var invariant = _dereq_(47); -var warning = _dereq_(49); +var emptyFunction = _dereq_(46); +var invariant = _dereq_(48); +var warning = _dereq_(50); /** * We used to allow keyed objects to serve as a collection of ReactElements, @@ -3038,7 +2412,7 @@ var ReactFragment = { }; module.exports = ReactFragment; -},{"16":16,"39":39,"45":45,"47":47,"49":49,"9":9}],20:[function(_dereq_,module,exports){ +},{"10":10,"15":15,"39":39,"46":46,"48":48,"50":50}],19:[function(_dereq_,module,exports){ /** * Copyright 2013-present, Facebook, Inc. * All rights reserved. @@ -3074,8 +2448,6 @@ module.exports = ReactFragment; * consumption of ReactLink easier; see LinkedValueUtils and LinkedStateMixin. */ -var React = _dereq_(5); - /** * Deprecated: An an easy way to express two-way binding with React. * See https://facebook.github.io/react/docs/two-way-binding-helpers.html @@ -3083,33 +2455,14 @@ var React = _dereq_(5); * @param {*} value current value of the link * @param {function} requestChange callback to request a change */ + function ReactLink(value, requestChange) { this.value = value; this.requestChange = requestChange; } -/** - * Creates a PropType that enforces the ReactLink API and optionally checks the - * type of the value being passed inside the link. Example: - * - * MyComponent.propTypes = { - * tabIndexLink: ReactLink.PropTypes.link(React.PropTypes.number) - * } - */ -function createLinkTypeChecker(linkType) { - var shapes = { - value: linkType === undefined ? React.PropTypes.any.isRequired : linkType.isRequired, - requestChange: React.PropTypes.func.isRequired - }; - return React.PropTypes.shape(shapes); -} - -ReactLink.PropTypes = { - link: createLinkTypeChecker -}; - module.exports = ReactLink; -},{"5":5}],21:[function(_dereq_,module,exports){ +},{}],20:[function(_dereq_,module,exports){ /** * Copyright 2015-present, Facebook, Inc. * All rights reserved. @@ -3122,7 +2475,7 @@ module.exports = ReactLink; 'use strict'; -var warning = _dereq_(49); +var warning = _dereq_(50); function warnNoop(publicInstance, callerName) { if ("development" !== 'production') { @@ -3135,7 +2488,6 @@ function warnNoop(publicInstance, callerName) { * This is the abstract API for an update queue. */ var ReactNoopUpdateQueue = { - /** * Checks whether or not this composite component is mounted. * @param {ReactClass} publicInstance The instance we want to test. @@ -3205,7 +2557,7 @@ var ReactNoopUpdateQueue = { }; module.exports = ReactNoopUpdateQueue; -},{"49":49}],22:[function(_dereq_,module,exports){ +},{"50":50}],21:[function(_dereq_,module,exports){ /** * Copyright 2013-present, Facebook, Inc. * All rights reserved. @@ -3230,7 +2582,7 @@ if ("development" !== 'production') { } module.exports = ReactPropTypeLocationNames; -},{}],23:[function(_dereq_,module,exports){ +},{}],22:[function(_dereq_,module,exports){ /** * Copyright 2013-present, Facebook, Inc. * All rights reserved. @@ -3243,13 +2595,13 @@ module.exports = ReactPropTypeLocationNames; 'use strict'; -var _require = _dereq_(16), +var _require = _dereq_(15), isValidElement = _require.isValidElement; -var factory = _dereq_(52); +var factory = _dereq_(53); module.exports = factory(isValidElement); -},{"16":16,"52":52}],24:[function(_dereq_,module,exports){ +},{"15":15,"53":53}],23:[function(_dereq_,module,exports){ /** * Copyright 2013-present, Facebook, Inc. * All rights reserved. @@ -3266,49 +2618,7 @@ module.exports = factory(isValidElement); var ReactPropTypesSecret = 'SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED'; module.exports = ReactPropTypesSecret; -},{}],25:[function(_dereq_,module,exports){ -/** - * Copyright 2013-present, Facebook, Inc. - * All rights reserved. - * - * This source code is licensed under the BSD-style license found in the - * LICENSE file in the root directory of this source tree. An additional grant - * of patent rights can be found in the PATENTS file in the same directory. - * - */ - -'use strict'; - -var _assign = _dereq_(50); - -var ReactComponent = _dereq_(11); -var ReactNoopUpdateQueue = _dereq_(21); - -var emptyObject = _dereq_(46); - -/** - * Base class helpers for the updating state of a component. - */ -function ReactPureComponent(props, context, updater) { - // Duplicated from ReactComponent. - this.props = props; - this.context = context; - this.refs = emptyObject; - // We initialize the default updater but the real one gets injected by the - // renderer. - this.updater = updater || ReactNoopUpdateQueue; -} - -function ComponentDummy() {} -ComponentDummy.prototype = ReactComponent.prototype; -ReactPureComponent.prototype = new ComponentDummy(); -ReactPureComponent.prototype.constructor = ReactPureComponent; -// Avoid an extra prototype jump for these methods. -_assign(ReactPureComponent.prototype, ReactComponent.prototype); -ReactPureComponent.prototype.isPureReactComponent = true; - -module.exports = ReactPureComponent; -},{"11":11,"21":21,"46":46,"50":50}],26:[function(_dereq_,module,exports){ +},{}],24:[function(_dereq_,module,exports){ /** * Copyright 2013-present, Facebook, Inc. * All rights reserved. @@ -3412,7 +2722,7 @@ ReactStateSetters.Mixin = { }; module.exports = ReactStateSetters; -},{}],27:[function(_dereq_,module,exports){ +},{}],25:[function(_dereq_,module,exports){ /** * Copyright 2013-present, Facebook, Inc. * All rights reserved. @@ -3425,7 +2735,7 @@ module.exports = ReactStateSetters; 'use strict'; -var flattenChildren = _dereq_(35); +var flattenChildren = _dereq_(34); var ReactTransitionChildMapping = { /** @@ -3515,7 +2825,7 @@ var ReactTransitionChildMapping = { }; module.exports = ReactTransitionChildMapping; -},{"35":35}],28:[function(_dereq_,module,exports){ +},{"34":34}],26:[function(_dereq_,module,exports){ /** * Copyright 2013-present, Facebook, Inc. * All rights reserved. @@ -3528,7 +2838,7 @@ module.exports = ReactTransitionChildMapping; 'use strict'; -var ExecutionEnvironment = _dereq_(44); +var ExecutionEnvironment = _dereq_(45); var getVendorPrefixedEventName = _dereq_(1); @@ -3588,7 +2898,7 @@ var ReactTransitionEvents = { }; module.exports = ReactTransitionEvents; -},{"1":1,"44":44}],29:[function(_dereq_,module,exports){ +},{"1":1,"45":45}],27:[function(_dereq_,module,exports){ /** * Copyright 2013-present, Facebook, Inc. * All rights reserved. @@ -3601,7 +2911,7 @@ module.exports = ReactTransitionEvents; 'use strict'; -var _assign = _dereq_(50); +var _assign = _dereq_(51); function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } @@ -3610,12 +2920,12 @@ function _possibleConstructorReturn(self, call) { if (!self) { throw new Referen function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; } var React = _dereq_(5); -var ReactTransitionChildMapping = _dereq_(27); +var ReactTransitionChildMapping = _dereq_(25); -var propTypesFactory = _dereq_(52); +var propTypesFactory = _dereq_(53); var PropTypes = propTypesFactory(React.isValidElement); -var emptyFunction = _dereq_(45); +var emptyFunction = _dereq_(46); /** * A basis for animations. When children are declaratively added or removed, @@ -3786,7 +3096,10 @@ var ReactTransitionGroup = function (_React$Component) { // already been removed. In case you need this behavior you can provide // a childFactory function to wrap every child, even the ones that are // leaving. - childrenToRender.push(React.cloneElement(this.props.childFactory(child), { ref: key, key: key })); + childrenToRender.push(React.cloneElement(this.props.childFactory(child), { + ref: key, + key: key + })); } } @@ -3820,7 +3133,7 @@ ReactTransitionGroup.defaultProps = { module.exports = ReactTransitionGroup; -},{"27":27,"45":45,"5":5,"50":50,"52":52}],30:[function(_dereq_,module,exports){ +},{"25":25,"46":46,"5":5,"51":51,"53":53}],28:[function(_dereq_,module,exports){ /** * Copyright 2013-present, Facebook, Inc. * All rights reserved. @@ -3833,8 +3146,8 @@ module.exports = ReactTransitionGroup; 'use strict'; -module.exports = '15.5.4'; -},{}],31:[function(_dereq_,module,exports){ +module.exports = '15.6.1'; +},{}],29:[function(_dereq_,module,exports){ /** * Copyright 2013-present, Facebook, Inc. * All rights reserved. @@ -3850,10 +3163,10 @@ module.exports = '15.5.4'; var LinkedStateMixin = _dereq_(3); var React = _dereq_(5); var ReactAddonsDOMDependencies = _dereq_(6); -var ReactComponentWithPureRenderMixin = _dereq_(13); -var ReactCSSTransitionGroup = _dereq_(7); -var ReactFragment = _dereq_(19); -var ReactTransitionGroup = _dereq_(29); +var ReactComponentWithPureRenderMixin = _dereq_(12); +var ReactCSSTransitionGroup = _dereq_(8); +var ReactFragment = _dereq_(18); +var ReactTransitionGroup = _dereq_(27); var shallowCompare = _dereq_(40); var update = _dereq_(42); @@ -3887,7 +3200,7 @@ if ("development" !== 'production') { } module.exports = React; -},{"13":13,"19":19,"29":29,"3":3,"40":40,"42":42,"5":5,"6":6,"7":7}],32:[function(_dereq_,module,exports){ +},{"12":12,"18":18,"27":27,"3":3,"40":40,"42":42,"5":5,"6":6,"8":8}],30:[function(_dereq_,module,exports){ /** * Copyright 2013-present, Facebook, Inc. * All rights reserved. @@ -3900,28 +3213,28 @@ module.exports = React; 'use strict'; -var _assign = _dereq_(50); +var _assign = _dereq_(51); -var ReactWithAddons = _dereq_(31); +var ReactWithAddons = _dereq_(29); // `version` will be added here by the React module. var ReactWithAddonsUMDEntry = _assign(ReactWithAddons, { __SECRET_INJECTED_REACT_DOM_DO_NOT_USE_OR_YOU_WILL_BE_FIRED: null, // Will be injected by ReactDOM UMD build. __SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED: { - ReactCurrentOwner: _dereq_(14) + ReactCurrentOwner: _dereq_(13) } }); if ("development" !== 'production') { _assign(ReactWithAddonsUMDEntry.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED, { // ReactComponentTreeHook should not be included in production. - ReactComponentTreeHook: _dereq_(12), - getNextDebugID: _dereq_(37) + ReactComponentTreeHook: _dereq_(11), + getNextDebugID: _dereq_(36) }); } module.exports = ReactWithAddonsUMDEntry; -},{"12":12,"14":14,"31":31,"37":37,"50":50}],33:[function(_dereq_,module,exports){ +},{"11":11,"13":13,"29":29,"36":36,"51":51}],31:[function(_dereq_,module,exports){ /** * Copyright 2013-present, Facebook, Inc. * All rights reserved. @@ -3947,7 +3260,7 @@ if ("development" !== 'production') { } module.exports = canDefineProperty; -},{}],34:[function(_dereq_,module,exports){ +},{}],32:[function(_dereq_,module,exports){ (function (process){ /** * Copyright 2013-present, Facebook, Inc. @@ -3963,11 +3276,11 @@ module.exports = canDefineProperty; var _prodInvariant = _dereq_(39); -var ReactPropTypeLocationNames = _dereq_(22); -var ReactPropTypesSecret = _dereq_(24); +var ReactPropTypeLocationNames = _dereq_(21); +var ReactPropTypesSecret = _dereq_(23); -var invariant = _dereq_(47); -var warning = _dereq_(49); +var invariant = _dereq_(48); +var warning = _dereq_(50); var ReactComponentTreeHook; @@ -3977,7 +3290,7 @@ if (typeof process !== 'undefined' && process.env && "development" === 'test') { // https://github.com/facebook/react/issues/7240 // Remove the inline requires when we don't need them anymore: // https://github.com/facebook/react/pull/7178 - ReactComponentTreeHook = _dereq_(12); + ReactComponentTreeHook = _dereq_(11); } var loggedTypeFailures = {}; @@ -4019,7 +3332,7 @@ function checkReactTypeSpec(typeSpecs, values, location, componentName, element, if ("development" !== 'production') { if (!ReactComponentTreeHook) { - ReactComponentTreeHook = _dereq_(12); + ReactComponentTreeHook = _dereq_(11); } if (debugID !== null) { componentStackInfo = ReactComponentTreeHook.getStackAddendumByID(debugID); @@ -4036,7 +3349,30 @@ function checkReactTypeSpec(typeSpecs, values, location, componentName, element, module.exports = checkReactTypeSpec; }).call(this,undefined) -},{"12":12,"22":22,"24":24,"39":39,"47":47,"49":49}],35:[function(_dereq_,module,exports){ +},{"11":11,"21":21,"23":23,"39":39,"48":48,"50":50}],33:[function(_dereq_,module,exports){ +/** + * Copyright 2013-present, Facebook, Inc. + * All rights reserved. + * + * This source code is licensed under the BSD-style license found in the + * LICENSE file in the root directory of this source tree. An additional grant + * of patent rights can be found in the PATENTS file in the same directory. + * + */ + +'use strict'; + +var _require = _dereq_(7), + Component = _require.Component; + +var _require2 = _dereq_(15), + isValidElement = _require2.isValidElement; + +var ReactNoopUpdateQueue = _dereq_(20); +var factory = _dereq_(43); + +module.exports = factory(Component, isValidElement, ReactNoopUpdateQueue); +},{"15":15,"20":20,"43":43,"7":7}],34:[function(_dereq_,module,exports){ (function (process){ /** * Copyright 2013-present, Facebook, Inc. @@ -4053,7 +3389,7 @@ module.exports = checkReactTypeSpec; var KeyEscapeUtils = _dereq_(2); var traverseAllChildren = _dereq_(41); -var warning = _dereq_(49); +var warning = _dereq_(50); var ReactComponentTreeHook; @@ -4063,7 +3399,7 @@ if (typeof process !== 'undefined' && process.env && "development" === 'test') { // https://github.com/facebook/react/issues/7240 // Remove the inline requires when we don't need them anymore: // https://github.com/facebook/react/pull/7178 - ReactComponentTreeHook = _dereq_(12); + ReactComponentTreeHook = _dereq_(11); } /** @@ -4079,7 +3415,7 @@ function flattenSingleChildIntoContext(traverseContext, child, name, selfDebugID var keyUnique = result[name] === undefined; if ("development" !== 'production') { if (!ReactComponentTreeHook) { - ReactComponentTreeHook = _dereq_(12); + ReactComponentTreeHook = _dereq_(11); } if (!keyUnique) { "development" !== 'production' ? warning(false, 'flattenChildren(...): Encountered two children with the same key, ' + '`%s`. Child keys must be unique; when two children share a key, only ' + 'the first child will be used.%s', KeyEscapeUtils.unescape(name), ReactComponentTreeHook.getStackAddendumByID(selfDebugID)) : void 0; @@ -4114,7 +3450,7 @@ function flattenChildren(children, selfDebugID) { module.exports = flattenChildren; }).call(this,undefined) -},{"12":12,"2":2,"41":41,"49":49}],36:[function(_dereq_,module,exports){ +},{"11":11,"2":2,"41":41,"50":50}],35:[function(_dereq_,module,exports){ /** * Copyright 2013-present, Facebook, Inc. * All rights reserved. @@ -4155,7 +3491,7 @@ function getIteratorFn(maybeIterable) { } module.exports = getIteratorFn; -},{}],37:[function(_dereq_,module,exports){ +},{}],36:[function(_dereq_,module,exports){ /** * Copyright 2013-present, Facebook, Inc. * All rights reserved. @@ -4176,6 +3512,71 @@ function getNextDebugID() { } module.exports = getNextDebugID; +},{}],37:[function(_dereq_,module,exports){ +/** + * Copyright 2014-2015, Facebook, Inc. + * All rights reserved. + * + * This source code is licensed under the BSD-style license found in the + * LICENSE file in the root directory of this source tree. An additional grant + * of patent rights can be found in the PATENTS file in the same directory. + * + */ + +'use strict'; + +/** + * Forked from fbjs/warning: + * https://github.com/facebook/fbjs/blob/e66ba20ad5be433eb54423f2b097d829324d9de6/packages/fbjs/src/__forks__/warning.js + * + * Only change is we use console.warn instead of console.error, + * and do nothing when 'console' is not supported. + * This really simplifies the code. + * --- + * Similar to invariant but only logs a warning if the condition is not met. + * This can be used to log issues in development environments in critical + * paths. Removing the logging code for production environments will keep the + * same logic and follow the same code paths. + */ + +var lowPriorityWarning = function () {}; + +if ("development" !== 'production') { + var printWarning = function (format) { + for (var _len = arguments.length, args = Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) { + args[_key - 1] = arguments[_key]; + } + + var argIndex = 0; + var message = 'Warning: ' + format.replace(/%s/g, function () { + return args[argIndex++]; + }); + if (typeof console !== 'undefined') { + console.warn(message); + } + try { + // --- Welcome to debugging React --- + // This error was thrown as a convenience so that you can use this stack + // to find the callsite that caused this warning to fire. + throw new Error(message); + } catch (x) {} + }; + + lowPriorityWarning = function (condition, format) { + if (format === undefined) { + throw new Error('`warning(condition, format, ...args)` requires a warning ' + 'message argument'); + } + if (!condition) { + for (var _len2 = arguments.length, args = Array(_len2 > 2 ? _len2 - 2 : 0), _key2 = 2; _key2 < _len2; _key2++) { + args[_key2 - 2] = arguments[_key2]; + } + + printWarning.apply(undefined, [format].concat(args)); + } + }; +} + +module.exports = lowPriorityWarning; },{}],38:[function(_dereq_,module,exports){ /** * Copyright 2013-present, Facebook, Inc. @@ -4190,9 +3591,9 @@ module.exports = getNextDebugID; var _prodInvariant = _dereq_(39); -var ReactElement = _dereq_(16); +var ReactElement = _dereq_(15); -var invariant = _dereq_(47); +var invariant = _dereq_(48); /** * Returns the first child in a collection of children and verifies that there @@ -4214,7 +3615,7 @@ function onlyChild(children) { } module.exports = onlyChild; -},{"16":16,"39":39,"47":47}],39:[function(_dereq_,module,exports){ +},{"15":15,"39":39,"48":48}],39:[function(_dereq_,module,exports){ /** * Copyright (c) 2013-present, Facebook, Inc. * All rights reserved. @@ -4266,7 +3667,7 @@ module.exports = reactProdInvariant; 'use strict'; -var shallowEqual = _dereq_(48); +var shallowEqual = _dereq_(49); /** * Does a shallow comparison for props and state. @@ -4278,7 +3679,7 @@ function shallowCompare(instance, nextProps, nextState) { } module.exports = shallowCompare; -},{"48":48}],41:[function(_dereq_,module,exports){ +},{"49":49}],41:[function(_dereq_,module,exports){ /** * Copyright 2013-present, Facebook, Inc. * All rights reserved. @@ -4293,13 +3694,13 @@ module.exports = shallowCompare; var _prodInvariant = _dereq_(39); -var ReactCurrentOwner = _dereq_(14); -var REACT_ELEMENT_TYPE = _dereq_(17); +var ReactCurrentOwner = _dereq_(13); +var REACT_ELEMENT_TYPE = _dereq_(16); -var getIteratorFn = _dereq_(36); -var invariant = _dereq_(47); +var getIteratorFn = _dereq_(35); +var invariant = _dereq_(48); var KeyEscapeUtils = _dereq_(2); -var warning = _dereq_(49); +var warning = _dereq_(50); var SEPARATOR = '.'; var SUBSEPARATOR = ':'; @@ -4412,7 +3813,7 @@ function traverseAllChildrenImpl(children, nameSoFar, callback, traverseContext) if ("development" !== 'production') { 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.'; if (children._isReactElement) { - addendum = ' It looks like you\'re using an element created by a different ' + 'version of React. Make sure to use only one copy of React.'; + addendum = " It looks like you're using an element created by a different " + 'version of React. Make sure to use only one copy of React.'; } if (ReactCurrentOwner.current) { var name = ReactCurrentOwner.current.getName(); @@ -4454,7 +3855,7 @@ function traverseAllChildren(children, callback, traverseContext) { } module.exports = traverseAllChildren; -},{"14":14,"17":17,"2":2,"36":36,"39":39,"47":47,"49":49}],42:[function(_dereq_,module,exports){ +},{"13":13,"16":16,"2":2,"35":35,"39":39,"48":48,"50":50}],42:[function(_dereq_,module,exports){ /** * Copyright 2013-present, Facebook, Inc. * All rights reserved. @@ -4470,9 +3871,9 @@ module.exports = traverseAllChildren; 'use strict'; var _prodInvariant = _dereq_(39), - _assign = _dereq_(50); + _assign = _dereq_(51); -var invariant = _dereq_(47); +var invariant = _dereq_(48); var hasOwnProperty = {}.hasOwnProperty; function shallowCopy(x) { @@ -4566,7 +3967,881 @@ function update(value, spec) { } module.exports = update; -},{"39":39,"47":47,"50":50}],43:[function(_dereq_,module,exports){ +},{"39":39,"48":48,"51":51}],43:[function(_dereq_,module,exports){ +/** + * Copyright 2013-present, Facebook, Inc. + * All rights reserved. + * + * This source code is licensed under the BSD-style license found in the + * LICENSE file in the root directory of this source tree. An additional grant + * of patent rights can be found in the PATENTS file in the same directory. + * + */ + +'use strict'; + +var _assign = _dereq_(51); + +var emptyObject = _dereq_(47); +var _invariant = _dereq_(48); + +if ("development" !== 'production') { + var warning = _dereq_(50); +} + +var MIXINS_KEY = 'mixins'; + +// Helper function to allow the creation of anonymous functions which do not +// have .name set to the name of the variable being assigned to. +function identity(fn) { + return fn; +} + +var ReactPropTypeLocationNames; +if ("development" !== 'production') { + ReactPropTypeLocationNames = { + prop: 'prop', + context: 'context', + childContext: 'child context' + }; +} else { + ReactPropTypeLocationNames = {}; +} + +function factory(ReactComponent, isValidElement, ReactNoopUpdateQueue) { + /** + * Policies that describe methods in `ReactClassInterface`. + */ + + var injectedMixins = []; + + /** + * Composite components are higher-level components that compose other composite + * or host components. + * + * To create a new type of `ReactClass`, pass a specification of + * your new class to `React.createClass`. The only requirement of your class + * specification is that you implement a `render` method. + * + * var MyComponent = React.createClass({ + * render: function() { + * return <div>Hello World</div>; + * } + * }); + * + * The class specification supports a specific protocol of methods that have + * special meaning (e.g. `render`). See `ReactClassInterface` for + * more the comprehensive protocol. Any other properties and methods in the + * class specification will be available on the prototype. + * + * @interface ReactClassInterface + * @internal + */ + var ReactClassInterface = { + /** + * An array of Mixin objects to include when defining your component. + * + * @type {array} + * @optional + */ + mixins: 'DEFINE_MANY', + + /** + * An object containing properties and methods that should be defined on + * the component's constructor instead of its prototype (static methods). + * + * @type {object} + * @optional + */ + statics: 'DEFINE_MANY', + + /** + * Definition of prop types for this component. + * + * @type {object} + * @optional + */ + propTypes: 'DEFINE_MANY', + + /** + * Definition of context types for this component. + * + * @type {object} + * @optional + */ + contextTypes: 'DEFINE_MANY', + + /** + * Definition of context types this component sets for its children. + * + * @type {object} + * @optional + */ + childContextTypes: 'DEFINE_MANY', + + // ==== Definition methods ==== + + /** + * Invoked when the component is mounted. Values in the mapping will be set on + * `this.props` if that prop is not specified (i.e. using an `in` check). + * + * This method is invoked before `getInitialState` and therefore cannot rely + * on `this.state` or use `this.setState`. + * + * @return {object} + * @optional + */ + getDefaultProps: 'DEFINE_MANY_MERGED', + + /** + * Invoked once before the component is mounted. The return value will be used + * as the initial value of `this.state`. + * + * getInitialState: function() { + * return { + * isOn: false, + * fooBaz: new BazFoo() + * } + * } + * + * @return {object} + * @optional + */ + getInitialState: 'DEFINE_MANY_MERGED', + + /** + * @return {object} + * @optional + */ + getChildContext: 'DEFINE_MANY_MERGED', + + /** + * Uses props from `this.props` and state from `this.state` to render the + * structure of the component. + * + * No guarantees are made about when or how often this method is invoked, so + * it must not have side effects. + * + * render: function() { + * var name = this.props.name; + * return <div>Hello, {name}!</div>; + * } + * + * @return {ReactComponent} + * @required + */ + render: 'DEFINE_ONCE', + + // ==== Delegate methods ==== + + /** + * Invoked when the component is initially created and about to be mounted. + * This may have side effects, but any external subscriptions or data created + * by this method must be cleaned up in `componentWillUnmount`. + * + * @optional + */ + componentWillMount: 'DEFINE_MANY', + + /** + * Invoked when the component has been mounted and has a DOM representation. + * However, there is no guarantee that the DOM node is in the document. + * + * Use this as an opportunity to operate on the DOM when the component has + * been mounted (initialized and rendered) for the first time. + * + * @param {DOMElement} rootNode DOM element representing the component. + * @optional + */ + componentDidMount: 'DEFINE_MANY', + + /** + * Invoked before the component receives new props. + * + * Use this as an opportunity to react to a prop transition by updating the + * state using `this.setState`. Current props are accessed via `this.props`. + * + * componentWillReceiveProps: function(nextProps, nextContext) { + * this.setState({ + * likesIncreasing: nextProps.likeCount > this.props.likeCount + * }); + * } + * + * NOTE: There is no equivalent `componentWillReceiveState`. An incoming prop + * transition may cause a state change, but the opposite is not true. If you + * need it, you are probably looking for `componentWillUpdate`. + * + * @param {object} nextProps + * @optional + */ + componentWillReceiveProps: 'DEFINE_MANY', + + /** + * Invoked while deciding if the component should be updated as a result of + * receiving new props, state and/or context. + * + * Use this as an opportunity to `return false` when you're certain that the + * transition to the new props/state/context will not require a component + * update. + * + * shouldComponentUpdate: function(nextProps, nextState, nextContext) { + * return !equal(nextProps, this.props) || + * !equal(nextState, this.state) || + * !equal(nextContext, this.context); + * } + * + * @param {object} nextProps + * @param {?object} nextState + * @param {?object} nextContext + * @return {boolean} True if the component should update. + * @optional + */ + shouldComponentUpdate: 'DEFINE_ONCE', + + /** + * Invoked when the component is about to update due to a transition from + * `this.props`, `this.state` and `this.context` to `nextProps`, `nextState` + * and `nextContext`. + * + * Use this as an opportunity to perform preparation before an update occurs. + * + * NOTE: You **cannot** use `this.setState()` in this method. + * + * @param {object} nextProps + * @param {?object} nextState + * @param {?object} nextContext + * @param {ReactReconcileTransaction} transaction + * @optional + */ + componentWillUpdate: 'DEFINE_MANY', + + /** + * Invoked when the component's DOM representation has been updated. + * + * Use this as an opportunity to operate on the DOM when the component has + * been updated. + * + * @param {object} prevProps + * @param {?object} prevState + * @param {?object} prevContext + * @param {DOMElement} rootNode DOM element representing the component. + * @optional + */ + componentDidUpdate: 'DEFINE_MANY', + + /** + * Invoked when the component is about to be removed from its parent and have + * its DOM representation destroyed. + * + * Use this as an opportunity to deallocate any external resources. + * + * NOTE: There is no `componentDidUnmount` since your component will have been + * destroyed by that point. + * + * @optional + */ + componentWillUnmount: 'DEFINE_MANY', + + // ==== Advanced methods ==== + + /** + * Updates the component's currently mounted DOM representation. + * + * By default, this implements React's rendering and reconciliation algorithm. + * Sophisticated clients may wish to override this. + * + * @param {ReactReconcileTransaction} transaction + * @internal + * @overridable + */ + updateComponent: 'OVERRIDE_BASE' + }; + + /** + * Mapping from class specification keys to special processing functions. + * + * Although these are declared like instance properties in the specification + * when defining classes using `React.createClass`, they are actually static + * and are accessible on the constructor instead of the prototype. Despite + * being static, they must be defined outside of the "statics" key under + * which all other static methods are defined. + */ + var RESERVED_SPEC_KEYS = { + displayName: function(Constructor, displayName) { + Constructor.displayName = displayName; + }, + mixins: function(Constructor, mixins) { + if (mixins) { + for (var i = 0; i < mixins.length; i++) { + mixSpecIntoComponent(Constructor, mixins[i]); + } + } + }, + childContextTypes: function(Constructor, childContextTypes) { + if ("development" !== 'production') { + validateTypeDef(Constructor, childContextTypes, 'childContext'); + } + Constructor.childContextTypes = _assign( + {}, + Constructor.childContextTypes, + childContextTypes + ); + }, + contextTypes: function(Constructor, contextTypes) { + if ("development" !== 'production') { + validateTypeDef(Constructor, contextTypes, 'context'); + } + Constructor.contextTypes = _assign( + {}, + Constructor.contextTypes, + contextTypes + ); + }, + /** + * Special case getDefaultProps which should move into statics but requires + * automatic merging. + */ + getDefaultProps: function(Constructor, getDefaultProps) { + if (Constructor.getDefaultProps) { + Constructor.getDefaultProps = createMergedResultFunction( + Constructor.getDefaultProps, + getDefaultProps + ); + } else { + Constructor.getDefaultProps = getDefaultProps; + } + }, + propTypes: function(Constructor, propTypes) { + if ("development" !== 'production') { + validateTypeDef(Constructor, propTypes, 'prop'); + } + Constructor.propTypes = _assign({}, Constructor.propTypes, propTypes); + }, + statics: function(Constructor, statics) { + mixStaticSpecIntoComponent(Constructor, statics); + }, + autobind: function() {} + }; + + function validateTypeDef(Constructor, typeDef, location) { + for (var propName in typeDef) { + if (typeDef.hasOwnProperty(propName)) { + // use a warning instead of an _invariant so components + // don't show up in prod but only in __DEV__ + if ("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 + ); + } + } + } + } + + function validateMethodOverride(isAlreadyDefined, name) { + var specPolicy = ReactClassInterface.hasOwnProperty(name) + ? ReactClassInterface[name] + : null; + + // Disallow overriding of base class methods unless explicitly allowed. + if (ReactClassMixin.hasOwnProperty(name)) { + _invariant( + specPolicy === 'OVERRIDE_BASE', + 'ReactClassInterface: You are attempting to override ' + + '`%s` from your class specification. Ensure that your method names ' + + 'do not overlap with React methods.', + name + ); + } + + // Disallow defining methods more than once unless explicitly allowed. + if (isAlreadyDefined) { + _invariant( + specPolicy === 'DEFINE_MANY' || specPolicy === 'DEFINE_MANY_MERGED', + 'ReactClassInterface: You are attempting to define ' + + '`%s` on your component more than once. This conflict may be due ' + + 'to a mixin.', + name + ); + } + } + + /** + * Mixin helper which handles policy validation and reserved + * specification keys when building React classes. + */ + function mixSpecIntoComponent(Constructor, spec) { + if (!spec) { + if ("development" !== 'production') { + var typeofSpec = typeof spec; + var isMixinValid = typeofSpec === 'object' && spec !== null; + + if ("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 + ); + } + } + + return; + } + + _invariant( + typeof spec !== 'function', + "ReactClass: You're attempting to " + + 'use a component class or function as a mixin. Instead, just use a ' + + 'regular object.' + ); + _invariant( + !isValidElement(spec), + "ReactClass: You're attempting to " + + 'use a component as a mixin. Instead, just use a regular object.' + ); + + var proto = Constructor.prototype; + var autoBindPairs = proto.__reactAutoBindPairs; + + // By handling mixins before any other properties, we ensure the same + // chaining order is applied to methods with DEFINE_MANY policy, whether + // mixins are listed before or after these methods in the spec. + if (spec.hasOwnProperty(MIXINS_KEY)) { + RESERVED_SPEC_KEYS.mixins(Constructor, spec.mixins); + } + + for (var name in spec) { + if (!spec.hasOwnProperty(name)) { + continue; + } + + if (name === MIXINS_KEY) { + // We have already handled mixins in a special case above. + continue; + } + + var property = spec[name]; + var isAlreadyDefined = proto.hasOwnProperty(name); + validateMethodOverride(isAlreadyDefined, name); + + if (RESERVED_SPEC_KEYS.hasOwnProperty(name)) { + RESERVED_SPEC_KEYS[name](Constructor, property); + } else { + // Setup methods on prototype: + // The following member methods should not be automatically bound: + // 1. Expected ReactClass methods (in the "interface"). + // 2. Overridden methods (that were mixed in). + var isReactClassMethod = ReactClassInterface.hasOwnProperty(name); + var isFunction = typeof property === 'function'; + var shouldAutoBind = + isFunction && + !isReactClassMethod && + !isAlreadyDefined && + spec.autobind !== false; + + if (shouldAutoBind) { + autoBindPairs.push(name, property); + proto[name] = property; + } else { + if (isAlreadyDefined) { + var specPolicy = ReactClassInterface[name]; + + // These cases should already be caught by validateMethodOverride. + _invariant( + isReactClassMethod && + (specPolicy === 'DEFINE_MANY_MERGED' || + specPolicy === 'DEFINE_MANY'), + 'ReactClass: Unexpected spec policy %s for key %s ' + + 'when mixing in component specs.', + specPolicy, + name + ); + + // For methods which are defined more than once, call the existing + // methods before calling the new property, merging if appropriate. + if (specPolicy === 'DEFINE_MANY_MERGED') { + proto[name] = createMergedResultFunction(proto[name], property); + } else if (specPolicy === 'DEFINE_MANY') { + proto[name] = createChainedFunction(proto[name], property); + } + } else { + proto[name] = property; + if ("development" !== 'production') { + // Add verbose displayName to the function, which helps when looking + // at profiling tools. + if (typeof property === 'function' && spec.displayName) { + proto[name].displayName = spec.displayName + '_' + name; + } + } + } + } + } + } + } + + function mixStaticSpecIntoComponent(Constructor, statics) { + if (!statics) { + return; + } + for (var name in statics) { + var property = statics[name]; + if (!statics.hasOwnProperty(name)) { + continue; + } + + var isReserved = name in RESERVED_SPEC_KEYS; + _invariant( + !isReserved, + '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 + ); + + var isInherited = name in Constructor; + _invariant( + !isInherited, + 'ReactClass: You are attempting to define ' + + '`%s` on your component more than once. This conflict may be ' + + 'due to a mixin.', + name + ); + Constructor[name] = property; + } + } + + /** + * Merge two objects, but throw if both contain the same key. + * + * @param {object} one The first object, which is mutated. + * @param {object} two The second object + * @return {object} one after it has been mutated to contain everything in two. + */ + function mergeIntoWithNoDuplicateKeys(one, two) { + _invariant( + one && two && typeof one === 'object' && typeof two === 'object', + 'mergeIntoWithNoDuplicateKeys(): Cannot merge non-objects.' + ); + + for (var key in two) { + if (two.hasOwnProperty(key)) { + _invariant( + one[key] === undefined, + '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 + ); + one[key] = two[key]; + } + } + return one; + } + + /** + * Creates a function that invokes two functions and merges their return values. + * + * @param {function} one Function to invoke first. + * @param {function} two Function to invoke second. + * @return {function} Function that invokes the two argument functions. + * @private + */ + function createMergedResultFunction(one, two) { + return function mergedResult() { + var a = one.apply(this, arguments); + var b = two.apply(this, arguments); + if (a == null) { + return b; + } else if (b == null) { + return a; + } + var c = {}; + mergeIntoWithNoDuplicateKeys(c, a); + mergeIntoWithNoDuplicateKeys(c, b); + return c; + }; + } + + /** + * Creates a function that invokes two functions and ignores their return vales. + * + * @param {function} one Function to invoke first. + * @param {function} two Function to invoke second. + * @return {function} Function that invokes the two argument functions. + * @private + */ + function createChainedFunction(one, two) { + return function chainedFunction() { + one.apply(this, arguments); + two.apply(this, arguments); + }; + } + + /** + * Binds a method to the component. + * + * @param {object} component Component whose method is going to be bound. + * @param {function} method Method to be bound. + * @return {function} The bound method. + */ + function bindAutoBindMethod(component, method) { + var boundMethod = method.bind(component); + if ("development" !== 'production') { + boundMethod.__reactBoundContext = component; + boundMethod.__reactBoundMethod = method; + boundMethod.__reactBoundArguments = null; + var componentName = component.constructor.displayName; + var _bind = boundMethod.bind; + boundMethod.bind = function(newThis) { + for ( + var _len = arguments.length, + args = Array(_len > 1 ? _len - 1 : 0), + _key = 1; + _key < _len; + _key++ + ) { + args[_key - 1] = arguments[_key]; + } + + // User is trying to bind() an autobound method; we effectively will + // ignore the value of "this" that the user is trying to use, so + // let's warn. + if (newThis !== component && newThis !== null) { + if ("development" !== 'production') { + warning( + false, + 'bind(): React component methods may only be bound to the ' + + 'component instance. See %s', + componentName + ); + } + } else if (!args.length) { + if ("development" !== 'production') { + warning( + false, + 'bind(): You are binding a component method to the component. ' + + 'React does this for you automatically in a high-performance ' + + 'way, so you can safely remove this call. See %s', + componentName + ); + } + return boundMethod; + } + var reboundMethod = _bind.apply(boundMethod, arguments); + reboundMethod.__reactBoundContext = component; + reboundMethod.__reactBoundMethod = method; + reboundMethod.__reactBoundArguments = args; + return reboundMethod; + }; + } + return boundMethod; + } + + /** + * Binds all auto-bound methods in a component. + * + * @param {object} component Component whose method is going to be bound. + */ + function bindAutoBindMethods(component) { + var pairs = component.__reactAutoBindPairs; + for (var i = 0; i < pairs.length; i += 2) { + var autoBindKey = pairs[i]; + var method = pairs[i + 1]; + component[autoBindKey] = bindAutoBindMethod(component, method); + } + } + + var IsMountedPreMixin = { + componentDidMount: function() { + this.__isMounted = true; + } + }; + + var IsMountedPostMixin = { + componentWillUnmount: function() { + this.__isMounted = false; + } + }; + + /** + * Add more to the ReactClass base class. These are all legacy features and + * therefore not already part of the modern ReactComponent. + */ + var ReactClassMixin = { + /** + * TODO: This will be deprecated because state should always keep a consistent + * type signature and the only use case for this, is to avoid that. + */ + replaceState: function(newState, callback) { + this.updater.enqueueReplaceState(this, newState, callback); + }, + + /** + * Checks whether or not this composite component is mounted. + * @return {boolean} True if mounted, false otherwise. + * @protected + * @final + */ + isMounted: function() { + if ("development" !== 'production') { + warning( + this.__didWarnIsMounted, + '%s: isMounted is deprecated. Instead, make sure to clean up ' + + 'subscriptions and pending requests in componentWillUnmount to ' + + 'prevent memory leaks.', + (this.constructor && this.constructor.displayName) || + this.name || + 'Component' + ); + this.__didWarnIsMounted = true; + } + return !!this.__isMounted; + } + }; + + var ReactClassComponent = function() {}; + _assign( + ReactClassComponent.prototype, + ReactComponent.prototype, + ReactClassMixin + ); + + /** + * Creates a composite component class given a class specification. + * See https://facebook.github.io/react/docs/top-level-api.html#react.createclass + * + * @param {object} spec Class specification (which must define `render`). + * @return {function} Component constructor function. + * @public + */ + function createClass(spec) { + // To keep our warnings more understandable, we'll use a little hack here to + // ensure that Constructor.name !== 'Constructor'. This makes sure we don't + // unnecessarily identify a class without displayName as 'Constructor'. + var Constructor = identity(function(props, context, updater) { + // This constructor gets overridden by mocks. The argument is used + // by mocks to assert on what gets mounted. + + if ("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' + ); + } + + // Wire up auto-binding + if (this.__reactAutoBindPairs.length) { + bindAutoBindMethods(this); + } + + this.props = props; + this.context = context; + this.refs = emptyObject; + this.updater = updater || ReactNoopUpdateQueue; + + this.state = null; + + // ReactClasses doesn't have constructors. Instead, they use the + // getInitialState and componentWillMount methods for initialization. + + var initialState = this.getInitialState ? this.getInitialState() : null; + if ("development" !== 'production') { + // We allow auto-mocks to proceed as if they're returning null. + if ( + initialState === undefined && + this.getInitialState._isMockFunction + ) { + // This is probably bad practice. Consider warning here and + // deprecating this convenience. + initialState = null; + } + } + _invariant( + typeof initialState === 'object' && !Array.isArray(initialState), + '%s.getInitialState(): must return an object or null', + Constructor.displayName || 'ReactCompositeComponent' + ); + + this.state = initialState; + }); + Constructor.prototype = new ReactClassComponent(); + Constructor.prototype.constructor = Constructor; + Constructor.prototype.__reactAutoBindPairs = []; + + injectedMixins.forEach(mixSpecIntoComponent.bind(null, Constructor)); + + mixSpecIntoComponent(Constructor, IsMountedPreMixin); + mixSpecIntoComponent(Constructor, spec); + mixSpecIntoComponent(Constructor, IsMountedPostMixin); + + // Initialize the defaultProps property after all mixins have been merged. + if (Constructor.getDefaultProps) { + Constructor.defaultProps = Constructor.getDefaultProps(); + } + + if ("development" !== 'production') { + // This is a tag to indicate that the use of these method names is ok, + // since it's used with createClass. If it's not, then it's likely a + // mistake so we'll warn you to use the static property, property + // initializer or constructor respectively. + if (Constructor.getDefaultProps) { + Constructor.getDefaultProps.isReactClassApproved = {}; + } + if (Constructor.prototype.getInitialState) { + Constructor.prototype.getInitialState.isReactClassApproved = {}; + } + } + + _invariant( + Constructor.prototype.render, + 'createClass(...): Class specification must implement a `render` method.' + ); + + if ("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' + ); + warning( + !Constructor.prototype.componentWillRecieveProps, + '%s has a method called ' + + 'componentWillRecieveProps(). Did you mean componentWillReceiveProps()?', + spec.displayName || 'A component' + ); + } + + // Reduce time spent doing lookups by setting these on the prototype. + for (var methodName in ReactClassInterface) { + if (!Constructor.prototype[methodName]) { + Constructor.prototype[methodName] = null; + } + } + + return Constructor; + } + + return createClass; +} + +module.exports = factory; + +},{"47":47,"48":48,"50":50,"51":51}],44:[function(_dereq_,module,exports){ 'use strict'; /** @@ -4580,7 +4855,7 @@ module.exports = update; * @typechecks */ -var invariant = _dereq_(47); +var invariant = _dereq_(48); /** * The CSSCore module specifies the API (and implements most of the methods) @@ -4688,7 +4963,7 @@ var CSSCore = { }; module.exports = CSSCore; -},{"47":47}],44:[function(_dereq_,module,exports){ +},{"48":48}],45:[function(_dereq_,module,exports){ /** * Copyright (c) 2013-present, Facebook, Inc. * All rights reserved. @@ -4724,7 +4999,7 @@ var ExecutionEnvironment = { }; module.exports = ExecutionEnvironment; -},{}],45:[function(_dereq_,module,exports){ +},{}],46:[function(_dereq_,module,exports){ "use strict"; /** @@ -4763,7 +5038,7 @@ emptyFunction.thatReturnsArgument = function (arg) { }; module.exports = emptyFunction; -},{}],46:[function(_dereq_,module,exports){ +},{}],47:[function(_dereq_,module,exports){ /** * Copyright (c) 2013-present, Facebook, Inc. * All rights reserved. @@ -4783,7 +5058,7 @@ if ("development" !== 'production') { } module.exports = emptyObject; -},{}],47:[function(_dereq_,module,exports){ +},{}],48:[function(_dereq_,module,exports){ /** * Copyright (c) 2013-present, Facebook, Inc. * All rights reserved. @@ -4839,7 +5114,7 @@ function invariant(condition, format, a, b, c, d, e, f) { } module.exports = invariant; -},{}],48:[function(_dereq_,module,exports){ +},{}],49:[function(_dereq_,module,exports){ /** * Copyright (c) 2013-present, Facebook, Inc. * All rights reserved. @@ -4907,7 +5182,7 @@ function shallowEqual(objA, objB) { } module.exports = shallowEqual; -},{}],49:[function(_dereq_,module,exports){ +},{}],50:[function(_dereq_,module,exports){ /** * Copyright 2014-2015, Facebook, Inc. * All rights reserved. @@ -4920,7 +5195,7 @@ module.exports = shallowEqual; 'use strict'; -var emptyFunction = _dereq_(45); +var emptyFunction = _dereq_(46); /** * Similar to invariant but only logs a warning if the condition is not met. @@ -4974,7 +5249,7 @@ if ("development" !== 'production') { } module.exports = warning; -},{"45":45}],50:[function(_dereq_,module,exports){ +},{"46":46}],51:[function(_dereq_,module,exports){ /* object-assign (c) Sindre Sorhus @@ -5066,7 +5341,7 @@ module.exports = shouldUseNative() ? Object.assign : function (target, source) { return to; }; -},{}],51:[function(_dereq_,module,exports){ +},{}],52:[function(_dereq_,module,exports){ /** * Copyright 2013-present, Facebook, Inc. * All rights reserved. @@ -5079,9 +5354,9 @@ module.exports = shouldUseNative() ? Object.assign : function (target, source) { 'use strict'; if ("development" !== 'production') { - var invariant = _dereq_(47); - var warning = _dereq_(49); - var ReactPropTypesSecret = _dereq_(54); + var invariant = _dereq_(48); + var warning = _dereq_(50); + var ReactPropTypesSecret = _dereq_(55); var loggedTypeFailures = {}; } @@ -5129,7 +5404,7 @@ function checkPropTypes(typeSpecs, values, location, componentName, getStack) { module.exports = checkPropTypes; -},{"47":47,"49":49,"54":54}],52:[function(_dereq_,module,exports){ +},{"48":48,"50":50,"55":55}],53:[function(_dereq_,module,exports){ /** * Copyright 2013-present, Facebook, Inc. * All rights reserved. @@ -5145,14 +5420,14 @@ module.exports = checkPropTypes; // Therefore we re-export development-only version with all the PropTypes checks here. // However if one is migrating to the `prop-types` npm library, they will go through the // `index.js` entry point, and it will branch depending on the environment. -var factory = _dereq_(53); +var factory = _dereq_(54); module.exports = function(isValidElement) { // It is still allowed in 15.5. var throwOnDirectAccess = false; return factory(isValidElement, throwOnDirectAccess); }; -},{"53":53}],53:[function(_dereq_,module,exports){ +},{"54":54}],54:[function(_dereq_,module,exports){ /** * Copyright 2013-present, Facebook, Inc. * All rights reserved. @@ -5164,12 +5439,12 @@ module.exports = function(isValidElement) { 'use strict'; -var emptyFunction = _dereq_(45); -var invariant = _dereq_(47); -var warning = _dereq_(49); +var emptyFunction = _dereq_(46); +var invariant = _dereq_(48); +var warning = _dereq_(50); -var ReactPropTypesSecret = _dereq_(54); -var checkPropTypes = _dereq_(51); +var ReactPropTypesSecret = _dereq_(55); +var checkPropTypes = _dereq_(52); module.exports = function(isValidElement, throwOnDirectAccess) { /* global Symbol */ @@ -5303,6 +5578,7 @@ module.exports = function(isValidElement, throwOnDirectAccess) { function createChainableTypeChecker(validate) { if ("development" !== 'production') { var manualPropTypeCallCache = {}; + var manualPropTypeWarningCount = 0; } function checkType(isRequired, props, propName, componentName, location, propFullName, secret) { componentName = componentName || ANONYMOUS; @@ -5320,7 +5596,11 @@ module.exports = function(isValidElement, throwOnDirectAccess) { } else if ("development" !== 'production' && typeof console !== 'undefined') { // Old behavior for people using React.PropTypes var cacheKey = componentName + ':' + propName; - if (!manualPropTypeCallCache[cacheKey]) { + if ( + !manualPropTypeCallCache[cacheKey] && + // Avoid spamming the console because they are often not actionable except for lib authors + manualPropTypeWarningCount < 3 + ) { warning( false, 'You are manually calling a React.PropTypes validation ' + @@ -5332,6 +5612,7 @@ module.exports = function(isValidElement, throwOnDirectAccess) { componentName ); manualPropTypeCallCache[cacheKey] = true; + manualPropTypeWarningCount++; } } } @@ -5469,6 +5750,20 @@ module.exports = function(isValidElement, throwOnDirectAccess) { return emptyFunction.thatReturnsNull; } + for (var i = 0; i < arrayOfTypeCheckers.length; i++) { + var checker = arrayOfTypeCheckers[i]; + if (typeof checker !== 'function') { + warning( + false, + 'Invalid argument supplid to oneOfType. Expected an array of check functions, but ' + + 'received %s at index %s.', + getPostfixForTypeWarning(checker), + i + ); + return emptyFunction.thatReturnsNull; + } + } + function validate(props, propName, componentName, location, propFullName) { for (var i = 0; i < arrayOfTypeCheckers.length; i++) { var checker = arrayOfTypeCheckers[i]; @@ -5601,6 +5896,9 @@ module.exports = function(isValidElement, throwOnDirectAccess) { // This handles more types than `getPropType`. Only used for error messages. // See `createPrimitiveTypeChecker`. function getPreciseType(propValue) { + if (typeof propValue === 'undefined' || propValue === null) { + return '' + propValue; + } var propType = getPropType(propValue); if (propType === 'object') { if (propValue instanceof Date) { @@ -5612,6 +5910,23 @@ module.exports = function(isValidElement, throwOnDirectAccess) { return propType; } + // Returns a string that is postfixed to a warning about an invalid type. + // For example, "undefined" or "of type array" + function getPostfixForTypeWarning(value) { + var type = getPreciseType(value); + switch (type) { + case 'array': + case 'object': + return 'an ' + type; + case 'boolean': + case 'date': + case 'regexp': + return 'a ' + type; + default: + return type; + } + } + // Returns class name of the object, if any. function getClassName(propValue) { if (!propValue.constructor || !propValue.constructor.name) { @@ -5626,7 +5941,7 @@ module.exports = function(isValidElement, throwOnDirectAccess) { return ReactPropTypes; }; -},{"45":45,"47":47,"49":49,"51":51,"54":54}],54:[function(_dereq_,module,exports){ +},{"46":46,"48":48,"50":50,"52":52,"55":55}],55:[function(_dereq_,module,exports){ /** * Copyright 2013-present, Facebook, Inc. * All rights reserved. @@ -5642,5 +5957,5 @@ var ReactPropTypesSecret = 'SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED'; module.exports = ReactPropTypesSecret; -},{}]},{},[32])(32) +},{}]},{},[30])(30) });
\ No newline at end of file |