🚀 Big News: Socket Acquires Coana to Bring Reachability Analysis to Every Appsec Team.Learn more

preact-redux

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

preact-redux - npm Package Compare versions

Comparing version

to
2.1.0

@@ -1,233 +0,320 @@

import { Component, h } from 'preact';
import { h, Component } from 'preact';
import { createContext } from 'preact-context';
import { bindActionCreators } from 'redux';
var Children = {
only: function only(children) {
return children && children[0] || null;
}
};
function _extends() {
_extends = Object.assign || function (target) {
for (var i = 1; i < arguments.length; i++) {
var source = arguments[i];
function proptype() {}
proptype.isRequired = proptype;
var PropTypes = {
element: proptype,
func: proptype,
shape: function shape() {
return proptype;
},
instanceOf: function instanceOf() {
return proptype;
}
};
var subscriptionShape = PropTypes.shape({
trySubscribe: PropTypes.func.isRequired,
tryUnsubscribe: PropTypes.func.isRequired,
notifyNestedSubs: PropTypes.func.isRequired,
isSubscribed: PropTypes.func.isRequired
});
var storeShape = PropTypes.shape({
subscribe: PropTypes.func.isRequired,
dispatch: PropTypes.func.isRequired,
getState: PropTypes.func.isRequired
});
/**
* 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 */
}
var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function (obj) {
return typeof obj;
} : function (obj) {
return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj;
};
var classCallCheck = function (instance, Constructor) {
if (!(instance instanceof Constructor)) {
throw new TypeError("Cannot call a class as a function");
}
};
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];
for (var key in source) {
if (Object.prototype.hasOwnProperty.call(source, key)) {
target[key] = source[key];
}
}
}
}
return target;
};
return target;
};
return _extends.apply(this, arguments);
}
function _inheritsLoose(subClass, superClass) {
subClass.prototype = Object.create(superClass.prototype);
subClass.prototype.constructor = subClass;
subClass.__proto__ = superClass;
}
var inherits = function (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 objectWithoutProperties = function (obj, keys) {
function _objectWithoutPropertiesLoose(source, excluded) {
if (source == null) return {};
var target = {};
var sourceKeys = Object.keys(source);
var key, i;
for (var i in obj) {
if (keys.indexOf(i) >= 0) continue;
if (!Object.prototype.hasOwnProperty.call(obj, i)) continue;
target[i] = obj[i];
for (i = 0; i < sourceKeys.length; i++) {
key = sourceKeys[i];
if (excluded.indexOf(key) >= 0) continue;
target[key] = source[key];
}
return target;
};
}
var possibleConstructorReturn = function (self, call) {
if (!self) {
function _assertThisInitialized(self) {
if (self === void 0) {
throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
}
return call && (typeof call === "object" || typeof call === "function") ? call : self;
};
var didWarnAboutReceivingStore = false;
function warnAboutReceivingStore() {
if (didWarnAboutReceivingStore) {
return;
}
didWarnAboutReceivingStore = true;
warning('<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.');
return self;
}
function createProvider() {
var _Provider$childContex;
function invariant () {}
var storeKey = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 'store';
var subKey = arguments[1];
var React = {
createContext: createContext,
forwardRef: invariant,
createElement: h
};
var subscriptionKey = subKey || storeKey + 'Subscription';
var ReactReduxContext = React.createContext(null);
var Provider = function (_Component) {
inherits(Provider, _Component);
Provider.prototype.getChildContext = function getChildContext() {
var _ref;
return _ref = {}, _ref[storeKey] = this[storeKey], _ref[subscriptionKey] = null, _ref;
var Provider =
function (_Component) {
_inheritsLoose(Provider, _Component);
function Provider(props) {
var _this;
_this = _Component.call(this, props) || this;
var store = props.store;
_this.state = {
storeState: store.getState(),
store: store
};
return _this;
}
var _proto = Provider.prototype;
_proto.componentDidMount = function componentDidMount() {
this._isMounted = true;
this.subscribe();
};
_proto.componentWillUnmount = function componentWillUnmount() {
if (this.unsubscribe) this.unsubscribe();
this._isMounted = false;
};
_proto.componentDidUpdate = function componentDidUpdate(prevProps) {
if (this.props.store !== prevProps.store) {
if (this.unsubscribe) this.unsubscribe();
this.subscribe();
}
};
_proto.subscribe = function subscribe() {
var _this2 = this;
var store = this.props.store;
this.unsubscribe = store.subscribe(function () {
var newStoreState = store.getState();
if (!_this2._isMounted) {
return;
}
_this2.setState(function (providerState) {
if (providerState.storeState === newStoreState) {
return null;
}
return {
storeState: newStoreState
};
});
});
var postMountStoreState = store.getState();
if (postMountStoreState !== this.state.storeState) {
this.setState({
storeState: postMountStoreState
});
}
};
_proto.render = function render() {
var Context = this.props.context || ReactReduxContext;
return React.createElement(Context.Provider, {
value: this.state
}, this.props.children);
};
return Provider;
}(Component);
function Provider(props, context) {
classCallCheck(this, Provider);
function unwrapExports (x) {
return x && x.__esModule && Object.prototype.hasOwnProperty.call(x, 'default') ? x['default'] : x;
}
var _this = possibleConstructorReturn(this, _Component.call(this, props, context));
function createCommonjsModule(fn, module) {
return module = { exports: {} }, fn(module, module.exports), module.exports;
}
_this[storeKey] = props.store;
return _this;
var reactIs_production_min = createCommonjsModule(function (module, exports) {
Object.defineProperty(exports, "__esModule", {
value: !0
});
var c = 60103,
d = 60106,
e = 60107,
f = 60108,
g = 60114,
h = 60109,
k = 60110,
l = 60111,
m = 60111,
n = 60112,
p = 60113,
q = 60115,
r = 60116;
function t(a) {
if ("object" === typeof a && null !== a) {
var u = a.$$typeof;
switch (u) {
case c:
switch (a = a.type, a) {
case l:
case m:
case e:
case g:
case f:
case p:
return a;
default:
switch (a = a && a.$$typeof, a) {
case k:
case n:
case h:
return a;
default:
return u;
}
}
case r:
case q:
case d:
return u;
}
Provider.prototype.render = function render() {
return Children.only(this.props.children);
};
return Provider;
}(Component);
{
Provider.prototype.componentWillReceiveProps = function (nextProps) {
if (this[storeKey] !== nextProps.store) {
warnAboutReceivingStore();
}
};
}
}
function v(a) {
return t(a) === m;
}
exports.typeOf = t;
exports.AsyncMode = l;
exports.ConcurrentMode = m;
exports.ContextConsumer = k;
exports.ContextProvider = h;
exports.Element = c;
exports.ForwardRef = n;
exports.Fragment = e;
exports.Lazy = r;
exports.Memo = q;
exports.Portal = d;
exports.Profiler = g;
exports.StrictMode = f;
exports.Suspense = p;
exports.isValidElementType = function (a) {
return "string" === typeof a || "function" === typeof a || a === e || a === m || a === g || a === f || a === p || "object" === typeof a && null !== a && (a.$$typeof === r || a.$$typeof === q || a.$$typeof === h || a.$$typeof === k || a.$$typeof === n);
};
exports.isAsyncMode = function (a) {
return v(a) || t(a) === l;
};
exports.isConcurrentMode = v;
exports.isContextConsumer = function (a) {
return t(a) === k;
};
exports.isContextProvider = function (a) {
return t(a) === h;
};
exports.isElement = function (a) {
return "object" === typeof a && null !== a && a.$$typeof === c;
};
exports.isForwardRef = function (a) {
return t(a) === n;
};
exports.isFragment = function (a) {
return t(a) === e;
};
exports.isLazy = function (a) {
return t(a) === r;
};
exports.isMemo = function (a) {
return t(a) === q;
};
exports.isPortal = function (a) {
return t(a) === d;
};
exports.isProfiler = function (a) {
return t(a) === g;
};
exports.isStrictMode = function (a) {
return t(a) === f;
};
exports.isSuspense = function (a) {
return t(a) === p;
};
});
unwrapExports(reactIs_production_min);
var reactIs_production_min_1 = reactIs_production_min.typeOf;
var reactIs_production_min_2 = reactIs_production_min.AsyncMode;
var reactIs_production_min_3 = reactIs_production_min.ConcurrentMode;
var reactIs_production_min_4 = reactIs_production_min.ContextConsumer;
var reactIs_production_min_5 = reactIs_production_min.ContextProvider;
var reactIs_production_min_6 = reactIs_production_min.Element;
var reactIs_production_min_7 = reactIs_production_min.ForwardRef;
var reactIs_production_min_8 = reactIs_production_min.Fragment;
var reactIs_production_min_9 = reactIs_production_min.Lazy;
var reactIs_production_min_10 = reactIs_production_min.Memo;
var reactIs_production_min_11 = reactIs_production_min.Portal;
var reactIs_production_min_12 = reactIs_production_min.Profiler;
var reactIs_production_min_13 = reactIs_production_min.StrictMode;
var reactIs_production_min_14 = reactIs_production_min.Suspense;
var reactIs_production_min_15 = reactIs_production_min.isValidElementType;
var reactIs_production_min_16 = reactIs_production_min.isAsyncMode;
var reactIs_production_min_17 = reactIs_production_min.isConcurrentMode;
var reactIs_production_min_18 = reactIs_production_min.isContextConsumer;
var reactIs_production_min_19 = reactIs_production_min.isContextProvider;
var reactIs_production_min_20 = reactIs_production_min.isElement;
var reactIs_production_min_21 = reactIs_production_min.isForwardRef;
var reactIs_production_min_22 = reactIs_production_min.isFragment;
var reactIs_production_min_23 = reactIs_production_min.isLazy;
var reactIs_production_min_24 = reactIs_production_min.isMemo;
var reactIs_production_min_25 = reactIs_production_min.isPortal;
var reactIs_production_min_26 = reactIs_production_min.isProfiler;
var reactIs_production_min_27 = reactIs_production_min.isStrictMode;
var reactIs_production_min_28 = reactIs_production_min.isSuspense;
Provider.childContextTypes = (_Provider$childContex = {}, _Provider$childContex[storeKey] = storeShape.isRequired, _Provider$childContex[subscriptionKey] = subscriptionShape, _Provider$childContex);
return Provider;
var reactIs = createCommonjsModule(function (module) {
{
module.exports = reactIs_production_min;
}
});
var reactIs_1 = reactIs.isValidElementType;
var reactIs_2 = reactIs.isContextConsumer;
var Provider = createProvider();
/**
* Copyright 2015, Yahoo! Inc.
* Copyrights licensed under the New BSD License. See the accompanying LICENSE file for terms.
*/
var REACT_STATICS = {
childContextTypes: true,
contextTypes: true,
defaultProps: true,
displayName: true,
getDefaultProps: true,
mixins: true,
propTypes: true,
type: true
childContextTypes: true,
contextType: true,
contextTypes: true,
defaultProps: true,
displayName: true,
getDefaultProps: true,
getDerivedStateFromError: true,
getDerivedStateFromProps: true,
mixins: true,
propTypes: true,
type: true
};
var KNOWN_STATICS = {
name: true,
length: true,
prototype: true,
caller: true,
callee: true,
arguments: true,
arity: true
name: true,
length: true,
prototype: true,
caller: true,
callee: true,
arguments: true,
arity: true
};
var defineProperty$1 = Object.defineProperty;
var FORWARD_REF_STATICS = {
'$$typeof': true,
render: true,
defaultProps: true,
displayName: true,
propTypes: true
};
var MEMO_STATICS = {
'$$typeof': true,
compare: true,
defaultProps: true,
displayName: true,
propTypes: true,
type: true
};
var TYPE_STATICS = {};
TYPE_STATICS[reactIs.ForwardRef] = FORWARD_REF_STATICS;
function getStatics(component) {
if (reactIs.isMemo(component)) {
return MEMO_STATICS;
}
return TYPE_STATICS[component['$$typeof']] || REACT_STATICS;
}
var defineProperty = Object.defineProperty;
var getOwnPropertyNames = Object.getOwnPropertyNames;

@@ -237,202 +324,59 @@ var getOwnPropertySymbols = Object.getOwnPropertySymbols;

var getPrototypeOf = Object.getPrototypeOf;
var objectPrototype = getPrototypeOf && getPrototypeOf(Object);
var hoistNonReactStatics = function hoistNonReactStatics(targetComponent, sourceComponent, blacklist) {
if (typeof sourceComponent !== 'string') {
// don't hoist over string (html) components
if (objectPrototype) {
var inheritedComponent = getPrototypeOf(sourceComponent);
if (inheritedComponent && inheritedComponent !== objectPrototype) {
hoistNonReactStatics(targetComponent, inheritedComponent, blacklist);
}
}
var keys = getOwnPropertyNames(sourceComponent);
if (getOwnPropertySymbols) {
keys = keys.concat(getOwnPropertySymbols(sourceComponent));
}
for (var i = 0; i < keys.length; ++i) {
var key = keys[i];
if (!REACT_STATICS[key] && !KNOWN_STATICS[key] && (!blacklist || !blacklist[key])) {
var descriptor = getOwnPropertyDescriptor(sourceComponent, key);
try {
// Avoid failures from read-only properties
defineProperty$1(targetComponent, key, descriptor);
} catch (e) {}
}
}
return targetComponent;
}
return targetComponent;
};
var invariant = 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]();
var objectPrototype = Object.prototype;
function hoistNonReactStatics(targetComponent, sourceComponent, blacklist) {
if (typeof sourceComponent !== 'string') {
if (objectPrototype) {
var inheritedComponent = getPrototypeOf(sourceComponent);
if (inheritedComponent && inheritedComponent !== objectPrototype) {
hoistNonReactStatics(targetComponent, inheritedComponent, blacklist);
}
},
get: function get$$1() {
return next;
},
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, onStateChange) {
classCallCheck(this, Subscription);
this.store = store;
this.parentSub = parentSub;
this.onStateChange = onStateChange;
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.unsubscribe = this.parentSub ? this.parentSub.addNestedSub(this.onStateChange) : this.store.subscribe(this.onStateChange);
this.listeners = createListenerCollection();
var keys = getOwnPropertyNames(sourceComponent);
if (getOwnPropertySymbols) {
keys = keys.concat(getOwnPropertySymbols(sourceComponent));
}
};
Subscription.prototype.tryUnsubscribe = function tryUnsubscribe() {
if (this.unsubscribe) {
this.unsubscribe();
this.unsubscribe = null;
this.listeners.clear();
this.listeners = nullListeners;
}
};
return Subscription;
}();
var hotReloadingVersion = 0;
var dummyState = {};
function noop() {}
function makeSelectorStateful(sourceSelector, store) {
// wrap the selector in an object that tracks its results between runs.
var selector = {
run: function runComponentSelector(props) {
try {
var nextProps = sourceSelector(store.getState(), props);
if (nextProps !== selector.props || selector.error) {
selector.shouldComponentUpdate = true;
selector.props = nextProps;
selector.error = null;
}
} catch (error) {
selector.shouldComponentUpdate = true;
selector.error = error;
var targetStatics = getStatics(targetComponent);
var sourceStatics = getStatics(sourceComponent);
for (var i = 0; i < keys.length; ++i) {
var key = keys[i];
if (!KNOWN_STATICS[key] && !(blacklist && blacklist[key]) && !(sourceStatics && sourceStatics[key]) && !(targetStatics && targetStatics[key])) {
var descriptor = getOwnPropertyDescriptor(sourceComponent, key);
try {
defineProperty(targetComponent, key, descriptor);
} catch (e) {}
}
}
};
return selector;
return targetComponent;
}
return targetComponent;
}
var hoistNonReactStatics_cjs = hoistNonReactStatics;
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,
getDisplayName = _ref$getDisplayName === undefined ? function (name) {
return 'ConnectAdvanced(' + name + ')';
selectorFactory,
_temp) {
var _ref = _temp === void 0 ? {} : _temp,
_ref$getDisplayName = _ref.getDisplayName,
getDisplayName = _ref$getDisplayName === void 0 ? function (name) {
return "ConnectAdvanced(" + name + ")";
} : _ref$getDisplayName,
_ref$methodName = _ref.methodName,
methodName = _ref$methodName === undefined ? 'connectAdvanced' : _ref$methodName,
methodName = _ref$methodName === void 0 ? 'connectAdvanced' : _ref$methodName,
_ref$renderCountProp = _ref.renderCountProp,
renderCountProp = _ref$renderCountProp === undefined ? undefined : _ref$renderCountProp,
renderCountProp = _ref$renderCountProp === void 0 ? undefined : _ref$renderCountProp,
_ref$shouldHandleStat = _ref.shouldHandleStateChanges,
shouldHandleStateChanges = _ref$shouldHandleStat === undefined ? true : _ref$shouldHandleStat,
shouldHandleStateChanges = _ref$shouldHandleStat === void 0 ? true : _ref$shouldHandleStat,
_ref$storeKey = _ref.storeKey,
storeKey = _ref$storeKey === undefined ? 'store' : _ref$storeKey,
storeKey = _ref$storeKey === void 0 ? 'store' : _ref$storeKey,
_ref$withRef = _ref.withRef,
withRef = _ref$withRef === undefined ? false : _ref$withRef,
connectOptions = objectWithoutProperties(_ref, ['getDisplayName', 'methodName', 'renderCountProp', 'shouldHandleStateChanges', 'storeKey', 'withRef']);
var subscriptionKey = storeKey + 'Subscription';
var version = hotReloadingVersion++;
var contextTypes = (_contextTypes = {}, _contextTypes[storeKey] = storeShape, _contextTypes[subscriptionKey] = subscriptionShape, _contextTypes);
var childContextTypes = (_childContextTypes = {}, _childContextTypes[subscriptionKey] = subscriptionShape, _childContextTypes);
_ref$forwardRef = _ref.forwardRef,
forwardRef = _ref$forwardRef === void 0 ? false : _ref$forwardRef,
_ref$context = _ref.context,
context = _ref$context === void 0 ? ReactReduxContext : _ref$context,
connectOptions = _objectWithoutPropertiesLoose(_ref, ["getDisplayName", "methodName", "renderCountProp", "shouldHandleStateChanges", "storeKey", "withRef", "forwardRef", "context"]);
var customStoreWarningMessage = 'To use a custom Redux store for specific components, create a custom React context with ' + "React.createContext(), and pass the context object to React Redux's Provider and specific components" + ' like: <Provider context={MyContext}><ConnectedComponent context={MyContext} /></Provider>. ' + 'You may also pass a {context : MyContext} option to connect';
var Context = context;
return function wrapWithConnect(WrappedComponent) {
invariant(typeof WrappedComponent == 'function', 'You must pass a component to the function returned by ' + ('connect. Instead received ' + JSON.stringify(WrappedComponent)));
var wrappedComponentName = WrappedComponent.displayName || WrappedComponent.name || 'Component';
var displayName = getDisplayName(wrappedComponentName);
var selectorFactoryOptions = _extends({}, connectOptions, {

@@ -444,3 +388,2 @@ getDisplayName: getDisplayName,

storeKey: storeKey,
withRef: withRef,
displayName: displayName,

@@ -450,189 +393,92 @@ wrappedComponentName: wrappedComponentName,

});
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 = props[storeKey] || context[storeKey];
_this.propsMode = Boolean(props[storeKey]);
_this.setWrappedInstance = _this.setWrappedInstance.bind(_this);
invariant(_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 + '".'));
_this.initSelector();
_this.initSubscription();
var pure = connectOptions.pure;
var OuterBaseComponent = Component;
if (pure) {
OuterBaseComponent = Component;
}
function makeDerivedPropsSelector() {
var lastProps;
var lastState;
var lastDerivedProps;
var lastStore;
var lastSelectorFactoryOptions;
var sourceSelector;
return function selectDerivedProps(state, props, store, selectorFactoryOptions) {
if (pure && lastProps === props && lastState === state) {
return lastDerivedProps;
}
if (store !== lastStore || lastSelectorFactoryOptions !== selectorFactoryOptions) {
lastStore = store;
lastSelectorFactoryOptions = selectorFactoryOptions;
sourceSelector = selectorFactory(store.dispatch, selectorFactoryOptions);
}
lastProps = props;
lastState = state;
var nextProps = sourceSelector(state, props);
lastDerivedProps = nextProps;
return lastDerivedProps;
};
}
function makeChildElementSelector() {
var lastChildProps, lastForwardRef, lastChildElement, lastComponent;
return function selectChildElement(WrappedComponent, childProps, forwardRef) {
if (childProps !== lastChildProps || forwardRef !== lastForwardRef || lastComponent !== WrappedComponent) {
lastChildProps = childProps;
lastForwardRef = forwardRef;
lastComponent = WrappedComponent;
lastChildElement = React.createElement(WrappedComponent, _extends({}, childProps, {
ref: forwardRef
}));
}
return lastChildElement;
};
}
var Connect =
function (_OuterBaseComponent) {
_inheritsLoose(Connect, _OuterBaseComponent);
function Connect(props) {
var _this;
_this = _OuterBaseComponent.call(this, props) || this;
invariant(forwardRef ? !props.wrapperProps[storeKey] : !props[storeKey], 'Passing redux store in props has been removed and does not do anything. ' + customStoreWarningMessage);
_this.selectDerivedProps = makeDerivedPropsSelector();
_this.selectChildElement = makeChildElementSelector();
_this.indirectRenderWrappedComponent = _this.indirectRenderWrappedComponent.bind(_assertThisInitialized(_this));
return _this;
}
Connect.prototype.getChildContext = function getChildContext() {
var _ref2;
// If this component received store from props, its subscription should be transparent
// to any descendants receiving store+subscription from context; it passes along
// subscription passed to it. Otherwise, it shadows the parent subscription, which allows
// Connect to control ordering of notifications to flow top-down.
var subscription = this.propsMode ? null : this.subscription;
return _ref2 = {}, _ref2[subscriptionKey] = subscription || this.context[subscriptionKey], _ref2;
var _proto = Connect.prototype;
_proto.indirectRenderWrappedComponent = function indirectRenderWrappedComponent(value) {
return this.renderWrappedComponent(value);
};
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();
this.subscription = null;
this.notifyNestedSubs = noop;
this.store = null;
this.selector.run = noop;
this.selector.shouldComponentUpdate = false;
};
Connect.prototype.getWrappedInstance = function getWrappedInstance() {
invariant(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 sourceSelector = selectorFactory(this.store.dispatch, selectorFactoryOptions);
this.selector = makeSelectorStateful(sourceSelector, this.store);
this.selector.run(this.props);
};
Connect.prototype.initSubscription = function initSubscription() {
if (!shouldHandleStateChanges) return;
// parentSub's source should match where store came from: props vs. context. A component
// connected to the store via props shouldn't use subscription from context, or vice versa.
var parentSub = (this.propsMode ? this.props : this.context)[subscriptionKey];
this.subscription = new Subscription(this.store, parentSub, this.onStateChange.bind(this));
// `notifyNestedSubs` is duplicated to handle the case where the component is unmounted in
// the middle of the notification loop, where `this.subscription` will then be null. An
// extra null check every change can be avoided by copying the method onto `this` and then
// replacing it with a no-op on unmount. This can probably be avoided if Subscription's
// listeners logic is changed to not call listeners that have been unsubscribed in the
// middle of the notification loop.
this.notifyNestedSubs = this.subscription.notifyNestedSubs.bind(this.subscription);
};
Connect.prototype.onStateChange = function onStateChange() {
this.selector.run(this.props);
if (!this.selector.shouldComponentUpdate) {
this.notifyNestedSubs();
} else {
this.componentDidUpdate = this.notifyNestedSubsOnComponentDidUpdate;
this.setState(dummyState);
_proto.renderWrappedComponent = function renderWrappedComponent(value) {
var storeState = value.storeState,
store = value.store;
var wrapperProps = this.props;
var forwardedRef;
if (forwardRef) {
wrapperProps = this.props.wrapperProps;
forwardedRef = this.props.forwardedRef;
}
var derivedProps = this.selectDerivedProps(storeState, wrapperProps, store, selectorFactoryOptions);
return this.selectChildElement(WrappedComponent, derivedProps, forwardedRef);
};
Connect.prototype.notifyNestedSubsOnComponentDidUpdate = function notifyNestedSubsOnComponentDidUpdate() {
// `componentDidUpdate` is conditionally implemented when `onStateChange` determines it
// needs to notify nested subs. Once called, it unimplements itself until further state
// changes occur. Doing it this way vs having a permanent `componentDidUpdate` that does
// a boolean check every time avoids an extra method call most of the time, resulting
// in some perf boost.
this.componentDidUpdate = undefined;
this.notifyNestedSubs();
_proto.render = function render() {
var ContextToUse = this.props.context && this.props.context.Consumer && reactIs_2(React.createElement(this.props.context.Consumer, null)) ? this.props.context : Context;
return React.createElement(ContextToUse.Consumer, null, this.indirectRenderWrappedComponent);
};
Connect.prototype.isSubscribed = function isSubscribed() {
return Boolean(this.subscription) && this.subscription.isSubscribed();
};
Connect.prototype.addExtraProps = function addExtraProps(props) {
if (!withRef && !renderCountProp && !(this.propsMode && this.subscription)) 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++;
if (this.propsMode && this.subscription) withExtras[subscriptionKey] = this.subscription;
return withExtras;
};
Connect.prototype.render = function render() {
var selector = this.selector;
selector.shouldComponentUpdate = false;
if (selector.error) {
throw selector.error;
} else {
return h(WrappedComponent, this.addExtraProps(selector.props));
}
};
return Connect;
}(Component);
}(OuterBaseComponent);
Connect.WrappedComponent = WrappedComponent;
Connect.displayName = displayName;
Connect.childContextTypes = childContextTypes;
Connect.contextTypes = contextTypes;
{
Connect.prototype.componentWillUpdate = function componentWillUpdate() {
var _this2 = this;
// We are hot reloading!
if (this.version !== version) {
this.version = version;
this.initSelector();
// If any connected descendants don't hot reload (and resubscribe in the process), their
// listeners will be lost when we unsubscribe. Unfortunately, by copying over all
// listeners, this does mean that the old versions of connected descendants will still be
// notified of state changes; however, their onStateChange function is a no-op so this
// isn't a huge deal.
var oldListeners = [];
if (this.subscription) {
oldListeners = this.subscription.listeners.get();
this.subscription.tryUnsubscribe();
}
this.initSubscription();
if (shouldHandleStateChanges) {
this.subscription.trySubscribe();
oldListeners.forEach(function (listener) {
return _this2.subscription.listeners.subscribe(listener);
});
}
}
};
if (forwardRef) {
var forwarded = React.forwardRef(function forwardConnectRef(props, ref) {
return React.createElement(Connect, {
wrapperProps: props,
forwardedRef: ref
});
});
forwarded.displayName = displayName;
forwarded.WrappedComponent = WrappedComponent;
return hoistNonReactStatics_cjs(forwarded, WrappedComponent);
}
return hoistNonReactStatics(Connect, WrappedComponent);
return hoistNonReactStatics_cjs(Connect, WrappedComponent);
};

@@ -642,3 +488,2 @@ }

var hasOwn = Object.prototype.hasOwnProperty;
function is(x, y) {

@@ -651,15 +496,10 @@ if (x === y) {

}
function shallowEqual(objA, objB) {
if (is(objA, objB)) return true;
if ((typeof objA === 'undefined' ? 'undefined' : _typeof(objA)) !== 'object' || objA === null || (typeof objB === 'undefined' ? 'undefined' : _typeof(objB)) !== 'object' || objB === null) {
if (typeof objA !== 'object' || objA === null || typeof objB !== 'object' || objB === null) {
return false;
}
var keysA = Object.keys(objA);
var keysB = Object.keys(objB);
if (keysA.length !== keysB.length) return false;
for (var i = 0; i < keysA.length; i++) {

@@ -670,214 +510,8 @@ if (!hasOwn.call(objB, keysA[i]) || !is(objA[keysA[i]], objB[keysA[i]])) {

}
return true;
}
/** Detect free variable `global` from Node.js. */
var freeGlobal = (typeof global === 'undefined' ? 'undefined' : _typeof(global)) == 'object' && global && global.Object === Object && global;
/** Detect free variable `self`. */
var freeSelf = (typeof self === 'undefined' ? 'undefined' : _typeof(self)) == 'object' && self && self.Object === Object && self;
/** Used as a reference to the global object. */
var root = freeGlobal || freeSelf || Function('return this')();
/** Built-in value references. */
var _Symbol = root.Symbol;
/** Used for built-in method references. */
var objectProto$1 = Object.prototype;
/** Used to check objects for own properties. */
var hasOwnProperty$1 = objectProto$1.hasOwnProperty;
/**
* Used to resolve the
* [`toStringTag`](http://ecma-international.org/ecma-262/7.0/#sec-object.prototype.tostring)
* of values.
*/
var nativeObjectToString = objectProto$1.toString;
/** Built-in value references. */
var symToStringTag$1 = _Symbol ? _Symbol.toStringTag : undefined;
/**
* A specialized version of `baseGetTag` which ignores `Symbol.toStringTag` values.
*
* @private
* @param {*} value The value to query.
* @returns {string} Returns the raw `toStringTag`.
*/
function getRawTag(value) {
var isOwn = hasOwnProperty$1.call(value, symToStringTag$1),
tag = value[symToStringTag$1];
try {
value[symToStringTag$1] = undefined;
var unmasked = true;
} catch (e) {}
var result = nativeObjectToString.call(value);
if (unmasked) {
if (isOwn) {
value[symToStringTag$1] = tag;
} else {
delete value[symToStringTag$1];
}
}
return result;
}
/** Used for built-in method references. */
var objectProto$2 = Object.prototype;
/**
* Used to resolve the
* [`toStringTag`](http://ecma-international.org/ecma-262/7.0/#sec-object.prototype.tostring)
* of values.
*/
var nativeObjectToString$1 = objectProto$2.toString;
/**
* Converts `value` to a string using `Object.prototype.toString`.
*
* @private
* @param {*} value The value to convert.
* @returns {string} Returns the converted string.
*/
function objectToString(value) {
return nativeObjectToString$1.call(value);
}
/** `Object#toString` result references. */
var nullTag = '[object Null]';
var undefinedTag = '[object Undefined]';
/** Built-in value references. */
var symToStringTag = _Symbol ? _Symbol.toStringTag : undefined;
/**
* The base implementation of `getTag` without fallbacks for buggy environments.
*
* @private
* @param {*} value The value to query.
* @returns {string} Returns the `toStringTag`.
*/
function baseGetTag(value) {
if (value == null) {
return value === undefined ? undefinedTag : nullTag;
}
return symToStringTag && symToStringTag in Object(value) ? getRawTag(value) : objectToString(value);
}
/**
* Creates a unary function that invokes `func` with its argument transformed.
*
* @private
* @param {Function} func The function to wrap.
* @param {Function} transform The argument transform.
* @returns {Function} Returns the new function.
*/
function overArg(func, transform) {
return function (arg) {
return func(transform(arg));
};
}
/** Built-in value references. */
var getPrototype = overArg(Object.getPrototypeOf, Object);
/**
* 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 != null && (typeof value === 'undefined' ? 'undefined' : _typeof(value)) == 'object';
}
/** `Object#toString` result references. */
var objectTag = '[object Object]';
/** Used for built-in method references. */
var funcProto = Function.prototype;
var objectProto = Object.prototype;
/** Used to resolve the decompiled source of functions. */
var funcToString = funcProto.toString;
/** Used to check objects for own properties. */
var hasOwnProperty = objectProto.hasOwnProperty;
/** Used to infer the `Object` constructor. */
var objectCtorString = funcToString.call(Object);
/**
* 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) || baseGetTag(value) != objectTag) {
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;
}
function verifyPlainObject(value, displayName, methodName) {
if (!isPlainObject(value)) {
warning(methodName + '() in ' + displayName + ' must return a plain object. Instead received ' + value + '.');
}
}
function wrapMapToPropsConstant(getConstant) {
return function initConstantSelector(dispatch, options) {
var constant = getConstant(dispatch, options);
function constantSelector() {

@@ -890,37 +524,12 @@ return constant;

}
// 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);
};
// allow detectFactoryAndVerify to get ownProps
proxy.dependsOnOwnProps = true;
proxy.mapToProps = function detectFactoryAndVerify(stateOrDispatch, ownProps) {

@@ -930,3 +539,2 @@ proxy.mapToProps = mapToProps;

var props = proxy(stateOrDispatch, ownProps);
if (typeof props === 'function') {

@@ -937,8 +545,4 @@ proxy.mapToProps = props;

}
verifyPlainObject(props, displayName, methodName);
return props;
};
return proxy;

@@ -951,15 +555,14 @@ };

}
function whenMapDispatchToPropsIsMissing(mapDispatchToProps) {
return !mapDispatchToProps ? wrapMapToPropsConstant(function (dispatch) {
return { dispatch: dispatch };
return {
dispatch: dispatch
};
}) : undefined;
}
function whenMapDispatchToPropsIsObject(mapDispatchToProps) {
return mapDispatchToProps && (typeof mapDispatchToProps === 'undefined' ? 'undefined' : _typeof(mapDispatchToProps)) === 'object' ? wrapMapToPropsConstant(function (dispatch) {
return mapDispatchToProps && typeof mapDispatchToProps === 'object' ? wrapMapToPropsConstant(function (dispatch) {
return bindActionCreators(mapDispatchToProps, dispatch);
}) : undefined;
}
var defaultMapDispatchToPropsFactories = [whenMapDispatchToPropsIsFunction, whenMapDispatchToPropsIsMissing, whenMapDispatchToPropsIsObject];

@@ -970,3 +573,2 @@

}
function whenMapStateToPropsIsMissing(mapStateToProps) {

@@ -977,3 +579,2 @@ return !mapStateToProps ? wrapMapToPropsConstant(function () {

}
var defaultMapStateToPropsFactories = [whenMapStateToPropsIsFunction, whenMapStateToPropsIsMissing];

@@ -984,3 +585,2 @@

}
function wrapMergePropsFunc(mergeProps) {

@@ -991,9 +591,6 @@ return function initMergePropsProxy(dispatch, _ref) {

areMergedPropsEqual = _ref.areMergedPropsEqual;
var hasRunOnce = false;
var mergedProps = void 0;
var mergedProps;
return function mergePropsProxy(stateProps, dispatchProps, ownProps) {
var nextMergedProps = mergeProps(stateProps, dispatchProps, ownProps);
if (hasRunOnce) {

@@ -1004,6 +601,3 @@ if (!pure || !areMergedPropsEqual(nextMergedProps, mergedProps)) mergedProps = nextMergedProps;

mergedProps = nextMergedProps;
verifyPlainObject(mergedProps, displayName, 'mergeProps');
}
return mergedProps;

@@ -1013,7 +607,5 @@ };

}
function whenMergePropsIsFunction(mergeProps) {
return typeof mergeProps === 'function' ? wrapMergePropsFunc(mergeProps) : undefined;
}
function whenMergePropsIsOmitted(mergeProps) {

@@ -1024,21 +616,4 @@ return !mergeProps ? function () {

}
var defaultMergePropsFactories = [whenMergePropsIsFunction, whenMergePropsIsOmitted];
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')) {
warning('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);
}
function impureFinalPropsSelectorFactory(mapStateToProps, mapDispatchToProps, mergeProps, dispatch) {

@@ -1049,3 +624,2 @@ return function impureFinalPropsSelector(state, ownProps) {

}
function pureFinalPropsSelectorFactory(mapStateToProps, mapDispatchToProps, mergeProps, dispatch, _ref) {

@@ -1055,10 +629,8 @@ var areStatesEqual = _ref.areStatesEqual,

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;
var state;
var ownProps;
var stateProps;
var dispatchProps;
var mergedProps;
function handleFirstCall(firstState, firstOwnProps) {

@@ -1073,21 +645,14 @@ state = firstState;

}
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() {

@@ -1097,8 +662,5 @@ var nextStateProps = mapStateToProps(state, ownProps);

stateProps = nextStateProps;
if (statePropsChanged) mergedProps = mergeProps(stateProps, dispatchProps, ownProps);
return mergedProps;
}
function handleSubsequentCalls(nextState, nextOwnProps) {

@@ -1109,3 +671,2 @@ var propsChanged = !areOwnPropsEqual(nextOwnProps, ownProps);

ownProps = nextOwnProps;
if (propsChanged && stateChanged) return handleNewPropsAndNewState();

@@ -1116,3 +677,2 @@ if (propsChanged) return handleNewProps();

}
return function pureFinalPropsSelector(nextState, nextOwnProps) {

@@ -1122,10 +682,2 @@ 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) {

@@ -1135,34 +687,10 @@ var initMapStateToProps = _ref2.initMapStateToProps,

initMergeProps = _ref2.initMergeProps,
options = objectWithoutProperties(_ref2, ['initMapStateToProps', 'initMapDispatchToProps', 'initMergeProps']);
options = _objectWithoutPropertiesLoose(_ref2, ["initMapStateToProps", "initMapDispatchToProps", "initMergeProps"]);
var mapStateToProps = initMapStateToProps(dispatch, options);
var mapDispatchToProps = initMapDispatchToProps(dispatch, options);
var mergeProps = initMergeProps(dispatch, options);
{
verifySubselectors(mapStateToProps, mapDispatchToProps, mergeProps, options.displayName);
}
var selectorFactory = options.pure ? pureFinalPropsSelectorFactory : impureFinalPropsSelectorFactory;
return selectorFactory(mapStateToProps, mapDispatchToProps, mergeProps, dispatch, options);
}
/*
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) {

@@ -1173,59 +701,43 @@ for (var i = factories.length - 1; i >= 0; i--) {

}
return function (dispatch, options) {
throw new Error('Invalid value of type ' + (typeof arg === 'undefined' ? 'undefined' : _typeof(arg)) + ' for ' + name + ' argument when connecting component ' + options.wrappedComponentName + '.');
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] : {},
function createConnect(_temp) {
var _ref = _temp === void 0 ? {} : _temp,
_ref$connectHOC = _ref.connectHOC,
connectHOC = _ref$connectHOC === undefined ? connectAdvanced : _ref$connectHOC,
connectHOC = _ref$connectHOC === void 0 ? connectAdvanced : _ref$connectHOC,
_ref$mapStateToPropsF = _ref.mapStateToPropsFactories,
mapStateToPropsFactories = _ref$mapStateToPropsF === undefined ? defaultMapStateToPropsFactories : _ref$mapStateToPropsF,
mapStateToPropsFactories = _ref$mapStateToPropsF === void 0 ? defaultMapStateToPropsFactories : _ref$mapStateToPropsF,
_ref$mapDispatchToPro = _ref.mapDispatchToPropsFactories,
mapDispatchToPropsFactories = _ref$mapDispatchToPro === undefined ? defaultMapDispatchToPropsFactories : _ref$mapDispatchToPro,
mapDispatchToPropsFactories = _ref$mapDispatchToPro === void 0 ? defaultMapDispatchToPropsFactories : _ref$mapDispatchToPro,
_ref$mergePropsFactor = _ref.mergePropsFactories,
mergePropsFactories = _ref$mergePropsFactor === undefined ? defaultMergePropsFactories : _ref$mergePropsFactor,
mergePropsFactories = _ref$mergePropsFactor === void 0 ? defaultMergePropsFactories : _ref$mergePropsFactor,
_ref$selectorFactory = _ref.selectorFactory,
selectorFactory = _ref$selectorFactory === undefined ? finalPropsSelectorFactory : _ref$selectorFactory;
return function connect(mapStateToProps, mapDispatchToProps, mergeProps) {
var _ref2 = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : {};
var _ref2$pure = _ref2.pure,
pure = _ref2$pure === undefined ? true : _ref2$pure,
selectorFactory = _ref$selectorFactory === void 0 ? finalPropsSelectorFactory : _ref$selectorFactory;
return function connect(mapStateToProps, mapDispatchToProps, mergeProps, _temp2) {
var _ref2 = _temp2 === void 0 ? {} : _temp2,
_ref2$pure = _ref2.pure,
pure = _ref2$pure === void 0 ? true : _ref2$pure,
_ref2$areStatesEqual = _ref2.areStatesEqual,
areStatesEqual = _ref2$areStatesEqual === undefined ? strictEqual : _ref2$areStatesEqual,
areStatesEqual = _ref2$areStatesEqual === void 0 ? strictEqual : _ref2$areStatesEqual,
_ref2$areOwnPropsEqua = _ref2.areOwnPropsEqual,
areOwnPropsEqual = _ref2$areOwnPropsEqua === undefined ? shallowEqual : _ref2$areOwnPropsEqua,
areOwnPropsEqual = _ref2$areOwnPropsEqua === void 0 ? shallowEqual : _ref2$areOwnPropsEqua,
_ref2$areStatePropsEq = _ref2.areStatePropsEqual,
areStatePropsEqual = _ref2$areStatePropsEq === undefined ? shallowEqual : _ref2$areStatePropsEq,
areStatePropsEqual = _ref2$areStatePropsEq === void 0 ? shallowEqual : _ref2$areStatePropsEq,
_ref2$areMergedPropsE = _ref2.areMergedPropsEqual,
areMergedPropsEqual = _ref2$areMergedPropsE === undefined ? shallowEqual : _ref2$areMergedPropsE,
extraOptions = objectWithoutProperties(_ref2, ['pure', 'areStatesEqual', 'areOwnPropsEqual', 'areStatePropsEqual', 'areMergedPropsEqual']);
areMergedPropsEqual = _ref2$areMergedPropsE === void 0 ? shallowEqual : _ref2$areMergedPropsE,
extraOptions = _objectWithoutPropertiesLoose(_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 + ')';
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,

@@ -1239,12 +751,16 @@ initMapDispatchToProps: initMapDispatchToProps,

areMergedPropsEqual: areMergedPropsEqual
}, extraOptions));
};
}
var connect = createConnect();
var index = { Provider: Provider, connect: connect, connectAdvanced: connectAdvanced };
var index = {
Provider: Provider,
connect: connect,
connectAdvanced: connectAdvanced,
ReactReduxContext: ReactReduxContext
};
export { Provider, connect, connectAdvanced };export default index;
export default index;
export { Provider, ReactReduxContext, connect, connectAdvanced };
//# sourceMappingURL=preact-redux.esm.js.map
(function (global, factory) {
typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory(require('preact'), require('redux')) :
typeof define === 'function' && define.amd ? define(['preact', 'redux'], factory) :
(global.preactRedux = factory(global.preact,global.Redux));
}(this, (function (preact,redux) {
typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory(require('preact'), require('preact-context'), require('redux')) :
typeof define === 'function' && define.amd ? define(['preact', 'preact-context', 'redux'], factory) :
(global = global || self, global.preactRedux = factory(global.preact, global.preactContext, global.Redux));
}(this, function (preact, preactContext, redux) { 'use strict';
var Children = {
only: function only(children) {
return children && children[0] || null;
}
};
function _extends() {
_extends = Object.assign || function (target) {
for (var i = 1; i < arguments.length; i++) {
var source = arguments[i];
function proptype() {}
proptype.isRequired = proptype;
for (var key in source) {
if (Object.prototype.hasOwnProperty.call(source, key)) {
target[key] = source[key];
}
}
}
var PropTypes = {
element: proptype,
func: proptype,
shape: function shape() {
return proptype;
},
instanceOf: function instanceOf() {
return proptype;
}
};
return target;
};
var subscriptionShape = PropTypes.shape({
trySubscribe: PropTypes.func.isRequired,
tryUnsubscribe: PropTypes.func.isRequired,
notifyNestedSubs: PropTypes.func.isRequired,
isSubscribed: PropTypes.func.isRequired
});
var storeShape = PropTypes.shape({
subscribe: PropTypes.func.isRequired,
dispatch: PropTypes.func.isRequired,
getState: PropTypes.func.isRequired
});
/**
* 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);
return _extends.apply(this, arguments);
}
/* 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 */
}
var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function (obj) {
return typeof obj;
} : function (obj) {
return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj;
};
var classCallCheck = function (instance, Constructor) {
if (!(instance instanceof Constructor)) {
throw new TypeError("Cannot call a class as a function");
function _inheritsLoose(subClass, superClass) {
subClass.prototype = Object.create(superClass.prototype);
subClass.prototype.constructor = subClass;
subClass.__proto__ = superClass;
}
};
function _objectWithoutPropertiesLoose(source, excluded) {
if (source == null) return {};
var target = {};
var sourceKeys = Object.keys(source);
var key, i;
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];
}
for (i = 0; i < sourceKeys.length; i++) {
key = sourceKeys[i];
if (excluded.indexOf(key) >= 0) continue;
target[key] = source[key];
}
}
return target;
};
var inherits = function (subClass, superClass) {
if (typeof superClass !== "function" && superClass !== null) {
throw new TypeError("Super expression must either be null or a function, not " + typeof superClass);
return target;
}
subClass.prototype = Object.create(superClass && superClass.prototype, {
constructor: {
value: subClass,
enumerable: false,
writable: true,
configurable: true
function _assertThisInitialized(self) {
if (self === void 0) {
throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
}
});
if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass;
};
var objectWithoutProperties = function (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 self;
}
return target;
};
function invariant () {}
var possibleConstructorReturn = function (self, call) {
if (!self) {
throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
}
var React = {
createContext: preactContext.createContext,
forwardRef: invariant,
createElement: preact.h
};
return call && (typeof call === "object" || typeof call === "function") ? call : self;
};
var ReactReduxContext = React.createContext(null);
var didWarnAboutReceivingStore = false;
function warnAboutReceivingStore() {
if (didWarnAboutReceivingStore) {
return;
}
didWarnAboutReceivingStore = true;
warning('<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.');
}
function createProvider() {
var _Provider$childContex;
var storeKey = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 'store';
var subKey = arguments[1];
var subscriptionKey = subKey || storeKey + 'Subscription';
var Provider = function (_Component) {
inherits(Provider, _Component);
Provider.prototype.getChildContext = function getChildContext() {
var _ref;
return _ref = {}, _ref[storeKey] = this[storeKey], _ref[subscriptionKey] = null, _ref;
};
function Provider(props, context) {
classCallCheck(this, Provider);
var _this = possibleConstructorReturn(this, _Component.call(this, props, context));
_this[storeKey] = props.store;
var Provider =
function (_Component) {
_inheritsLoose(Provider, _Component);
function Provider(props) {
var _this;
_this = _Component.call(this, props) || this;
var store = props.store;
_this.state = {
storeState: store.getState(),
store: store
};
return _this;
}
Provider.prototype.render = function render() {
return Children.only(this.props.children);
var _proto = Provider.prototype;
_proto.componentDidMount = function componentDidMount() {
this._isMounted = true;
this.subscribe();
};
_proto.componentWillUnmount = function componentWillUnmount() {
if (this.unsubscribe) this.unsubscribe();
this._isMounted = false;
};
_proto.componentDidUpdate = function componentDidUpdate(prevProps) {
if (this.props.store !== prevProps.store) {
if (this.unsubscribe) this.unsubscribe();
this.subscribe();
}
};
_proto.subscribe = function subscribe() {
var _this2 = this;
var store = this.props.store;
this.unsubscribe = store.subscribe(function () {
var newStoreState = store.getState();
if (!_this2._isMounted) {
return;
}
_this2.setState(function (providerState) {
if (providerState.storeState === newStoreState) {
return null;
}
return {
storeState: newStoreState
};
});
});
var postMountStoreState = store.getState();
if (postMountStoreState !== this.state.storeState) {
this.setState({
storeState: postMountStoreState
});
}
};
_proto.render = function render() {
var Context = this.props.context || ReactReduxContext;
return React.createElement(Context.Provider, {
value: this.state
}, this.props.children);
};
return Provider;
}(preact.Component);
{
Provider.prototype.componentWillReceiveProps = function (nextProps) {
if (this[storeKey] !== nextProps.store) {
warnAboutReceivingStore();
}
};
function unwrapExports (x) {
return x && x.__esModule && Object.prototype.hasOwnProperty.call(x, 'default') ? x['default'] : x;
}
Provider.childContextTypes = (_Provider$childContex = {}, _Provider$childContex[storeKey] = storeShape.isRequired, _Provider$childContex[subscriptionKey] = subscriptionShape, _Provider$childContex);
function createCommonjsModule(fn, module) {
return module = { exports: {} }, fn(module, module.exports), module.exports;
}
return Provider;
}
var reactIs_production_min = createCommonjsModule(function (module, exports) {
Object.defineProperty(exports, "__esModule", {
value: !0
});
var c = 60103,
d = 60106,
e = 60107,
f = 60108,
g = 60114,
h = 60109,
k = 60110,
l = 60111,
m = 60111,
n = 60112,
p = 60113,
q = 60115,
r = 60116;
function t(a) {
if ("object" === typeof a && null !== a) {
var u = a.$$typeof;
switch (u) {
case c:
switch (a = a.type, a) {
case l:
case m:
case e:
case g:
case f:
case p:
return a;
default:
switch (a = a && a.$$typeof, a) {
case k:
case n:
case h:
return a;
default:
return u;
}
}
case r:
case q:
case d:
return u;
}
}
}
function v(a) {
return t(a) === m;
}
exports.typeOf = t;
exports.AsyncMode = l;
exports.ConcurrentMode = m;
exports.ContextConsumer = k;
exports.ContextProvider = h;
exports.Element = c;
exports.ForwardRef = n;
exports.Fragment = e;
exports.Lazy = r;
exports.Memo = q;
exports.Portal = d;
exports.Profiler = g;
exports.StrictMode = f;
exports.Suspense = p;
exports.isValidElementType = function (a) {
return "string" === typeof a || "function" === typeof a || a === e || a === m || a === g || a === f || a === p || "object" === typeof a && null !== a && (a.$$typeof === r || a.$$typeof === q || a.$$typeof === h || a.$$typeof === k || a.$$typeof === n);
};
exports.isAsyncMode = function (a) {
return v(a) || t(a) === l;
};
exports.isConcurrentMode = v;
exports.isContextConsumer = function (a) {
return t(a) === k;
};
exports.isContextProvider = function (a) {
return t(a) === h;
};
exports.isElement = function (a) {
return "object" === typeof a && null !== a && a.$$typeof === c;
};
exports.isForwardRef = function (a) {
return t(a) === n;
};
exports.isFragment = function (a) {
return t(a) === e;
};
exports.isLazy = function (a) {
return t(a) === r;
};
exports.isMemo = function (a) {
return t(a) === q;
};
exports.isPortal = function (a) {
return t(a) === d;
};
exports.isProfiler = function (a) {
return t(a) === g;
};
exports.isStrictMode = function (a) {
return t(a) === f;
};
exports.isSuspense = function (a) {
return t(a) === p;
};
});
unwrapExports(reactIs_production_min);
var reactIs_production_min_1 = reactIs_production_min.typeOf;
var reactIs_production_min_2 = reactIs_production_min.AsyncMode;
var reactIs_production_min_3 = reactIs_production_min.ConcurrentMode;
var reactIs_production_min_4 = reactIs_production_min.ContextConsumer;
var reactIs_production_min_5 = reactIs_production_min.ContextProvider;
var reactIs_production_min_6 = reactIs_production_min.Element;
var reactIs_production_min_7 = reactIs_production_min.ForwardRef;
var reactIs_production_min_8 = reactIs_production_min.Fragment;
var reactIs_production_min_9 = reactIs_production_min.Lazy;
var reactIs_production_min_10 = reactIs_production_min.Memo;
var reactIs_production_min_11 = reactIs_production_min.Portal;
var reactIs_production_min_12 = reactIs_production_min.Profiler;
var reactIs_production_min_13 = reactIs_production_min.StrictMode;
var reactIs_production_min_14 = reactIs_production_min.Suspense;
var reactIs_production_min_15 = reactIs_production_min.isValidElementType;
var reactIs_production_min_16 = reactIs_production_min.isAsyncMode;
var reactIs_production_min_17 = reactIs_production_min.isConcurrentMode;
var reactIs_production_min_18 = reactIs_production_min.isContextConsumer;
var reactIs_production_min_19 = reactIs_production_min.isContextProvider;
var reactIs_production_min_20 = reactIs_production_min.isElement;
var reactIs_production_min_21 = reactIs_production_min.isForwardRef;
var reactIs_production_min_22 = reactIs_production_min.isFragment;
var reactIs_production_min_23 = reactIs_production_min.isLazy;
var reactIs_production_min_24 = reactIs_production_min.isMemo;
var reactIs_production_min_25 = reactIs_production_min.isPortal;
var reactIs_production_min_26 = reactIs_production_min.isProfiler;
var reactIs_production_min_27 = reactIs_production_min.isStrictMode;
var reactIs_production_min_28 = reactIs_production_min.isSuspense;
var Provider = createProvider();
var reactIs = createCommonjsModule(function (module) {
{
module.exports = reactIs_production_min;
}
});
var reactIs_1 = reactIs.isValidElementType;
var reactIs_2 = reactIs.isContextConsumer;
/**
* Copyright 2015, Yahoo! Inc.
* Copyrights licensed under the New BSD License. See the accompanying LICENSE file for terms.
*/
var REACT_STATICS = {
var REACT_STATICS = {
childContextTypes: true,
contextType: true,
contextTypes: true,

@@ -220,8 +283,9 @@ defaultProps: true,

getDefaultProps: true,
getDerivedStateFromError: true,
getDerivedStateFromProps: true,
mixins: true,
propTypes: true,
type: true
};
var KNOWN_STATICS = {
};
var KNOWN_STATICS = {
name: true,

@@ -234,997 +298,447 @@ length: true,

arity: true
};
var defineProperty$1 = Object.defineProperty;
var getOwnPropertyNames = Object.getOwnPropertyNames;
var getOwnPropertySymbols = Object.getOwnPropertySymbols;
var getOwnPropertyDescriptor = Object.getOwnPropertyDescriptor;
var getPrototypeOf = Object.getPrototypeOf;
var objectPrototype = getPrototypeOf && getPrototypeOf(Object);
var hoistNonReactStatics = function hoistNonReactStatics(targetComponent, sourceComponent, blacklist) {
};
var FORWARD_REF_STATICS = {
'$$typeof': true,
render: true,
defaultProps: true,
displayName: true,
propTypes: true
};
var MEMO_STATICS = {
'$$typeof': true,
compare: true,
defaultProps: true,
displayName: true,
propTypes: true,
type: true
};
var TYPE_STATICS = {};
TYPE_STATICS[reactIs.ForwardRef] = FORWARD_REF_STATICS;
function getStatics(component) {
if (reactIs.isMemo(component)) {
return MEMO_STATICS;
}
return TYPE_STATICS[component['$$typeof']] || REACT_STATICS;
}
var defineProperty = Object.defineProperty;
var getOwnPropertyNames = Object.getOwnPropertyNames;
var getOwnPropertySymbols = Object.getOwnPropertySymbols;
var getOwnPropertyDescriptor = Object.getOwnPropertyDescriptor;
var getPrototypeOf = Object.getPrototypeOf;
var objectPrototype = Object.prototype;
function hoistNonReactStatics(targetComponent, sourceComponent, blacklist) {
if (typeof sourceComponent !== 'string') {
// don't hoist over string (html) components
if (objectPrototype) {
var inheritedComponent = getPrototypeOf(sourceComponent);
if (inheritedComponent && inheritedComponent !== objectPrototype) {
hoistNonReactStatics(targetComponent, inheritedComponent, blacklist);
}
if (objectPrototype) {
var inheritedComponent = getPrototypeOf(sourceComponent);
if (inheritedComponent && inheritedComponent !== objectPrototype) {
hoistNonReactStatics(targetComponent, inheritedComponent, blacklist);
}
var keys = getOwnPropertyNames(sourceComponent);
if (getOwnPropertySymbols) {
keys = keys.concat(getOwnPropertySymbols(sourceComponent));
}
var keys = getOwnPropertyNames(sourceComponent);
if (getOwnPropertySymbols) {
keys = keys.concat(getOwnPropertySymbols(sourceComponent));
}
var targetStatics = getStatics(targetComponent);
var sourceStatics = getStatics(sourceComponent);
for (var i = 0; i < keys.length; ++i) {
var key = keys[i];
if (!KNOWN_STATICS[key] && !(blacklist && blacklist[key]) && !(sourceStatics && sourceStatics[key]) && !(targetStatics && targetStatics[key])) {
var descriptor = getOwnPropertyDescriptor(sourceComponent, key);
try {
defineProperty(targetComponent, key, descriptor);
} catch (e) {}
}
for (var i = 0; i < keys.length; ++i) {
var key = keys[i];
if (!REACT_STATICS[key] && !KNOWN_STATICS[key] && (!blacklist || !blacklist[key])) {
var descriptor = getOwnPropertyDescriptor(sourceComponent, key);
try {
// Avoid failures from read-only properties
defineProperty$1(targetComponent, key, descriptor);
} catch (e) {}
}
}
return targetComponent;
}
return targetComponent;
}
return targetComponent;
};
}
var hoistNonReactStatics_cjs = hoistNonReactStatics;
var invariant = 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]();
function connectAdvanced(
selectorFactory,
_temp) {
var _ref = _temp === void 0 ? {} : _temp,
_ref$getDisplayName = _ref.getDisplayName,
getDisplayName = _ref$getDisplayName === void 0 ? function (name) {
return "ConnectAdvanced(" + name + ")";
} : _ref$getDisplayName,
_ref$methodName = _ref.methodName,
methodName = _ref$methodName === void 0 ? 'connectAdvanced' : _ref$methodName,
_ref$renderCountProp = _ref.renderCountProp,
renderCountProp = _ref$renderCountProp === void 0 ? undefined : _ref$renderCountProp,
_ref$shouldHandleStat = _ref.shouldHandleStateChanges,
shouldHandleStateChanges = _ref$shouldHandleStat === void 0 ? true : _ref$shouldHandleStat,
_ref$storeKey = _ref.storeKey,
storeKey = _ref$storeKey === void 0 ? 'store' : _ref$storeKey,
_ref$withRef = _ref.withRef,
_ref$forwardRef = _ref.forwardRef,
forwardRef = _ref$forwardRef === void 0 ? false : _ref$forwardRef,
_ref$context = _ref.context,
context = _ref$context === void 0 ? ReactReduxContext : _ref$context,
connectOptions = _objectWithoutPropertiesLoose(_ref, ["getDisplayName", "methodName", "renderCountProp", "shouldHandleStateChanges", "storeKey", "withRef", "forwardRef", "context"]);
var customStoreWarningMessage = 'To use a custom Redux store for specific components, create a custom React context with ' + "React.createContext(), and pass the context object to React Redux's Provider and specific components" + ' like: <Provider context={MyContext}><ConnectedComponent context={MyContext} /></Provider>. ' + 'You may also pass a {context : MyContext} option to connect';
var Context = context;
return function wrapWithConnect(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,
displayName: displayName,
wrappedComponentName: wrappedComponentName,
WrappedComponent: WrappedComponent
});
var pure = connectOptions.pure;
var OuterBaseComponent = preact.Component;
if (pure) {
OuterBaseComponent = preact.Component;
}
},
get: function get$$1() {
return next;
},
subscribe: function subscribe(listener) {
var isSubscribed = true;
if (next === current) next = current.slice();
next.push(listener);
function makeDerivedPropsSelector() {
var lastProps;
var lastState;
var lastDerivedProps;
var lastStore;
var lastSelectorFactoryOptions;
var sourceSelector;
return function selectDerivedProps(state, props, store, selectorFactoryOptions) {
if (pure && lastProps === props && lastState === state) {
return lastDerivedProps;
}
if (store !== lastStore || lastSelectorFactoryOptions !== selectorFactoryOptions) {
lastStore = store;
lastSelectorFactoryOptions = selectorFactoryOptions;
sourceSelector = selectorFactory(store.dispatch, selectorFactoryOptions);
}
lastProps = props;
lastState = state;
var nextProps = sourceSelector(state, props);
lastDerivedProps = nextProps;
return lastDerivedProps;
};
}
function makeChildElementSelector() {
var lastChildProps, lastForwardRef, lastChildElement, lastComponent;
return function selectChildElement(WrappedComponent, childProps, forwardRef) {
if (childProps !== lastChildProps || forwardRef !== lastForwardRef || lastComponent !== WrappedComponent) {
lastChildProps = childProps;
lastForwardRef = forwardRef;
lastComponent = WrappedComponent;
lastChildElement = React.createElement(WrappedComponent, _extends({}, childProps, {
ref: forwardRef
}));
}
return lastChildElement;
};
}
var Connect =
function (_OuterBaseComponent) {
_inheritsLoose(Connect, _OuterBaseComponent);
function Connect(props) {
var _this;
_this = _OuterBaseComponent.call(this, props) || this;
invariant(forwardRef ? !props.wrapperProps[storeKey] : !props[storeKey], 'Passing redux store in props has been removed and does not do anything. ' + customStoreWarningMessage);
_this.selectDerivedProps = makeDerivedPropsSelector();
_this.selectChildElement = makeChildElementSelector();
_this.indirectRenderWrappedComponent = _this.indirectRenderWrappedComponent.bind(_assertThisInitialized(_this));
return _this;
}
var _proto = Connect.prototype;
_proto.indirectRenderWrappedComponent = function indirectRenderWrappedComponent(value) {
return this.renderWrappedComponent(value);
};
_proto.renderWrappedComponent = function renderWrappedComponent(value) {
var storeState = value.storeState,
store = value.store;
var wrapperProps = this.props;
var forwardedRef;
if (forwardRef) {
wrapperProps = this.props.wrapperProps;
forwardedRef = this.props.forwardedRef;
}
var derivedProps = this.selectDerivedProps(storeState, wrapperProps, store, selectorFactoryOptions);
return this.selectChildElement(WrappedComponent, derivedProps, forwardedRef);
};
_proto.render = function render() {
var ContextToUse = this.props.context && this.props.context.Consumer && reactIs_2(React.createElement(this.props.context.Consumer, null)) ? this.props.context : Context;
return React.createElement(ContextToUse.Consumer, null, this.indirectRenderWrappedComponent);
};
return Connect;
}(OuterBaseComponent);
Connect.WrappedComponent = WrappedComponent;
Connect.displayName = displayName;
if (forwardRef) {
var forwarded = React.forwardRef(function forwardConnectRef(props, ref) {
return React.createElement(Connect, {
wrapperProps: props,
forwardedRef: ref
});
});
forwarded.displayName = displayName;
forwarded.WrappedComponent = WrappedComponent;
return hoistNonReactStatics_cjs(forwarded, WrappedComponent);
}
return hoistNonReactStatics_cjs(Connect, WrappedComponent);
};
}
return function unsubscribe() {
if (!isSubscribed || current === CLEARED) return;
isSubscribed = false;
if (next === current) next = current.slice();
next.splice(next.indexOf(listener), 1);
};
var hasOwn = Object.prototype.hasOwnProperty;
function is(x, y) {
if (x === y) {
return x !== 0 || y !== 0 || 1 / x === 1 / y;
} else {
return x !== x && y !== y;
}
};
}
var Subscription = function () {
function Subscription(store, parentSub, onStateChange) {
classCallCheck(this, Subscription);
this.store = store;
this.parentSub = parentSub;
this.onStateChange = onStateChange;
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.unsubscribe = this.parentSub ? this.parentSub.addNestedSub(this.onStateChange) : this.store.subscribe(this.onStateChange);
this.listeners = createListenerCollection();
function shallowEqual(objA, objB) {
if (is(objA, objB)) return true;
if (typeof objA !== 'object' || objA === null || typeof objB !== 'object' || objB === null) {
return false;
}
};
Subscription.prototype.tryUnsubscribe = function tryUnsubscribe() {
if (this.unsubscribe) {
this.unsubscribe();
this.unsubscribe = null;
this.listeners.clear();
this.listeners = nullListeners;
}
};
return Subscription;
}();
var hotReloadingVersion = 0;
var dummyState = {};
function noop() {}
function makeSelectorStateful(sourceSelector, store) {
// wrap the selector in an object that tracks its results between runs.
var selector = {
run: function runComponentSelector(props) {
try {
var nextProps = sourceSelector(store.getState(), props);
if (nextProps !== selector.props || selector.error) {
selector.shouldComponentUpdate = true;
selector.props = nextProps;
selector.error = null;
}
} catch (error) {
selector.shouldComponentUpdate = true;
selector.error = error;
var keysA = Object.keys(objA);
var keysB = Object.keys(objB);
if (keysA.length !== keysB.length) return false;
for (var i = 0; i < keysA.length; i++) {
if (!hasOwn.call(objB, keysA[i]) || !is(objA[keysA[i]], objB[keysA[i]])) {
return false;
}
}
};
return true;
}
return selector;
}
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,
getDisplayName = _ref$getDisplayName === undefined ? function (name) {
return 'ConnectAdvanced(' + name + ')';
} : _ref$getDisplayName,
_ref$methodName = _ref.methodName,
methodName = _ref$methodName === undefined ? 'connectAdvanced' : _ref$methodName,
_ref$renderCountProp = _ref.renderCountProp,
renderCountProp = _ref$renderCountProp === undefined ? undefined : _ref$renderCountProp,
_ref$shouldHandleStat = _ref.shouldHandleStateChanges,
shouldHandleStateChanges = _ref$shouldHandleStat === undefined ? true : _ref$shouldHandleStat,
_ref$storeKey = _ref.storeKey,
storeKey = _ref$storeKey === undefined ? 'store' : _ref$storeKey,
_ref$withRef = _ref.withRef,
withRef = _ref$withRef === undefined ? false : _ref$withRef,
connectOptions = objectWithoutProperties(_ref, ['getDisplayName', 'methodName', 'renderCountProp', 'shouldHandleStateChanges', 'storeKey', 'withRef']);
var subscriptionKey = storeKey + 'Subscription';
var version = hotReloadingVersion++;
var contextTypes = (_contextTypes = {}, _contextTypes[storeKey] = storeShape, _contextTypes[subscriptionKey] = subscriptionShape, _contextTypes);
var childContextTypes = (_childContextTypes = {}, _childContextTypes[subscriptionKey] = subscriptionShape, _childContextTypes);
return function wrapWithConnect(WrappedComponent) {
invariant(typeof WrappedComponent == 'function', 'You must pass a component to the function returned by ' + ('connect. Instead received ' + JSON.stringify(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 = props[storeKey] || context[storeKey];
_this.propsMode = Boolean(props[storeKey]);
_this.setWrappedInstance = _this.setWrappedInstance.bind(_this);
invariant(_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 + '".'));
_this.initSelector();
_this.initSubscription();
return _this;
function wrapMapToPropsConstant(getConstant) {
return function initConstantSelector(dispatch, options) {
var constant = getConstant(dispatch, options);
function constantSelector() {
return constant;
}
Connect.prototype.getChildContext = function getChildContext() {
var _ref2;
// If this component received store from props, its subscription should be transparent
// to any descendants receiving store+subscription from context; it passes along
// subscription passed to it. Otherwise, it shadows the parent subscription, which allows
// Connect to control ordering of notifications to flow top-down.
var subscription = this.propsMode ? null : this.subscription;
return _ref2 = {}, _ref2[subscriptionKey] = subscription || this.context[subscriptionKey], _ref2;
constantSelector.dependsOnOwnProps = false;
return constantSelector;
};
}
function getDependsOnOwnProps(mapToProps) {
return mapToProps.dependsOnOwnProps !== null && mapToProps.dependsOnOwnProps !== undefined ? Boolean(mapToProps.dependsOnOwnProps) : mapToProps.length !== 1;
}
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);
};
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();
this.subscription = null;
this.notifyNestedSubs = noop;
this.store = null;
this.selector.run = noop;
this.selector.shouldComponentUpdate = false;
};
Connect.prototype.getWrappedInstance = function getWrappedInstance() {
invariant(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 sourceSelector = selectorFactory(this.store.dispatch, selectorFactoryOptions);
this.selector = makeSelectorStateful(sourceSelector, this.store);
this.selector.run(this.props);
};
Connect.prototype.initSubscription = function initSubscription() {
if (!shouldHandleStateChanges) return;
// parentSub's source should match where store came from: props vs. context. A component
// connected to the store via props shouldn't use subscription from context, or vice versa.
var parentSub = (this.propsMode ? this.props : this.context)[subscriptionKey];
this.subscription = new Subscription(this.store, parentSub, this.onStateChange.bind(this));
// `notifyNestedSubs` is duplicated to handle the case where the component is unmounted in
// the middle of the notification loop, where `this.subscription` will then be null. An
// extra null check every change can be avoided by copying the method onto `this` and then
// replacing it with a no-op on unmount. This can probably be avoided if Subscription's
// listeners logic is changed to not call listeners that have been unsubscribed in the
// middle of the notification loop.
this.notifyNestedSubs = this.subscription.notifyNestedSubs.bind(this.subscription);
};
Connect.prototype.onStateChange = function onStateChange() {
this.selector.run(this.props);
if (!this.selector.shouldComponentUpdate) {
this.notifyNestedSubs();
} else {
this.componentDidUpdate = this.notifyNestedSubsOnComponentDidUpdate;
this.setState(dummyState);
proxy.dependsOnOwnProps = true;
proxy.mapToProps = function detectFactoryAndVerify(stateOrDispatch, ownProps) {
proxy.mapToProps = mapToProps;
proxy.dependsOnOwnProps = getDependsOnOwnProps(mapToProps);
var props = proxy(stateOrDispatch, ownProps);
if (typeof props === 'function') {
proxy.mapToProps = props;
proxy.dependsOnOwnProps = getDependsOnOwnProps(props);
props = proxy(stateOrDispatch, ownProps);
}
return props;
};
return proxy;
};
}
Connect.prototype.notifyNestedSubsOnComponentDidUpdate = function notifyNestedSubsOnComponentDidUpdate() {
// `componentDidUpdate` is conditionally implemented when `onStateChange` determines it
// needs to notify nested subs. Once called, it unimplements itself until further state
// changes occur. Doing it this way vs having a permanent `componentDidUpdate` that does
// a boolean check every time avoids an extra method call most of the time, resulting
// in some perf boost.
this.componentDidUpdate = undefined;
this.notifyNestedSubs();
function whenMapDispatchToPropsIsFunction(mapDispatchToProps) {
return typeof mapDispatchToProps === 'function' ? wrapMapToPropsFunc(mapDispatchToProps, 'mapDispatchToProps') : undefined;
}
function whenMapDispatchToPropsIsMissing(mapDispatchToProps) {
return !mapDispatchToProps ? wrapMapToPropsConstant(function (dispatch) {
return {
dispatch: dispatch
};
}) : undefined;
}
function whenMapDispatchToPropsIsObject(mapDispatchToProps) {
return mapDispatchToProps && typeof mapDispatchToProps === 'object' ? wrapMapToPropsConstant(function (dispatch) {
return redux.bindActionCreators(mapDispatchToProps, dispatch);
}) : undefined;
}
var defaultMapDispatchToPropsFactories = [whenMapDispatchToPropsIsFunction, whenMapDispatchToPropsIsMissing, whenMapDispatchToPropsIsObject];
Connect.prototype.isSubscribed = function isSubscribed() {
return Boolean(this.subscription) && this.subscription.isSubscribed();
};
function whenMapStateToPropsIsFunction(mapStateToProps) {
return typeof mapStateToProps === 'function' ? wrapMapToPropsFunc(mapStateToProps, 'mapStateToProps') : undefined;
}
function whenMapStateToPropsIsMissing(mapStateToProps) {
return !mapStateToProps ? wrapMapToPropsConstant(function () {
return {};
}) : undefined;
}
var defaultMapStateToPropsFactories = [whenMapStateToPropsIsFunction, whenMapStateToPropsIsMissing];
Connect.prototype.addExtraProps = function addExtraProps(props) {
if (!withRef && !renderCountProp && !(this.propsMode && this.subscription)) 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++;
if (this.propsMode && this.subscription) withExtras[subscriptionKey] = this.subscription;
return withExtras;
};
Connect.prototype.render = function render() {
var selector = this.selector;
selector.shouldComponentUpdate = false;
if (selector.error) {
throw selector.error;
function defaultMergeProps(stateProps, dispatchProps, ownProps) {
return _extends({}, ownProps, stateProps, dispatchProps);
}
function wrapMergePropsFunc(mergeProps) {
return function initMergePropsProxy(dispatch, _ref) {
var displayName = _ref.displayName,
pure = _ref.pure,
areMergedPropsEqual = _ref.areMergedPropsEqual;
var hasRunOnce = false;
var mergedProps;
return function mergePropsProxy(stateProps, dispatchProps, ownProps) {
var nextMergedProps = mergeProps(stateProps, dispatchProps, ownProps);
if (hasRunOnce) {
if (!pure || !areMergedPropsEqual(nextMergedProps, mergedProps)) mergedProps = nextMergedProps;
} else {
return preact.h(WrappedComponent, this.addExtraProps(selector.props));
hasRunOnce = true;
mergedProps = nextMergedProps;
}
return mergedProps;
};
return Connect;
}(preact.Component);
Connect.WrappedComponent = WrappedComponent;
Connect.displayName = displayName;
Connect.childContextTypes = childContextTypes;
Connect.contextTypes = contextTypes;
{
Connect.prototype.componentWillUpdate = function componentWillUpdate() {
var _this2 = this;
// We are hot reloading!
if (this.version !== version) {
this.version = version;
this.initSelector();
// If any connected descendants don't hot reload (and resubscribe in the process), their
// listeners will be lost when we unsubscribe. Unfortunately, by copying over all
// listeners, this does mean that the old versions of connected descendants will still be
// notified of state changes; however, their onStateChange function is a no-op so this
// isn't a huge deal.
var oldListeners = [];
if (this.subscription) {
oldListeners = this.subscription.listeners.get();
this.subscription.tryUnsubscribe();
}
this.initSubscription();
if (shouldHandleStateChanges) {
this.subscription.trySubscribe();
oldListeners.forEach(function (listener) {
return _this2.subscription.listeners.subscribe(listener);
});
}
}
};
}
return hoistNonReactStatics(Connect, WrappedComponent);
};
}
var hasOwn = Object.prototype.hasOwnProperty;
function is(x, y) {
if (x === y) {
return x !== 0 || y !== 0 || 1 / x === 1 / y;
} else {
return x !== x && y !== y;
};
}
}
function shallowEqual(objA, objB) {
if (is(objA, objB)) return true;
if ((typeof objA === 'undefined' ? 'undefined' : _typeof(objA)) !== 'object' || objA === null || (typeof objB === 'undefined' ? 'undefined' : _typeof(objB)) !== 'object' || objB === null) {
return false;
function whenMergePropsIsFunction(mergeProps) {
return typeof mergeProps === 'function' ? wrapMergePropsFunc(mergeProps) : undefined;
}
var keysA = Object.keys(objA);
var keysB = Object.keys(objB);
if (keysA.length !== keysB.length) return false;
for (var i = 0; i < keysA.length; i++) {
if (!hasOwn.call(objB, keysA[i]) || !is(objA[keysA[i]], objB[keysA[i]])) {
return false;
}
function whenMergePropsIsOmitted(mergeProps) {
return !mergeProps ? function () {
return defaultMergeProps;
} : undefined;
}
var defaultMergePropsFactories = [whenMergePropsIsFunction, whenMergePropsIsOmitted];
return true;
}
/** Detect free variable `global` from Node.js. */
var freeGlobal = (typeof global === 'undefined' ? 'undefined' : _typeof(global)) == 'object' && global && global.Object === Object && global;
/** Detect free variable `self`. */
var freeSelf = (typeof self === 'undefined' ? 'undefined' : _typeof(self)) == 'object' && self && self.Object === Object && self;
/** Used as a reference to the global object. */
var root = freeGlobal || freeSelf || Function('return this')();
/** Built-in value references. */
var _Symbol = root.Symbol;
/** Used for built-in method references. */
var objectProto$1 = Object.prototype;
/** Used to check objects for own properties. */
var hasOwnProperty$1 = objectProto$1.hasOwnProperty;
/**
* Used to resolve the
* [`toStringTag`](http://ecma-international.org/ecma-262/7.0/#sec-object.prototype.tostring)
* of values.
*/
var nativeObjectToString = objectProto$1.toString;
/** Built-in value references. */
var symToStringTag$1 = _Symbol ? _Symbol.toStringTag : undefined;
/**
* A specialized version of `baseGetTag` which ignores `Symbol.toStringTag` values.
*
* @private
* @param {*} value The value to query.
* @returns {string} Returns the raw `toStringTag`.
*/
function getRawTag(value) {
var isOwn = hasOwnProperty$1.call(value, symToStringTag$1),
tag = value[symToStringTag$1];
try {
value[symToStringTag$1] = undefined;
var unmasked = true;
} catch (e) {}
var result = nativeObjectToString.call(value);
if (unmasked) {
if (isOwn) {
value[symToStringTag$1] = tag;
} else {
delete value[symToStringTag$1];
}
function impureFinalPropsSelectorFactory(mapStateToProps, mapDispatchToProps, mergeProps, dispatch) {
return function impureFinalPropsSelector(state, ownProps) {
return mergeProps(mapStateToProps(state, ownProps), mapDispatchToProps(dispatch, ownProps), ownProps);
};
}
return result;
}
/** Used for built-in method references. */
var objectProto$2 = Object.prototype;
/**
* Used to resolve the
* [`toStringTag`](http://ecma-international.org/ecma-262/7.0/#sec-object.prototype.tostring)
* of values.
*/
var nativeObjectToString$1 = objectProto$2.toString;
/**
* Converts `value` to a string using `Object.prototype.toString`.
*
* @private
* @param {*} value The value to convert.
* @returns {string} Returns the converted string.
*/
function objectToString(value) {
return nativeObjectToString$1.call(value);
}
/** `Object#toString` result references. */
var nullTag = '[object Null]';
var undefinedTag = '[object Undefined]';
/** Built-in value references. */
var symToStringTag = _Symbol ? _Symbol.toStringTag : undefined;
/**
* The base implementation of `getTag` without fallbacks for buggy environments.
*
* @private
* @param {*} value The value to query.
* @returns {string} Returns the `toStringTag`.
*/
function baseGetTag(value) {
if (value == null) {
return value === undefined ? undefinedTag : nullTag;
function pureFinalPropsSelectorFactory(mapStateToProps, mapDispatchToProps, mergeProps, dispatch, _ref) {
var areStatesEqual = _ref.areStatesEqual,
areOwnPropsEqual = _ref.areOwnPropsEqual,
areStatePropsEqual = _ref.areStatePropsEqual;
var hasRunAtLeastOnce = false;
var state;
var ownProps;
var stateProps;
var dispatchProps;
var mergedProps;
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;
}
return symToStringTag && symToStringTag in Object(value) ? getRawTag(value) : objectToString(value);
}
/**
* Creates a unary function that invokes `func` with its argument transformed.
*
* @private
* @param {Function} func The function to wrap.
* @param {Function} transform The argument transform.
* @returns {Function} Returns the new function.
*/
function overArg(func, transform) {
return function (arg) {
return func(transform(arg));
};
}
/** Built-in value references. */
var getPrototype = overArg(Object.getPrototypeOf, Object);
/**
* 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 != null && (typeof value === 'undefined' ? 'undefined' : _typeof(value)) == 'object';
}
/** `Object#toString` result references. */
var objectTag = '[object Object]';
/** Used for built-in method references. */
var funcProto = Function.prototype;
var objectProto = Object.prototype;
/** Used to resolve the decompiled source of functions. */
var funcToString = funcProto.toString;
/** Used to check objects for own properties. */
var hasOwnProperty = objectProto.hasOwnProperty;
/** Used to infer the `Object` constructor. */
var objectCtorString = funcToString.call(Object);
/**
* 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) || baseGetTag(value) != objectTag) {
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;
}
function verifyPlainObject(value, displayName, methodName) {
if (!isPlainObject(value)) {
warning(methodName + '() in ' + displayName + ' must return a plain object. Instead received ' + value + '.');
}
}
function wrapMapToPropsConstant(getConstant) {
return function initConstantSelector(dispatch, options) {
var constant = getConstant(dispatch, options);
function constantSelector() {
return constant;
function handleNewPropsAndNewState() {
stateProps = mapStateToProps(state, ownProps);
if (mapDispatchToProps.dependsOnOwnProps) dispatchProps = mapDispatchToProps(dispatch, ownProps);
mergedProps = mergeProps(stateProps, dispatchProps, ownProps);
return mergedProps;
}
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);
};
// allow detectFactoryAndVerify to get ownProps
proxy.dependsOnOwnProps = true;
proxy.mapToProps = function detectFactoryAndVerify(stateOrDispatch, ownProps) {
proxy.mapToProps = mapToProps;
proxy.dependsOnOwnProps = getDependsOnOwnProps(mapToProps);
var props = proxy(stateOrDispatch, ownProps);
if (typeof props === 'function') {
proxy.mapToProps = props;
proxy.dependsOnOwnProps = getDependsOnOwnProps(props);
props = proxy(stateOrDispatch, ownProps);
}
verifyPlainObject(props, displayName, methodName);
return props;
};
return proxy;
};
}
function whenMapDispatchToPropsIsFunction(mapDispatchToProps) {
return typeof mapDispatchToProps === 'function' ? wrapMapToPropsFunc(mapDispatchToProps, 'mapDispatchToProps') : undefined;
}
function whenMapDispatchToPropsIsMissing(mapDispatchToProps) {
return !mapDispatchToProps ? wrapMapToPropsConstant(function (dispatch) {
return { dispatch: dispatch };
}) : undefined;
}
function whenMapDispatchToPropsIsObject(mapDispatchToProps) {
return mapDispatchToProps && (typeof mapDispatchToProps === 'undefined' ? 'undefined' : _typeof(mapDispatchToProps)) === 'object' ? wrapMapToPropsConstant(function (dispatch) {
return redux.bindActionCreators(mapDispatchToProps, dispatch);
}) : undefined;
}
var defaultMapDispatchToPropsFactories = [whenMapDispatchToPropsIsFunction, whenMapDispatchToPropsIsMissing, whenMapDispatchToPropsIsObject];
function whenMapStateToPropsIsFunction(mapStateToProps) {
return typeof mapStateToProps === 'function' ? wrapMapToPropsFunc(mapStateToProps, 'mapStateToProps') : undefined;
}
function whenMapStateToPropsIsMissing(mapStateToProps) {
return !mapStateToProps ? wrapMapToPropsConstant(function () {
return {};
}) : undefined;
}
var defaultMapStateToPropsFactories = [whenMapStateToPropsIsFunction, whenMapStateToPropsIsMissing];
function defaultMergeProps(stateProps, dispatchProps, ownProps) {
return _extends({}, ownProps, stateProps, dispatchProps);
}
function wrapMergePropsFunc(mergeProps) {
return function initMergePropsProxy(dispatch, _ref) {
var displayName = _ref.displayName,
pure = _ref.pure,
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;
verifyPlainObject(mergedProps, displayName, 'mergeProps');
}
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);
};
};
}
function whenMergePropsIsFunction(mergeProps) {
return typeof mergeProps === 'function' ? wrapMergePropsFunc(mergeProps) : undefined;
}
function whenMergePropsIsOmitted(mergeProps) {
return !mergeProps ? function () {
return defaultMergeProps;
} : undefined;
}
var defaultMergePropsFactories = [whenMergePropsIsFunction, whenMergePropsIsOmitted];
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')) {
warning('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);
}
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,
areOwnPropsEqual = _ref.areOwnPropsEqual,
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 finalPropsSelectorFactory(dispatch, _ref2) {
var initMapStateToProps = _ref2.initMapStateToProps,
initMapDispatchToProps = _ref2.initMapDispatchToProps,
initMergeProps = _ref2.initMergeProps,
options = _objectWithoutPropertiesLoose(_ref2, ["initMapStateToProps", "initMapDispatchToProps", "initMergeProps"]);
var mapStateToProps = initMapStateToProps(dispatch, options);
var mapDispatchToProps = initMapDispatchToProps(dispatch, options);
var mergeProps = initMergeProps(dispatch, options);
var selectorFactory = options.pure ? pureFinalPropsSelectorFactory : impureFinalPropsSelectorFactory;
return selectorFactory(mapStateToProps, mapDispatchToProps, mergeProps, dispatch, options);
}
function handleNewPropsAndNewState() {
stateProps = mapStateToProps(state, ownProps);
if (mapDispatchToProps.dependsOnOwnProps) dispatchProps = mapDispatchToProps(dispatch, ownProps);
mergedProps = mergeProps(stateProps, dispatchProps, ownProps);
return mergedProps;
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 handleNewProps() {
if (mapStateToProps.dependsOnOwnProps) stateProps = mapStateToProps(state, ownProps);
if (mapDispatchToProps.dependsOnOwnProps) dispatchProps = mapDispatchToProps(dispatch, ownProps);
mergedProps = mergeProps(stateProps, dispatchProps, ownProps);
return mergedProps;
function strictEqual(a, b) {
return a === b;
}
function handleNewState() {
var nextStateProps = mapStateToProps(state, ownProps);
var statePropsChanged = !areStatePropsEqual(nextStateProps, stateProps);
stateProps = nextStateProps;
if (statePropsChanged) mergedProps = mergeProps(stateProps, dispatchProps, ownProps);
return mergedProps;
function createConnect(_temp) {
var _ref = _temp === void 0 ? {} : _temp,
_ref$connectHOC = _ref.connectHOC,
connectHOC = _ref$connectHOC === void 0 ? connectAdvanced : _ref$connectHOC,
_ref$mapStateToPropsF = _ref.mapStateToPropsFactories,
mapStateToPropsFactories = _ref$mapStateToPropsF === void 0 ? defaultMapStateToPropsFactories : _ref$mapStateToPropsF,
_ref$mapDispatchToPro = _ref.mapDispatchToPropsFactories,
mapDispatchToPropsFactories = _ref$mapDispatchToPro === void 0 ? defaultMapDispatchToPropsFactories : _ref$mapDispatchToPro,
_ref$mergePropsFactor = _ref.mergePropsFactories,
mergePropsFactories = _ref$mergePropsFactor === void 0 ? defaultMergePropsFactories : _ref$mergePropsFactor,
_ref$selectorFactory = _ref.selectorFactory,
selectorFactory = _ref$selectorFactory === void 0 ? finalPropsSelectorFactory : _ref$selectorFactory;
return function connect(mapStateToProps, mapDispatchToProps, mergeProps, _temp2) {
var _ref2 = _temp2 === void 0 ? {} : _temp2,
_ref2$pure = _ref2.pure,
pure = _ref2$pure === void 0 ? true : _ref2$pure,
_ref2$areStatesEqual = _ref2.areStatesEqual,
areStatesEqual = _ref2$areStatesEqual === void 0 ? strictEqual : _ref2$areStatesEqual,
_ref2$areOwnPropsEqua = _ref2.areOwnPropsEqual,
areOwnPropsEqual = _ref2$areOwnPropsEqua === void 0 ? shallowEqual : _ref2$areOwnPropsEqua,
_ref2$areStatePropsEq = _ref2.areStatePropsEqual,
areStatePropsEqual = _ref2$areStatePropsEq === void 0 ? shallowEqual : _ref2$areStatePropsEq,
_ref2$areMergedPropsE = _ref2.areMergedPropsEqual,
areMergedPropsEqual = _ref2$areMergedPropsE === void 0 ? shallowEqual : _ref2$areMergedPropsE,
extraOptions = _objectWithoutPropertiesLoose(_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({
methodName: 'connect',
getDisplayName: function getDisplayName(name) {
return "Connect(" + name + ")";
},
shouldHandleStateChanges: Boolean(mapStateToProps),
initMapStateToProps: initMapStateToProps,
initMapDispatchToProps: initMapDispatchToProps,
initMergeProps: initMergeProps,
pure: pure,
areStatesEqual: areStatesEqual,
areOwnPropsEqual: areOwnPropsEqual,
areStatePropsEqual: areStatePropsEqual,
areMergedPropsEqual: areMergedPropsEqual
}, extraOptions));
};
}
var connect = createConnect();
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);
var index = {
Provider: Provider,
connect: connect,
connectAdvanced: connectAdvanced,
ReactReduxContext: ReactReduxContext
};
}
// TODO: Add more comments
return index;
// 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,
initMapDispatchToProps = _ref2.initMapDispatchToProps,
initMergeProps = _ref2.initMergeProps,
options = objectWithoutProperties(_ref2, ['initMapStateToProps', 'initMapDispatchToProps', 'initMergeProps']);
var mapStateToProps = initMapStateToProps(dispatch, options);
var mapDispatchToProps = initMapDispatchToProps(dispatch, options);
var mergeProps = initMergeProps(dispatch, options);
{
verifySubselectors(mapStateToProps, mapDispatchToProps, mergeProps, options.displayName);
}
var selectorFactory = options.pure ? pureFinalPropsSelectorFactory : impureFinalPropsSelectorFactory;
return selectorFactory(mapStateToProps, mapDispatchToProps, mergeProps, dispatch, options);
}
/*
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 === 'undefined' ? 'undefined' : _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] : {},
_ref$connectHOC = _ref.connectHOC,
connectHOC = _ref$connectHOC === undefined ? connectAdvanced : _ref$connectHOC,
_ref$mapStateToPropsF = _ref.mapStateToPropsFactories,
mapStateToPropsFactories = _ref$mapStateToPropsF === undefined ? defaultMapStateToPropsFactories : _ref$mapStateToPropsF,
_ref$mapDispatchToPro = _ref.mapDispatchToPropsFactories,
mapDispatchToPropsFactories = _ref$mapDispatchToPro === undefined ? defaultMapDispatchToPropsFactories : _ref$mapDispatchToPro,
_ref$mergePropsFactor = _ref.mergePropsFactories,
mergePropsFactories = _ref$mergePropsFactor === undefined ? defaultMergePropsFactories : _ref$mergePropsFactor,
_ref$selectorFactory = _ref.selectorFactory,
selectorFactory = _ref$selectorFactory === undefined ? finalPropsSelectorFactory : _ref$selectorFactory;
return function connect(mapStateToProps, mapDispatchToProps, mergeProps) {
var _ref2 = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : {};
var _ref2$pure = _ref2.pure,
pure = _ref2$pure === undefined ? true : _ref2$pure,
_ref2$areStatesEqual = _ref2.areStatesEqual,
areStatesEqual = _ref2$areStatesEqual === undefined ? strictEqual : _ref2$areStatesEqual,
_ref2$areOwnPropsEqua = _ref2.areOwnPropsEqual,
areOwnPropsEqual = _ref2$areOwnPropsEqua === undefined ? shallowEqual : _ref2$areOwnPropsEqua,
_ref2$areStatePropsEq = _ref2.areStatePropsEqual,
areStatePropsEqual = _ref2$areStatePropsEq === undefined ? shallowEqual : _ref2$areStatePropsEq,
_ref2$areMergedPropsE = _ref2.areMergedPropsEqual,
areMergedPropsEqual = _ref2$areMergedPropsE === undefined ? shallowEqual : _ref2$areMergedPropsE,
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));
};
}
var connect = createConnect();
var index = { Provider: Provider, connect: connect, connectAdvanced: connectAdvanced };
return index;
})));
}));
//# sourceMappingURL=preact-redux.js.map

@@ -1,2 +0,1 @@

!function(t,e){"object"==typeof exports&&"undefined"!=typeof module?module.exports=e(require("preact"),require("redux")):"function"==typeof define&&define.amd?define(["preact","redux"],e):t.preactRedux=e(t.preact,t.Redux)}(this,function(t,e){function n(){}function r(){z||(z=!0)}function o(){var t=[],e=[];return{clear:function(){e=et,t=et},notify:function(){for(var n=t=e,r=0;r<n.length;r++)n[r]()},get:function(){return e},subscribe:function(n){var r=!0;return e===t&&(e=t.slice()),e.push(n),function(){r&&t!==et&&(r=!1,e===t&&(e=t.slice()),e.splice(e.indexOf(n),1))}}}}function i(){}function s(t,e){var n={run:function(r){try{var o=t(e.getState(),r);(o!==n.props||n.error)&&(n.shouldComponentUpdate=!0,n.props=o,n.error=null)}catch(t){n.shouldComponentUpdate=!0,n.error=t}}};return n}function u(e){var n,r,o=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},u=o.getDisplayName,p=void 0===u?function(t){return"ConnectAdvanced("+t+")"}:u,c=o.methodName,a=void 0===c?"connectAdvanced":c,d=o.renderCountProp,f=void 0===d?void 0:d,l=o.shouldHandleStateChanges,h=void 0===l||l,b=o.storeKey,y=void 0===b?"store":b,v=o.withRef,m=void 0!==v&&v,P=k(o,["getDisplayName","methodName","renderCountProp","shouldHandleStateChanges","storeKey","withRef"]),O=y+"Subscription",S=ot++,g=(n={},n[y]=H,n[O]=F,n),w=(r={},r[O]=F,r);return function(n){JSON.stringify(n);var r=n.displayName||n.name||"Component",o=p(r),u=_({},P,{getDisplayName:p,methodName:a,renderCountProp:f,shouldHandleStateChanges:h,storeKey:y,withRef:m,displayName:o,wrappedComponentName:r,WrappedComponent:n}),c=function(r){function o(t,e){var n=J(this,r.call(this,t,e));return n.version=S,n.state={},n.renderCount=0,n.store=t[y]||e[y],n.propsMode=!!t[y],n.setWrappedInstance=n.setWrappedInstance.bind(n),n.initSelector(),n.initSubscription(),n}return K(o,r),o.prototype.getChildContext=function(){var t,e=this.propsMode?null:this.subscription;return t={},t[O]=e||this.context[O],t},o.prototype.componentDidMount=function(){h&&(this.subscription.trySubscribe(),this.selector.run(this.props),this.selector.shouldComponentUpdate&&this.forceUpdate())},o.prototype.componentWillReceiveProps=function(t){this.selector.run(t)},o.prototype.shouldComponentUpdate=function(){return this.selector.shouldComponentUpdate},o.prototype.componentWillUnmount=function(){this.subscription&&this.subscription.tryUnsubscribe(),this.subscription=null,this.notifyNestedSubs=i,this.store=null,this.selector.run=i,this.selector.shouldComponentUpdate=!1},o.prototype.getWrappedInstance=function(){return this.wrappedInstance},o.prototype.setWrappedInstance=function(t){this.wrappedInstance=t},o.prototype.initSelector=function(){this.selector=s(e(this.store.dispatch,u),this.store),this.selector.run(this.props)},o.prototype.initSubscription=function(){if(h){this.subscription=new rt(this.store,(this.propsMode?this.props:this.context)[O],this.onStateChange.bind(this)),this.notifyNestedSubs=this.subscription.notifyNestedSubs.bind(this.subscription)}},o.prototype.onStateChange=function(){this.selector.run(this.props),this.selector.shouldComponentUpdate?(this.componentDidUpdate=this.notifyNestedSubsOnComponentDidUpdate,this.setState(it)):this.notifyNestedSubs()},o.prototype.notifyNestedSubsOnComponentDidUpdate=function(){this.componentDidUpdate=void 0,this.notifyNestedSubs()},o.prototype.isSubscribed=function(){return!!this.subscription&&this.subscription.isSubscribed()},o.prototype.addExtraProps=function(t){if(!(m||f||this.propsMode&&this.subscription))return t;var e=_({},t);return m&&(e.ref=this.setWrappedInstance),f&&(e[f]=this.renderCount++),this.propsMode&&this.subscription&&(e[O]=this.subscription),e},o.prototype.render=function(){var e=this.selector;if(e.shouldComponentUpdate=!1,e.error)throw e.error;return t.h(n,this.addExtraProps(e.props))},o}(t.Component);return c.WrappedComponent=n,c.displayName=o,c.childContextTypes=w,c.contextTypes=g,c.prototype.componentWillUpdate=function(){var t=this;if(this.version!==S){this.version=S,this.initSelector();var e=[];this.subscription&&(e=this.subscription.listeners.get(),this.subscription.tryUnsubscribe()),this.initSubscription(),h&&(this.subscription.trySubscribe(),e.forEach(function(e){return t.subscription.listeners.subscribe(e)}))}},tt(c,n)}}function p(t,e){return t===e?0!==t||0!==e||1/t==1/e:t!==t&&e!==e}function c(t,e){if(p(t,e))return!0;if("object"!==(void 0===t?"undefined":A(t))||null===t||"object"!==(void 0===e?"undefined":A(e))||null===e)return!1;var n=Object.keys(t);if(n.length!==Object.keys(e).length)return!1;for(var r=0;r<n.length;r++)if(!st.call(e,n[r])||!p(t[n[r]],e[n[r]]))return!1;return!0}function a(t){var e=ft.call(t,ht),n=t[ht];try{t[ht]=void 0;var r=!0}catch(t){}var o=lt.call(t);return r&&(e?t[ht]=n:delete t[ht]),o}function d(t){return yt.call(t)}function f(t){return null==t?void 0===t?mt:vt:Pt&&Pt in Object(t)?a(t):d(t)}function l(t){return null!=t&&"object"==(void 0===t?"undefined":A(t))}function h(t){if(!l(t)||f(t)!=St)return!1;var e=Ot(t);if(null===e)return!0;var n=jt.call(e,"constructor")&&e.constructor;return"function"==typeof n&&n instanceof n&&Ct.call(n)==Nt}function b(t){h(t)}function y(t){return function(e,n){function r(){return o}var o=t(e,n);return r.dependsOnOwnProps=!1,r}}function v(t){return null!==t.dependsOnOwnProps&&void 0!==t.dependsOnOwnProps?!!t.dependsOnOwnProps:1!==t.length}function m(t,e){return function(n,r){var o=r.displayName,i=function(t,e){return i.dependsOnOwnProps?i.mapToProps(t,e):i.mapToProps(t)};return i.dependsOnOwnProps=!0,i.mapToProps=function(n,r){i.mapToProps=t,i.dependsOnOwnProps=v(t);var s=i(n,r);return"function"==typeof s&&(i.mapToProps=s,i.dependsOnOwnProps=v(s),s=i(n,r)),b(s,o,e),s},i}}function P(t){return"function"==typeof t?m(t,"mapDispatchToProps"):void 0}function O(t){return t?void 0:y(function(t){return{dispatch:t}})}function S(t){return t&&"object"===(void 0===t?"undefined":A(t))?y(function(n){return e.bindActionCreators(t,n)}):void 0}function g(t){return"function"==typeof t?m(t,"mapStateToProps"):void 0}function w(t){return t?void 0:y(function(){return{}})}function C(t,e,n){return _({},n,t,e)}function j(t){return function(e,n){var r=n.displayName,o=n.pure,i=n.areMergedPropsEqual,s=!1,u=void 0;return function(e,n,p){var c=t(e,n,p);return s?o&&i(c,u)||(u=c):(s=!0,u=c,b(u,r,"mergeProps")),u}}}function N(t){return"function"==typeof t?j(t):void 0}function T(t){return t?void 0:function(){return C}}function q(t,e,n){if(!t)throw Error("Unexpected value for "+e+" in "+n+".");"mapStateToProps"!==e&&"mapDispatchToProps"!==e||t.hasOwnProperty("dependsOnOwnProps")}function E(t,e,n,r){q(t,"mapStateToProps",r),q(e,"mapDispatchToProps",r),q(n,"mergeProps",r)}function x(t,e,n,r){return function(o,i){return n(t(o,i),e(r,i),i)}}function U(t,e,n,r,o){function i(o,i){return h=o,b=i,y=t(h,b),v=e(r,b),m=n(y,v,b),l=!0,m}function s(){return y=t(h,b),e.dependsOnOwnProps&&(v=e(r,b)),m=n(y,v,b)}function u(){return t.dependsOnOwnProps&&(y=t(h,b)),e.dependsOnOwnProps&&(v=e(r,b)),m=n(y,v,b)}function p(){var e=t(h,b),r=!f(e,y);return y=e,r&&(m=n(y,v,b)),m}function c(t,e){var n=!d(e,b),r=!a(t,h);return h=t,b=e,n&&r?s():n?u():r?p():m}var a=o.areStatesEqual,d=o.areOwnPropsEqual,f=o.areStatePropsEqual,l=!1,h=void 0,b=void 0,y=void 0,v=void 0,m=void 0;return function(t,e){return l?c(t,e):i(t,e)}}function D(t,e){var n=e.initMapStateToProps,r=e.initMapDispatchToProps,o=e.initMergeProps,i=k(e,["initMapStateToProps","initMapDispatchToProps","initMergeProps"]),s=n(t,i),u=r(t,i),p=o(t,i);return E(s,u,p,i.displayName),(i.pure?U:x)(s,u,p,t,i)}function M(t,e,n){for(var r=e.length-1;r>=0;r--){var o=e[r](t);if(o)return o}return function(e,r){throw Error("Invalid value of type "+(void 0===t?"undefined":A(t))+" for "+n+" argument when connecting component "+r.wrappedComponentName+".")}}function R(t,e){return t===e}var W={only:function(t){return t&&t[0]||null}};n.isRequired=n;var I={element:n,func:n,shape:function(){return n},instanceOf:function(){return n}},F=I.shape({trySubscribe:I.func.isRequired,tryUnsubscribe:I.func.isRequired,notifyNestedSubs:I.func.isRequired,isSubscribed:I.func.isRequired}),H=I.shape({subscribe:I.func.isRequired,dispatch:I.func.isRequired,getState:I.func.isRequired}),A="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},_=Object.assign||function(t){for(var e=1;e<arguments.length;e++){var n=arguments[e];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(t[r]=n[r])}return t},K=function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function, not "+typeof e);t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}),e&&(Object.setPrototypeOf?Object.setPrototypeOf(t,e):t.__proto__=e)},k=function(t,e){var n={};for(var r in t)e.indexOf(r)>=0||Object.prototype.hasOwnProperty.call(t,r)&&(n[r]=t[r]);return n},J=function(t,e){if(!t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!e||"object"!=typeof e&&"function"!=typeof e?t:e},z=!1,B=function(){var e,n=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"store",o=arguments[1],i=o||n+"Subscription",s=function(t){function e(e,r){var o=J(this,t.call(this,e,r));return o[n]=e.store,o}return K(e,t),e.prototype.getChildContext=function(){var t;return t={},t[n]=this[n],t[i]=null,t},e.prototype.render=function(){return W.only(this.props.children)},e}(t.Component);return s.prototype.componentWillReceiveProps=function(t){this[n]!==t.store&&r()},s.childContextTypes=(e={},e[n]=H.isRequired,e[i]=F,e),s}(),G={childContextTypes:!0,contextTypes:!0,defaultProps:!0,displayName:!0,getDefaultProps:!0,mixins:!0,propTypes:!0,type:!0},L={name:!0,length:!0,prototype:!0,caller:!0,callee:!0,arguments:!0,arity:!0},Q=Object.defineProperty,V=Object.getOwnPropertyNames,X=Object.getOwnPropertySymbols,Y=Object.getOwnPropertyDescriptor,Z=Object.getPrototypeOf,$=Z&&Z(Object),tt=function t(e,n,r){if("string"!=typeof n){if($){var o=Z(n);o&&o!==$&&t(e,o,r)}var i=V(n);X&&(i=i.concat(X(n)));for(var s=0;s<i.length;++s){var u=i[s];if(!(G[u]||L[u]||r&&r[u])){var p=Y(n,u);try{Q(e,u,p)}catch(t){}}}return e}return e},et=null,nt={notify:function(){}},rt=function(){function t(t,e,n){this.store=t,this.parentSub=e,this.onStateChange=n,this.unsubscribe=null,this.listeners=nt}return t.prototype.addNestedSub=function(t){return this.trySubscribe(),this.listeners.subscribe(t)},t.prototype.notifyNestedSubs=function(){this.listeners.notify()},t.prototype.isSubscribed=function(){return!!this.unsubscribe},t.prototype.trySubscribe=function(){this.unsubscribe||(this.unsubscribe=this.parentSub?this.parentSub.addNestedSub(this.onStateChange):this.store.subscribe(this.onStateChange),this.listeners=o())},t.prototype.tryUnsubscribe=function(){this.unsubscribe&&(this.unsubscribe(),this.unsubscribe=null,this.listeners.clear(),this.listeners=nt)},t}(),ot=0,it={},st=Object.prototype.hasOwnProperty,ut="object"==("undefined"==typeof global?"undefined":A(global))&&global&&global.Object===Object&&global,pt="object"==("undefined"==typeof self?"undefined":A(self))&&self&&self.Object===Object&&self,ct=ut||pt||Function("return this")(),at=ct.Symbol,dt=Object.prototype,ft=dt.hasOwnProperty,lt=dt.toString,ht=at?at.toStringTag:void 0,bt=Object.prototype,yt=bt.toString,vt="[object Null]",mt="[object Undefined]",Pt=at?at.toStringTag:void 0,Ot=function(t,e){return function(n){return t(e(n))}}(Object.getPrototypeOf,Object),St="[object Object]",gt=Function.prototype,wt=Object.prototype,Ct=gt.toString,jt=wt.hasOwnProperty,Nt=Ct.call(Object),Tt=[P,O,S],qt=[g,w],Et=[N,T];return{Provider:B,connect:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},e=t.connectHOC,n=void 0===e?u:e,r=t.mapStateToPropsFactories,o=void 0===r?qt:r,i=t.mapDispatchToPropsFactories,s=void 0===i?Tt:i,p=t.mergePropsFactories,a=void 0===p?Et:p,d=t.selectorFactory,f=void 0===d?D:d;return function(t,e,r){var i=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{},u=i.pure,p=void 0===u||u,d=i.areStatesEqual,l=void 0===d?R:d,h=i.areOwnPropsEqual,b=void 0===h?c:h,y=i.areStatePropsEqual,v=void 0===y?c:y,m=i.areMergedPropsEqual,P=void 0===m?c:m,O=k(i,["pure","areStatesEqual","areOwnPropsEqual","areStatePropsEqual","areMergedPropsEqual"]),S=M(t,o,"mapStateToProps"),g=M(e,s,"mapDispatchToProps"),w=M(r,a,"mergeProps");return n(f,_({methodName:"connect",getDisplayName:function(t){return"Connect("+t+")"},shouldHandleStateChanges:!!t,initMapStateToProps:S,initMapDispatchToProps:g,initMergeProps:w,pure:p,areStatesEqual:l,areOwnPropsEqual:b,areStatePropsEqual:v,areMergedPropsEqual:P},O))}}(),connectAdvanced:u}});
//# sourceMappingURL=preact-redux.min.js.map
!function(t,n){"object"==typeof exports&&"undefined"!=typeof module?module.exports=n(require("preact"),require("preact-context"),require("redux")):"function"==typeof define&&define.amd?define(["preact","preact-context","redux"],n):(t=t||self).preactRedux=n(t.preact,t.preactContext,t.Redux)}(this,function(t,n,r){"use strict";function e(){return(e=Object.assign||function(t){for(var n=1;n<arguments.length;n++){var r=arguments[n];for(var e in r)Object.prototype.hasOwnProperty.call(r,e)&&(t[e]=r[e])}return t}).apply(this,arguments)}function o(t,n){t.prototype=Object.create(n.prototype),t.prototype.constructor=t,t.__proto__=n}function u(t,n){if(null==t)return{};var r,e,o={},u=Object.keys(t);for(e=0;e<u.length;e++)n.indexOf(r=u[e])>=0||(o[r]=t[r]);return o}function i(){}var c={createContext:n.createContext,forwardRef:i,createElement:t.h},a=c.createContext(null),f=function(t){function n(n){var r;r=t.call(this,n)||this;var e=n.store;return r.state={storeState:e.getState(),store:e},r}o(n,t);var r=n.prototype;return r.componentDidMount=function(){this.t=!0,this.subscribe()},r.componentWillUnmount=function(){this.unsubscribe&&this.unsubscribe(),this.t=!1},r.componentDidUpdate=function(t){this.props.store!==t.store&&(this.unsubscribe&&this.unsubscribe(),this.subscribe())},r.subscribe=function(){var t=this,n=this.props.store;this.unsubscribe=n.subscribe(function(){var r=n.getState();t.t&&t.setState(function(t){return t.storeState===r?null:{storeState:r}})});var r=n.getState();r!==this.state.storeState&&this.setState({storeState:r})},r.render=function(){return c.createElement((this.props.context||a).Provider,{value:this.state},this.props.children)},n}(t.Component);function s(t,n){return t(n={exports:{}},n.exports),n.exports}var p,v=s(function(t,n){Object.defineProperty(n,"o",{value:!0});var r=60103,e=60106,o=60107,u=60108,i=60114,c=60109,a=60110,f=60111,s=60111,p=60112,v=60113,d=60115,l=60116;function h(t){if("object"==typeof t&&null!==t){var n=t.$$typeof;switch(n){case r:switch(t=t.type){case f:case s:case o:case i:case u:case v:return t;default:switch(t=t&&t.$$typeof){case a:case p:case c:return t;default:return n}}case l:case d:case e:return n}}}function y(t){return h(t)===s}n.typeOf=h,n.AsyncMode=f,n.ConcurrentMode=s,n.ContextConsumer=a,n.ContextProvider=c,n.Element=r,n.ForwardRef=p,n.Fragment=o,n.Lazy=l,n.Memo=d,n.Portal=e,n.Profiler=i,n.StrictMode=u,n.Suspense=v,n.isValidElementType=function(t){return"string"==typeof t||"function"==typeof t||t===o||t===s||t===i||t===u||t===v||"object"==typeof t&&null!==t&&(t.$$typeof===l||t.$$typeof===d||t.$$typeof===c||t.$$typeof===a||t.$$typeof===p)},n.isAsyncMode=function(t){return y(t)||h(t)===f},n.isConcurrentMode=y,n.isContextConsumer=function(t){return h(t)===a},n.isContextProvider=function(t){return h(t)===c},n.isElement=function(t){return"object"==typeof t&&null!==t&&t.$$typeof===r},n.isForwardRef=function(t){return h(t)===p},n.isFragment=function(t){return h(t)===o},n.isLazy=function(t){return h(t)===l},n.isMemo=function(t){return h(t)===d},n.isPortal=function(t){return h(t)===e},n.isProfiler=function(t){return h(t)===i},n.isStrictMode=function(t){return h(t)===u},n.isSuspense=function(t){return h(t)===v}});(p=v)&&p.o&&Object.prototype.hasOwnProperty.call(p,"default");var d=s(function(t){t.exports=v}),l=d.isContextConsumer,h={childContextTypes:!0,contextType:!0,contextTypes:!0,defaultProps:!0,displayName:!0,getDefaultProps:!0,getDerivedStateFromError:!0,getDerivedStateFromProps:!0,mixins:!0,propTypes:!0,type:!0},y={name:!0,length:!0,prototype:!0,caller:!0,callee:!0,arguments:!0,arity:!0},m={$$typeof:!0,compare:!0,defaultProps:!0,displayName:!0,propTypes:!0,type:!0},b={};function P(t){return d.isMemo(t)?m:b[t.$$typeof]||h}b[d.ForwardRef]={$$typeof:!0,render:!0,defaultProps:!0,displayName:!0,propTypes:!0};var j=Object.defineProperty,g=Object.getOwnPropertyNames,O=Object.getOwnPropertySymbols,w=Object.getOwnPropertyDescriptor,S=Object.getPrototypeOf,x=Object.prototype;var C=function t(n,r,e){if("string"!=typeof r){if(x){var o=S(r);o&&o!==x&&t(n,o,e)}var u=g(r);O&&(u=u.concat(O(r)));for(var i=P(n),c=P(r),a=0;a<u.length;++a){var f=u[a];if(!(y[f]||e&&e[f]||c&&c[f]||i&&i[f])){var s=w(r,f);try{j(n,f,s)}catch(t){}}}return n}return n};function E(n,r){var i=void 0===r?{}:r,f=i.getDisplayName,s=void 0===f?function(t){return"ConnectAdvanced("+t+")"}:f,p=i.methodName,v=void 0===p?"connectAdvanced":p,d=i.renderCountProp,h=void 0===d?void 0:d,y=i.shouldHandleStateChanges,m=void 0===y||y,b=i.storeKey,P=void 0===b?"store":b,j=i.forwardRef,g=void 0!==j&&j,O=i.context,w=void 0===O?a:O,S=u(i,["getDisplayName","methodName","renderCountProp","shouldHandleStateChanges","storeKey","withRef","forwardRef","context"]),x=w;return function(r){var u=r.displayName||r.name||"Component",i=s(u),a=e({},S,{getDisplayName:s,methodName:v,renderCountProp:h,shouldHandleStateChanges:m,storeKey:P,displayName:i,wrappedComponentName:u,WrappedComponent:r}),f=S.pure,p=t.Component;f&&(p=t.Component);var d=function(t){function u(r){var o,u,i,a,s,p,v,d,l,h,y;return(o=t.call(this,r)||this).selectDerivedProps=function(t,r,e,o){if(f&&u===r&&i===t)return a;e===s&&p===o||(s=e,p=o,v=n(e.dispatch,o)),u=r,i=t;var c=v(t,r);return a=c},o.selectChildElement=function(t,n,r){return n===d&&r===l&&y===t||(d=n,l=r,y=t,h=c.createElement(t,e({},n,{ref:r}))),h},o.indirectRenderWrappedComponent=o.indirectRenderWrappedComponent.bind(function(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}(o)),o}o(u,t);var i=u.prototype;return i.indirectRenderWrappedComponent=function(t){return this.renderWrappedComponent(t)},i.renderWrappedComponent=function(t){var n,e=this.props;g&&(e=this.props.wrapperProps,n=this.props.forwardedRef);var o=this.selectDerivedProps(t.storeState,e,t.store,a);return this.selectChildElement(r,o,n)},i.render=function(){var t=this.props.context&&this.props.context.Consumer&&l(c.createElement(this.props.context.Consumer,null))?this.props.context:x;return c.createElement(t.Consumer,null,this.indirectRenderWrappedComponent)},u}(p);if(d.WrappedComponent=r,d.displayName=i,g){var y=c.forwardRef(function(t,n){return c.createElement(d,{wrapperProps:t,forwardedRef:n})});return y.displayName=i,y.WrappedComponent=r,C(y,r)}return C(d,r)}}var T=Object.prototype.hasOwnProperty;function q(t,n){return t===n?0!==t||0!==n||1/t==1/n:t!=t&&n!=n}function N(t,n){if(q(t,n))return!0;if("object"!=typeof t||null===t||"object"!=typeof n||null===n)return!1;var r=Object.keys(t);if(r.length!==Object.keys(n).length)return!1;for(var e=0;e<r.length;e++)if(!T.call(n,r[e])||!q(t[r[e]],n[r[e]]))return!1;return!0}function D(t){return function(n,r){var e=t(n,r);function o(){return e}return o.dependsOnOwnProps=!1,o}}function M(t){return null!=t.dependsOnOwnProps?!!t.dependsOnOwnProps:1!==t.length}function R(t){return function(){var n=function(t,r){return n.dependsOnOwnProps?n.mapToProps(t,r):n.mapToProps(t)};return n.dependsOnOwnProps=!0,n.mapToProps=function(r,e){n.mapToProps=t,n.dependsOnOwnProps=M(t);var o=n(r,e);return"function"==typeof o&&(n.mapToProps=o,n.dependsOnOwnProps=M(o),o=n(r,e)),o},n}}function $(t,n,r){return e({},r,t,n)}var A,H,F,K,_,I,W,k,z,B,G,J,L=[function(t){return"function"==typeof t?function(t){return function(n,r){var e,o=r.pure,u=r.areMergedPropsEqual,i=!1;return function(n,r,c){var a=t(n,r,c);return i?o&&u(a,e)||(e=a):(i=!0,e=a),e}}}(t):void 0},function(t){return t?void 0:function(){return $}}];function Q(t,n,r,e){return function(o,u){return r(t(o,u),n(e,u),u)}}function U(t,n,r,e,o){var u,i,c,a,f,s=o.areStatesEqual,p=o.areOwnPropsEqual,v=o.areStatePropsEqual,d=!1;function l(o,d){var l,h,y=!p(d,i),m=!s(o,u);return u=o,i=d,y&&m?(c=t(u,i),n.dependsOnOwnProps&&(a=n(e,i)),f=r(c,a,i)):y?(t.dependsOnOwnProps&&(c=t(u,i)),n.dependsOnOwnProps&&(a=n(e,i)),f=r(c,a,i)):m?(l=t(u,i),h=!v(l,c),c=l,h&&(f=r(c,a,i)),f):f}return function(o,s){return d?l(o,s):(c=t(u=o,i=s),a=n(e,i),f=r(c,a,i),d=!0,f)}}function V(t,n){var r=n.initMapStateToProps,e=n.initMapDispatchToProps,o=n.initMergeProps,i=u(n,["initMapStateToProps","initMapDispatchToProps","initMergeProps"]),c=r(t,i),a=e(t,i),f=o(t,i);return(i.pure?U:Q)(c,a,f,t,i)}function X(t,n,r){for(var e=n.length-1;e>=0;e--){var o=n[e](t);if(o)return o}return function(n,e){throw Error("Invalid value of type "+typeof t+" for "+r+" argument when connecting component "+e.wrappedComponentName+".")}}function Y(t,n){return t===n}return{Provider:f,connect:(K=void 0===(F=(H=void 0===A?{}:A).connectHOC)?E:F,I=void 0===(_=H.mapStateToPropsFactories)?[function(t){return"function"==typeof t?R(t):void 0},function(t){return t?void 0:D(function(){return{}})}]:_,k=void 0===(W=H.mapDispatchToPropsFactories)?[function(t){return"function"==typeof t?R(t):void 0},function(t){return t?void 0:D(function(t){return{dispatch:t}})},function(t){return t&&"object"==typeof t?D(function(n){return r.bindActionCreators(t,n)}):void 0}]:W,B=void 0===(z=H.mergePropsFactories)?L:z,J=void 0===(G=H.selectorFactory)?V:G,function(t,n,r,o){var i=void 0===o?{}:o,c=i.pure,a=void 0===c||c,f=i.areStatesEqual,s=void 0===f?Y:f,p=i.areOwnPropsEqual,v=void 0===p?N:p,d=i.areStatePropsEqual,l=void 0===d?N:d,h=i.areMergedPropsEqual,y=void 0===h?N:h,m=u(i,["pure","areStatesEqual","areOwnPropsEqual","areStatePropsEqual","areMergedPropsEqual"]),b=X(t,I,"mapStateToProps"),P=X(n,k,"mapDispatchToProps"),j=X(r,B,"mergeProps");return K(J,e({methodName:"connect",getDisplayName:function(t){return"Connect("+t+")"},shouldHandleStateChanges:!!t,initMapStateToProps:b,initMapDispatchToProps:P,initMergeProps:j,pure:a,areStatesEqual:s,areOwnPropsEqual:v,areStatePropsEqual:l,areMergedPropsEqual:y},m))}),connectAdvanced:E,ReactReduxContext:a}});
{
"name": "preact-redux",
"amdName": "preactRedux",
"version": "2.0.3",
"version": "2.1.0",
"description": "Wraps react-redux up for Preact, without preact-compat",

@@ -16,6 +16,6 @@ "main": "dist/preact-redux.js",

"transpile:es": "rollup -c --environment FORMAT:es",
"minify": "uglifyjs dist/preact-redux.js --define NODE_ENV=production --pure-funcs classCallCheck Object.defineProperty Object.freeze invariant warning -c unsafe,collapse_vars,evaluate,screw_ie8,loops,keep_fargs=false,pure_getters,unused,dead_code -m -o dist/preact-redux.min.js -p relative --in-source-map dist/preact-redux.js.map --source-map dist/preact-redux.min.js.map",
"minify": "terser dist/preact-redux.js --define NODE_ENV=production -c 'pure_funcs=\"classCallCheck,console.warn,invariant,warning,React.forwardRef\",unsafe,collapse_vars,evaluate,loops,keep_fargs=false,pure_getters,unused,dead_code' -m --mangle-props regex=/_/ -o dist/preact-redux.min.js --source-map content=dist/preact-redux.js.map,filename=dist/preact-redux.min.js.map",
"size": "gzip-size dist/preact-redux.min.js",
"test": "cross-env NODE_ENV=development npm-run-all lint transpile:* test:karma",
"lint": "eslint {src,test}",
"lint": "eslint src/ test/",
"test:karma": "karma start --single-run",

@@ -45,28 +45,23 @@ "test:watch": "karma start",

"peerDependencies": {
"preact": ">=3",
"redux": ">=2"
"preact": "<10",
"redux": ">=2",
"preact-context": ">=1.1.0"
},
"devDependencies": {
"babel-cli": "^6.24.1",
"babel-core": "^6.24.1",
"babel-eslint": "^7.2.1",
"babel-loader": "^7.0.0",
"babel-plugin-external-helpers": "^6.22.0",
"babel-plugin-transform-class-properties": "^6.24.1",
"babel-plugin-transform-es2015-classes": "^6.24.1",
"babel-plugin-transform-node-env-inline": "^6.8.0",
"babel-plugin-transform-object-assign": "^6.22.0",
"babel-plugin-transform-react-jsx": "^6.24.1",
"babel-plugin-transform-react-remove-prop-types": "^0.4.1",
"babel-preset-es2015": "^6.24.1",
"babel-preset-react": "^6.24.1",
"babel-preset-stage-0": "^6.24.1",
"chai": "^3.5.0",
"cross-env": "^4.0.0",
"@babel/cli": "^7.4.3",
"@babel/core": "^7.4.3",
"@babel/plugin-proposal-class-properties": "^7.4.0",
"@babel/preset-env": "^7.4.3",
"@babel/preset-react": "^7.0.0",
"babel-eslint": "^10.0.1",
"babel-loader": "^8.0.5",
"babel-plugin-transform-react-remove-prop-types": "^0.4.24",
"chai": "^4.2.0",
"cross-env": "^5.2.0",
"cross-var": "^1.0.3",
"diff": "^3.2.0",
"eslint": "^3.19.0",
"eslint-plugin-react": "^6.10.3",
"gzip-size-cli": "^2.0.0",
"karma": "^1.6.0",
"diff": "^4.0.1",
"eslint": "^5.16.0",
"eslint-plugin-react": "^7.12.4",
"gzip-size-cli": "^3.0.0",
"karma": "^4.0.1",
"karma-chai-sinon": "^0.1.5",

@@ -76,26 +71,31 @@ "karma-mocha": "^1.3.0",

"karma-phantomjs-launcher": "^1.0.4",
"karma-source-map-support": "^1.4.0",
"karma-sourcemap-loader": "^0.3.7",
"karma-webpack": "^2.0.3",
"karma-webpack": "^3.0.5",
"mkdirp": "^0.5.1",
"mocha": "^3.2.0",
"mocha": "^6.1.2",
"npm-run-all": "^4.0.2",
"phantomjs-prebuilt": "^2.1.14",
"preact": "^8.1.0",
"preact-context": "^1.1.3",
"pretty-bytes-cli": "^2.0.0",
"react-redux": "^5.0.4",
"redux": "^3.6.0",
"react-redux": "^6.0.1",
"redux": "^4.0.0",
"rimraf": "^2.6.1",
"rollup": "^0.41.6",
"rollup": "^1.9.2",
"rollup-plugin-alias": "^1.2.1",
"rollup-plugin-babel": "^2.7.1",
"rollup-plugin-commonjs": "^8.0.2",
"rollup-plugin-analyzer": "^3.0.0",
"rollup-plugin-babel": "^4.3.2",
"rollup-plugin-cjs-es": "^0.7.0",
"rollup-plugin-cleanup": "^3.1.1",
"rollup-plugin-commonjs": "^9.3.4",
"rollup-plugin-es3": "^1.0.3",
"rollup-plugin-memory": "^2.0.0",
"rollup-plugin-node-resolve": "^3.0.0",
"rollup-plugin-replace": "^1.1.1",
"sinon": "^2.1.0",
"sinon-chai": "^2.9.0",
"uglify-js": "^2.8.22",
"webpack": "^2.3.3"
"rollup-plugin-invariant": "^0.5.2",
"rollup-plugin-node-resolve": "^4.2.2",
"rollup-plugin-replace": "^2.2.0",
"sinon": "^7.3.1",
"sinon-chai": "^3.3.0",
"terser": "^3.17.0",
"webpack": "^4.29.6"
}
}

@@ -6,8 +6,10 @@ # preact-redux

Wraps [react-redux] up for [Preact], without using [preact-compat](https://github.com/developit/preact-compat).
Wraps [react-redux] up for [Preact] (8.x and prior), without using [preact-compat](https://github.com/developit/preact-compat). Think of this as a version of `react-redux` that is pre-aliased to use preact in place of React.
> Think of this as a version of `react-redux` that is pre-aliased to use preact in place of React.
**See [preact-redux-example](https://github.com/developit/preact-redux-example):** _a full working example of `redux` + `preact` using `preact-redux`!_
> 💁‍ **Compatibility Note:**
>
> If you're using Preact X (preact@10+), please use the official [react-redux] library.
---

@@ -14,0 +16,0 @@

@@ -1,7 +0,10 @@

export { Component, h as createElement } from 'preact';
export { Component, Component as PureComponent } from "preact";
import { createContext } from "preact-context";
import { h } from "preact";
import empty from "./empty";
export const Children = {
only(children) {
return children && children[0] || null;
}
export default {
createContext,
forwardRef: empty,
createElement: h
};

@@ -1,3 +0,3 @@

import { Provider, connect, connectAdvanced } from 'react-redux';
export { Provider, connect, connectAdvanced };
export default { Provider, connect, connectAdvanced };
import { Provider, connect, connectAdvanced, ReactReduxContext } from 'react-redux';
export { Provider, connect, connectAdvanced, ReactReduxContext };
export default { Provider, connect, connectAdvanced, ReactReduxContext };

@@ -12,10 +12,11 @@ // Type definitions for preact-redux 2.0.1

import { AnyComponent, Component, ComponentConstructor, VNode } from 'preact';
import { Store, Dispatch, ActionCreator } from 'redux';
import { Store, Dispatch, ActionCreator, Action } from 'redux';
// Diff / Omit taken from https://github.com/Microsoft/TypeScript/issues/12215#issuecomment-311923766
type Diff<T extends string, U extends string> = ({ [P in T]: P } & { [P in U]: never } & { [x: string]: never })[T];
type Omit<T, K extends keyof T> = Pick<T, Diff<keyof T, K>>;
// new Omit in TS2.9 https://github.com/Microsoft/TypeScript/issues/12215#issuecomment-377567046
type Omit<T, K extends keyof T> = Pick<T, Exclude<keyof T, K>>;
export interface DispatchProp<S> {
dispatch?: Dispatch<S>;
export interface DispatchProp<A extends Action> {
dispatch?: Dispatch<A>;
}

@@ -201,4 +202,4 @@

*/
export declare function connectAdvanced<S, TProps, TOwnProps, TFactoryOptions = {}>(
selectorFactory: SelectorFactory<S, TProps, TOwnProps, TFactoryOptions>,
export declare function connectAdvanced<A extends Action, TProps, TOwnProps, TFactoryOptions = {}>(
selectorFactory: SelectorFactory<A, TProps, TOwnProps, TFactoryOptions>,
connectOptions?: ConnectOptions & TFactoryOptions

@@ -215,4 +216,4 @@ ): AdvancedComponentDecorator<TProps, TOwnProps>;

*/
export interface SelectorFactory<S, TProps, TOwnProps, TFactoryOptions> {
(dispatch: Dispatch<S>, factoryOptions: TFactoryOptions): Selector<S, TProps, TOwnProps>
export interface SelectorFactory<A extends Action, TProps, TOwnProps, TFactoryOptions> {
(dispatch: Dispatch<A>, factoryOptions: TFactoryOptions): Selector<A, TProps, TOwnProps>
}

@@ -281,3 +282,3 @@

export class Provider extends Component<ProviderProps, {}> {
render(props: ProviderProps): VNode
render(props?: ProviderProps): JSX.Element | null
}

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet