react-responsive
Advanced tools
Comparing version 1.3.4 to 2.0.0
## Change Log | ||
### upcoming (2017/07/14 21:36 +00:00) | ||
### upcoming (2017/10/02 21:11 +00:00) | ||
- [14004ab](https://github.com/contra/react-responsive/commit/14004aba9ec54fd7b807abf6ed960a6cff87ada3) housekeeping (@contra) | ||
- [8ff7425](https://github.com/contra/react-responsive/commit/8ff742533e3fdf8d113c945cbe9291c16b8b3278) rebuild (@contra) | ||
- [#120](https://github.com/contra/react-responsive/pull/120) support react 16. (@whatknight) | ||
- [6b300d7](https://github.com/contra/react-responsive/commit/6b300d7cc1bb340afa14eb046290a5d03064120b) Merge branch 'master' into react16 (@contra) | ||
- [#119](https://github.com/contra/react-responsive/pull/119) Housekeeping (@whatknight) | ||
- [#121](https://github.com/contra/react-responsive/pull/121) Update README.txt (@vpicone) | ||
- [1d19af9](https://github.com/contra/react-responsive/commit/1d19af9a5e6ddf5baf11eb27f455165430cdd405) Update README.txt (@vpicone) | ||
- [bb69da2](https://github.com/contra/react-responsive/commit/bb69da2e74b615132dd30c4eecad2b88080e5287) support react 16. (@whatknight) | ||
- [e78cab9](https://github.com/contra/react-responsive/commit/e78cab9fafceb30195ffca6858df35560f3675b6) bump sinon (@whatknight) | ||
- [9429386](https://github.com/contra/react-responsive/commit/9429386ce0891c1904baadf725837e0a3f282746) remove transform runtime (@whatknight) | ||
- [8380bd9](https://github.com/contra/react-responsive/commit/8380bd91c3fbb73957f7410bd2512266f7c7053a) update webpack (@whatknight) | ||
- [307b31d](https://github.com/contra/react-responsive/commit/307b31d16cf4d336f50ad4c53739166e4bd1d80e) update babel config (@whatknight) | ||
- [48b2a33](https://github.com/contra/react-responsive/commit/48b2a33ad9a6c61fbbbac6dad6f54838f949d61a) update test deps (@whatknight) | ||
- [81d9d18](https://github.com/contra/react-responsive/commit/81d9d181d08634527b49bb62c66f5b2c72e606f1) update eslint (@whatknight) | ||
- [#117](https://github.com/contra/react-responsive/pull/117) Update README.md (@modosc) | ||
- [0b4d019](https://github.com/contra/react-responsive/commit/0b4d0197d1011c3e5899cc6003556a6526350bc1) Update README.md (@modosc) | ||
- [c55a77e](https://github.com/contra/react-responsive/commit/c55a77ec86c2db7d2aae4a3e67a08dba09a3a455) closes #116 (@contra) | ||
### v1.3.4 (2017/07/14 21:36 +00:00) | ||
- [c93ac7a](https://github.com/contra/react-responsive/commit/c93ac7a696a8d3f0f8a5b71ce7836375de13a28d) 1.3.4 (@contra) | ||
- [#109](https://github.com/contra/react-responsive/pull/109) fix Cannot read property 'removeListener' of undefined (@modosc) | ||
@@ -5,0 +25,0 @@ - [ea3d577](https://github.com/contra/react-responsive/commit/ea3d5774bc59fa06ad50d60e582a9f6da94b9bd5) update matchmediaquery@^0.2.1 (@modosc) |
@@ -10,3 +10,3 @@ (function webpackUniversalModuleDefinition(root, factory) { | ||
root["MediaQuery"] = factory(root["react"]); | ||
})(this, function(__WEBPACK_EXTERNAL_MODULE_15__) { | ||
})(this, function(__WEBPACK_EXTERNAL_MODULE_8__) { | ||
return /******/ (function(modules) { // webpackBootstrap | ||
@@ -20,10 +20,10 @@ /******/ // The module cache | ||
/******/ // Check if module is in cache | ||
/******/ if(installedModules[moduleId]) | ||
/******/ 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 | ||
/******/ i: moduleId, | ||
/******/ l: false, | ||
/******/ exports: {} | ||
/******/ }; | ||
@@ -35,3 +35,3 @@ /******/ | ||
/******/ // Flag the module as loaded | ||
/******/ module.loaded = true; | ||
/******/ module.l = true; | ||
/******/ | ||
@@ -49,2 +49,25 @@ /******/ // Return the exports of the module | ||
/******/ | ||
/******/ // define getter function for harmony exports | ||
/******/ __webpack_require__.d = function(exports, name, getter) { | ||
/******/ if(!__webpack_require__.o(exports, name)) { | ||
/******/ Object.defineProperty(exports, name, { | ||
/******/ configurable: false, | ||
/******/ enumerable: true, | ||
/******/ get: getter | ||
/******/ }); | ||
/******/ } | ||
/******/ }; | ||
/******/ | ||
/******/ // getDefaultExport function for compatibility with non-harmony modules | ||
/******/ __webpack_require__.n = function(module) { | ||
/******/ var getter = module && module.__esModule ? | ||
/******/ function getDefault() { return module['default']; } : | ||
/******/ function getModuleExports() { return module; }; | ||
/******/ __webpack_require__.d(getter, 'a', getter); | ||
/******/ return getter; | ||
/******/ }; | ||
/******/ | ||
/******/ // Object.prototype.hasOwnProperty.call | ||
/******/ __webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); }; | ||
/******/ | ||
/******/ // __webpack_public_path__ | ||
@@ -54,3 +77,3 @@ /******/ __webpack_require__.p = ""; | ||
/******/ // Load entry module and return exports | ||
/******/ return __webpack_require__(0); | ||
/******/ return __webpack_require__(__webpack_require__.s = 7); | ||
/******/ }) | ||
@@ -62,418 +85,133 @@ /************************************************************************/ | ||
'use strict'; | ||
Object.defineProperty(exports, "__esModule", { | ||
value: 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; }; | ||
var _react = __webpack_require__(15); | ||
var _react2 = _interopRequireDefault(_react); | ||
var _propTypes = __webpack_require__(8); | ||
var _propTypes2 = _interopRequireDefault(_propTypes); | ||
var _matchmediaquery = __webpack_require__(11); | ||
var _matchmediaquery2 = _interopRequireDefault(_matchmediaquery); | ||
var _hyphenateStyleName = __webpack_require__(7); | ||
var _hyphenateStyleName2 = _interopRequireDefault(_hyphenateStyleName); | ||
var _mediaQuery = __webpack_require__(5); | ||
var _mediaQuery2 = _interopRequireDefault(_mediaQuery); | ||
var _toQuery = __webpack_require__(9); | ||
var _toQuery2 = _interopRequireDefault(_toQuery); | ||
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 defaultTypes = { | ||
component: _propTypes2.default.node, | ||
query: _propTypes2.default.string, | ||
values: _propTypes2.default.shape(_mediaQuery2.default.matchers), | ||
children: _propTypes2.default.oneOfType([_propTypes2.default.node, _propTypes2.default.func]), | ||
onChange: _propTypes2.default.func, | ||
onBeforeChange: _propTypes2.default.func | ||
}; | ||
var mediaKeys = Object.keys(_mediaQuery2.default.all); | ||
var excludedQueryKeys = Object.keys(defaultTypes); | ||
var excludedPropKeys = excludedQueryKeys.concat(mediaKeys); | ||
function omit(object, keys) { | ||
var newObject = _extends({}, object); | ||
keys.forEach(function (key) { | ||
return delete newObject[key]; | ||
}); | ||
return newObject; | ||
} | ||
var MediaQuery = function (_React$Component) { | ||
_inherits(MediaQuery, _React$Component); | ||
function MediaQuery() { | ||
var _ref; | ||
var _temp, _this, _ret; | ||
_classCallCheck(this, MediaQuery); | ||
for (var _len = arguments.length, args = Array(_len), _key = 0; _key < _len; _key++) { | ||
args[_key] = arguments[_key]; | ||
} | ||
return _ret = (_temp = (_this = _possibleConstructorReturn(this, (_ref = MediaQuery.__proto__ || Object.getPrototypeOf(MediaQuery)).call.apply(_ref, [this].concat(args))), _this), _this.state = { matches: false }, _this.updateMatches = function () { | ||
if (_this._mql.matches === _this.state.matches) { | ||
return; | ||
} | ||
_this.setState({ | ||
matches: _this._mql.matches | ||
}); | ||
}, _this.removeMql = function () { | ||
if (_this._mql) { | ||
_this._mql.removeListener(_this.updateMatches); | ||
_this._mql.dispose(); | ||
} | ||
}, _temp), _possibleConstructorReturn(_this, _ret); | ||
} | ||
_createClass(MediaQuery, [{ | ||
key: 'componentWillMount', | ||
value: function componentWillMount() { | ||
this.updateQuery(this.props); | ||
} | ||
}, { | ||
key: 'componentWillReceiveProps', | ||
value: function componentWillReceiveProps(nextProps) { | ||
this.updateQuery(nextProps); | ||
} | ||
}, { | ||
key: 'updateQuery', | ||
value: function updateQuery(props) { | ||
var values = void 0; | ||
if (props.query) { | ||
this.query = props.query; | ||
} else { | ||
this.query = (0, _toQuery2.default)(omit(props, excludedQueryKeys)); | ||
} | ||
if (!this.query) { | ||
throw new Error('Invalid or missing MediaQuery!'); | ||
} | ||
if (props.values) { | ||
values = Object.keys(props.values).reduce(function (result, key) { | ||
result[(0, _hyphenateStyleName2.default)(key)] = props.values[key]; | ||
return result; | ||
}, {}); | ||
} | ||
this.removeMql(); | ||
this._mql = (0, _matchmediaquery2.default)(this.query, values); | ||
this._mql.addListener(this.updateMatches); | ||
this.updateMatches(); | ||
} | ||
}, { | ||
key: 'componentWillUpdate', | ||
value: function componentWillUpdate(_, nextState) { | ||
if (this.props.onBeforeChange && this.state.matches !== nextState.matches) { | ||
this.props.onBeforeChange(this.state.matches); | ||
} | ||
} | ||
}, { | ||
key: 'componentDidUpdate', | ||
value: function componentDidUpdate(_, prevState) { | ||
if (this.props.onChange && prevState.matches !== this.state.matches) { | ||
this.props.onChange(this.state.matches); | ||
} | ||
} | ||
}, { | ||
key: 'componentWillUnmount', | ||
value: function componentWillUnmount() { | ||
this.removeMql(); | ||
} | ||
}, { | ||
key: 'render', | ||
value: function render() { | ||
if (typeof this.props.children === 'function') { | ||
return this.props.children(this.state.matches); | ||
} | ||
if (this.state.matches === false) { | ||
return null; | ||
} | ||
var props = omit(this.props, excludedPropKeys); | ||
var hasMergeProps = Object.keys(props).length > 0; | ||
var childrenCount = _react2.default.Children.count(this.props.children); | ||
var wrapChildren = this.props.component || childrenCount > 1 || typeof this.props.children === 'string' || Array.isArray(this.props.children) && childrenCount == 1 || this.props.children === undefined; | ||
if (wrapChildren) { | ||
return _react2.default.createElement(this.props.component || 'div', props, this.props.children); | ||
} else if (hasMergeProps) { | ||
return _react2.default.cloneElement(this.props.children, props); | ||
} else if (childrenCount) { | ||
return this.props.children; | ||
} else { | ||
return null; | ||
} | ||
} | ||
}]); | ||
return MediaQuery; | ||
}(_react2.default.Component); | ||
MediaQuery.displayName = 'MediaQuery'; | ||
MediaQuery.defaultProps = { | ||
values: {} | ||
}; | ||
exports.default = MediaQuery; | ||
module.exports = exports['default']; | ||
/** | ||
* Copyright (c) 2013-present, Facebook, Inc. | ||
* | ||
* This source code is licensed under the MIT license found in the | ||
* LICENSE file in the root directory of this source tree. | ||
*/ | ||
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__(9)(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')(); | ||
} | ||
/***/ }), | ||
/* 1 */ | ||
/***/ (function(module, exports) { | ||
/***/ (function(module, exports, __webpack_require__) { | ||
// shim for using process in browser | ||
var process = module.exports = {}; | ||
// cached from whatever global is present so that test runners that stub it | ||
// don't break things. But we need to wrap it in a try catch in case it is | ||
// wrapped in strict mode code which doesn't define any globals. It's inside a | ||
// function because try/catches deoptimize in certain engines. | ||
var cachedSetTimeout; | ||
var cachedClearTimeout; | ||
function defaultSetTimout() { | ||
throw new Error('setTimeout has not been defined'); | ||
} | ||
function defaultClearTimeout () { | ||
throw new Error('clearTimeout has not been defined'); | ||
} | ||
(function () { | ||
try { | ||
if (typeof setTimeout === 'function') { | ||
cachedSetTimeout = setTimeout; | ||
} else { | ||
cachedSetTimeout = defaultSetTimout; | ||
} | ||
} catch (e) { | ||
cachedSetTimeout = defaultSetTimout; | ||
} | ||
try { | ||
if (typeof clearTimeout === 'function') { | ||
cachedClearTimeout = clearTimeout; | ||
} else { | ||
cachedClearTimeout = defaultClearTimeout; | ||
} | ||
} catch (e) { | ||
cachedClearTimeout = defaultClearTimeout; | ||
} | ||
} ()) | ||
function runTimeout(fun) { | ||
if (cachedSetTimeout === setTimeout) { | ||
//normal enviroments in sane situations | ||
return setTimeout(fun, 0); | ||
} | ||
// if setTimeout wasn't available but was latter defined | ||
if ((cachedSetTimeout === defaultSetTimout || !cachedSetTimeout) && setTimeout) { | ||
cachedSetTimeout = setTimeout; | ||
return setTimeout(fun, 0); | ||
} | ||
try { | ||
// when when somebody has screwed with setTimeout but no I.E. maddness | ||
return cachedSetTimeout(fun, 0); | ||
} catch(e){ | ||
try { | ||
// When we are in I.E. but the script has been evaled so I.E. doesn't trust the global object when called normally | ||
return cachedSetTimeout.call(null, fun, 0); | ||
} catch(e){ | ||
// same as above but when it's a version of I.E. that must have the global object for 'this', hopfully our context correct otherwise it will throw a global error | ||
return cachedSetTimeout.call(this, fun, 0); | ||
} | ||
} | ||
} | ||
function runClearTimeout(marker) { | ||
if (cachedClearTimeout === clearTimeout) { | ||
//normal enviroments in sane situations | ||
return clearTimeout(marker); | ||
} | ||
// if clearTimeout wasn't available but was latter defined | ||
if ((cachedClearTimeout === defaultClearTimeout || !cachedClearTimeout) && clearTimeout) { | ||
cachedClearTimeout = clearTimeout; | ||
return clearTimeout(marker); | ||
} | ||
try { | ||
// when when somebody has screwed with setTimeout but no I.E. maddness | ||
return cachedClearTimeout(marker); | ||
} catch (e){ | ||
try { | ||
// When we are in I.E. but the script has been evaled so I.E. doesn't trust the global object when called normally | ||
return cachedClearTimeout.call(null, marker); | ||
} catch (e){ | ||
// same as above but when it's a version of I.E. that must have the global object for 'this', hopfully our context correct otherwise it will throw a global error. | ||
// Some versions of I.E. have different rules for clearTimeout vs setTimeout | ||
return cachedClearTimeout.call(this, marker); | ||
} | ||
} | ||
} | ||
var queue = []; | ||
var draining = false; | ||
var currentQueue; | ||
var queueIndex = -1; | ||
function cleanUpNextTick() { | ||
if (!draining || !currentQueue) { | ||
return; | ||
} | ||
draining = false; | ||
if (currentQueue.length) { | ||
queue = currentQueue.concat(queue); | ||
} else { | ||
queueIndex = -1; | ||
} | ||
if (queue.length) { | ||
drainQueue(); | ||
} | ||
} | ||
function drainQueue() { | ||
if (draining) { | ||
return; | ||
} | ||
var timeout = runTimeout(cleanUpNextTick); | ||
draining = true; | ||
var len = queue.length; | ||
while(len) { | ||
currentQueue = queue; | ||
queue = []; | ||
while (++queueIndex < len) { | ||
if (currentQueue) { | ||
currentQueue[queueIndex].run(); | ||
} | ||
} | ||
queueIndex = -1; | ||
len = queue.length; | ||
} | ||
currentQueue = null; | ||
draining = false; | ||
runClearTimeout(timeout); | ||
} | ||
process.nextTick = function (fun) { | ||
var args = new Array(arguments.length - 1); | ||
if (arguments.length > 1) { | ||
for (var i = 1; i < arguments.length; i++) { | ||
args[i - 1] = arguments[i]; | ||
} | ||
} | ||
queue.push(new Item(fun, args)); | ||
if (queue.length === 1 && !draining) { | ||
runTimeout(drainQueue); | ||
} | ||
}; | ||
// v8 likes predictible objects | ||
function Item(fun, array) { | ||
this.fun = fun; | ||
this.array = array; | ||
} | ||
Item.prototype.run = function () { | ||
this.fun.apply(null, this.array); | ||
}; | ||
process.title = 'browser'; | ||
process.browser = true; | ||
process.env = {}; | ||
process.argv = []; | ||
process.version = ''; // empty string to avoid regexp issues | ||
process.versions = {}; | ||
function noop() {} | ||
process.on = noop; | ||
process.addListener = noop; | ||
process.once = noop; | ||
process.off = noop; | ||
process.removeListener = noop; | ||
process.removeAllListeners = noop; | ||
process.emit = noop; | ||
process.prependListener = noop; | ||
process.prependOnceListener = noop; | ||
process.listeners = function (name) { return [] } | ||
process.binding = function (name) { | ||
throw new Error('process.binding is not supported'); | ||
}; | ||
process.cwd = function () { return '/' }; | ||
process.chdir = function (dir) { | ||
throw new Error('process.chdir is not supported'); | ||
}; | ||
process.umask = function() { return 0; }; | ||
"use strict"; | ||
/** | ||
* Copyright (c) 2013-present, Facebook, Inc. | ||
* | ||
* This source code is licensed under the MIT license found in the | ||
* LICENSE file in the root directory of this source tree. | ||
* | ||
* | ||
*/ | ||
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; | ||
/***/ }), | ||
/* 2 */ | ||
/***/ (function(module, exports) { | ||
/***/ (function(module, exports, __webpack_require__) { | ||
"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; | ||
"use strict"; | ||
/** | ||
* Copyright (c) 2013-present, Facebook, Inc. | ||
* | ||
* This source code is licensed under the MIT license found in the | ||
* LICENSE file in the root directory of this source tree. | ||
* | ||
*/ | ||
/** | ||
* 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; | ||
/***/ }), | ||
@@ -483,79 +221,85 @@ /* 3 */ | ||
/* WEBPACK VAR INJECTION */(function(process) {/** | ||
* 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 (process.env.NODE_ENV !== 'production') { | ||
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; | ||
/* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(1))) | ||
"use strict"; | ||
/** | ||
* Copyright (c) 2014-present, Facebook, Inc. | ||
* | ||
* This source code is licensed under the MIT license found in the | ||
* LICENSE file in the root directory of this source tree. | ||
* | ||
*/ | ||
var emptyFunction = __webpack_require__(1); | ||
/** | ||
* 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) { | ||
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; | ||
/***/ }), | ||
/* 4 */ | ||
/***/ (function(module, exports) { | ||
/***/ (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 ReactPropTypesSecret = 'SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED'; | ||
module.exports = ReactPropTypesSecret; | ||
"use strict"; | ||
/** | ||
* Copyright (c) 2013-present, Facebook, Inc. | ||
* | ||
* This source code is licensed under the MIT license found in the | ||
* LICENSE file in the root directory of this source tree. | ||
*/ | ||
var ReactPropTypesSecret = 'SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED'; | ||
module.exports = ReactPropTypesSecret; | ||
/***/ }), | ||
@@ -565,99 +309,21 @@ /* 5 */ | ||
'use strict'; | ||
Object.defineProperty(exports, "__esModule", { | ||
value: 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; }; | ||
var _propTypes = __webpack_require__(8); | ||
var _propTypes2 = _interopRequireDefault(_propTypes); | ||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } | ||
var stringOrNumber = _propTypes2.default.oneOfType([_propTypes2.default.string, _propTypes2.default.number]); | ||
// properties that match media queries | ||
var matchers = { | ||
orientation: _propTypes2.default.oneOf(['portrait', 'landscape']), | ||
scan: _propTypes2.default.oneOf(['progressive', 'interlace']), | ||
aspectRatio: _propTypes2.default.string, | ||
deviceAspectRatio: _propTypes2.default.string, | ||
height: stringOrNumber, | ||
deviceHeight: stringOrNumber, | ||
width: stringOrNumber, | ||
deviceWidth: stringOrNumber, | ||
color: _propTypes2.default.bool, | ||
colorIndex: _propTypes2.default.bool, | ||
monochrome: _propTypes2.default.bool, | ||
resolution: stringOrNumber | ||
// media features | ||
};var features = _extends({ | ||
minAspectRatio: _propTypes2.default.string, | ||
maxAspectRatio: _propTypes2.default.string, | ||
minDeviceAspectRatio: _propTypes2.default.string, | ||
maxDeviceAspectRatio: _propTypes2.default.string, | ||
minHeight: stringOrNumber, | ||
maxHeight: stringOrNumber, | ||
minDeviceHeight: stringOrNumber, | ||
maxDeviceHeight: stringOrNumber, | ||
minWidth: stringOrNumber, | ||
maxWidth: stringOrNumber, | ||
minDeviceWidth: stringOrNumber, | ||
maxDeviceWidth: stringOrNumber, | ||
minColor: _propTypes2.default.number, | ||
maxColor: _propTypes2.default.number, | ||
minColorIndex: _propTypes2.default.number, | ||
maxColorIndex: _propTypes2.default.number, | ||
minMonochrome: _propTypes2.default.number, | ||
maxMonochrome: _propTypes2.default.number, | ||
minResolution: stringOrNumber, | ||
maxResolution: stringOrNumber | ||
}, matchers); | ||
// media types | ||
var types = { | ||
all: _propTypes2.default.bool, | ||
grid: _propTypes2.default.bool, | ||
aural: _propTypes2.default.bool, | ||
braille: _propTypes2.default.bool, | ||
handheld: _propTypes2.default.bool, | ||
print: _propTypes2.default.bool, | ||
projection: _propTypes2.default.bool, | ||
screen: _propTypes2.default.bool, | ||
tty: _propTypes2.default.bool, | ||
tv: _propTypes2.default.bool, | ||
embossed: _propTypes2.default.bool | ||
}; | ||
var all = _extends({}, types, features); | ||
// add the type property | ||
matchers.type = Object.keys(types); | ||
exports.default = { | ||
all: all, | ||
types: types, | ||
matchers: matchers, | ||
features: features | ||
}; | ||
module.exports = exports['default']; | ||
"use strict"; | ||
var uppercasePattern = /[A-Z]/g; | ||
var msPattern = /^ms-/; | ||
var cache = {}; | ||
function hyphenateStyleName(string) { | ||
return string in cache | ||
? cache[string] | ||
: cache[string] = string | ||
.replace(uppercasePattern, '-$&') | ||
.toLowerCase() | ||
.replace(msPattern, '-ms-'); | ||
} | ||
module.exports = hyphenateStyleName; | ||
/***/ }), | ||
@@ -667,128 +333,293 @@ /* 6 */ | ||
/* WEBPACK VAR INJECTION */(function(process) {/** | ||
* 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__(2); | ||
/** | ||
* 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 (process.env.NODE_ENV !== 'production') { | ||
(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; | ||
/* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(1))) | ||
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { | ||
value: 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; }; | ||
var _propTypes = __webpack_require__(0); | ||
var _propTypes2 = _interopRequireDefault(_propTypes); | ||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } | ||
var stringOrNumber = _propTypes2.default.oneOfType([_propTypes2.default.string, _propTypes2.default.number]); | ||
// properties that match media queries | ||
var matchers = { | ||
orientation: _propTypes2.default.oneOf(['portrait', 'landscape']), | ||
scan: _propTypes2.default.oneOf(['progressive', 'interlace']), | ||
aspectRatio: _propTypes2.default.string, | ||
deviceAspectRatio: _propTypes2.default.string, | ||
height: stringOrNumber, | ||
deviceHeight: stringOrNumber, | ||
width: stringOrNumber, | ||
deviceWidth: stringOrNumber, | ||
color: _propTypes2.default.bool, | ||
colorIndex: _propTypes2.default.bool, | ||
monochrome: _propTypes2.default.bool, | ||
resolution: stringOrNumber | ||
// media features | ||
};var features = _extends({ | ||
minAspectRatio: _propTypes2.default.string, | ||
maxAspectRatio: _propTypes2.default.string, | ||
minDeviceAspectRatio: _propTypes2.default.string, | ||
maxDeviceAspectRatio: _propTypes2.default.string, | ||
minHeight: stringOrNumber, | ||
maxHeight: stringOrNumber, | ||
minDeviceHeight: stringOrNumber, | ||
maxDeviceHeight: stringOrNumber, | ||
minWidth: stringOrNumber, | ||
maxWidth: stringOrNumber, | ||
minDeviceWidth: stringOrNumber, | ||
maxDeviceWidth: stringOrNumber, | ||
minColor: _propTypes2.default.number, | ||
maxColor: _propTypes2.default.number, | ||
minColorIndex: _propTypes2.default.number, | ||
maxColorIndex: _propTypes2.default.number, | ||
minMonochrome: _propTypes2.default.number, | ||
maxMonochrome: _propTypes2.default.number, | ||
minResolution: stringOrNumber, | ||
maxResolution: stringOrNumber | ||
}, matchers); | ||
// media types | ||
var types = { | ||
all: _propTypes2.default.bool, | ||
grid: _propTypes2.default.bool, | ||
aural: _propTypes2.default.bool, | ||
braille: _propTypes2.default.bool, | ||
handheld: _propTypes2.default.bool, | ||
print: _propTypes2.default.bool, | ||
projection: _propTypes2.default.bool, | ||
screen: _propTypes2.default.bool, | ||
tty: _propTypes2.default.bool, | ||
tv: _propTypes2.default.bool, | ||
embossed: _propTypes2.default.bool | ||
}; | ||
var all = _extends({}, types, features); | ||
// add the type property | ||
matchers.type = Object.keys(types); | ||
exports.default = { | ||
all: all, | ||
types: types, | ||
matchers: matchers, | ||
features: features | ||
}; | ||
module.exports = exports['default']; | ||
/***/ }), | ||
/* 7 */ | ||
/***/ (function(module, exports) { | ||
/***/ (function(module, exports, __webpack_require__) { | ||
'use strict'; | ||
var uppercasePattern = /[A-Z]/g; | ||
var msPattern = /^ms-/; | ||
var cache = {}; | ||
function hyphenateStyleName(string) { | ||
return string in cache | ||
? cache[string] | ||
: cache[string] = string | ||
.replace(uppercasePattern, '-$&') | ||
.toLowerCase() | ||
.replace(msPattern, '-ms-'); | ||
} | ||
module.exports = hyphenateStyleName; | ||
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { | ||
value: 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; }; | ||
var _react = __webpack_require__(8); | ||
var _react2 = _interopRequireDefault(_react); | ||
var _propTypes = __webpack_require__(0); | ||
var _propTypes2 = _interopRequireDefault(_propTypes); | ||
var _matchmediaquery = __webpack_require__(12); | ||
var _matchmediaquery2 = _interopRequireDefault(_matchmediaquery); | ||
var _hyphenateStyleName = __webpack_require__(5); | ||
var _hyphenateStyleName2 = _interopRequireDefault(_hyphenateStyleName); | ||
var _mediaQuery = __webpack_require__(6); | ||
var _mediaQuery2 = _interopRequireDefault(_mediaQuery); | ||
var _toQuery = __webpack_require__(14); | ||
var _toQuery2 = _interopRequireDefault(_toQuery); | ||
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 defaultTypes = { | ||
component: _propTypes2.default.node, | ||
query: _propTypes2.default.string, | ||
values: _propTypes2.default.shape(_mediaQuery2.default.matchers), | ||
children: _propTypes2.default.oneOfType([_propTypes2.default.node, _propTypes2.default.func]), | ||
onChange: _propTypes2.default.func, | ||
onBeforeChange: _propTypes2.default.func | ||
}; | ||
var mediaKeys = Object.keys(_mediaQuery2.default.all); | ||
var excludedQueryKeys = Object.keys(defaultTypes); | ||
var excludedPropKeys = excludedQueryKeys.concat(mediaKeys); | ||
function omit(object, keys) { | ||
var newObject = _extends({}, object); | ||
keys.forEach(function (key) { | ||
return delete newObject[key]; | ||
}); | ||
return newObject; | ||
} | ||
var MediaQuery = function (_React$Component) { | ||
_inherits(MediaQuery, _React$Component); | ||
function MediaQuery() { | ||
var _ref; | ||
var _temp, _this, _ret; | ||
_classCallCheck(this, MediaQuery); | ||
for (var _len = arguments.length, args = Array(_len), _key = 0; _key < _len; _key++) { | ||
args[_key] = arguments[_key]; | ||
} | ||
return _ret = (_temp = (_this = _possibleConstructorReturn(this, (_ref = MediaQuery.__proto__ || Object.getPrototypeOf(MediaQuery)).call.apply(_ref, [this].concat(args))), _this), _this.state = { matches: false }, _this.updateMatches = function () { | ||
if (_this._mql.matches === _this.state.matches) { | ||
return; | ||
} | ||
_this.setState({ | ||
matches: _this._mql.matches | ||
}); | ||
}, _this.removeMql = function () { | ||
if (_this._mql) { | ||
_this._mql.removeListener(_this.updateMatches); | ||
_this._mql.dispose(); | ||
} | ||
}, _temp), _possibleConstructorReturn(_this, _ret); | ||
} | ||
_createClass(MediaQuery, [{ | ||
key: 'componentWillMount', | ||
value: function componentWillMount() { | ||
this.updateQuery(this.props); | ||
} | ||
}, { | ||
key: 'componentWillReceiveProps', | ||
value: function componentWillReceiveProps(nextProps) { | ||
this.updateQuery(nextProps); | ||
} | ||
}, { | ||
key: 'updateQuery', | ||
value: function updateQuery(props) { | ||
var values = void 0; | ||
if (props.query) { | ||
this.query = props.query; | ||
} else { | ||
this.query = (0, _toQuery2.default)(omit(props, excludedQueryKeys)); | ||
} | ||
if (!this.query) { | ||
throw new Error('Invalid or missing MediaQuery!'); | ||
} | ||
if (props.values) { | ||
values = Object.keys(props.values).reduce(function (result, key) { | ||
result[(0, _hyphenateStyleName2.default)(key)] = props.values[key]; | ||
return result; | ||
}, {}); | ||
} | ||
this.removeMql(); | ||
this._mql = (0, _matchmediaquery2.default)(this.query, values); | ||
this._mql.addListener(this.updateMatches); | ||
this.updateMatches(); | ||
} | ||
}, { | ||
key: 'componentWillUpdate', | ||
value: function componentWillUpdate(_, nextState) { | ||
if (this.props.onBeforeChange && this.state.matches !== nextState.matches) { | ||
this.props.onBeforeChange(this.state.matches); | ||
} | ||
} | ||
}, { | ||
key: 'componentDidUpdate', | ||
value: function componentDidUpdate(_, prevState) { | ||
if (this.props.onChange && prevState.matches !== this.state.matches) { | ||
this.props.onChange(this.state.matches); | ||
} | ||
} | ||
}, { | ||
key: 'componentWillUnmount', | ||
value: function componentWillUnmount() { | ||
this.removeMql(); | ||
} | ||
}, { | ||
key: 'render', | ||
value: function render() { | ||
if (typeof this.props.children === 'function') { | ||
return this.props.children(this.state.matches); | ||
} | ||
if (this.state.matches === false) { | ||
return null; | ||
} | ||
var props = omit(this.props, excludedPropKeys); | ||
var hasMergeProps = Object.keys(props).length > 0; | ||
var childrenCount = _react2.default.Children.count(this.props.children); | ||
var wrapChildren = this.props.component || childrenCount > 1 || typeof this.props.children === 'string' || Array.isArray(this.props.children) && childrenCount == 1 || this.props.children === undefined; | ||
if (wrapChildren) { | ||
return _react2.default.createElement(this.props.component || 'div', props, this.props.children); | ||
} else if (hasMergeProps) { | ||
return _react2.default.cloneElement(this.props.children, props); | ||
} else if (childrenCount) { | ||
return this.props.children; | ||
} else { | ||
return null; | ||
} | ||
} | ||
}]); | ||
return MediaQuery; | ||
}(_react2.default.Component); | ||
MediaQuery.displayName = 'MediaQuery'; | ||
MediaQuery.defaultProps = { | ||
values: {} | ||
}; | ||
exports.default = MediaQuery; | ||
module.exports = exports['default']; | ||
/***/ }), | ||
/* 8 */ | ||
/***/ (function(module, exports, __webpack_require__) { | ||
/***/ (function(module, exports) { | ||
/* WEBPACK VAR INJECTION */(function(process) {/** | ||
* 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 (process.env.NODE_ENV !== 'production') { | ||
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__(14)(isValidElement, throwOnDirectAccess); | ||
} else { | ||
// By explicitly using `prop-types` you are opting into new production behavior. | ||
// http://fb.me/prop-types-in-prod | ||
module.exports = __webpack_require__(13)(); | ||
} | ||
/* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(1))) | ||
module.exports = __WEBPACK_EXTERNAL_MODULE_8__; | ||
@@ -799,218 +630,644 @@ /***/ }), | ||
'use strict'; | ||
Object.defineProperty(exports, "__esModule", { | ||
value: true | ||
}); | ||
exports.default = function (obj) { | ||
var rules = []; | ||
Object.keys(_mediaQuery2.default.all).forEach(function (k) { | ||
var v = obj[k]; | ||
if (v != null) { | ||
rules.push(keyVal(k, v)); | ||
} | ||
}); | ||
return join(rules); | ||
}; | ||
var _hyphenateStyleName = __webpack_require__(7); | ||
var _hyphenateStyleName2 = _interopRequireDefault(_hyphenateStyleName); | ||
var _mediaQuery = __webpack_require__(5); | ||
var _mediaQuery2 = _interopRequireDefault(_mediaQuery); | ||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } | ||
var negate = function negate(cond) { | ||
return 'not ' + cond; | ||
}; | ||
function keyVal(k, v) { | ||
var realKey = (0, _hyphenateStyleName2.default)(k); | ||
// px shorthand | ||
if (typeof v === 'number') { | ||
v = v + 'px'; | ||
} | ||
if (v === true) { | ||
return k; | ||
} | ||
if (v === false) { | ||
return negate(k); | ||
} | ||
return '(' + realKey + ': ' + v + ')'; | ||
} | ||
function join(conds) { | ||
return conds.join(' and '); | ||
} | ||
module.exports = exports['default']; | ||
"use strict"; | ||
/** | ||
* Copyright (c) 2013-present, Facebook, Inc. | ||
* | ||
* This source code is licensed under the MIT license found in the | ||
* LICENSE file in the root directory of this source tree. | ||
*/ | ||
var emptyFunction = __webpack_require__(1); | ||
var invariant = __webpack_require__(2); | ||
var warning = __webpack_require__(3); | ||
var assign = __webpack_require__(10); | ||
var ReactPropTypesSecret = __webpack_require__(4); | ||
var checkPropTypes = __webpack_require__(11); | ||
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 = '<<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, | ||
exact: createStrictShapeTypeChecker, | ||
}; | ||
/** | ||
* 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; | ||
} | ||
for (var i = 0; i < arrayOfTypeCheckers.length; i++) { | ||
var checker = arrayOfTypeCheckers[i]; | ||
if (typeof checker !== 'function') { | ||
warning( | ||
false, | ||
'Invalid argument supplied to oneOfType. Expected an array of check functions, but ' + | ||
'received %s at index %s.', | ||
getPostfixForTypeWarning(checker), | ||
i | ||
); | ||
return emptyFunction.thatReturnsNull; | ||
} | ||
} | ||
function validate(props, propName, componentName, location, propFullName) { | ||
for (var i = 0; i < arrayOfTypeCheckers.length; i++) { | ||
var checker = arrayOfTypeCheckers[i]; | ||
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 createStrictShapeTypeChecker(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`.')); | ||
} | ||
// We need to check all keys in case some are required but missing from | ||
// props. | ||
var allKeys = assign({}, props[propName], shapeTypes); | ||
for (var key in allKeys) { | ||
var checker = shapeTypes[key]; | ||
if (!checker) { | ||
return new PropTypeError( | ||
'Invalid ' + location + ' `' + propFullName + '` key `' + key + '` supplied to `' + componentName + '`.' + | ||
'\nBad object: ' + JSON.stringify(props[propName], null, ' ') + | ||
'\nValid keys: ' + JSON.stringify(Object.keys(shapeTypes), null, ' ') | ||
); | ||
} | ||
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) { | ||
if (typeof propValue === 'undefined' || propValue === null) { | ||
return '' + propValue; | ||
} | ||
var propType = getPropType(propValue); | ||
if (propType === 'object') { | ||
if (propValue instanceof Date) { | ||
return 'date'; | ||
} else if (propValue instanceof RegExp) { | ||
return 'regexp'; | ||
} | ||
} | ||
return propType; | ||
} | ||
// Returns a string that is postfixed to a warning about an invalid type. | ||
// For example, "undefined" or "of type array" | ||
function getPostfixForTypeWarning(value) { | ||
var type = getPreciseType(value); | ||
switch (type) { | ||
case 'array': | ||
case 'object': | ||
return 'an ' + type; | ||
case 'boolean': | ||
case 'date': | ||
case 'regexp': | ||
return 'a ' + type; | ||
default: | ||
return type; | ||
} | ||
} | ||
// Returns class name of the object, if any. | ||
function getClassName(propValue) { | ||
if (!propValue.constructor || !propValue.constructor.name) { | ||
return ANONYMOUS; | ||
} | ||
return propValue.constructor.name; | ||
} | ||
ReactPropTypes.checkPropTypes = checkPropTypes; | ||
ReactPropTypes.PropTypes = ReactPropTypes; | ||
return ReactPropTypes; | ||
}; | ||
/***/ }), | ||
/* 10 */ | ||
/***/ (function(module, exports) { | ||
/***/ (function(module, exports, __webpack_require__) { | ||
/* | ||
Copyright (c) 2014, Yahoo! Inc. All rights reserved. | ||
Copyrights licensed under the New BSD License. | ||
See the accompanying LICENSE file for terms. | ||
*/ | ||
'use strict'; | ||
exports.match = matchQuery; | ||
exports.parse = parseQuery; | ||
// ----------------------------------------------------------------------------- | ||
var RE_MEDIA_QUERY = /(?:(only|not)?\s*([^\s\(\)]+)(?:\s*and)?\s*)?(.+)?/i, | ||
RE_MQ_EXPRESSION = /\(\s*([^\s\:\)]+)\s*(?:\:\s*([^\s\)]+))?\s*\)/, | ||
RE_MQ_FEATURE = /^(?:(min|max)-)?(.+)/, | ||
RE_LENGTH_UNIT = /(em|rem|px|cm|mm|in|pt|pc)?$/, | ||
RE_RESOLUTION_UNIT = /(dpi|dpcm|dppx)?$/; | ||
function matchQuery(mediaQuery, values) { | ||
return parseQuery(mediaQuery).some(function (query) { | ||
var inverse = query.inverse; | ||
// Either the parsed or specified `type` is "all", or the types must be | ||
// equal for a match. | ||
var typeMatch = query.type === 'all' || values.type === query.type; | ||
// Quit early when `type` doesn't match, but take "not" into account. | ||
if ((typeMatch && inverse) || !(typeMatch || inverse)) { | ||
return false; | ||
} | ||
var expressionsMatch = query.expressions.every(function (expression) { | ||
var feature = expression.feature, | ||
modifier = expression.modifier, | ||
expValue = expression.value, | ||
value = values[feature]; | ||
// Missing or falsy values don't match. | ||
if (!value) { return false; } | ||
switch (feature) { | ||
case 'orientation': | ||
case 'scan': | ||
return value.toLowerCase() === expValue.toLowerCase(); | ||
case 'width': | ||
case 'height': | ||
case 'device-width': | ||
case 'device-height': | ||
expValue = toPx(expValue); | ||
value = toPx(value); | ||
break; | ||
case 'resolution': | ||
expValue = toDpi(expValue); | ||
value = toDpi(value); | ||
break; | ||
case 'aspect-ratio': | ||
case 'device-aspect-ratio': | ||
case /* Deprecated */ 'device-pixel-ratio': | ||
expValue = toDecimal(expValue); | ||
value = toDecimal(value); | ||
break; | ||
case 'grid': | ||
case 'color': | ||
case 'color-index': | ||
case 'monochrome': | ||
expValue = parseInt(expValue, 10) || 1; | ||
value = parseInt(value, 10) || 0; | ||
break; | ||
} | ||
switch (modifier) { | ||
case 'min': return value >= expValue; | ||
case 'max': return value <= expValue; | ||
default : return value === expValue; | ||
} | ||
}); | ||
return (expressionsMatch && !inverse) || (!expressionsMatch && inverse); | ||
}); | ||
"use strict"; | ||
/* | ||
object-assign | ||
(c) Sindre Sorhus | ||
@license MIT | ||
*/ | ||
/* eslint-disable no-unused-vars */ | ||
var getOwnPropertySymbols = Object.getOwnPropertySymbols; | ||
var hasOwnProperty = Object.prototype.hasOwnProperty; | ||
var propIsEnumerable = Object.prototype.propertyIsEnumerable; | ||
function toObject(val) { | ||
if (val === null || val === undefined) { | ||
throw new TypeError('Object.assign cannot be called with null or undefined'); | ||
} | ||
function parseQuery(mediaQuery) { | ||
return mediaQuery.split(',').map(function (query) { | ||
query = query.trim(); | ||
var captures = query.match(RE_MEDIA_QUERY), | ||
modifier = captures[1], | ||
type = captures[2], | ||
expressions = captures[3] || '', | ||
parsed = {}; | ||
parsed.inverse = !!modifier && modifier.toLowerCase() === 'not'; | ||
parsed.type = type ? type.toLowerCase() : 'all'; | ||
// Split expressions into a list. | ||
expressions = expressions.match(/\([^\)]+\)/g) || []; | ||
parsed.expressions = expressions.map(function (expression) { | ||
var captures = expression.match(RE_MQ_EXPRESSION), | ||
feature = captures[1].toLowerCase().match(RE_MQ_FEATURE); | ||
return { | ||
modifier: feature[1], | ||
feature : feature[2], | ||
value : captures[2] | ||
}; | ||
}); | ||
return parsed; | ||
}); | ||
return Object(val); | ||
} | ||
function shouldUseNative() { | ||
try { | ||
if (!Object.assign) { | ||
return false; | ||
} | ||
// Detect buggy property enumeration order in older V8 versions. | ||
// https://bugs.chromium.org/p/v8/issues/detail?id=4118 | ||
var test1 = new String('abc'); // eslint-disable-line no-new-wrappers | ||
test1[5] = 'de'; | ||
if (Object.getOwnPropertyNames(test1)[0] === '5') { | ||
return false; | ||
} | ||
// https://bugs.chromium.org/p/v8/issues/detail?id=3056 | ||
var test2 = {}; | ||
for (var i = 0; i < 10; i++) { | ||
test2['_' + String.fromCharCode(i)] = i; | ||
} | ||
var order2 = Object.getOwnPropertyNames(test2).map(function (n) { | ||
return test2[n]; | ||
}); | ||
if (order2.join('') !== '0123456789') { | ||
return false; | ||
} | ||
// https://bugs.chromium.org/p/v8/issues/detail?id=3056 | ||
var test3 = {}; | ||
'abcdefghijklmnopqrst'.split('').forEach(function (letter) { | ||
test3[letter] = letter; | ||
}); | ||
if (Object.keys(Object.assign({}, test3)).join('') !== | ||
'abcdefghijklmnopqrst') { | ||
return false; | ||
} | ||
return true; | ||
} catch (err) { | ||
// We don't expect any of the above to throw, but better to be safe. | ||
return false; | ||
} | ||
// -- Utilities ---------------------------------------------------------------- | ||
function toDecimal(ratio) { | ||
var decimal = Number(ratio), | ||
numbers; | ||
if (!decimal) { | ||
numbers = ratio.match(/^(\d+)\s*\/\s*(\d+)$/); | ||
decimal = numbers[1] / numbers[2]; | ||
} | ||
return decimal; | ||
} | ||
module.exports = shouldUseNative() ? Object.assign : function (target, source) { | ||
var from; | ||
var to = toObject(target); | ||
var symbols; | ||
for (var s = 1; s < arguments.length; s++) { | ||
from = Object(arguments[s]); | ||
for (var key in from) { | ||
if (hasOwnProperty.call(from, key)) { | ||
to[key] = from[key]; | ||
} | ||
} | ||
if (getOwnPropertySymbols) { | ||
symbols = getOwnPropertySymbols(from); | ||
for (var i = 0; i < symbols.length; i++) { | ||
if (propIsEnumerable.call(from, symbols[i])) { | ||
to[symbols[i]] = from[symbols[i]]; | ||
} | ||
} | ||
} | ||
} | ||
function toDpi(resolution) { | ||
var value = parseFloat(resolution), | ||
units = String(resolution).match(RE_RESOLUTION_UNIT)[1]; | ||
switch (units) { | ||
case 'dpcm': return value / 2.54; | ||
case 'dppx': return value * 96; | ||
default : return value; | ||
} | ||
} | ||
function toPx(length) { | ||
var value = parseFloat(length), | ||
units = String(length).match(RE_LENGTH_UNIT)[1]; | ||
switch (units) { | ||
case 'em' : return value * 16; | ||
case 'rem': return value * 16; | ||
case 'cm' : return value * 96 / 2.54; | ||
case 'mm' : return value * 96 / 2.54 / 10; | ||
case 'in' : return value * 96; | ||
case 'pt' : return value * 72; | ||
case 'pc' : return value * 72 / 12; | ||
default : return value; | ||
} | ||
} | ||
return to; | ||
}; | ||
/***/ }), | ||
@@ -1020,57 +1277,64 @@ /* 11 */ | ||
'use strict'; | ||
var staticMatch = __webpack_require__(10).match; | ||
var dynamicMatch = typeof window !== 'undefined' ? window.matchMedia : null; | ||
// our fake MediaQueryList | ||
function Mql(query, values){ | ||
var self = this; | ||
if(dynamicMatch){ | ||
var mql = dynamicMatch.call(window, query); | ||
this.matches = mql.matches; | ||
this.media = mql.media; | ||
// TODO: is there a time it makes sense to remove this listener? | ||
mql.addListener(update); | ||
} else { | ||
this.matches = staticMatch(query, values); | ||
this.media = query; | ||
} | ||
this.addListener = addListener; | ||
this.removeListener = removeListener; | ||
this.dispose = dispose; | ||
function addListener(listener){ | ||
if(mql){ | ||
mql.addListener(listener); | ||
} | ||
} | ||
function removeListener(listener){ | ||
if(mql){ | ||
mql.removeListener(listener); | ||
} | ||
} | ||
// update ourselves! | ||
function update(evt){ | ||
self.matches = evt.matches; | ||
self.media = evt.media; | ||
} | ||
function dispose(){ | ||
if(mql){ | ||
mql.removeListener(update); | ||
} | ||
} | ||
} | ||
function matchMedia(query, values){ | ||
return new Mql(query, values); | ||
} | ||
module.exports = matchMedia; | ||
"use strict"; | ||
/** | ||
* Copyright (c) 2013-present, Facebook, Inc. | ||
* | ||
* This source code is licensed under the MIT license found in the | ||
* LICENSE file in the root directory of this source tree. | ||
*/ | ||
if (true) { | ||
var invariant = __webpack_require__(2); | ||
var warning = __webpack_require__(3); | ||
var ReactPropTypesSecret = __webpack_require__(4); | ||
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 ' + 'the `prop-types` package, but received `%s`.', componentName || 'React class', location, typeSpecName, typeof typeSpecs[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; | ||
/***/ }), | ||
@@ -1080,66 +1344,58 @@ /* 12 */ | ||
/* WEBPACK VAR INJECTION */(function(process) {/** | ||
* 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 (process.env.NODE_ENV !== 'production') { | ||
var invariant = __webpack_require__(3); | ||
var warning = __webpack_require__(6); | ||
var ReactPropTypesSecret = __webpack_require__(4); | ||
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 (process.env.NODE_ENV !== 'production') { | ||
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; | ||
/* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(1))) | ||
"use strict"; | ||
var staticMatch = __webpack_require__(13).match; | ||
var dynamicMatch = typeof window !== 'undefined' ? window.matchMedia : null; | ||
// our fake MediaQueryList | ||
function Mql(query, values){ | ||
var self = this; | ||
if(dynamicMatch){ | ||
var mql = dynamicMatch.call(window, query); | ||
this.matches = mql.matches; | ||
this.media = mql.media; | ||
// TODO: is there a time it makes sense to remove this listener? | ||
mql.addListener(update); | ||
} else { | ||
this.matches = staticMatch(query, values); | ||
this.media = query; | ||
} | ||
this.addListener = addListener; | ||
this.removeListener = removeListener; | ||
this.dispose = dispose; | ||
function addListener(listener){ | ||
if(mql){ | ||
mql.addListener(listener); | ||
} | ||
} | ||
function removeListener(listener){ | ||
if(mql){ | ||
mql.removeListener(listener); | ||
} | ||
} | ||
// update ourselves! | ||
function update(evt){ | ||
self.matches = evt.matches; | ||
self.media = evt.media; | ||
} | ||
function dispose(){ | ||
if(mql){ | ||
mql.removeListener(update); | ||
} | ||
} | ||
} | ||
function matchMedia(query, values){ | ||
return new Mql(query, values); | ||
} | ||
module.exports = matchMedia; | ||
/***/ }), | ||
@@ -1149,63 +1405,162 @@ /* 13 */ | ||
/** | ||
* 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__(2); | ||
var invariant = __webpack_require__(3); | ||
var ReactPropTypesSecret = __webpack_require__(4); | ||
module.exports = function() { | ||
function shim(props, propName, componentName, location, propFullName, secret) { | ||
if (secret === ReactPropTypesSecret) { | ||
// It is still safe when called from React. | ||
return; | ||
} | ||
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' | ||
); | ||
}; | ||
shim.isRequired = shim; | ||
function getShim() { | ||
return shim; | ||
}; | ||
// Important! | ||
// Keep this list in sync with production version in `./factoryWithTypeCheckers.js`. | ||
var ReactPropTypes = { | ||
array: shim, | ||
bool: shim, | ||
func: shim, | ||
number: shim, | ||
object: shim, | ||
string: shim, | ||
symbol: shim, | ||
any: shim, | ||
arrayOf: getShim, | ||
element: shim, | ||
instanceOf: getShim, | ||
node: shim, | ||
objectOf: getShim, | ||
oneOf: getShim, | ||
oneOfType: getShim, | ||
shape: getShim | ||
}; | ||
ReactPropTypes.checkPropTypes = emptyFunction; | ||
ReactPropTypes.PropTypes = ReactPropTypes; | ||
return ReactPropTypes; | ||
}; | ||
"use strict"; | ||
/* | ||
Copyright (c) 2014, Yahoo! Inc. All rights reserved. | ||
Copyrights licensed under the New BSD License. | ||
See the accompanying LICENSE file for terms. | ||
*/ | ||
exports.match = matchQuery; | ||
exports.parse = parseQuery; | ||
// ----------------------------------------------------------------------------- | ||
var RE_MEDIA_QUERY = /(?:(only|not)?\s*([^\s\(\)]+)(?:\s*and)?\s*)?(.+)?/i, | ||
RE_MQ_EXPRESSION = /\(\s*([^\s\:\)]+)\s*(?:\:\s*([^\s\)]+))?\s*\)/, | ||
RE_MQ_FEATURE = /^(?:(min|max)-)?(.+)/, | ||
RE_LENGTH_UNIT = /(em|rem|px|cm|mm|in|pt|pc)?$/, | ||
RE_RESOLUTION_UNIT = /(dpi|dpcm|dppx)?$/; | ||
function matchQuery(mediaQuery, values) { | ||
return parseQuery(mediaQuery).some(function (query) { | ||
var inverse = query.inverse; | ||
// Either the parsed or specified `type` is "all", or the types must be | ||
// equal for a match. | ||
var typeMatch = query.type === 'all' || values.type === query.type; | ||
// Quit early when `type` doesn't match, but take "not" into account. | ||
if ((typeMatch && inverse) || !(typeMatch || inverse)) { | ||
return false; | ||
} | ||
var expressionsMatch = query.expressions.every(function (expression) { | ||
var feature = expression.feature, | ||
modifier = expression.modifier, | ||
expValue = expression.value, | ||
value = values[feature]; | ||
// Missing or falsy values don't match. | ||
if (!value) { return false; } | ||
switch (feature) { | ||
case 'orientation': | ||
case 'scan': | ||
return value.toLowerCase() === expValue.toLowerCase(); | ||
case 'width': | ||
case 'height': | ||
case 'device-width': | ||
case 'device-height': | ||
expValue = toPx(expValue); | ||
value = toPx(value); | ||
break; | ||
case 'resolution': | ||
expValue = toDpi(expValue); | ||
value = toDpi(value); | ||
break; | ||
case 'aspect-ratio': | ||
case 'device-aspect-ratio': | ||
case /* Deprecated */ 'device-pixel-ratio': | ||
expValue = toDecimal(expValue); | ||
value = toDecimal(value); | ||
break; | ||
case 'grid': | ||
case 'color': | ||
case 'color-index': | ||
case 'monochrome': | ||
expValue = parseInt(expValue, 10) || 1; | ||
value = parseInt(value, 10) || 0; | ||
break; | ||
} | ||
switch (modifier) { | ||
case 'min': return value >= expValue; | ||
case 'max': return value <= expValue; | ||
default : return value === expValue; | ||
} | ||
}); | ||
return (expressionsMatch && !inverse) || (!expressionsMatch && inverse); | ||
}); | ||
} | ||
function parseQuery(mediaQuery) { | ||
return mediaQuery.split(',').map(function (query) { | ||
query = query.trim(); | ||
var captures = query.match(RE_MEDIA_QUERY), | ||
modifier = captures[1], | ||
type = captures[2], | ||
expressions = captures[3] || '', | ||
parsed = {}; | ||
parsed.inverse = !!modifier && modifier.toLowerCase() === 'not'; | ||
parsed.type = type ? type.toLowerCase() : 'all'; | ||
// Split expressions into a list. | ||
expressions = expressions.match(/\([^\)]+\)/g) || []; | ||
parsed.expressions = expressions.map(function (expression) { | ||
var captures = expression.match(RE_MQ_EXPRESSION), | ||
feature = captures[1].toLowerCase().match(RE_MQ_FEATURE); | ||
return { | ||
modifier: feature[1], | ||
feature : feature[2], | ||
value : captures[2] | ||
}; | ||
}); | ||
return parsed; | ||
}); | ||
} | ||
// -- Utilities ---------------------------------------------------------------- | ||
function toDecimal(ratio) { | ||
var decimal = Number(ratio), | ||
numbers; | ||
if (!decimal) { | ||
numbers = ratio.match(/^(\d+)\s*\/\s*(\d+)$/); | ||
decimal = numbers[1] / numbers[2]; | ||
} | ||
return decimal; | ||
} | ||
function toDpi(resolution) { | ||
var value = parseFloat(resolution), | ||
units = String(resolution).match(RE_RESOLUTION_UNIT)[1]; | ||
switch (units) { | ||
case 'dpcm': return value / 2.54; | ||
case 'dppx': return value * 96; | ||
default : return value; | ||
} | ||
} | ||
function toPx(length) { | ||
var value = parseFloat(length), | ||
units = String(length).match(RE_LENGTH_UNIT)[1]; | ||
switch (units) { | ||
case 'em' : return value * 16; | ||
case 'rem': return value * 16; | ||
case 'cm' : return value * 96 / 2.54; | ||
case 'mm' : return value * 96 / 2.54 / 10; | ||
case 'in' : return value * 96; | ||
case 'pt' : return value * 72; | ||
case 'pc' : return value * 72 / 12; | ||
default : return value; | ||
} | ||
} | ||
/***/ }), | ||
@@ -1215,527 +1570,59 @@ /* 14 */ | ||
/* WEBPACK VAR INJECTION */(function(process) {/** | ||
* 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__(2); | ||
var invariant = __webpack_require__(3); | ||
var warning = __webpack_require__(6); | ||
var ReactPropTypesSecret = __webpack_require__(4); | ||
var checkPropTypes = __webpack_require__(12); | ||
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 = '<<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 (process.env.NODE_ENV !== 'production') { | ||
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 (process.env.NODE_ENV !== '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)) { | ||
process.env.NODE_ENV !== 'production' ? 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)) { | ||
process.env.NODE_ENV !== 'production' ? warning(false, 'Invalid argument supplied to oneOfType, expected an instance of array.') : void 0; | ||
return emptyFunction.thatReturnsNull; | ||
} | ||
for (var i = 0; i < arrayOfTypeCheckers.length; i++) { | ||
var checker = arrayOfTypeCheckers[i]; | ||
if (typeof checker !== 'function') { | ||
warning( | ||
false, | ||
'Invalid argument supplid to oneOfType. Expected an array of check functions, but ' + | ||
'received %s at index %s.', | ||
getPostfixForTypeWarning(checker), | ||
i | ||
); | ||
return emptyFunction.thatReturnsNull; | ||
} | ||
} | ||
function validate(props, propName, componentName, location, propFullName) { | ||
for (var i = 0; i < arrayOfTypeCheckers.length; i++) { | ||
var checker = arrayOfTypeCheckers[i]; | ||
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) { | ||
if (typeof propValue === 'undefined' || propValue === null) { | ||
return '' + propValue; | ||
} | ||
var propType = getPropType(propValue); | ||
if (propType === 'object') { | ||
if (propValue instanceof Date) { | ||
return 'date'; | ||
} else if (propValue instanceof RegExp) { | ||
return 'regexp'; | ||
} | ||
} | ||
return propType; | ||
} | ||
// Returns a string that is postfixed to a warning about an invalid type. | ||
// For example, "undefined" or "of type array" | ||
function getPostfixForTypeWarning(value) { | ||
var type = getPreciseType(value); | ||
switch (type) { | ||
case 'array': | ||
case 'object': | ||
return 'an ' + type; | ||
case 'boolean': | ||
case 'date': | ||
case 'regexp': | ||
return 'a ' + type; | ||
default: | ||
return type; | ||
} | ||
} | ||
// Returns class name of the object, if any. | ||
function getClassName(propValue) { | ||
if (!propValue.constructor || !propValue.constructor.name) { | ||
return ANONYMOUS; | ||
} | ||
return propValue.constructor.name; | ||
} | ||
ReactPropTypes.checkPropTypes = checkPropTypes; | ||
ReactPropTypes.PropTypes = ReactPropTypes; | ||
return ReactPropTypes; | ||
}; | ||
/* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(1))) | ||
"use strict"; | ||
/***/ }), | ||
/* 15 */ | ||
/***/ (function(module, exports) { | ||
module.exports = __WEBPACK_EXTERNAL_MODULE_15__; | ||
Object.defineProperty(exports, "__esModule", { | ||
value: true | ||
}); | ||
exports.default = function (obj) { | ||
var rules = []; | ||
Object.keys(_mediaQuery2.default.all).forEach(function (k) { | ||
var v = obj[k]; | ||
if (v != null) { | ||
rules.push(keyVal(k, v)); | ||
} | ||
}); | ||
return join(rules); | ||
}; | ||
var _hyphenateStyleName = __webpack_require__(5); | ||
var _hyphenateStyleName2 = _interopRequireDefault(_hyphenateStyleName); | ||
var _mediaQuery = __webpack_require__(6); | ||
var _mediaQuery2 = _interopRequireDefault(_mediaQuery); | ||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } | ||
var negate = function negate(cond) { | ||
return 'not ' + cond; | ||
}; | ||
function keyVal(k, v) { | ||
var realKey = (0, _hyphenateStyleName2.default)(k); | ||
// px shorthand | ||
if (typeof v === 'number') { | ||
v = v + 'px'; | ||
} | ||
if (v === true) { | ||
return k; | ||
} | ||
if (v === false) { | ||
return negate(k); | ||
} | ||
return '(' + realKey + ': ' + v + ')'; | ||
} | ||
function join(conds) { | ||
return conds.join(' and '); | ||
} | ||
module.exports = exports['default']; | ||
/***/ }) | ||
/******/ ]) | ||
/******/ ]); | ||
}); | ||
; | ||
//# sourceMappingURL=react-responsive.js.map |
@@ -1,2 +0,2 @@ | ||
!function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t(require("react")):"function"==typeof define&&define.amd?define(["react"],t):"object"==typeof exports?exports.MediaQuery=t(require("react")):e.MediaQuery=t(e.react)}(this,function(e){return function(e){function t(r){if(n[r])return n[r].exports;var o=n[r]={exports:{},id:r,loaded:!1};return e[r].call(o.exports,o,o.exports,t),o.loaded=!0,o.exports}var n={};return t.m=e,t.c=n,t.p="",t(0)}([function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{default:e}}function o(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function i(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function a(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}function u(e,t){var n=c({},e);return t.forEach(function(e){return delete n[e]}),n}Object.defineProperty(t,"__esModule",{value:!0});var s=function(){function e(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}return function(t,n,r){return n&&e(t.prototype,n),r&&e(t,r),t}}(),c=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},f=n(15),l=r(f),p=n(8),d=r(p),h=n(11),m=r(h),y=n(7),v=r(y),b=n(5),g=r(b),w=n(9),x=r(w),O={component:d.default.node,query:d.default.string,values:d.default.shape(g.default.matchers),children:d.default.oneOfType([d.default.node,d.default.func]),onChange:d.default.func,onBeforeChange:d.default.func},T=Object.keys(g.default.all),E=Object.keys(O),_=E.concat(T),j=function(e){function t(){var e,n,r,a;o(this,t);for(var u=arguments.length,s=Array(u),c=0;c<u;c++)s[c]=arguments[c];return n=r=i(this,(e=t.__proto__||Object.getPrototypeOf(t)).call.apply(e,[this].concat(s))),r.state={matches:!1},r.updateMatches=function(){r._mql.matches!==r.state.matches&&r.setState({matches:r._mql.matches})},r.removeMql=function(){r._mql&&(r._mql.removeListener(r.updateMatches),r._mql.dispose())},a=n,i(r,a)}return a(t,e),s(t,[{key:"componentWillMount",value:function(){this.updateQuery(this.props)}},{key:"componentWillReceiveProps",value:function(e){this.updateQuery(e)}},{key:"updateQuery",value:function(e){var t=void 0;if(e.query?this.query=e.query:this.query=(0,x.default)(u(e,E)),!this.query)throw new Error("Invalid or missing MediaQuery!");e.values&&(t=Object.keys(e.values).reduce(function(t,n){return t[(0,v.default)(n)]=e.values[n],t},{})),this.removeMql(),this._mql=(0,m.default)(this.query,t),this._mql.addListener(this.updateMatches),this.updateMatches()}},{key:"componentWillUpdate",value:function(e,t){this.props.onBeforeChange&&this.state.matches!==t.matches&&this.props.onBeforeChange(this.state.matches)}},{key:"componentDidUpdate",value:function(e,t){this.props.onChange&&t.matches!==this.state.matches&&this.props.onChange(this.state.matches)}},{key:"componentWillUnmount",value:function(){this.removeMql()}},{key:"render",value:function(){if("function"==typeof this.props.children)return this.props.children(this.state.matches);if(this.state.matches===!1)return null;var e=u(this.props,_),t=Object.keys(e).length>0,n=l.default.Children.count(this.props.children),r=this.props.component||n>1||"string"==typeof this.props.children||Array.isArray(this.props.children)&&1==n||void 0===this.props.children;return r?l.default.createElement(this.props.component||"div",e,this.props.children):t?l.default.cloneElement(this.props.children,e):n?this.props.children:null}}]),t}(l.default.Component);j.displayName="MediaQuery",j.defaultProps={values:{}},t.default=j,e.exports=t.default},function(e,t){function n(){throw new Error("setTimeout has not been defined")}function r(){throw new Error("clearTimeout has not been defined")}function o(e){if(f===setTimeout)return setTimeout(e,0);if((f===n||!f)&&setTimeout)return f=setTimeout,setTimeout(e,0);try{return f(e,0)}catch(t){try{return f.call(null,e,0)}catch(t){return f.call(this,e,0)}}}function i(e){if(l===clearTimeout)return clearTimeout(e);if((l===r||!l)&&clearTimeout)return l=clearTimeout,clearTimeout(e);try{return l(e)}catch(t){try{return l.call(null,e)}catch(t){return l.call(this,e)}}}function a(){m&&d&&(m=!1,d.length?h=d.concat(h):y=-1,h.length&&u())}function u(){if(!m){var e=o(a);m=!0;for(var t=h.length;t;){for(d=h,h=[];++y<t;)d&&d[y].run();y=-1,t=h.length}d=null,m=!1,i(e)}}function s(e,t){this.fun=e,this.array=t}function c(){}var f,l,p=e.exports={};!function(){try{f="function"==typeof setTimeout?setTimeout:n}catch(e){f=n}try{l="function"==typeof clearTimeout?clearTimeout:r}catch(e){l=r}}();var d,h=[],m=!1,y=-1;p.nextTick=function(e){var t=new Array(arguments.length-1);if(arguments.length>1)for(var n=1;n<arguments.length;n++)t[n-1]=arguments[n];h.push(new s(e,t)),1!==h.length||m||o(u)},s.prototype.run=function(){this.fun.apply(null,this.array)},p.title="browser",p.browser=!0,p.env={},p.argv=[],p.version="",p.versions={},p.on=c,p.addListener=c,p.once=c,p.off=c,p.removeListener=c,p.removeAllListeners=c,p.emit=c,p.prependListener=c,p.prependOnceListener=c,p.listeners=function(e){return[]},p.binding=function(e){throw new Error("process.binding is not supported")},p.cwd=function(){return"/"},p.chdir=function(e){throw new Error("process.chdir is not supported")},p.umask=function(){return 0}},function(e,t){"use strict";function n(e){return function(){return e}}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(e){return e},e.exports=r},function(e,t,n){(function(t){"use strict";function n(e,t,n,o,i,a,u,s){if(r(t),!e){var c;if(void 0===t)c=new Error("Minified exception occurred; use the non-minified dev environment for the full error message and additional helpful warnings.");else{var f=[n,o,i,a,u,s],l=0;c=new Error(t.replace(/%s/g,function(){return f[l++]})),c.name="Invariant Violation"}throw c.framesToPop=1,c}}var r=function(e){};"production"!==t.env.NODE_ENV&&(r=function(e){if(void 0===e)throw new Error("invariant requires an error message argument")}),e.exports=n}).call(t,n(1))},function(e,t){"use strict";var n="SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED";e.exports=n},function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(t,"__esModule",{value:!0});var o=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},i=n(8),a=r(i),u=a.default.oneOfType([a.default.string,a.default.number]),s={orientation:a.default.oneOf(["portrait","landscape"]),scan:a.default.oneOf(["progressive","interlace"]),aspectRatio:a.default.string,deviceAspectRatio:a.default.string,height:u,deviceHeight:u,width:u,deviceWidth:u,color:a.default.bool,colorIndex:a.default.bool,monochrome:a.default.bool,resolution:u},c=o({minAspectRatio:a.default.string,maxAspectRatio:a.default.string,minDeviceAspectRatio:a.default.string,maxDeviceAspectRatio:a.default.string,minHeight:u,maxHeight:u,minDeviceHeight:u,maxDeviceHeight:u,minWidth:u,maxWidth:u,minDeviceWidth:u,maxDeviceWidth:u,minColor:a.default.number,maxColor:a.default.number,minColorIndex:a.default.number,maxColorIndex:a.default.number,minMonochrome:a.default.number,maxMonochrome:a.default.number,minResolution:u,maxResolution:u},s),f={all:a.default.bool,grid:a.default.bool,aural:a.default.bool,braille:a.default.bool,handheld:a.default.bool,print:a.default.bool,projection:a.default.bool,screen:a.default.bool,tty:a.default.bool,tv:a.default.bool,embossed:a.default.bool},l=o({},f,c);s.type=Object.keys(f),t.default={all:l,types:f,matchers:s,features:c},e.exports=t.default},function(e,t,n){(function(t){"use strict";var r=n(2),o=r;"production"!==t.env.NODE_ENV&&!function(){var e=function(e){for(var t=arguments.length,n=Array(t>1?t-1:0),r=1;r<t;r++)n[r-1]=arguments[r];var o=0,i="Warning: "+e.replace(/%s/g,function(){return n[o++]});"undefined"!=typeof console&&console.error(i);try{throw new Error(i)}catch(e){}};o=function(t,n){if(void 0===n)throw new Error("`warning(condition, format, ...args)` requires a warning message argument");if(0!==n.indexOf("Failed Composite propType: ")&&!t){for(var r=arguments.length,o=Array(r>2?r-2:0),i=2;i<r;i++)o[i-2]=arguments[i];e.apply(void 0,[n].concat(o))}}}(),e.exports=o}).call(t,n(1))},function(e,t){"use strict";function n(e){return e in i?i[e]:i[e]=e.replace(r,"-$&").toLowerCase().replace(o,"-ms-")}var r=/[A-Z]/g,o=/^ms-/,i={};e.exports=n},function(e,t,n){(function(t){if("production"!==t.env.NODE_ENV){var r="function"==typeof Symbol&&Symbol.for&&Symbol.for("react.element")||60103,o=function(e){return"object"==typeof e&&null!==e&&e.$$typeof===r},i=!0;e.exports=n(14)(o,i)}else e.exports=n(13)()}).call(t,n(1))},function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{default:e}}function o(e,t){var n=(0,u.default)(e);return"number"==typeof t&&(t+="px"),t===!0?e:t===!1?f(e):"("+n+": "+t+")"}function i(e){return e.join(" and ")}Object.defineProperty(t,"__esModule",{value:!0}),t.default=function(e){var t=[];return Object.keys(c.default.all).forEach(function(n){var r=e[n];null!=r&&t.push(o(n,r))}),i(t)};var a=n(7),u=r(a),s=n(5),c=r(s),f=function(e){return"not "+e};e.exports=t.default},function(e,t){"use strict";function n(e,t){return r(e).some(function(e){var n=e.inverse,r="all"===e.type||t.type===e.type;if(r&&n||!r&&!n)return!1;var u=e.expressions.every(function(e){var n=e.feature,r=e.modifier,u=e.value,s=t[n];if(!s)return!1;switch(n){case"orientation":case"scan":return s.toLowerCase()===u.toLowerCase();case"width":case"height":case"device-width":case"device-height":u=a(u),s=a(s);break;case"resolution":u=i(u),s=i(s);break;case"aspect-ratio":case"device-aspect-ratio":case"device-pixel-ratio":u=o(u),s=o(s);break;case"grid":case"color":case"color-index":case"monochrome":u=parseInt(u,10)||1,s=parseInt(s,10)||0}switch(r){case"min":return s>=u;case"max":return s<=u;default:return s===u}});return u&&!n||!u&&n})}function r(e){return e.split(",").map(function(e){e=e.trim();var t=e.match(u),n=t[1],r=t[2],o=t[3]||"",i={};return i.inverse=!!n&&"not"===n.toLowerCase(),i.type=r?r.toLowerCase():"all",o=o.match(/\([^\)]+\)/g)||[],i.expressions=o.map(function(e){var t=e.match(s),n=t[1].toLowerCase().match(c);return{modifier:n[1],feature:n[2],value:t[2]}}),i})}function o(e){var t,n=Number(e);return n||(t=e.match(/^(\d+)\s*\/\s*(\d+)$/),n=t[1]/t[2]),n}function i(e){var t=parseFloat(e),n=String(e).match(l)[1];switch(n){case"dpcm":return t/2.54;case"dppx":return 96*t;default:return t}}function a(e){var t=parseFloat(e),n=String(e).match(f)[1];switch(n){case"em":return 16*t;case"rem":return 16*t;case"cm":return 96*t/2.54;case"mm":return 96*t/2.54/10;case"in":return 96*t;case"pt":return 72*t;case"pc":return 72*t/12;default:return t}}t.match=n,t.parse=r;var u=/(?:(only|not)?\s*([^\s\(\)]+)(?:\s*and)?\s*)?(.+)?/i,s=/\(\s*([^\s\:\)]+)\s*(?:\:\s*([^\s\)]+))?\s*\)/,c=/^(?:(min|max)-)?(.+)/,f=/(em|rem|px|cm|mm|in|pt|pc)?$/,l=/(dpi|dpcm|dppx)?$/},function(e,t,n){"use strict";function r(e,t){function n(e){c&&c.addListener(e)}function r(e){c&&c.removeListener(e)}function o(e){s.matches=e.matches,s.media=e.media}function u(){c&&c.removeListener(o)}var s=this;if(a){var c=a.call(window,e);this.matches=c.matches,this.media=c.media,c.addListener(o)}else this.matches=i(e,t),this.media=e;this.addListener=n,this.removeListener=r,this.dispose=u}function o(e,t){return new r(e,t)}var i=n(10).match,a="undefined"!=typeof window?window.matchMedia:null;e.exports=o},function(e,t,n){(function(t){"use strict";function r(e,n,r,s,c){if("production"!==t.env.NODE_ENV)for(var f in e)if(e.hasOwnProperty(f)){var l;try{o("function"==typeof e[f],"%s: %s type `%s` is invalid; it must be a function, usually from React.PropTypes.",s||"React class",r,f),l=e[f](n,f,s,r,null,a)}catch(e){l=e}if(i(!l||l 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).",s||"React class",r,f,typeof l),l instanceof Error&&!(l.message in u)){u[l.message]=!0;var p=c?c():"";i(!1,"Failed %s type: %s%s",r,l.message,null!=p?p:"")}}}if("production"!==t.env.NODE_ENV)var o=n(3),i=n(6),a=n(4),u={};e.exports=r}).call(t,n(1))},function(e,t,n){"use strict";var r=n(2),o=n(3),i=n(4);e.exports=function(){function e(e,t,n,r,a,u){u!==i&&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 t(){return e}e.isRequired=e;var n={array:e,bool:e,func:e,number:e,object:e,string:e,symbol:e,any:e,arrayOf:t,element:e,instanceOf:t,node:e,objectOf:t,oneOf:t,oneOfType:t,shape:t};return n.checkPropTypes=r,n.PropTypes=n,n}},function(e,t,n){(function(t){"use strict";var r=n(2),o=n(3),i=n(6),a=n(4),u=n(12);e.exports=function(e,n){function s(e){var t=e&&(k&&e[k]||e[P]);if("function"==typeof t)return t}function c(e,t){return e===t?0!==e||1/e===1/t:e!==e&&t!==t}function f(e){this.message=e,this.stack=""}function l(e){function r(r,c,l,p,d,h,m){if(p=p||N,h=h||l,m!==a)if(n)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");else if("production"!==t.env.NODE_ENV&&"undefined"!=typeof console){var y=p+":"+l;!u[y]&&s<3&&(i(!1,"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.",h,p),u[y]=!0,s++)}return null==c[l]?r?new f(null===c[l]?"The "+d+" `"+h+"` is marked as required "+("in `"+p+"`, but its value is `null`."):"The "+d+" `"+h+"` is marked as required in "+("`"+p+"`, but its value is `undefined`.")):null:e(c,l,p,d,h)}if("production"!==t.env.NODE_ENV)var u={},s=0;var c=r.bind(null,!1);return c.isRequired=r.bind(null,!0),c}function p(e){function t(t,n,r,o,i,a){var u=t[n],s=E(u);if(s!==e){var c=_(u);return new f("Invalid "+o+" `"+i+"` of type "+("`"+c+"` supplied to `"+r+"`, expected ")+("`"+e+"`."))}return null}return l(t)}function d(){return l(r.thatReturnsNull)}function h(e){function t(t,n,r,o,i){if("function"!=typeof e)return new f("Property `"+i+"` of component `"+r+"` has invalid PropType notation inside arrayOf.");var u=t[n];if(!Array.isArray(u)){var s=E(u);return new f("Invalid "+o+" `"+i+"` of type "+("`"+s+"` supplied to `"+r+"`, expected an array."))}for(var c=0;c<u.length;c++){var l=e(u,c,r,o,i+"["+c+"]",a);if(l instanceof Error)return l}return null}return l(t)}function m(){function t(t,n,r,o,i){var a=t[n];if(!e(a)){var u=E(a);return new f("Invalid "+o+" `"+i+"` of type "+("`"+u+"` supplied to `"+r+"`, expected a single ReactElement."))}return null}return l(t)}function y(e){function t(t,n,r,o,i){if(!(t[n]instanceof e)){var a=e.name||N,u=R(t[n]);return new f("Invalid "+o+" `"+i+"` of type "+("`"+u+"` supplied to `"+r+"`, expected ")+("instance of `"+a+"`."))}return null}return l(t)}function v(e){function n(t,n,r,o,i){for(var a=t[n],u=0;u<e.length;u++)if(c(a,e[u]))return null;var s=JSON.stringify(e);return new f("Invalid "+o+" `"+i+"` of value `"+a+"` "+("supplied to `"+r+"`, expected one of "+s+"."))}return Array.isArray(e)?l(n):("production"!==t.env.NODE_ENV?i(!1,"Invalid argument supplied to oneOf, expected an instance of array."):void 0,r.thatReturnsNull)}function b(e){function t(t,n,r,o,i){if("function"!=typeof e)return new f("Property `"+i+"` of component `"+r+"` has invalid PropType notation inside objectOf.");var u=t[n],s=E(u);if("object"!==s)return new f("Invalid "+o+" `"+i+"` of type "+("`"+s+"` supplied to `"+r+"`, expected an object."));for(var c in u)if(u.hasOwnProperty(c)){var l=e(u,c,r,o,i+"."+c,a);if(l instanceof Error)return l}return null}return l(t)}function g(e){function n(t,n,r,o,i){for(var u=0;u<e.length;u++){var s=e[u];if(null==s(t,n,r,o,i,a))return null}return new f("Invalid "+o+" `"+i+"` supplied to "+("`"+r+"`."))}if(!Array.isArray(e))return"production"!==t.env.NODE_ENV?i(!1,"Invalid argument supplied to oneOfType, expected an instance of array."):void 0,r.thatReturnsNull;for(var o=0;o<e.length;o++){var u=e[o];if("function"!=typeof u)return i(!1,"Invalid argument supplid to oneOfType. Expected an array of check functions, but received %s at index %s.",j(u),o),r.thatReturnsNull}return l(n)}function w(){function e(e,t,n,r,o){return O(e[t])?null:new f("Invalid "+r+" `"+o+"` supplied to "+("`"+n+"`, expected a ReactNode."))}return l(e)}function x(e){function t(t,n,r,o,i){var u=t[n],s=E(u);if("object"!==s)return new f("Invalid "+o+" `"+i+"` of type `"+s+"` "+("supplied to `"+r+"`, expected `object`."));for(var c in e){var l=e[c];if(l){var p=l(u,c,r,o,i+"."+c,a);if(p)return p}}return null}return l(t)}function O(t){switch(typeof t){case"number":case"string":case"undefined":return!0;case"boolean":return!t;case"object":if(Array.isArray(t))return t.every(O);if(null===t||e(t))return!0;var n=s(t);if(!n)return!1;var r,o=n.call(t);if(n!==t.entries){for(;!(r=o.next()).done;)if(!O(r.value))return!1}else for(;!(r=o.next()).done;){var i=r.value;if(i&&!O(i[1]))return!1}return!0;default:return!1}}function T(e,t){return"symbol"===e||("Symbol"===t["@@toStringTag"]||"function"==typeof Symbol&&t instanceof Symbol)}function E(e){var t=typeof e;return Array.isArray(e)?"array":e instanceof RegExp?"object":T(t,e)?"symbol":t}function _(e){if("undefined"==typeof e||null===e)return""+e;var t=E(e);if("object"===t){if(e instanceof Date)return"date";if(e instanceof RegExp)return"regexp"}return t}function j(e){var t=_(e);switch(t){case"array":case"object":return"an "+t;case"boolean":case"date":case"regexp":return"a "+t;default:return t}}function R(e){return e.constructor&&e.constructor.name?e.constructor.name:N}var k="function"==typeof Symbol&&Symbol.iterator,P="@@iterator",N="<<anonymous>>",q={array:p("array"),bool:p("boolean"),func:p("function"),number:p("number"),object:p("object"),string:p("string"),symbol:p("symbol"),any:d(),arrayOf:h,element:m(),instanceOf:y,node:w(),objectOf:b,oneOf:v,oneOfType:g,shape:x};return f.prototype=Error.prototype,q.checkPropTypes=u,q.PropTypes=q,q}}).call(t,n(1))},function(t,n){t.exports=e}])}); | ||
//# sourceMappingURL=react-responsive.js.map | ||
!function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t(require("react")):"function"==typeof define&&define.amd?define(["react"],t):"object"==typeof exports?exports.MediaQuery=t(require("react")):e.MediaQuery=t(e.react)}(this,function(e){return function(e){function t(n){if(r[n])return r[n].exports;var o=r[n]={i:n,l:!1,exports:{}};return e[n].call(o.exports,o,o.exports,t),o.l=!0,o.exports}var r={};return t.m=e,t.c=r,t.d=function(e,r,n){t.o(e,r)||Object.defineProperty(e,r,{configurable:!1,enumerable:!0,get:n})},t.n=function(e){var r=e&&e.__esModule?function(){return e.default}:function(){return e};return t.d(r,"a",r),r},t.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},t.p="",t(t.s=3)}([function(e,t,r){e.exports=r(5)()},function(e,t,r){"use strict";function n(e){return e in i?i[e]:i[e]=e.replace(o,"-$&").toLowerCase().replace(a,"-ms-")}var o=/[A-Z]/g,a=/^ms-/,i={};e.exports=n},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var n=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},o=r(0),a=function(e){return e&&e.__esModule?e:{default:e}}(o),i=a.default.oneOfType([a.default.string,a.default.number]),u={orientation:a.default.oneOf(["portrait","landscape"]),scan:a.default.oneOf(["progressive","interlace"]),aspectRatio:a.default.string,deviceAspectRatio:a.default.string,height:i,deviceHeight:i,width:i,deviceWidth:i,color:a.default.bool,colorIndex:a.default.bool,monochrome:a.default.bool,resolution:i},s=n({minAspectRatio:a.default.string,maxAspectRatio:a.default.string,minDeviceAspectRatio:a.default.string,maxDeviceAspectRatio:a.default.string,minHeight:i,maxHeight:i,minDeviceHeight:i,maxDeviceHeight:i,minWidth:i,maxWidth:i,minDeviceWidth:i,maxDeviceWidth:i,minColor:a.default.number,maxColor:a.default.number,minColorIndex:a.default.number,maxColorIndex:a.default.number,minMonochrome:a.default.number,maxMonochrome:a.default.number,minResolution:i,maxResolution:i},u),c={all:a.default.bool,grid:a.default.bool,aural:a.default.bool,braille:a.default.bool,handheld:a.default.bool,print:a.default.bool,projection:a.default.bool,screen:a.default.bool,tty:a.default.bool,tv:a.default.bool,embossed:a.default.bool},l=n({},c,s);u.type=Object.keys(c),t.default={all:l,types:c,matchers:u,features:s},e.exports=t.default},function(e,t,r){"use strict";function n(e){return e&&e.__esModule?e:{default:e}}function o(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function a(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function i(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}function u(e,t){var r=c({},e);return t.forEach(function(e){return delete r[e]}),r}Object.defineProperty(t,"__esModule",{value:!0});var s=function(){function e(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}return function(t,r,n){return r&&e(t.prototype,r),n&&e(t,n),t}}(),c=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},l=r(4),f=n(l),p=r(0),d=n(p),h=r(9),m=n(h),v=r(1),y=n(v),b=r(2),g=n(b),x=r(11),O=n(x),_={component:d.default.node,query:d.default.string,values:d.default.shape(g.default.matchers),children:d.default.oneOfType([d.default.node,d.default.func]),onChange:d.default.func,onBeforeChange:d.default.func},w=Object.keys(g.default.all),j=Object.keys(_),M=j.concat(w),k=function(e){function t(){var e,r,n,i;o(this,t);for(var u=arguments.length,s=Array(u),c=0;c<u;c++)s[c]=arguments[c];return r=n=a(this,(e=t.__proto__||Object.getPrototypeOf(t)).call.apply(e,[this].concat(s))),n.state={matches:!1},n.updateMatches=function(){n._mql.matches!==n.state.matches&&n.setState({matches:n._mql.matches})},n.removeMql=function(){n._mql&&(n._mql.removeListener(n.updateMatches),n._mql.dispose())},i=r,a(n,i)}return i(t,e),s(t,[{key:"componentWillMount",value:function(){this.updateQuery(this.props)}},{key:"componentWillReceiveProps",value:function(e){this.updateQuery(e)}},{key:"updateQuery",value:function(e){var t=void 0;if(e.query?this.query=e.query:this.query=(0,O.default)(u(e,j)),!this.query)throw new Error("Invalid or missing MediaQuery!");e.values&&(t=Object.keys(e.values).reduce(function(t,r){return t[(0,y.default)(r)]=e.values[r],t},{})),this.removeMql(),this._mql=(0,m.default)(this.query,t),this._mql.addListener(this.updateMatches),this.updateMatches()}},{key:"componentWillUpdate",value:function(e,t){this.props.onBeforeChange&&this.state.matches!==t.matches&&this.props.onBeforeChange(this.state.matches)}},{key:"componentDidUpdate",value:function(e,t){this.props.onChange&&t.matches!==this.state.matches&&this.props.onChange(this.state.matches)}},{key:"componentWillUnmount",value:function(){this.removeMql()}},{key:"render",value:function(){if("function"==typeof this.props.children)return this.props.children(this.state.matches);if(!1===this.state.matches)return null;var e=u(this.props,M),t=Object.keys(e).length>0,r=f.default.Children.count(this.props.children);return this.props.component||r>1||"string"==typeof this.props.children||Array.isArray(this.props.children)&&1==r||void 0===this.props.children?f.default.createElement(this.props.component||"div",e,this.props.children):t?f.default.cloneElement(this.props.children,e):r?this.props.children:null}}]),t}(f.default.Component);k.displayName="MediaQuery",k.defaultProps={values:{}},t.default=k,e.exports=t.default},function(t,r){t.exports=e},function(e,t,r){"use strict";var n=r(6),o=r(7),a=r(8);e.exports=function(){function e(e,t,r,n,i,u){u!==a&&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 t(){return e}e.isRequired=e;var r={array:e,bool:e,func:e,number:e,object:e,string:e,symbol:e,any:e,arrayOf:t,element:e,instanceOf:t,node:e,objectOf:t,oneOf:t,oneOfType:t,shape:t,exact:t};return r.checkPropTypes=n,r.PropTypes=r,r}},function(e,t,r){"use strict";function n(e){return function(){return e}}var o=function(){};o.thatReturns=n,o.thatReturnsFalse=n(!1),o.thatReturnsTrue=n(!0),o.thatReturnsNull=n(null),o.thatReturnsThis=function(){return this},o.thatReturnsArgument=function(e){return e},e.exports=o},function(e,t,r){"use strict";function n(e,t,r,n,a,i,u,s){if(o(t),!e){var c;if(void 0===t)c=new Error("Minified exception occurred; use the non-minified dev environment for the full error message and additional helpful warnings.");else{var l=[r,n,a,i,u,s],f=0;c=new Error(t.replace(/%s/g,function(){return l[f++]})),c.name="Invariant Violation"}throw c.framesToPop=1,c}}var o=function(e){};e.exports=n},function(e,t,r){"use strict";e.exports="SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED"},function(e,t,r){"use strict";function n(e,t){function r(e){c&&c.addListener(e)}function n(e){c&&c.removeListener(e)}function o(e){s.matches=e.matches,s.media=e.media}function u(){c&&c.removeListener(o)}var s=this;if(i){var c=i.call(window,e);this.matches=c.matches,this.media=c.media,c.addListener(o)}else this.matches=a(e,t),this.media=e;this.addListener=r,this.removeListener=n,this.dispose=u}function o(e,t){return new n(e,t)}var a=r(10).match,i="undefined"!=typeof window?window.matchMedia:null;e.exports=o},function(e,t,r){"use strict";function n(e,t){return o(e).some(function(e){var r=e.inverse,n="all"===e.type||t.type===e.type;if(n&&r||!n&&!r)return!1;var o=e.expressions.every(function(e){var r=e.feature,n=e.modifier,o=e.value,s=t[r];if(!s)return!1;switch(r){case"orientation":case"scan":return s.toLowerCase()===o.toLowerCase();case"width":case"height":case"device-width":case"device-height":o=u(o),s=u(s);break;case"resolution":o=i(o),s=i(s);break;case"aspect-ratio":case"device-aspect-ratio":case"device-pixel-ratio":o=a(o),s=a(s);break;case"grid":case"color":case"color-index":case"monochrome":o=parseInt(o,10)||1,s=parseInt(s,10)||0}switch(n){case"min":return s>=o;case"max":return s<=o;default:return s===o}});return o&&!r||!o&&r})}function o(e){return e.split(",").map(function(e){e=e.trim();var t=e.match(s),r=t[1],n=t[2],o=t[3]||"",a={};return a.inverse=!!r&&"not"===r.toLowerCase(),a.type=n?n.toLowerCase():"all",o=o.match(/\([^\)]+\)/g)||[],a.expressions=o.map(function(e){var t=e.match(c),r=t[1].toLowerCase().match(l);return{modifier:r[1],feature:r[2],value:t[2]}}),a})}function a(e){var t,r=Number(e);return r||(t=e.match(/^(\d+)\s*\/\s*(\d+)$/),r=t[1]/t[2]),r}function i(e){var t=parseFloat(e);switch(String(e).match(p)[1]){case"dpcm":return t/2.54;case"dppx":return 96*t;default:return t}}function u(e){var t=parseFloat(e);switch(String(e).match(f)[1]){case"em":case"rem":return 16*t;case"cm":return 96*t/2.54;case"mm":return 96*t/2.54/10;case"in":return 96*t;case"pt":return 72*t;case"pc":return 72*t/12;default:return t}}t.match=n,t.parse=o;var s=/(?:(only|not)?\s*([^\s\(\)]+)(?:\s*and)?\s*)?(.+)?/i,c=/\(\s*([^\s\:\)]+)\s*(?:\:\s*([^\s\)]+))?\s*\)/,l=/^(?:(min|max)-)?(.+)/,f=/(em|rem|px|cm|mm|in|pt|pc)?$/,p=/(dpi|dpcm|dppx)?$/},function(e,t,r){"use strict";function n(e){return e&&e.__esModule?e:{default:e}}function o(e,t){var r=(0,u.default)(e);return"number"==typeof t&&(t+="px"),!0===t?e:!1===t?l(e):"("+r+": "+t+")"}function a(e){return e.join(" and ")}Object.defineProperty(t,"__esModule",{value:!0}),t.default=function(e){var t=[];return Object.keys(c.default.all).forEach(function(r){var n=e[r];null!=n&&t.push(o(r,n))}),a(t)};var i=r(1),u=n(i),s=r(2),c=n(s),l=function(e){return"not "+e};e.exports=t.default}])}); | ||
//# sourceMappingURL=react-responsive.min.js.map |
{ | ||
"name": "react-responsive", | ||
"description": "Media queries in react for responsive design", | ||
"version": "1.3.4", | ||
"version": "2.0.0", | ||
"homepage": "http://github.com/contra/react-responsive", | ||
@@ -40,28 +40,27 @@ "repository": { | ||
"babel-core": "^6.18.0", | ||
"babel-eslint": "^7.1.0", | ||
"babel-loader": "^6.2.7", | ||
"babel-eslint": "^8.0.0", | ||
"babel-loader": "^7.1.2", | ||
"babel-plugin-add-module-exports": "^0.2.1", | ||
"babel-plugin-transform-runtime": "^6.15.0", | ||
"babel-preset-es2015": "^6.18.0", | ||
"babel-preset-es2015-loose": "^8.0.0", | ||
"babel-plugin-transform-class-properties": "^6.24.1", | ||
"babel-plugin-transform-object-rest-spread": "^6.26.0", | ||
"babel-preset-env": "^1.6.0", | ||
"babel-preset-react": "^6.16.0", | ||
"babel-preset-stage-0": "^6.16.0", | ||
"babel-register": "^6.18.0", | ||
"chai": "^3.5.0", | ||
"chai": "^4.1.2", | ||
"cross-env": "^5.0.1", | ||
"eslint": "^3.9.0", | ||
"eslint-config-rackt": "^1.1.1", | ||
"eslint": "^4.6.1", | ||
"eslint-plugin-import": "^2.7.0", | ||
"eslint-plugin-react": "^7.1.0", | ||
"github-changes": "^1.0.4", | ||
"jsdom": "^8.4.0", | ||
"mocha": "^2.4.5", | ||
"react": "^15.0.1", | ||
"react-dom": "^0.14.0 || ^15.0.0", | ||
"should": "^8.0.2", | ||
"sinon": "^1.17.3", | ||
"webpack": "^1.13.3", | ||
"webpack-dev-server": "^1.16.2" | ||
"jsdom": "^11.2.0", | ||
"mocha": "^3.5.3", | ||
"react": ">=0.14.0", | ||
"react-dom": ">=0.14.0", | ||
"should": "^13.0.1", | ||
"sinon": "^4.0.0", | ||
"webpack": "^3.5.6", | ||
"webpack-dev-server": "^2.8.1" | ||
}, | ||
"scripts": { | ||
"preversion": "npm run clean && npm run build && npm docs", | ||
"preversion": "npm run clean && npm run build", | ||
"postversion": "npm run changelog", | ||
@@ -76,16 +75,13 @@ "start": "webpack-dev-server --config webpack.config.samples.js --content-base samples/sandbox/src --host 0.0.0.0 --hot --inline --port 3333", | ||
"test": "cross-env NODE_PATH=$NODE_PATH:$PWD/src mocha -R spec --compilers js:babel-register --require ./test/setup.js test/*_test.js", | ||
"changelog": "github-changes -o contra -r react-responsive -b master -f ./CHANGELOG.md --order-semver --use-commit-body", | ||
"docs": "npm run docs:pre && npm run docs:build && npm run docs:publish", | ||
"docs:pre": "gitbook install && rimraf _book", | ||
"docs:build": "gitbook build -g contra/react-responsive", | ||
"docs:publish": "cd _book && git init && git commit --allow-empty -m 'update book' && git checkout -b gh-pages && touch .nojekyll && git add . && git commit -am 'update book' && git push git@github.com:contra/react-responsive gh-pages --force" | ||
"changelog": "github-changes -o contra -r react-responsive -b master -f ./CHANGELOG.md --order-semver --use-commit-body" | ||
}, | ||
"babel": { | ||
"presets": [ | ||
"es2015", | ||
"react", | ||
"stage-0" | ||
"env", | ||
"react" | ||
], | ||
"plugins": [ | ||
"add-module-exports" | ||
"add-module-exports", | ||
"transform-class-properties", | ||
"transform-object-rest-spread" | ||
] | ||
@@ -96,15 +92,20 @@ }, | ||
"extends": [ | ||
"rackt", | ||
"eslint:recommended", | ||
"plugin:react/recommended" | ||
], | ||
"plugins": [ | ||
"import", | ||
"react" | ||
], | ||
"env": { | ||
"browser": true, | ||
"node": true, | ||
"es6": true, | ||
"mocha": true | ||
}, | ||
"ecmaFeatures": { | ||
"modules": true, | ||
"ecmaVersion": 7, | ||
"jsx": true | ||
"parserOptions": { | ||
"sourceType": "module", | ||
"ecmaVersion": 8, | ||
"ecmaFeatures": { | ||
"jsx": true | ||
} | ||
}, | ||
@@ -117,6 +118,3 @@ "rules": { | ||
"react/prop-types": 0 | ||
}, | ||
"plugins": [ | ||
"react" | ||
] | ||
} | ||
}, | ||
@@ -123,0 +121,0 @@ "engines": { |
185
README.md
@@ -42,34 +42,30 @@ # react-responsive [![NPM version][npm-image]][npm-url] [![Downloads][downloads-image]][npm-url] [![Support us][gittip-image]][gittip-url] | ||
```jsx | ||
var MediaQuery = require('react-responsive'); | ||
import MediaQuery from 'react-responsive'; | ||
var A = React.createClass({ | ||
render: function(){ | ||
return ( | ||
<div> | ||
<div>Device Test!</div> | ||
<MediaQuery query='(min-device-width: 1224px)'> | ||
<div>You are a desktop or laptop</div> | ||
<MediaQuery query='(min-device-width: 1824px)'> | ||
<div>You also have a huge screen</div> | ||
</MediaQuery> | ||
<MediaQuery query='(max-width: 1224px)'> | ||
<div>You are sized like a tablet or mobile phone though</div> | ||
</MediaQuery> | ||
</MediaQuery> | ||
<MediaQuery query='(max-device-width: 1224px)'> | ||
<div>You are a tablet or mobile phone</div> | ||
</MediaQuery> | ||
<MediaQuery query='(orientation: portrait)'> | ||
<div>You are portrait</div> | ||
</MediaQuery> | ||
<MediaQuery query='(orientation: landscape)'> | ||
<div>You are landscape</div> | ||
</MediaQuery> | ||
<MediaQuery query='(min-resolution: 2dppx)'> | ||
<div>You are retina</div> | ||
</MediaQuery> | ||
</div> | ||
); | ||
} | ||
}); | ||
const Example = () => ( | ||
<div> | ||
<div>Device Test!</div> | ||
<MediaQuery query="(min-device-width: 1224px)"> | ||
<div>You are a desktop or laptop</div> | ||
<MediaQuery query="(min-device-width: 1824px)"> | ||
<div>You also have a huge screen</div> | ||
</MediaQuery> | ||
<MediaQuery query="(max-width: 1224px)"> | ||
<div>You are sized like a tablet or mobile phone though</div> | ||
</MediaQuery> | ||
</MediaQuery> | ||
<MediaQuery query="(max-device-width: 1224px)"> | ||
<div>You are a tablet or mobile phone</div> | ||
</MediaQuery> | ||
<MediaQuery query="(orientation: portrait)"> | ||
<div>You are portrait</div> | ||
</MediaQuery> | ||
<MediaQuery query="(orientation: landscape)"> | ||
<div>You are landscape</div> | ||
</MediaQuery> | ||
<MediaQuery query="(min-resolution: 2dppx)"> | ||
<div>You are retina</div> | ||
</MediaQuery> | ||
</div> | ||
); | ||
``` | ||
@@ -89,34 +85,30 @@ | ||
```jsx | ||
var MediaQuery = require('react-responsive'); | ||
import MediaQuery from 'react-responsive'; | ||
var A = React.createClass({ | ||
render: function(){ | ||
return ( | ||
<div> | ||
<div>Device Test!</div> | ||
<MediaQuery minDeviceWidth={1224}> | ||
<div>You are a desktop or laptop</div> | ||
<MediaQuery minDeviceWidth={1824}> | ||
<div>You also have a huge screen</div> | ||
</MediaQuery> | ||
<MediaQuery maxWidth={1224}> | ||
<div>You are sized like a tablet or mobile phone though</div> | ||
</MediaQuery> | ||
</MediaQuery> | ||
<MediaQuery maxDeviceWidth={1224}> | ||
<div>You are a tablet or mobile phone</div> | ||
</MediaQuery> | ||
<MediaQuery orientation='portrait'> | ||
<div>You are portrait</div> | ||
</MediaQuery> | ||
<MediaQuery orientation='landscape'> | ||
<div>You are landscape</div> | ||
</MediaQuery> | ||
<MediaQuery minResolution='2dppx'> | ||
<div>You are retina</div> | ||
</MediaQuery> | ||
</div> | ||
); | ||
} | ||
}); | ||
const Example = () => ( | ||
<div> | ||
<div>Device Test!</div> | ||
<MediaQuery minDeviceWidth={1224}> | ||
<div>You are a desktop or laptop</div> | ||
<MediaQuery minDeviceWidth={1824}> | ||
<div>You also have a huge screen</div> | ||
</MediaQuery> | ||
<MediaQuery maxWidth={1224}> | ||
<div>You are sized like a tablet or mobile phone though</div> | ||
</MediaQuery> | ||
</MediaQuery> | ||
<MediaQuery maxDeviceWidth={1224}> | ||
<div>You are a tablet or mobile phone</div> | ||
</MediaQuery> | ||
<MediaQuery orientation="portrait"> | ||
<div>You are portrait</div> | ||
</MediaQuery> | ||
<MediaQuery orientation="landscape"> | ||
<div>You are landscape</div> | ||
</MediaQuery> | ||
<MediaQuery minResolution="2dppx"> | ||
<div>You are retina</div> | ||
</MediaQuery> | ||
</div> | ||
); | ||
``` | ||
@@ -190,3 +182,3 @@ | ||
Server rendering can be done by passing static values through the `values` property. | ||
Server rendering can be done by passing static values through the `values` property. | ||
@@ -200,35 +192,34 @@ The values property can contain `orientation`, `scan`, `aspectRatio`, `deviceAspectRatio`, | ||
If you are using [redux](http://redux.js.org/) you can automatically pass `width` / `deviceWidth` values to your components with [react-responsive-redux](https://github.com/modosc/react-responsive-redux). | ||
```jsx | ||
var MediaQuery = require('react-responsive'); | ||
import MediaQuery from 'react-responsive'; | ||
var A = React.createClass({ | ||
render: function(){ | ||
return ( | ||
<div> | ||
<div>Device Test!</div> | ||
<MediaQuery minDeviceWidth={1224} values={{deviceWidth: 1600}}> | ||
<div>You are a desktop or laptop</div> | ||
<MediaQuery minDeviceWidth={1824}> | ||
<div>You also have a huge screen</div> | ||
</MediaQuery> | ||
<MediaQuery maxWidth={1224}> | ||
<div>You are sized like a tablet or mobile phone though</div> | ||
</MediaQuery> | ||
</MediaQuery> | ||
<MediaQuery maxDeviceWidth={1224}> | ||
<div>You are a tablet or mobile phone</div> | ||
</MediaQuery> | ||
<MediaQuery orientation='portrait'> | ||
<div>You are portrait</div> | ||
</MediaQuery> | ||
<MediaQuery orientation='landscape'> | ||
<div>You are landscape</div> | ||
</MediaQuery> | ||
<MediaQuery minResolution='2dppx'> | ||
<div>You are retina</div> | ||
</MediaQuery> | ||
</div> | ||
); | ||
} | ||
}); | ||
const Example = () => ( | ||
<div> | ||
<div>Device Test!</div> | ||
<MediaQuery minDeviceWidth={1224} values={{ deviceWidth: 1600 }}> | ||
<div>You are a desktop or laptop</div> | ||
<MediaQuery minDeviceWidth={1824}> | ||
<div>You also have a huge screen</div> | ||
</MediaQuery> | ||
<MediaQuery maxWidth={1224}> | ||
<div>You are sized like a tablet or mobile phone though</div> | ||
</MediaQuery> | ||
</MediaQuery> | ||
<MediaQuery maxDeviceWidth={1224}> | ||
<div>You are a tablet or mobile phone</div> | ||
</MediaQuery> | ||
<MediaQuery orientation="portrait"> | ||
<div>You are portrait</div> | ||
</MediaQuery> | ||
<MediaQuery orientation="landscape"> | ||
<div>You are landscape</div> | ||
</MediaQuery> | ||
<MediaQuery minResolution="2dppx"> | ||
<div>You are retina</div> | ||
</MediaQuery> | ||
</div> | ||
); | ||
``` | ||
@@ -241,10 +232,6 @@ | ||
// Desktop, tablet and mobile setup | ||
const Desktop = ({ children }) => <Responsive minWidth={992} children={children} />; | ||
const Tablet = ({ children }) => <Responsive minWidth={768} maxWidth={992} children={children} />; | ||
const Mobile = ({ children }) => <Responsive maxWidth={768} children={children} />; | ||
// Default (desktop, tablet) and mobile setup | ||
const Default = ({ children }) => <Responsive minWidth={768} children={children} />; | ||
const Mobile = ({ children }) => <Responsive maxWidth={768} children={children} />; | ||
@@ -256,5 +243,3 @@ const Example = () => ( | ||
<Mobile>You are a mobile phone</Mobile> | ||
<Default>You are not a mobile phone</Default> | ||
<Mobile>You are a mobile phone</Mobile> | ||
</div> | ||
@@ -261,0 +246,0 @@ ); |
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Environment variable access
Supply chain riskPackage accesses environment variables, which may be a sign of credential stuffing or data theft.
Found 2 instances in 1 package
24
8
0
227235
1392
289
1