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

vue-resize

Package Overview
Dependencies
Maintainers
1
Versions
20
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

vue-resize - npm Package Compare versions

Comparing version 1.0.0 to 1.0.1

3

babel.config.js

@@ -5,2 +5,5 @@ module.exports = {

],
plugins: [
[require('@babel/plugin-transform-runtime')],
],
}

@@ -37,2 +37,4 @@ import { babel } from '@rollup/plugin-babel'

exclude: 'node_modules/**',
babelHelpers: 'runtime',
extensions: ['.js', '.jsx', '.es6', '.es', '.mjs', '.vue'],
}),

@@ -42,2 +44,3 @@ cjs(),

VERSION: JSON.stringify(config.version),
preventAssignment: false,
}),

@@ -44,0 +47,0 @@ ],

@@ -13,2 +13,3 @@ import base from './rollup.config.base'

// Additional externals here
/@babel\/runtime/,
],

@@ -15,0 +16,0 @@ })

124

dist/vue-resize.esm.js

@@ -30,6 +30,5 @@ function getInternetExplorerVersion() {

//
var isIE;
let isIE;
function initCompat () {
function initCompat() {
if (!initCompat.init) {

@@ -43,30 +42,29 @@ initCompat.init = true;

name: 'ResizeObserver',
props: {
emitOnMount: {
type: Boolean,
default: false,
default: false
},
ignoreWidth: {
type: Boolean,
default: false,
default: false
},
ignoreHeight: {
type: Boolean,
default: false,
},
default: false
}
},
mounted: function mounted() {
var _this = this;
mounted () {
initCompat();
this.$nextTick(() => {
this._w = this.$el.offsetWidth;
this._h = this.$el.offsetHeight;
if (this.emitOnMount) {
this.emitSize();
this.$nextTick(function () {
_this._w = _this.$el.offsetWidth;
_this._h = _this.$el.offsetHeight;
if (_this.emitOnMount) {
_this.emitSize();
}
});
const object = document.createElement('object');
var object = document.createElement('object');
this._resizeObject = object;

@@ -77,6 +75,9 @@ object.setAttribute('aria-hidden', 'true');

object.type = 'text/html';
if (isIE) {
this.$el.appendChild(object);
}
object.data = 'about:blank';
if (!isIE) {

@@ -86,10 +87,8 @@ this.$el.appendChild(object);

},
beforeDestroy () {
beforeDestroy: function beforeDestroy() {
this.removeResizeHandlers();
},
methods: {
compareAndNotify () {
if ((!this.ignoreWidth && this._w !== this.$el.offsetWidth) || (!this.ignoreHeight && this._h !== this.$el.offsetHeight)) {
compareAndNotify: function compareAndNotify() {
if (!this.ignoreWidth && this._w !== this.$el.offsetWidth || !this.ignoreHeight && this._h !== this.$el.offsetHeight) {
this._w = this.$el.offsetWidth;

@@ -100,16 +99,14 @@ this._h = this.$el.offsetHeight;

},
emitSize () {
emitSize: function emitSize() {
this.$emit('notify', {
width: this._w,
height: this._h,
height: this._h
});
},
addResizeHandlers: function addResizeHandlers() {
this._resizeObject.contentDocument.defaultView.addEventListener('resize', this.compareAndNotify);
addResizeHandlers () {
this._resizeObject.contentDocument.defaultView.addEventListener('resize', this.compareAndNotify);
this.compareAndNotify();
},
removeResizeHandlers () {
removeResizeHandlers: function removeResizeHandlers() {
if (this._resizeObject && this._resizeObject.onload) {

@@ -119,2 +116,3 @@ if (!isIE && this._resizeObject.contentDocument) {

}
this.$el.removeChild(this._resizeObject);

@@ -124,4 +122,4 @@ this._resizeObject.onload = null;

}
},
},
}
}
};

@@ -213,45 +211,45 @@

/* script */
const __vue_script__ = script;
var __vue_script__ = script;
/* template */
var __vue_render__ = function() {
var __vue_render__ = function __vue_render__() {
var _vm = this;
var _h = _vm.$createElement;
var _c = _vm._self._c || _h;
return _c("div", {
staticClass: "resize-observer",
attrs: { tabindex: "-1" }
})
attrs: {
tabindex: "-1"
}
});
};
var __vue_staticRenderFns__ = [];
__vue_render__._withStripped = true;
/* style */
/* style */
const __vue_inject_styles__ = undefined;
/* scoped */
const __vue_scope_id__ = "data-v-8859cc6c";
/* module identifier */
const __vue_module_identifier__ = undefined;
/* functional template */
const __vue_is_functional_template__ = false;
/* style inject */
/* style inject SSR */
/* style inject shadow dom */
var __vue_inject_styles__ = undefined;
/* scoped */
const __vue_component__ = /*#__PURE__*/normalizeComponent(
{ render: __vue_render__, staticRenderFns: __vue_staticRenderFns__ },
__vue_inject_styles__,
__vue_script__,
__vue_scope_id__,
__vue_is_functional_template__,
__vue_module_identifier__,
false,
undefined,
undefined,
undefined
);
var __vue_scope_id__ = "data-v-8859cc6c";
/* module identifier */
var __vue_module_identifier__ = undefined;
/* functional template */
var __vue_is_functional_template__ = false;
/* style inject */
/* style inject SSR */
/* style inject shadow dom */
var __vue_component__ = /*#__PURE__*/normalizeComponent({
render: __vue_render__,
staticRenderFns: __vue_staticRenderFns__
}, __vue_inject_styles__, __vue_script__, __vue_scope_id__, __vue_is_functional_template__, __vue_module_identifier__, false, undefined, undefined, undefined);
function install(Vue) {

@@ -265,3 +263,3 @@ // eslint-disable-next-line vue/component-definition-name-casing

// eslint-disable-next-line no-undef
version: "1.0.0",
version: "1.0.1",
install: install

@@ -268,0 +266,0 @@ };

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

var VueResize=function(e){"use strict";let t;function i(){i.init||(i.init=!0,t=-1!==function(){var e=window.navigator.userAgent,t=e.indexOf("MSIE ");if(t>0)return parseInt(e.substring(t+5,e.indexOf(".",t)),10);if(e.indexOf("Trident/")>0){var i=e.indexOf("rv:");return parseInt(e.substring(i+3,e.indexOf(".",i)),10)}var n=e.indexOf("Edge/");return n>0?parseInt(e.substring(n+5,e.indexOf(".",n)),10):-1}())}function n(e,t,i,n,s,r,o,d,a,h){"boolean"!=typeof o&&(a=d,d=o,o=!1);var l,c="function"==typeof i?i.options:i;if(e&&e.render&&(c.render=e.render,c.staticRenderFns=e.staticRenderFns,c._compiled=!0,s&&(c.functional=!0)),n&&(c._scopeId=n),r?(l=function(e){(e=e||this.$vnode&&this.$vnode.ssrContext||this.parent&&this.parent.$vnode&&this.parent.$vnode.ssrContext)||"undefined"==typeof __VUE_SSR_CONTEXT__||(e=__VUE_SSR_CONTEXT__),t&&t.call(this,a(e)),e&&e._registeredComponents&&e._registeredComponents.add(r)},c._ssrRegister=l):t&&(l=o?function(e){t.call(this,h(e,this.$root.$options.shadowRoot))}:function(e){t.call(this,d(e))}),l)if(c.functional){var f=c.render;c.render=function(e,t){return l.call(t),f(e,t)}}else{var u=c.beforeCreate;c.beforeCreate=u?[].concat(u,l):[l]}return i}const s={name:"ResizeObserver",props:{emitOnMount:{type:Boolean,default:!1},ignoreWidth:{type:Boolean,default:!1},ignoreHeight:{type:Boolean,default:!1}},mounted(){i(),this.$nextTick(()=>{this._w=this.$el.offsetWidth,this._h=this.$el.offsetHeight,this.emitOnMount&&this.emitSize()});const e=document.createElement("object");this._resizeObject=e,e.setAttribute("aria-hidden","true"),e.setAttribute("tabindex",-1),e.onload=this.addResizeHandlers,e.type="text/html",t&&this.$el.appendChild(e),e.data="about:blank",t||this.$el.appendChild(e)},beforeDestroy(){this.removeResizeHandlers()},methods:{compareAndNotify(){(!this.ignoreWidth&&this._w!==this.$el.offsetWidth||!this.ignoreHeight&&this._h!==this.$el.offsetHeight)&&(this._w=this.$el.offsetWidth,this._h=this.$el.offsetHeight,this.emitSize())},emitSize(){this.$emit("notify",{width:this._w,height:this._h})},addResizeHandlers(){this._resizeObject.contentDocument.defaultView.addEventListener("resize",this.compareAndNotify),this.compareAndNotify()},removeResizeHandlers(){this._resizeObject&&this._resizeObject.onload&&(!t&&this._resizeObject.contentDocument&&this._resizeObject.contentDocument.defaultView.removeEventListener("resize",this.compareAndNotify),this.$el.removeChild(this._resizeObject),this._resizeObject.onload=null,this._resizeObject=null)}}};var r=function(){var e=this.$createElement;return(this._self._c||e)("div",{staticClass:"resize-observer",attrs:{tabindex:"-1"}})};r._withStripped=!0;const o=n({render:r,staticRenderFns:[]},void 0,s,"data-v-8859cc6c",!1,void 0,!1,void 0,void 0,void 0);function d(e){e.component("resize-observer",o),e.component("ResizeObserver",o)}var a={version:"1.0.0",install:d},h=null;return"undefined"!=typeof window?h=window.Vue:"undefined"!=typeof global&&(h=global.Vue),h&&h.use(a),e.ResizeObserver=o,e.default=a,e.install=d,Object.defineProperty(e,"__esModule",{value:!0}),e}({});
var VueResize=function(e){"use strict";var t;function i(){i.init||(i.init=!0,t=-1!==function(){var e=window.navigator.userAgent,t=e.indexOf("MSIE ");if(t>0)return parseInt(e.substring(t+5,e.indexOf(".",t)),10);if(e.indexOf("Trident/")>0){var i=e.indexOf("rv:");return parseInt(e.substring(i+3,e.indexOf(".",i)),10)}var n=e.indexOf("Edge/");return n>0?parseInt(e.substring(n+5,e.indexOf(".",n)),10):-1}())}function n(e,t,i,n,s,r,o,d,a,h){"boolean"!=typeof o&&(a=d,d=o,o=!1);var f,c="function"==typeof i?i.options:i;if(e&&e.render&&(c.render=e.render,c.staticRenderFns=e.staticRenderFns,c._compiled=!0,s&&(c.functional=!0)),n&&(c._scopeId=n),r?(f=function(e){(e=e||this.$vnode&&this.$vnode.ssrContext||this.parent&&this.parent.$vnode&&this.parent.$vnode.ssrContext)||"undefined"==typeof __VUE_SSR_CONTEXT__||(e=__VUE_SSR_CONTEXT__),t&&t.call(this,a(e)),e&&e._registeredComponents&&e._registeredComponents.add(r)},c._ssrRegister=f):t&&(f=o?function(e){t.call(this,h(e,this.$root.$options.shadowRoot))}:function(e){t.call(this,d(e))}),f)if(c.functional){var l=c.render;c.render=function(e,t){return f.call(t),l(e,t)}}else{var u=c.beforeCreate;c.beforeCreate=u?[].concat(u,f):[f]}return i}var s={name:"ResizeObserver",props:{emitOnMount:{type:Boolean,default:!1},ignoreWidth:{type:Boolean,default:!1},ignoreHeight:{type:Boolean,default:!1}},mounted:function(){var e=this;i(),this.$nextTick((function(){e._w=e.$el.offsetWidth,e._h=e.$el.offsetHeight,e.emitOnMount&&e.emitSize()}));var n=document.createElement("object");this._resizeObject=n,n.setAttribute("aria-hidden","true"),n.setAttribute("tabindex",-1),n.onload=this.addResizeHandlers,n.type="text/html",t&&this.$el.appendChild(n),n.data="about:blank",t||this.$el.appendChild(n)},beforeDestroy:function(){this.removeResizeHandlers()},methods:{compareAndNotify:function(){(!this.ignoreWidth&&this._w!==this.$el.offsetWidth||!this.ignoreHeight&&this._h!==this.$el.offsetHeight)&&(this._w=this.$el.offsetWidth,this._h=this.$el.offsetHeight,this.emitSize())},emitSize:function(){this.$emit("notify",{width:this._w,height:this._h})},addResizeHandlers:function(){this._resizeObject.contentDocument.defaultView.addEventListener("resize",this.compareAndNotify),this.compareAndNotify()},removeResizeHandlers:function(){this._resizeObject&&this._resizeObject.onload&&(!t&&this._resizeObject.contentDocument&&this._resizeObject.contentDocument.defaultView.removeEventListener("resize",this.compareAndNotify),this.$el.removeChild(this._resizeObject),this._resizeObject.onload=null,this._resizeObject=null)}}},r=function(){var e=this.$createElement;return(this._self._c||e)("div",{staticClass:"resize-observer",attrs:{tabindex:"-1"}})};r._withStripped=!0;var o=n({render:r,staticRenderFns:[]},void 0,s,"data-v-8859cc6c",!1,void 0,!1,void 0,void 0,void 0);function d(e){e.component("resize-observer",o),e.component("ResizeObserver",o)}var a={version:"1.0.1",install:d},h=null;return"undefined"!=typeof window?h=window.Vue:"undefined"!=typeof global&&(h=global.Vue),h&&h.use(a),e.ResizeObserver=o,e.default=a,e.install=d,Object.defineProperty(e,"__esModule",{value:!0}),e}({});
//# sourceMappingURL=vue-resize.min.js.map

@@ -36,6 +36,5 @@ (function (global, factory) {

//
var isIE;
let isIE;
function initCompat () {
function initCompat() {
if (!initCompat.init) {

@@ -49,30 +48,29 @@ initCompat.init = true;

name: 'ResizeObserver',
props: {
emitOnMount: {
type: Boolean,
default: false,
default: false
},
ignoreWidth: {
type: Boolean,
default: false,
default: false
},
ignoreHeight: {
type: Boolean,
default: false,
},
default: false
}
},
mounted: function mounted() {
var _this = this;
mounted () {
initCompat();
this.$nextTick(() => {
this._w = this.$el.offsetWidth;
this._h = this.$el.offsetHeight;
if (this.emitOnMount) {
this.emitSize();
this.$nextTick(function () {
_this._w = _this.$el.offsetWidth;
_this._h = _this.$el.offsetHeight;
if (_this.emitOnMount) {
_this.emitSize();
}
});
const object = document.createElement('object');
var object = document.createElement('object');
this._resizeObject = object;

@@ -83,6 +81,9 @@ object.setAttribute('aria-hidden', 'true');

object.type = 'text/html';
if (isIE) {
this.$el.appendChild(object);
}
object.data = 'about:blank';
if (!isIE) {

@@ -92,10 +93,8 @@ this.$el.appendChild(object);

},
beforeDestroy () {
beforeDestroy: function beforeDestroy() {
this.removeResizeHandlers();
},
methods: {
compareAndNotify () {
if ((!this.ignoreWidth && this._w !== this.$el.offsetWidth) || (!this.ignoreHeight && this._h !== this.$el.offsetHeight)) {
compareAndNotify: function compareAndNotify() {
if (!this.ignoreWidth && this._w !== this.$el.offsetWidth || !this.ignoreHeight && this._h !== this.$el.offsetHeight) {
this._w = this.$el.offsetWidth;

@@ -106,16 +105,14 @@ this._h = this.$el.offsetHeight;

},
emitSize () {
emitSize: function emitSize() {
this.$emit('notify', {
width: this._w,
height: this._h,
height: this._h
});
},
addResizeHandlers: function addResizeHandlers() {
this._resizeObject.contentDocument.defaultView.addEventListener('resize', this.compareAndNotify);
addResizeHandlers () {
this._resizeObject.contentDocument.defaultView.addEventListener('resize', this.compareAndNotify);
this.compareAndNotify();
},
removeResizeHandlers () {
removeResizeHandlers: function removeResizeHandlers() {
if (this._resizeObject && this._resizeObject.onload) {

@@ -125,2 +122,3 @@ if (!isIE && this._resizeObject.contentDocument) {

}
this.$el.removeChild(this._resizeObject);

@@ -130,4 +128,4 @@ this._resizeObject.onload = null;

}
},
},
}
}
};

@@ -219,45 +217,45 @@

/* script */
const __vue_script__ = script;
var __vue_script__ = script;
/* template */
var __vue_render__ = function() {
var __vue_render__ = function __vue_render__() {
var _vm = this;
var _h = _vm.$createElement;
var _c = _vm._self._c || _h;
return _c("div", {
staticClass: "resize-observer",
attrs: { tabindex: "-1" }
})
attrs: {
tabindex: "-1"
}
});
};
var __vue_staticRenderFns__ = [];
__vue_render__._withStripped = true;
/* style */
/* style */
const __vue_inject_styles__ = undefined;
/* scoped */
const __vue_scope_id__ = "data-v-8859cc6c";
/* module identifier */
const __vue_module_identifier__ = undefined;
/* functional template */
const __vue_is_functional_template__ = false;
/* style inject */
/* style inject SSR */
/* style inject shadow dom */
var __vue_inject_styles__ = undefined;
/* scoped */
const __vue_component__ = /*#__PURE__*/normalizeComponent(
{ render: __vue_render__, staticRenderFns: __vue_staticRenderFns__ },
__vue_inject_styles__,
__vue_script__,
__vue_scope_id__,
__vue_is_functional_template__,
__vue_module_identifier__,
false,
undefined,
undefined,
undefined
);
var __vue_scope_id__ = "data-v-8859cc6c";
/* module identifier */
var __vue_module_identifier__ = undefined;
/* functional template */
var __vue_is_functional_template__ = false;
/* style inject */
/* style inject SSR */
/* style inject shadow dom */
var __vue_component__ = /*#__PURE__*/normalizeComponent({
render: __vue_render__,
staticRenderFns: __vue_staticRenderFns__
}, __vue_inject_styles__, __vue_script__, __vue_scope_id__, __vue_is_functional_template__, __vue_module_identifier__, false, undefined, undefined, undefined);
function install(Vue) {

@@ -271,3 +269,3 @@ // eslint-disable-next-line vue/component-definition-name-casing

// eslint-disable-next-line no-undef
version: "1.0.0",
version: "1.0.1",
install: install

@@ -274,0 +272,0 @@ };

{
"name": "vue-resize",
"description": "Detects DOM element resizing",
"version": "1.0.0",
"version": "1.0.1",
"author": {

@@ -40,4 +40,8 @@ "name": "Guillaume Chau",

"homepage": "https://github.com/Akryum/vue-resize#readme",
"dependencies": {
"@babel/runtime": "^7.13.10"
},
"devDependencies": {
"@babel/core": "^7.9.0",
"@babel/plugin-transform-runtime": "^7.13.10",
"@babel/preset-env": "^7.9.0",

@@ -76,4 +80,4 @@ "@rollup/plugin-babel": "^5.2.2",

"last 2 versions",
"not ie <= 8"
"not ie <= 10"
]
}

@@ -8,3 +8,3 @@ # vue-resize

[Demo](https://akryum.github.io/vue-resize/) - [JSFiddle](https://jsfiddle.net/Akryum/zqygwf3r/)
[JSFiddle](https://jsfiddle.net/Akryum/zqygwf3r/)

@@ -11,0 +11,0 @@ <p>

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

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