2018-10-24 07:48:53 -04:00
|
|
|
this["wp"] = this["wp"] || {}; this["wp"]["viewport"] =
|
|
|
|
/******/ (function(modules) { // webpackBootstrap
|
|
|
|
/******/ // The module cache
|
|
|
|
/******/ var installedModules = {};
|
|
|
|
/******/
|
|
|
|
/******/ // The require function
|
|
|
|
/******/ function __webpack_require__(moduleId) {
|
|
|
|
/******/
|
|
|
|
/******/ // Check if module is in cache
|
|
|
|
/******/ if(installedModules[moduleId]) {
|
|
|
|
/******/ return installedModules[moduleId].exports;
|
|
|
|
/******/ }
|
|
|
|
/******/ // Create a new module (and put it into the cache)
|
|
|
|
/******/ var module = installedModules[moduleId] = {
|
|
|
|
/******/ i: moduleId,
|
|
|
|
/******/ l: false,
|
|
|
|
/******/ exports: {}
|
|
|
|
/******/ };
|
|
|
|
/******/
|
|
|
|
/******/ // Execute the module function
|
|
|
|
/******/ modules[moduleId].call(module.exports, module, module.exports, __webpack_require__);
|
|
|
|
/******/
|
|
|
|
/******/ // Flag the module as loaded
|
|
|
|
/******/ module.l = true;
|
|
|
|
/******/
|
|
|
|
/******/ // Return the exports of the module
|
|
|
|
/******/ return module.exports;
|
|
|
|
/******/ }
|
|
|
|
/******/
|
|
|
|
/******/
|
|
|
|
/******/ // expose the modules object (__webpack_modules__)
|
|
|
|
/******/ __webpack_require__.m = modules;
|
|
|
|
/******/
|
|
|
|
/******/ // expose the module cache
|
|
|
|
/******/ __webpack_require__.c = installedModules;
|
|
|
|
/******/
|
|
|
|
/******/ // define getter function for harmony exports
|
|
|
|
/******/ __webpack_require__.d = function(exports, name, getter) {
|
|
|
|
/******/ if(!__webpack_require__.o(exports, name)) {
|
|
|
|
/******/ Object.defineProperty(exports, name, { enumerable: true, get: getter });
|
|
|
|
/******/ }
|
|
|
|
/******/ };
|
|
|
|
/******/
|
|
|
|
/******/ // define __esModule on exports
|
|
|
|
/******/ __webpack_require__.r = function(exports) {
|
|
|
|
/******/ if(typeof Symbol !== 'undefined' && Symbol.toStringTag) {
|
|
|
|
/******/ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
|
|
|
|
/******/ }
|
|
|
|
/******/ Object.defineProperty(exports, '__esModule', { value: true });
|
|
|
|
/******/ };
|
|
|
|
/******/
|
|
|
|
/******/ // create a fake namespace object
|
|
|
|
/******/ // mode & 1: value is a module id, require it
|
|
|
|
/******/ // mode & 2: merge all properties of value into the ns
|
|
|
|
/******/ // mode & 4: return value when already ns object
|
|
|
|
/******/ // mode & 8|1: behave like require
|
|
|
|
/******/ __webpack_require__.t = function(value, mode) {
|
|
|
|
/******/ if(mode & 1) value = __webpack_require__(value);
|
|
|
|
/******/ if(mode & 8) return value;
|
|
|
|
/******/ if((mode & 4) && typeof value === 'object' && value && value.__esModule) return value;
|
|
|
|
/******/ var ns = Object.create(null);
|
|
|
|
/******/ __webpack_require__.r(ns);
|
|
|
|
/******/ Object.defineProperty(ns, 'default', { enumerable: true, value: value });
|
|
|
|
/******/ if(mode & 2 && typeof value != 'string') for(var key in value) __webpack_require__.d(ns, key, function(key) { return value[key]; }.bind(null, key));
|
|
|
|
/******/ return ns;
|
|
|
|
/******/ };
|
|
|
|
/******/
|
|
|
|
/******/ // 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__
|
|
|
|
/******/ __webpack_require__.p = "";
|
|
|
|
/******/
|
|
|
|
/******/
|
|
|
|
/******/ // Load entry module and return exports
|
2018-10-26 03:35:06 -04:00
|
|
|
/******/ return __webpack_require__(__webpack_require__.s = "./packages/packages/viewport/build-module/index.js");
|
2018-10-24 07:48:53 -04:00
|
|
|
/******/ })
|
|
|
|
/************************************************************************/
|
|
|
|
/******/ ({
|
|
|
|
|
2018-10-26 03:35:06 -04:00
|
|
|
/***/ "./packages/node_modules/@babel/runtime/helpers/esm/arrayWithoutHoles.js":
|
|
|
|
/*!*******************************************************************************!*\
|
|
|
|
!*** ./packages/node_modules/@babel/runtime/helpers/esm/arrayWithoutHoles.js ***!
|
|
|
|
\*******************************************************************************/
|
2018-10-24 07:48:53 -04:00
|
|
|
/*! exports provided: default */
|
|
|
|
/***/ (function(module, __webpack_exports__, __webpack_require__) {
|
|
|
|
|
|
|
|
"use strict";
|
|
|
|
__webpack_require__.r(__webpack_exports__);
|
|
|
|
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "default", function() { return _arrayWithoutHoles; });
|
|
|
|
function _arrayWithoutHoles(arr) {
|
|
|
|
if (Array.isArray(arr)) {
|
|
|
|
for (var i = 0, arr2 = new Array(arr.length); i < arr.length; i++) {
|
|
|
|
arr2[i] = arr[i];
|
|
|
|
}
|
|
|
|
|
|
|
|
return arr2;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
/***/ }),
|
|
|
|
|
2018-10-26 03:35:06 -04:00
|
|
|
/***/ "./packages/node_modules/@babel/runtime/helpers/esm/iterableToArray.js":
|
|
|
|
/*!*****************************************************************************!*\
|
|
|
|
!*** ./packages/node_modules/@babel/runtime/helpers/esm/iterableToArray.js ***!
|
|
|
|
\*****************************************************************************/
|
2018-10-24 07:48:53 -04:00
|
|
|
/*! exports provided: default */
|
|
|
|
/***/ (function(module, __webpack_exports__, __webpack_require__) {
|
|
|
|
|
|
|
|
"use strict";
|
|
|
|
__webpack_require__.r(__webpack_exports__);
|
|
|
|
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "default", function() { return _iterableToArray; });
|
|
|
|
function _iterableToArray(iter) {
|
|
|
|
if (Symbol.iterator in Object(iter) || Object.prototype.toString.call(iter) === "[object Arguments]") return Array.from(iter);
|
|
|
|
}
|
|
|
|
|
|
|
|
/***/ }),
|
|
|
|
|
2018-10-26 03:35:06 -04:00
|
|
|
/***/ "./packages/node_modules/@babel/runtime/helpers/esm/nonIterableSpread.js":
|
|
|
|
/*!*******************************************************************************!*\
|
|
|
|
!*** ./packages/node_modules/@babel/runtime/helpers/esm/nonIterableSpread.js ***!
|
|
|
|
\*******************************************************************************/
|
2018-10-24 07:48:53 -04:00
|
|
|
/*! exports provided: default */
|
|
|
|
/***/ (function(module, __webpack_exports__, __webpack_require__) {
|
|
|
|
|
|
|
|
"use strict";
|
|
|
|
__webpack_require__.r(__webpack_exports__);
|
|
|
|
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "default", function() { return _nonIterableSpread; });
|
|
|
|
function _nonIterableSpread() {
|
|
|
|
throw new TypeError("Invalid attempt to spread non-iterable instance");
|
|
|
|
}
|
|
|
|
|
|
|
|
/***/ }),
|
|
|
|
|
2018-10-26 03:35:06 -04:00
|
|
|
/***/ "./packages/node_modules/@babel/runtime/helpers/esm/toConsumableArray.js":
|
|
|
|
/*!*******************************************************************************!*\
|
|
|
|
!*** ./packages/node_modules/@babel/runtime/helpers/esm/toConsumableArray.js ***!
|
|
|
|
\*******************************************************************************/
|
2018-10-24 07:48:53 -04:00
|
|
|
/*! exports provided: default */
|
|
|
|
/***/ (function(module, __webpack_exports__, __webpack_require__) {
|
|
|
|
|
|
|
|
"use strict";
|
|
|
|
__webpack_require__.r(__webpack_exports__);
|
|
|
|
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "default", function() { return _toConsumableArray; });
|
2018-10-26 03:35:06 -04:00
|
|
|
/* harmony import */ var _arrayWithoutHoles__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./arrayWithoutHoles */ "./packages/node_modules/@babel/runtime/helpers/esm/arrayWithoutHoles.js");
|
|
|
|
/* harmony import */ var _iterableToArray__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./iterableToArray */ "./packages/node_modules/@babel/runtime/helpers/esm/iterableToArray.js");
|
|
|
|
/* harmony import */ var _nonIterableSpread__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./nonIterableSpread */ "./packages/node_modules/@babel/runtime/helpers/esm/nonIterableSpread.js");
|
2018-10-24 07:48:53 -04:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
function _toConsumableArray(arr) {
|
|
|
|
return Object(_arrayWithoutHoles__WEBPACK_IMPORTED_MODULE_0__["default"])(arr) || Object(_iterableToArray__WEBPACK_IMPORTED_MODULE_1__["default"])(arr) || Object(_nonIterableSpread__WEBPACK_IMPORTED_MODULE_2__["default"])();
|
|
|
|
}
|
|
|
|
|
|
|
|
/***/ }),
|
|
|
|
|
2018-10-26 03:35:06 -04:00
|
|
|
/***/ "./packages/packages/viewport/build-module/if-viewport-matches.js":
|
|
|
|
/*!************************************************************************!*\
|
|
|
|
!*** ./packages/packages/viewport/build-module/if-viewport-matches.js ***!
|
|
|
|
\************************************************************************/
|
2018-10-24 07:48:53 -04:00
|
|
|
/*! exports provided: default */
|
|
|
|
/***/ (function(module, __webpack_exports__, __webpack_require__) {
|
|
|
|
|
|
|
|
"use strict";
|
|
|
|
__webpack_require__.r(__webpack_exports__);
|
|
|
|
/* harmony import */ var _wordpress_compose__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @wordpress/compose */ "@wordpress/compose");
|
|
|
|
/* harmony import */ var _wordpress_compose__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_wordpress_compose__WEBPACK_IMPORTED_MODULE_0__);
|
2018-10-26 03:35:06 -04:00
|
|
|
/* harmony import */ var _with_viewport_match__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./with-viewport-match */ "./packages/packages/viewport/build-module/with-viewport-match.js");
|
2018-10-24 07:48:53 -04:00
|
|
|
/**
|
|
|
|
* WordPress dependencies
|
|
|
|
*/
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Internal dependencies
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Higher-order component creator, creating a new component which renders if
|
|
|
|
* the viewport query is satisfied.
|
|
|
|
*
|
|
|
|
* @param {string} query Viewport query.
|
|
|
|
*
|
|
|
|
* @see withViewportMatches
|
|
|
|
*
|
|
|
|
* @return {Function} Higher-order component.
|
|
|
|
*/
|
|
|
|
|
|
|
|
var ifViewportMatches = function ifViewportMatches(query) {
|
|
|
|
return Object(_wordpress_compose__WEBPACK_IMPORTED_MODULE_0__["createHigherOrderComponent"])(Object(_wordpress_compose__WEBPACK_IMPORTED_MODULE_0__["compose"])([Object(_with_viewport_match__WEBPACK_IMPORTED_MODULE_1__["default"])({
|
|
|
|
isViewportMatch: query
|
|
|
|
}), Object(_wordpress_compose__WEBPACK_IMPORTED_MODULE_0__["ifCondition"])(function (props) {
|
|
|
|
return props.isViewportMatch;
|
|
|
|
})]), 'ifViewportMatches');
|
|
|
|
};
|
|
|
|
|
|
|
|
/* harmony default export */ __webpack_exports__["default"] = (ifViewportMatches);
|
|
|
|
|
|
|
|
|
|
|
|
/***/ }),
|
|
|
|
|
2018-10-26 03:35:06 -04:00
|
|
|
/***/ "./packages/packages/viewport/build-module/index.js":
|
|
|
|
/*!**********************************************************!*\
|
|
|
|
!*** ./packages/packages/viewport/build-module/index.js ***!
|
|
|
|
\**********************************************************/
|
2018-10-24 07:48:53 -04:00
|
|
|
/*! exports provided: ifViewportMatches, withViewportMatch */
|
|
|
|
/***/ (function(module, __webpack_exports__, __webpack_require__) {
|
|
|
|
|
|
|
|
"use strict";
|
|
|
|
__webpack_require__.r(__webpack_exports__);
|
|
|
|
/* harmony import */ var lodash__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! lodash */ "lodash");
|
|
|
|
/* harmony import */ var lodash__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(lodash__WEBPACK_IMPORTED_MODULE_0__);
|
|
|
|
/* harmony import */ var _wordpress_data__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @wordpress/data */ "@wordpress/data");
|
|
|
|
/* harmony import */ var _wordpress_data__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(_wordpress_data__WEBPACK_IMPORTED_MODULE_1__);
|
2018-10-26 03:35:06 -04:00
|
|
|
/* harmony import */ var _store__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./store */ "./packages/packages/viewport/build-module/store/index.js");
|
|
|
|
/* harmony import */ var _if_viewport_matches__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./if-viewport-matches */ "./packages/packages/viewport/build-module/if-viewport-matches.js");
|
2018-10-24 07:48:53 -04:00
|
|
|
/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "ifViewportMatches", function() { return _if_viewport_matches__WEBPACK_IMPORTED_MODULE_3__["default"]; });
|
|
|
|
|
2018-10-26 03:35:06 -04:00
|
|
|
/* harmony import */ var _with_viewport_match__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./with-viewport-match */ "./packages/packages/viewport/build-module/with-viewport-match.js");
|
2018-10-24 07:48:53 -04:00
|
|
|
/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "withViewportMatch", function() { return _with_viewport_match__WEBPACK_IMPORTED_MODULE_4__["default"]; });
|
|
|
|
|
|
|
|
/**
|
|
|
|
* External dependencies
|
|
|
|
*/
|
|
|
|
|
|
|
|
/**
|
|
|
|
* WordPress dependencies
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Internal dependencies
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Hash of breakpoint names with pixel width at which it becomes effective.
|
|
|
|
*
|
|
|
|
* @see _breakpoints.scss
|
|
|
|
*
|
|
|
|
* @type {Object}
|
|
|
|
*/
|
|
|
|
|
|
|
|
var BREAKPOINTS = {
|
|
|
|
huge: 1440,
|
|
|
|
wide: 1280,
|
|
|
|
large: 960,
|
|
|
|
medium: 782,
|
|
|
|
small: 600,
|
|
|
|
mobile: 480
|
|
|
|
};
|
|
|
|
/**
|
|
|
|
* Hash of query operators with corresponding condition for media query.
|
|
|
|
*
|
|
|
|
* @type {Object}
|
|
|
|
*/
|
|
|
|
|
|
|
|
var OPERATORS = {
|
|
|
|
'<': 'max-width',
|
|
|
|
'>=': 'min-width'
|
|
|
|
};
|
|
|
|
/**
|
|
|
|
* Callback invoked when media query state should be updated. Is invoked a
|
|
|
|
* maximum of one time per call stack.
|
|
|
|
*/
|
|
|
|
|
|
|
|
var setIsMatching = Object(lodash__WEBPACK_IMPORTED_MODULE_0__["debounce"])(function () {
|
|
|
|
var values = Object(lodash__WEBPACK_IMPORTED_MODULE_0__["mapValues"])(queries, function (query) {
|
|
|
|
return query.matches;
|
|
|
|
});
|
|
|
|
Object(_wordpress_data__WEBPACK_IMPORTED_MODULE_1__["dispatch"])('core/viewport').setIsMatching(values);
|
|
|
|
}, {
|
|
|
|
leading: true
|
|
|
|
});
|
|
|
|
/**
|
|
|
|
* Hash of breakpoint names with generated MediaQueryList for corresponding
|
|
|
|
* media query.
|
|
|
|
*
|
|
|
|
* @see https://developer.mozilla.org/en-US/docs/Web/API/Window/matchMedia
|
|
|
|
* @see https://developer.mozilla.org/en-US/docs/Web/API/MediaQueryList
|
|
|
|
*
|
|
|
|
* @type {Object<string,MediaQueryList>}
|
|
|
|
*/
|
|
|
|
|
|
|
|
var queries = Object(lodash__WEBPACK_IMPORTED_MODULE_0__["reduce"])(BREAKPOINTS, function (result, width, name) {
|
|
|
|
Object(lodash__WEBPACK_IMPORTED_MODULE_0__["forEach"])(OPERATORS, function (condition, operator) {
|
|
|
|
var list = window.matchMedia("(".concat(condition, ": ").concat(width, "px)"));
|
|
|
|
list.addListener(setIsMatching);
|
|
|
|
var key = [operator, name].join(' ');
|
|
|
|
result[key] = list;
|
|
|
|
});
|
|
|
|
return result;
|
|
|
|
}, {});
|
|
|
|
window.addEventListener('orientationchange', setIsMatching); // Set initial values
|
|
|
|
|
|
|
|
setIsMatching();
|
|
|
|
|
|
|
|
|
|
|
|
/***/ }),
|
|
|
|
|
2018-10-26 03:35:06 -04:00
|
|
|
/***/ "./packages/packages/viewport/build-module/store/actions.js":
|
|
|
|
/*!******************************************************************!*\
|
|
|
|
!*** ./packages/packages/viewport/build-module/store/actions.js ***!
|
|
|
|
\******************************************************************/
|
2018-10-24 07:48:53 -04:00
|
|
|
/*! exports provided: setIsMatching */
|
|
|
|
/***/ (function(module, __webpack_exports__, __webpack_require__) {
|
|
|
|
|
|
|
|
"use strict";
|
|
|
|
__webpack_require__.r(__webpack_exports__);
|
|
|
|
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "setIsMatching", function() { return setIsMatching; });
|
|
|
|
/**
|
|
|
|
* Returns an action object used in signalling that viewport queries have been
|
|
|
|
* updated. Values are specified as an object of breakpoint query keys where
|
|
|
|
* value represents whether query matches.
|
|
|
|
*
|
|
|
|
* @param {Object} values Breakpoint query matches.
|
|
|
|
*
|
|
|
|
* @return {Object} Action object.
|
|
|
|
*/
|
|
|
|
function setIsMatching(values) {
|
|
|
|
return {
|
|
|
|
type: 'SET_IS_MATCHING',
|
|
|
|
values: values
|
|
|
|
};
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/***/ }),
|
|
|
|
|
2018-10-26 03:35:06 -04:00
|
|
|
/***/ "./packages/packages/viewport/build-module/store/index.js":
|
|
|
|
/*!****************************************************************!*\
|
|
|
|
!*** ./packages/packages/viewport/build-module/store/index.js ***!
|
|
|
|
\****************************************************************/
|
2018-10-24 07:48:53 -04:00
|
|
|
/*! exports provided: default */
|
|
|
|
/***/ (function(module, __webpack_exports__, __webpack_require__) {
|
|
|
|
|
|
|
|
"use strict";
|
|
|
|
__webpack_require__.r(__webpack_exports__);
|
|
|
|
/* harmony import */ var _wordpress_data__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @wordpress/data */ "@wordpress/data");
|
|
|
|
/* harmony import */ var _wordpress_data__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_wordpress_data__WEBPACK_IMPORTED_MODULE_0__);
|
2018-10-26 03:35:06 -04:00
|
|
|
/* harmony import */ var _reducer__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./reducer */ "./packages/packages/viewport/build-module/store/reducer.js");
|
|
|
|
/* harmony import */ var _actions__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./actions */ "./packages/packages/viewport/build-module/store/actions.js");
|
|
|
|
/* harmony import */ var _selectors__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./selectors */ "./packages/packages/viewport/build-module/store/selectors.js");
|
2018-10-24 07:48:53 -04:00
|
|
|
/**
|
|
|
|
* WordPress dependencies
|
|
|
|
*/
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Internal dependencies
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/* harmony default export */ __webpack_exports__["default"] = (Object(_wordpress_data__WEBPACK_IMPORTED_MODULE_0__["registerStore"])('core/viewport', {
|
|
|
|
reducer: _reducer__WEBPACK_IMPORTED_MODULE_1__["default"],
|
|
|
|
actions: _actions__WEBPACK_IMPORTED_MODULE_2__,
|
|
|
|
selectors: _selectors__WEBPACK_IMPORTED_MODULE_3__
|
|
|
|
}));
|
|
|
|
|
|
|
|
|
|
|
|
/***/ }),
|
|
|
|
|
2018-10-26 03:35:06 -04:00
|
|
|
/***/ "./packages/packages/viewport/build-module/store/reducer.js":
|
|
|
|
/*!******************************************************************!*\
|
|
|
|
!*** ./packages/packages/viewport/build-module/store/reducer.js ***!
|
|
|
|
\******************************************************************/
|
2018-10-24 07:48:53 -04:00
|
|
|
/*! exports provided: default */
|
|
|
|
/***/ (function(module, __webpack_exports__, __webpack_require__) {
|
|
|
|
|
|
|
|
"use strict";
|
|
|
|
__webpack_require__.r(__webpack_exports__);
|
|
|
|
/**
|
|
|
|
* Reducer returning the viewport state, as keys of breakpoint queries with
|
|
|
|
* boolean value representing whether query is matched.
|
|
|
|
*
|
|
|
|
* @param {Object} state Current state.
|
|
|
|
* @param {Object} action Dispatched action.
|
|
|
|
*
|
|
|
|
* @return {Object} Updated state.
|
|
|
|
*/
|
|
|
|
function reducer() {
|
|
|
|
var state = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
|
|
|
var action = arguments.length > 1 ? arguments[1] : undefined;
|
|
|
|
|
|
|
|
switch (action.type) {
|
|
|
|
case 'SET_IS_MATCHING':
|
|
|
|
return action.values;
|
|
|
|
}
|
|
|
|
|
|
|
|
return state;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* harmony default export */ __webpack_exports__["default"] = (reducer);
|
|
|
|
|
|
|
|
|
|
|
|
/***/ }),
|
|
|
|
|
2018-10-26 03:35:06 -04:00
|
|
|
/***/ "./packages/packages/viewport/build-module/store/selectors.js":
|
|
|
|
/*!********************************************************************!*\
|
|
|
|
!*** ./packages/packages/viewport/build-module/store/selectors.js ***!
|
|
|
|
\********************************************************************/
|
2018-10-24 07:48:53 -04:00
|
|
|
/*! exports provided: isViewportMatch */
|
|
|
|
/***/ (function(module, __webpack_exports__, __webpack_require__) {
|
|
|
|
|
|
|
|
"use strict";
|
|
|
|
__webpack_require__.r(__webpack_exports__);
|
|
|
|
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "isViewportMatch", function() { return isViewportMatch; });
|
2018-10-26 03:35:06 -04:00
|
|
|
/* harmony import */ var _babel_runtime_helpers_esm_toConsumableArray__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @babel/runtime/helpers/esm/toConsumableArray */ "./packages/node_modules/@babel/runtime/helpers/esm/toConsumableArray.js");
|
2018-10-24 07:48:53 -04:00
|
|
|
/* harmony import */ var lodash__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! lodash */ "lodash");
|
|
|
|
/* harmony import */ var lodash__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(lodash__WEBPACK_IMPORTED_MODULE_1__);
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
* External dependencies
|
|
|
|
*/
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Returns true if the viewport matches the given query, or false otherwise.
|
|
|
|
*
|
|
|
|
* @param {Object} state Viewport state object.
|
|
|
|
* @param {string} query Query string. Includes operator and breakpoint name,
|
|
|
|
* space separated. Operator defaults to >=.
|
|
|
|
*
|
|
|
|
* @example
|
|
|
|
*
|
|
|
|
* ```js
|
|
|
|
* isViewportMatch( state, '< huge' );
|
|
|
|
* isViewPortMatch( state, 'medium' );
|
|
|
|
* ```
|
|
|
|
*
|
|
|
|
* @return {boolean} Whether viewport matches query.
|
|
|
|
*/
|
|
|
|
|
|
|
|
function isViewportMatch(state, query) {
|
|
|
|
// Pad to _at least_ two elements to take from the right, effectively
|
|
|
|
// defaulting the left-most value.
|
|
|
|
var key = Object(lodash__WEBPACK_IMPORTED_MODULE_1__["takeRight"])(['>='].concat(Object(_babel_runtime_helpers_esm_toConsumableArray__WEBPACK_IMPORTED_MODULE_0__["default"])(query.split(' '))), 2).join(' ');
|
|
|
|
return !!state[key];
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/***/ }),
|
|
|
|
|
2018-10-26 03:35:06 -04:00
|
|
|
/***/ "./packages/packages/viewport/build-module/with-viewport-match.js":
|
|
|
|
/*!************************************************************************!*\
|
|
|
|
!*** ./packages/packages/viewport/build-module/with-viewport-match.js ***!
|
|
|
|
\************************************************************************/
|
2018-10-24 07:48:53 -04:00
|
|
|
/*! exports provided: default */
|
|
|
|
/***/ (function(module, __webpack_exports__, __webpack_require__) {
|
|
|
|
|
|
|
|
"use strict";
|
|
|
|
__webpack_require__.r(__webpack_exports__);
|
|
|
|
/* harmony import */ var lodash__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! lodash */ "lodash");
|
|
|
|
/* harmony import */ var lodash__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(lodash__WEBPACK_IMPORTED_MODULE_0__);
|
|
|
|
/* harmony import */ var _wordpress_compose__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @wordpress/compose */ "@wordpress/compose");
|
|
|
|
/* harmony import */ var _wordpress_compose__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(_wordpress_compose__WEBPACK_IMPORTED_MODULE_1__);
|
|
|
|
/* harmony import */ var _wordpress_data__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! @wordpress/data */ "@wordpress/data");
|
|
|
|
/* harmony import */ var _wordpress_data__WEBPACK_IMPORTED_MODULE_2___default = /*#__PURE__*/__webpack_require__.n(_wordpress_data__WEBPACK_IMPORTED_MODULE_2__);
|
|
|
|
/**
|
|
|
|
* External dependencies
|
|
|
|
*/
|
|
|
|
|
|
|
|
/**
|
|
|
|
* WordPress dependencies
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Higher-order component creator, creating a new component which renders with
|
|
|
|
* the given prop names, where the value passed to the underlying component is
|
|
|
|
* the result of the query assigned as the object's value.
|
|
|
|
*
|
|
|
|
* @param {Object} queries Object of prop name to viewport query.
|
|
|
|
*
|
|
|
|
* @see isViewportMatch
|
|
|
|
*
|
|
|
|
* @return {Function} Higher-order component.
|
|
|
|
*/
|
|
|
|
|
|
|
|
var withViewportMatch = function withViewportMatch(queries) {
|
|
|
|
return Object(_wordpress_compose__WEBPACK_IMPORTED_MODULE_1__["createHigherOrderComponent"])(Object(_wordpress_data__WEBPACK_IMPORTED_MODULE_2__["withSelect"])(function (select) {
|
|
|
|
return Object(lodash__WEBPACK_IMPORTED_MODULE_0__["mapValues"])(queries, function (query) {
|
|
|
|
return select('core/viewport').isViewportMatch(query);
|
|
|
|
});
|
|
|
|
}), 'withViewportMatch');
|
|
|
|
};
|
|
|
|
|
|
|
|
/* harmony default export */ __webpack_exports__["default"] = (withViewportMatch);
|
|
|
|
|
|
|
|
|
|
|
|
/***/ }),
|
|
|
|
|
|
|
|
/***/ "@wordpress/compose":
|
|
|
|
/*!******************************************!*\
|
|
|
|
!*** external {"this":["wp","compose"]} ***!
|
|
|
|
\******************************************/
|
|
|
|
/*! no static exports found */
|
|
|
|
/***/ (function(module, exports) {
|
|
|
|
|
|
|
|
(function() { module.exports = this["wp"]["compose"]; }());
|
|
|
|
|
|
|
|
/***/ }),
|
|
|
|
|
|
|
|
/***/ "@wordpress/data":
|
|
|
|
/*!***************************************!*\
|
|
|
|
!*** external {"this":["wp","data"]} ***!
|
|
|
|
\***************************************/
|
|
|
|
/*! no static exports found */
|
|
|
|
/***/ (function(module, exports) {
|
|
|
|
|
|
|
|
(function() { module.exports = this["wp"]["data"]; }());
|
|
|
|
|
|
|
|
/***/ }),
|
|
|
|
|
|
|
|
/***/ "lodash":
|
|
|
|
/*!*************************!*\
|
|
|
|
!*** external "lodash" ***!
|
|
|
|
\*************************/
|
|
|
|
/*! no static exports found */
|
|
|
|
/***/ (function(module, exports) {
|
|
|
|
|
|
|
|
(function() { module.exports = this["lodash"]; }());
|
|
|
|
|
|
|
|
/***/ })
|
|
|
|
|
|
|
|
/******/ });
|
|
|
|
//# sourceMappingURL=viewport.js.map
|