2 lines
1.9 KiB
JavaScript
2 lines
1.9 KiB
JavaScript
/*! This file is auto-generated */
|
|
!function(){"use strict";var e={d:function(t,r){for(var n in r)e.o(r,n)&&!e.o(t,n)&&Object.defineProperty(t,n,{enumerable:!0,get:r[n]})},o:function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},r:function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})}},t={};e.r(t),e.d(t,{ifViewportMatches:function(){return f},store:function(){return s},withViewportMatch:function(){return w}});var r={};e.r(r),e.d(r,{setIsMatching:function(){return a}});var n={};e.r(n),e.d(n,{isViewportMatch:function(){return u}});var o=window.wp.compose,i=window.wp.data;var c=function(e={},t){return"SET_IS_MATCHING"===t.type?t.values:e};function a(e){return{type:"SET_IS_MATCHING",values:e}}function u(e,t){return-1===t.indexOf(" ")&&(t=">= "+t),!!e[t]}const s=(0,i.createReduxStore)("core/viewport",{reducer:c,actions:r,selectors:n});(0,i.register)(s);var d=(e,t)=>{const r=(0,o.debounce)((()=>{const e=Object.fromEntries(c.map((([e,t])=>[e,t.matches])));(0,i.dispatch)(s).setIsMatching(e)}),0,{leading:!0}),n=Object.entries(t),c=Object.entries(e).flatMap((([e,t])=>n.map((([n,o])=>{const i=window.matchMedia(`(${o}: ${t}px)`);return i.addEventListener("change",r),[`${n} ${e}`,i]}))));window.addEventListener("orientationchange",r),r(),r.flush()},p=window.wp.element;var w=e=>{const t=Object.entries(e);return(0,o.createHigherOrderComponent)((e=>(0,o.pure)((r=>{const n=Object.fromEntries(t.map((([e,t])=>{let[r,n]=t.split(" ");return void 0===n&&(n=r,r=">="),[e,(0,o.useViewportMatch)(n,r)]})));return(0,p.createElement)(e,{...r,...n})}))),"withViewportMatch")};var f=e=>(0,o.createHigherOrderComponent)((0,o.compose)([w({isViewportMatch:e}),(0,o.ifCondition)((e=>e.isViewportMatch))]),"ifViewportMatches");d({huge:1440,wide:1280,large:960,medium:782,small:600,mobile:480},{"<":"max-width",">=":"min-width"}),(window.wp=window.wp||{}).viewport=t}(); |