Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

vue-screen

Package Overview
Dependencies
Maintainers
1
Versions
40
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

vue-screen - npm Package Compare versions

Comparing version 1.4.3 to 1.4.4

6

dist/vue-screen.cjs.js

@@ -110,6 +110,6 @@ 'use strict';

xs: 0,
sm: 576,
sm: 640,
md: 768,
lg: 992,
xl: 1200
lg: 1024,
xl: 1280
};

@@ -116,0 +116,0 @@

@@ -108,6 +108,6 @@ function _typeof(obj) {

xs: 0,
sm: 576,
sm: 640,
md: 768,
lg: 992,
xl: 1200
lg: 1024,
xl: 1280
};

@@ -114,0 +114,0 @@

@@ -1,1 +0,1 @@

var VueScreen=function(){"use strict";function t(e){return(t="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 i(e,t){for(var n=0;n<t.length;n++){var i=t[n];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(e,i.key,i)}}function r(e){var t=e.split("."),n=parseInt(t[0],10);return{major:"number"==typeof n?n:1,minor:parseInt(t[1],10)||0,patch:parseInt(t[2],10)||0}}var a,o="undefined"!=typeof window,e={bootstrap:{xs:0,sm:576,md:768,lg:992,xl:1200},bulma:{mobile:0,tablet:769,desktop:1024,widescreen:1216,fullhd:1408},foundation:{small:0,medium:640,large:1024},materialize:{s:0,m:601,l:993,xl:1201},"semantic-ui":{mobile:0,tablet:768,computer:992,large:1201},tailwind:{xs:0,sm:576,md:768,lg:992,xl:1200}},s="2.6.0",c=["width","height","touch","portrait","landscape"],u={bootstrap:["xs","sm","md","lg","xl"],bulma:["mobile","tablet","desktop","widescreen","fullhd"],foundation:["small","medium","large"],materialize:["s","m","l","xl"],"semantic-ui":["mobile","tablet","computer","large"],tailwind:["xs","sm","md","lg","xl"]},n=function(){function n(){var e=0<arguments.length&&void 0!==arguments[0]?arguments[0]:"";!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,n),this.callbacks={},this.framework="",this.customBreakpointFn=!1,this.createScreen(n.parseBreakpoints(e)),this.init()}return function(e,t,n){t&&i(e.prototype,t),n&&i(e,n)}(n,[{key:"init",value:function(){this.attachResize(),this.setScreenSize(),this.checkTouch()}},{key:"attachResize",value:function(){o&&window.addEventListener("resize",function(n,i){var r;return function(){var e=this,t=arguments;clearTimeout(r),r=setTimeout(function(){r=null,n.apply(e,t)},i)}}(this.setScreenSize.bind(this),100))}},{key:"setScreenSize",value:function(){o&&(this.screen.width=window.innerWidth,this.screen.height=window.innerHeight,this.runCallbacks(),this.findCurrentBreakpoint())}},{key:"runCallbacks",value:function(){var t=this;Object.keys(this.callbacks).forEach(function(e){t.screen[e]=t.callbacks[e].call(null,t.screen)})}},{key:"findCurrentBreakpoint",value:function(){var n=this;this.customBreakpointFn||(this.screen.breakpoint=this.screen.breakpointsOrder.reduce(function(e,t){return n.screen[t]?t:e},this.screen.breakpointsOrder[0]))}},{key:"checkTouch",value:function(){o&&(this.screen.touch="ontouchstart"in window)}},{key:"createScreen",value:function(e){var t=this,n=Object.keys(e),i=u[this.framework]||n;this.screen=a.observable({width:410,height:730,touch:!0,portrait:!0,landscape:!1,breakpointsOrder:i,breakpoint:i[0]}),n.includes("breakpoint")&&(this.customBreakpointFn=!0),this.findCurrentBreakpoint(),n.forEach(function(e){if(0<=c.indexOf(e))throw new Error('Invalid breakpoint name: "'.concat(e,'". This key is reserved.'));a.set(t.screen,e,!1)}),o&&this.initMediaQueries(e)}},{key:"initMediaQueries",value:function(r){var a=this;Object.keys(r).forEach(function(t){var e=r[t],n=null;if("function"==typeof e?a.callbacks[t]=e:"number"==typeof e?n="".concat(e,"px"):"string"==typeof e?n=e:a.screen[t]=e,n){var i=window.matchMedia("(min-width: ".concat(n,")"));i.addListener(function(e){return a.mediaStateChanged(t,e.matches)}),a.mediaStateChanged(t,i.matches)}});var e=window.matchMedia("(orientation: portrait)");e.addListener(function(e){a.mediaStateChanged("portrait",e.matches),a.mediaStateChanged("landscape",!e.matches)}),this.mediaStateChanged("portrait",e.matches),this.mediaStateChanged("landscape",!e.matches)}},{key:"mediaStateChanged",value:function(e,t){a.set(this.screen,e,t)}}],[{key:"parseBreakpoints",value:function(e){return"object"===t(e)?e.extend?(this.framework=e.extend.toString(),delete e.extend,Object.assign({},e,n.getBreakpoints())):(this.framework="__CUSTOM__",e):(this.framework=e.toString(),n.getBreakpoints())}},{key:"getBreakpoints",value:function(){if(this.framework||(this.framework="tailwind"),!e[this.framework])throw new Error('Cannot find grid breakpoints for framework "'.concat(this.framework,'"'));return e[this.framework]}},{key:"install",value:function(e,t){if(!function(e,t){var n=r(e),i=r(t);return n.major>i.major||n.major===i.major&&n.minor>i.minor||n.major===i.major&&n.minor===i.minor&&n.patch>=i.patch}((a=e).version,s))throw Error("VueScreen requires at least Vue ".concat(s));a.prototype.$screen=new n(t).screen}}]),n}();return o&&window.Vue&&window.Vue.use(n),n}();
var VueScreen=function(){"use strict";function t(e){return(t="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 i(e,t){for(var n=0;n<t.length;n++){var i=t[n];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(e,i.key,i)}}function r(e){var t=e.split("."),n=parseInt(t[0],10);return{major:"number"==typeof n?n:1,minor:parseInt(t[1],10)||0,patch:parseInt(t[2],10)||0}}var a,o="undefined"!=typeof window,e={bootstrap:{xs:0,sm:576,md:768,lg:992,xl:1200},bulma:{mobile:0,tablet:769,desktop:1024,widescreen:1216,fullhd:1408},foundation:{small:0,medium:640,large:1024},materialize:{s:0,m:601,l:993,xl:1201},"semantic-ui":{mobile:0,tablet:768,computer:992,large:1201},tailwind:{xs:0,sm:640,md:768,lg:1024,xl:1280}},s="2.6.0",c=["width","height","touch","portrait","landscape"],u={bootstrap:["xs","sm","md","lg","xl"],bulma:["mobile","tablet","desktop","widescreen","fullhd"],foundation:["small","medium","large"],materialize:["s","m","l","xl"],"semantic-ui":["mobile","tablet","computer","large"],tailwind:["xs","sm","md","lg","xl"]},n=function(){function n(){var e=0<arguments.length&&void 0!==arguments[0]?arguments[0]:"";!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,n),this.callbacks={},this.framework="",this.customBreakpointFn=!1,this.createScreen(n.parseBreakpoints(e)),this.init()}return function(e,t,n){t&&i(e.prototype,t),n&&i(e,n)}(n,[{key:"init",value:function(){this.attachResize(),this.setScreenSize(),this.checkTouch()}},{key:"attachResize",value:function(){o&&window.addEventListener("resize",function(n,i){var r;return function(){var e=this,t=arguments;clearTimeout(r),r=setTimeout(function(){r=null,n.apply(e,t)},i)}}(this.setScreenSize.bind(this),100))}},{key:"setScreenSize",value:function(){o&&(this.screen.width=window.innerWidth,this.screen.height=window.innerHeight,this.runCallbacks(),this.findCurrentBreakpoint())}},{key:"runCallbacks",value:function(){var t=this;Object.keys(this.callbacks).forEach(function(e){t.screen[e]=t.callbacks[e].call(null,t.screen)})}},{key:"findCurrentBreakpoint",value:function(){var n=this;this.customBreakpointFn||(this.screen.breakpoint=this.screen.breakpointsOrder.reduce(function(e,t){return n.screen[t]?t:e},this.screen.breakpointsOrder[0]))}},{key:"checkTouch",value:function(){o&&(this.screen.touch="ontouchstart"in window)}},{key:"createScreen",value:function(e){var t=this,n=Object.keys(e),i=u[this.framework]||n;this.screen=a.observable({width:410,height:730,touch:!0,portrait:!0,landscape:!1,breakpointsOrder:i,breakpoint:i[0]}),n.includes("breakpoint")&&(this.customBreakpointFn=!0),this.findCurrentBreakpoint(),n.forEach(function(e){if(0<=c.indexOf(e))throw new Error('Invalid breakpoint name: "'.concat(e,'". This key is reserved.'));a.set(t.screen,e,!1)}),o&&this.initMediaQueries(e)}},{key:"initMediaQueries",value:function(r){var a=this;Object.keys(r).forEach(function(t){var e=r[t],n=null;if("function"==typeof e?a.callbacks[t]=e:"number"==typeof e?n="".concat(e,"px"):"string"==typeof e?n=e:a.screen[t]=e,n){var i=window.matchMedia("(min-width: ".concat(n,")"));i.addListener(function(e){return a.mediaStateChanged(t,e.matches)}),a.mediaStateChanged(t,i.matches)}});var e=window.matchMedia("(orientation: portrait)");e.addListener(function(e){a.mediaStateChanged("portrait",e.matches),a.mediaStateChanged("landscape",!e.matches)}),this.mediaStateChanged("portrait",e.matches),this.mediaStateChanged("landscape",!e.matches)}},{key:"mediaStateChanged",value:function(e,t){a.set(this.screen,e,t)}}],[{key:"parseBreakpoints",value:function(e){return"object"===t(e)?e.extend?(this.framework=e.extend.toString(),delete e.extend,Object.assign({},e,n.getBreakpoints())):(this.framework="__CUSTOM__",e):(this.framework=e.toString(),n.getBreakpoints())}},{key:"getBreakpoints",value:function(){if(this.framework||(this.framework="tailwind"),!e[this.framework])throw new Error('Cannot find grid breakpoints for framework "'.concat(this.framework,'"'));return e[this.framework]}},{key:"install",value:function(e,t){if(!function(e,t){var n=r(e),i=r(t);return n.major>i.major||n.major===i.major&&n.minor>i.minor||n.major===i.major&&n.minor===i.minor&&n.patch>=i.patch}((a=e).version,s))throw Error("VueScreen requires at least Vue ".concat(s));a.prototype.$screen=new n(t).screen}}]),n}();return o&&window.Vue&&window.Vue.use(n),n}();
{
"name": "vue-screen",
"version": "1.4.3",
"version": "1.4.4",
"description": "Reactive window size and media query states for Vue components. Integrates with most UI frameworks.",

@@ -5,0 +5,0 @@ "keywords": [

[![npm version](https://badge.fury.io/js/vue-screen.svg)](https://badge.fury.io/js/vue-screen)
[![Build Status](https://travis-ci.org/matteo-rigon/vue-screen.svg?branch=master)](https://travis-ci.org/matteo-rigon/vue-screen)
[![Build Status](https://travis-ci.org/reegodev/vue-screen.svg?branch=master)](https://travis-ci.org/matteo-rigon/vue-screen)
[![Build Status](https://img.shields.io/badge/vue-2.6.x-brightgreen.svg)](https://img.shields.io/badge/vue-2.x-brightgreen.svg)

@@ -4,0 +4,0 @@

@@ -5,4 +5,4 @@ export default {

md: 768,
lg: 992,
xl: 1200,
lg: 1024,
xl: 1280,
};
SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc