}
*/
const queries = Object(external_lodash_["reduce"])(breakpoints, (result, width, name) => {
Object(external_lodash_["forEach"])(operators, (condition, operator) => {
const list = window.matchMedia(`(${condition}: ${width}px)`);
list.addListener(setIsMatching);
const key = [operator, name].join(' ');
result[key] = list;
});
return result;
}, {});
window.addEventListener('orientationchange', setIsMatching); // Set initial values
setIsMatching();
setIsMatching.flush();
};
/* harmony default export */ var listener = (addDimensionsEventListener);
// EXTERNAL MODULE: external ["wp","compose"]
var external_wp_compose_ = __webpack_require__("K9lf");
// EXTERNAL MODULE: ./node_modules/@babel/runtime/helpers/esm/extends.js
var esm_extends = __webpack_require__("wx14");
// EXTERNAL MODULE: external ["wp","element"]
var external_wp_element_ = __webpack_require__("GRId");
// CONCATENATED MODULE: ./node_modules/@wordpress/viewport/build-module/with-viewport-match.js
/**
* 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.
*
* @see isViewportMatch
*
* @param {Object} queries Object of prop name to viewport query.
*
* @example
*
* ```jsx
* function MyComponent( { isMobile } ) {
* return (
* Currently: { isMobile ? 'Mobile' : 'Not Mobile' }
* );
* }
*
* MyComponent = withViewportMatch( { isMobile: '< small' } )( MyComponent );
* ```
*
* @return {Function} Higher-order component.
*/
const withViewportMatch = queries => {
const useViewPortQueriesResult = () => Object(external_lodash_["mapValues"])(queries, query => {
let [operator, breakpointName] = query.split(' ');
if (breakpointName === undefined) {
breakpointName = operator;
operator = '>=';
} // Hooks should unconditionally execute in the same order,
// we are respecting that as from the static query of the HOC we generate
// a hook that calls other hooks always in the same order (because the query never changes).
// eslint-disable-next-line react-hooks/rules-of-hooks
return Object(external_wp_compose_["useViewportMatch"])(breakpointName, operator);
});
return Object(external_wp_compose_["createHigherOrderComponent"])(WrappedComponent => {
return Object(external_wp_compose_["pure"])(props => {
const queriesResult = useViewPortQueriesResult();
return Object(external_wp_element_["createElement"])(WrappedComponent, Object(esm_extends["a" /* default */])({}, props, queriesResult));
});
}, 'withViewportMatch');
};
/* harmony default export */ var with_viewport_match = (withViewportMatch);
// CONCATENATED MODULE: ./node_modules/@wordpress/viewport/build-module/if-viewport-matches.js
/**
* WordPress dependencies
*/
/**
* Internal dependencies
*/
/**
* Higher-order component creator, creating a new component which renders if
* the viewport query is satisfied.
*
* @see withViewportMatches
*
* @param {string} query Viewport query.
*
* @example
*
* ```jsx
* function MyMobileComponent() {
* return I'm only rendered on mobile viewports!
;
* }
*
* MyMobileComponent = ifViewportMatches( '< small' )( MyMobileComponent );
* ```
*
* @return {Function} Higher-order component.
*/
const ifViewportMatches = query => Object(external_wp_compose_["createHigherOrderComponent"])(Object(external_wp_compose_["compose"])([with_viewport_match({
isViewportMatch: query
}), Object(external_wp_compose_["ifCondition"])(props => props.isViewportMatch)]), 'ifViewportMatches');
/* harmony default export */ var if_viewport_matches = (ifViewportMatches);
// CONCATENATED MODULE: ./node_modules/@wordpress/viewport/build-module/index.js
/**
* Internal dependencies
*/
/**
* Hash of breakpoint names with pixel width at which it becomes effective.
*
* @see _breakpoints.scss
*
* @type {Object}
*/
const 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}
*/
const OPERATORS = {
'<': 'max-width',
'>=': 'min-width'
};
listener(BREAKPOINTS, OPERATORS);
/***/ }),
/***/ "YLtl":
/***/ (function(module, exports) {
(function() { module.exports = window["lodash"]; }());
/***/ }),
/***/ "wx14":
/***/ (function(module, __webpack_exports__, __webpack_require__) {
"use strict";
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return _extends; });
function _extends() {
_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;
};
return _extends.apply(this, arguments);
}
/***/ })
/******/ });