mirror of
https://github.com/roytam1/basilisk55.git
synced 2026-05-27 03:09:37 +00:00
1433 lines
49 KiB
JavaScript
1433 lines
49 KiB
JavaScript
const REACT_PATH = "devtools/client/shared/vendor/react";
|
|
const REDUX_PATH = "devtools/client/shared/vendor/redux";
|
|
|
|
(function webpackUniversalModuleDefinition(root, factory) {
|
|
if(typeof exports === 'object' && typeof module === 'object')
|
|
module.exports = factory(require(REACT_PATH), require(REDUX_PATH));
|
|
else if(typeof define === 'function' && define.amd)
|
|
define(["react", "redux"], factory);
|
|
else if(typeof exports === 'object')
|
|
exports["ReactRedux"] = factory(require(REACT_PATH), require(REDUX_PATH));
|
|
else
|
|
root["ReactRedux"] = factory(root["React"], root["Redux"]);
|
|
})(this, function(__WEBPACK_EXTERNAL_MODULE_2__, __WEBPACK_EXTERNAL_MODULE_22__) {
|
|
return /******/ (function(modules) { // webpackBootstrap
|
|
/******/ // The module cache
|
|
/******/ var installedModules = {};
|
|
|
|
/******/ // The require function
|
|
/******/ function __webpack_require__(moduleId) {
|
|
|
|
/******/ // Check if module is in cache
|
|
/******/ if(installedModules[moduleId])
|
|
/******/ return installedModules[moduleId].exports;
|
|
|
|
/******/ // Create a new module (and put it into the cache)
|
|
/******/ var module = installedModules[moduleId] = {
|
|
/******/ exports: {},
|
|
/******/ id: moduleId,
|
|
/******/ loaded: false
|
|
/******/ };
|
|
|
|
/******/ // Execute the module function
|
|
/******/ modules[moduleId].call(module.exports, module, module.exports, __webpack_require__);
|
|
|
|
/******/ // Flag the module as loaded
|
|
/******/ module.loaded = true;
|
|
|
|
/******/ // Return the exports of the module
|
|
/******/ return module.exports;
|
|
/******/ }
|
|
|
|
|
|
/******/ // expose the modules object (__webpack_modules__)
|
|
/******/ __webpack_require__.m = modules;
|
|
|
|
/******/ // expose the module cache
|
|
/******/ __webpack_require__.c = installedModules;
|
|
|
|
/******/ // __webpack_public_path__
|
|
/******/ __webpack_require__.p = "";
|
|
|
|
/******/ // Load entry module and return exports
|
|
/******/ return __webpack_require__(0);
|
|
/******/ })
|
|
/************************************************************************/
|
|
/******/ ([
|
|
/* 0 */
|
|
/***/ function(module, exports, __webpack_require__) {
|
|
|
|
'use strict';
|
|
|
|
exports.__esModule = true;
|
|
exports.connect = exports.connectAdvanced = exports.Provider = undefined;
|
|
|
|
var _Provider = __webpack_require__(7);
|
|
|
|
var _Provider2 = _interopRequireDefault(_Provider);
|
|
|
|
var _connectAdvanced = __webpack_require__(3);
|
|
|
|
var _connectAdvanced2 = _interopRequireDefault(_connectAdvanced);
|
|
|
|
var _connect = __webpack_require__(8);
|
|
|
|
var _connect2 = _interopRequireDefault(_connect);
|
|
|
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
|
|
exports.Provider = _Provider2.default;
|
|
exports.connectAdvanced = _connectAdvanced2.default;
|
|
exports.connect = _connect2.default;
|
|
|
|
/***/ },
|
|
/* 1 */
|
|
/***/ function(module, exports) {
|
|
|
|
'use strict';
|
|
|
|
exports.__esModule = true;
|
|
exports.default = warning;
|
|
/**
|
|
* Prints a warning in the console if it exists.
|
|
*
|
|
* @param {String} message The warning message.
|
|
* @returns {void}
|
|
*/
|
|
function warning(message) {
|
|
/* eslint-disable no-console */
|
|
if (typeof console !== 'undefined' && typeof console.error === 'function') {
|
|
console.error(message);
|
|
}
|
|
/* eslint-enable no-console */
|
|
try {
|
|
// This error was thrown as a convenience so that if you enable
|
|
// "break on all exceptions" in your console,
|
|
// it would pause the execution at this line.
|
|
throw new Error(message);
|
|
/* eslint-disable no-empty */
|
|
} catch (e) {}
|
|
/* eslint-enable no-empty */
|
|
}
|
|
|
|
/***/ },
|
|
/* 2 */
|
|
/***/ function(module, exports) {
|
|
|
|
module.exports = __WEBPACK_EXTERNAL_MODULE_2__;
|
|
|
|
/***/ },
|
|
/* 3 */
|
|
/***/ function(module, exports, __webpack_require__) {
|
|
|
|
'use strict';
|
|
|
|
exports.__esModule = true;
|
|
|
|
var _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; };
|
|
|
|
exports.default = connectAdvanced;
|
|
|
|
var _hoistNonReactStatics = __webpack_require__(16);
|
|
|
|
var _hoistNonReactStatics2 = _interopRequireDefault(_hoistNonReactStatics);
|
|
|
|
var _invariant = __webpack_require__(17);
|
|
|
|
var _invariant2 = _interopRequireDefault(_invariant);
|
|
|
|
var _react = __webpack_require__(2);
|
|
|
|
var _Subscription = __webpack_require__(14);
|
|
|
|
var _Subscription2 = _interopRequireDefault(_Subscription);
|
|
|
|
var _storeShape = __webpack_require__(5);
|
|
|
|
var _storeShape2 = _interopRequireDefault(_storeShape);
|
|
|
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
|
|
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
|
|
|
function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }
|
|
|
|
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; }
|
|
|
|
function _objectWithoutProperties(obj, keys) { var target = {}; for (var i in obj) { if (keys.indexOf(i) >= 0) continue; if (!Object.prototype.hasOwnProperty.call(obj, i)) continue; target[i] = obj[i]; } return target; }
|
|
|
|
var hotReloadingVersion = 0;
|
|
function connectAdvanced(
|
|
/*
|
|
selectorFactory is a func that is responsible for returning the selector function used to
|
|
compute new props from state, props, and dispatch. For example:
|
|
export default connectAdvanced((dispatch, options) => (state, props) => ({
|
|
thing: state.things[props.thingId],
|
|
saveThing: fields => dispatch(actionCreators.saveThing(props.thingId, fields)),
|
|
}))(YourComponent)
|
|
Access to dispatch is provided to the factory so selectorFactories can bind actionCreators
|
|
outside of their selector as an optimization. Options passed to connectAdvanced are passed to
|
|
the selectorFactory, along with displayName and WrappedComponent, as the second argument.
|
|
Note that selectorFactory is responsible for all caching/memoization of inbound and outbound
|
|
props. Do not use connectAdvanced directly without memoizing results between calls to your
|
|
selector, otherwise the Connect component will re-render on every state or props change.
|
|
*/
|
|
selectorFactory) {
|
|
var _contextTypes, _childContextTypes;
|
|
|
|
var _ref = arguments.length <= 1 || arguments[1] === undefined ? {} : arguments[1];
|
|
|
|
var _ref$getDisplayName = _ref.getDisplayName;
|
|
var
|
|
// the func used to compute this HOC's displayName from the wrapped component's displayName.
|
|
// probably overridden by wrapper functions such as connect()
|
|
getDisplayName = _ref$getDisplayName === undefined ? function (name) {
|
|
return 'ConnectAdvanced(' + name + ')';
|
|
} : _ref$getDisplayName;
|
|
var _ref$methodName = _ref.methodName;
|
|
var
|
|
|
|
// shown in error messages
|
|
// probably overridden by wrapper functions such as connect()
|
|
methodName = _ref$methodName === undefined ? 'connectAdvanced' : _ref$methodName;
|
|
var _ref$renderCountProp = _ref.renderCountProp;
|
|
var
|
|
|
|
// if defined, the name of the property passed to the wrapped element indicating the number of
|
|
// calls to render. useful for watching in react devtools for unnecessary re-renders.
|
|
renderCountProp = _ref$renderCountProp === undefined ? undefined : _ref$renderCountProp;
|
|
var _ref$shouldHandleStat = _ref.shouldHandleStateChanges;
|
|
var
|
|
|
|
// determines whether this HOC subscribes to store changes
|
|
shouldHandleStateChanges = _ref$shouldHandleStat === undefined ? true : _ref$shouldHandleStat;
|
|
var _ref$storeKey = _ref.storeKey;
|
|
var
|
|
|
|
// the key of props/context to get the store
|
|
storeKey = _ref$storeKey === undefined ? 'store' : _ref$storeKey;
|
|
var _ref$withRef = _ref.withRef;
|
|
var
|
|
|
|
// if true, the wrapped element is exposed by this HOC via the getWrappedInstance() function.
|
|
withRef = _ref$withRef === undefined ? false : _ref$withRef;
|
|
|
|
var connectOptions = _objectWithoutProperties(_ref, ['getDisplayName', 'methodName', 'renderCountProp', 'shouldHandleStateChanges', 'storeKey', 'withRef']);
|
|
|
|
var subscriptionKey = storeKey + 'Subscription';
|
|
var version = hotReloadingVersion++;
|
|
|
|
var contextTypes = (_contextTypes = {}, _contextTypes[storeKey] = _storeShape2.default, _contextTypes[subscriptionKey] = _react.PropTypes.instanceOf(_Subscription2.default), _contextTypes);
|
|
var childContextTypes = (_childContextTypes = {}, _childContextTypes[subscriptionKey] = _react.PropTypes.instanceOf(_Subscription2.default), _childContextTypes);
|
|
|
|
return function wrapWithConnect(WrappedComponent) {
|
|
(0, _invariant2.default)(typeof WrappedComponent == 'function', 'You must pass a component to the function returned by ' + ('connect. Instead received ' + WrappedComponent));
|
|
|
|
var wrappedComponentName = WrappedComponent.displayName || WrappedComponent.name || 'Component';
|
|
|
|
var displayName = getDisplayName(wrappedComponentName);
|
|
|
|
var selectorFactoryOptions = _extends({}, connectOptions, {
|
|
getDisplayName: getDisplayName,
|
|
methodName: methodName,
|
|
renderCountProp: renderCountProp,
|
|
shouldHandleStateChanges: shouldHandleStateChanges,
|
|
storeKey: storeKey,
|
|
withRef: withRef,
|
|
displayName: displayName,
|
|
wrappedComponentName: wrappedComponentName,
|
|
WrappedComponent: WrappedComponent
|
|
});
|
|
|
|
var Connect = function (_Component) {
|
|
_inherits(Connect, _Component);
|
|
|
|
function Connect(props, context) {
|
|
_classCallCheck(this, Connect);
|
|
|
|
var _this = _possibleConstructorReturn(this, _Component.call(this, props, context));
|
|
|
|
_this.version = version;
|
|
_this.state = {};
|
|
_this.renderCount = 0;
|
|
_this.store = _this.props[storeKey] || _this.context[storeKey];
|
|
_this.parentSub = props[subscriptionKey] || context[subscriptionKey];
|
|
|
|
_this.setWrappedInstance = _this.setWrappedInstance.bind(_this);
|
|
|
|
(0, _invariant2.default)(_this.store, 'Could not find "' + storeKey + '" in either the context or ' + ('props of "' + displayName + '". ') + 'Either wrap the root component in a <Provider>, ' + ('or explicitly pass "' + storeKey + '" as a prop to "' + displayName + '".'));
|
|
|
|
// make sure `getState` is properly bound in order to avoid breaking
|
|
// custom store implementations that rely on the store's context
|
|
_this.getState = _this.store.getState.bind(_this.store);
|
|
|
|
_this.initSelector();
|
|
_this.initSubscription();
|
|
return _this;
|
|
}
|
|
|
|
Connect.prototype.getChildContext = function getChildContext() {
|
|
var _ref2;
|
|
|
|
return _ref2 = {}, _ref2[subscriptionKey] = this.subscription, _ref2;
|
|
};
|
|
|
|
Connect.prototype.componentDidMount = function componentDidMount() {
|
|
if (!shouldHandleStateChanges) return;
|
|
|
|
// componentWillMount fires during server side rendering, but componentDidMount and
|
|
// componentWillUnmount do not. Because of this, trySubscribe happens during ...didMount.
|
|
// Otherwise, unsubscription would never take place during SSR, causing a memory leak.
|
|
// To handle the case where a child component may have triggered a state change by
|
|
// dispatching an action in its componentWillMount, we have to re-run the select and maybe
|
|
// re-render.
|
|
this.subscription.trySubscribe();
|
|
this.selector.run(this.props);
|
|
if (this.selector.shouldComponentUpdate) this.forceUpdate();
|
|
};
|
|
|
|
Connect.prototype.componentWillReceiveProps = function componentWillReceiveProps(nextProps) {
|
|
this.selector.run(nextProps);
|
|
};
|
|
|
|
Connect.prototype.shouldComponentUpdate = function shouldComponentUpdate() {
|
|
return this.selector.shouldComponentUpdate;
|
|
};
|
|
|
|
Connect.prototype.componentWillUnmount = function componentWillUnmount() {
|
|
if (this.subscription) this.subscription.tryUnsubscribe();
|
|
// these are just to guard against extra memory leakage if a parent element doesn't
|
|
// dereference this instance properly, such as an async callback that never finishes
|
|
this.subscription = null;
|
|
this.store = null;
|
|
this.parentSub = null;
|
|
this.selector.run = function () {};
|
|
};
|
|
|
|
Connect.prototype.getWrappedInstance = function getWrappedInstance() {
|
|
(0, _invariant2.default)(withRef, 'To access the wrapped instance, you need to specify ' + ('{ withRef: true } in the options argument of the ' + methodName + '() call.'));
|
|
return this.wrappedInstance;
|
|
};
|
|
|
|
Connect.prototype.setWrappedInstance = function setWrappedInstance(ref) {
|
|
this.wrappedInstance = ref;
|
|
};
|
|
|
|
Connect.prototype.initSelector = function initSelector() {
|
|
var dispatch = this.store.dispatch;
|
|
var getState = this.getState;
|
|
|
|
var sourceSelector = selectorFactory(dispatch, selectorFactoryOptions);
|
|
|
|
// wrap the selector in an object that tracks its results between runs
|
|
var selector = this.selector = {
|
|
shouldComponentUpdate: true,
|
|
props: sourceSelector(getState(), this.props),
|
|
run: function runComponentSelector(props) {
|
|
try {
|
|
var nextProps = sourceSelector(getState(), props);
|
|
if (selector.error || nextProps !== selector.props) {
|
|
selector.shouldComponentUpdate = true;
|
|
selector.props = nextProps;
|
|
selector.error = null;
|
|
}
|
|
} catch (error) {
|
|
selector.shouldComponentUpdate = true;
|
|
selector.error = error;
|
|
}
|
|
}
|
|
};
|
|
};
|
|
|
|
Connect.prototype.initSubscription = function initSubscription() {
|
|
var _this2 = this;
|
|
|
|
if (shouldHandleStateChanges) {
|
|
(function () {
|
|
var subscription = _this2.subscription = new _Subscription2.default(_this2.store, _this2.parentSub);
|
|
var dummyState = {};
|
|
|
|
subscription.onStateChange = function onStateChange() {
|
|
this.selector.run(this.props);
|
|
|
|
if (!this.selector.shouldComponentUpdate) {
|
|
subscription.notifyNestedSubs();
|
|
} else {
|
|
this.componentDidUpdate = function componentDidUpdate() {
|
|
this.componentDidUpdate = undefined;
|
|
subscription.notifyNestedSubs();
|
|
};
|
|
|
|
this.setState(dummyState);
|
|
}
|
|
}.bind(_this2);
|
|
})();
|
|
}
|
|
};
|
|
|
|
Connect.prototype.isSubscribed = function isSubscribed() {
|
|
return Boolean(this.subscription) && this.subscription.isSubscribed();
|
|
};
|
|
|
|
Connect.prototype.addExtraProps = function addExtraProps(props) {
|
|
if (!withRef && !renderCountProp) return props;
|
|
// make a shallow copy so that fields added don't leak to the original selector.
|
|
// this is especially important for 'ref' since that's a reference back to the component
|
|
// instance. a singleton memoized selector would then be holding a reference to the
|
|
// instance, preventing the instance from being garbage collected, and that would be bad
|
|
var withExtras = _extends({}, props);
|
|
if (withRef) withExtras.ref = this.setWrappedInstance;
|
|
if (renderCountProp) withExtras[renderCountProp] = this.renderCount++;
|
|
return withExtras;
|
|
};
|
|
|
|
Connect.prototype.render = function render() {
|
|
var selector = this.selector;
|
|
selector.shouldComponentUpdate = false;
|
|
|
|
if (selector.error) {
|
|
throw selector.error;
|
|
} else {
|
|
return (0, _react.createElement)(WrappedComponent, this.addExtraProps(selector.props));
|
|
}
|
|
};
|
|
|
|
return Connect;
|
|
}(_react.Component);
|
|
|
|
Connect.WrappedComponent = WrappedComponent;
|
|
Connect.displayName = displayName;
|
|
Connect.childContextTypes = childContextTypes;
|
|
Connect.contextTypes = contextTypes;
|
|
Connect.propTypes = contextTypes;
|
|
|
|
if (true) {
|
|
Connect.prototype.componentWillUpdate = function componentWillUpdate() {
|
|
// We are hot reloading!
|
|
if (this.version !== version) {
|
|
this.version = version;
|
|
this.initSelector();
|
|
|
|
if (this.subscription) this.subscription.tryUnsubscribe();
|
|
this.initSubscription();
|
|
if (shouldHandleStateChanges) this.subscription.trySubscribe();
|
|
}
|
|
};
|
|
}
|
|
|
|
return (0, _hoistNonReactStatics2.default)(Connect, WrappedComponent);
|
|
};
|
|
}
|
|
|
|
/***/ },
|
|
/* 4 */
|
|
/***/ function(module, exports, __webpack_require__) {
|
|
|
|
'use strict';
|
|
|
|
exports.__esModule = true;
|
|
exports.wrapMapToPropsConstant = wrapMapToPropsConstant;
|
|
exports.getDependsOnOwnProps = getDependsOnOwnProps;
|
|
exports.wrapMapToPropsFunc = wrapMapToPropsFunc;
|
|
|
|
var _verifyPlainObject = __webpack_require__(6);
|
|
|
|
var _verifyPlainObject2 = _interopRequireDefault(_verifyPlainObject);
|
|
|
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
|
|
function wrapMapToPropsConstant(getConstant) {
|
|
return function initConstantSelector(dispatch, options) {
|
|
var constant = getConstant(dispatch, options);
|
|
|
|
function constantSelector() {
|
|
return constant;
|
|
}
|
|
constantSelector.dependsOnOwnProps = false;
|
|
return constantSelector;
|
|
};
|
|
}
|
|
|
|
// dependsOnOwnProps is used by createMapToPropsProxy to determine whether to pass props as args
|
|
// to the mapToProps function being wrapped. It is also used by makePurePropsSelector to determine
|
|
// whether mapToProps needs to be invoked when props have changed.
|
|
//
|
|
// A length of one signals that mapToProps does not depend on props from the parent component.
|
|
// A length of zero is assumed to mean mapToProps is getting args via arguments or ...args and
|
|
// therefore not reporting its length accurately..
|
|
function getDependsOnOwnProps(mapToProps) {
|
|
return mapToProps.dependsOnOwnProps !== null && mapToProps.dependsOnOwnProps !== undefined ? Boolean(mapToProps.dependsOnOwnProps) : mapToProps.length !== 1;
|
|
}
|
|
|
|
// Used by whenMapStateToPropsIsFunction and whenMapDispatchToPropsIsFunction,
|
|
// this function wraps mapToProps in a proxy function which does several things:
|
|
//
|
|
// * Detects whether the mapToProps function being called depends on props, which
|
|
// is used by selectorFactory to decide if it should reinvoke on props changes.
|
|
//
|
|
// * On first call, handles mapToProps if returns another function, and treats that
|
|
// new function as the true mapToProps for subsequent calls.
|
|
//
|
|
// * On first call, verifies the first result is a plain object, in order to warn
|
|
// the developer that their mapToProps function is not returning a valid result.
|
|
//
|
|
function wrapMapToPropsFunc(mapToProps, methodName) {
|
|
return function initProxySelector(dispatch, _ref) {
|
|
var displayName = _ref.displayName;
|
|
|
|
var proxy = function mapToPropsProxy(stateOrDispatch, ownProps) {
|
|
return proxy.dependsOnOwnProps ? proxy.mapToProps(stateOrDispatch, ownProps) : proxy.mapToProps(stateOrDispatch);
|
|
};
|
|
|
|
proxy.dependsOnOwnProps = getDependsOnOwnProps(mapToProps);
|
|
|
|
proxy.mapToProps = function detectFactoryAndVerify(stateOrDispatch, ownProps) {
|
|
proxy.mapToProps = mapToProps;
|
|
var props = proxy(stateOrDispatch, ownProps);
|
|
|
|
if (typeof props === 'function') {
|
|
proxy.mapToProps = props;
|
|
proxy.dependsOnOwnProps = getDependsOnOwnProps(props);
|
|
props = proxy(stateOrDispatch, ownProps);
|
|
}
|
|
|
|
if (true) (0, _verifyPlainObject2.default)(props, displayName, methodName);
|
|
|
|
return props;
|
|
};
|
|
|
|
return proxy;
|
|
};
|
|
}
|
|
|
|
/***/ },
|
|
/* 5 */
|
|
/***/ function(module, exports, __webpack_require__) {
|
|
|
|
'use strict';
|
|
|
|
exports.__esModule = true;
|
|
|
|
var _react = __webpack_require__(2);
|
|
|
|
exports.default = _react.PropTypes.shape({
|
|
subscribe: _react.PropTypes.func.isRequired,
|
|
dispatch: _react.PropTypes.func.isRequired,
|
|
getState: _react.PropTypes.func.isRequired
|
|
});
|
|
|
|
/***/ },
|
|
/* 6 */
|
|
/***/ function(module, exports, __webpack_require__) {
|
|
|
|
'use strict';
|
|
|
|
exports.__esModule = true;
|
|
exports.default = verifyPlainObject;
|
|
|
|
var _isPlainObject = __webpack_require__(21);
|
|
|
|
var _isPlainObject2 = _interopRequireDefault(_isPlainObject);
|
|
|
|
var _warning = __webpack_require__(1);
|
|
|
|
var _warning2 = _interopRequireDefault(_warning);
|
|
|
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
|
|
function verifyPlainObject(value, displayName, methodName) {
|
|
if (!(0, _isPlainObject2.default)(value)) {
|
|
(0, _warning2.default)(methodName + '() in ' + displayName + ' must return a plain object. Instead received ' + value + '.');
|
|
}
|
|
}
|
|
|
|
/***/ },
|
|
/* 7 */
|
|
/***/ function(module, exports, __webpack_require__) {
|
|
|
|
'use strict';
|
|
|
|
exports.__esModule = true;
|
|
exports.default = undefined;
|
|
|
|
var _react = __webpack_require__(2);
|
|
|
|
var _storeShape = __webpack_require__(5);
|
|
|
|
var _storeShape2 = _interopRequireDefault(_storeShape);
|
|
|
|
var _warning = __webpack_require__(1);
|
|
|
|
var _warning2 = _interopRequireDefault(_warning);
|
|
|
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
|
|
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
|
|
|
function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }
|
|
|
|
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 didWarnAboutReceivingStore = false;
|
|
function warnAboutReceivingStore() {
|
|
if (didWarnAboutReceivingStore) {
|
|
return;
|
|
}
|
|
didWarnAboutReceivingStore = true;
|
|
|
|
(0, _warning2.default)('<Provider> does not support changing `store` on the fly. ' + 'It is most likely that you see this error because you updated to ' + 'Redux 2.x and React Redux 2.x which no longer hot reload reducers ' + 'automatically. See https://github.com/reactjs/react-redux/releases/' + 'tag/v2.0.0 for the migration instructions.');
|
|
}
|
|
|
|
var Provider = function (_Component) {
|
|
_inherits(Provider, _Component);
|
|
|
|
Provider.prototype.getChildContext = function getChildContext() {
|
|
return { store: this.store };
|
|
};
|
|
|
|
function Provider(props, context) {
|
|
_classCallCheck(this, Provider);
|
|
|
|
var _this = _possibleConstructorReturn(this, _Component.call(this, props, context));
|
|
|
|
_this.store = props.store;
|
|
return _this;
|
|
}
|
|
|
|
Provider.prototype.render = function render() {
|
|
return _react.Children.only(this.props.children);
|
|
};
|
|
|
|
return Provider;
|
|
}(_react.Component);
|
|
|
|
exports.default = Provider;
|
|
|
|
|
|
if (true) {
|
|
Provider.prototype.componentWillReceiveProps = function (nextProps) {
|
|
var store = this.store;
|
|
var nextStore = nextProps.store;
|
|
|
|
|
|
if (store !== nextStore) {
|
|
warnAboutReceivingStore();
|
|
}
|
|
};
|
|
}
|
|
|
|
Provider.propTypes = {
|
|
store: _storeShape2.default.isRequired,
|
|
children: _react.PropTypes.element.isRequired
|
|
};
|
|
Provider.childContextTypes = {
|
|
store: _storeShape2.default.isRequired
|
|
};
|
|
Provider.displayName = 'Provider';
|
|
|
|
/***/ },
|
|
/* 8 */
|
|
/***/ function(module, exports, __webpack_require__) {
|
|
|
|
'use strict';
|
|
|
|
exports.__esModule = true;
|
|
|
|
var _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; };
|
|
|
|
exports.createConnect = createConnect;
|
|
|
|
var _connectAdvanced = __webpack_require__(3);
|
|
|
|
var _connectAdvanced2 = _interopRequireDefault(_connectAdvanced);
|
|
|
|
var _shallowEqual = __webpack_require__(15);
|
|
|
|
var _shallowEqual2 = _interopRequireDefault(_shallowEqual);
|
|
|
|
var _mapDispatchToProps = __webpack_require__(9);
|
|
|
|
var _mapDispatchToProps2 = _interopRequireDefault(_mapDispatchToProps);
|
|
|
|
var _mapStateToProps = __webpack_require__(10);
|
|
|
|
var _mapStateToProps2 = _interopRequireDefault(_mapStateToProps);
|
|
|
|
var _mergeProps = __webpack_require__(11);
|
|
|
|
var _mergeProps2 = _interopRequireDefault(_mergeProps);
|
|
|
|
var _selectorFactory = __webpack_require__(12);
|
|
|
|
var _selectorFactory2 = _interopRequireDefault(_selectorFactory);
|
|
|
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
|
|
function _objectWithoutProperties(obj, keys) { var target = {}; for (var i in obj) { if (keys.indexOf(i) >= 0) continue; if (!Object.prototype.hasOwnProperty.call(obj, i)) continue; target[i] = obj[i]; } return target; }
|
|
|
|
/*
|
|
connect is a facade over connectAdvanced. It turns its args into a compatible
|
|
selectorFactory, which has the signature:
|
|
|
|
(dispatch, options) => (nextState, nextOwnProps) => nextFinalProps
|
|
|
|
connect passes its args to connectAdvanced as options, which will in turn pass them to
|
|
selectorFactory each time a Connect component instance is instantiated or hot reloaded.
|
|
|
|
selectorFactory returns a final props selector from its mapStateToProps,
|
|
mapStateToPropsFactories, mapDispatchToProps, mapDispatchToPropsFactories, mergeProps,
|
|
mergePropsFactories, and pure args.
|
|
|
|
The resulting final props selector is called by the Connect component instance whenever
|
|
it receives new props or store state.
|
|
*/
|
|
|
|
function match(arg, factories, name) {
|
|
for (var i = factories.length - 1; i >= 0; i--) {
|
|
var result = factories[i](arg);
|
|
if (result) return result;
|
|
}
|
|
|
|
return function (dispatch, options) {
|
|
throw new Error('Invalid value of type ' + typeof arg + ' for ' + name + ' argument when connecting component ' + options.wrappedComponentName + '.');
|
|
};
|
|
}
|
|
|
|
function strictEqual(a, b) {
|
|
return a === b;
|
|
}
|
|
|
|
// createConnect with default args builds the 'official' connect behavior. Calling it with
|
|
// different options opens up some testing and extensibility scenarios
|
|
function createConnect() {
|
|
var _ref = arguments.length <= 0 || arguments[0] === undefined ? {} : arguments[0];
|
|
|
|
var _ref$connectHOC = _ref.connectHOC;
|
|
var connectHOC = _ref$connectHOC === undefined ? _connectAdvanced2.default : _ref$connectHOC;
|
|
var _ref$mapStateToPropsF = _ref.mapStateToPropsFactories;
|
|
var mapStateToPropsFactories = _ref$mapStateToPropsF === undefined ? _mapStateToProps2.default : _ref$mapStateToPropsF;
|
|
var _ref$mapDispatchToPro = _ref.mapDispatchToPropsFactories;
|
|
var mapDispatchToPropsFactories = _ref$mapDispatchToPro === undefined ? _mapDispatchToProps2.default : _ref$mapDispatchToPro;
|
|
var _ref$mergePropsFactor = _ref.mergePropsFactories;
|
|
var mergePropsFactories = _ref$mergePropsFactor === undefined ? _mergeProps2.default : _ref$mergePropsFactor;
|
|
var _ref$selectorFactory = _ref.selectorFactory;
|
|
var selectorFactory = _ref$selectorFactory === undefined ? _selectorFactory2.default : _ref$selectorFactory;
|
|
|
|
return function connect(mapStateToProps, mapDispatchToProps, mergeProps) {
|
|
var _ref2 = arguments.length <= 3 || arguments[3] === undefined ? {} : arguments[3];
|
|
|
|
var _ref2$pure = _ref2.pure;
|
|
var pure = _ref2$pure === undefined ? true : _ref2$pure;
|
|
var _ref2$areStatesEqual = _ref2.areStatesEqual;
|
|
var areStatesEqual = _ref2$areStatesEqual === undefined ? strictEqual : _ref2$areStatesEqual;
|
|
var _ref2$areOwnPropsEqua = _ref2.areOwnPropsEqual;
|
|
var areOwnPropsEqual = _ref2$areOwnPropsEqua === undefined ? _shallowEqual2.default : _ref2$areOwnPropsEqua;
|
|
var _ref2$areStatePropsEq = _ref2.areStatePropsEqual;
|
|
var areStatePropsEqual = _ref2$areStatePropsEq === undefined ? _shallowEqual2.default : _ref2$areStatePropsEq;
|
|
var _ref2$areMergedPropsE = _ref2.areMergedPropsEqual;
|
|
var areMergedPropsEqual = _ref2$areMergedPropsE === undefined ? _shallowEqual2.default : _ref2$areMergedPropsE;
|
|
|
|
var extraOptions = _objectWithoutProperties(_ref2, ['pure', 'areStatesEqual', 'areOwnPropsEqual', 'areStatePropsEqual', 'areMergedPropsEqual']);
|
|
|
|
var initMapStateToProps = match(mapStateToProps, mapStateToPropsFactories, 'mapStateToProps');
|
|
var initMapDispatchToProps = match(mapDispatchToProps, mapDispatchToPropsFactories, 'mapDispatchToProps');
|
|
var initMergeProps = match(mergeProps, mergePropsFactories, 'mergeProps');
|
|
|
|
return connectHOC(selectorFactory, _extends({
|
|
// used in error messages
|
|
methodName: 'connect',
|
|
|
|
// used to compute Connect's displayName from the wrapped component's displayName.
|
|
getDisplayName: function getDisplayName(name) {
|
|
return 'Connect(' + name + ')';
|
|
},
|
|
|
|
// if mapStateToProps is falsy, the Connect component doesn't subscribe to store state changes
|
|
shouldHandleStateChanges: Boolean(mapStateToProps),
|
|
|
|
// passed through to selectorFactory
|
|
initMapStateToProps: initMapStateToProps,
|
|
initMapDispatchToProps: initMapDispatchToProps,
|
|
initMergeProps: initMergeProps,
|
|
pure: pure,
|
|
areStatesEqual: areStatesEqual,
|
|
areOwnPropsEqual: areOwnPropsEqual,
|
|
areStatePropsEqual: areStatePropsEqual,
|
|
areMergedPropsEqual: areMergedPropsEqual
|
|
|
|
}, extraOptions));
|
|
};
|
|
}
|
|
|
|
exports.default = createConnect();
|
|
|
|
/***/ },
|
|
/* 9 */
|
|
/***/ function(module, exports, __webpack_require__) {
|
|
|
|
'use strict';
|
|
|
|
exports.__esModule = true;
|
|
exports.whenMapDispatchToPropsIsFunction = whenMapDispatchToPropsIsFunction;
|
|
exports.whenMapDispatchToPropsIsMissing = whenMapDispatchToPropsIsMissing;
|
|
exports.whenMapDispatchToPropsIsObject = whenMapDispatchToPropsIsObject;
|
|
|
|
var _redux = __webpack_require__(22);
|
|
|
|
var _wrapMapToProps = __webpack_require__(4);
|
|
|
|
function whenMapDispatchToPropsIsFunction(mapDispatchToProps) {
|
|
return typeof mapDispatchToProps === 'function' ? (0, _wrapMapToProps.wrapMapToPropsFunc)(mapDispatchToProps, 'mapDispatchToProps') : undefined;
|
|
}
|
|
|
|
function whenMapDispatchToPropsIsMissing(mapDispatchToProps) {
|
|
return !mapDispatchToProps ? (0, _wrapMapToProps.wrapMapToPropsConstant)(function (dispatch) {
|
|
return { dispatch: dispatch };
|
|
}) : undefined;
|
|
}
|
|
|
|
function whenMapDispatchToPropsIsObject(mapDispatchToProps) {
|
|
return mapDispatchToProps && typeof mapDispatchToProps === 'object' ? (0, _wrapMapToProps.wrapMapToPropsConstant)(function (dispatch) {
|
|
return (0, _redux.bindActionCreators)(mapDispatchToProps, dispatch);
|
|
}) : undefined;
|
|
}
|
|
|
|
exports.default = [whenMapDispatchToPropsIsFunction, whenMapDispatchToPropsIsMissing, whenMapDispatchToPropsIsObject];
|
|
|
|
/***/ },
|
|
/* 10 */
|
|
/***/ function(module, exports, __webpack_require__) {
|
|
|
|
'use strict';
|
|
|
|
exports.__esModule = true;
|
|
exports.whenMapStateToPropsIsFunction = whenMapStateToPropsIsFunction;
|
|
exports.whenMapStateToPropsIsMissing = whenMapStateToPropsIsMissing;
|
|
|
|
var _wrapMapToProps = __webpack_require__(4);
|
|
|
|
function whenMapStateToPropsIsFunction(mapStateToProps) {
|
|
return typeof mapStateToProps === 'function' ? (0, _wrapMapToProps.wrapMapToPropsFunc)(mapStateToProps, 'mapStateToProps') : undefined;
|
|
}
|
|
|
|
function whenMapStateToPropsIsMissing(mapStateToProps) {
|
|
return !mapStateToProps ? (0, _wrapMapToProps.wrapMapToPropsConstant)(function () {
|
|
return {};
|
|
}) : undefined;
|
|
}
|
|
|
|
exports.default = [whenMapStateToPropsIsFunction, whenMapStateToPropsIsMissing];
|
|
|
|
/***/ },
|
|
/* 11 */
|
|
/***/ function(module, exports, __webpack_require__) {
|
|
|
|
'use strict';
|
|
|
|
exports.__esModule = true;
|
|
|
|
var _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; };
|
|
|
|
exports.defaultMergeProps = defaultMergeProps;
|
|
exports.wrapMergePropsFunc = wrapMergePropsFunc;
|
|
exports.whenMergePropsIsFunction = whenMergePropsIsFunction;
|
|
exports.whenMergePropsIsOmitted = whenMergePropsIsOmitted;
|
|
|
|
var _verifyPlainObject = __webpack_require__(6);
|
|
|
|
var _verifyPlainObject2 = _interopRequireDefault(_verifyPlainObject);
|
|
|
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
|
|
function defaultMergeProps(stateProps, dispatchProps, ownProps) {
|
|
return _extends({}, ownProps, stateProps, dispatchProps);
|
|
}
|
|
|
|
function wrapMergePropsFunc(mergeProps) {
|
|
return function initMergePropsProxy(dispatch, _ref) {
|
|
var displayName = _ref.displayName;
|
|
var pure = _ref.pure;
|
|
var areMergedPropsEqual = _ref.areMergedPropsEqual;
|
|
|
|
var hasRunOnce = false;
|
|
var mergedProps = void 0;
|
|
|
|
return function mergePropsProxy(stateProps, dispatchProps, ownProps) {
|
|
var nextMergedProps = mergeProps(stateProps, dispatchProps, ownProps);
|
|
|
|
if (hasRunOnce) {
|
|
if (!pure || !areMergedPropsEqual(nextMergedProps, mergedProps)) mergedProps = nextMergedProps;
|
|
} else {
|
|
hasRunOnce = true;
|
|
mergedProps = nextMergedProps;
|
|
|
|
if (true) (0, _verifyPlainObject2.default)(mergedProps, displayName, 'mergeProps');
|
|
}
|
|
|
|
return mergedProps;
|
|
};
|
|
};
|
|
}
|
|
|
|
function whenMergePropsIsFunction(mergeProps) {
|
|
return typeof mergeProps === 'function' ? wrapMergePropsFunc(mergeProps) : undefined;
|
|
}
|
|
|
|
function whenMergePropsIsOmitted(mergeProps) {
|
|
return !mergeProps ? function () {
|
|
return defaultMergeProps;
|
|
} : undefined;
|
|
}
|
|
|
|
exports.default = [whenMergePropsIsFunction, whenMergePropsIsOmitted];
|
|
|
|
/***/ },
|
|
/* 12 */
|
|
/***/ function(module, exports, __webpack_require__) {
|
|
|
|
'use strict';
|
|
|
|
exports.__esModule = true;
|
|
exports.impureFinalPropsSelectorFactory = impureFinalPropsSelectorFactory;
|
|
exports.pureFinalPropsSelectorFactory = pureFinalPropsSelectorFactory;
|
|
exports.default = finalPropsSelectorFactory;
|
|
|
|
var _verifySubselectors = __webpack_require__(13);
|
|
|
|
var _verifySubselectors2 = _interopRequireDefault(_verifySubselectors);
|
|
|
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
|
|
function _objectWithoutProperties(obj, keys) { var target = {}; for (var i in obj) { if (keys.indexOf(i) >= 0) continue; if (!Object.prototype.hasOwnProperty.call(obj, i)) continue; target[i] = obj[i]; } return target; }
|
|
|
|
function impureFinalPropsSelectorFactory(mapStateToProps, mapDispatchToProps, mergeProps, dispatch) {
|
|
return function impureFinalPropsSelector(state, ownProps) {
|
|
return mergeProps(mapStateToProps(state, ownProps), mapDispatchToProps(dispatch, ownProps), ownProps);
|
|
};
|
|
}
|
|
|
|
function pureFinalPropsSelectorFactory(mapStateToProps, mapDispatchToProps, mergeProps, dispatch, _ref) {
|
|
var areStatesEqual = _ref.areStatesEqual;
|
|
var areOwnPropsEqual = _ref.areOwnPropsEqual;
|
|
var areStatePropsEqual = _ref.areStatePropsEqual;
|
|
|
|
var hasRunAtLeastOnce = false;
|
|
var state = void 0;
|
|
var ownProps = void 0;
|
|
var stateProps = void 0;
|
|
var dispatchProps = void 0;
|
|
var mergedProps = void 0;
|
|
|
|
function handleFirstCall(firstState, firstOwnProps) {
|
|
state = firstState;
|
|
ownProps = firstOwnProps;
|
|
stateProps = mapStateToProps(state, ownProps);
|
|
dispatchProps = mapDispatchToProps(dispatch, ownProps);
|
|
mergedProps = mergeProps(stateProps, dispatchProps, ownProps);
|
|
hasRunAtLeastOnce = true;
|
|
return mergedProps;
|
|
}
|
|
|
|
function handleNewPropsAndNewState() {
|
|
stateProps = mapStateToProps(state, ownProps);
|
|
|
|
if (mapDispatchToProps.dependsOnOwnProps) dispatchProps = mapDispatchToProps(dispatch, ownProps);
|
|
|
|
mergedProps = mergeProps(stateProps, dispatchProps, ownProps);
|
|
return mergedProps;
|
|
}
|
|
|
|
function handleNewProps() {
|
|
if (mapStateToProps.dependsOnOwnProps) stateProps = mapStateToProps(state, ownProps);
|
|
|
|
if (mapDispatchToProps.dependsOnOwnProps) dispatchProps = mapDispatchToProps(dispatch, ownProps);
|
|
|
|
mergedProps = mergeProps(stateProps, dispatchProps, ownProps);
|
|
return mergedProps;
|
|
}
|
|
|
|
function handleNewState() {
|
|
var nextStateProps = mapStateToProps(state, ownProps);
|
|
var statePropsChanged = !areStatePropsEqual(nextStateProps, stateProps);
|
|
stateProps = nextStateProps;
|
|
|
|
if (statePropsChanged) mergedProps = mergeProps(stateProps, dispatchProps, ownProps);
|
|
|
|
return mergedProps;
|
|
}
|
|
|
|
function handleSubsequentCalls(nextState, nextOwnProps) {
|
|
var propsChanged = !areOwnPropsEqual(nextOwnProps, ownProps);
|
|
var stateChanged = !areStatesEqual(nextState, state);
|
|
state = nextState;
|
|
ownProps = nextOwnProps;
|
|
|
|
if (propsChanged && stateChanged) return handleNewPropsAndNewState();
|
|
if (propsChanged) return handleNewProps();
|
|
if (stateChanged) return handleNewState();
|
|
return mergedProps;
|
|
}
|
|
|
|
return function pureFinalPropsSelector(nextState, nextOwnProps) {
|
|
return hasRunAtLeastOnce ? handleSubsequentCalls(nextState, nextOwnProps) : handleFirstCall(nextState, nextOwnProps);
|
|
};
|
|
}
|
|
|
|
// TODO: Add more comments
|
|
|
|
// If pure is true, the selector returned by selectorFactory will memoize its results,
|
|
// allowing connectAdvanced's shouldComponentUpdate to return false if final
|
|
// props have not changed. If false, the selector will always return a new
|
|
// object and shouldComponentUpdate will always return true.
|
|
|
|
function finalPropsSelectorFactory(dispatch, _ref2) {
|
|
var initMapStateToProps = _ref2.initMapStateToProps;
|
|
var initMapDispatchToProps = _ref2.initMapDispatchToProps;
|
|
var initMergeProps = _ref2.initMergeProps;
|
|
|
|
var options = _objectWithoutProperties(_ref2, ['initMapStateToProps', 'initMapDispatchToProps', 'initMergeProps']);
|
|
|
|
var mapStateToProps = initMapStateToProps(dispatch, options);
|
|
var mapDispatchToProps = initMapDispatchToProps(dispatch, options);
|
|
var mergeProps = initMergeProps(dispatch, options);
|
|
|
|
if (true) {
|
|
(0, _verifySubselectors2.default)(mapStateToProps, mapDispatchToProps, mergeProps, options.displayName);
|
|
}
|
|
|
|
var selectorFactory = options.pure ? pureFinalPropsSelectorFactory : impureFinalPropsSelectorFactory;
|
|
|
|
return selectorFactory(mapStateToProps, mapDispatchToProps, mergeProps, dispatch, options);
|
|
}
|
|
|
|
/***/ },
|
|
/* 13 */
|
|
/***/ function(module, exports, __webpack_require__) {
|
|
|
|
'use strict';
|
|
|
|
exports.__esModule = true;
|
|
exports.default = verifySubselectors;
|
|
|
|
var _warning = __webpack_require__(1);
|
|
|
|
var _warning2 = _interopRequireDefault(_warning);
|
|
|
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
|
|
function verify(selector, methodName, displayName) {
|
|
if (!selector) {
|
|
throw new Error('Unexpected value for ' + methodName + ' in ' + displayName + '.');
|
|
} else if (methodName === 'mapStateToProps' || methodName === 'mapDispatchToProps') {
|
|
if (!selector.hasOwnProperty('dependsOnOwnProps')) {
|
|
(0, _warning2.default)('The selector for ' + methodName + ' of ' + displayName + ' did not specify a value for dependsOnOwnProps.');
|
|
}
|
|
}
|
|
}
|
|
|
|
function verifySubselectors(mapStateToProps, mapDispatchToProps, mergeProps, displayName) {
|
|
verify(mapStateToProps, 'mapStateToProps', displayName);
|
|
verify(mapDispatchToProps, 'mapDispatchToProps', displayName);
|
|
verify(mergeProps, 'mergeProps', displayName);
|
|
}
|
|
|
|
/***/ },
|
|
/* 14 */
|
|
/***/ function(module, exports) {
|
|
|
|
"use strict";
|
|
|
|
exports.__esModule = true;
|
|
|
|
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
|
|
|
// encapsulates the subscription logic for connecting a component to the redux store, as
|
|
// well as nesting subscriptions of descendant components, so that we can ensure the
|
|
// ancestor components re-render before descendants
|
|
|
|
var CLEARED = null;
|
|
var nullListeners = {
|
|
notify: function notify() {}
|
|
};
|
|
|
|
function createListenerCollection() {
|
|
// the current/next pattern is copied from redux's createStore code.
|
|
// TODO: refactor+expose that code to be reusable here?
|
|
var current = [];
|
|
var next = [];
|
|
|
|
return {
|
|
clear: function clear() {
|
|
next = CLEARED;
|
|
current = CLEARED;
|
|
},
|
|
notify: function notify() {
|
|
var listeners = current = next;
|
|
for (var i = 0; i < listeners.length; i++) {
|
|
listeners[i]();
|
|
}
|
|
},
|
|
subscribe: function subscribe(listener) {
|
|
var isSubscribed = true;
|
|
if (next === current) next = current.slice();
|
|
next.push(listener);
|
|
|
|
return function unsubscribe() {
|
|
if (!isSubscribed || current === CLEARED) return;
|
|
isSubscribed = false;
|
|
|
|
if (next === current) next = current.slice();
|
|
next.splice(next.indexOf(listener), 1);
|
|
};
|
|
}
|
|
};
|
|
}
|
|
|
|
var Subscription = function () {
|
|
function Subscription(store, parentSub) {
|
|
_classCallCheck(this, Subscription);
|
|
|
|
this.store = store;
|
|
this.parentSub = parentSub;
|
|
this.unsubscribe = null;
|
|
this.listeners = nullListeners;
|
|
}
|
|
|
|
Subscription.prototype.addNestedSub = function addNestedSub(listener) {
|
|
this.trySubscribe();
|
|
return this.listeners.subscribe(listener);
|
|
};
|
|
|
|
Subscription.prototype.notifyNestedSubs = function notifyNestedSubs() {
|
|
this.listeners.notify();
|
|
};
|
|
|
|
Subscription.prototype.isSubscribed = function isSubscribed() {
|
|
return Boolean(this.unsubscribe);
|
|
};
|
|
|
|
Subscription.prototype.trySubscribe = function trySubscribe() {
|
|
if (!this.unsubscribe) {
|
|
// this.onStateChange is set by connectAdvanced.initSubscription()
|
|
this.unsubscribe = this.parentSub ? this.parentSub.addNestedSub(this.onStateChange) : this.store.subscribe(this.onStateChange);
|
|
|
|
this.listeners = createListenerCollection();
|
|
}
|
|
};
|
|
|
|
Subscription.prototype.tryUnsubscribe = function tryUnsubscribe() {
|
|
if (this.unsubscribe) {
|
|
this.unsubscribe();
|
|
this.unsubscribe = null;
|
|
this.listeners.clear();
|
|
this.listeners = nullListeners;
|
|
}
|
|
};
|
|
|
|
return Subscription;
|
|
}();
|
|
|
|
exports.default = Subscription;
|
|
|
|
/***/ },
|
|
/* 15 */
|
|
/***/ function(module, exports) {
|
|
|
|
"use strict";
|
|
|
|
exports.__esModule = true;
|
|
exports.default = shallowEqual;
|
|
var hasOwn = Object.prototype.hasOwnProperty;
|
|
|
|
function shallowEqual(a, b) {
|
|
if (a === b) return true;
|
|
|
|
var countA = 0;
|
|
var countB = 0;
|
|
|
|
for (var key in a) {
|
|
if (hasOwn.call(a, key) && a[key] !== b[key]) return false;
|
|
countA++;
|
|
}
|
|
|
|
for (var _key in b) {
|
|
if (hasOwn.call(b, _key)) countB++;
|
|
}
|
|
|
|
return countA === countB;
|
|
}
|
|
|
|
/***/ },
|
|
/* 16 */
|
|
/***/ function(module, exports) {
|
|
|
|
/**
|
|
* Copyright 2015, Yahoo! Inc.
|
|
* Copyrights licensed under the New BSD License. See the accompanying LICENSE file for terms.
|
|
*/
|
|
'use strict';
|
|
|
|
var REACT_STATICS = {
|
|
childContextTypes: true,
|
|
contextTypes: true,
|
|
defaultProps: true,
|
|
displayName: true,
|
|
getDefaultProps: true,
|
|
mixins: true,
|
|
propTypes: true,
|
|
type: true
|
|
};
|
|
|
|
var KNOWN_STATICS = {
|
|
name: true,
|
|
length: true,
|
|
prototype: true,
|
|
caller: true,
|
|
arguments: true,
|
|
arity: true
|
|
};
|
|
|
|
module.exports = function hoistNonReactStatics(targetComponent, sourceComponent) {
|
|
if (typeof sourceComponent !== 'string') { // don't hoist over string (html) components
|
|
var keys = Object.getOwnPropertyNames(sourceComponent);
|
|
for (var i=0; i<keys.length; ++i) {
|
|
if (!REACT_STATICS[keys[i]] && !KNOWN_STATICS[keys[i]]) {
|
|
try {
|
|
targetComponent[keys[i]] = sourceComponent[keys[i]];
|
|
} catch (error) {
|
|
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
return targetComponent;
|
|
};
|
|
|
|
|
|
/***/ },
|
|
/* 17 */
|
|
/***/ function(module, exports, __webpack_require__) {
|
|
|
|
/**
|
|
* Copyright 2013-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';
|
|
|
|
/**
|
|
* Use invariant() to assert state which your program assumes to be true.
|
|
*
|
|
* Provide sprintf-style format (only %s is supported) and arguments
|
|
* to provide information about what broke and what you were
|
|
* expecting.
|
|
*
|
|
* The invariant message will be stripped in production, but the invariant
|
|
* will remain to ensure logic does not differ in production.
|
|
*/
|
|
|
|
var invariant = function(condition, format, a, b, c, d, e, f) {
|
|
if (true) {
|
|
if (format === undefined) {
|
|
throw new Error('invariant requires an error message argument');
|
|
}
|
|
}
|
|
|
|
if (!condition) {
|
|
var error;
|
|
if (format === undefined) {
|
|
error = new Error(
|
|
'Minified exception occurred; use the non-minified dev environment ' +
|
|
'for the full error message and additional helpful warnings.'
|
|
);
|
|
} else {
|
|
var args = [a, b, c, d, e, f];
|
|
var argIndex = 0;
|
|
error = new Error(
|
|
format.replace(/%s/g, function() { return args[argIndex++]; })
|
|
);
|
|
error.name = 'Invariant Violation';
|
|
}
|
|
|
|
error.framesToPop = 1; // we don't care about invariant's own frame
|
|
throw error;
|
|
}
|
|
};
|
|
|
|
module.exports = invariant;
|
|
|
|
|
|
/***/ },
|
|
/* 18 */
|
|
/***/ function(module, exports) {
|
|
|
|
/* Built-in method references for those with the same name as other `lodash` methods. */
|
|
var nativeGetPrototype = Object.getPrototypeOf;
|
|
|
|
/**
|
|
* Gets the `[[Prototype]]` of `value`.
|
|
*
|
|
* @private
|
|
* @param {*} value The value to query.
|
|
* @returns {null|Object} Returns the `[[Prototype]]`.
|
|
*/
|
|
function getPrototype(value) {
|
|
return nativeGetPrototype(Object(value));
|
|
}
|
|
|
|
module.exports = getPrototype;
|
|
|
|
|
|
/***/ },
|
|
/* 19 */
|
|
/***/ function(module, exports) {
|
|
|
|
/**
|
|
* Checks if `value` is a host object in IE < 9.
|
|
*
|
|
* @private
|
|
* @param {*} value The value to check.
|
|
* @returns {boolean} Returns `true` if `value` is a host object, else `false`.
|
|
*/
|
|
function isHostObject(value) {
|
|
// Many host objects are `Object` objects that can coerce to strings
|
|
// despite having improperly defined `toString` methods.
|
|
var result = false;
|
|
if (value != null && typeof value.toString != 'function') {
|
|
try {
|
|
result = !!(value + '');
|
|
} catch (e) {}
|
|
}
|
|
return result;
|
|
}
|
|
|
|
module.exports = isHostObject;
|
|
|
|
|
|
/***/ },
|
|
/* 20 */
|
|
/***/ function(module, exports) {
|
|
|
|
/**
|
|
* Checks if `value` is object-like. A value is object-like if it's not `null`
|
|
* and has a `typeof` result of "object".
|
|
*
|
|
* @static
|
|
* @memberOf _
|
|
* @since 4.0.0
|
|
* @category Lang
|
|
* @param {*} value The value to check.
|
|
* @returns {boolean} Returns `true` if `value` is object-like, else `false`.
|
|
* @example
|
|
*
|
|
* _.isObjectLike({});
|
|
* // => true
|
|
*
|
|
* _.isObjectLike([1, 2, 3]);
|
|
* // => true
|
|
*
|
|
* _.isObjectLike(_.noop);
|
|
* // => false
|
|
*
|
|
* _.isObjectLike(null);
|
|
* // => false
|
|
*/
|
|
function isObjectLike(value) {
|
|
return !!value && typeof value == 'object';
|
|
}
|
|
|
|
module.exports = isObjectLike;
|
|
|
|
|
|
/***/ },
|
|
/* 21 */
|
|
/***/ function(module, exports, __webpack_require__) {
|
|
|
|
var getPrototype = __webpack_require__(18),
|
|
isHostObject = __webpack_require__(19),
|
|
isObjectLike = __webpack_require__(20);
|
|
|
|
/** `Object#toString` result references. */
|
|
var objectTag = '[object Object]';
|
|
|
|
/** Used for built-in method references. */
|
|
var objectProto = Object.prototype;
|
|
|
|
/** Used to resolve the decompiled source of functions. */
|
|
var funcToString = Function.prototype.toString;
|
|
|
|
/** Used to check objects for own properties. */
|
|
var hasOwnProperty = objectProto.hasOwnProperty;
|
|
|
|
/** Used to infer the `Object` constructor. */
|
|
var objectCtorString = funcToString.call(Object);
|
|
|
|
/**
|
|
* Used to resolve the
|
|
* [`toStringTag`](http://ecma-international.org/ecma-262/6.0/#sec-object.prototype.tostring)
|
|
* of values.
|
|
*/
|
|
var objectToString = objectProto.toString;
|
|
|
|
/**
|
|
* Checks if `value` is a plain object, that is, an object created by the
|
|
* `Object` constructor or one with a `[[Prototype]]` of `null`.
|
|
*
|
|
* @static
|
|
* @memberOf _
|
|
* @since 0.8.0
|
|
* @category Lang
|
|
* @param {*} value The value to check.
|
|
* @returns {boolean} Returns `true` if `value` is a plain object,
|
|
* else `false`.
|
|
* @example
|
|
*
|
|
* function Foo() {
|
|
* this.a = 1;
|
|
* }
|
|
*
|
|
* _.isPlainObject(new Foo);
|
|
* // => false
|
|
*
|
|
* _.isPlainObject([1, 2, 3]);
|
|
* // => false
|
|
*
|
|
* _.isPlainObject({ 'x': 0, 'y': 0 });
|
|
* // => true
|
|
*
|
|
* _.isPlainObject(Object.create(null));
|
|
* // => true
|
|
*/
|
|
function isPlainObject(value) {
|
|
if (!isObjectLike(value) ||
|
|
objectToString.call(value) != objectTag || isHostObject(value)) {
|
|
return false;
|
|
}
|
|
var proto = getPrototype(value);
|
|
if (proto === null) {
|
|
return true;
|
|
}
|
|
var Ctor = hasOwnProperty.call(proto, 'constructor') && proto.constructor;
|
|
return (typeof Ctor == 'function' &&
|
|
Ctor instanceof Ctor && funcToString.call(Ctor) == objectCtorString);
|
|
}
|
|
|
|
module.exports = isPlainObject;
|
|
|
|
|
|
/***/ },
|
|
/* 22 */
|
|
/***/ function(module, exports) {
|
|
|
|
module.exports = __WEBPACK_EXTERNAL_MODULE_22__;
|
|
|
|
/***/ }
|
|
/******/ ])
|
|
});
|
|
;
|