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.5.1 to 1.5.2

12

dist/vue-screen.cjs.js

@@ -305,3 +305,5 @@ 'use strict';

var breakpointKeys = Object.keys(this.config);
var breakpointKeys = Object.keys(this.config).filter(function (key) {
return key !== 'breakpointsOrder';
});
this.screen = Vue.observable({

@@ -339,3 +341,5 @@ width: DEFAULT_WIDTH,

Object.keys(this.config).forEach(function (name) {
Object.keys(this.config).filter(function (key) {
return key !== 'breakpointsOrder';
}).forEach(function (name) {
var w = null;

@@ -408,3 +412,5 @@

return _objectSpread2({
breakpointsOrder: Object.keys(breakpoints)
breakpointsOrder: Object.keys(breakpoints).filter(function (key) {
return key !== 'breakpointsOrder';
})
}, breakpoints);

@@ -411,0 +417,0 @@ }

@@ -303,3 +303,5 @@ function _typeof(obj) {

var breakpointKeys = Object.keys(this.config);
var breakpointKeys = Object.keys(this.config).filter(function (key) {
return key !== 'breakpointsOrder';
});
this.screen = Vue.observable({

@@ -337,3 +339,5 @@ width: DEFAULT_WIDTH,

Object.keys(this.config).forEach(function (name) {
Object.keys(this.config).filter(function (key) {
return key !== 'breakpointsOrder';
}).forEach(function (name) {
var w = null;

@@ -406,3 +410,5 @@

return _objectSpread2({
breakpointsOrder: Object.keys(breakpoints)
breakpointsOrder: Object.keys(breakpoints).filter(function (key) {
return key !== 'breakpointsOrder';
})
}, breakpoints);

@@ -409,0 +415,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 r(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}function n(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e&&(r=r.filter(function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable})),n.push.apply(n,r)}return n}function i(i){for(var e=1;e<arguments.length;e++){var a=null!=arguments[e]?arguments[e]:{};e%2?n(a,!0).forEach(function(e){var t,n,r;t=i,r=a[n=e],n in t?Object.defineProperty(t,n,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[n]=r}):Object.getOwnPropertyDescriptors?Object.defineProperties(i,Object.getOwnPropertyDescriptors(a)):n(a).forEach(function(e){Object.defineProperty(i,e,Object.getOwnPropertyDescriptor(a,e))})}return i}function a(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 o,c="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,"2xl":1536}},s="2.6.0",u=["width","height","touch","portrait","landscape","config"],l={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"]},f=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.config=n.parseBreakpoints(e),this.createScreen(),this.init()}return function(e,t,n){t&&r(e.prototype,t),n&&r(e,n)}(n,[{key:"init",value:function(){this.attachResize(),this.setScreenSize(),this.checkTouch()}},{key:"attachResize",value:function(){c&&window.addEventListener("resize",function(n,r){var i;return function(){var e=this,t=arguments;clearTimeout(i),i=setTimeout(function(){i=null,n.apply(e,t)},r)}}(this.setScreenSize.bind(this),100))}},{key:"setScreenSize",value:function(){c&&(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.screen.breakpoint=this.config.breakpointsOrder.reduce(function(e,t){return n.screen[t]?t:e},this.config.breakpointsOrder[0])}},{key:"checkTouch",value:function(){c&&(this.screen.touch="ontouchstart"in window)}},{key:"createScreen",value:function(){var t=this,e=Object.keys(this.config);this.screen=o.observable({width:410,height:730,touch:!0,portrait:!0,landscape:!1,breakpoint:this.config.breakpointsOrder[0],breakpointsOrder:this.config.breakpointsOrder,config:this.config}),this.findCurrentBreakpoint(),e.forEach(function(e){if(0<=u.indexOf(e))throw new Error('Invalid breakpoint name: "'.concat(e,'". This key is reserved.'));o.set(t.screen,e,!1)}),c&&this.initMediaQueries()}},{key:"initMediaQueries",value:function(){var i=this;Object.keys(this.config).forEach(function(t){var e=null;if("breakpointsOrder"!==t){var n=i.config[t];"function"==typeof n?i.callbacks[t]=n:"number"==typeof n?e="".concat(n,"px"):"string"==typeof n?e=n:i.screen[t]=n}if(e){var r=window.matchMedia("(min-width: ".concat(e,")"));r.addEventListener("change",function(e){return i.mediaStateChanged(t,e.matches)}),i.mediaStateChanged(t,r.matches)}});var e=window.matchMedia("(orientation: portrait)");e.addEventListener("change",function(e){i.mediaStateChanged("portrait",e.matches),i.mediaStateChanged("landscape",!e.matches)}),this.mediaStateChanged("portrait",e.matches),this.mediaStateChanged("landscape",!e.matches)}},{key:"mediaStateChanged",value:function(e,t){o.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__",i({breakpointsOrder:Object.keys(e)},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 i({},e[this.framework],{breakpointsOrder:l[this.framework]})}},{key:"install",value:function(e,t){if(!function(e,t){var n=a(e),r=a(t);return n.major>r.major||n.major===r.major&&n.minor>r.minor||n.major===r.major&&n.minor===r.minor&&n.patch>=r.patch}((o=e).version,s))throw Error("VueScreen requires at least Vue ".concat(s));o.prototype.$screen=new n(t).screen}}]),n}();return c&&window.Vue&&window.Vue.use(f),f}();
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 n(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}function r(t,e){var r=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);e&&(n=n.filter(function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable})),r.push.apply(r,n)}return r}function i(i){for(var e=1;e<arguments.length;e++){var a=null!=arguments[e]?arguments[e]:{};e%2?r(a,!0).forEach(function(e){var t,r,n;t=i,n=a[r=e],r in t?Object.defineProperty(t,r,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[r]=n}):Object.getOwnPropertyDescriptors?Object.defineProperties(i,Object.getOwnPropertyDescriptors(a)):r(a).forEach(function(e){Object.defineProperty(i,e,Object.getOwnPropertyDescriptor(a,e))})}return i}function a(e){var t=e.split("."),r=parseInt(t[0],10);return{major:"number"==typeof r?r:1,minor:parseInt(t[1],10)||0,patch:parseInt(t[2],10)||0}}var o,c="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,"2xl":1536}},s="2.6.0",u=["width","height","touch","portrait","landscape","config"],l={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"]},f=function(){function r(){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,r),this.callbacks={},this.framework="",this.config=r.parseBreakpoints(e),this.createScreen(),this.init()}return function(e,t,r){t&&n(e.prototype,t),r&&n(e,r)}(r,[{key:"init",value:function(){this.attachResize(),this.setScreenSize(),this.checkTouch()}},{key:"attachResize",value:function(){c&&window.addEventListener("resize",function(r,n){var i;return function(){var e=this,t=arguments;clearTimeout(i),i=setTimeout(function(){i=null,r.apply(e,t)},n)}}(this.setScreenSize.bind(this),100))}},{key:"setScreenSize",value:function(){c&&(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 r=this;this.screen.breakpoint=this.config.breakpointsOrder.reduce(function(e,t){return r.screen[t]?t:e},this.config.breakpointsOrder[0])}},{key:"checkTouch",value:function(){c&&(this.screen.touch="ontouchstart"in window)}},{key:"createScreen",value:function(){var t=this,e=Object.keys(this.config).filter(function(e){return"breakpointsOrder"!==e});this.screen=o.observable({width:410,height:730,touch:!0,portrait:!0,landscape:!1,breakpoint:this.config.breakpointsOrder[0],breakpointsOrder:this.config.breakpointsOrder,config:this.config}),this.findCurrentBreakpoint(),e.forEach(function(e){if(0<=u.indexOf(e))throw new Error('Invalid breakpoint name: "'.concat(e,'". This key is reserved.'));o.set(t.screen,e,!1)}),c&&this.initMediaQueries()}},{key:"initMediaQueries",value:function(){var i=this;Object.keys(this.config).filter(function(e){return"breakpointsOrder"!==e}).forEach(function(t){var e=null;if("breakpointsOrder"!==t){var r=i.config[t];"function"==typeof r?i.callbacks[t]=r:"number"==typeof r?e="".concat(r,"px"):"string"==typeof r?e=r:i.screen[t]=r}if(e){var n=window.matchMedia("(min-width: ".concat(e,")"));n.addEventListener("change",function(e){return i.mediaStateChanged(t,e.matches)}),i.mediaStateChanged(t,n.matches)}});var e=window.matchMedia("(orientation: portrait)");e.addEventListener("change",function(e){i.mediaStateChanged("portrait",e.matches),i.mediaStateChanged("landscape",!e.matches)}),this.mediaStateChanged("portrait",e.matches),this.mediaStateChanged("landscape",!e.matches)}},{key:"mediaStateChanged",value:function(e,t){o.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,r.getBreakpoints())):(this.framework="__CUSTOM__",i({breakpointsOrder:Object.keys(e).filter(function(e){return"breakpointsOrder"!==e})},e)):(this.framework=e.toString(),r.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 i({},e[this.framework],{breakpointsOrder:l[this.framework]})}},{key:"install",value:function(e,t){if(!function(e,t){var r=a(e),n=a(t);return r.major>n.major||r.major===n.major&&r.minor>n.minor||r.major===n.major&&r.minor===n.minor&&r.patch>=n.patch}((o=e).version,s))throw Error("VueScreen requires at least Vue ".concat(s));o.prototype.$screen=new r(t).screen}}]),r}();return c&&window.Vue&&window.Vue.use(f),f}();
{
"name": "vue-screen",
"version": "1.5.1",
"version": "1.5.2",
"description": "Reactive window size and media query states for Vue components. Integrates with most UI frameworks.",

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

@@ -73,3 +73,3 @@ import { debounce, inBrowser, checkVersion } from './utils';

return {
breakpointsOrder: Object.keys(breakpoints),
breakpointsOrder: Object.keys(breakpoints).filter(key => key !== 'breakpointsOrder'),
...breakpoints

@@ -178,3 +178,3 @@ };

createScreen() {
const breakpointKeys = Object.keys(this.config);
const breakpointKeys = Object.keys(this.config).filter(key => key !== 'breakpointsOrder');

@@ -211,3 +211,3 @@ this.screen = Vue.observable({

initMediaQueries() {
Object.keys(this.config).forEach((name) => {
Object.keys(this.config).filter(key => key !== 'breakpointsOrder').forEach((name) => {
let w = null;

@@ -214,0 +214,0 @@ if (name !== 'breakpointsOrder') {

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