v-scroll-lock
Advanced tools
Comparing version 1.1.1 to 1.2.0
@@ -1,5 +0,6 @@ | ||
import { disableBodyScroll, enableBodyScroll } from 'body-scroll-lock'; | ||
import { disableBodyScroll, enableBodyScroll, BodyScrollOptions } from 'body-scroll-lock'; | ||
export default interface PluginOptions { | ||
disableBodyScroll?: typeof disableBodyScroll; | ||
enableBodyScroll?: typeof enableBodyScroll; | ||
bodyScrollOptions?: Partial<BodyScrollOptions>; | ||
} |
import PluginOptions from './plugin-options.interface'; | ||
import { PluginFunction, DirectiveFunction } from 'vue'; | ||
import { enableBodyScroll, disableBodyScroll } from 'body-scroll-lock'; | ||
import { enableBodyScroll, disableBodyScroll, BodyScrollOptions } from 'body-scroll-lock'; | ||
export default interface VScrollLock { | ||
@@ -11,2 +11,3 @@ enableBodyScroll: typeof enableBodyScroll; | ||
unbind: DirectiveFunction; | ||
bodyScrollOptions?: Partial<BodyScrollOptions>; | ||
} |
@@ -1,1 +0,1 @@ | ||
var e=function(){},i={enableBodyScroll:e,disableBodyScroll:e,install:function(e,i){if(i){var n=i.enableBodyScroll,l=i.disableBodyScroll;n&&(this.enableBodyScroll=n),l&&(this.disableBodyScroll=l)}e.directive("scroll-lock",{inserted:this.inserted.bind(this),componentUpdated:this.componentUpdated.bind(this),unbind:this.unbind.bind(this)})},inserted:function(e,i){i.value&&this.disableBodyScroll(e)},componentUpdated:function(e,i){i.value?this.disableBodyScroll(e):this.enableBodyScroll(e)},unbind:function(e){this.enableBodyScroll(e)}};"undefined"!=typeof window&&window.Vue&&window.Vue.use(i);export default i; | ||
var o=function(){},i={enableBodyScroll:o,disableBodyScroll:o,install:function(o,i){if(i){var l=i.enableBodyScroll,n=i.disableBodyScroll,d=i.bodyScrollOptions;l&&(this.enableBodyScroll=l),n&&(this.disableBodyScroll=n),d&&(this.bodyScrollOptions=d)}o.directive("scroll-lock",{inserted:this.inserted.bind(this),componentUpdated:this.componentUpdated.bind(this),unbind:this.unbind.bind(this)})},inserted:function(o,i){i.value&&this.disableBodyScroll(o,this.bodyScrollOptions)},componentUpdated:function(o,i){i.value?this.disableBodyScroll(o,this.bodyScrollOptions):this.enableBodyScroll(o)},unbind:function(o){this.enableBodyScroll(o)}};"undefined"!=typeof window&&window.Vue&&window.Vue.use(i);export default i; |
@@ -1,1 +0,1 @@ | ||
function e(e){return function(e){if(Array.isArray(e)){for(var t=0,n=new Array(e.length);t<e.length;t++)n[t]=e[t];return n}}(e)||function(e){if(Symbol.iterator in Object(e)||"[object Arguments]"===Object.prototype.toString.call(e))return Array.from(e)}(e)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance")}()}var t=!1;if("undefined"!=typeof window){var n={get passive(){t=!0}};window.addEventListener("testPassive",null,n),window.removeEventListener("testPassive",null,n)}var o,i,r="undefined"!=typeof window&&window.navigator&&window.navigator.platform&&/iP(ad|hone|od)/.test(window.navigator.platform),l=[],d=!1,c=-1,a=function(e){return l.some((function(t){return!(!t.options.allowTouchMove||!t.options.allowTouchMove(e))}))},u=function(e){var t=e||window.event;return!!a(t.target)||(t.touches.length>1||(t.preventDefault&&t.preventDefault(),!1))},s={enableBodyScroll:function(e){if(r){if(!e)return void console.error("enableBodyScroll unsuccessful - targetElement must be provided when calling enableBodyScroll on IOS devices.");e.ontouchstart=null,e.ontouchmove=null,l=l.filter((function(t){return t.targetElement!==e})),d&&0===l.length&&(document.removeEventListener("touchmove",u,t?{passive:!1}:void 0),d=!1)}else(l=l.filter((function(t){return t.targetElement!==e}))).length||setTimeout((function(){void 0!==i&&(document.body.style.paddingRight=i,i=void 0),void 0!==o&&(document.body.style.overflow=o,o=void 0)}))},disableBodyScroll:function(n,s){if(r){if(!n)return void console.error("disableBodyScroll unsuccessful - targetElement must be provided when calling disableBodyScroll on IOS devices.");if(n&&!l.some((function(e){return e.targetElement===n}))){var v={targetElement:n,options:s||{}};l=[].concat(e(l),[v]),n.ontouchstart=function(e){1===e.targetTouches.length&&(c=e.targetTouches[0].clientY)},n.ontouchmove=function(e){1===e.targetTouches.length&&function(e,t){var n=e.targetTouches[0].clientY-c;!a(e.target)&&(t&&0===t.scrollTop&&n>0?u(e):function(e){return!!e&&e.scrollHeight-e.scrollTop<=e.clientHeight}(t)&&n<0?u(e):e.stopPropagation())}(e,n)},d||(document.addEventListener("touchmove",u,t?{passive:!1}:void 0),d=!0)}}else{!function(e){setTimeout((function(){if(void 0===i){var t=!!e&&!0===e.reserveScrollBarGap,n=window.innerWidth-document.documentElement.clientWidth;t&&n>0&&(i=document.body.style.paddingRight,document.body.style.paddingRight="".concat(n,"px"))}void 0===o&&(o=document.body.style.overflow,document.body.style.overflow="hidden")}))}(s);var f={targetElement:n,options:s||{}};l=[].concat(e(l),[f])}},install:function(e,t){if(t){var n=t.enableBodyScroll,o=t.disableBodyScroll;n&&(this.enableBodyScroll=n),o&&(this.disableBodyScroll=o)}e.directive("scroll-lock",{inserted:this.inserted.bind(this),componentUpdated:this.componentUpdated.bind(this),unbind:this.unbind.bind(this)})},inserted:function(e,t){t.value&&this.disableBodyScroll(e)},componentUpdated:function(e,t){t.value?this.disableBodyScroll(e):this.enableBodyScroll(e)},unbind:function(e){this.enableBodyScroll(e)}};"undefined"!=typeof window&&window.Vue&&window.Vue.use(s);export default s; | ||
function e(e){return function(e){if(Array.isArray(e)){for(var t=0,o=new Array(e.length);t<e.length;t++)o[t]=e[t];return o}}(e)||function(e){if(Symbol.iterator in Object(e)||"[object Arguments]"===Object.prototype.toString.call(e))return Array.from(e)}(e)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance")}()}var t=!1;if("undefined"!=typeof window){var o={get passive(){t=!0}};window.addEventListener("testPassive",null,o),window.removeEventListener("testPassive",null,o)}var n,i,r="undefined"!=typeof window&&window.navigator&&window.navigator.platform&&/iP(ad|hone|od)/.test(window.navigator.platform),l=[],d=!1,c=-1,s=function(e){return l.some((function(t){return!(!t.options.allowTouchMove||!t.options.allowTouchMove(e))}))},a=function(e){var t=e||window.event;return!!s(t.target)||(t.touches.length>1||(t.preventDefault&&t.preventDefault(),!1))},u={enableBodyScroll:function(e){if(r){if(!e)return void console.error("enableBodyScroll unsuccessful - targetElement must be provided when calling enableBodyScroll on IOS devices.");e.ontouchstart=null,e.ontouchmove=null,l=l.filter((function(t){return t.targetElement!==e})),d&&0===l.length&&(document.removeEventListener("touchmove",a,t?{passive:!1}:void 0),d=!1)}else(l=l.filter((function(t){return t.targetElement!==e}))).length||setTimeout((function(){void 0!==i&&(document.body.style.paddingRight=i,i=void 0),void 0!==n&&(document.body.style.overflow=n,n=void 0)}))},disableBodyScroll:function(o,u){if(r){if(!o)return void console.error("disableBodyScroll unsuccessful - targetElement must be provided when calling disableBodyScroll on IOS devices.");if(o&&!l.some((function(e){return e.targetElement===o}))){var v={targetElement:o,options:u||{}};l=[].concat(e(l),[v]),o.ontouchstart=function(e){1===e.targetTouches.length&&(c=e.targetTouches[0].clientY)},o.ontouchmove=function(e){1===e.targetTouches.length&&function(e,t){var o=e.targetTouches[0].clientY-c;!s(e.target)&&(t&&0===t.scrollTop&&o>0?a(e):function(e){return!!e&&e.scrollHeight-e.scrollTop<=e.clientHeight}(t)&&o<0?a(e):e.stopPropagation())}(e,o)},d||(document.addEventListener("touchmove",a,t?{passive:!1}:void 0),d=!0)}}else{!function(e){setTimeout((function(){if(void 0===i){var t=!!e&&!0===e.reserveScrollBarGap,o=window.innerWidth-document.documentElement.clientWidth;t&&o>0&&(i=document.body.style.paddingRight,document.body.style.paddingRight="".concat(o,"px"))}void 0===n&&(n=document.body.style.overflow,document.body.style.overflow="hidden")}))}(u);var f={targetElement:o,options:u||{}};l=[].concat(e(l),[f])}},install:function(e,t){if(t){var o=t.enableBodyScroll,n=t.disableBodyScroll,i=t.bodyScrollOptions;o&&(this.enableBodyScroll=o),n&&(this.disableBodyScroll=n),i&&(this.bodyScrollOptions=i)}e.directive("scroll-lock",{inserted:this.inserted.bind(this),componentUpdated:this.componentUpdated.bind(this),unbind:this.unbind.bind(this)})},inserted:function(e,t){t.value&&this.disableBodyScroll(e,this.bodyScrollOptions)},componentUpdated:function(e,t){t.value?this.disableBodyScroll(e,this.bodyScrollOptions):this.enableBodyScroll(e)},unbind:function(e){this.enableBodyScroll(e)}};"undefined"!=typeof window&&window.Vue&&window.Vue.use(u);export default u; |
@@ -1,1 +0,1 @@ | ||
var VShowSlide=function(e){"use strict";function t(e){return function(e){if(Array.isArray(e)){for(var t=0,n=new Array(e.length);t<e.length;t++)n[t]=e[t];return n}}(e)||function(e){if(Symbol.iterator in Object(e)||"[object Arguments]"===Object.prototype.toString.call(e))return Array.from(e)}(e)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance")}()}var n=!1;if("undefined"!=typeof window){var o={get passive(){n=!0}};window.addEventListener("testPassive",null,o),window.removeEventListener("testPassive",null,o)}var i,r,l="undefined"!=typeof window&&window.navigator&&window.navigator.platform&&/iP(ad|hone|od)/.test(window.navigator.platform),d=[],c=!1,a=-1,u=function(e){return d.some((function(t){return!(!t.options.allowTouchMove||!t.options.allowTouchMove(e))}))},s=function(e){var t=e||window.event;return!!u(t.target)||(t.touches.length>1||(t.preventDefault&&t.preventDefault(),!1))},v={enableBodyScroll:function(e){if(l){if(!e)return void console.error("enableBodyScroll unsuccessful - targetElement must be provided when calling enableBodyScroll on IOS devices.");e.ontouchstart=null,e.ontouchmove=null,d=d.filter((function(t){return t.targetElement!==e})),c&&0===d.length&&(document.removeEventListener("touchmove",s,n?{passive:!1}:void 0),c=!1)}else(d=d.filter((function(t){return t.targetElement!==e}))).length||setTimeout((function(){void 0!==r&&(document.body.style.paddingRight=r,r=void 0),void 0!==i&&(document.body.style.overflow=i,i=void 0)}))},disableBodyScroll:function(e,o){if(l){if(!e)return void console.error("disableBodyScroll unsuccessful - targetElement must be provided when calling disableBodyScroll on IOS devices.");if(e&&!d.some((function(t){return t.targetElement===e}))){var v={targetElement:e,options:o||{}};d=[].concat(t(d),[v]),e.ontouchstart=function(e){1===e.targetTouches.length&&(a=e.targetTouches[0].clientY)},e.ontouchmove=function(t){1===t.targetTouches.length&&function(e,t){var n=e.targetTouches[0].clientY-a;!u(e.target)&&(t&&0===t.scrollTop&&n>0?s(e):function(e){return!!e&&e.scrollHeight-e.scrollTop<=e.clientHeight}(t)&&n<0?s(e):e.stopPropagation())}(t,e)},c||(document.addEventListener("touchmove",s,n?{passive:!1}:void 0),c=!0)}}else{!function(e){setTimeout((function(){if(void 0===r){var t=!!e&&!0===e.reserveScrollBarGap,n=window.innerWidth-document.documentElement.clientWidth;t&&n>0&&(r=document.body.style.paddingRight,document.body.style.paddingRight="".concat(n,"px"))}void 0===i&&(i=document.body.style.overflow,document.body.style.overflow="hidden")}))}(o);var f={targetElement:e,options:o||{}};d=[].concat(t(d),[f])}},install:function(e,t){if(t){var n=t.enableBodyScroll,o=t.disableBodyScroll;n&&(this.enableBodyScroll=n),o&&(this.disableBodyScroll=o)}e.directive("scroll-lock",{inserted:this.inserted.bind(this),componentUpdated:this.componentUpdated.bind(this),unbind:this.unbind.bind(this)})},inserted:function(e,t){t.value&&this.disableBodyScroll(e)},componentUpdated:function(e,t){t.value?this.disableBodyScroll(e):this.enableBodyScroll(e)},unbind:function(e){this.enableBodyScroll(e)}};return"undefined"!=typeof window&&window.Vue&&window.Vue.use(v),e.default=v,e}({}); | ||
var VShowSlide=function(e){"use strict";function t(e){return function(e){if(Array.isArray(e)){for(var t=0,o=new Array(e.length);t<e.length;t++)o[t]=e[t];return o}}(e)||function(e){if(Symbol.iterator in Object(e)||"[object Arguments]"===Object.prototype.toString.call(e))return Array.from(e)}(e)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance")}()}var o=!1;if("undefined"!=typeof window){var n={get passive(){o=!0}};window.addEventListener("testPassive",null,n),window.removeEventListener("testPassive",null,n)}var i,r,l="undefined"!=typeof window&&window.navigator&&window.navigator.platform&&/iP(ad|hone|od)/.test(window.navigator.platform),d=[],c=!1,s=-1,a=function(e){return d.some((function(t){return!(!t.options.allowTouchMove||!t.options.allowTouchMove(e))}))},u=function(e){var t=e||window.event;return!!a(t.target)||(t.touches.length>1||(t.preventDefault&&t.preventDefault(),!1))},v={enableBodyScroll:function(e){if(l){if(!e)return void console.error("enableBodyScroll unsuccessful - targetElement must be provided when calling enableBodyScroll on IOS devices.");e.ontouchstart=null,e.ontouchmove=null,d=d.filter((function(t){return t.targetElement!==e})),c&&0===d.length&&(document.removeEventListener("touchmove",u,o?{passive:!1}:void 0),c=!1)}else(d=d.filter((function(t){return t.targetElement!==e}))).length||setTimeout((function(){void 0!==r&&(document.body.style.paddingRight=r,r=void 0),void 0!==i&&(document.body.style.overflow=i,i=void 0)}))},disableBodyScroll:function(e,n){if(l){if(!e)return void console.error("disableBodyScroll unsuccessful - targetElement must be provided when calling disableBodyScroll on IOS devices.");if(e&&!d.some((function(t){return t.targetElement===e}))){var v={targetElement:e,options:n||{}};d=[].concat(t(d),[v]),e.ontouchstart=function(e){1===e.targetTouches.length&&(s=e.targetTouches[0].clientY)},e.ontouchmove=function(t){1===t.targetTouches.length&&function(e,t){var o=e.targetTouches[0].clientY-s;!a(e.target)&&(t&&0===t.scrollTop&&o>0?u(e):function(e){return!!e&&e.scrollHeight-e.scrollTop<=e.clientHeight}(t)&&o<0?u(e):e.stopPropagation())}(t,e)},c||(document.addEventListener("touchmove",u,o?{passive:!1}:void 0),c=!0)}}else{!function(e){setTimeout((function(){if(void 0===r){var t=!!e&&!0===e.reserveScrollBarGap,o=window.innerWidth-document.documentElement.clientWidth;t&&o>0&&(r=document.body.style.paddingRight,document.body.style.paddingRight="".concat(o,"px"))}void 0===i&&(i=document.body.style.overflow,document.body.style.overflow="hidden")}))}(n);var f={targetElement:e,options:n||{}};d=[].concat(t(d),[f])}},install:function(e,t){if(t){var o=t.enableBodyScroll,n=t.disableBodyScroll,i=t.bodyScrollOptions;o&&(this.enableBodyScroll=o),n&&(this.disableBodyScroll=n),i&&(this.bodyScrollOptions=i)}e.directive("scroll-lock",{inserted:this.inserted.bind(this),componentUpdated:this.componentUpdated.bind(this),unbind:this.unbind.bind(this)})},inserted:function(e,t){t.value&&this.disableBodyScroll(e,this.bodyScrollOptions)},componentUpdated:function(e,t){t.value?this.disableBodyScroll(e,this.bodyScrollOptions):this.enableBodyScroll(e)},unbind:function(e){this.enableBodyScroll(e)}};return"undefined"!=typeof window&&window.Vue&&window.Vue.use(v),e.default=v,e}({}); |
@@ -1,1 +0,1 @@ | ||
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports):"function"==typeof define&&define.amd?define(["exports"],t):t((e=e||self).VShowSlide={})}(this,(function(e){"use strict";function t(e){return function(e){if(Array.isArray(e)){for(var t=0,n=new Array(e.length);t<e.length;t++)n[t]=e[t];return n}}(e)||function(e){if(Symbol.iterator in Object(e)||"[object Arguments]"===Object.prototype.toString.call(e))return Array.from(e)}(e)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance")}()}var n=!1;if("undefined"!=typeof window){var o={get passive(){n=!0}};window.addEventListener("testPassive",null,o),window.removeEventListener("testPassive",null,o)}var i,r,l="undefined"!=typeof window&&window.navigator&&window.navigator.platform&&/iP(ad|hone|od)/.test(window.navigator.platform),d=[],c=!1,u=-1,s=function(e){return d.some((function(t){return!(!t.options.allowTouchMove||!t.options.allowTouchMove(e))}))},a=function(e){var t=e||window.event;return!!s(t.target)||(t.touches.length>1||(t.preventDefault&&t.preventDefault(),!1))},f={enableBodyScroll:function(e){if(l){if(!e)return void console.error("enableBodyScroll unsuccessful - targetElement must be provided when calling enableBodyScroll on IOS devices.");e.ontouchstart=null,e.ontouchmove=null,d=d.filter((function(t){return t.targetElement!==e})),c&&0===d.length&&(document.removeEventListener("touchmove",a,n?{passive:!1}:void 0),c=!1)}else(d=d.filter((function(t){return t.targetElement!==e}))).length||setTimeout((function(){void 0!==r&&(document.body.style.paddingRight=r,r=void 0),void 0!==i&&(document.body.style.overflow=i,i=void 0)}))},disableBodyScroll:function(e,o){if(l){if(!e)return void console.error("disableBodyScroll unsuccessful - targetElement must be provided when calling disableBodyScroll on IOS devices.");if(e&&!d.some((function(t){return t.targetElement===e}))){var f={targetElement:e,options:o||{}};d=[].concat(t(d),[f]),e.ontouchstart=function(e){1===e.targetTouches.length&&(u=e.targetTouches[0].clientY)},e.ontouchmove=function(t){1===t.targetTouches.length&&function(e,t){var n=e.targetTouches[0].clientY-u;!s(e.target)&&(t&&0===t.scrollTop&&n>0?a(e):function(e){return!!e&&e.scrollHeight-e.scrollTop<=e.clientHeight}(t)&&n<0?a(e):e.stopPropagation())}(t,e)},c||(document.addEventListener("touchmove",a,n?{passive:!1}:void 0),c=!0)}}else{!function(e){setTimeout((function(){if(void 0===r){var t=!!e&&!0===e.reserveScrollBarGap,n=window.innerWidth-document.documentElement.clientWidth;t&&n>0&&(r=document.body.style.paddingRight,document.body.style.paddingRight="".concat(n,"px"))}void 0===i&&(i=document.body.style.overflow,document.body.style.overflow="hidden")}))}(o);var v={targetElement:e,options:o||{}};d=[].concat(t(d),[v])}},install:function(e,t){if(t){var n=t.enableBodyScroll,o=t.disableBodyScroll;n&&(this.enableBodyScroll=n),o&&(this.disableBodyScroll=o)}e.directive("scroll-lock",{inserted:this.inserted.bind(this),componentUpdated:this.componentUpdated.bind(this),unbind:this.unbind.bind(this)})},inserted:function(e,t){t.value&&this.disableBodyScroll(e)},componentUpdated:function(e,t){t.value?this.disableBodyScroll(e):this.enableBodyScroll(e)},unbind:function(e){this.enableBodyScroll(e)}};"undefined"!=typeof window&&window.Vue&&window.Vue.use(f),e.default=f,Object.defineProperty(e,"__esModule",{value:!0})})); | ||
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports):"function"==typeof define&&define.amd?define(["exports"],t):t((e=e||self).VShowSlide={})}(this,(function(e){"use strict";function t(e){return function(e){if(Array.isArray(e)){for(var t=0,o=new Array(e.length);t<e.length;t++)o[t]=e[t];return o}}(e)||function(e){if(Symbol.iterator in Object(e)||"[object Arguments]"===Object.prototype.toString.call(e))return Array.from(e)}(e)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance")}()}var o=!1;if("undefined"!=typeof window){var n={get passive(){o=!0}};window.addEventListener("testPassive",null,n),window.removeEventListener("testPassive",null,n)}var i,r,l="undefined"!=typeof window&&window.navigator&&window.navigator.platform&&/iP(ad|hone|od)/.test(window.navigator.platform),d=[],c=!1,s=-1,u=function(e){return d.some((function(t){return!(!t.options.allowTouchMove||!t.options.allowTouchMove(e))}))},a=function(e){var t=e||window.event;return!!u(t.target)||(t.touches.length>1||(t.preventDefault&&t.preventDefault(),!1))},f={enableBodyScroll:function(e){if(l){if(!e)return void console.error("enableBodyScroll unsuccessful - targetElement must be provided when calling enableBodyScroll on IOS devices.");e.ontouchstart=null,e.ontouchmove=null,d=d.filter((function(t){return t.targetElement!==e})),c&&0===d.length&&(document.removeEventListener("touchmove",a,o?{passive:!1}:void 0),c=!1)}else(d=d.filter((function(t){return t.targetElement!==e}))).length||setTimeout((function(){void 0!==r&&(document.body.style.paddingRight=r,r=void 0),void 0!==i&&(document.body.style.overflow=i,i=void 0)}))},disableBodyScroll:function(e,n){if(l){if(!e)return void console.error("disableBodyScroll unsuccessful - targetElement must be provided when calling disableBodyScroll on IOS devices.");if(e&&!d.some((function(t){return t.targetElement===e}))){var f={targetElement:e,options:n||{}};d=[].concat(t(d),[f]),e.ontouchstart=function(e){1===e.targetTouches.length&&(s=e.targetTouches[0].clientY)},e.ontouchmove=function(t){1===t.targetTouches.length&&function(e,t){var o=e.targetTouches[0].clientY-s;!u(e.target)&&(t&&0===t.scrollTop&&o>0?a(e):function(e){return!!e&&e.scrollHeight-e.scrollTop<=e.clientHeight}(t)&&o<0?a(e):e.stopPropagation())}(t,e)},c||(document.addEventListener("touchmove",a,o?{passive:!1}:void 0),c=!0)}}else{!function(e){setTimeout((function(){if(void 0===r){var t=!!e&&!0===e.reserveScrollBarGap,o=window.innerWidth-document.documentElement.clientWidth;t&&o>0&&(r=document.body.style.paddingRight,document.body.style.paddingRight="".concat(o,"px"))}void 0===i&&(i=document.body.style.overflow,document.body.style.overflow="hidden")}))}(n);var v={targetElement:e,options:n||{}};d=[].concat(t(d),[v])}},install:function(e,t){if(t){var o=t.enableBodyScroll,n=t.disableBodyScroll,i=t.bodyScrollOptions;o&&(this.enableBodyScroll=o),n&&(this.disableBodyScroll=n),i&&(this.bodyScrollOptions=i)}e.directive("scroll-lock",{inserted:this.inserted.bind(this),componentUpdated:this.componentUpdated.bind(this),unbind:this.unbind.bind(this)})},inserted:function(e,t){t.value&&this.disableBodyScroll(e,this.bodyScrollOptions)},componentUpdated:function(e,t){t.value?this.disableBodyScroll(e,this.bodyScrollOptions):this.enableBodyScroll(e)},unbind:function(e){this.enableBodyScroll(e)}};"undefined"!=typeof window&&window.Vue&&window.Vue.use(f),e.default=f,Object.defineProperty(e,"__esModule",{value:!0})})); |
{ | ||
"name": "v-scroll-lock", | ||
"version": "1.1.1", | ||
"version": "1.2.0", | ||
"description": "A Vue.js directive for scroll locking", | ||
@@ -5,0 +5,0 @@ "main": "dist/v-scroll-lock.umd.js", |
@@ -96,2 +96,18 @@ [![npm](https://img.shields.io/npm/dw/localeval.svg)](https://www.npmjs.com/package/v-scroll-lock) | ||
### [body-scroll-lock](https://github.com/willmcpo/body-scroll-lock#options) options | ||
Options can be passed when installing the directive: | ||
```js | ||
import VScrollLock from 'v-scroll-lock' | ||
Vue.use(VScrollLock, { | ||
bodyScrollOptions: { | ||
reserveScrollBarGap: true, | ||
}, | ||
}) | ||
``` | ||
See [https://github.com/willmcpo/body-scroll-lock#options](https://github.com/willmcpo/body-scroll-lock#options) for full list of options. | ||
### Providing Your Own Version of [body-scroll-lock](https://github.com/willmcpo/body-scroll-lock) | ||
@@ -98,0 +114,0 @@ |
@@ -19,2 +19,3 @@ import { VueConstructor } from 'vue' | ||
disableBodyScroll: disableBodyScrollOption, | ||
bodyScrollOptions, | ||
} = options | ||
@@ -29,2 +30,6 @@ | ||
} | ||
if (bodyScrollOptions) { | ||
this.bodyScrollOptions = bodyScrollOptions | ||
} | ||
} | ||
@@ -39,3 +44,3 @@ Vue.directive('scroll-lock', { | ||
if (binding.value) { | ||
this.disableBodyScroll(el) | ||
this.disableBodyScroll(el, this.bodyScrollOptions) | ||
} | ||
@@ -45,3 +50,3 @@ }, | ||
if (binding.value) { | ||
this.disableBodyScroll(el) | ||
this.disableBodyScroll(el, this.bodyScrollOptions) | ||
} else { | ||
@@ -48,0 +53,0 @@ this.enableBodyScroll(el) |
@@ -1,2 +0,6 @@ | ||
import { disableBodyScroll, enableBodyScroll } from 'body-scroll-lock' | ||
import { | ||
disableBodyScroll, | ||
enableBodyScroll, | ||
BodyScrollOptions, | ||
} from 'body-scroll-lock' | ||
@@ -6,2 +10,3 @@ export default interface PluginOptions { | ||
enableBodyScroll?: typeof enableBodyScroll | ||
bodyScrollOptions?: Partial<BodyScrollOptions> | ||
} |
import PluginOptions from './plugin-options.interface' | ||
import { PluginFunction, DirectiveFunction } from 'vue' | ||
import { enableBodyScroll, disableBodyScroll } from 'body-scroll-lock' | ||
import { | ||
enableBodyScroll, | ||
disableBodyScroll, | ||
BodyScrollOptions, | ||
} from 'body-scroll-lock' | ||
@@ -12,2 +16,3 @@ export default interface VScrollLock { | ||
unbind: DirectiveFunction | ||
bodyScrollOptions?: Partial<BodyScrollOptions> | ||
} |
Sorry, the diff of this file is too big to display
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
250252
963
133