Socket
Socket
Sign inDemoInstall

@mattlewis92/dom-autoscroller

Package Overview
Dependencies
8
Maintainers
1
Versions
7
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 2.3.6 to 2.3.7

9

dist/bundle.es.js

@@ -7,6 +7,9 @@ import { boolean } from 'type-func';

var prefix = [ 'webkit', 'moz', 'ms', 'o' ];
var window = typeof window !== "undefined" ? window : {};
var requestFrame = (function () {
if (typeof window === "undefined") {
return function () {};
}
for ( var i = 0, limit = prefix.length ; i < limit && ! window.requestAnimationFrame ; ++i ) {

@@ -35,2 +38,6 @@ window.requestAnimationFrame = window[ prefix[ i ] + 'RequestAnimationFrame' ];

if (typeof window === "undefined") {
return function () {};
}
for ( var i = 0, limit = prefix.length ; i < limit && ! window.cancelAnimationFrame ; ++i ) {

@@ -37,0 +44,0 @@ window.cancelAnimationFrame = window[ prefix[ i ] + 'CancelAnimationFrame' ] || window[ prefix[ i ] + 'CancelRequestAnimationFrame' ];

@@ -11,6 +11,9 @@ 'use strict';

var prefix = [ 'webkit', 'moz', 'ms', 'o' ];
var window = typeof window !== "undefined" ? window : {};
var requestFrame = (function () {
if (typeof window === "undefined") {
return function () {};
}
for ( var i = 0, limit = prefix.length ; i < limit && ! window.requestAnimationFrame ; ++i ) {

@@ -39,2 +42,6 @@ window.requestAnimationFrame = window[ prefix[ i ] + 'RequestAnimationFrame' ];

if (typeof window === "undefined") {
return function () {};
}
for ( var i = 0, limit = prefix.length ; i < limit && ! window.cancelAnimationFrame ; ++i ) {

@@ -41,0 +48,0 @@ window.cancelAnimationFrame = window[ prefix[ i ] + 'CancelAnimationFrame' ] || window[ prefix[ i ] + 'CancelRequestAnimationFrame' ];

89

dist/dom-autoscroller.js

@@ -655,17 +655,20 @@ var autoScroll = (function () {

var prefix = [ 'webkit', 'moz', 'ms', 'o' ];
var window$1 = typeof window$1 !== "undefined" ? window$1 : {};
var requestFrame = (function () {
for ( var i = 0, limit = prefix.length ; i < limit && ! window$1.requestAnimationFrame ; ++i ) {
window$1.requestAnimationFrame = window$1[ prefix[ i ] + 'RequestAnimationFrame' ];
if (typeof window === "undefined") {
return function () {};
}
if ( ! window$1.requestAnimationFrame ) {
for ( var i = 0, limit = prefix.length ; i < limit && ! window.requestAnimationFrame ; ++i ) {
window.requestAnimationFrame = window[ prefix[ i ] + 'RequestAnimationFrame' ];
}
if ( ! window.requestAnimationFrame ) {
var lastTime = 0;
window$1.requestAnimationFrame = function (callback) {
window.requestAnimationFrame = function (callback) {
var now = new Date().getTime();
var ttc = Math.max( 0, 16 - now - lastTime );
var timer = window$1.setTimeout( function () { return callback( now + ttc ); }, ttc );
var timer = window.setTimeout( function () { return callback( now + ttc ); }, ttc );

@@ -678,3 +681,3 @@ lastTime = now + ttc;

return window$1.requestAnimationFrame.bind( window$1 );
return window.requestAnimationFrame.bind( window );
})();

@@ -684,13 +687,17 @@

for ( var i = 0, limit = prefix.length ; i < limit && ! window$1.cancelAnimationFrame ; ++i ) {
window$1.cancelAnimationFrame = window$1[ prefix[ i ] + 'CancelAnimationFrame' ] || window$1[ prefix[ i ] + 'CancelRequestAnimationFrame' ];
if (typeof window === "undefined") {
return function () {};
}
if ( ! window$1.cancelAnimationFrame ) {
window$1.cancelAnimationFrame = function (timer) {
window$1.clearTimeout( timer );
for ( var i = 0, limit = prefix.length ; i < limit && ! window.cancelAnimationFrame ; ++i ) {
window.cancelAnimationFrame = window[ prefix[ i ] + 'CancelAnimationFrame' ] || window[ prefix[ i ] + 'CancelRequestAnimationFrame' ];
}
if ( ! window.cancelAnimationFrame ) {
window.cancelAnimationFrame = function (timer) {
window.clearTimeout( timer );
};
}
return window$1.cancelAnimationFrame.bind( window$1 );
return window.cancelAnimationFrame.bind( window );
})();

@@ -713,4 +720,4 @@

window$1.addEventListener('mousemove', pointCB, false);
window$1.addEventListener('touchmove', pointCB, false);
window.addEventListener('mousemove', pointCB, false);
window.addEventListener('touchmove', pointCB, false);

@@ -725,15 +732,15 @@ if(!isNaN(options.maxSpeed)){

this.destroy = function(forceCleanAnimation) {
window$1.removeEventListener('mousemove', pointCB, false);
window$1.removeEventListener('touchmove', pointCB, false);
window$1.removeEventListener('mousedown', onDown, false);
window$1.removeEventListener('touchstart', onDown, false);
window$1.removeEventListener('mouseup', onUp, false);
window$1.removeEventListener('touchend', onUp, false);
window$1.removeEventListener('pointerup', onUp, false);
window$1.removeEventListener('mouseleave', onMouseOut, false);
window.removeEventListener('mousemove', pointCB, false);
window.removeEventListener('touchmove', pointCB, false);
window.removeEventListener('mousedown', onDown, false);
window.removeEventListener('touchstart', onDown, false);
window.removeEventListener('mouseup', onUp, false);
window.removeEventListener('touchend', onUp, false);
window.removeEventListener('pointerup', onUp, false);
window.removeEventListener('mouseleave', onMouseOut, false);
window$1.removeEventListener('mousemove', onMove, false);
window$1.removeEventListener('touchmove', onMove, false);
window.removeEventListener('mousemove', onMove, false);
window.removeEventListener('touchmove', onMove, false);
window$1.removeEventListener('scroll', setScroll, true);
window.removeEventListener('scroll', setScroll, true);
elements = [];

@@ -769,4 +776,4 @@ if(forceCleanAnimation){

temp.forEach(function(element){
if(element === window$1){
hasWindow = window$1;
if(element === window){
hasWindow = window;
}else{

@@ -795,6 +802,6 @@ self.add(element);

window$1.addEventListener('mousedown', onDown, false);
window$1.addEventListener('touchstart', onDown, false);
window$1.addEventListener('mouseup', onUp, false);
window$1.addEventListener('touchend', onUp, false);
window.addEventListener('mousedown', onDown, false);
window.addEventListener('touchstart', onDown, false);
window.addEventListener('mouseup', onUp, false);
window.addEventListener('touchend', onUp, false);

@@ -807,10 +814,10 @@ /*

*/
window$1.addEventListener('pointerup', onUp, false);
window.addEventListener('pointerup', onUp, false);
window$1.addEventListener('mousemove', onMove, false);
window$1.addEventListener('touchmove', onMove, false);
window.addEventListener('mousemove', onMove, false);
window.addEventListener('touchmove', onMove, false);
window$1.addEventListener('mouseleave', onMouseOut, false);
window.addEventListener('mouseleave', onMouseOut, false);
window$1.addEventListener('scroll', setScroll, true);
window.addEventListener('scroll', setScroll, true);

@@ -1003,4 +1010,4 @@ function setScroll(e){

function scrollY(el, amount){
if(el === window$1){
window$1.scrollTo(el.pageXOffset, el.pageYOffset + amount);
if(el === window){
window.scrollTo(el.pageXOffset, el.pageYOffset + amount);
}else{

@@ -1012,4 +1019,4 @@ el.scrollTop += amount;

function scrollX(el, amount){
if(el === window$1){
window$1.scrollTo(el.pageXOffset + amount, el.pageYOffset);
if(el === window){
window.scrollTo(el.pageXOffset + amount, el.pageYOffset);
}else{

@@ -1016,0 +1023,0 @@ el.scrollLeft += amount;

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

var autoScroll=function(){"use strict";function e(e,t){return void 0===e?void 0===t?e:t:e}function t(t,n){return t=e(t,n),"function"==typeof t?function(){for(var e=arguments,n=arguments.length,r=Array(n),o=0;o<n;o++)r[o]=e[o];return!!t.apply(this,r)}:t?function(){return!0}:function(){return!1}}function n(e,t){if(t=u(t,!0),!w(t))return-1;for(var n=0;n<e.length;n++)if(e[n]===t)return n;return-1}function r(e,t){return-1!==n(e,t)}function o(e,t){for(var n=0;n<t.length;n++)r(e,t[n])||e.push(t[n]);return t}function i(e){for(var t=arguments,n=[],r=arguments.length-1;r-- >0;)n[r]=t[r+1];return n=n.map(u),o(e,n)}function a(e){for(var t=arguments,r=[],o=arguments.length-1;o-- >0;)r[o]=t[o+1];return r.map(u).reduce(function(t,r){var o=n(e,r);return-1!==o?t.concat(e.splice(o,1)):t},[])}function u(e,t){if("string"==typeof e)try{return document.querySelector(e)}catch(e){throw e}if(!w(e)&&!t)throw new TypeError(e+" is not a DOM element.");return e}function c(e,n){n=n||{};var r=t(n.allowUpdate,!0);return function(t){if(t=t||window.event,e.target=t.target||t.srcElement||t.originalTarget,e.element=this,e.type=t.type,r(t)){if(t.targetTouches)e.x=t.targetTouches[0].clientX,e.y=t.targetTouches[0].clientY,e.pageX=t.targetTouches[0].pageX,e.pageY=t.targetTouches[0].pageY,e.screenX=t.targetTouches[0].screenX,e.screenY=t.targetTouches[0].screenY;else{if(null===t.pageX&&null!==t.clientX){var n=t.target&&t.target.ownerDocument||document,o=n.documentElement,i=n.body;e.pageX=t.clientX+(o&&o.scrollLeft||i&&i.scrollLeft||0)-(o&&o.clientLeft||i&&i.clientLeft||0),e.pageY=t.clientY+(o&&o.scrollTop||i&&i.scrollTop||0)-(o&&o.clientTop||i&&i.clientTop||0)}else e.pageX=t.pageX,e.pageY=t.pageY;e.x=t.clientX,e.y=t.clientY,e.screenX=t.screenX,e.screenY=t.screenY}e.clientX=e.x,e.clientY=e.y}}}function l(){var e={top:{value:0,enumerable:!0},left:{value:0,enumerable:!0},right:{value:window.innerWidth,enumerable:!0},bottom:{value:window.innerHeight,enumerable:!0},width:{value:window.innerWidth,enumerable:!0},height:{value:window.innerHeight,enumerable:!0},x:{value:0,enumerable:!0},y:{value:0,enumerable:!0}};if(Object.create)return Object.create({},e);var t={};return Object.defineProperties(t,e),t}function f(e){if(e===window)return l();try{var t=e.getBoundingClientRect();return void 0===t.x&&(t.x=t.left,t.y=t.top),t}catch(t){throw new TypeError("Can't call getBoundingClientRect on "+e)}}function s(e,t){var n=f(t);return e.y>n.top&&e.y<n.bottom&&e.x>n.left&&e.x<n.right}function m(e){function t(e){for(var t=0;t<x.length;t++)r[x[t]]=e[x[t]]}function n(){e&&e.removeEventListener("mousemove",t,!1),r=null}var r={screenX:0,screenY:0,clientX:0,clientY:0,ctrlKey:!1,shiftKey:!1,altKey:!1,metaKey:!1,button:0,buttons:1,relatedTarget:null,region:null};return void 0!==e&&e.addEventListener("mousemove",t),{destroy:n,dispatch:function(){return MouseEvent?function(e,t,n){var o=new MouseEvent("mousemove",v(r,t));return d(o,n),e.dispatchEvent(o)}:"function"==typeof document.createEvent?function(e,t,n){var o=v(r,t),i=document.createEvent("MouseEvents");return i.initMouseEvent("mousemove",!0,!0,window,0,o.screenX,o.screenY,o.clientX,o.clientY,o.ctrlKey,o.altKey,o.shiftKey,o.metaKey,o.button,o.relatedTarget),d(i,n),e.dispatchEvent(i)}:"function"==typeof document.createEventObject?function(e,t,n){var o=document.createEventObject(),i=v(r,t);for(var a in i)o[a]=i[a];return d(o,n),e.dispatchEvent(o)}:void 0}()}}function v(e,t){t=t||{};for(var n=T(e),r=0;r<x.length;r++)void 0!==t[x[r]]&&(n[x[r]]=t[x[r]]);return n}function d(e,t){console.log("data ",t),e.data=t||{},e.dispatched="mousemove"}function p(e,n){function o(t){for(var n=0;n<e.length;n++)if(e[n]===t.target){O=!0;break}O&&Y(function(){return O=!1})}function u(){F=!0}function l(){F=!1,s()}function s(){A(N),A(K)}function v(){F=!1}function d(t){if(!t)return null;if(C===t)return t;if(r(e,t))return t;for(;t=t.parentNode;)if(r(e,t))return t;return null}function p(){for(var t=null,n=0;n<e.length;n++)g(S,e[n])&&(t=e[n]);return t}function h(e){if(x.autoScroll()&&!e.dispatched){var t=e.target,n=document.body;C&&!g(S,C)&&(x.scrollWhenOutside||(C=null)),t&&t.parentNode===n?t=p():(t=d(t))||(t=p()),t&&t!==C&&(C=t),q&&(A(K),K=Y(y)),C&&(A(N),N=Y(b))}}function y(){w(q),A(K),K=Y(y)}function b(){C&&(w(C),A(N),N=Y(b))}function w(e){var t,n,r=f(e);t=S.x<r.left+x.margin?Math.floor(Math.max(-1,(S.x-r.left)/x.margin-1)*x.maxSpeed):S.x>r.right-x.margin?Math.ceil(Math.min(1,(S.x-r.right)/x.margin+1)*x.maxSpeed):0,n=S.y<r.top+x.margin?Math.floor(Math.max(-1,(S.y-r.top)/x.margin-1)*x.maxSpeed):S.y>r.bottom-x.margin?Math.ceil(Math.min(1,(S.y-r.bottom)/x.margin+1)*x.maxSpeed):0,x.syncMove()&&M.dispatch(e,{pageX:S.pageX+t,pageY:S.pageY+n,clientX:S.x+t,clientY:S.y+n}),setTimeout(function(){n&&E(e,n),t&&T(e,t)})}function E(e,t){e===X?X.scrollTo(e.pageXOffset,e.pageYOffset+t):e.scrollTop+=t}function T(e,t){e===X?X.scrollTo(e.pageXOffset+t,e.pageYOffset):e.scrollLeft+=t}void 0===n&&(n={});var x=this,L=4,O=!1;this.margin=n.margin||-1,this.scrollWhenOutside=n.scrollWhenOutside||!1;var S={},j=c(S),M=m(),F=!1;X.addEventListener("mousemove",j,!1),X.addEventListener("touchmove",j,!1),isNaN(n.maxSpeed)||(L=n.maxSpeed),this.autoScroll=t(n.autoScroll),this.syncMove=t(n.syncMove,!1),this.destroy=function(t){X.removeEventListener("mousemove",j,!1),X.removeEventListener("touchmove",j,!1),X.removeEventListener("mousedown",u,!1),X.removeEventListener("touchstart",u,!1),X.removeEventListener("mouseup",l,!1),X.removeEventListener("touchend",l,!1),X.removeEventListener("pointerup",l,!1),X.removeEventListener("mouseleave",v,!1),X.removeEventListener("mousemove",h,!1),X.removeEventListener("touchmove",h,!1),X.removeEventListener("scroll",o,!0),e=[],t&&s()},this.add=function(){for(var t=[],n=arguments.length;n--;)t[n]=arguments[n];return i.apply(void 0,[e].concat(t)),this},this.remove=function(){for(var t=[],n=arguments.length;n--;)t[n]=arguments[n];return a.apply(void 0,[e].concat(t))};var K,q=null;"[object Array]"!==Object.prototype.toString.call(e)&&(e=[e]),function(t){e=[],t.forEach(function(e){e===X?q=X:x.add(e)})}(e),Object.defineProperties(this,{down:{get:function(){return F}},maxSpeed:{get:function(){return L}},point:{get:function(){return S}},scrolling:{get:function(){return O}}});var N,C=null;X.addEventListener("mousedown",u,!1),X.addEventListener("touchstart",u,!1),X.addEventListener("mouseup",l,!1),X.addEventListener("touchend",l,!1),X.addEventListener("pointerup",l,!1),X.addEventListener("mousemove",h,!1),X.addEventListener("touchmove",h,!1),X.addEventListener("mouseleave",v,!1),X.addEventListener("scroll",o,!0)}function h(e,t){return new p(e,t)}function g(e,t,n){return n?e.y>n.top&&e.y<n.bottom&&e.x>n.left&&e.x<n.right:s(e,t)}var y=function(){var e=function(e){return"function"==typeof e},t=function(e){var t=Number(e);return isNaN(t)?0:0!==t&&isFinite(t)?(t>0?1:-1)*Math.floor(Math.abs(t)):t},n=Math.pow(2,53)-1,r=function(e){var r=t(e);return Math.min(Math.max(r,0),n)},o=function(e){if(null!=e){if(["string","number","boolean","symbol"].indexOf(typeof e)>-1)return Symbol.iterator;if("undefined"!=typeof Symbol&&"iterator"in Symbol&&Symbol.iterator in e)return Symbol.iterator;if("@@iterator"in e)return"@@iterator"}},i=function(t,n){if(null!=t&&null!=n){var r=t[n];if(null==r)return;if(!e(r))throw new TypeError(r+" is not a function");return r}},a=function(e){var t=e.next();return!Boolean(t.done)&&t};return function(t){var n,u=this,c=arguments.length>1?arguments[1]:void 0;if(void 0!==c){if(!e(c))throw new TypeError("Array.from: when provided, the second argument must be a function");arguments.length>2&&(n=arguments[2])}var l,f,s=i(t,o(t));if(void 0!==s){l=e(u)?Object(new u):[];var m=s.call(t);if(null==m)throw new TypeError("Array.from requires an array-like or iterable object");f=0;for(var v,d;;){if(!(v=a(m)))return l.length=f,l;d=v.value,l[f]=c?c.call(n,d,f):d,f++}}else{var p=Object(t);if(null==t)throw new TypeError("Array.from requires an array-like object - not null or undefined");var h=r(p.length);l=e(u)?Object(new u(h)):new Array(h),f=0;for(var g;f<h;)g=p[f],l[f]=c?c.call(n,g,f):g,f++;l.length=h}return l}}(),b=("function"==typeof Array.from&&Array.from,Array.isArray,Object.prototype.toString,"function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol?"symbol":typeof e}),w=function(e){return null!=e&&"object"===(void 0===e?"undefined":b(e))&&1===e.nodeType&&"object"===b(e.style)&&"object"===b(e.ownerDocument)},E=void 0;E="function"!=typeof Object.create?function(e){var t=function(){};return function(e,n){if(e!==Object(e)&&null!==e)throw TypeError("Argument must be an object, or null");t.prototype=e||{};var r=new t;return t.prototype=null,void 0!==n&&Object.defineProperties(r,n),null===e&&(r.__proto__=null),r}}():Object.create;var T=E,x=["altKey","button","buttons","clientX","clientY","ctrlKey","metaKey","movementX","movementY","offsetX","offsetY","pageX","pageY","region","relatedTarget","screenX","screenY","shiftKey","which","x","y"],L=["webkit","moz","ms","o"],X=void 0!==X?X:{},Y=function(){for(var e=0,t=L.length;e<t&&!X.requestAnimationFrame;++e)X.requestAnimationFrame=X[L[e]+"RequestAnimationFrame"];if(!X.requestAnimationFrame){var n=0;X.requestAnimationFrame=function(e){var t=(new Date).getTime(),r=Math.max(0,16-t-n),o=X.setTimeout(function(){return e(t+r)},r);return n=t+r,o}}return X.requestAnimationFrame.bind(X)}(),A=function(){for(var e=0,t=L.length;e<t&&!X.cancelAnimationFrame;++e)X.cancelAnimationFrame=X[L[e]+"CancelAnimationFrame"]||X[L[e]+"CancelRequestAnimationFrame"];return X.cancelAnimationFrame||(X.cancelAnimationFrame=function(e){X.clearTimeout(e)}),X.cancelAnimationFrame.bind(X)}();return h}();
var autoScroll=function(){"use strict";function e(e,n){return void 0===e?void 0===n?e:n:e}function n(n,t){return n=e(n,t),"function"==typeof n?function(){for(var e=arguments,t=arguments.length,r=Array(t),o=0;o<t;o++)r[o]=e[o];return!!n.apply(this,r)}:n?function(){return!0}:function(){return!1}}function t(e,n){if(n=u(n,!0),!b(n))return-1;for(var t=0;t<e.length;t++)if(e[t]===n)return t;return-1}function r(e,n){return-1!==t(e,n)}function o(e,n){for(var t=0;t<n.length;t++)r(e,n[t])||e.push(n[t]);return n}function i(e){for(var n=arguments,t=[],r=arguments.length-1;r-- >0;)t[r]=n[r+1];return t=t.map(u),o(e,t)}function a(e){for(var n=arguments,r=[],o=arguments.length-1;o-- >0;)r[o]=n[o+1];return r.map(u).reduce(function(n,r){var o=t(e,r);return-1!==o?n.concat(e.splice(o,1)):n},[])}function u(e,n){if("string"==typeof e)try{return document.querySelector(e)}catch(e){throw e}if(!b(e)&&!n)throw new TypeError(e+" is not a DOM element.");return e}function c(e,t){t=t||{};var r=n(t.allowUpdate,!0);return function(n){if(n=n||window.event,e.target=n.target||n.srcElement||n.originalTarget,e.element=this,e.type=n.type,r(n)){if(n.targetTouches)e.x=n.targetTouches[0].clientX,e.y=n.targetTouches[0].clientY,e.pageX=n.targetTouches[0].pageX,e.pageY=n.targetTouches[0].pageY,e.screenX=n.targetTouches[0].screenX,e.screenY=n.targetTouches[0].screenY;else{if(null===n.pageX&&null!==n.clientX){var t=n.target&&n.target.ownerDocument||document,o=t.documentElement,i=t.body;e.pageX=n.clientX+(o&&o.scrollLeft||i&&i.scrollLeft||0)-(o&&o.clientLeft||i&&i.clientLeft||0),e.pageY=n.clientY+(o&&o.scrollTop||i&&i.scrollTop||0)-(o&&o.clientTop||i&&i.clientTop||0)}else e.pageX=n.pageX,e.pageY=n.pageY;e.x=n.clientX,e.y=n.clientY,e.screenX=n.screenX,e.screenY=n.screenY}e.clientX=e.x,e.clientY=e.y}}}function l(){var e={top:{value:0,enumerable:!0},left:{value:0,enumerable:!0},right:{value:window.innerWidth,enumerable:!0},bottom:{value:window.innerHeight,enumerable:!0},width:{value:window.innerWidth,enumerable:!0},height:{value:window.innerHeight,enumerable:!0},x:{value:0,enumerable:!0},y:{value:0,enumerable:!0}};if(Object.create)return Object.create({},e);var n={};return Object.defineProperties(n,e),n}function f(e){if(e===window)return l();try{var n=e.getBoundingClientRect();return void 0===n.x&&(n.x=n.left,n.y=n.top),n}catch(n){throw new TypeError("Can't call getBoundingClientRect on "+e)}}function d(e,n){var t=f(n);return e.y>t.top&&e.y<t.bottom&&e.x>t.left&&e.x<t.right}function s(e){function n(e){for(var n=0;n<x.length;n++)r[x[n]]=e[x[n]]}function t(){e&&e.removeEventListener("mousemove",n,!1),r=null}var r={screenX:0,screenY:0,clientX:0,clientY:0,ctrlKey:!1,shiftKey:!1,altKey:!1,metaKey:!1,button:0,buttons:1,relatedTarget:null,region:null};return void 0!==e&&e.addEventListener("mousemove",n),{destroy:t,dispatch:function(){return MouseEvent?function(e,n,t){var o=new MouseEvent("mousemove",m(r,n));return v(o,t),e.dispatchEvent(o)}:"function"==typeof document.createEvent?function(e,n,t){var o=m(r,n),i=document.createEvent("MouseEvents");return i.initMouseEvent("mousemove",!0,!0,window,0,o.screenX,o.screenY,o.clientX,o.clientY,o.ctrlKey,o.altKey,o.shiftKey,o.metaKey,o.button,o.relatedTarget),v(i,t),e.dispatchEvent(i)}:"function"==typeof document.createEventObject?function(e,n,t){var o=document.createEventObject(),i=m(r,n);for(var a in i)o[a]=i[a];return v(o,t),e.dispatchEvent(o)}:void 0}()}}function m(e,n){n=n||{};for(var t=T(e),r=0;r<x.length;r++)void 0!==n[x[r]]&&(t[x[r]]=n[x[r]]);return t}function v(e,n){console.log("data ",n),e.data=n||{},e.dispatched="mousemove"}function w(e,t){function o(n){for(var t=0;t<e.length;t++)if(e[t]===n.target){A=!0;break}A&&X(function(){return A=!1})}function u(){M=!0}function l(){M=!1,d()}function d(){Y(q),Y(F)}function m(){M=!1}function v(n){if(!n)return null;if(N===n)return n;if(r(e,n))return n;for(;n=n.parentNode;)if(r(e,n))return n;return null}function w(){for(var n=null,t=0;t<e.length;t++)h(O,e[t])&&(n=e[t]);return n}function p(e){if(x.autoScroll()&&!e.dispatched){var n=e.target,t=document.body;N&&!h(O,N)&&(x.scrollWhenOutside||(N=null)),n&&n.parentNode===t?n=w():(n=v(n))||(n=w()),n&&n!==N&&(N=n),K&&(Y(F),F=X(y)),N&&(Y(q),q=X(g))}}function y(){b(K),Y(F),F=X(y)}function g(){N&&(b(N),Y(q),q=X(g))}function b(e){var n,t,r=f(e);n=O.x<r.left+x.margin?Math.floor(Math.max(-1,(O.x-r.left)/x.margin-1)*x.maxSpeed):O.x>r.right-x.margin?Math.ceil(Math.min(1,(O.x-r.right)/x.margin+1)*x.maxSpeed):0,t=O.y<r.top+x.margin?Math.floor(Math.max(-1,(O.y-r.top)/x.margin-1)*x.maxSpeed):O.y>r.bottom-x.margin?Math.ceil(Math.min(1,(O.y-r.bottom)/x.margin+1)*x.maxSpeed):0,x.syncMove()&&j.dispatch(e,{pageX:O.pageX+n,pageY:O.pageY+t,clientX:O.x+n,clientY:O.y+t}),setTimeout(function(){t&&E(e,t),n&&T(e,n)})}function E(e,n){e===window?window.scrollTo(e.pageXOffset,e.pageYOffset+n):e.scrollTop+=n}function T(e,n){e===window?window.scrollTo(e.pageXOffset+n,e.pageYOffset):e.scrollLeft+=n}void 0===t&&(t={});var x=this,L=4,A=!1;this.margin=t.margin||-1,this.scrollWhenOutside=t.scrollWhenOutside||!1;var O={},S=c(O),j=s(),M=!1;window.addEventListener("mousemove",S,!1),window.addEventListener("touchmove",S,!1),isNaN(t.maxSpeed)||(L=t.maxSpeed),this.autoScroll=n(t.autoScroll),this.syncMove=n(t.syncMove,!1),this.destroy=function(n){window.removeEventListener("mousemove",S,!1),window.removeEventListener("touchmove",S,!1),window.removeEventListener("mousedown",u,!1),window.removeEventListener("touchstart",u,!1),window.removeEventListener("mouseup",l,!1),window.removeEventListener("touchend",l,!1),window.removeEventListener("pointerup",l,!1),window.removeEventListener("mouseleave",m,!1),window.removeEventListener("mousemove",p,!1),window.removeEventListener("touchmove",p,!1),window.removeEventListener("scroll",o,!0),e=[],n&&d()},this.add=function(){for(var n=[],t=arguments.length;t--;)n[t]=arguments[t];return i.apply(void 0,[e].concat(n)),this},this.remove=function(){for(var n=[],t=arguments.length;t--;)n[t]=arguments[t];return a.apply(void 0,[e].concat(n))};var F,K=null;"[object Array]"!==Object.prototype.toString.call(e)&&(e=[e]),function(n){e=[],n.forEach(function(e){e===window?K=window:x.add(e)})}(e),Object.defineProperties(this,{down:{get:function(){return M}},maxSpeed:{get:function(){return L}},point:{get:function(){return O}},scrolling:{get:function(){return A}}});var q,N=null;window.addEventListener("mousedown",u,!1),window.addEventListener("touchstart",u,!1),window.addEventListener("mouseup",l,!1),window.addEventListener("touchend",l,!1),window.addEventListener("pointerup",l,!1),window.addEventListener("mousemove",p,!1),window.addEventListener("touchmove",p,!1),window.addEventListener("mouseleave",m,!1),window.addEventListener("scroll",o,!0)}function p(e,n){return new w(e,n)}function h(e,n,t){return t?e.y>t.top&&e.y<t.bottom&&e.x>t.left&&e.x<t.right:d(e,n)}var y=function(){var e=function(e){return"function"==typeof e},n=function(e){var n=Number(e);return isNaN(n)?0:0!==n&&isFinite(n)?(n>0?1:-1)*Math.floor(Math.abs(n)):n},t=Math.pow(2,53)-1,r=function(e){var r=n(e);return Math.min(Math.max(r,0),t)},o=function(e){if(null!=e){if(["string","number","boolean","symbol"].indexOf(typeof e)>-1)return Symbol.iterator;if("undefined"!=typeof Symbol&&"iterator"in Symbol&&Symbol.iterator in e)return Symbol.iterator;if("@@iterator"in e)return"@@iterator"}},i=function(n,t){if(null!=n&&null!=t){var r=n[t];if(null==r)return;if(!e(r))throw new TypeError(r+" is not a function");return r}},a=function(e){var n=e.next();return!Boolean(n.done)&&n};return function(n){var t,u=this,c=arguments.length>1?arguments[1]:void 0;if(void 0!==c){if(!e(c))throw new TypeError("Array.from: when provided, the second argument must be a function");arguments.length>2&&(t=arguments[2])}var l,f,d=i(n,o(n));if(void 0!==d){l=e(u)?Object(new u):[];var s=d.call(n);if(null==s)throw new TypeError("Array.from requires an array-like or iterable object");f=0;for(var m,v;;){if(!(m=a(s)))return l.length=f,l;v=m.value,l[f]=c?c.call(t,v,f):v,f++}}else{var w=Object(n);if(null==n)throw new TypeError("Array.from requires an array-like object - not null or undefined");var p=r(w.length);l=e(u)?Object(new u(p)):new Array(p),f=0;for(var h;f<p;)h=w[f],l[f]=c?c.call(t,h,f):h,f++;l.length=p}return l}}(),g=("function"==typeof Array.from&&Array.from,Array.isArray,Object.prototype.toString,"function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol?"symbol":typeof e}),b=function(e){return null!=e&&"object"===(void 0===e?"undefined":g(e))&&1===e.nodeType&&"object"===g(e.style)&&"object"===g(e.ownerDocument)},E=void 0;E="function"!=typeof Object.create?function(e){var n=function(){};return function(e,t){if(e!==Object(e)&&null!==e)throw TypeError("Argument must be an object, or null");n.prototype=e||{};var r=new n;return n.prototype=null,void 0!==t&&Object.defineProperties(r,t),null===e&&(r.__proto__=null),r}}():Object.create;var T=E,x=["altKey","button","buttons","clientX","clientY","ctrlKey","metaKey","movementX","movementY","offsetX","offsetY","pageX","pageY","region","relatedTarget","screenX","screenY","shiftKey","which","x","y"],L=["webkit","moz","ms","o"],X=function(){if("undefined"==typeof window)return function(){};for(var e=0,n=L.length;e<n&&!window.requestAnimationFrame;++e)window.requestAnimationFrame=window[L[e]+"RequestAnimationFrame"];if(!window.requestAnimationFrame){var t=0;window.requestAnimationFrame=function(e){var n=(new Date).getTime(),r=Math.max(0,16-n-t),o=window.setTimeout(function(){return e(n+r)},r);return t=n+r,o}}return window.requestAnimationFrame.bind(window)}(),Y=function(){if("undefined"==typeof window)return function(){};for(var e=0,n=L.length;e<n&&!window.cancelAnimationFrame;++e)window.cancelAnimationFrame=window[L[e]+"CancelAnimationFrame"]||window[L[e]+"CancelRequestAnimationFrame"];return window.cancelAnimationFrame||(window.cancelAnimationFrame=function(e){window.clearTimeout(e)}),window.cancelAnimationFrame.bind(window)}();return p}();
{
"name": "@mattlewis92/dom-autoscroller",
"version": "2.3.6",
"version": "2.3.7",
"description": "Auto scroll dom elements",

@@ -5,0 +5,0 @@ "main": "dist/bundle.js",

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

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc