UNPKG

foundation-sites

Version:

The most advanced responsive front-end framework in the world.

3 lines (2 loc) 5.91 kB
((e,t)=>{"object"==typeof exports&&"object"==typeof module?module.exports=t(require("./foundation.core"),require("jquery")):"function"==typeof define&&define.amd?define(["./foundation.core","jquery"],t):"object"==typeof exports?exports.__FOUNDATION_EXTERNAL__=t(require("./foundation.core"),require("jquery")):(e.__FOUNDATION_EXTERNAL__=e.__FOUNDATION_EXTERNAL__||{},e.__FOUNDATION_EXTERNAL__["foundation.util.mediaQuery"]=t(e.__FOUNDATION_EXTERNAL__["foundation.core"],e.jQuery))})(self,function(t,n){return i={"./js/foundation.util.mediaQuery.js":function(e,t,n){n.r(t),n.d(t,{MediaQuery:function(){return d}});var r,i,o,t=n("jquery"),u=n.n(t);function a(e){return(a="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function s(e,t){return(e=>{if(Array.isArray(e))return e})(e)||((e,t)=>{var n=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=n){var r,i,o,u,a=[],s=!0,c=!1;try{if(o=(n=n.call(e)).next,0===t){if(Object(n)!==n)return;s=!1}else for(;!(s=(r=o.call(n)).done)&&(a.push(r.value),a.length!==t);s=!0);}catch(e){c=!0,i=e}finally{try{if(!s&&null!=n.return&&(u=n.return(),Object(u)!==u))return}finally{if(c)throw i}}return a}})(e,t)||((e,t)=>{var n;if(e)return"string"==typeof e?c(e,t):"Map"===(n="Object"===(n={}.toString.call(e).slice(8,-1))&&e.constructor?e.constructor.name:n)||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?c(e,t):void 0})(e,t)||(()=>{throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")})()}function c(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n<t;n++)r[n]=e[n];return r}window.matchMedia||(window.matchMedia=((o=window.styleMedia||window.media)||(r=document.createElement("style"),n=document.getElementsByTagName("script")[0],i=null,r.type="text/css",r.id="matchmediajs-test",n?n.parentNode.insertBefore(r,n):document.head.appendChild(r),i="getComputedStyle"in window&&window.getComputedStyle(r,null)||r.currentStyle,o={matchMedium:function(e){e="@media "+e+"{ #matchmediajs-test { width: 1px; } }";return r.styleSheet?r.styleSheet.cssText=e:r.textContent=e,"1px"===i.width}}),function(e){return{matches:o.matchMedium(e||"all"),media:e||"all"}}));var d={queries:[],current:"",_init:function(){if(!0===this.isInitialized)return this;this.isInitialized=!0;u()("meta.foundation-mq").length||u()('<meta class="foundation-mq" name="foundation-mq" content>').appendTo(document.head);var e,t,n,r=u()(".foundation-mq").css("font-family");for(n in t={},e=t="string"==typeof(r=r)&&(r=r.trim().slice(1,-1))?r.split("&").reduce(function(e,t){var t=t.replace(/\+/g," ").split("="),n=t[0],t=t[1],n=decodeURIComponent(n),t=void 0===t?null:decodeURIComponent(t);return e.hasOwnProperty(n)?Array.isArray(e[n])?e[n].push(t):e[n]=[e[n],t]:e[n]=t,e},{}):t,this.queries=[],e)e.hasOwnProperty(n)&&this.queries.push({name:n,value:"only screen and (min-width: ".concat(e[n],")")});this.current=this._getCurrentSize(),this._watcher()},_reInit:function(){this.isInitialized=!1,this._init()},atLeast:function(e){e=this.get(e);return!!e&&window.matchMedia(e).matches},only:function(e){return e===this._getCurrentSize()},upTo:function(e){e=this.next(e);return!e||!this.atLeast(e)},is:function(e){var t=s(e.trim().split(" ").filter(function(e){return!!e.length}),2),n=t[0],t=t[1],t=void 0===t?"":t;if("only"===t)return this.only(n);if(!t||"up"===t)return this.atLeast(n);if("down"===t)return this.upTo(n);throw new Error('\n Invalid breakpoint passed to MediaQuery.is().\n Expected a breakpoint name formatted like "<size> <modifier>", got "'.concat(e,'".\n '))},get:function(e){for(var t in this.queries)if(this.queries.hasOwnProperty(t)){t=this.queries[t];if(e===t.name)return t.value}return null},next:function(t){var n=this,e=this.queries.findIndex(function(e){return n._getQueryName(e)===t});if(-1===e)throw new Error('\n Unknown breakpoint "'.concat(t,'" passed to MediaQuery.next().\n Ensure it is present in your Sass "$breakpoints" setting.\n '));e=this.queries[e+1];return e?e.name:null},_getQueryName:function(e){if("string"==typeof e)return e;if("object"===a(e))return e.name;throw new TypeError('\n Invalid value passed to MediaQuery._getQueryName().\n Expected a breakpoint name (String) or a breakpoint query (Object), got "'.concat(e,'" (').concat(a(e),")\n "))},_getCurrentSize:function(){for(var e,t=0;t<this.queries.length;t++){var n=this.queries[t];window.matchMedia(n.value).matches&&(e=n)}return e&&this._getQueryName(e)},_watcher:function(){var n=this;u()(window).on("resize.zf.trigger",function(){var e=n._getCurrentSize(),t=n.current;e!==t&&(n.current=e,u()(window).trigger("changed.zf.mediaquery",[e,t]))})}}},"./foundation.core":function(e){e.exports=t},jquery:function(e){e.exports=n}},o={},r.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return r.d(t,{a:t}),t},r.d=function(e,t){for(var n in t)r.o(t,n)&&!r.o(e,n)&&Object.defineProperty(e,n,{enumerable:!0,get:t[n]})},r.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},a={},(r.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})})(a),r.d(a,{Foundation:function(){return e.Foundation},MediaQuery:function(){return u.MediaQuery}}),e=r("./foundation.core"),u=r("./js/foundation.util.mediaQuery.js"),e.Foundation.MediaQuery=u.MediaQuery,e.Foundation.MediaQuery._init(),a;function r(e){var t=o[e];return void 0!==t||(t=o[e]={exports:{}},i[e](t,t.exports,r)),t.exports}var i,o,e,u,a}); //# sourceMappingURL=foundation.util.mediaQuery.min.js.map