diff --git a/.gitignore b/.gitignore index f53ff7d..af72094 100644 --- a/.gitignore +++ b/.gitignore @@ -1,5 +1,3 @@ -lib -dist node_modules coverage *.log diff --git a/dist/react-inline-grid.js b/dist/react-inline-grid.js new file mode 100644 index 0000000..bc589d6 --- /dev/null +++ b/dist/react-inline-grid.js @@ -0,0 +1,3985 @@ +(function webpackUniversalModuleDefinition(root, factory) { + if(typeof exports === 'object' && typeof module === 'object') + module.exports = factory(require("react"), require("redux")); + else if(typeof define === 'function' && define.amd) + define(["react", "redux"], factory); + else if(typeof exports === 'object') + exports["ReactInlineGrid"] = factory(require("react"), require("redux")); + else + root["ReactInlineGrid"] = factory(root["React"], root["Redux"]); +})(this, function(__WEBPACK_EXTERNAL_MODULE_3__, __WEBPACK_EXTERNAL_MODULE_20__) { +return /******/ (function(modules) { // webpackBootstrap +/******/ // The module cache +/******/ var installedModules = {}; + +/******/ // The require function +/******/ function __webpack_require__(moduleId) { + +/******/ // Check if module is in cache +/******/ if(installedModules[moduleId]) +/******/ return installedModules[moduleId].exports; + +/******/ // Create a new module (and put it into the cache) +/******/ var module = installedModules[moduleId] = { +/******/ exports: {}, +/******/ id: moduleId, +/******/ loaded: false +/******/ }; + +/******/ // Execute the module function +/******/ modules[moduleId].call(module.exports, module, module.exports, __webpack_require__); + +/******/ // Flag the module as loaded +/******/ module.loaded = true; + +/******/ // Return the exports of the module +/******/ return module.exports; +/******/ } + + +/******/ // expose the modules object (__webpack_modules__) +/******/ __webpack_require__.m = modules; + +/******/ // expose the module cache +/******/ __webpack_require__.c = installedModules; + +/******/ // __webpack_public_path__ +/******/ __webpack_require__.p = ""; + +/******/ // Load entry module and return exports +/******/ return __webpack_require__(0); +/******/ }) +/************************************************************************/ +/******/ ([ +/* 0 */ +/***/ (function(module, exports, __webpack_require__) { + + 'use strict'; + + exports.__esModule = true; + + function _interopRequire(obj) { return obj && obj.__esModule ? obj['default'] : obj; } + + function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; } + + var _constants = __webpack_require__(1); + + var _componentsCreateComponent = __webpack_require__(38); + + var _componentsCreateComponent2 = _interopRequireDefault(_componentsCreateComponent); + + var _componentsGrid = __webpack_require__(37); + + exports.Grid = _interopRequire(_componentsGrid); + + var Row = _componentsCreateComponent2['default'](_constants.ROW_ID); + var Cell = _componentsCreateComponent2['default'](_constants.CELL_ID); + + exports.Row = Row; + exports.Cell = Cell; + +/***/ }), +/* 1 */ +/***/ (function(module, exports) { + + 'use strict'; + + exports.__esModule = true; + + var _WHITE_LIST; + + var UPDATE_MEDIA_NAME = 'media/name/UPDATE'; + exports.UPDATE_MEDIA_NAME = UPDATE_MEDIA_NAME; + var ROW_ID = 'row'; + exports.ROW_ID = ROW_ID; + var CELL_ID = 'cell'; + exports.CELL_ID = CELL_ID; + var MEDIA_MODEL_HELPER = { + gutter: 16, + margin: 16, + list: [{ + name: 'phone', + query: '(max-width: 479px)' + }, { + name: 'tablet', + query: '(min-width: 480px) and (max-width: 839px)' + }, { + name: 'desktop', + query: '(min-width: 840px)' + }] + }; + exports.MEDIA_MODEL_HELPER = MEDIA_MODEL_HELPER; + var WHITE_LIST = (_WHITE_LIST = {}, _WHITE_LIST[ROW_ID] = ['row', 'start', 'center', 'end', 'around', 'between', 'nospace'], _WHITE_LIST[CELL_ID] = ['cell', '1', '2', '3', '4', '5', '6', '7', '8', '9', '10', '11', '12', 'top', 'middle', 'bottom', 'stretch', 'between', 'offset', 'nospace'], _WHITE_LIST); + exports.WHITE_LIST = WHITE_LIST; + +/***/ }), +/* 2 */ +/***/ (function(module, exports, __webpack_require__) { + + /** + * Copyright 2013-present, Facebook, Inc. + * All rights reserved. + * + * This source code is licensed under the BSD-style license found in the + * LICENSE file in the root directory of this source tree. An additional grant + * of patent rights can be found in the PATENTS file in the same directory. + */ + + if (true) { + var REACT_ELEMENT_TYPE = (typeof Symbol === 'function' && + Symbol.for && + Symbol.for('react.element')) || + 0xeac7; + + var isValidElement = function(object) { + return typeof object === 'object' && + object !== null && + object.$$typeof === REACT_ELEMENT_TYPE; + }; + + // By explicitly using `prop-types` you are opting into new development behavior. + // http://fb.me/prop-types-in-prod + var throwOnDirectAccess = true; + module.exports = __webpack_require__(52)(isValidElement, throwOnDirectAccess); + } else { + // By explicitly using `prop-types` you are opting into new production behavior. + // http://fb.me/prop-types-in-prod + module.exports = require('./factoryWithThrowingShims')(); + } + + +/***/ }), +/* 3 */ +/***/ (function(module, exports) { + + module.exports = __WEBPACK_EXTERNAL_MODULE_3__; + +/***/ }), +/* 4 */ +/***/ (function(module, exports) { + + /** + * Checks if `value` is the [language type](https://es5.github.io/#x8) of `Object`. + * (e.g. arrays, functions, objects, regexes, `new Number(0)`, and `new String('')`) + * + * @static + * @memberOf _ + * @category Lang + * @param {*} value The value to check. + * @returns {boolean} Returns `true` if `value` is an object, else `false`. + * @example + * + * _.isObject({}); + * // => true + * + * _.isObject([1, 2, 3]); + * // => true + * + * _.isObject(1); + * // => false + */ + 'use strict'; + + function isObject(value) { + // Avoid a V8 JIT bug in Chrome 19-20. + // See https://code.google.com/p/v8/issues/detail?id=2291 for more details. + var type = typeof value; + return !!value && (type == 'object' || type == 'function'); + } + + module.exports = isObject; + +/***/ }), +/* 5 */ +/***/ (function(module, exports) { + + 'use strict'; + + exports.__esModule = true; + exports.default = warning; + /** + * Prints a warning in the console if it exists. + * + * @param {String} message The warning message. + * @returns {void} + */ + function warning(message) { + /* eslint-disable no-console */ + if (typeof console !== 'undefined' && typeof console.error === 'function') { + console.error(message); + } + /* eslint-enable no-console */ + try { + // This error was thrown as a convenience so that if you enable + // "break on all exceptions" in your console, + // it would pause the execution at this line. + throw new Error(message); + /* eslint-disable no-empty */ + } catch (e) {} + /* eslint-enable no-empty */ + } + +/***/ }), +/* 6 */ +/***/ (function(module, exports) { + + /** + * Used as the [maximum length](http://ecma-international.org/ecma-262/6.0/#sec-number.max_safe_integer) + * of an array-like value. + */ + 'use strict'; + + var MAX_SAFE_INTEGER = 9007199254740991; + + /** + * Checks if `value` is a valid array-like length. + * + * **Note:** This function is based on [`ToLength`](http://ecma-international.org/ecma-262/6.0/#sec-tolength). + * + * @private + * @param {*} value The value to check. + * @returns {boolean} Returns `true` if `value` is a valid length, else `false`. + */ + function isLength(value) { + return typeof value == 'number' && value > -1 && value % 1 == 0 && value <= MAX_SAFE_INTEGER; + } + + module.exports = isLength; + +/***/ }), +/* 7 */ +/***/ (function(module, exports) { + + /** + * Checks if `value` is object-like. + * + * @private + * @param {*} value The value to check. + * @returns {boolean} Returns `true` if `value` is object-like, else `false`. + */ + 'use strict'; + + function isObjectLike(value) { + return !!value && typeof value == 'object'; + } + + module.exports = isObjectLike; + +/***/ }), +/* 8 */ +/***/ (function(module, exports, __webpack_require__) { + + 'use strict'; + + exports.__esModule = true; + + var _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; + + exports.hydrateMedia = hydrateMedia; + exports.updateMediaName = updateMediaName; + exports['default'] = media; + + var _constants = __webpack_require__(1); + + function hydrateMedia(_ref) { + var name = _ref.name; + + return { + name: name + }; + } + + function updateMediaName(payload) { + return { + type: _constants.UPDATE_MEDIA_NAME, + payload: payload + }; + } + + function media() { + var state = arguments.length <= 0 || arguments[0] === undefined ? {} : arguments[0]; + var action = arguments.length <= 1 || arguments[1] === undefined ? {} : arguments[1]; + + switch (action.type) { + case _constants.UPDATE_MEDIA_NAME: + return _extends({}, state, { + name: action.payload + }); + default: + return state; + } + } + +/***/ }), +/* 9 */ +/***/ (function(module, exports) { + + "use strict"; + + exports.__esModule = true; + exports["default"] = invariant; + + function invariant(condition, error) { + if (!condition) throw new Error(error); + } + + module.exports = exports["default"]; + +/***/ }), +/* 10 */ +/***/ (function(module, exports) { + + "use strict"; + + /** + * Copyright (c) 2013-present, Facebook, Inc. + * All rights reserved. + * + * This source code is licensed under the BSD-style license found in the + * LICENSE file in the root directory of this source tree. An additional grant + * of patent rights can be found in the PATENTS file in the same directory. + * + * + */ + + function makeEmptyFunction(arg) { + return function () { + return arg; + }; + } + + /** + * This function accepts and discards inputs; it has no side effects. This is + * primarily useful idiomatically for overridable function endpoints which + * always need to be callable, since JS lacks a null-call idiom ala Cocoa. + */ + var emptyFunction = function emptyFunction() {}; + + emptyFunction.thatReturns = makeEmptyFunction; + emptyFunction.thatReturnsFalse = makeEmptyFunction(false); + emptyFunction.thatReturnsTrue = makeEmptyFunction(true); + emptyFunction.thatReturnsNull = makeEmptyFunction(null); + emptyFunction.thatReturnsThis = function () { + return this; + }; + emptyFunction.thatReturnsArgument = function (arg) { + return arg; + }; + + module.exports = emptyFunction; + +/***/ }), +/* 11 */ +/***/ (function(module, exports, __webpack_require__) { + + /** + * Copyright (c) 2013-present, Facebook, Inc. + * All rights reserved. + * + * This source code is licensed under the BSD-style license found in the + * LICENSE file in the root directory of this source tree. An additional grant + * of patent rights can be found in the PATENTS file in the same directory. + * + */ + + 'use strict'; + + /** + * Use invariant() to assert state which your program assumes to be true. + * + * Provide sprintf-style format (only %s is supported) and arguments + * to provide information about what broke and what you were + * expecting. + * + * The invariant message will be stripped in production, but the invariant + * will remain to ensure logic does not differ in production. + */ + + var validateFormat = function validateFormat(format) {}; + + if (true) { + validateFormat = function validateFormat(format) { + if (format === undefined) { + throw new Error('invariant requires an error message argument'); + } + }; + } + + function invariant(condition, format, a, b, c, d, e, f) { + validateFormat(format); + + if (!condition) { + var error; + if (format === undefined) { + error = new Error('Minified exception occurred; use the non-minified dev environment ' + 'for the full error message and additional helpful warnings.'); + } else { + var args = [a, b, c, d, e, f]; + var argIndex = 0; + error = new Error(format.replace(/%s/g, function () { + return args[argIndex++]; + })); + error.name = 'Invariant Violation'; + } + + error.framesToPop = 1; // we don't care about invariant's own frame + throw error; + } + } + + module.exports = invariant; + +/***/ }), +/* 12 */ +/***/ (function(module, exports, __webpack_require__) { + + /** + * Copyright 2014-2015, Facebook, Inc. + * All rights reserved. + * + * This source code is licensed under the BSD-style license found in the + * LICENSE file in the root directory of this source tree. An additional grant + * of patent rights can be found in the PATENTS file in the same directory. + * + */ + + 'use strict'; + + var emptyFunction = __webpack_require__(10); + + /** + * Similar to invariant but only logs a warning if the condition is not met. + * This can be used to log issues in development environments in critical + * paths. Removing the logging code for production environments will keep the + * same logic and follow the same code paths. + */ + + var warning = emptyFunction; + + if (true) { + (function () { + var printWarning = function printWarning(format) { + for (var _len = arguments.length, args = Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) { + args[_key - 1] = arguments[_key]; + } + + var argIndex = 0; + var message = 'Warning: ' + format.replace(/%s/g, function () { + return args[argIndex++]; + }); + if (typeof console !== 'undefined') { + console.error(message); + } + try { + // --- Welcome to debugging React --- + // This error was thrown as a convenience so that you can use this stack + // to find the callsite that caused this warning to fire. + throw new Error(message); + } catch (x) {} + }; + + warning = function warning(condition, format) { + if (format === undefined) { + throw new Error('`warning(condition, format, ...args)` requires a warning ' + 'message argument'); + } + + if (format.indexOf('Failed Composite propType: ') === 0) { + return; // Ignore CompositeComponent proptype check. + } + + if (!condition) { + for (var _len2 = arguments.length, args = Array(_len2 > 2 ? _len2 - 2 : 0), _key2 = 2; _key2 < _len2; _key2++) { + args[_key2 - 2] = arguments[_key2]; + } + + printWarning.apply(undefined, [format].concat(args)); + } + }; + })(); + } + + module.exports = warning; + +/***/ }), +/* 13 */ +/***/ (function(module, exports) { + + /** + * Copyright 2013-present, Facebook, Inc. + * All rights reserved. + * + * This source code is licensed under the BSD-style license found in the + * LICENSE file in the root directory of this source tree. An additional grant + * of patent rights can be found in the PATENTS file in the same directory. + */ + + 'use strict'; + + var ReactPropTypesSecret = 'SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED'; + + module.exports = ReactPropTypesSecret; + + +/***/ }), +/* 14 */ +/***/ (function(module, exports, __webpack_require__) { + + 'use strict'; + + exports.__esModule = true; + + var _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; + + exports.default = connectAdvanced; + + var _hoistNonReactStatics = __webpack_require__(49); + + var _hoistNonReactStatics2 = _interopRequireDefault(_hoistNonReactStatics); + + var _invariant = __webpack_require__(50); + + var _invariant2 = _interopRequireDefault(_invariant); + + var _react = __webpack_require__(3); + + var _Subscription = __webpack_require__(60); + + var _Subscription2 = _interopRequireDefault(_Subscription); + + var _PropTypes = __webpack_require__(17); + + function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + + function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } + + function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; } + + function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; } + + function _objectWithoutProperties(obj, keys) { var target = {}; for (var i in obj) { if (keys.indexOf(i) >= 0) continue; if (!Object.prototype.hasOwnProperty.call(obj, i)) continue; target[i] = obj[i]; } return target; } + + var hotReloadingVersion = 0; + 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; + } + } + }; + + 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] : {}, + _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] = _PropTypes.storeShape, _contextTypes[subscriptionKey] = _PropTypes.subscriptionShape, _contextTypes); + var childContextTypes = (_childContextTypes = {}, _childContextTypes[subscriptionKey] = _PropTypes.subscriptionShape, _childContextTypes); + + return function wrapWithConnect(WrappedComponent) { + (0, _invariant2.default)(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); + + (0, _invariant2.default)(_this.store, 'Could not find "' + storeKey + '" in either the context or props of ' + ('"' + displayName + '". Either wrap the root component in a , ') + ('or explicitly pass "' + storeKey + '" as a prop to "' + displayName + '".')); + + _this.initSelector(); + _this.initSubscription(); + 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; + }; + + 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() { + (0, _invariant2.default)(withRef, 'To access the wrapped instance, you need to specify ' + ('{ withRef: true } in the options argument of the ' + methodName + '() call.')); + return this.wrappedInstance; + }; + + Connect.prototype.setWrappedInstance = function setWrappedInstance(ref) { + this.wrappedInstance = ref; + }; + + Connect.prototype.initSelector = function initSelector() { + var 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 _Subscription2.default(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); + } + }; + + 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 `componentDidMount` 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(); + }; + + 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 (0, _react.createElement)(WrappedComponent, this.addExtraProps(selector.props)); + } + }; + + return Connect; + }(_react.Component); + + Connect.WrappedComponent = WrappedComponent; + Connect.displayName = displayName; + Connect.childContextTypes = childContextTypes; + Connect.contextTypes = contextTypes; + Connect.propTypes = contextTypes; + + if (true) { + Connect.prototype.componentWillUpdate = function componentWillUpdate() { + // We are hot reloading! + if (this.version !== version) { + this.version = version; + this.initSelector(); + + if (this.subscription) this.subscription.tryUnsubscribe(); + this.initSubscription(); + if (shouldHandleStateChanges) this.subscription.trySubscribe(); + } + }; + } + + return (0, _hoistNonReactStatics2.default)(Connect, WrappedComponent); + }; + } + +/***/ }), +/* 15 */ +/***/ (function(module, exports, __webpack_require__) { + + 'use strict'; + + exports.__esModule = true; + exports.wrapMapToPropsConstant = wrapMapToPropsConstant; + exports.getDependsOnOwnProps = getDependsOnOwnProps; + exports.wrapMapToPropsFunc = wrapMapToPropsFunc; + + var _verifyPlainObject = __webpack_require__(18); + + var _verifyPlainObject2 = _interopRequireDefault(_verifyPlainObject); + + function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + + function wrapMapToPropsConstant(getConstant) { + return function initConstantSelector(dispatch, options) { + var constant = getConstant(dispatch, options); + + function constantSelector() { + return constant; + } + constantSelector.dependsOnOwnProps = false; + return constantSelector; + }; + } + + // dependsOnOwnProps is used by createMapToPropsProxy to determine whether to pass props as args + // to the mapToProps function being wrapped. It is also used by makePurePropsSelector to determine + // whether mapToProps needs to be invoked when props have changed. + // + // A length of one signals that mapToProps does not depend on props from the parent component. + // A length of zero is assumed to mean mapToProps is getting args via arguments or ...args and + // therefore not reporting its length accurately.. + function getDependsOnOwnProps(mapToProps) { + return mapToProps.dependsOnOwnProps !== null && mapToProps.dependsOnOwnProps !== undefined ? Boolean(mapToProps.dependsOnOwnProps) : mapToProps.length !== 1; + } + + // Used by whenMapStateToPropsIsFunction and whenMapDispatchToPropsIsFunction, + // this function wraps mapToProps in a proxy function which does several things: + // + // * Detects whether the mapToProps function being called depends on props, which + // is used by selectorFactory to decide if it should reinvoke on props changes. + // + // * On first call, handles mapToProps if returns another function, and treats that + // new function as the true mapToProps for subsequent calls. + // + // * On first call, verifies the first result is a plain object, in order to warn + // the developer that their mapToProps function is not returning a valid result. + // + function wrapMapToPropsFunc(mapToProps, methodName) { + return function initProxySelector(dispatch, _ref) { + var displayName = _ref.displayName; + + var proxy = function mapToPropsProxy(stateOrDispatch, ownProps) { + return proxy.dependsOnOwnProps ? proxy.mapToProps(stateOrDispatch, ownProps) : proxy.mapToProps(stateOrDispatch); + }; + + // 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); + } + + if (true) (0, _verifyPlainObject2.default)(props, displayName, methodName); + + return props; + }; + + return proxy; + }; + } + +/***/ }), +/* 16 */ +/***/ (function(module, exports, __webpack_require__) { + + 'use strict'; + + exports.__esModule = true; + exports.connect = exports.connectAdvanced = exports.Provider = undefined; + + var _Provider = __webpack_require__(53); + + var _Provider2 = _interopRequireDefault(_Provider); + + var _connectAdvanced = __webpack_require__(14); + + var _connectAdvanced2 = _interopRequireDefault(_connectAdvanced); + + var _connect = __webpack_require__(54); + + var _connect2 = _interopRequireDefault(_connect); + + function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + + exports.Provider = _Provider2.default; + exports.connectAdvanced = _connectAdvanced2.default; + exports.connect = _connect2.default; + +/***/ }), +/* 17 */ +/***/ (function(module, exports, __webpack_require__) { + + 'use strict'; + + exports.__esModule = true; + exports.storeShape = exports.subscriptionShape = undefined; + + var _propTypes = __webpack_require__(2); + + var _propTypes2 = _interopRequireDefault(_propTypes); + + function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + + var subscriptionShape = exports.subscriptionShape = _propTypes2.default.shape({ + trySubscribe: _propTypes2.default.func.isRequired, + tryUnsubscribe: _propTypes2.default.func.isRequired, + notifyNestedSubs: _propTypes2.default.func.isRequired, + isSubscribed: _propTypes2.default.func.isRequired + }); + + var storeShape = exports.storeShape = _propTypes2.default.shape({ + subscribe: _propTypes2.default.func.isRequired, + dispatch: _propTypes2.default.func.isRequired, + getState: _propTypes2.default.func.isRequired + }); + +/***/ }), +/* 18 */ +/***/ (function(module, exports, __webpack_require__) { + + 'use strict'; + + exports.__esModule = true; + exports.default = verifyPlainObject; + + var _isPlainObject = __webpack_require__(70); + + var _isPlainObject2 = _interopRequireDefault(_isPlainObject); + + var _warning = __webpack_require__(5); + + var _warning2 = _interopRequireDefault(_warning); + + function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + + function verifyPlainObject(value, displayName, methodName) { + if (!(0, _isPlainObject2.default)(value)) { + (0, _warning2.default)(methodName + '() in ' + displayName + ' must return a plain object. Instead received ' + value + '.'); + } + } + +/***/ }), +/* 19 */ +/***/ (function(module, exports, __webpack_require__) { + + var root = __webpack_require__(68); + + /** Built-in value references. */ + var Symbol = root.Symbol; + + module.exports = Symbol; + + +/***/ }), +/* 20 */ +/***/ (function(module, exports) { + + module.exports = __WEBPACK_EXTERNAL_MODULE_20__; + +/***/ }), +/* 21 */ +/***/ (function(module, exports) { + + /** + * Creates an array with all falsey values removed. The values `false`, `null`, + * `0`, `""`, `undefined`, and `NaN` are falsey. + * + * @static + * @memberOf _ + * @category Array + * @param {Array} array The array to compact. + * @returns {Array} Returns the new array of filtered values. + * @example + * + * _.compact([0, 1, false, 2, '', 3]); + * // => [1, 2, 3] + */ + "use strict"; + + function compact(array) { + var index = -1, + length = array ? array.length : 0, + resIndex = -1, + result = []; + + while (++index < length) { + var value = array[index]; + if (value) { + result[++resIndex] = value; + } + } + return result; + } + + module.exports = compact; + +/***/ }), +/* 22 */ +/***/ (function(module, exports, __webpack_require__) { + + 'use strict'; + + var toObject = __webpack_require__(30); + + /** + * The base implementation of `get` without support for string paths + * and default values. + * + * @private + * @param {Object} object The object to query. + * @param {Array} path The path of the property to get. + * @param {string} [pathKey] The key representation of path. + * @returns {*} Returns the resolved value. + */ + function baseGet(object, path, pathKey) { + if (object == null) { + return; + } + if (pathKey !== undefined && pathKey in toObject(object)) { + path = [pathKey]; + } + var index = 0, + length = path.length; + + while (object != null && index < length) { + object = object[path[index++]]; + } + return index && index == length ? object : undefined; + } + + module.exports = baseGet; + +/***/ }), +/* 23 */ +/***/ (function(module, exports) { + + /** + * The base implementation of `_.property` without support for deep paths. + * + * @private + * @param {string} key The key of the property to get. + * @returns {Function} Returns the new function. + */ + "use strict"; + + function baseProperty(key) { + return function (object) { + return object == null ? undefined : object[key]; + }; + } + + module.exports = baseProperty; + +/***/ }), +/* 24 */ +/***/ (function(module, exports) { + + /** + * Converts `value` to a string if it's not one. An empty string is returned + * for `null` or `undefined` values. + * + * @private + * @param {*} value The value to process. + * @returns {string} Returns the string. + */ + 'use strict'; + + function baseToString(value) { + return value == null ? '' : value + ''; + } + + module.exports = baseToString; + +/***/ }), +/* 25 */ +/***/ (function(module, exports, __webpack_require__) { + + 'use strict'; + + var baseProperty = __webpack_require__(23); + + /** + * Gets the "length" property value of `object`. + * + * **Note:** This function is used to avoid a [JIT bug](https://bugs.webkit.org/show_bug.cgi?id=142792) + * that affects Safari on at least iOS 8.1-8.3 ARM64. + * + * @private + * @param {Object} object The object to query. + * @returns {*} Returns the "length" value. + */ + var getLength = baseProperty('length'); + + module.exports = getLength; + +/***/ }), +/* 26 */ +/***/ (function(module, exports, __webpack_require__) { + + 'use strict'; + + var isNative = __webpack_require__(34); + + /** + * Gets the native function at `key` of `object`. + * + * @private + * @param {Object} object The object to query. + * @param {string} key The key of the method to get. + * @returns {*} Returns the function if it's native, else `undefined`. + */ + function getNative(object, key) { + var value = object == null ? undefined : object[key]; + return isNative(value) ? value : undefined; + } + + module.exports = getNative; + +/***/ }), +/* 27 */ +/***/ (function(module, exports, __webpack_require__) { + + 'use strict'; + + var getLength = __webpack_require__(25), + isLength = __webpack_require__(6); + + /** + * Checks if `value` is array-like. + * + * @private + * @param {*} value The value to check. + * @returns {boolean} Returns `true` if `value` is array-like, else `false`. + */ + function isArrayLike(value) { + return value != null && isLength(getLength(value)); + } + + module.exports = isArrayLike; + +/***/ }), +/* 28 */ +/***/ (function(module, exports) { + + /** Used to detect unsigned integer values. */ + 'use strict'; + + var reIsUint = /^\d+$/; + + /** + * Used as the [maximum length](http://ecma-international.org/ecma-262/6.0/#sec-number.max_safe_integer) + * of an array-like value. + */ + var MAX_SAFE_INTEGER = 9007199254740991; + + /** + * Checks if `value` is a valid array-like index. + * + * @private + * @param {*} value The value to check. + * @param {number} [length=MAX_SAFE_INTEGER] The upper bounds of a valid index. + * @returns {boolean} Returns `true` if `value` is a valid index, else `false`. + */ + function isIndex(value, length) { + value = typeof value == 'number' || reIsUint.test(value) ? +value : -1; + length = length == null ? MAX_SAFE_INTEGER : length; + return value > -1 && value % 1 == 0 && value < length; + } + + module.exports = isIndex; + +/***/ }), +/* 29 */ +/***/ (function(module, exports, __webpack_require__) { + + 'use strict'; + + var isArrayLike = __webpack_require__(27), + isIndex = __webpack_require__(28), + isObject = __webpack_require__(4); + + /** + * Checks if the provided arguments are from an iteratee call. + * + * @private + * @param {*} value The potential iteratee value argument. + * @param {*} index The potential iteratee index or key argument. + * @param {*} object The potential iteratee object argument. + * @returns {boolean} Returns `true` if the arguments are from an iteratee call, else `false`. + */ + function isIterateeCall(value, index, object) { + if (!isObject(object)) { + return false; + } + var type = typeof index; + if (type == 'number' ? isArrayLike(object) && isIndex(index, object.length) : type == 'string' && index in object) { + var other = object[index]; + return value === value ? value === other : other !== other; + } + return false; + } + + module.exports = isIterateeCall; + +/***/ }), +/* 30 */ +/***/ (function(module, exports, __webpack_require__) { + + 'use strict'; + + var isObject = __webpack_require__(4); + + /** + * Converts `value` to an object if it's not one. + * + * @private + * @param {*} value The value to process. + * @returns {Object} Returns the object. + */ + function toObject(value) { + return isObject(value) ? value : Object(value); + } + + module.exports = toObject; + +/***/ }), +/* 31 */ +/***/ (function(module, exports, __webpack_require__) { + + 'use strict'; + + var baseToString = __webpack_require__(24), + isArray = __webpack_require__(32); + + /** Used to match property names within property paths. */ + var rePropName = /[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\n\\]|\\.)*?)\2)\]/g; + + /** Used to match backslashes in property paths. */ + var reEscapeChar = /\\(\\)?/g; + + /** + * Converts `value` to property path array if it's not one. + * + * @private + * @param {*} value The value to process. + * @returns {Array} Returns the property path array. + */ + function toPath(value) { + if (isArray(value)) { + return value; + } + var result = []; + baseToString(value).replace(rePropName, function (match, number, quote, string) { + result.push(quote ? string.replace(reEscapeChar, '$1') : number || match); + }); + return result; + } + + module.exports = toPath; + +/***/ }), +/* 32 */ +/***/ (function(module, exports, __webpack_require__) { + + 'use strict'; + + var getNative = __webpack_require__(26), + isLength = __webpack_require__(6), + isObjectLike = __webpack_require__(7); + + /** `Object#toString` result references. */ + var arrayTag = '[object Array]'; + + /** Used for native method references. */ + var objectProto = Object.prototype; + + /** + * Used to resolve the [`toStringTag`](http://ecma-international.org/ecma-262/6.0/#sec-object.prototype.tostring) + * of values. + */ + var objToString = objectProto.toString; + + /* Native method references for those with the same name as other `lodash` methods. */ + var nativeIsArray = getNative(Array, 'isArray'); + + /** + * Checks if `value` is classified as an `Array` object. + * + * @static + * @memberOf _ + * @category Lang + * @param {*} value The value to check. + * @returns {boolean} Returns `true` if `value` is correctly classified, else `false`. + * @example + * + * _.isArray([1, 2, 3]); + * // => true + * + * _.isArray(function() { return arguments; }()); + * // => false + */ + var isArray = nativeIsArray || function (value) { + return isObjectLike(value) && isLength(value.length) && objToString.call(value) == arrayTag; + }; + + module.exports = isArray; + +/***/ }), +/* 33 */ +/***/ (function(module, exports, __webpack_require__) { + + 'use strict'; + + var isObject = __webpack_require__(4); + + /** `Object#toString` result references. */ + var funcTag = '[object Function]'; + + /** Used for native method references. */ + var objectProto = Object.prototype; + + /** + * Used to resolve the [`toStringTag`](http://ecma-international.org/ecma-262/6.0/#sec-object.prototype.tostring) + * of values. + */ + var objToString = objectProto.toString; + + /** + * Checks if `value` is classified as a `Function` object. + * + * @static + * @memberOf _ + * @category Lang + * @param {*} value The value to check. + * @returns {boolean} Returns `true` if `value` is correctly classified, else `false`. + * @example + * + * _.isFunction(_); + * // => true + * + * _.isFunction(/abc/); + * // => false + */ + function isFunction(value) { + // The use of `Object#toString` avoids issues with the `typeof` operator + // in older versions of Chrome and Safari which return 'function' for regexes + // and Safari 8 which returns 'object' for typed array constructors. + return isObject(value) && objToString.call(value) == funcTag; + } + + module.exports = isFunction; + +/***/ }), +/* 34 */ +/***/ (function(module, exports, __webpack_require__) { + + 'use strict'; + + var isFunction = __webpack_require__(33), + isObjectLike = __webpack_require__(7); + + /** Used to detect host constructors (Safari > 5). */ + var reIsHostCtor = /^\[object .+?Constructor\]$/; + + /** Used for native method references. */ + var objectProto = Object.prototype; + + /** Used to resolve the decompiled source of functions. */ + var fnToString = Function.prototype.toString; + + /** Used to check objects for own properties. */ + var hasOwnProperty = objectProto.hasOwnProperty; + + /** Used to detect if a method is native. */ + var reIsNative = RegExp('^' + fnToString.call(hasOwnProperty).replace(/[\\^$.*+?()[\]{}|]/g, '\\$&').replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g, '$1.*?') + '$'); + + /** + * Checks if `value` is a native function. + * + * @static + * @memberOf _ + * @category Lang + * @param {*} value The value to check. + * @returns {boolean} Returns `true` if `value` is a native function, else `false`. + * @example + * + * _.isNative(Array.prototype.push); + * // => true + * + * _.isNative(_); + * // => false + */ + function isNative(value) { + if (value == null) { + return false; + } + if (isFunction(value)) { + return reIsNative.test(fnToString.call(value)); + } + return isObjectLike(value) && reIsHostCtor.test(value); + } + + module.exports = isNative; + +/***/ }), +/* 35 */ +/***/ (function(module, exports, __webpack_require__) { + + 'use strict'; + + var baseGet = __webpack_require__(22), + toPath = __webpack_require__(31); + + /** + * Gets the property value at `path` of `object`. If the resolved value is + * `undefined` the `defaultValue` is used in its place. + * + * @static + * @memberOf _ + * @category Object + * @param {Object} object The object to query. + * @param {Array|string} path The path of the property to get. + * @param {*} [defaultValue] The value returned if the resolved value is `undefined`. + * @returns {*} Returns the resolved value. + * @example + * + * var object = { 'a': [{ 'b': { 'c': 3 } }] }; + * + * _.get(object, 'a[0].b.c'); + * // => 3 + * + * _.get(object, ['a', '0', 'b', 'c']); + * // => 3 + * + * _.get(object, 'a.b.c', 'default'); + * // => 'default' + */ + function get(object, path, defaultValue) { + var result = object == null ? undefined : baseGet(object, toPath(path), path + ''); + return result === undefined ? defaultValue : result; + } + + module.exports = get; + +/***/ }), +/* 36 */ +/***/ (function(module, exports, __webpack_require__) { + + 'use strict'; + + var isIterateeCall = __webpack_require__(29); + + /* Native method references for those with the same name as other `lodash` methods. */ + var nativeCeil = Math.ceil, + nativeMax = Math.max; + + /** + * Creates an array of numbers (positive and/or negative) progressing from + * `start` up to, but not including, `end`. If `end` is not specified it's + * set to `start` with `start` then set to `0`. If `end` is less than `start` + * a zero-length range is created unless a negative `step` is specified. + * + * @static + * @memberOf _ + * @category Utility + * @param {number} [start=0] The start of the range. + * @param {number} end The end of the range. + * @param {number} [step=1] The value to increment or decrement by. + * @returns {Array} Returns the new array of numbers. + * @example + * + * _.range(4); + * // => [0, 1, 2, 3] + * + * _.range(1, 5); + * // => [1, 2, 3, 4] + * + * _.range(0, 20, 5); + * // => [0, 5, 10, 15] + * + * _.range(0, -4, -1); + * // => [0, -1, -2, -3] + * + * _.range(1, 4, 0); + * // => [1, 1, 1] + * + * _.range(0); + * // => [] + */ + function range(start, end, step) { + if (step && isIterateeCall(start, end, step)) { + end = step = undefined; + } + start = +start || 0; + step = step == null ? 1 : +step || 0; + + if (end == null) { + end = start; + start = 0; + } else { + end = +end || 0; + } + // Use `Array(length)` so engines like Chakra and V8 avoid slower modes. + // See https://youtu.be/XAqIpGU8ZZk#t=17m25s for more details. + var index = -1, + length = nativeMax(nativeCeil((end - start) / (step || 1)), 0), + result = Array(length); + + while (++index < length) { + result[index] = start; + start += step; + } + return result; + } + + module.exports = range; + +/***/ }), +/* 37 */ +/***/ (function(module, exports, __webpack_require__) { + + 'use strict'; + + exports.__esModule = true; + + var _createClass = (function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ('value' in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; })(); + + exports.ensureValue = ensureValue; + exports.ensureListProperties = ensureListProperties; + exports.build = build; + exports.setMedia = setMedia; + exports.setReference = setReference; + + function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; } + + function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError('Cannot call a class as a function'); } } + + function _inherits(subClass, superClass) { if (typeof superClass !== 'function' && superClass !== null) { throw new TypeError('Super expression must either be null or a function, not ' + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; } + + var _react = __webpack_require__(3); + + var _react2 = _interopRequireDefault(_react); + + var _propTypes = __webpack_require__(2); + + var _propTypes2 = _interopRequireDefault(_propTypes); + + var _reactRedux = __webpack_require__(16); + + var _matchMedia = __webpack_require__(39); + + var _matchMedia2 = _interopRequireDefault(_matchMedia); + + var _store = __webpack_require__(41); + + var _store2 = _interopRequireDefault(_store); + + var _reducersMedia = __webpack_require__(8); + + var _constants = __webpack_require__(1); + + var _utilsInvariant = __webpack_require__(9); + + var _utilsInvariant2 = _interopRequireDefault(_utilsInvariant); + + var optionsShape = _propTypes2['default'].shape({ + columns: _propTypes2['default'].number, + gutter: _propTypes2['default'].number, + margin: _propTypes2['default'].number, + deaf: _propTypes2['default'].bool, + list: _propTypes2['default'].arrayOf(_propTypes2['default'].shape({ + name: _propTypes2['default'].string.isRequired, + query: _propTypes2['default'].string.isRequired, + gutter: _propTypes2['default'].number, + margin: _propTypes2['default'].number + })) + }); + + function ensureValue(options, base, key, value) { + if (true) { + _utilsInvariant2['default'](key, ' -> ensureValue -> key must be defined.'); + + _utilsInvariant2['default'](base, ' -> ensureValue -> base must be defined.'); + + _utilsInvariant2['default'](typeof base[key] !== 'undefined', ' -> ensureValue -> base -> key must be defined.'); + } + + if (value >= 0) return value; + var result = options && options[key] >= 0 ? options[key] : base[key]; + return result; + } + + function ensureListProperties(options, base, list) { + return list.map(function (n) { + var name = n.name; + var query = n.query; + var gutter = n.gutter; + var margin = n.margin; + + return { + name: name, + query: query, + gutter: ensureValue(options, base, 'gutter', gutter), + margin: ensureValue(options, base, 'margin', margin) + }; + }); + } + + function build() { + var options = arguments.length <= 0 || arguments[0] === undefined ? {} : arguments[0]; + var base = arguments.length <= 1 || arguments[1] === undefined ? {} : arguments[1]; + var columns = options.columns; + var _options$deaf = options.deaf; + var deaf = _options$deaf === undefined ? false : _options$deaf; + var _options$list = options.list; + var list = _options$list === undefined ? base.list : _options$list; + + var size = list.length; + + _utilsInvariant2['default'](!!size, ' -> options -> list can not be empty'); + + if (columns) { + _utilsInvariant2['default'](!(columns % size) > 0, ' -> options -> columns must be a multiple of ' + ' -> options -> list -> length'); + } + + return { + columns: columns || size * 4, + deaf: deaf, + list: ensureListProperties(options, base, list) + }; + } + + function setMedia(name) { + return { name: name }; + } + + function setReference(options) { + return { options: options }; + } + + var Grid = (function (_Component) { + _inherits(Grid, _Component); + + _createClass(Grid, null, [{ + key: 'propTypes', + value: { + options: optionsShape, + children: _propTypes2['default'].element.isRequired + }, + enumerable: true + }]); + + function Grid(props, context) { + _classCallCheck(this, Grid); + + _Component.call(this, props, context); + + // Initialize a new Model: + // If -> options is missing, it return a default Model. + // if -> options is provided, it return a valid Model. + var model = build(props.options, _constants.MEDIA_MODEL_HELPER); + + this.match = _matchMedia2['default'](model.list); + this.shouldSubscribe = model.deaf !== true; + + // Initialize Redux `store`. + var media = setMedia(this.match.getCurrentName); + var reference = setReference(model); + this.store = _store2['default']({ media: media, reference: reference }); + } + + Grid.prototype.componentDidMount = function componentDidMount() { + this.trySubscribe(); + }; + + Grid.prototype.componentWillUnmount = function componentWillUnmount() { + this.tryUnsubscribe(); + }; + + Grid.prototype.render = function render() { + return _react2['default'].createElement( + _reactRedux.Provider, + { store: this.store }, + _react.Children.only(this.props.children) + ); + }; + + Grid.prototype.trySubscribe = function trySubscribe() { + if (this.shouldSubscribe && !this.unsubscribe) { + this.unsubscribe = this.match.subscribe(this.handleChange.bind(this)); + } + }; + + Grid.prototype.tryUnsubscribe = function tryUnsubscribe() { + if (this.unsubscribe) { + this.unsubscribe(); + this.unsubscribe = null; + } + }; + + Grid.prototype.handleChange = function handleChange(payload) { + if (!this.unsubscribe) { + return; + } + this.store.dispatch(_reducersMedia.updateMediaName(payload)); + }; + + return Grid; + })(_react.Component); + + exports['default'] = Grid; + +/***/ }), +/* 38 */ +/***/ (function(module, exports, __webpack_require__) { + + 'use strict'; + + exports.__esModule = true; + + var _createClass = (function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ('value' in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; })(); + + var _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; + + exports['default'] = createComponent; + + function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; } + + function _objectWithoutProperties(obj, keys) { var target = {}; for (var i in obj) { if (keys.indexOf(i) >= 0) continue; if (!Object.prototype.hasOwnProperty.call(obj, i)) continue; target[i] = obj[i]; } return target; } + + function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError('Cannot call a class as a function'); } } + + function _inherits(subClass, superClass) { if (typeof superClass !== 'function' && superClass !== null) { throw new TypeError('Super expression must either be null or a function, not ' + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; } + + var _react = __webpack_require__(3); + + var _react2 = _interopRequireDefault(_react); + + var _propTypes = __webpack_require__(2); + + var _propTypes2 = _interopRequireDefault(_propTypes); + + var _reactRedux = __webpack_require__(16); + + var _utilsPick = __webpack_require__(48); + + var _utilsPick2 = _interopRequireDefault(_utilsPick); + + var mapStateToProps = function mapStateToProps(state) { + return _extends({}, state); + }; + + var mergeProps = function mergeProps(stateProps, dispatchProps, _ref) { + var is = _ref.is; + + var clean = _objectWithoutProperties(_ref, ['is']); + + return _extends({}, clean, { + grid: _extends({}, stateProps, { + is: is + }) + }); + }; + + var gridShape = _propTypes2['default'].shape({ + media: _propTypes2['default'].object.isRequired, + reference: _propTypes2['default'].object.isRequired, + is: _propTypes2['default'].string + }).isRequired; + + var elem = function elem(tag) { + return (function (_Component) { + _inherits(Elem, _Component); + + function Elem() { + _classCallCheck(this, Elem); + + _Component.apply(this, arguments); + } + + Elem.prototype.shouldComponentUpdate = function shouldComponentUpdate(nextProps) { + if (true) { + return true; + } + + if (false) { + return nextProps.grid.media.name !== this.props.grid.media.name || nextProps.grid.is !== this.props.grid.is; + } + }; + + Elem.prototype.render = function render() { + var _props = this.props; + var grid = _props.grid; + var children = _props.children; + + var clean = _objectWithoutProperties(_props, ['grid', 'children']); + + return _react2['default'].createElement( + 'div', + { style: _utilsPick2['default'](tag, grid) }, + _react.Children.map(children, function (child) { + return _react.cloneElement(child, _extends({}, clean)); + }) + ); + }; + + _createClass(Elem, null, [{ + key: 'propTypes', + value: { + grid: gridShape + }, + enumerable: true + }]); + + return Elem; + })(_react.Component); + }; + + function createComponent(tag) { + return _reactRedux.connect(mapStateToProps, null, mergeProps)(elem(tag)); + } + + module.exports = exports['default']; + +/***/ }), +/* 39 */ +/***/ (function(module, exports) { + + "use strict"; + + exports.__esModule = true; + exports["default"] = matchMedia; + + function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } + + function setModel(options) { + return options.map(function (n) { + var name = n.name; + var query = n.query; + + return { + name: name, + query: query + }; + }); + } + + function setState(model, handleChange) { + return model.map(function (_ref) { + var name = _ref.name; + var query = _ref.query; + + var match = window.matchMedia(query); + match.add = function () { + return match.addListener(handleChange); + }; + match.add(); + match.remove = function () { + return match.removeListener(handleChange); + }; + + return { + name: name, + match: match + }; + }); + } + + var MatchMedia = (function () { + function MatchMedia(list) { + _classCallCheck(this, MatchMedia); + + this.listeners = []; + this.state = []; + this.model = setModel(list.slice()); + + return this.updateState(); + } + + MatchMedia.prototype.handleChange = function handleChange() { + this.state.slice().forEach(function (_ref2) { + var match = _ref2.match; + return match.remove(); + }); + + return this.updateState(); + }; + + MatchMedia.prototype.updateState = function updateState() { + this.state = setState(this.model, this.handleChange.bind(this)); + + return this.dispatchUpdate(); + }; + + MatchMedia.prototype.getCurrentName = function getCurrentName() { + var current = this.state.filter(function (_ref3) { + var match = _ref3.match; + return match.matches; + }); + + var _ref4 = current.length > 0 ? current[0] : this.model[0]; + + var name = _ref4.name; + + return name; + }; + + MatchMedia.prototype.dispatchUpdate = function dispatchUpdate() { + var current = this.getCurrentName(); + return this.listeners.slice().forEach(function (listener) { + return listener(current); + }); + }; + + MatchMedia.prototype.subscribe = function subscribe(listener) { + this.listeners.push(listener); + + return function unsubscribe() { + if (this.listeners != null) { + var index = this.listeners.indexOf(listener); + this.listeners = this.listeners.slice(index, 1); + } + }; + }; + + return MatchMedia; + })(); + + function matchMedia(list) { + var mM = new MatchMedia(list); + + return { + subscribe: mM.subscribe.bind(mM), + getCurrentName: mM.getCurrentName() + }; + } + + module.exports = exports["default"]; + +/***/ }), +/* 40 */ +/***/ (function(module, exports, __webpack_require__) { + + 'use strict'; + + exports.__esModule = true; + + var _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; + + exports.hydrateReference = hydrateReference; + exports['default'] = reference; + + function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; } + + var _utilsIsUAFixNeeded = __webpack_require__(46); + + var _utilsIsUAFixNeeded2 = _interopRequireDefault(_utilsIsUAFixNeeded); + + var _utilsFixUserAgent = __webpack_require__(45); + + var _utilsFixUserAgent2 = _interopRequireDefault(_utilsFixUserAgent); + + var _utilsCalcPropWithGutter = __webpack_require__(43); + + var _utilsCalcPropWithGutter2 = _interopRequireDefault(_utilsCalcPropWithGutter); + + var _constants = __webpack_require__(1); + + var ROW_ROOT = { + display: 'flex', + flexFlow: 'row wrap', + alignItems: 'stretch' + }; + + var buildRow = function buildRow(id, FIXED_ROW, gutter, margin) { + var _ref; + + return _ref = {}, _ref[id] = _extends({}, FIXED_ROW, { + padding: margin - gutter / 2 + 'px' + }), _ref; + }; + + exports.buildRow = buildRow; + var buildRowTypeProperties = function buildRowTypeProperties(justifyContent) { + var _start, _center, _end, _around, _between; + + return { + start: (_start = {}, _start[justifyContent] = 'flex-start', _start), + center: (_center = {}, _center[justifyContent] = 'center', _center), + end: (_end = {}, _end[justifyContent] = 'flex-end', _end), + around: (_around = {}, _around[justifyContent] = 'space-around', _around), + between: (_between = {}, _between[justifyContent] = 'space-between', _between) + }; + }; + + exports.buildRowTypeProperties = buildRowTypeProperties; + var buildCell = function buildCell(id, gutter) { + var _ref2; + + return _ref2 = {}, _ref2[id] = { + boxSizing: 'border-box', + margin: gutter / 2 + 'px', + width: 'calc(100% - ' + gutter + 'px)' + }, _ref2; + }; + + exports.buildCell = buildCell; + var buildCellTypeProperties = function buildCellTypeProperties(alignSelf) { + var _top, _middle, _bottom, _stretch; + + return { + top: (_top = {}, _top[alignSelf] = 'flex-start', _top), + middle: (_middle = {}, _middle[alignSelf] = 'center', _middle), + bottom: (_bottom = {}, _bottom[alignSelf] = 'flex-end', _bottom), + stretch: (_stretch = {}, _stretch[alignSelf] = 'stretch', _stretch) + }; + }; + + exports.buildCellTypeProperties = buildCellTypeProperties; + var buildSharedProperties = function buildSharedProperties() { + return { + nospace: { padding: 0, margin: 0 } + }; + }; + + exports.buildSharedProperties = buildSharedProperties; + + function hydrateReference(_ref3) { + var options = _ref3.options; + var columns = options.columns; + var list = options.list; + + var size = list.length; + + return list.reduce(function (acc, current, i) { + var _extends2; + + var name = current.name; + var gutter = current.gutter; + var margin = current.margin; + + var _fixUserAgent = _utilsFixUserAgent2['default'](ROW_ROOT, _utilsIsUAFixNeeded2['default'](navigator.userAgent)); + + var justifyContent = _fixUserAgent.justifyContent; + var alignSelf = _fixUserAgent.alignSelf; + var FIXED_ROW = _fixUserAgent.FIXED_ROW; + + // 4 + // 8 + // 12 + var localColumns = columns / size * (i + 1); + + // Define partial sizes for columnNumber < totalColumns. + var partialWidth = _utilsCalcPropWithGutter2['default']([1, localColumns, gutter], 'width'); + + // Define sizes = 100% for everything else. + var fullWidth = _utilsCalcPropWithGutter2['default']([localColumns, columns + 1, gutter], 'width', true); + + // Define offset sizes. + var offset = _utilsCalcPropWithGutter2['default']([0, localColumns, gutter / 2], 'marginLeft'); + + var row = buildRow(_constants.ROW_ID, FIXED_ROW, gutter, margin); + var rowTypeProperties = buildRowTypeProperties(justifyContent); + + var cell = buildCell(_constants.CELL_ID, gutter); + var cellTypeProperties = buildCellTypeProperties(alignSelf); + + var sharedProperties = buildSharedProperties(); + + return _extends({}, acc, (_extends2 = {}, _extends2[name] = _extends({}, row, rowTypeProperties, cell, cellTypeProperties, partialWidth, fullWidth, sharedProperties, { + offset: _extends({}, offset) + }), _extends2)); + }, {}); + } + + function reference() { + var state = arguments.length <= 0 || arguments[0] === undefined ? {} : arguments[0]; + + return state; + } + +/***/ }), +/* 41 */ +/***/ (function(module, exports, __webpack_require__) { + + 'use strict'; + + exports.__esModule = true; + exports['default'] = store; + + function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; } + + var _redux = __webpack_require__(20); + + var _reducersMedia = __webpack_require__(8); + + var _reducersMedia2 = _interopRequireDefault(_reducersMedia); + + var _reducersReference = __webpack_require__(40); + + var _reducersReference2 = _interopRequireDefault(_reducersReference); + + function store(initialState) { + return _redux.createStore(_redux.combineReducers({ media: _reducersMedia2['default'], reference: _reducersReference2['default'] }), { + media: _reducersMedia.hydrateMedia(initialState.media), + reference: _reducersReference.hydrateReference(initialState.reference) + }); + } + + module.exports = exports['default']; + +/***/ }), +/* 42 */ +/***/ (function(module, exports) { + + "use strict"; + + exports.__esModule = true; + exports["default"] = {}; + module.exports = exports["default"]; + +/***/ }), +/* 43 */ +/***/ (function(module, exports, __webpack_require__) { + + 'use strict'; + + exports.__esModule = true; + exports['default'] = calcPropWithGutter; + + function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; } + + var _lodashUtilityRange = __webpack_require__(36); + + var _lodashUtilityRange2 = _interopRequireDefault(_lodashUtilityRange); + + function calcPropWithGutter(_ref, prop, isFull) { + var start = _ref[0]; + var end = _ref[1]; + var gutter = _ref[2]; + + return _lodashUtilityRange2['default'](start, end).reduce(function (acc, n) { + var _acc$n; + + var width = isFull ? 100 : n / end * 100; + acc[n] = (_acc$n = {}, _acc$n[prop] = 'calc(' + width + '% - ' + gutter + 'px)', _acc$n); + return acc; + }, {}); + } + + module.exports = exports['default']; + +/***/ }), +/* 44 */ +/***/ (function(module, exports) { + + "use strict"; + + exports.__esModule = true; + exports["default"] = capitalize; + + function capitalize(string) { + return string.charAt(0).toUpperCase() + string.slice(1); + } + + module.exports = exports["default"]; + +/***/ }), +/* 45 */ +/***/ (function(module, exports) { + + 'use strict'; + + exports.__esModule = true; + exports['default'] = fixUserAgent; + + function fixUserAgent(rowRoot, needFix) { + var justifyContent = needFix ? 'WebkitJustifyContent' : 'justifyContent'; + + var alignSelf = needFix ? 'WebkitAlignSelf' : 'alignSelf'; + + var FIXED_ROW = needFix ? { + display: '-webkit-flex', + WebkitFlexFlow: 'row wrap', + WebkitAlignItems: 'stretch' + } : rowRoot; + + return { + justifyContent: justifyContent, + alignSelf: alignSelf, + FIXED_ROW: FIXED_ROW + }; + } + + module.exports = exports['default']; + +/***/ }), +/* 46 */ +/***/ (function(module, exports) { + + 'use strict'; + + exports.__esModule = true; + exports['default'] = isUAFixNeeded; + + function isUAFixNeeded(userAgent) { + return userAgent.indexOf('Chrome') < 0 && userAgent.indexOf('Safari') > -1; + } + + module.exports = exports['default']; + +/***/ }), +/* 47 */ +/***/ (function(module, exports, __webpack_require__) { + + 'use strict'; + + exports.__esModule = true; + exports['default'] = memoize; + + function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; } + + var _cache = __webpack_require__(42); + + var _cache2 = _interopRequireDefault(_cache); + + function memoize(callback) { + return function getInMemory(key) { + if (!_cache2['default'].hasOwnProperty(key)) { + _cache2['default'][key] = callback.call(this, key); + } + return _cache2['default'][key]; + }; + } + + module.exports = exports['default']; + +/***/ }), +/* 48 */ +/***/ (function(module, exports, __webpack_require__) { + + 'use strict'; + + exports.__esModule = true; + + var _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; + + exports['default'] = pick; + + function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; } + + var _lodashArrayCompact = __webpack_require__(21); + + var _lodashArrayCompact2 = _interopRequireDefault(_lodashArrayCompact); + + var _lodashObjectGet = __webpack_require__(35); + + var _lodashObjectGet2 = _interopRequireDefault(_lodashObjectGet); + + var _memoize = __webpack_require__(47); + + var _memoize2 = _interopRequireDefault(_memoize); + + var _invariant = __webpack_require__(9); + + var _invariant2 = _interopRequireDefault(_invariant); + + var _capitalize = __webpack_require__(44); + + var _capitalize2 = _interopRequireDefault(_capitalize); + + var _constants = __webpack_require__(1); + + var parser = function parser(initial, input) { + if (input && input.trim()) { + return [initial].concat(input.trim().split(/\s+/)); + } + return [initial]; + }; + + exports.parser = parser; + var listReducer = function listReducer(name) { + var list = arguments.length <= 1 || arguments[1] === undefined ? [] : arguments[1]; + + return _lodashArrayCompact2['default'](list.map(function (n) { + var _n$split = n.split('-'); + + var entry = _n$split[0]; + + var value = _n$split.slice(1); + + switch (value.length) { + case 0: + return entry; + case 1: + if (entry === 'offset') { + return [entry].concat(value); + } + if (entry !== name) return false; + return value[0]; + case 2: + if (entry !== name) return false; + if (value[0] === 'offset') { + return value; + } + return false; + default: + return false; + } + })); + }; + + exports.listReducer = listReducer; + var generatePayload = function generatePayload(_ref, list) { + var name = _ref.name; + + return { + name: name, + list: listReducer(name, list) + }; + }; + + exports.generatePayload = generatePayload; + var reducePayload = function reducePayload(_ref2, reference) { + var name = _ref2.name; + var list = _ref2.list; + + return list.reduce(function (acc, current) { + var style = _lodashObjectGet2['default'](reference, [name].concat(current)); + return _extends({}, acc, style); + }, {}); + }; + + exports.reducePayload = reducePayload; + var getInReference = function getInReference(tag, _ref3) { + var media = _ref3.media; + var reference = _ref3.reference; + var is = _ref3.is; + + var list = parser(tag, is); + var payload = generatePayload(media, list); + + if (true) { + payload.list.forEach(function (n) { + var value = Array.isArray(n) ? n[0] : n; + _invariant2['default'](_constants.WHITE_LIST[tag].indexOf(value) > -1, 'Property \'' + value + '\' is not allowed for <' + _capitalize2['default'](tag) + '> component.'); + }); + } + + return reducePayload(payload, reference); + }; + + exports.getInReference = getInReference; + var memoizeProcess = function memoizeProcess() { + for (var _len = arguments.length, arg = Array(_len), _key = 0; _key < _len; _key++) { + arg[_key] = arguments[_key]; + } + + return _memoize2['default'](function () { + return getInReference.apply(undefined, arg); + }); + }; + + exports.memoizeProcess = memoizeProcess; + var generateKey = function generateKey(tag, _ref4) { + var name = _ref4.media.name; + var is = _ref4.is; + return '' + tag + name + is; + }; + + exports.generateKey = generateKey; + + function pick() { + var key = generateKey.apply(undefined, arguments); + + return memoizeProcess.apply(undefined, arguments)(key); + } + +/***/ }), +/* 49 */ +/***/ (function(module, exports) { + + /** + * Copyright 2015, Yahoo! Inc. + * Copyrights licensed under the New BSD License. See the accompanying LICENSE file for terms. + */ + 'use strict'; + + var REACT_STATICS = { + childContextTypes: true, + contextTypes: true, + defaultProps: true, + displayName: true, + getDefaultProps: true, + mixins: true, + propTypes: true, + type: true + }; + + var KNOWN_STATICS = { + name: true, + length: true, + prototype: true, + caller: true, + arguments: true, + arity: true + }; + + var isGetOwnPropertySymbolsAvailable = typeof Object.getOwnPropertySymbols === 'function'; + + module.exports = function hoistNonReactStatics(targetComponent, sourceComponent, customStatics) { + if (typeof sourceComponent !== 'string') { // don't hoist over string (html) components + var keys = Object.getOwnPropertyNames(sourceComponent); + + /* istanbul ignore else */ + if (isGetOwnPropertySymbolsAvailable) { + keys = keys.concat(Object.getOwnPropertySymbols(sourceComponent)); + } + + for (var i = 0; i < keys.length; ++i) { + if (!REACT_STATICS[keys[i]] && !KNOWN_STATICS[keys[i]] && (!customStatics || !customStatics[keys[i]])) { + try { + targetComponent[keys[i]] = sourceComponent[keys[i]]; + } catch (error) { + + } + } + } + } + + return targetComponent; + }; + + +/***/ }), +/* 50 */ +/***/ (function(module, exports, __webpack_require__) { + + /** + * Copyright 2013-2015, Facebook, Inc. + * All rights reserved. + * + * This source code is licensed under the BSD-style license found in the + * LICENSE file in the root directory of this source tree. An additional grant + * of patent rights can be found in the PATENTS file in the same directory. + */ + + 'use strict'; + + /** + * Use invariant() to assert state which your program assumes to be true. + * + * Provide sprintf-style format (only %s is supported) and arguments + * to provide information about what broke and what you were + * expecting. + * + * The invariant message will be stripped in production, but the invariant + * will remain to ensure logic does not differ in production. + */ + + var invariant = function(condition, format, a, b, c, d, e, f) { + if (true) { + if (format === undefined) { + throw new Error('invariant requires an error message argument'); + } + } + + if (!condition) { + var error; + if (format === undefined) { + error = new Error( + 'Minified exception occurred; use the non-minified dev environment ' + + 'for the full error message and additional helpful warnings.' + ); + } else { + var args = [a, b, c, d, e, f]; + var argIndex = 0; + error = new Error( + format.replace(/%s/g, function() { return args[argIndex++]; }) + ); + error.name = 'Invariant Violation'; + } + + error.framesToPop = 1; // we don't care about invariant's own frame + throw error; + } + }; + + module.exports = invariant; + + +/***/ }), +/* 51 */ +/***/ (function(module, exports, __webpack_require__) { + + /** + * Copyright 2013-present, Facebook, Inc. + * All rights reserved. + * + * This source code is licensed under the BSD-style license found in the + * LICENSE file in the root directory of this source tree. An additional grant + * of patent rights can be found in the PATENTS file in the same directory. + */ + + 'use strict'; + + if (true) { + var invariant = __webpack_require__(11); + var warning = __webpack_require__(12); + var ReactPropTypesSecret = __webpack_require__(13); + var loggedTypeFailures = {}; + } + + /** + * Assert that the values match with the type specs. + * Error messages are memorized and will only be shown once. + * + * @param {object} typeSpecs Map of name to a ReactPropType + * @param {object} values Runtime values that need to be type-checked + * @param {string} location e.g. "prop", "context", "child context" + * @param {string} componentName Name of the component for error messages. + * @param {?Function} getStack Returns the component stack. + * @private + */ + function checkPropTypes(typeSpecs, values, location, componentName, getStack) { + if (true) { + for (var typeSpecName in typeSpecs) { + if (typeSpecs.hasOwnProperty(typeSpecName)) { + var error; + // Prop type validation may throw. In case they do, we don't want to + // fail the render phase where it didn't fail before. So we log it. + // After these have been cleaned up, we'll let them throw. + try { + // This is intentionally an invariant that gets caught. It's the same + // behavior as without this statement except with a better message. + invariant(typeof typeSpecs[typeSpecName] === 'function', '%s: %s type `%s` is invalid; it must be a function, usually from ' + 'React.PropTypes.', componentName || 'React class', location, typeSpecName); + error = typeSpecs[typeSpecName](values, typeSpecName, componentName, location, null, ReactPropTypesSecret); + } catch (ex) { + error = ex; + } + warning(!error || error instanceof Error, '%s: type specification of %s `%s` is invalid; the type checker ' + 'function must return `null` or an `Error` but returned a %s. ' + 'You may have forgotten to pass an argument to the type checker ' + 'creator (arrayOf, instanceOf, objectOf, oneOf, oneOfType, and ' + 'shape all require an argument).', componentName || 'React class', location, typeSpecName, typeof error); + if (error instanceof Error && !(error.message in loggedTypeFailures)) { + // Only monitor this failure once because there tends to be a lot of the + // same error. + loggedTypeFailures[error.message] = true; + + var stack = getStack ? getStack() : ''; + + warning(false, 'Failed %s type: %s%s', location, error.message, stack != null ? stack : ''); + } + } + } + } + } + + module.exports = checkPropTypes; + + +/***/ }), +/* 52 */ +/***/ (function(module, exports, __webpack_require__) { + + /** + * Copyright 2013-present, Facebook, Inc. + * All rights reserved. + * + * This source code is licensed under the BSD-style license found in the + * LICENSE file in the root directory of this source tree. An additional grant + * of patent rights can be found in the PATENTS file in the same directory. + */ + + 'use strict'; + + var emptyFunction = __webpack_require__(10); + var invariant = __webpack_require__(11); + var warning = __webpack_require__(12); + + var ReactPropTypesSecret = __webpack_require__(13); + var checkPropTypes = __webpack_require__(51); + + module.exports = function(isValidElement, throwOnDirectAccess) { + /* global Symbol */ + var ITERATOR_SYMBOL = typeof Symbol === 'function' && Symbol.iterator; + var FAUX_ITERATOR_SYMBOL = '@@iterator'; // Before Symbol spec. + + /** + * Returns the iterator method function contained on the iterable object. + * + * Be sure to invoke the function with the iterable as context: + * + * var iteratorFn = getIteratorFn(myIterable); + * if (iteratorFn) { + * var iterator = iteratorFn.call(myIterable); + * ... + * } + * + * @param {?object} maybeIterable + * @return {?function} + */ + function getIteratorFn(maybeIterable) { + var iteratorFn = maybeIterable && (ITERATOR_SYMBOL && maybeIterable[ITERATOR_SYMBOL] || maybeIterable[FAUX_ITERATOR_SYMBOL]); + if (typeof iteratorFn === 'function') { + return iteratorFn; + } + } + + /** + * Collection of methods that allow declaration and validation of props that are + * supplied to React components. Example usage: + * + * var Props = require('ReactPropTypes'); + * var MyArticle = React.createClass({ + * propTypes: { + * // An optional string prop named "description". + * description: Props.string, + * + * // A required enum prop named "category". + * category: Props.oneOf(['News','Photos']).isRequired, + * + * // A prop named "dialog" that requires an instance of Dialog. + * dialog: Props.instanceOf(Dialog).isRequired + * }, + * render: function() { ... } + * }); + * + * A more formal specification of how these methods are used: + * + * type := array|bool|func|object|number|string|oneOf([...])|instanceOf(...) + * decl := ReactPropTypes.{type}(.isRequired)? + * + * Each and every declaration produces a function with the same signature. This + * allows the creation of custom validation functions. For example: + * + * var MyLink = React.createClass({ + * propTypes: { + * // An optional string or URI prop named "href". + * href: function(props, propName, componentName) { + * var propValue = props[propName]; + * if (propValue != null && typeof propValue !== 'string' && + * !(propValue instanceof URI)) { + * return new Error( + * 'Expected a string or an URI for ' + propName + ' in ' + + * componentName + * ); + * } + * } + * }, + * render: function() {...} + * }); + * + * @internal + */ + + var ANONYMOUS = '<>'; + + // Important! + // Keep this list in sync with production version in `./factoryWithThrowingShims.js`. + var ReactPropTypes = { + array: createPrimitiveTypeChecker('array'), + bool: createPrimitiveTypeChecker('boolean'), + func: createPrimitiveTypeChecker('function'), + number: createPrimitiveTypeChecker('number'), + object: createPrimitiveTypeChecker('object'), + string: createPrimitiveTypeChecker('string'), + symbol: createPrimitiveTypeChecker('symbol'), + + any: createAnyTypeChecker(), + arrayOf: createArrayOfTypeChecker, + element: createElementTypeChecker(), + instanceOf: createInstanceTypeChecker, + node: createNodeChecker(), + objectOf: createObjectOfTypeChecker, + oneOf: createEnumTypeChecker, + oneOfType: createUnionTypeChecker, + shape: createShapeTypeChecker + }; + + /** + * inlined Object.is polyfill to avoid requiring consumers ship their own + * https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/is + */ + /*eslint-disable no-self-compare*/ + function is(x, y) { + // SameValue algorithm + if (x === y) { + // Steps 1-5, 7-10 + // Steps 6.b-6.e: +0 != -0 + return x !== 0 || 1 / x === 1 / y; + } else { + // Step 6.a: NaN == NaN + return x !== x && y !== y; + } + } + /*eslint-enable no-self-compare*/ + + /** + * We use an Error-like object for backward compatibility as people may call + * PropTypes directly and inspect their output. However, we don't use real + * Errors anymore. We don't inspect their stack anyway, and creating them + * is prohibitively expensive if they are created too often, such as what + * happens in oneOfType() for any type before the one that matched. + */ + function PropTypeError(message) { + this.message = message; + this.stack = ''; + } + // Make `instanceof Error` still work for returned errors. + PropTypeError.prototype = Error.prototype; + + function createChainableTypeChecker(validate) { + if (true) { + var manualPropTypeCallCache = {}; + var manualPropTypeWarningCount = 0; + } + function checkType(isRequired, props, propName, componentName, location, propFullName, secret) { + componentName = componentName || ANONYMOUS; + propFullName = propFullName || propName; + + if (secret !== ReactPropTypesSecret) { + if (throwOnDirectAccess) { + // New behavior only for users of `prop-types` package + invariant( + false, + 'Calling PropTypes validators directly is not supported by the `prop-types` package. ' + + 'Use `PropTypes.checkPropTypes()` to call them. ' + + 'Read more at http://fb.me/use-check-prop-types' + ); + } else if (("development") !== 'production' && typeof console !== 'undefined') { + // Old behavior for people using React.PropTypes + var cacheKey = componentName + ':' + propName; + if ( + !manualPropTypeCallCache[cacheKey] && + // Avoid spamming the console because they are often not actionable except for lib authors + manualPropTypeWarningCount < 3 + ) { + warning( + false, + 'You are manually calling a React.PropTypes validation ' + + 'function for the `%s` prop on `%s`. This is deprecated ' + + 'and will throw in the standalone `prop-types` package. ' + + 'You may be seeing this warning due to a third-party PropTypes ' + + 'library. See https://fb.me/react-warning-dont-call-proptypes ' + 'for details.', + propFullName, + componentName + ); + manualPropTypeCallCache[cacheKey] = true; + manualPropTypeWarningCount++; + } + } + } + if (props[propName] == null) { + if (isRequired) { + if (props[propName] === null) { + return new PropTypeError('The ' + location + ' `' + propFullName + '` is marked as required ' + ('in `' + componentName + '`, but its value is `null`.')); + } + return new PropTypeError('The ' + location + ' `' + propFullName + '` is marked as required in ' + ('`' + componentName + '`, but its value is `undefined`.')); + } + return null; + } else { + return validate(props, propName, componentName, location, propFullName); + } + } + + var chainedCheckType = checkType.bind(null, false); + chainedCheckType.isRequired = checkType.bind(null, true); + + return chainedCheckType; + } + + function createPrimitiveTypeChecker(expectedType) { + function validate(props, propName, componentName, location, propFullName, secret) { + var propValue = props[propName]; + var propType = getPropType(propValue); + if (propType !== expectedType) { + // `propValue` being instance of, say, date/regexp, pass the 'object' + // check, but we can offer a more precise error message here rather than + // 'of type `object`'. + var preciseType = getPreciseType(propValue); + + return new PropTypeError('Invalid ' + location + ' `' + propFullName + '` of type ' + ('`' + preciseType + '` supplied to `' + componentName + '`, expected ') + ('`' + expectedType + '`.')); + } + return null; + } + return createChainableTypeChecker(validate); + } + + function createAnyTypeChecker() { + return createChainableTypeChecker(emptyFunction.thatReturnsNull); + } + + function createArrayOfTypeChecker(typeChecker) { + function validate(props, propName, componentName, location, propFullName) { + if (typeof typeChecker !== 'function') { + return new PropTypeError('Property `' + propFullName + '` of component `' + componentName + '` has invalid PropType notation inside arrayOf.'); + } + var propValue = props[propName]; + if (!Array.isArray(propValue)) { + var propType = getPropType(propValue); + return new PropTypeError('Invalid ' + location + ' `' + propFullName + '` of type ' + ('`' + propType + '` supplied to `' + componentName + '`, expected an array.')); + } + for (var i = 0; i < propValue.length; i++) { + var error = typeChecker(propValue, i, componentName, location, propFullName + '[' + i + ']', ReactPropTypesSecret); + if (error instanceof Error) { + return error; + } + } + return null; + } + return createChainableTypeChecker(validate); + } + + function createElementTypeChecker() { + function validate(props, propName, componentName, location, propFullName) { + var propValue = props[propName]; + if (!isValidElement(propValue)) { + var propType = getPropType(propValue); + return new PropTypeError('Invalid ' + location + ' `' + propFullName + '` of type ' + ('`' + propType + '` supplied to `' + componentName + '`, expected a single ReactElement.')); + } + return null; + } + return createChainableTypeChecker(validate); + } + + function createInstanceTypeChecker(expectedClass) { + function validate(props, propName, componentName, location, propFullName) { + if (!(props[propName] instanceof expectedClass)) { + var expectedClassName = expectedClass.name || ANONYMOUS; + var actualClassName = getClassName(props[propName]); + return new PropTypeError('Invalid ' + location + ' `' + propFullName + '` of type ' + ('`' + actualClassName + '` supplied to `' + componentName + '`, expected ') + ('instance of `' + expectedClassName + '`.')); + } + return null; + } + return createChainableTypeChecker(validate); + } + + function createEnumTypeChecker(expectedValues) { + if (!Array.isArray(expectedValues)) { + true ? warning(false, 'Invalid argument supplied to oneOf, expected an instance of array.') : void 0; + return emptyFunction.thatReturnsNull; + } + + function validate(props, propName, componentName, location, propFullName) { + var propValue = props[propName]; + for (var i = 0; i < expectedValues.length; i++) { + if (is(propValue, expectedValues[i])) { + return null; + } + } + + var valuesString = JSON.stringify(expectedValues); + return new PropTypeError('Invalid ' + location + ' `' + propFullName + '` of value `' + propValue + '` ' + ('supplied to `' + componentName + '`, expected one of ' + valuesString + '.')); + } + return createChainableTypeChecker(validate); + } + + function createObjectOfTypeChecker(typeChecker) { + function validate(props, propName, componentName, location, propFullName) { + if (typeof typeChecker !== 'function') { + return new PropTypeError('Property `' + propFullName + '` of component `' + componentName + '` has invalid PropType notation inside objectOf.'); + } + var propValue = props[propName]; + var propType = getPropType(propValue); + if (propType !== 'object') { + return new PropTypeError('Invalid ' + location + ' `' + propFullName + '` of type ' + ('`' + propType + '` supplied to `' + componentName + '`, expected an object.')); + } + for (var key in propValue) { + if (propValue.hasOwnProperty(key)) { + var error = typeChecker(propValue, key, componentName, location, propFullName + '.' + key, ReactPropTypesSecret); + if (error instanceof Error) { + return error; + } + } + } + return null; + } + return createChainableTypeChecker(validate); + } + + function createUnionTypeChecker(arrayOfTypeCheckers) { + if (!Array.isArray(arrayOfTypeCheckers)) { + true ? warning(false, 'Invalid argument supplied to oneOfType, expected an instance of array.') : void 0; + return emptyFunction.thatReturnsNull; + } + + function validate(props, propName, componentName, location, propFullName) { + for (var i = 0; i < arrayOfTypeCheckers.length; i++) { + var checker = arrayOfTypeCheckers[i]; + if (checker(props, propName, componentName, location, propFullName, ReactPropTypesSecret) == null) { + return null; + } + } + + return new PropTypeError('Invalid ' + location + ' `' + propFullName + '` supplied to ' + ('`' + componentName + '`.')); + } + return createChainableTypeChecker(validate); + } + + function createNodeChecker() { + function validate(props, propName, componentName, location, propFullName) { + if (!isNode(props[propName])) { + return new PropTypeError('Invalid ' + location + ' `' + propFullName + '` supplied to ' + ('`' + componentName + '`, expected a ReactNode.')); + } + return null; + } + return createChainableTypeChecker(validate); + } + + function createShapeTypeChecker(shapeTypes) { + function validate(props, propName, componentName, location, propFullName) { + var propValue = props[propName]; + var propType = getPropType(propValue); + if (propType !== 'object') { + return new PropTypeError('Invalid ' + location + ' `' + propFullName + '` of type `' + propType + '` ' + ('supplied to `' + componentName + '`, expected `object`.')); + } + for (var key in shapeTypes) { + var checker = shapeTypes[key]; + if (!checker) { + continue; + } + var error = checker(propValue, key, componentName, location, propFullName + '.' + key, ReactPropTypesSecret); + if (error) { + return error; + } + } + return null; + } + return createChainableTypeChecker(validate); + } + + function isNode(propValue) { + switch (typeof propValue) { + case 'number': + case 'string': + case 'undefined': + return true; + case 'boolean': + return !propValue; + case 'object': + if (Array.isArray(propValue)) { + return propValue.every(isNode); + } + if (propValue === null || isValidElement(propValue)) { + return true; + } + + var iteratorFn = getIteratorFn(propValue); + if (iteratorFn) { + var iterator = iteratorFn.call(propValue); + var step; + if (iteratorFn !== propValue.entries) { + while (!(step = iterator.next()).done) { + if (!isNode(step.value)) { + return false; + } + } + } else { + // Iterator will provide entry [k,v] tuples rather than values. + while (!(step = iterator.next()).done) { + var entry = step.value; + if (entry) { + if (!isNode(entry[1])) { + return false; + } + } + } + } + } else { + return false; + } + + return true; + default: + return false; + } + } + + function isSymbol(propType, propValue) { + // Native Symbol. + if (propType === 'symbol') { + return true; + } + + // 19.4.3.5 Symbol.prototype[@@toStringTag] === 'Symbol' + if (propValue['@@toStringTag'] === 'Symbol') { + return true; + } + + // Fallback for non-spec compliant Symbols which are polyfilled. + if (typeof Symbol === 'function' && propValue instanceof Symbol) { + return true; + } + + return false; + } + + // Equivalent of `typeof` but with special handling for array and regexp. + function getPropType(propValue) { + var propType = typeof propValue; + if (Array.isArray(propValue)) { + return 'array'; + } + if (propValue instanceof RegExp) { + // Old webkits (at least until Android 4.0) return 'function' rather than + // 'object' for typeof a RegExp. We'll normalize this here so that /bla/ + // passes PropTypes.object. + return 'object'; + } + if (isSymbol(propType, propValue)) { + return 'symbol'; + } + return propType; + } + + // This handles more types than `getPropType`. Only used for error messages. + // See `createPrimitiveTypeChecker`. + function getPreciseType(propValue) { + var propType = getPropType(propValue); + if (propType === 'object') { + if (propValue instanceof Date) { + return 'date'; + } else if (propValue instanceof RegExp) { + return 'regexp'; + } + } + return propType; + } + + // Returns class name of the object, if any. + function getClassName(propValue) { + if (!propValue.constructor || !propValue.constructor.name) { + return ANONYMOUS; + } + return propValue.constructor.name; + } + + ReactPropTypes.checkPropTypes = checkPropTypes; + ReactPropTypes.PropTypes = ReactPropTypes; + + return ReactPropTypes; + }; + + +/***/ }), +/* 53 */ +/***/ (function(module, exports, __webpack_require__) { + + 'use strict'; + + exports.__esModule = true; + exports.default = undefined; + + var _react = __webpack_require__(3); + + var _propTypes = __webpack_require__(2); + + var _propTypes2 = _interopRequireDefault(_propTypes); + + var _PropTypes = __webpack_require__(17); + + var _warning = __webpack_require__(5); + + var _warning2 = _interopRequireDefault(_warning); + + function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + + function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } + + function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; } + + function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; } + + var didWarnAboutReceivingStore = false; + function warnAboutReceivingStore() { + if (didWarnAboutReceivingStore) { + return; + } + didWarnAboutReceivingStore = true; + + (0, _warning2.default)(' does not support changing `store` on the fly. ' + 'It is most likely that you see this error because you updated to ' + 'Redux 2.x and React Redux 2.x which no longer hot reload reducers ' + 'automatically. See https://github.com/reactjs/react-redux/releases/' + 'tag/v2.0.0 for the migration instructions.'); + } + + var Provider = function (_Component) { + _inherits(Provider, _Component); + + Provider.prototype.getChildContext = function getChildContext() { + return { store: this.store, storeSubscription: null }; + }; + + function Provider(props, context) { + _classCallCheck(this, Provider); + + var _this = _possibleConstructorReturn(this, _Component.call(this, props, context)); + + _this.store = props.store; + return _this; + } + + Provider.prototype.render = function render() { + return _react.Children.only(this.props.children); + }; + + return Provider; + }(_react.Component); + + exports.default = Provider; + + + if (true) { + Provider.prototype.componentWillReceiveProps = function (nextProps) { + var store = this.store; + var nextStore = nextProps.store; + + + if (store !== nextStore) { + warnAboutReceivingStore(); + } + }; + } + + Provider.propTypes = { + store: _PropTypes.storeShape.isRequired, + children: _propTypes2.default.element.isRequired + }; + Provider.childContextTypes = { + store: _PropTypes.storeShape.isRequired, + storeSubscription: _PropTypes.subscriptionShape + }; + Provider.displayName = 'Provider'; + +/***/ }), +/* 54 */ +/***/ (function(module, exports, __webpack_require__) { + + 'use strict'; + + exports.__esModule = true; + + var _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; + + exports.createConnect = createConnect; + + var _connectAdvanced = __webpack_require__(14); + + var _connectAdvanced2 = _interopRequireDefault(_connectAdvanced); + + var _shallowEqual = __webpack_require__(61); + + var _shallowEqual2 = _interopRequireDefault(_shallowEqual); + + var _mapDispatchToProps = __webpack_require__(55); + + var _mapDispatchToProps2 = _interopRequireDefault(_mapDispatchToProps); + + var _mapStateToProps = __webpack_require__(56); + + var _mapStateToProps2 = _interopRequireDefault(_mapStateToProps); + + var _mergeProps = __webpack_require__(57); + + var _mergeProps2 = _interopRequireDefault(_mergeProps); + + var _selectorFactory = __webpack_require__(58); + + var _selectorFactory2 = _interopRequireDefault(_selectorFactory); + + function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + + function _objectWithoutProperties(obj, keys) { var target = {}; for (var i in obj) { if (keys.indexOf(i) >= 0) continue; if (!Object.prototype.hasOwnProperty.call(obj, i)) continue; target[i] = obj[i]; } return target; } + + /* + connect is a facade over connectAdvanced. It turns its args into a compatible + selectorFactory, which has the signature: + + (dispatch, options) => (nextState, nextOwnProps) => nextFinalProps + + connect passes its args to connectAdvanced as options, which will in turn pass them to + selectorFactory each time a Connect component instance is instantiated or hot reloaded. + + selectorFactory returns a final props selector from its mapStateToProps, + mapStateToPropsFactories, mapDispatchToProps, mapDispatchToPropsFactories, mergeProps, + mergePropsFactories, and pure args. + + The resulting final props selector is called by the Connect component instance whenever + it receives new props or store state. + */ + + function match(arg, factories, name) { + for (var i = factories.length - 1; i >= 0; i--) { + var result = factories[i](arg); + if (result) return result; + } + + return function (dispatch, options) { + throw new Error('Invalid value of type ' + typeof arg + ' for ' + name + ' argument when connecting component ' + options.wrappedComponentName + '.'); + }; + } + + function strictEqual(a, b) { + return a === b; + } + + // createConnect with default args builds the 'official' connect behavior. Calling it with + // different options opens up some testing and extensibility scenarios + function createConnect() { + var _ref = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {}, + _ref$connectHOC = _ref.connectHOC, + connectHOC = _ref$connectHOC === undefined ? _connectAdvanced2.default : _ref$connectHOC, + _ref$mapStateToPropsF = _ref.mapStateToPropsFactories, + mapStateToPropsFactories = _ref$mapStateToPropsF === undefined ? _mapStateToProps2.default : _ref$mapStateToPropsF, + _ref$mapDispatchToPro = _ref.mapDispatchToPropsFactories, + mapDispatchToPropsFactories = _ref$mapDispatchToPro === undefined ? _mapDispatchToProps2.default : _ref$mapDispatchToPro, + _ref$mergePropsFactor = _ref.mergePropsFactories, + mergePropsFactories = _ref$mergePropsFactor === undefined ? _mergeProps2.default : _ref$mergePropsFactor, + _ref$selectorFactory = _ref.selectorFactory, + selectorFactory = _ref$selectorFactory === undefined ? _selectorFactory2.default : _ref$selectorFactory; + + return function connect(mapStateToProps, mapDispatchToProps, mergeProps) { + var _ref2 = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : {}, + _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 ? _shallowEqual2.default : _ref2$areOwnPropsEqua, + _ref2$areStatePropsEq = _ref2.areStatePropsEqual, + areStatePropsEqual = _ref2$areStatePropsEq === undefined ? _shallowEqual2.default : _ref2$areStatePropsEq, + _ref2$areMergedPropsE = _ref2.areMergedPropsEqual, + areMergedPropsEqual = _ref2$areMergedPropsE === undefined ? _shallowEqual2.default : _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)); + }; + } + + exports.default = createConnect(); + +/***/ }), +/* 55 */ +/***/ (function(module, exports, __webpack_require__) { + + 'use strict'; + + exports.__esModule = true; + exports.whenMapDispatchToPropsIsFunction = whenMapDispatchToPropsIsFunction; + exports.whenMapDispatchToPropsIsMissing = whenMapDispatchToPropsIsMissing; + exports.whenMapDispatchToPropsIsObject = whenMapDispatchToPropsIsObject; + + var _redux = __webpack_require__(20); + + var _wrapMapToProps = __webpack_require__(15); + + function whenMapDispatchToPropsIsFunction(mapDispatchToProps) { + return typeof mapDispatchToProps === 'function' ? (0, _wrapMapToProps.wrapMapToPropsFunc)(mapDispatchToProps, 'mapDispatchToProps') : undefined; + } + + function whenMapDispatchToPropsIsMissing(mapDispatchToProps) { + return !mapDispatchToProps ? (0, _wrapMapToProps.wrapMapToPropsConstant)(function (dispatch) { + return { dispatch: dispatch }; + }) : undefined; + } + + function whenMapDispatchToPropsIsObject(mapDispatchToProps) { + return mapDispatchToProps && typeof mapDispatchToProps === 'object' ? (0, _wrapMapToProps.wrapMapToPropsConstant)(function (dispatch) { + return (0, _redux.bindActionCreators)(mapDispatchToProps, dispatch); + }) : undefined; + } + + exports.default = [whenMapDispatchToPropsIsFunction, whenMapDispatchToPropsIsMissing, whenMapDispatchToPropsIsObject]; + +/***/ }), +/* 56 */ +/***/ (function(module, exports, __webpack_require__) { + + 'use strict'; + + exports.__esModule = true; + exports.whenMapStateToPropsIsFunction = whenMapStateToPropsIsFunction; + exports.whenMapStateToPropsIsMissing = whenMapStateToPropsIsMissing; + + var _wrapMapToProps = __webpack_require__(15); + + function whenMapStateToPropsIsFunction(mapStateToProps) { + return typeof mapStateToProps === 'function' ? (0, _wrapMapToProps.wrapMapToPropsFunc)(mapStateToProps, 'mapStateToProps') : undefined; + } + + function whenMapStateToPropsIsMissing(mapStateToProps) { + return !mapStateToProps ? (0, _wrapMapToProps.wrapMapToPropsConstant)(function () { + return {}; + }) : undefined; + } + + exports.default = [whenMapStateToPropsIsFunction, whenMapStateToPropsIsMissing]; + +/***/ }), +/* 57 */ +/***/ (function(module, exports, __webpack_require__) { + + 'use strict'; + + exports.__esModule = true; + + var _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; + + exports.defaultMergeProps = defaultMergeProps; + exports.wrapMergePropsFunc = wrapMergePropsFunc; + exports.whenMergePropsIsFunction = whenMergePropsIsFunction; + exports.whenMergePropsIsOmitted = whenMergePropsIsOmitted; + + var _verifyPlainObject = __webpack_require__(18); + + var _verifyPlainObject2 = _interopRequireDefault(_verifyPlainObject); + + function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + + function defaultMergeProps(stateProps, dispatchProps, ownProps) { + return _extends({}, ownProps, stateProps, dispatchProps); + } + + function wrapMergePropsFunc(mergeProps) { + return function initMergePropsProxy(dispatch, _ref) { + var displayName = _ref.displayName, + 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; + + if (true) (0, _verifyPlainObject2.default)(mergedProps, displayName, 'mergeProps'); + } + + return mergedProps; + }; + }; + } + + function whenMergePropsIsFunction(mergeProps) { + return typeof mergeProps === 'function' ? wrapMergePropsFunc(mergeProps) : undefined; + } + + function whenMergePropsIsOmitted(mergeProps) { + return !mergeProps ? function () { + return defaultMergeProps; + } : undefined; + } + + exports.default = [whenMergePropsIsFunction, whenMergePropsIsOmitted]; + +/***/ }), +/* 58 */ +/***/ (function(module, exports, __webpack_require__) { + + 'use strict'; + + exports.__esModule = true; + exports.impureFinalPropsSelectorFactory = impureFinalPropsSelectorFactory; + exports.pureFinalPropsSelectorFactory = pureFinalPropsSelectorFactory; + exports.default = finalPropsSelectorFactory; + + var _verifySubselectors = __webpack_require__(59); + + var _verifySubselectors2 = _interopRequireDefault(_verifySubselectors); + + function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + + function _objectWithoutProperties(obj, keys) { var target = {}; for (var i in obj) { if (keys.indexOf(i) >= 0) continue; if (!Object.prototype.hasOwnProperty.call(obj, i)) continue; target[i] = obj[i]; } return target; } + + function impureFinalPropsSelectorFactory(mapStateToProps, mapDispatchToProps, mergeProps, dispatch) { + return function impureFinalPropsSelector(state, ownProps) { + return mergeProps(mapStateToProps(state, ownProps), mapDispatchToProps(dispatch, ownProps), ownProps); + }; + } + + function pureFinalPropsSelectorFactory(mapStateToProps, mapDispatchToProps, mergeProps, dispatch, _ref) { + var areStatesEqual = _ref.areStatesEqual, + 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 handleNewPropsAndNewState() { + stateProps = mapStateToProps(state, ownProps); + + if (mapDispatchToProps.dependsOnOwnProps) dispatchProps = mapDispatchToProps(dispatch, ownProps); + + mergedProps = mergeProps(stateProps, dispatchProps, ownProps); + return mergedProps; + } + + function handleNewProps() { + if (mapStateToProps.dependsOnOwnProps) stateProps = mapStateToProps(state, ownProps); + + if (mapDispatchToProps.dependsOnOwnProps) dispatchProps = mapDispatchToProps(dispatch, ownProps); + + mergedProps = mergeProps(stateProps, dispatchProps, ownProps); + return mergedProps; + } + + function handleNewState() { + var nextStateProps = mapStateToProps(state, ownProps); + var statePropsChanged = !areStatePropsEqual(nextStateProps, stateProps); + stateProps = nextStateProps; + + if (statePropsChanged) mergedProps = mergeProps(stateProps, dispatchProps, ownProps); + + return mergedProps; + } + + function handleSubsequentCalls(nextState, nextOwnProps) { + var propsChanged = !areOwnPropsEqual(nextOwnProps, ownProps); + var stateChanged = !areStatesEqual(nextState, state); + state = nextState; + ownProps = nextOwnProps; + + if (propsChanged && stateChanged) return handleNewPropsAndNewState(); + if (propsChanged) return handleNewProps(); + if (stateChanged) return handleNewState(); + return mergedProps; + } + + return function pureFinalPropsSelector(nextState, nextOwnProps) { + return hasRunAtLeastOnce ? handleSubsequentCalls(nextState, nextOwnProps) : handleFirstCall(nextState, nextOwnProps); + }; + } + + // TODO: Add more comments + + // If pure is true, the selector returned by selectorFactory will memoize its results, + // allowing connectAdvanced's shouldComponentUpdate to return false if final + // props have not changed. If false, the selector will always return a new + // object and shouldComponentUpdate will always return true. + + function finalPropsSelectorFactory(dispatch, _ref2) { + var initMapStateToProps = _ref2.initMapStateToProps, + 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); + + if (true) { + (0, _verifySubselectors2.default)(mapStateToProps, mapDispatchToProps, mergeProps, options.displayName); + } + + var selectorFactory = options.pure ? pureFinalPropsSelectorFactory : impureFinalPropsSelectorFactory; + + return selectorFactory(mapStateToProps, mapDispatchToProps, mergeProps, dispatch, options); + } + +/***/ }), +/* 59 */ +/***/ (function(module, exports, __webpack_require__) { + + 'use strict'; + + exports.__esModule = true; + exports.default = verifySubselectors; + + var _warning = __webpack_require__(5); + + var _warning2 = _interopRequireDefault(_warning); + + function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + + function verify(selector, methodName, displayName) { + if (!selector) { + throw new Error('Unexpected value for ' + methodName + ' in ' + displayName + '.'); + } else if (methodName === 'mapStateToProps' || methodName === 'mapDispatchToProps') { + if (!selector.hasOwnProperty('dependsOnOwnProps')) { + (0, _warning2.default)('The selector for ' + methodName + ' of ' + displayName + ' did not specify a value for dependsOnOwnProps.'); + } + } + } + + function verifySubselectors(mapStateToProps, mapDispatchToProps, mergeProps, displayName) { + verify(mapStateToProps, 'mapStateToProps', displayName); + verify(mapDispatchToProps, 'mapDispatchToProps', displayName); + verify(mergeProps, 'mergeProps', displayName); + } + +/***/ }), +/* 60 */ +/***/ (function(module, exports) { + + "use strict"; + + exports.__esModule = true; + + function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } + + // encapsulates the subscription logic for connecting a component to the redux store, as + // well as nesting subscriptions of descendant components, so that we can ensure the + // ancestor components re-render before descendants + + var CLEARED = null; + var nullListeners = { + notify: function notify() {} + }; + + function createListenerCollection() { + // the current/next pattern is copied from redux's createStore code. + // TODO: refactor+expose that code to be reusable here? + var current = []; + var next = []; + + return { + clear: function clear() { + next = CLEARED; + current = CLEARED; + }, + notify: function notify() { + var listeners = current = next; + for (var i = 0; i < listeners.length; i++) { + listeners[i](); + } + }, + subscribe: function subscribe(listener) { + var isSubscribed = true; + if (next === current) next = current.slice(); + next.push(listener); + + return function unsubscribe() { + if (!isSubscribed || current === CLEARED) return; + isSubscribed = false; + + if (next === current) next = current.slice(); + next.splice(next.indexOf(listener), 1); + }; + } + }; + } + + var Subscription = function () { + function Subscription(store, parentSub, 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(); + } + }; + + Subscription.prototype.tryUnsubscribe = function tryUnsubscribe() { + if (this.unsubscribe) { + this.unsubscribe(); + this.unsubscribe = null; + this.listeners.clear(); + this.listeners = nullListeners; + } + }; + + return Subscription; + }(); + + exports.default = Subscription; + +/***/ }), +/* 61 */ +/***/ (function(module, exports) { + + 'use strict'; + + exports.__esModule = true; + exports.default = shallowEqual; + 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 !== '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++) { + if (!hasOwn.call(objB, keysA[i]) || !is(objA[keysA[i]], objB[keysA[i]])) { + return false; + } + } + + return true; + } + +/***/ }), +/* 62 */ +/***/ (function(module, exports, __webpack_require__) { + + var Symbol = __webpack_require__(19), + getRawTag = __webpack_require__(65), + objectToString = __webpack_require__(66); + + /** `Object#toString` result references. */ + var nullTag = '[object Null]', + 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); + } + + module.exports = baseGetTag; + + +/***/ }), +/* 63 */ +/***/ (function(module, exports) { + + /* WEBPACK VAR INJECTION */(function(global) {/** Detect free variable `global` from Node.js. */ + var freeGlobal = typeof global == 'object' && global && global.Object === Object && global; + + module.exports = freeGlobal; + + /* WEBPACK VAR INJECTION */}.call(exports, (function() { return this; }()))) + +/***/ }), +/* 64 */ +/***/ (function(module, exports, __webpack_require__) { + + var overArg = __webpack_require__(67); + + /** Built-in value references. */ + var getPrototype = overArg(Object.getPrototypeOf, Object); + + module.exports = getPrototype; + + +/***/ }), +/* 65 */ +/***/ (function(module, exports, __webpack_require__) { + + var Symbol = __webpack_require__(19); + + /** Used for built-in method references. */ + var objectProto = Object.prototype; + + /** Used to check objects for own properties. */ + var hasOwnProperty = objectProto.hasOwnProperty; + + /** + * Used to resolve the + * [`toStringTag`](http://ecma-international.org/ecma-262/7.0/#sec-object.prototype.tostring) + * of values. + */ + var nativeObjectToString = objectProto.toString; + + /** Built-in value references. */ + var symToStringTag = 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.call(value, symToStringTag), + tag = value[symToStringTag]; + + try { + value[symToStringTag] = undefined; + var unmasked = true; + } catch (e) {} + + var result = nativeObjectToString.call(value); + if (unmasked) { + if (isOwn) { + value[symToStringTag] = tag; + } else { + delete value[symToStringTag]; + } + } + return result; + } + + module.exports = getRawTag; + + +/***/ }), +/* 66 */ +/***/ (function(module, exports) { + + /** Used for built-in method references. */ + var objectProto = Object.prototype; + + /** + * Used to resolve the + * [`toStringTag`](http://ecma-international.org/ecma-262/7.0/#sec-object.prototype.tostring) + * of values. + */ + var nativeObjectToString = objectProto.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.call(value); + } + + module.exports = objectToString; + + +/***/ }), +/* 67 */ +/***/ (function(module, exports) { + + /** + * 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)); + }; + } + + module.exports = overArg; + + +/***/ }), +/* 68 */ +/***/ (function(module, exports, __webpack_require__) { + + var freeGlobal = __webpack_require__(63); + + /** Detect free variable `self`. */ + var freeSelf = typeof self == 'object' && self && self.Object === Object && self; + + /** Used as a reference to the global object. */ + var root = freeGlobal || freeSelf || Function('return this')(); + + module.exports = root; + + +/***/ }), +/* 69 */ +/***/ (function(module, exports) { + + /** + * Checks if `value` is object-like. A value is object-like if it's not `null` + * and has a `typeof` result of "object". + * + * @static + * @memberOf _ + * @since 4.0.0 + * @category Lang + * @param {*} value The value to check. + * @returns {boolean} Returns `true` if `value` is object-like, else `false`. + * @example + * + * _.isObjectLike({}); + * // => true + * + * _.isObjectLike([1, 2, 3]); + * // => true + * + * _.isObjectLike(_.noop); + * // => false + * + * _.isObjectLike(null); + * // => false + */ + function isObjectLike(value) { + return value != null && typeof value == 'object'; + } + + module.exports = isObjectLike; + + +/***/ }), +/* 70 */ +/***/ (function(module, exports, __webpack_require__) { + + var baseGetTag = __webpack_require__(62), + getPrototype = __webpack_require__(64), + isObjectLike = __webpack_require__(69); + + /** `Object#toString` result references. */ + var objectTag = '[object Object]'; + + /** Used for built-in method references. */ + var funcProto = Function.prototype, + 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; + } + + module.exports = isPlainObject; + + +/***/ }) +/******/ ]) +}); +; \ No newline at end of file diff --git a/dist/react-inline-grid.min.js b/dist/react-inline-grid.min.js new file mode 100644 index 0000000..d88642b --- /dev/null +++ b/dist/react-inline-grid.min.js @@ -0,0 +1,2 @@ +!function(t,e){"object"==typeof exports&&"object"==typeof module?module.exports=e(require("react"),require("redux")):"function"==typeof define&&define.amd?define(["react","redux"],e):"object"==typeof exports?exports.ReactInlineGrid=e(require("react"),require("redux")):t.ReactInlineGrid=e(t.React,t.Redux)}(this,function(t,e){return function(t){function e(r){if(n[r])return n[r].exports;var o=n[r]={exports:{},id:r,loaded:!1};return t[r].call(o.exports,o,o.exports,e),o.loaded=!0,o.exports}var n={};return e.m=t,e.c=n,e.p="",e(0)}([function(t,e,n){"use strict";function r(t){return t&&t.__esModule?t.default:t}function o(t){return t&&t.__esModule?t:{default:t}}e.__esModule=!0;var i=n(1),u=n(34),s=o(u),a=n(33);e.Grid=r(a);var c=s.default(i.ROW_ID),p=s.default(i.CELL_ID);e.Row=c,e.Cell=p},function(t,e){"use strict";e.__esModule=!0;var n,r="media/name/UPDATE";e.UPDATE_MEDIA_NAME=r;var o="row";e.ROW_ID=o;var i="cell";e.CELL_ID=i;var u={gutter:16,margin:16,list:[{name:"phone",query:"(max-width: 479px)"},{name:"tablet",query:"(min-width: 480px) and (max-width: 839px)"},{name:"desktop",query:"(min-width: 840px)"}]};e.MEDIA_MODEL_HELPER=u;var s=(n={},n[o]=["row","start","center","end","around","between","nospace"],n[i]=["cell","1","2","3","4","5","6","7","8","9","10","11","12","top","middle","bottom","stretch","between","offset","nospace"],n);e.WHITE_LIST=s},function(t,e,n){t.exports=n(49)()},function(e,n){e.exports=t},function(t,e){"use strict";function n(t){var e=typeof t;return!!t&&("object"==e||"function"==e)}t.exports=n},function(t,e){"use strict";function n(t){"undefined"!=typeof console&&"function"==typeof console.error&&console.error(t);try{throw Error(t)}catch(t){}}e.__esModule=!0,e.default=n},function(t,e){"use strict";function n(t){return"number"==typeof t&&t>-1&&t%1==0&&r>=t}var r=9007199254740991;t.exports=n},function(t,e){"use strict";function n(t){return!!t&&"object"==typeof t}t.exports=n},function(t,e,n){"use strict";function r(t){var e=t.name;return{name:e}}function o(t){return{type:s.UPDATE_MEDIA_NAME,payload:t}}function i(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};switch(e.type){case s.UPDATE_MEDIA_NAME:return u({},t,{name:e.payload});default:return t}}e.__esModule=!0;var u=Object.assign||function(t){for(var e=1;arguments.length>e;e++){var n=arguments[e];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(t[r]=n[r])}return t};e.hydrateMedia=r,e.updateMediaName=o,e.default=i;var s=n(1)},function(t,e){"use strict";function n(t,e){if(!t)throw Error(e)}e.__esModule=!0,e.default=n,t.exports=e.default},function(t,e,n){"use strict";function r(t){return t&&t.__esModule?t:{default:t}}function o(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function i(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}function u(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)}function s(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}function a(){}function c(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 p(t){var e,n,r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},p=r.getDisplayName,l=void 0===p?function(t){return"ConnectAdvanced("+t+")"}:p,h=r.methodName,y=void 0===h?"connectAdvanced":h,_=r.renderCountProp,w=void 0===_?void 0:_,x=r.shouldHandleStateChanges,M=void 0===x||x,S=r.storeKey,C=void 0===S?"store":S,j=r.withRef,T=void 0!==j&&j,E=s(r,["getDisplayName","methodName","renderCountProp","shouldHandleStateChanges","storeKey","withRef"]),R=C+"Subscription",q=O++,D=(e={},e[C]=g.storeShape,e[R]=g.subscriptionShape,e),N=(n={},n[R]=g.subscriptionShape,n);return function(e){(0,v.default)("function"==typeof e,"You must pass a component to the function returned by connect. Instead received "+JSON.stringify(e));var n=e.displayName||e.name||"Component",r=l(n),s=f({},E,{getDisplayName:l,methodName:y,renderCountProp:w,shouldHandleStateChanges:M,storeKey:C,withRef:T,displayName:r,wrappedComponentName:n,WrappedComponent:e}),p=function(n){function p(t,e){o(this,p);var u=i(this,n.call(this,t,e));return u.version=q,u.state={},u.renderCount=0,u.store=t[C]||e[C],u.propsMode=!!t[C],u.setWrappedInstance=u.setWrappedInstance.bind(u),(0,v.default)(u.store,'Could not find "'+C+'" in either the context or props of '+('"'+r+'". Either wrap the root component in a , ')+('or explicitly pass "'+C+'" as a prop to "'+r+'".')),u.initSelector(),u.initSubscription(),u}return u(p,n),p.prototype.getChildContext=function(){var t,e=this.propsMode?null:this.subscription;return t={},t[R]=e||this.context[R],t},p.prototype.componentDidMount=function(){M&&(this.subscription.trySubscribe(),this.selector.run(this.props),this.selector.shouldComponentUpdate&&this.forceUpdate())},p.prototype.componentWillReceiveProps=function(t){this.selector.run(t)},p.prototype.shouldComponentUpdate=function(){return this.selector.shouldComponentUpdate},p.prototype.componentWillUnmount=function(){this.subscription&&this.subscription.tryUnsubscribe(),this.subscription=null,this.notifyNestedSubs=a,this.store=null,this.selector.run=a,this.selector.shouldComponentUpdate=!1},p.prototype.getWrappedInstance=function(){return(0,v.default)(T,"To access the wrapped instance, you need to specify "+("{ withRef: true } in the options argument of the "+y+"() call.")),this.wrappedInstance},p.prototype.setWrappedInstance=function(t){this.wrappedInstance=t},p.prototype.initSelector=function(){var e=t(this.store.dispatch,s);this.selector=c(e,this.store),this.selector.run(this.props)},p.prototype.initSubscription=function(){if(M){var t=(this.propsMode?this.props:this.context)[R];this.subscription=new m.default(this.store,t,this.onStateChange.bind(this)),this.notifyNestedSubs=this.subscription.notifyNestedSubs.bind(this.subscription)}},p.prototype.onStateChange=function(){this.selector.run(this.props),this.selector.shouldComponentUpdate?(this.componentDidUpdate=this.notifyNestedSubsOnComponentDidUpdate,this.setState(P)):this.notifyNestedSubs()},p.prototype.notifyNestedSubsOnComponentDidUpdate=function(){this.componentDidUpdate=void 0,this.notifyNestedSubs()},p.prototype.isSubscribed=function(){return!!this.subscription&&this.subscription.isSubscribed()},p.prototype.addExtraProps=function(t){if(!(T||w||this.propsMode&&this.subscription))return t;var e=f({},t);return T&&(e.ref=this.setWrappedInstance),w&&(e[w]=this.renderCount++),this.propsMode&&this.subscription&&(e[R]=this.subscription),e},p.prototype.render=function(){var t=this.selector;if(t.shouldComponentUpdate=!1,t.error)throw t.error;return(0,b.createElement)(e,this.addExtraProps(t.props))},p}(b.Component);return p.WrappedComponent=e,p.displayName=r,p.childContextTypes=N,p.contextTypes=D,p.propTypes=D,(0,d.default)(p,e)}}e.__esModule=!0;var f=Object.assign||function(t){for(var e=1;arguments.length>e;e++){var n=arguments[e];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(t[r]=n[r])}return t};e.default=p;var l=n(47),d=r(l),h=n(48),v=r(h),b=n(3),y=n(57),m=r(y),g=n(13),O=0,P={}},function(t,e,n){"use strict";function r(t){return t&&t.__esModule?t:{default:t}}function o(t){return function(e,n){function r(){return o}var o=t(e,n);return r.dependsOnOwnProps=!1,r}}function i(t){return null!==t.dependsOnOwnProps&&void 0!==t.dependsOnOwnProps?!!t.dependsOnOwnProps:1!==t.length}function u(t,e){return function(e,n){var r=function(t,e){return r.dependsOnOwnProps?r.mapToProps(t,e):r.mapToProps(t)};return r.dependsOnOwnProps=!0,r.mapToProps=function(e,n){r.mapToProps=t,r.dependsOnOwnProps=i(t);var o=r(e,n);return"function"==typeof o&&(r.mapToProps=o,r.dependsOnOwnProps=i(o),o=r(e,n)),o},r}}e.__esModule=!0,e.wrapMapToPropsConstant=o,e.getDependsOnOwnProps=i,e.wrapMapToPropsFunc=u;var s=n(14);r(s)},function(t,e,n){"use strict";function r(t){return t&&t.__esModule?t:{default:t}}e.__esModule=!0,e.connect=e.connectAdvanced=e.Provider=void 0;var o=n(50),i=r(o),u=n(10),s=r(u),a=n(51),c=r(a);e.Provider=i.default,e.connectAdvanced=s.default,e.connect=c.default},function(t,e,n){"use strict";function r(t){return t&&t.__esModule?t:{default:t}}e.__esModule=!0,e.storeShape=e.subscriptionShape=void 0;var o=n(2),i=r(o);e.subscriptionShape=i.default.shape({trySubscribe:i.default.func.isRequired,tryUnsubscribe:i.default.func.isRequired,notifyNestedSubs:i.default.func.isRequired,isSubscribed:i.default.func.isRequired}),e.storeShape=i.default.shape({subscribe:i.default.func.isRequired,dispatch:i.default.func.isRequired,getState:i.default.func.isRequired})},function(t,e,n){"use strict";function r(t){return t&&t.__esModule?t:{default:t}}function o(t,e,n){(0,u.default)(t)||(0,a.default)(n+"() in "+e+" must return a plain object. Instead received "+t+".")}e.__esModule=!0,e.default=o;var i=n(67),u=r(i),s=n(5),a=r(s)},function(t,e,n){var r=n(65),o=r.Symbol;t.exports=o},function(t,n){t.exports=e},function(t,e){"use strict";function n(t){for(var e=-1,n=t?t.length:0,r=-1,o=[];++er;)t=t[e[r++]];return r&&r==i?t:void 0}}var o=n(26);t.exports=r},function(t,e){"use strict";function n(t){return function(e){return null==e?void 0:e[t]}}t.exports=n},function(t,e){"use strict";function n(t){return null==t?"":t+""}t.exports=n},function(t,e,n){"use strict";var r=n(19),o=r("length");t.exports=o},function(t,e,n){"use strict";function r(t,e){var n=null==t?void 0:t[e];return o(n)?n:void 0}var o=n(30);t.exports=r},function(t,e,n){"use strict";function r(t){return null!=t&&i(o(t))}var o=n(21),i=n(6);t.exports=r},function(t,e){"use strict";function n(t,e){return t="number"==typeof t||r.test(t)?+t:-1,e=null==e?o:e,t>-1&&t%1==0&&e>t}var r=/^\d+$/,o=9007199254740991;t.exports=n},function(t,e,n){"use strict";function r(t,e,n){if(!u(n))return!1;var r=typeof e;if("number"==r?o(n)&&i(e,n.length):"string"==r&&e in n){var s=n[e];return t===t?t===s:s!==s}return!1}var o=n(23),i=n(24),u=n(4);t.exports=r},function(t,e,n){"use strict";function r(t){return o(t)?t:Object(t)}var o=n(4);t.exports=r},function(t,e,n){"use strict";function r(t){if(i(t))return t;var e=[];return o(t).replace(u,function(t,n,r,o){e.push(r?o.replace(s,"$1"):n||t)}),e}var o=n(20),i=n(28),u=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\n\\]|\\.)*?)\2)\]/g,s=/\\(\\)?/g;t.exports=r},function(t,e,n){"use strict";var r=n(22),o=n(6),i=n(7),u="[object Array]",s=Object.prototype,a=s.toString,c=r(Array,"isArray"),p=c||function(t){return i(t)&&o(t.length)&&a.call(t)==u};t.exports=p},function(t,e,n){"use strict";function r(t){return o(t)&&s.call(t)==i}var o=n(4),i="[object Function]",u=Object.prototype,s=u.toString;t.exports=r},function(t,e,n){"use strict";function r(t){return null!=t&&(o(t)?p.test(a.call(t)):i(t)&&u.test(t))}var o=n(29),i=n(7),u=/^\[object .+?Constructor\]$/,s=Object.prototype,a=Function.prototype.toString,c=s.hasOwnProperty,p=RegExp("^"+a.call(c).replace(/[\\^$.*+?()[\]{}|]/g,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$");t.exports=r},function(t,e,n){"use strict";function r(t,e,n){var r=null==t?void 0:o(t,i(e),e+"");return void 0===r?n:r}var o=n(18),i=n(27);t.exports=r},function(t,e,n){"use strict";function r(t,e,n){n&&o(t,e,n)&&(e=n=void 0),t=+t||0,n=null==n?1:+n||0,null==e?(e=t,t=0):e=+e||0;for(var r=-1,s=u(i((e-t)/(n||1)),0),a=Array(s);++r=0)return r;var o=t&&t[n]>=0?t[n]:e[n];return o}function s(t,e,n){return n.map(function(n){var r=n.name,o=n.query,i=n.gutter,s=n.margin;return{name:r,query:o,gutter:u(t,e,"gutter",i),margin:u(t,e,"margin",s)}})}function a(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=t.columns,r=t.deaf,o=void 0!==r&&r,i=t.list,u=void 0===i?e.list:i,a=u.length;return x.default(!!a," -> options -> list can not be empty"),n&&x.default(!(n%a)>0," -> options -> columns must be a multiple of -> options -> list -> length"),{columns:n||4*a,deaf:o,list:s(t,e,u)}}function c(t){return{name:t}}function p(t){return{options:t}}e.__esModule=!0;var f=function(){function t(t,e){for(var n=0;e.length>n;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,r.key,r)}}return function(e,n,r){return n&&t(e.prototype,n),r&&t(e,r),e}}();e.ensureValue=u,e.ensureListProperties=s,e.build=a,e.setMedia=c,e.setReference=p;var l=n(3),d=r(l),h=n(2),v=r(h),b=n(12),y=n(35),m=r(y),g=n(37),O=r(g),P=n(8),_=n(1),w=n(9),x=r(w),M=v.default.shape({columns:v.default.number,gutter:v.default.number,margin:v.default.number,deaf:v.default.bool,list:v.default.arrayOf(v.default.shape({name:v.default.string.isRequired,query:v.default.string.isRequired,gutter:v.default.number,margin:v.default.number}))}),S=function(t){function e(n,r){o(this,e),t.call(this,n,r);var i=a(n.options,_.MEDIA_MODEL_HELPER);this.match=m.default(i.list),this.shouldSubscribe=i.deaf!==!0;var u=c(this.match.getCurrentName),s=p(i);this.store=O.default({media:u,reference:s})}return i(e,t),f(e,null,[{key:"propTypes",value:{options:M,children:v.default.element.isRequired},enumerable:!0}]),e.prototype.componentDidMount=function(){this.trySubscribe()},e.prototype.componentWillUnmount=function(){this.tryUnsubscribe()},e.prototype.render=function(){return d.default.createElement(b.Provider,{store:this.store},l.Children.only(this.props.children))},e.prototype.trySubscribe=function(){this.shouldSubscribe&&!this.unsubscribe&&(this.unsubscribe=this.match.subscribe(this.handleChange.bind(this)))},e.prototype.tryUnsubscribe=function(){this.unsubscribe&&(this.unsubscribe(),this.unsubscribe=null)},e.prototype.handleChange=function(t){this.unsubscribe&&this.store.dispatch(P.updateMediaName(t))},e}(l.Component);e.default=S},function(t,e,n){"use strict";function r(t){return t&&t.__esModule?t:{default:t}}function o(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}function i(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function u(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)}function s(t){return h.connect(y,null,m)(O(t))}e.__esModule=!0;var a=function(){function t(t,e){for(var n=0;e.length>n;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,r.key,r)}}return function(e,n,r){return n&&t(e.prototype,n),r&&t(e,r),e}}(),c=Object.assign||function(t){for(var e=1;arguments.length>e;e++){var n=arguments[e];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(t[r]=n[r])}return t};e.default=s;var p=n(3),f=r(p),l=n(2),d=r(l),h=n(12),v=n(44),b=r(v),y=function(t){return c({},t)},m=function(t,e,n){var r=n.is,i=o(n,["is"]);return c({},i,{grid:c({},t,{is:r})})},g=d.default.shape({media:d.default.object.isRequired,reference:d.default.object.isRequired,is:d.default.string}).isRequired,O=function(t){return function(e){function n(){i(this,n),e.apply(this,arguments)}return u(n,e),n.prototype.shouldComponentUpdate=function(t){return t.grid.media.name!==this.props.grid.media.name||t.grid.is!==this.props.grid.is},n.prototype.render=function(){var e=this.props,n=e.grid,r=e.children,i=o(e,["grid","children"]);return f.default.createElement("div",{style:b.default(t,n)},p.Children.map(r,function(t){return p.cloneElement(t,c({},i))}))},a(n,null,[{key:"propTypes",value:{grid:g},enumerable:!0}]),n}(p.Component)};t.exports=e.default},function(t,e){"use strict";function n(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function r(t){return t.map(function(t){var e=t.name,n=t.query;return{name:e,query:n}})}function o(t,e){return t.map(function(t){var n=t.name,r=t.query,o=window.matchMedia(r);return o.add=function(){return o.addListener(e)},o.add(),o.remove=function(){return o.removeListener(e)},{name:n,match:o}})}function i(t){var e=new u(t);return{subscribe:e.subscribe.bind(e),getCurrentName:e.getCurrentName()}}e.__esModule=!0,e.default=i;var u=function(){function t(e){return n(this,t),this.listeners=[],this.state=[],this.model=r(e.slice()),this.updateState()}return t.prototype.handleChange=function(){return this.state.slice().forEach(function(t){var e=t.match;return e.remove()}),this.updateState()},t.prototype.updateState=function(){return this.state=o(this.model,this.handleChange.bind(this)),this.dispatchUpdate()},t.prototype.getCurrentName=function(){var t=this.state.filter(function(t){var e=t.match;return e.matches}),e=t.length>0?t[0]:this.model[0],n=e.name;return n},t.prototype.dispatchUpdate=function(){var t=this.getCurrentName();return this.listeners.slice().forEach(function(e){return e(t)})},t.prototype.subscribe=function(t){return this.listeners.push(t),function(){if(null!=this.listeners){var e=this.listeners.indexOf(t);this.listeners=this.listeners.slice(e,1)}}},t}();t.exports=e.default},function(t,e,n){"use strict";function r(t){return t&&t.__esModule?t:{default:t}}function o(t){var e=t.options,n=e.columns,r=e.list,o=r.length;return r.reduce(function(t,e,r){var i,s=e.name,c=e.gutter,f=e.margin,O=p.default(h,a.default(navigator.userAgent)),P=O.justifyContent,_=O.alignSelf,w=O.FIXED_ROW,x=n/o*(r+1),M=l.default([1,x,c],"width"),S=l.default([x,n+1,c],"width",!0),C=l.default([0,x,c/2],"marginLeft"),j=v(d.ROW_ID,w,c,f),T=b(P),E=y(d.CELL_ID,c),R=m(_),q=g();return u({},t,(i={},i[s]=u({},j,T,E,R,M,S,q,{offset:u({},C)}),i))},{})}function i(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return t}e.__esModule=!0;var u=Object.assign||function(t){for(var e=1;arguments.length>e;e++){var n=arguments[e];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(t[r]=n[r])}return t};e.hydrateReference=o,e.default=i;var s=n(42),a=r(s),c=n(41),p=r(c),f=n(39),l=r(f),d=n(1),h={display:"flex",flexFlow:"row wrap",alignItems:"stretch"},v=function(t,e,n,r){var o;return o={},o[t]=u({},e,{padding:r-n/2+"px"}),o};e.buildRow=v;var b=function(t){var e,n,r,o,i;return{start:(e={},e[t]="flex-start",e),center:(n={},n[t]="center",n),end:(r={},r[t]="flex-end",r),around:(o={},o[t]="space-around",o),between:(i={},i[t]="space-between",i)}};e.buildRowTypeProperties=b;var y=function(t,e){var n;return n={},n[t]={boxSizing:"border-box",margin:e/2+"px",width:"calc(100% - "+e+"px)"},n};e.buildCell=y;var m=function(t){var e,n,r,o;return{top:(e={},e[t]="flex-start",e),middle:(n={},n[t]="center",n),bottom:(r={},r[t]="flex-end",r),stretch:(o={},o[t]="stretch",o)}};e.buildCellTypeProperties=m;var g=function(){return{nospace:{padding:0,margin:0}}};e.buildSharedProperties=g},function(t,e,n){"use strict";function r(t){return t&&t.__esModule?t:{default:t}}function o(t){return i.createStore(i.combineReducers({media:s.default,reference:c.default}),{media:u.hydrateMedia(t.media),reference:a.hydrateReference(t.reference)})}e.__esModule=!0,e.default=o;var i=n(16),u=n(8),s=r(u),a=n(36),c=r(a);t.exports=e.default},function(t,e){"use strict";e.__esModule=!0,e.default={},t.exports=e.default},function(t,e,n){"use strict";function r(t){return t&&t.__esModule?t:{default:t}}function o(t,e,n){var r=t[0],o=t[1],i=t[2];return u.default(r,o).reduce(function(t,r){var u,s=n?100:r/o*100;return t[r]=(u={},u[e]="calc("+s+"% - "+i+"px)",u),t},{})}e.__esModule=!0,e.default=o;var i=n(32),u=r(i);t.exports=e.default},function(t,e){"use strict";function n(t){return t.charAt(0).toUpperCase()+t.slice(1)}e.__esModule=!0,e.default=n,t.exports=e.default},function(t,e){"use strict";function n(t,e){var n=e?"WebkitJustifyContent":"justifyContent",r=e?"WebkitAlignSelf":"alignSelf",o=e?{display:"-webkit-flex",WebkitFlexFlow:"row wrap",WebkitAlignItems:"stretch"}:t;return{justifyContent:n,alignSelf:r,FIXED_ROW:o}}e.__esModule=!0,e.default=n,t.exports=e.default},function(t,e){"use strict";function n(t){return t.indexOf("Chrome")<0&&t.indexOf("Safari")>-1}e.__esModule=!0,e.default=n,t.exports=e.default},function(t,e,n){"use strict";function r(t){return t&&t.__esModule?t:{default:t}}function o(t){return function(e){return u.default.hasOwnProperty(e)||(u.default[e]=t.call(this,e)),u.default[e]}}e.__esModule=!0,e.default=o;var i=n(38),u=r(i);t.exports=e.default},function(t,e,n){"use strict";function r(t){return t&&t.__esModule?t:{default:t}}function o(){var t=O.apply(void 0,arguments);return g.apply(void 0,arguments)(t)}e.__esModule=!0;var i=Object.assign||function(t){for(var e=1;arguments.length>e;e++){var n=arguments[e];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(t[r]=n[r])}return t};e.default=o;var u=n(17),s=r(u),a=n(31),c=r(a),p=n(43),f=r(p),l=n(9),d=(r(l),n(40)),h=(r(d),n(1),function(t,e){return e&&e.trim()?[t].concat(e.trim().split(/\s+/)):[t]});e.parser=h;var v=function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:[];return s.default(e.map(function(e){var n=e.split("-"),r=n[0],o=n.slice(1);switch(o.length){case 0:return r;case 1:return"offset"===r?[r].concat(o):r===t&&o[0];case 2:return r===t&&("offset"===o[0]&&o);default:return!1}}))};e.listReducer=v;var b=function(t,e){var n=t.name;return{name:n,list:v(n,e)}};e.generatePayload=b;var y=function(t,e){var n=t.name,r=t.list;return r.reduce(function(t,r){var o=c.default(e,[n].concat(r));return i({},t,o)},{})};e.reducePayload=y;var m=function(t,e){var n=e.media,r=e.reference,o=e.is,i=h(t,o),u=b(n,i);return y(u,r)};e.getInReference=m;var g=function(){for(var t=arguments.length,e=Array(t),n=0;t>n;n++)e[n]=arguments[n];return f.default(function(){return m.apply(void 0,e)})};e.memoizeProcess=g;var O=function(t,e){var n=e.media.name,r=e.is;return""+t+n+r};e.generateKey=O},function(t,e){"use strict";function n(t){return function(){return t}}var r=function(){};r.thatReturns=n,r.thatReturnsFalse=n(!1),r.thatReturnsTrue=n(!0),r.thatReturnsNull=n(null),r.thatReturnsThis=function(){return this},r.thatReturnsArgument=function(t){return t},t.exports=r},function(t,e,n){"use strict";function r(t,e,n,r,i,u,s,a){if(o(e),!t){var c;if(void 0===e)c=Error("Minified exception occurred; use the non-minified dev environment for the full error message and additional helpful warnings.");else{var p=[n,r,i,u,s,a],f=0;c=Error(e.replace(/%s/g,function(){return p[f++]})),c.name="Invariant Violation"}throw c.framesToPop=1,c}}var o=function(t){};t.exports=r},function(t,e){"use strict";var n={childContextTypes:!0,contextTypes:!0,defaultProps:!0,displayName:!0,getDefaultProps:!0,mixins:!0,propTypes:!0,type:!0},r={name:!0,length:!0,prototype:!0,caller:!0,arguments:!0,arity:!0},o="function"==typeof Object.getOwnPropertySymbols;t.exports=function(t,e,i){if("string"!=typeof e){var u=Object.getOwnPropertyNames(e);o&&(u=u.concat(Object.getOwnPropertySymbols(e)));for(var s=0;u.length>s;++s)if(!(n[u[s]]||r[u[s]]||i&&i[u[s]]))try{t[u[s]]=e[u[s]]}catch(t){}}return t}},function(t,e,n){"use strict";var r=function(t,e,n,r,o,i,u,s){if(!t){var a;if(void 0===e)a=Error("Minified exception occurred; use the non-minified dev environment for the full error message and additional helpful warnings.");else{var c=[n,r,o,i,u,s],p=0;a=Error(e.replace(/%s/g,function(){return c[p++]})),a.name="Invariant Violation"}throw a.framesToPop=1,a}};t.exports=r},function(t,e,n){"use strict";var r=n(45),o=n(46);t.exports=function(){function t(){o(!1,"Calling PropTypes validators directly is not supported by the `prop-types` package. Use PropTypes.checkPropTypes() to call them. Read more at http://fb.me/use-check-prop-types")}function e(){return t}t.isRequired=t;var n={array:t,bool:t,func:t,number:t,object:t,string:t,symbol:t,any:t,arrayOf:e,element:t,instanceOf:e,node:t,objectOf:e,oneOf:e,oneOfType:e,shape:e};return n.checkPropTypes=r,n.PropTypes=n,n}},function(t,e,n){"use strict";function r(t){return t&&t.__esModule?t:{default:t}}function o(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function i(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}function u(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)}e.__esModule=!0,e.default=void 0;var s=n(3),a=n(2),c=r(a),p=n(13),f=n(5),l=(r(f),function(t){function e(n,r){o(this,e);var u=i(this,t.call(this,n,r));return u.store=n.store,u}return u(e,t),e.prototype.getChildContext=function(){return{store:this.store,storeSubscription:null}},e.prototype.render=function(){return s.Children.only(this.props.children)},e}(s.Component));e.default=l,l.propTypes={store:p.storeShape.isRequired,children:c.default.element.isRequired},l.childContextTypes={store:p.storeShape.isRequired,storeSubscription:p.subscriptionShape},l.displayName="Provider"},function(t,e,n){"use strict";function r(t){return t&&t.__esModule?t:{default:t}}function o(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}function i(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 "+typeof t+" for "+n+" argument when connecting component "+r.wrappedComponentName+".")}}function u(t,e){return t===e}function s(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},e=t.connectHOC,n=void 0===e?p.default:e,r=t.mapStateToPropsFactories,s=void 0===r?b.default:r,c=t.mapDispatchToPropsFactories,f=void 0===c?h.default:c,d=t.mergePropsFactories,v=void 0===d?m.default:d,y=t.selectorFactory,g=void 0===y?O.default:y;return function(t,e,r){var c=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{},p=c.pure,d=void 0===p||p,h=c.areStatesEqual,b=void 0===h?u:h,y=c.areOwnPropsEqual,m=void 0===y?l.default:y,O=c.areStatePropsEqual,P=void 0===O?l.default:O,_=c.areMergedPropsEqual,w=void 0===_?l.default:_,x=o(c,["pure","areStatesEqual","areOwnPropsEqual","areStatePropsEqual","areMergedPropsEqual"]),M=i(t,s,"mapStateToProps"),S=i(e,f,"mapDispatchToProps"),C=i(r,v,"mergeProps");return n(g,a({methodName:"connect",getDisplayName:function(t){return"Connect("+t+")"},shouldHandleStateChanges:!!t,initMapStateToProps:M,initMapDispatchToProps:S,initMergeProps:C,pure:d,areStatesEqual:b,areOwnPropsEqual:m,areStatePropsEqual:P,areMergedPropsEqual:w},x))}}e.__esModule=!0;var a=Object.assign||function(t){for(var e=1;arguments.length>e;e++){var n=arguments[e];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(t[r]=n[r])}return t};e.createConnect=s;var c=n(10),p=r(c),f=n(58),l=r(f),d=n(52),h=r(d),v=n(53),b=r(v),y=n(54),m=r(y),g=n(55),O=r(g);e.default=s()},function(t,e,n){"use strict";function r(t){return"function"==typeof t?(0,s.wrapMapToPropsFunc)(t,"mapDispatchToProps"):void 0}function o(t){return t?void 0:(0,s.wrapMapToPropsConstant)(function(t){return{dispatch:t}})}function i(t){return t&&"object"==typeof t?(0,s.wrapMapToPropsConstant)(function(e){return(0,u.bindActionCreators)(t,e)}):void 0}e.__esModule=!0,e.whenMapDispatchToPropsIsFunction=r,e.whenMapDispatchToPropsIsMissing=o,e.whenMapDispatchToPropsIsObject=i;var u=n(16),s=n(11);e.default=[r,o,i]},function(t,e,n){"use strict";function r(t){return"function"==typeof t?(0,i.wrapMapToPropsFunc)(t,"mapStateToProps"):void 0}function o(t){return t?void 0:(0,i.wrapMapToPropsConstant)(function(){return{}})}e.__esModule=!0,e.whenMapStateToPropsIsFunction=r,e.whenMapStateToPropsIsMissing=o;var i=n(11);e.default=[r,o]},function(t,e,n){"use strict";function r(t){return t&&t.__esModule?t:{default:t}}function o(t,e,n){return a({},n,t,e)}function i(t){return function(e,n){var r=n.pure,o=n.areMergedPropsEqual,i=!1,u=void 0;return function(e,n,s){var a=t(e,n,s);return i?r&&o(a,u)||(u=a):(i=!0,u=a),u}}}function u(t){return"function"==typeof t?i(t):void 0}function s(t){return t?void 0:function(){return o}}e.__esModule=!0;var a=Object.assign||function(t){for(var e=1;arguments.length>e;e++){var n=arguments[e];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(t[r]=n[r])}return t};e.defaultMergeProps=o,e.wrapMergePropsFunc=i,e.whenMergePropsIsFunction=u,e.whenMergePropsIsOmitted=s;var c=n(14);r(c);e.default=[u,s]},function(t,e,n){"use strict";function r(t){return t&&t.__esModule?t:{default:t}}function o(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}function i(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,v=i,b=t(h,v),y=e(r,v),m=n(b,y,v),d=!0,m}function u(){return b=t(h,v),e.dependsOnOwnProps&&(y=e(r,v)),m=n(b,y,v)}function s(){return t.dependsOnOwnProps&&(b=t(h,v)),e.dependsOnOwnProps&&(y=e(r,v)),m=n(b,y,v)}function a(){var e=t(h,v),r=!l(e,b);return b=e,r&&(m=n(b,y,v)),m}function c(t,e){var n=!f(e,v),r=!p(t,h);return h=t,v=e,n&&r?u():n?s():r?a():m}var p=o.areStatesEqual,f=o.areOwnPropsEqual,l=o.areStatePropsEqual,d=!1,h=void 0,v=void 0,b=void 0,y=void 0,m=void 0;return function(t,e){return d?c(t,e):i(t,e)}}function s(t,e){var n=e.initMapStateToProps,r=e.initMapDispatchToProps,s=e.initMergeProps,a=o(e,["initMapStateToProps","initMapDispatchToProps","initMergeProps"]),c=n(t,a),p=r(t,a),f=s(t,a),l=a.pure?u:i;return l(c,p,f,t,a)}e.__esModule=!0,e.impureFinalPropsSelectorFactory=i,e.pureFinalPropsSelectorFactory=u,e.default=s;var a=n(56);r(a)},function(t,e,n){"use strict";function r(t){return t&&t.__esModule?t:{default:t}}function o(t,e,n){if(!t)throw Error("Unexpected value for "+e+" in "+n+".");"mapStateToProps"!==e&&"mapDispatchToProps"!==e||t.hasOwnProperty("dependsOnOwnProps")||(0,s.default)("The selector for "+e+" of "+n+" did not specify a value for dependsOnOwnProps.")}function i(t,e,n,r){o(t,"mapStateToProps",r),o(e,"mapDispatchToProps",r),o(n,"mergeProps",r)}e.__esModule=!0,e.default=i;var u=n(5),s=r(u)},function(t,e){"use strict";function n(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function r(){var t=[],e=[];return{clear:function(){e=o,t=o},notify:function(){for(var n=t=e,r=0;n.length>r;r++)n[r]()},subscribe:function(n){var r=!0;return e===t&&(e=t.slice()),e.push(n),function(){r&&t!==o&&(r=!1,e===t&&(e=t.slice()),e.splice(e.indexOf(n),1))}}}}e.__esModule=!0;var o=null,i={notify:function(){}},u=function(){function t(e,r,o){n(this,t),this.store=e,this.parentSub=r,this.onStateChange=o,this.unsubscribe=null,this.listeners=i}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=r())},t.prototype.tryUnsubscribe=function(){this.unsubscribe&&(this.unsubscribe(),this.unsubscribe=null,this.listeners.clear(),this.listeners=i)},t}();e.default=u},function(t,e){"use strict";function n(t,e){return t===e?0!==t||0!==e||1/t===1/e:t!==t&&e!==e}function r(t,e){if(n(t,e))return!0;if("object"!=typeof t||null===t||"object"!=typeof e||null===e)return!1;var r=Object.keys(t),i=Object.keys(e);if(r.length!==i.length)return!1;for(var u=0;r.length>u;u++)if(!o.call(e,r[u])||!n(t[r[u]],e[r[u]]))return!1;return!0}e.__esModule=!0,e.default=r;var o=Object.prototype.hasOwnProperty},function(t,e,n){function r(t){return null==t?void 0===t?a:s:c&&c in Object(t)?i(t):u(t)}var o=n(15),i=n(62),u=n(63),s="[object Null]",a="[object Undefined]",c=o?o.toStringTag:void 0;t.exports=r},function(t,e){(function(e){var n="object"==typeof e&&e&&e.Object===Object&&e;t.exports=n}).call(e,function(){return this}())},function(t,e,n){var r=n(64),o=r(Object.getPrototypeOf,Object);t.exports=o},function(t,e,n){function r(t){var e=u.call(t,a),n=t[a];try{t[a]=void 0;var r=!0}catch(t){}var o=s.call(t);return r&&(e?t[a]=n:delete t[a]),o}var o=n(15),i=Object.prototype,u=i.hasOwnProperty,s=i.toString,a=o?o.toStringTag:void 0;t.exports=r},function(t,e){function n(t){return o.call(t)}var r=Object.prototype,o=r.toString;t.exports=n},function(t,e){function n(t,e){return function(n){return t(e(n))}}t.exports=n},function(t,e,n){var r=n(60),o="object"==typeof self&&self&&self.Object===Object&&self,i=r||o||Function("return this")();t.exports=i},function(t,e){function n(t){return null!=t&&"object"==typeof t}t.exports=n},function(t,e,n){function r(t){if(!u(t)||o(t)!=s)return!1;var e=i(t);if(null===e)return!0;var n=f.call(e,"constructor")&&e.constructor;return"function"==typeof n&&n instanceof n&&p.call(n)==l}var o=n(59),i=n(61),u=n(66),s="[object Object]",a=Function.prototype,c=Object.prototype,p=a.toString,f=c.hasOwnProperty,l=p.call(Object);t.exports=r}])}); \ No newline at end of file diff --git a/examples/gh-pages/components/Box.js b/examples/gh-pages/components/Box.js index 7dcb95e..9b6cccf 100644 --- a/examples/gh-pages/components/Box.js +++ b/examples/gh-pages/components/Box.js @@ -1,4 +1,5 @@ -import React, { Component, PropTypes } from 'react'; +import React, { Component } from 'react'; +import PropTypes from 'prop-types'; const STYLE_PROPS = { boxDefault: { diff --git a/examples/react-transform-boilerplate/src/Box.js b/examples/react-transform-boilerplate/src/Box.js index baebf59..9863824 100644 --- a/examples/react-transform-boilerplate/src/Box.js +++ b/examples/react-transform-boilerplate/src/Box.js @@ -1,4 +1,5 @@ -import React, { Component, PropTypes } from 'react'; +import React, { Component } from 'react'; +import PropTypes from 'prop-types'; const container = { box: { height: '30px' }, diff --git a/examples/react-transform-boilerplate/src/ToolBar.js b/examples/react-transform-boilerplate/src/ToolBar.js index e9d8059..09ab081 100644 --- a/examples/react-transform-boilerplate/src/ToolBar.js +++ b/examples/react-transform-boilerplate/src/ToolBar.js @@ -1,4 +1,5 @@ -import React, { Component, PropTypes } from 'react'; +import React, { Component } from 'react'; +import PropTypes from 'prop-types'; import { bindActionCreators } from 'redux'; import { connect } from 'react-redux'; import { Row, Cell } from 'react-inline-grid'; diff --git a/lib/components/Grid.js b/lib/components/Grid.js new file mode 100644 index 0000000..c2742ad --- /dev/null +++ b/lib/components/Grid.js @@ -0,0 +1,190 @@ +'use strict'; + +exports.__esModule = true; + +var _createClass = (function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ('value' in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; })(); + +exports.ensureValue = ensureValue; +exports.ensureListProperties = ensureListProperties; +exports.build = build; +exports.setMedia = setMedia; +exports.setReference = setReference; + +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; } + +function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError('Cannot call a class as a function'); } } + +function _inherits(subClass, superClass) { if (typeof superClass !== 'function' && superClass !== null) { throw new TypeError('Super expression must either be null or a function, not ' + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; } + +var _react = require('react'); + +var _react2 = _interopRequireDefault(_react); + +var _propTypes = require('prop-types'); + +var _propTypes2 = _interopRequireDefault(_propTypes); + +var _reactRedux = require('react-redux'); + +var _matchMedia = require('../matchMedia'); + +var _matchMedia2 = _interopRequireDefault(_matchMedia); + +var _store = require('../store'); + +var _store2 = _interopRequireDefault(_store); + +var _reducersMedia = require('../reducers/media'); + +var _constants = require('../constants'); + +var _utilsInvariant = require('../utils/invariant'); + +var _utilsInvariant2 = _interopRequireDefault(_utilsInvariant); + +var optionsShape = _propTypes2['default'].shape({ + columns: _propTypes2['default'].number, + gutter: _propTypes2['default'].number, + margin: _propTypes2['default'].number, + deaf: _propTypes2['default'].bool, + list: _propTypes2['default'].arrayOf(_propTypes2['default'].shape({ + name: _propTypes2['default'].string.isRequired, + query: _propTypes2['default'].string.isRequired, + gutter: _propTypes2['default'].number, + margin: _propTypes2['default'].number + })) +}); + +function ensureValue(options, base, key, value) { + if (process.env.NODE_ENV !== 'production') { + _utilsInvariant2['default'](key, ' -> ensureValue -> key must be defined.'); + + _utilsInvariant2['default'](base, ' -> ensureValue -> base must be defined.'); + + _utilsInvariant2['default'](typeof base[key] !== 'undefined', ' -> ensureValue -> base -> key must be defined.'); + } + + if (value >= 0) return value; + var result = options && options[key] >= 0 ? options[key] : base[key]; + return result; +} + +function ensureListProperties(options, base, list) { + return list.map(function (n) { + var name = n.name; + var query = n.query; + var gutter = n.gutter; + var margin = n.margin; + + return { + name: name, + query: query, + gutter: ensureValue(options, base, 'gutter', gutter), + margin: ensureValue(options, base, 'margin', margin) + }; + }); +} + +function build() { + var options = arguments.length <= 0 || arguments[0] === undefined ? {} : arguments[0]; + var base = arguments.length <= 1 || arguments[1] === undefined ? {} : arguments[1]; + var columns = options.columns; + var _options$deaf = options.deaf; + var deaf = _options$deaf === undefined ? false : _options$deaf; + var _options$list = options.list; + var list = _options$list === undefined ? base.list : _options$list; + + var size = list.length; + + _utilsInvariant2['default'](!!size, ' -> options -> list can not be empty'); + + if (columns) { + _utilsInvariant2['default'](!(columns % size) > 0, ' -> options -> columns must be a multiple of ' + ' -> options -> list -> length'); + } + + return { + columns: columns || size * 4, + deaf: deaf, + list: ensureListProperties(options, base, list) + }; +} + +function setMedia(name) { + return { name: name }; +} + +function setReference(options) { + return { options: options }; +} + +var Grid = (function (_Component) { + _inherits(Grid, _Component); + + _createClass(Grid, null, [{ + key: 'propTypes', + value: { + options: optionsShape, + children: _propTypes2['default'].element.isRequired + }, + enumerable: true + }]); + + function Grid(props, context) { + _classCallCheck(this, Grid); + + _Component.call(this, props, context); + + // Initialize a new Model: + // If -> options is missing, it return a default Model. + // if -> options is provided, it return a valid Model. + var model = build(props.options, _constants.MEDIA_MODEL_HELPER); + + this.match = _matchMedia2['default'](model.list); + this.shouldSubscribe = model.deaf !== true; + + // Initialize Redux `store`. + var media = setMedia(this.match.getCurrentName); + var reference = setReference(model); + this.store = _store2['default']({ media: media, reference: reference }); + } + + Grid.prototype.componentDidMount = function componentDidMount() { + this.trySubscribe(); + }; + + Grid.prototype.componentWillUnmount = function componentWillUnmount() { + this.tryUnsubscribe(); + }; + + Grid.prototype.render = function render() { + return _react2['default'].createElement( + _reactRedux.Provider, + { store: this.store }, + _react.Children.only(this.props.children) + ); + }; + + Grid.prototype.trySubscribe = function trySubscribe() { + if (this.shouldSubscribe && !this.unsubscribe) { + this.unsubscribe = this.match.subscribe(this.handleChange.bind(this)); + } + }; + + Grid.prototype.tryUnsubscribe = function tryUnsubscribe() { + if (this.unsubscribe) { + this.unsubscribe(); + this.unsubscribe = null; + } + }; + + Grid.prototype.handleChange = function handleChange(payload) { + if (!this.unsubscribe) { + return; + } + this.store.dispatch(_reducersMedia.updateMediaName(payload)); + }; + + return Grid; +})(_react.Component); + +exports['default'] = Grid; \ No newline at end of file diff --git a/lib/components/createComponent.js b/lib/components/createComponent.js new file mode 100644 index 0000000..78a4498 --- /dev/null +++ b/lib/components/createComponent.js @@ -0,0 +1,107 @@ +'use strict'; + +exports.__esModule = true; + +var _createClass = (function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ('value' in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; })(); + +var _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; + +exports['default'] = createComponent; + +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; } + +function _objectWithoutProperties(obj, keys) { var target = {}; for (var i in obj) { if (keys.indexOf(i) >= 0) continue; if (!Object.prototype.hasOwnProperty.call(obj, i)) continue; target[i] = obj[i]; } return target; } + +function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError('Cannot call a class as a function'); } } + +function _inherits(subClass, superClass) { if (typeof superClass !== 'function' && superClass !== null) { throw new TypeError('Super expression must either be null or a function, not ' + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; } + +var _react = require('react'); + +var _react2 = _interopRequireDefault(_react); + +var _propTypes = require('prop-types'); + +var _propTypes2 = _interopRequireDefault(_propTypes); + +var _reactRedux = require('react-redux'); + +var _utilsPick = require('../utils/pick'); + +var _utilsPick2 = _interopRequireDefault(_utilsPick); + +var mapStateToProps = function mapStateToProps(state) { + return _extends({}, state); +}; + +var mergeProps = function mergeProps(stateProps, dispatchProps, _ref) { + var is = _ref.is; + + var clean = _objectWithoutProperties(_ref, ['is']); + + return _extends({}, clean, { + grid: _extends({}, stateProps, { + is: is + }) + }); +}; + +var gridShape = _propTypes2['default'].shape({ + media: _propTypes2['default'].object.isRequired, + reference: _propTypes2['default'].object.isRequired, + is: _propTypes2['default'].string +}).isRequired; + +var elem = function elem(tag) { + return (function (_Component) { + _inherits(Elem, _Component); + + function Elem() { + _classCallCheck(this, Elem); + + _Component.apply(this, arguments); + } + + Elem.prototype.shouldComponentUpdate = function shouldComponentUpdate(nextProps) { + if (process.env.NODE_ENV !== 'production') { + return true; + } + + if (process.env.NODE_ENV === 'production') { + return nextProps.grid.media.name !== this.props.grid.media.name || nextProps.grid.is !== this.props.grid.is; + } + }; + + Elem.prototype.render = function render() { + var _props = this.props; + var grid = _props.grid; + var children = _props.children; + + var clean = _objectWithoutProperties(_props, ['grid', 'children']); + + return _react2['default'].createElement( + 'div', + { style: _utilsPick2['default'](tag, grid) }, + _react.Children.map(children, function (child) { + return _react.cloneElement(child, _extends({}, clean)); + }) + ); + }; + + _createClass(Elem, null, [{ + key: 'propTypes', + value: { + grid: gridShape + }, + enumerable: true + }]); + + return Elem; + })(_react.Component); +}; + +function createComponent(tag) { + return _reactRedux.connect(mapStateToProps, null, mergeProps)(elem(tag)); +} + +module.exports = exports['default']; \ No newline at end of file diff --git a/lib/constants.js b/lib/constants.js new file mode 100644 index 0000000..ea62d9e --- /dev/null +++ b/lib/constants.js @@ -0,0 +1,29 @@ +'use strict'; + +exports.__esModule = true; + +var _WHITE_LIST; + +var UPDATE_MEDIA_NAME = 'media/name/UPDATE'; +exports.UPDATE_MEDIA_NAME = UPDATE_MEDIA_NAME; +var ROW_ID = 'row'; +exports.ROW_ID = ROW_ID; +var CELL_ID = 'cell'; +exports.CELL_ID = CELL_ID; +var MEDIA_MODEL_HELPER = { + gutter: 16, + margin: 16, + list: [{ + name: 'phone', + query: '(max-width: 479px)' + }, { + name: 'tablet', + query: '(min-width: 480px) and (max-width: 839px)' + }, { + name: 'desktop', + query: '(min-width: 840px)' + }] +}; +exports.MEDIA_MODEL_HELPER = MEDIA_MODEL_HELPER; +var WHITE_LIST = (_WHITE_LIST = {}, _WHITE_LIST[ROW_ID] = ['row', 'start', 'center', 'end', 'around', 'between', 'nospace'], _WHITE_LIST[CELL_ID] = ['cell', '1', '2', '3', '4', '5', '6', '7', '8', '9', '10', '11', '12', 'top', 'middle', 'bottom', 'stretch', 'between', 'offset', 'nospace'], _WHITE_LIST); +exports.WHITE_LIST = WHITE_LIST; \ No newline at end of file diff --git a/lib/index.js b/lib/index.js new file mode 100644 index 0000000..a71896c --- /dev/null +++ b/lib/index.js @@ -0,0 +1,23 @@ +'use strict'; + +exports.__esModule = true; + +function _interopRequire(obj) { return obj && obj.__esModule ? obj['default'] : obj; } + +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; } + +var _constants = require('./constants'); + +var _componentsCreateComponent = require('./components/createComponent'); + +var _componentsCreateComponent2 = _interopRequireDefault(_componentsCreateComponent); + +var _componentsGrid = require('./components/Grid'); + +exports.Grid = _interopRequire(_componentsGrid); + +var Row = _componentsCreateComponent2['default'](_constants.ROW_ID); +var Cell = _componentsCreateComponent2['default'](_constants.CELL_ID); + +exports.Row = Row; +exports.Cell = Cell; \ No newline at end of file diff --git a/lib/matchMedia.js b/lib/matchMedia.js new file mode 100644 index 0000000..e58bd61 --- /dev/null +++ b/lib/matchMedia.js @@ -0,0 +1,110 @@ +"use strict"; + +exports.__esModule = true; +exports["default"] = matchMedia; + +function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } + +function setModel(options) { + return options.map(function (n) { + var name = n.name; + var query = n.query; + + return { + name: name, + query: query + }; + }); +} + +function setState(model, handleChange) { + return model.map(function (_ref) { + var name = _ref.name; + var query = _ref.query; + + var match = window.matchMedia(query); + match.add = function () { + return match.addListener(handleChange); + }; + match.add(); + match.remove = function () { + return match.removeListener(handleChange); + }; + + return { + name: name, + match: match + }; + }); +} + +var MatchMedia = (function () { + function MatchMedia(list) { + _classCallCheck(this, MatchMedia); + + this.listeners = []; + this.state = []; + this.model = setModel(list.slice()); + + return this.updateState(); + } + + MatchMedia.prototype.handleChange = function handleChange() { + this.state.slice().forEach(function (_ref2) { + var match = _ref2.match; + return match.remove(); + }); + + return this.updateState(); + }; + + MatchMedia.prototype.updateState = function updateState() { + this.state = setState(this.model, this.handleChange.bind(this)); + + return this.dispatchUpdate(); + }; + + MatchMedia.prototype.getCurrentName = function getCurrentName() { + var current = this.state.filter(function (_ref3) { + var match = _ref3.match; + return match.matches; + }); + + var _ref4 = current.length > 0 ? current[0] : this.model[0]; + + var name = _ref4.name; + + return name; + }; + + MatchMedia.prototype.dispatchUpdate = function dispatchUpdate() { + var current = this.getCurrentName(); + return this.listeners.slice().forEach(function (listener) { + return listener(current); + }); + }; + + MatchMedia.prototype.subscribe = function subscribe(listener) { + this.listeners.push(listener); + + return function unsubscribe() { + if (this.listeners != null) { + var index = this.listeners.indexOf(listener); + this.listeners = this.listeners.slice(index, 1); + } + }; + }; + + return MatchMedia; +})(); + +function matchMedia(list) { + var mM = new MatchMedia(list); + + return { + subscribe: mM.subscribe.bind(mM), + getCurrentName: mM.getCurrentName() + }; +} + +module.exports = exports["default"]; \ No newline at end of file diff --git a/lib/reducers/media.js b/lib/reducers/media.js new file mode 100644 index 0000000..e4a9dfc --- /dev/null +++ b/lib/reducers/media.js @@ -0,0 +1,40 @@ +'use strict'; + +exports.__esModule = true; + +var _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; + +exports.hydrateMedia = hydrateMedia; +exports.updateMediaName = updateMediaName; +exports['default'] = media; + +var _constants = require('../constants'); + +function hydrateMedia(_ref) { + var name = _ref.name; + + return { + name: name + }; +} + +function updateMediaName(payload) { + return { + type: _constants.UPDATE_MEDIA_NAME, + payload: payload + }; +} + +function media() { + var state = arguments.length <= 0 || arguments[0] === undefined ? {} : arguments[0]; + var action = arguments.length <= 1 || arguments[1] === undefined ? {} : arguments[1]; + + switch (action.type) { + case _constants.UPDATE_MEDIA_NAME: + return _extends({}, state, { + name: action.payload + }); + default: + return state; + } +} \ No newline at end of file diff --git a/lib/reducers/reference.js b/lib/reducers/reference.js new file mode 100644 index 0000000..ddfe3a9 --- /dev/null +++ b/lib/reducers/reference.js @@ -0,0 +1,137 @@ +'use strict'; + +exports.__esModule = true; + +var _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; + +exports.hydrateReference = hydrateReference; +exports['default'] = reference; + +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; } + +var _utilsIsUAFixNeeded = require('../utils/isUAFixNeeded'); + +var _utilsIsUAFixNeeded2 = _interopRequireDefault(_utilsIsUAFixNeeded); + +var _utilsFixUserAgent = require('../utils/fixUserAgent'); + +var _utilsFixUserAgent2 = _interopRequireDefault(_utilsFixUserAgent); + +var _utilsCalcPropWithGutter = require('../utils/calcPropWithGutter'); + +var _utilsCalcPropWithGutter2 = _interopRequireDefault(_utilsCalcPropWithGutter); + +var _constants = require('../constants'); + +var ROW_ROOT = { + display: 'flex', + flexFlow: 'row wrap', + alignItems: 'stretch' +}; + +var buildRow = function buildRow(id, FIXED_ROW, gutter, margin) { + var _ref; + + return _ref = {}, _ref[id] = _extends({}, FIXED_ROW, { + padding: margin - gutter / 2 + 'px' + }), _ref; +}; + +exports.buildRow = buildRow; +var buildRowTypeProperties = function buildRowTypeProperties(justifyContent) { + var _start, _center, _end, _around, _between; + + return { + start: (_start = {}, _start[justifyContent] = 'flex-start', _start), + center: (_center = {}, _center[justifyContent] = 'center', _center), + end: (_end = {}, _end[justifyContent] = 'flex-end', _end), + around: (_around = {}, _around[justifyContent] = 'space-around', _around), + between: (_between = {}, _between[justifyContent] = 'space-between', _between) + }; +}; + +exports.buildRowTypeProperties = buildRowTypeProperties; +var buildCell = function buildCell(id, gutter) { + var _ref2; + + return _ref2 = {}, _ref2[id] = { + boxSizing: 'border-box', + margin: gutter / 2 + 'px', + width: 'calc(100% - ' + gutter + 'px)' + }, _ref2; +}; + +exports.buildCell = buildCell; +var buildCellTypeProperties = function buildCellTypeProperties(alignSelf) { + var _top, _middle, _bottom, _stretch; + + return { + top: (_top = {}, _top[alignSelf] = 'flex-start', _top), + middle: (_middle = {}, _middle[alignSelf] = 'center', _middle), + bottom: (_bottom = {}, _bottom[alignSelf] = 'flex-end', _bottom), + stretch: (_stretch = {}, _stretch[alignSelf] = 'stretch', _stretch) + }; +}; + +exports.buildCellTypeProperties = buildCellTypeProperties; +var buildSharedProperties = function buildSharedProperties() { + return { + nospace: { padding: 0, margin: 0 } + }; +}; + +exports.buildSharedProperties = buildSharedProperties; + +function hydrateReference(_ref3) { + var options = _ref3.options; + var columns = options.columns; + var list = options.list; + + var size = list.length; + + return list.reduce(function (acc, current, i) { + var _extends2; + + var name = current.name; + var gutter = current.gutter; + var margin = current.margin; + + var _fixUserAgent = _utilsFixUserAgent2['default'](ROW_ROOT, _utilsIsUAFixNeeded2['default'](navigator.userAgent)); + + var justifyContent = _fixUserAgent.justifyContent; + var alignSelf = _fixUserAgent.alignSelf; + var FIXED_ROW = _fixUserAgent.FIXED_ROW; + + // 4 + // 8 + // 12 + var localColumns = columns / size * (i + 1); + + // Define partial sizes for columnNumber < totalColumns. + var partialWidth = _utilsCalcPropWithGutter2['default']([1, localColumns, gutter], 'width'); + + // Define sizes = 100% for everything else. + var fullWidth = _utilsCalcPropWithGutter2['default']([localColumns, columns + 1, gutter], 'width', true); + + // Define offset sizes. + var offset = _utilsCalcPropWithGutter2['default']([0, localColumns, gutter / 2], 'marginLeft'); + + var row = buildRow(_constants.ROW_ID, FIXED_ROW, gutter, margin); + var rowTypeProperties = buildRowTypeProperties(justifyContent); + + var cell = buildCell(_constants.CELL_ID, gutter); + var cellTypeProperties = buildCellTypeProperties(alignSelf); + + var sharedProperties = buildSharedProperties(); + + return _extends({}, acc, (_extends2 = {}, _extends2[name] = _extends({}, row, rowTypeProperties, cell, cellTypeProperties, partialWidth, fullWidth, sharedProperties, { + offset: _extends({}, offset) + }), _extends2)); + }, {}); +} + +function reference() { + var state = arguments.length <= 0 || arguments[0] === undefined ? {} : arguments[0]; + + return state; +} \ No newline at end of file diff --git a/lib/store.js b/lib/store.js new file mode 100644 index 0000000..0eeec8c --- /dev/null +++ b/lib/store.js @@ -0,0 +1,25 @@ +'use strict'; + +exports.__esModule = true; +exports['default'] = store; + +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; } + +var _redux = require('redux'); + +var _reducersMedia = require('./reducers/media'); + +var _reducersMedia2 = _interopRequireDefault(_reducersMedia); + +var _reducersReference = require('./reducers/reference'); + +var _reducersReference2 = _interopRequireDefault(_reducersReference); + +function store(initialState) { + return _redux.createStore(_redux.combineReducers({ media: _reducersMedia2['default'], reference: _reducersReference2['default'] }), { + media: _reducersMedia.hydrateMedia(initialState.media), + reference: _reducersReference.hydrateReference(initialState.reference) + }); +} + +module.exports = exports['default']; \ No newline at end of file diff --git a/lib/utils/cache.js b/lib/utils/cache.js new file mode 100644 index 0000000..0ffed22 --- /dev/null +++ b/lib/utils/cache.js @@ -0,0 +1,5 @@ +"use strict"; + +exports.__esModule = true; +exports["default"] = {}; +module.exports = exports["default"]; \ No newline at end of file diff --git a/lib/utils/calcPropWithGutter.js b/lib/utils/calcPropWithGutter.js new file mode 100644 index 0000000..4393f85 --- /dev/null +++ b/lib/utils/calcPropWithGutter.js @@ -0,0 +1,26 @@ +'use strict'; + +exports.__esModule = true; +exports['default'] = calcPropWithGutter; + +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; } + +var _lodashUtilityRange = require('lodash/utility/range'); + +var _lodashUtilityRange2 = _interopRequireDefault(_lodashUtilityRange); + +function calcPropWithGutter(_ref, prop, isFull) { + var start = _ref[0]; + var end = _ref[1]; + var gutter = _ref[2]; + + return _lodashUtilityRange2['default'](start, end).reduce(function (acc, n) { + var _acc$n; + + var width = isFull ? 100 : n / end * 100; + acc[n] = (_acc$n = {}, _acc$n[prop] = 'calc(' + width + '% - ' + gutter + 'px)', _acc$n); + return acc; + }, {}); +} + +module.exports = exports['default']; \ No newline at end of file diff --git a/lib/utils/capitalize.js b/lib/utils/capitalize.js new file mode 100644 index 0000000..ba182f4 --- /dev/null +++ b/lib/utils/capitalize.js @@ -0,0 +1,10 @@ +"use strict"; + +exports.__esModule = true; +exports["default"] = capitalize; + +function capitalize(string) { + return string.charAt(0).toUpperCase() + string.slice(1); +} + +module.exports = exports["default"]; \ No newline at end of file diff --git a/lib/utils/fixUserAgent.js b/lib/utils/fixUserAgent.js new file mode 100644 index 0000000..e646f7a --- /dev/null +++ b/lib/utils/fixUserAgent.js @@ -0,0 +1,24 @@ +'use strict'; + +exports.__esModule = true; +exports['default'] = fixUserAgent; + +function fixUserAgent(rowRoot, needFix) { + var justifyContent = needFix ? 'WebkitJustifyContent' : 'justifyContent'; + + var alignSelf = needFix ? 'WebkitAlignSelf' : 'alignSelf'; + + var FIXED_ROW = needFix ? { + display: '-webkit-flex', + WebkitFlexFlow: 'row wrap', + WebkitAlignItems: 'stretch' + } : rowRoot; + + return { + justifyContent: justifyContent, + alignSelf: alignSelf, + FIXED_ROW: FIXED_ROW + }; +} + +module.exports = exports['default']; \ No newline at end of file diff --git a/lib/utils/invariant.js b/lib/utils/invariant.js new file mode 100644 index 0000000..9ac598c --- /dev/null +++ b/lib/utils/invariant.js @@ -0,0 +1,10 @@ +"use strict"; + +exports.__esModule = true; +exports["default"] = invariant; + +function invariant(condition, error) { + if (!condition) throw new Error(error); +} + +module.exports = exports["default"]; \ No newline at end of file diff --git a/lib/utils/isUAFixNeeded.js b/lib/utils/isUAFixNeeded.js new file mode 100644 index 0000000..ecc2280 --- /dev/null +++ b/lib/utils/isUAFixNeeded.js @@ -0,0 +1,10 @@ +'use strict'; + +exports.__esModule = true; +exports['default'] = isUAFixNeeded; + +function isUAFixNeeded(userAgent) { + return userAgent.indexOf('Chrome') < 0 && userAgent.indexOf('Safari') > -1; +} + +module.exports = exports['default']; \ No newline at end of file diff --git a/lib/utils/memoize.js b/lib/utils/memoize.js new file mode 100644 index 0000000..fbda1d9 --- /dev/null +++ b/lib/utils/memoize.js @@ -0,0 +1,21 @@ +'use strict'; + +exports.__esModule = true; +exports['default'] = memoize; + +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; } + +var _cache = require('./cache'); + +var _cache2 = _interopRequireDefault(_cache); + +function memoize(callback) { + return function getInMemory(key) { + if (!_cache2['default'].hasOwnProperty(key)) { + _cache2['default'][key] = callback.call(this, key); + } + return _cache2['default'][key]; + }; +} + +module.exports = exports['default']; \ No newline at end of file diff --git a/lib/utils/pick.js b/lib/utils/pick.js new file mode 100644 index 0000000..8a0639a --- /dev/null +++ b/lib/utils/pick.js @@ -0,0 +1,136 @@ +'use strict'; + +exports.__esModule = true; + +var _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; + +exports['default'] = pick; + +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; } + +var _lodashArrayCompact = require('lodash/array/compact'); + +var _lodashArrayCompact2 = _interopRequireDefault(_lodashArrayCompact); + +var _lodashObjectGet = require('lodash/object/get'); + +var _lodashObjectGet2 = _interopRequireDefault(_lodashObjectGet); + +var _memoize = require('./memoize'); + +var _memoize2 = _interopRequireDefault(_memoize); + +var _invariant = require('./invariant'); + +var _invariant2 = _interopRequireDefault(_invariant); + +var _capitalize = require('./capitalize'); + +var _capitalize2 = _interopRequireDefault(_capitalize); + +var _constants = require('../constants'); + +var parser = function parser(initial, input) { + if (input && input.trim()) { + return [initial].concat(input.trim().split(/\s+/)); + } + return [initial]; +}; + +exports.parser = parser; +var listReducer = function listReducer(name) { + var list = arguments.length <= 1 || arguments[1] === undefined ? [] : arguments[1]; + + return _lodashArrayCompact2['default'](list.map(function (n) { + var _n$split = n.split('-'); + + var entry = _n$split[0]; + + var value = _n$split.slice(1); + + switch (value.length) { + case 0: + return entry; + case 1: + if (entry === 'offset') { + return [entry].concat(value); + } + if (entry !== name) return false; + return value[0]; + case 2: + if (entry !== name) return false; + if (value[0] === 'offset') { + return value; + } + return false; + default: + return false; + } + })); +}; + +exports.listReducer = listReducer; +var generatePayload = function generatePayload(_ref, list) { + var name = _ref.name; + + return { + name: name, + list: listReducer(name, list) + }; +}; + +exports.generatePayload = generatePayload; +var reducePayload = function reducePayload(_ref2, reference) { + var name = _ref2.name; + var list = _ref2.list; + + return list.reduce(function (acc, current) { + var style = _lodashObjectGet2['default'](reference, [name].concat(current)); + return _extends({}, acc, style); + }, {}); +}; + +exports.reducePayload = reducePayload; +var getInReference = function getInReference(tag, _ref3) { + var media = _ref3.media; + var reference = _ref3.reference; + var is = _ref3.is; + + var list = parser(tag, is); + var payload = generatePayload(media, list); + + if (process.env.NODE_ENV !== 'production') { + payload.list.forEach(function (n) { + var value = Array.isArray(n) ? n[0] : n; + _invariant2['default'](_constants.WHITE_LIST[tag].indexOf(value) > -1, 'Property \'' + value + '\' is not allowed for <' + _capitalize2['default'](tag) + '> component.'); + }); + } + + return reducePayload(payload, reference); +}; + +exports.getInReference = getInReference; +var memoizeProcess = function memoizeProcess() { + for (var _len = arguments.length, arg = Array(_len), _key = 0; _key < _len; _key++) { + arg[_key] = arguments[_key]; + } + + return _memoize2['default'](function () { + return getInReference.apply(undefined, arg); + }); +}; + +exports.memoizeProcess = memoizeProcess; +var generateKey = function generateKey(tag, _ref4) { + var name = _ref4.media.name; + var is = _ref4.is; + return '' + tag + name + is; +}; + +exports.generateKey = generateKey; + +function pick() { + var key = generateKey.apply(undefined, arguments); + + return memoizeProcess.apply(undefined, arguments)(key); +} \ No newline at end of file diff --git a/package.json b/package.json index 9987b15..e01d394 100644 --- a/package.json +++ b/package.json @@ -41,11 +41,13 @@ "homepage": "https://github.com/broucz/react-inline-grid", "dependencies": { "lodash": "^3.10.1", - "react-redux": "^2.1.1", - "redux": "^2.0.0" + "prop-types": "^15.5.0", + "react": "^15.5.4", + "react-redux": "^5.0.4", + "redux": "^3.6.0" }, "peerDependencies": { - "react": "^0.14.0 || ^0.14.0-beta3 || ^0.14.0-rc1" + "react": "15.x" }, "devDependencies": { "babel": "^5.8.21", diff --git a/src/components/Grid.js b/src/components/Grid.js index bebca3a..32df1f1 100644 --- a/src/components/Grid.js +++ b/src/components/Grid.js @@ -1,4 +1,5 @@ -import React, { Component, PropTypes, Children } from 'react'; +import React, { Component, Children } from 'react'; +import PropTypes from 'prop-types'; import { Provider } from 'react-redux'; import matchMedia from '../matchMedia'; import store from '../store'; diff --git a/src/components/createComponent.js b/src/components/createComponent.js index e6d0e51..3dd4778 100644 --- a/src/components/createComponent.js +++ b/src/components/createComponent.js @@ -1,4 +1,5 @@ -import React, { Component, PropTypes, Children, cloneElement } from 'react'; +import React, { Component, Children, cloneElement } from 'react'; +import PropTypes from 'prop-types'; import { connect } from 'react-redux'; import pick from '../utils/pick';