8 lines
2.3 KiB
JavaScript
8 lines
2.3 KiB
JavaScript
/**
|
|
* Minified by jsDelivr using UglifyJS v3.4.4.
|
|
* Original file: /npm/vue-match-media@1.0.3/dist/index.js
|
|
*
|
|
* Do NOT use SRI with dynamically generated files! More information: https://www.jsdelivr.com/using-sri-with-dynamic-files
|
|
*/
|
|
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(require("vue")):"function"==typeof define&&define.amd?define(["vue"],t):t(e.Vue)}(this,function(e){"use strict";e=e&&e.hasOwnProperty("default")?e.default:e;var h="VUE-MATCH-MEDIA-MQ",l="VUE-MATCH-MEDIA-MQUERIES";e.use(function(d,e){Object.defineProperty(d.prototype,"$mq",{get:function(){return this[h]}}),d.mixin({beforeCreate:function(){var r=this,e=this.$options.mq&&this.$options.mq.config&&this.$options.mq.config.isolated,t=this===this.$root,o=this.$parent&&this.$parent[l],n=e||t||!o?[]:Object.keys(o);if(this.$options.mq){this[l]={};var i=new Set(n.concat(Object.keys(this.$options.mq).filter(function(e){return"config"!==e}))),a=Array.from(i).reduce(function(t,n){var e=r.$options.mq[n],i=e?window.matchMedia(e):o[n];return i.addListener(function(e){t[n]=e.matches}),t[n]=i.matches,r[l][n]=i,t},{});Object.defineProperty(a,"all",{enumerable:!0,configurable:!0,get:function(){var t=this;return Object.keys(this).filter(function(e){return"all"!==e}).filter(function(e){return t[e]})}}),d.util.defineReactive(this,h,a)}else o&&(this[l]=o,d.util.defineReactive(this,h,this.$parent[h]))}}),d.directive("onmedia",{bind:function(e,t,n){var i=t.value,r=t.expression,o=t.arg,a=t.modifiers,s=n.context,f=[].concat(function(e){if(Array.isArray(e)){for(var t=0,n=Array(e.length);t<e.length;t++)n[t]=e[t];return n}return Array.from(e)}(Object.keys(a))),u=!f.length||a.any,c=o;if(i instanceof Function){if(c){if(u)return void d.util.warn('Error binding v-onmedia: a ":not" argument was passed without any modifiers',s);if("not"!==c)return void d.util.warn('Error binding v-onmedia: unknown argument "'+o+'" was passed',s)}Object.keys(s[l]).filter(function(t){return u||f.find(function(e){return c?e!==t:e===t})}).forEach(function(n){s.$watch("$mq."+n,function(e,t){i.call(s,n,e)}),s[h][n]&&i.call(s,n,!0,!0)})}else d.util.warn('Error binding v-onmedia: expression "'+r+"\" doesn't resolve to\n a component method, so there's nothing to call back on change",s)}})})});
|
|
//# sourceMappingURL=/sm/d00acccaefc18d73b6972481820eb5a86dd8604fbc1c279067e434f4fa66d154.map
|