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

vue-agile-scrollbar

Package Overview
Dependencies
Maintainers
1
Versions
22
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

vue-agile-scrollbar - npm Package Compare versions

Comparing version 1.0.9 to 1.0.10

2

dist/vue-agile-scrollbar.es.js

@@ -180,3 +180,3 @@ var props = {

}
if (this.scrollContentHeight > this.scrollHeight) {
if (this.scrollContentHeight > this.$refs.scroll.parentNode.parentNode.offsetHeight) {
this.scrollbarStyles = {};

@@ -183,0 +183,0 @@ const height = this.scrollHeight - (this.scrollContentHeight - this.scrollHeight) - this.offsetTop - this.offsetBottom;

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

(function(c,a){typeof exports=="object"&&typeof module!="undefined"?module.exports=a():typeof define=="function"&&define.amd?define(a):(c=typeof globalThis!="undefined"?globalThis:c||self,c["vue-agile-scrollbar"]=a())})(this,function(){"use strict";var c={minBarSize:{type:Number,default:50},scrollTop:{type:[Number,Function],default:0},scrollLeft:{type:[Number,Function],default:0},offsetLeft:{type:Number,default:0},offsetRight:{type:Number,default:10},offsetTop:{type:Number,default:0},offsetBottom:{type:Number,default:10},offsetHit:{type:Number,default:10},isAutoUpdate:{type:Boolean,default:!0},dragSpeedX:{type:Number,default:1},dragSpeedY:{type:Number,default:1}},a=function(){var t=this,l=t.$createElement,s=t._self._c||l;return s("div",{staticClass:"vue-agile-scrollbar",class:{"not-user-select":t.scrollBarX.clientX||t.scrollBarY.clientY},style:t.scrollbarStyles},[s("div",{ref:"scroll",staticClass:"agile-scroll-content",on:{scroll:t.onScroll}},[s("div",{ref:"scrollContent",staticClass:"agile-scroll-wrapper"},[t._t("default")],2)]),t.scrollBarX.show?s("div",{staticClass:"agile-scroll-bar-x",class:{act:t.scrollBarX.clientX||t.scrollBarY.clientY},style:{left:t.scrollBarX.left+"px",width:t.scrollBarX.width+"px"},on:{mousedown:function(i){return t.scrollBarDown(i,"scrollBarX")}}}):t._e(),t.scrollBarY.show?s("div",{staticClass:"agile-scroll-bar-y",class:{act:t.scrollBarY.clientY||t.scrollBarX.clientX},style:{top:t.scrollBarY.top+"px",height:t.scrollBarY.height+"px"},on:{mousedown:function(i){return t.scrollBarDown(i,"scrollBarY")}}}):t._e()])},B=[],b="";function g(t,l,s,i,r,h,d,X){var e=typeof t=="function"?t.options:t;l&&(e.render=l,e.staticRenderFns=s,e._compiled=!0),i&&(e.functional=!0),h&&(e._scopeId="data-v-"+h);var n;if(d?(n=function(o){o=o||this.$vnode&&this.$vnode.ssrContext||this.parent&&this.parent.$vnode&&this.parent.$vnode.ssrContext,!o&&typeof __VUE_SSR_CONTEXT__!="undefined"&&(o=__VUE_SSR_CONTEXT__),r&&r.call(this,o),o&&o._registeredComponents&&o._registeredComponents.add(d)},e._ssrRegister=n):r&&(n=X?function(){r.call(this,(e.functional?this.parent:this).$root.$options.shadowRoot)}:r),n)if(e.functional){e._injectStyles=n;var Y=e.render;e.render=function(w,p){return n.call(p),Y(w,p)}}else{var u=e.beforeCreate;e.beforeCreate=u?[].concat(u,n):[n]}return{exports:t,options:e}}const m={props:c,data(){return{scrollBarY:{show:!0,clientY:null,height:0,top:this.offsetTop,multiple:1},scrollBarX:{show:!0,clientX:null,width:0,left:this.offsetLeft,multiple:1},scrollWidth:0,scrollHeight:0,scrollContentWidth:0,scrollContentHeight:0,scrollbarStyles:{}}},watch:{offsetLeft(){this.setScrollBarLeft()},offsetRight(){this.setScrollBarLeft()},offsetTop(){this.setScrollBarTop()},offsetBottom(){this.setScrollBarTop()}},mounted(){this.$scroll=this.$refs.scroll,this.$scrollContent=this.$refs.scrollContent,this.initContainer(),this.initScrollBar(),this.isAutoUpdate&&(this.observer=new MutationObserver(this.updated),this.observer.observe(this.$refs.scrollContent,{attributes:!0,childList:!0,subtree:!0})),this.addDragEvent()},methods:{initContainer(){this.scrollWidth=this.$scroll.offsetWidth,this.scrollHeight=this.$scroll.offsetHeight,this.scrollContentWidth=this.$scrollContent.offsetWidth,this.scrollContentHeight=this.$scrollContent.offsetHeight},initScrollBar(){if(this.scrollContentWidth>this.scrollWidth){const t=this.scrollWidth-(this.scrollContentWidth-this.scrollWidth)-this.offsetLeft-this.offsetRight;this.scrollBarX.show=!0,this.scrollBarX.width=t<this.minBarSize?this.minBarSize:t,this.scrollBarX.multiple=(this.scrollContentWidth-this.scrollWidth)/(this.scrollWidth-this.scrollBarX.width-this.offsetLeft-this.offsetRight)}else this.scrollBarX.show=!1;if(this.scrollContentHeight>this.scrollHeight){this.scrollbarStyles={};const t=this.scrollHeight-(this.scrollContentHeight-this.scrollHeight)-this.offsetTop-this.offsetBottom;this.scrollBarY.show=!0,this.scrollBarY.height=t<this.minBarSize?this.minBarSize:t,this.scrollBarY.multiple=(this.scrollContentHeight-this.scrollHeight)/(this.scrollHeight-this.scrollBarY.height-this.offsetTop-this.offsetBottom)}else this.scrollBarY.show=!1,this.scrollbarStyles={height:this.scrollContentHeight+"px"}},updated(){this.initContainer(),this.initScrollBar()},setScrollBarLeft(){const t=this.$scroll.scrollLeft,l=this.offsetLeft+Math.floor(t/this.scrollBarX.multiple);return l!==this.scrollBarX.left&&(this.scrollBarX.left=l),t},setScrollBarTop(){const t=this.$scroll.scrollTop,l=this.offsetTop+Math.floor(t/this.scrollBarY.multiple);return l!==this.scrollBarY.top&&(this.scrollBarY.top=l),t},onScroll(t){this.ticking||(window.requestAnimationFrame(()=>{const l=this.setScrollBarTop(),s=this.setScrollBarLeft();this.$emit("scroll",{top:l,left:s,scrollWidth:this.scrollWidth,scrollHeight:this.scrollHeight,scrollContentWidth:this.scrollContentWidth,scrollContentHeight:this.scrollContentHeight},t),this._events["scroll-hit"]&&this.onScrollHit(l,s),this.ticking=!1}),this.ticking=!0)},onScrollHit(t,l){let s="top",i=t-this.initTop,r=l-this.initLeft;this.initTop=t,this.initLeft=l;const h=()=>{this.$emit("scroll-hit",s,{top:t,left:l})};i!==0&&this.scrollBarY.height&&(i<0?s="top":s="bottom",this.scrollContentHeight-this.scrollHeight-t==0&&h(),t===0&&s==="top"&&h()),r!==0&&this.scrollBarX.width&&(r<0?s="left":s="right",l===0&&s==="left"&&h(),this.scrollContentWidth-this.scrollWidth-l==0&&h())},scrollBarDown(t,l){l==="scrollBarX"&&(this.scrollBarX.clientX=t.clientX,this.scrollBarX.scrollLeft=this.$scroll.scrollLeft),l==="scrollBarY"&&(this.scrollBarY.clientY=t.clientY,this.scrollBarY.scrollTop=this.$scroll.scrollTop),window.addEventListener("mousemove",this.scrollBarDrag)},scrollBarDrag(t){const l=this.scrollBarX.clientX,s=this.scrollBarY.clientY;if(l){let i=t.clientX-l;this.$scroll.scrollLeft=this.scrollBarX.scrollLeft+i*(this.scrollBarX.multiple*this.dragSpeedX)}if(s){let i=t.clientY-s;this.$scroll.scrollTop=this.scrollBarY.scrollTop+i*this.scrollBarY.multiple*this.dragSpeedY}},scrollBarUp(){this.scrollBarX.clientX=null,this.scrollBarY.clientY=null,window.removeEventListener("mousemove",this.scrollBarDrag)},addDragEvent(){window.addEventListener("mouseup",this.scrollBarUp)},removeDragEvent(){window.removeEventListener("mouseup",this.scrollBarUp)}},beforeDestroy(){this.isAutoUpdate&&this.observer&&this.observer.disconnect(),this.removeDragEvent()}},f={};var v=g(m,a,B,!1,_,null,null,null);function _(t){for(let l in f)this[l]=f[l]}var C=function(){return v.exports}();return C});
(function(c,a){typeof exports=="object"&&typeof module!="undefined"?module.exports=a():typeof define=="function"&&define.amd?define(a):(c=typeof globalThis!="undefined"?globalThis:c||self,c["vue-agile-scrollbar"]=a())})(this,function(){"use strict";var c={minBarSize:{type:Number,default:50},scrollTop:{type:[Number,Function],default:0},scrollLeft:{type:[Number,Function],default:0},offsetLeft:{type:Number,default:0},offsetRight:{type:Number,default:10},offsetTop:{type:Number,default:0},offsetBottom:{type:Number,default:10},offsetHit:{type:Number,default:10},isAutoUpdate:{type:Boolean,default:!0},dragSpeedX:{type:Number,default:1},dragSpeedY:{type:Number,default:1}},a=function(){var t=this,l=t.$createElement,s=t._self._c||l;return s("div",{staticClass:"vue-agile-scrollbar",class:{"not-user-select":t.scrollBarX.clientX||t.scrollBarY.clientY},style:t.scrollbarStyles},[s("div",{ref:"scroll",staticClass:"agile-scroll-content",on:{scroll:t.onScroll}},[s("div",{ref:"scrollContent",staticClass:"agile-scroll-wrapper"},[t._t("default")],2)]),t.scrollBarX.show?s("div",{staticClass:"agile-scroll-bar-x",class:{act:t.scrollBarX.clientX||t.scrollBarY.clientY},style:{left:t.scrollBarX.left+"px",width:t.scrollBarX.width+"px"},on:{mousedown:function(i){return t.scrollBarDown(i,"scrollBarX")}}}):t._e(),t.scrollBarY.show?s("div",{staticClass:"agile-scroll-bar-y",class:{act:t.scrollBarY.clientY||t.scrollBarX.clientX},style:{top:t.scrollBarY.top+"px",height:t.scrollBarY.height+"px"},on:{mousedown:function(i){return t.scrollBarDown(i,"scrollBarY")}}}):t._e()])},B=[],b="";function g(t,l,s,i,r,h,d,X){var e=typeof t=="function"?t.options:t;l&&(e.render=l,e.staticRenderFns=s,e._compiled=!0),i&&(e.functional=!0),h&&(e._scopeId="data-v-"+h);var n;if(d?(n=function(o){o=o||this.$vnode&&this.$vnode.ssrContext||this.parent&&this.parent.$vnode&&this.parent.$vnode.ssrContext,!o&&typeof __VUE_SSR_CONTEXT__!="undefined"&&(o=__VUE_SSR_CONTEXT__),r&&r.call(this,o),o&&o._registeredComponents&&o._registeredComponents.add(d)},e._ssrRegister=n):r&&(n=X?function(){r.call(this,(e.functional?this.parent:this).$root.$options.shadowRoot)}:r),n)if(e.functional){e._injectStyles=n;var Y=e.render;e.render=function(w,p){return n.call(p),Y(w,p)}}else{var u=e.beforeCreate;e.beforeCreate=u?[].concat(u,n):[n]}return{exports:t,options:e}}const m={props:c,data(){return{scrollBarY:{show:!0,clientY:null,height:0,top:this.offsetTop,multiple:1},scrollBarX:{show:!0,clientX:null,width:0,left:this.offsetLeft,multiple:1},scrollWidth:0,scrollHeight:0,scrollContentWidth:0,scrollContentHeight:0,scrollbarStyles:{}}},watch:{offsetLeft(){this.setScrollBarLeft()},offsetRight(){this.setScrollBarLeft()},offsetTop(){this.setScrollBarTop()},offsetBottom(){this.setScrollBarTop()}},mounted(){this.$scroll=this.$refs.scroll,this.$scrollContent=this.$refs.scrollContent,this.initContainer(),this.initScrollBar(),this.isAutoUpdate&&(this.observer=new MutationObserver(this.updated),this.observer.observe(this.$refs.scrollContent,{attributes:!0,childList:!0,subtree:!0})),this.addDragEvent()},methods:{initContainer(){this.scrollWidth=this.$scroll.offsetWidth,this.scrollHeight=this.$scroll.offsetHeight,this.scrollContentWidth=this.$scrollContent.offsetWidth,this.scrollContentHeight=this.$scrollContent.offsetHeight},initScrollBar(){if(this.scrollContentWidth>this.scrollWidth){const t=this.scrollWidth-(this.scrollContentWidth-this.scrollWidth)-this.offsetLeft-this.offsetRight;this.scrollBarX.show=!0,this.scrollBarX.width=t<this.minBarSize?this.minBarSize:t,this.scrollBarX.multiple=(this.scrollContentWidth-this.scrollWidth)/(this.scrollWidth-this.scrollBarX.width-this.offsetLeft-this.offsetRight)}else this.scrollBarX.show=!1;if(this.scrollContentHeight>this.$refs.scroll.parentNode.parentNode.offsetHeight){this.scrollbarStyles={};const t=this.scrollHeight-(this.scrollContentHeight-this.scrollHeight)-this.offsetTop-this.offsetBottom;this.scrollBarY.show=!0,this.scrollBarY.height=t<this.minBarSize?this.minBarSize:t,this.scrollBarY.multiple=(this.scrollContentHeight-this.scrollHeight)/(this.scrollHeight-this.scrollBarY.height-this.offsetTop-this.offsetBottom)}else this.scrollBarY.show=!1,this.scrollbarStyles={height:this.scrollContentHeight+"px"}},updated(){this.initContainer(),this.initScrollBar()},setScrollBarLeft(){const t=this.$scroll.scrollLeft,l=this.offsetLeft+Math.floor(t/this.scrollBarX.multiple);return l!==this.scrollBarX.left&&(this.scrollBarX.left=l),t},setScrollBarTop(){const t=this.$scroll.scrollTop,l=this.offsetTop+Math.floor(t/this.scrollBarY.multiple);return l!==this.scrollBarY.top&&(this.scrollBarY.top=l),t},onScroll(t){this.ticking||(window.requestAnimationFrame(()=>{const l=this.setScrollBarTop(),s=this.setScrollBarLeft();this.$emit("scroll",{top:l,left:s,scrollWidth:this.scrollWidth,scrollHeight:this.scrollHeight,scrollContentWidth:this.scrollContentWidth,scrollContentHeight:this.scrollContentHeight},t),this._events["scroll-hit"]&&this.onScrollHit(l,s),this.ticking=!1}),this.ticking=!0)},onScrollHit(t,l){let s="top",i=t-this.initTop,r=l-this.initLeft;this.initTop=t,this.initLeft=l;const h=()=>{this.$emit("scroll-hit",s,{top:t,left:l})};i!==0&&this.scrollBarY.height&&(i<0?s="top":s="bottom",this.scrollContentHeight-this.scrollHeight-t==0&&h(),t===0&&s==="top"&&h()),r!==0&&this.scrollBarX.width&&(r<0?s="left":s="right",l===0&&s==="left"&&h(),this.scrollContentWidth-this.scrollWidth-l==0&&h())},scrollBarDown(t,l){l==="scrollBarX"&&(this.scrollBarX.clientX=t.clientX,this.scrollBarX.scrollLeft=this.$scroll.scrollLeft),l==="scrollBarY"&&(this.scrollBarY.clientY=t.clientY,this.scrollBarY.scrollTop=this.$scroll.scrollTop),window.addEventListener("mousemove",this.scrollBarDrag)},scrollBarDrag(t){const l=this.scrollBarX.clientX,s=this.scrollBarY.clientY;if(l){let i=t.clientX-l;this.$scroll.scrollLeft=this.scrollBarX.scrollLeft+i*(this.scrollBarX.multiple*this.dragSpeedX)}if(s){let i=t.clientY-s;this.$scroll.scrollTop=this.scrollBarY.scrollTop+i*this.scrollBarY.multiple*this.dragSpeedY}},scrollBarUp(){this.scrollBarX.clientX=null,this.scrollBarY.clientY=null,window.removeEventListener("mousemove",this.scrollBarDrag)},addDragEvent(){window.addEventListener("mouseup",this.scrollBarUp)},removeDragEvent(){window.removeEventListener("mouseup",this.scrollBarUp)}},beforeDestroy(){this.isAutoUpdate&&this.observer&&this.observer.disconnect(),this.removeDragEvent()}},f={};var v=g(m,a,B,!1,_,null,null,null);function _(t){for(let l in f)this[l]=f[l]}var C=function(){return v.exports}();return C});
{
"name": "vue-agile-scrollbar",
"version": "1.0.9",
"version": "1.0.10",
"description": "Custom agile scroll bar",

@@ -5,0 +5,0 @@ "author": {

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