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

compute-scroll-into-view

Package Overview
Dependencies
Maintainers
1
Versions
32
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

compute-scroll-into-view - npm Package Compare versions

Comparing version 1.0.7 to 1.0.8

4

es/index.js
function isElement(el) {
return el != null && typeof el === 'object' && (el.nodeType === 1 || el.nodeType === 11);
return el != null && typeof el === 'object' && el.nodeType === 1;
}

@@ -57,3 +57,3 @@

while (isElement(cursor) && checkBoundary(cursor)) {
cursor = cursor.parentNode || cursor.host;
cursor = cursor.parentNode;

@@ -60,0 +60,0 @@ if (cursor === scrollingElement) {

@@ -7,3 +7,3 @@ "use strict";

function isElement(el) {
return el != null && typeof el === 'object' && (el.nodeType === 1 || el.nodeType === 11);
return el != null && typeof el === 'object' && el.nodeType === 1;
}

@@ -63,3 +63,3 @@

while (isElement(cursor) && checkBoundary(cursor)) {
cursor = cursor.parentNode || cursor.host;
cursor = cursor.parentNode;

@@ -66,0 +66,0 @@ if (cursor === scrollingElement) {

@@ -11,3 +11,3 @@ {

},
"version": "1.0.7",
"version": "1.0.8",
"main": "index.js",

@@ -36,30 +36,30 @@ "module": "es/index.js",

"devDependencies": {
"@babel/cli": "7.0.0-beta.54",
"@babel/core": "7.0.0-beta.54",
"@babel/plugin-external-helpers": "7.0.0-beta.54",
"@babel/preset-env": "7.0.0-beta.54",
"@babel/preset-typescript": "7.0.0-beta.54",
"@babel/cli": "7.0.0-rc.1",
"@babel/core": "7.0.0-rc.1",
"@babel/plugin-external-helpers": "7.0.0-rc.1",
"@babel/preset-env": "7.0.0-rc.1",
"@babel/preset-typescript": "7.0.0-rc.1",
"babel-plugin-add-module-exports": "0.2.1",
"babel-plugin-dev-expression": "0.2.1",
"concurrently": "3.6.0",
"concurrently": "3.6.1",
"husky": "0.14.3",
"jest": "23.4.1",
"jest": "23.5.0",
"jest-junit": "5.1.0",
"jest-puppeteer": "3.2.1",
"lint-staged": "7.2.0",
"prettier": "1.13.7",
"prettier-package-json": "1.6.0",
"puppeteer": "1.6.0",
"lint-staged": "7.2.2",
"prettier": "1.14.2",
"prettier-package-json": "2.0.0",
"puppeteer": "1.7.0",
"rimraf": "2.6.2",
"rollup": "0.63.4",
"rollup-plugin-babel": "4.0.0-beta.7",
"rollup-plugin-commonjs": "9.1.3",
"rollup": "0.64.1",
"rollup-plugin-babel": "4.0.0-beta.8",
"rollup-plugin-commonjs": "9.1.5",
"rollup-plugin-node-resolve": "3.3.0",
"rollup-plugin-replace": "2.0.0",
"rollup-plugin-terser": "1.0.1",
"semantic-release": "15.8.1",
"serve": "9.3.0",
"semantic-release": "15.9.8",
"serve": "9.4.2",
"tslint": "5.11.0",
"tslint-config-prettier": "1.14.0",
"typescript": "2.9.2"
"typescript": "3.0.1"
},

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

@@ -8,5 +8,2 @@ declare global {

}
interface Element {
host: any;
}
}

@@ -13,0 +10,0 @@ declare type ScrollLogicalPosition = 'start' | 'center' | 'end' | 'nearest';

@@ -8,3 +8,3 @@ (function (global, factory) {

function isElement(el) {
return el != null && typeof el === 'object' && (el.nodeType === 1 || el.nodeType === 11);
return el != null && typeof el === 'object' && el.nodeType === 1;
}

@@ -64,3 +64,3 @@

while (isElement(cursor) && checkBoundary(cursor)) {
cursor = cursor.parentNode || cursor.host;
cursor = cursor.parentNode;

@@ -67,0 +67,0 @@ if (cursor === scrollingElement) {

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

!function(t,e){"object"==typeof exports&&"undefined"!=typeof module?module.exports=e():"function"==typeof define&&define.amd?define(e):t.computeScrollIntoView=e()}(this,function(){"use strict";function t(t){return null!=t&&"object"==typeof t&&(1===t.nodeType||11===t.nodeType)}function e(t,e){return(!e||"hidden"!==t)&&("visible"!==t&&"clip"!==t)}function n(t,n){if(t.clientHeight<t.scrollHeight||t.clientWidth<t.scrollWidth){var o=getComputedStyle(t,null);return e(o.overflowY,n)||e(o.overflowX,n)}return!1}function o(t,e,n,o,i,r,d,l){return r<t&&d>e||r>t&&d<e?0:r<t&&l<n||d>e&&l>n?r-t-o:d>e&&l<n||r<t&&l>n?d-e+i:0}return function(e,i){var r=i.scrollMode,d=i.block,l=i.inline,f=i.boundary,s=i.skipOverflowHiddenElements,h="function"==typeof f?f:function(t){return t!==f};if(!t(e))throw new TypeError("Invalid target");for(var u=document.scrollingElement||document.documentElement,c=[],a=e;t(a)&&h(a);){if((a=a.parentNode||a.host)===u){c.push(a);break}a===document.body&&n(a)&&!n(document.documentElement)||n(a,s)&&c.push(a)}for(var p=window.visualViewport?visualViewport.width:innerWidth,m=window.visualViewport?visualViewport.height:innerHeight,g=window.scrollX||pageXOffset,w=window.scrollY||pageYOffset,v=e.getBoundingClientRect(),b=v.height,y=v.width,W=v.top,H=v.right,M=v.bottom,x=v.left,I="start"===d||"nearest"===d?W:"end"===d?M:W+b/2,E="center"===l?x+y/2:"end"===l?H:x,T=[],V=0;V<c.length;V++){var C=c[V],k=C.getBoundingClientRect(),B=k.height,O=k.width,R=k.top,S=k.right,X=k.bottom,Y=k.left;if("if-needed"===r&&W>=0&&x>=0&&M<=m&&H<=p&&W>=R&&M<=X&&x>=Y&&H<=S)return T;var j=getComputedStyle(C),L=parseInt(j.borderLeftWidth,10),N=parseInt(j.borderTopWidth,10),q=parseInt(j.borderRightWidth,10),z=parseInt(j.borderBottomWidth,10),A=0,D=0,F="offsetWidth"in C?C.offsetWidth-C.clientWidth-L-q:0,G="offsetHeight"in C?C.offsetHeight-C.clientHeight-N-z:0;if(u===C)A="start"===d?I:"end"===d?I-m:"nearest"===d?o(w,w+m,m,N,z,w+I,w+I+b,b):I-m/2,D="start"===l?E:"center"===l?E-p/2:"end"===l?E-p:o(g,g+p,p,L,q,g+E,g+E+y,y),A=Math.max(0,A+w),D=Math.max(0,D+g);else{A="start"===d?I-R-N:"end"===d?I-X+z+G:"nearest"===d?o(R,X,B,N,z+G,I,I+b,b):I-(R+B/2)+G/2,D="start"===l?E-Y-L:"center"===l?E-(Y+O/2)+F/2:"end"===l?E-S+q+F:o(Y,S,O,L,q+F,E,E+y,y);var J=C.scrollLeft,K=C.scrollTop;I+=K-(A=Math.max(0,Math.min(K+A,C.scrollHeight-B+G))),E+=J-(D=Math.max(0,Math.min(J+D,C.scrollWidth-O+F)))}T.push({el:C,top:A,left:D})}return T}});
!function(t,e){"object"==typeof exports&&"undefined"!=typeof module?module.exports=e():"function"==typeof define&&define.amd?define(e):t.computeScrollIntoView=e()}(this,function(){"use strict";function t(t){return null!=t&&"object"==typeof t&&1===t.nodeType}function e(t,e){return(!e||"hidden"!==t)&&("visible"!==t&&"clip"!==t)}function n(t,n){if(t.clientHeight<t.scrollHeight||t.clientWidth<t.scrollWidth){var i=getComputedStyle(t,null);return e(i.overflowY,n)||e(i.overflowX,n)}return!1}function i(t,e,n,i,o,r,d,l){return r<t&&d>e||r>t&&d<e?0:r<t&&l<n||d>e&&l>n?r-t-i:d>e&&l<n||r<t&&l>n?d-e+o:0}return function(e,o){var r=o.scrollMode,d=o.block,l=o.inline,f=o.boundary,s=o.skipOverflowHiddenElements,u="function"==typeof f?f:function(t){return t!==f};if(!t(e))throw new TypeError("Invalid target");for(var h=document.scrollingElement||document.documentElement,c=[],a=e;t(a)&&u(a);){if((a=a.parentNode)===h){c.push(a);break}a===document.body&&n(a)&&!n(document.documentElement)||n(a,s)&&c.push(a)}for(var p=window.visualViewport?visualViewport.width:innerWidth,m=window.visualViewport?visualViewport.height:innerHeight,g=window.scrollX||pageXOffset,w=window.scrollY||pageYOffset,v=e.getBoundingClientRect(),b=v.height,y=v.width,W=v.top,H=v.right,M=v.bottom,x=v.left,I="start"===d||"nearest"===d?W:"end"===d?M:W+b/2,E="center"===l?x+y/2:"end"===l?H:x,V=[],C=0;C<c.length;C++){var T=c[C],k=T.getBoundingClientRect(),B=k.height,O=k.width,R=k.top,S=k.right,X=k.bottom,Y=k.left;if("if-needed"===r&&W>=0&&x>=0&&M<=m&&H<=p&&W>=R&&M<=X&&x>=Y&&H<=S)return V;var j=getComputedStyle(T),L=parseInt(j.borderLeftWidth,10),N=parseInt(j.borderTopWidth,10),q=parseInt(j.borderRightWidth,10),z=parseInt(j.borderBottomWidth,10),A=0,D=0,F="offsetWidth"in T?T.offsetWidth-T.clientWidth-L-q:0,G="offsetHeight"in T?T.offsetHeight-T.clientHeight-N-z:0;if(h===T)A="start"===d?I:"end"===d?I-m:"nearest"===d?i(w,w+m,m,N,z,w+I,w+I+b,b):I-m/2,D="start"===l?E:"center"===l?E-p/2:"end"===l?E-p:i(g,g+p,p,L,q,g+E,g+E+y,y),A=Math.max(0,A+w),D=Math.max(0,D+g);else{A="start"===d?I-R-N:"end"===d?I-X+z+G:"nearest"===d?i(R,X,B,N,z+G,I,I+b,b):I-(R+B/2)+G/2,D="start"===l?E-Y-L:"center"===l?E-(Y+O/2)+F/2:"end"===l?E-S+q+F:i(Y,S,O,L,q+F,E,E+y,y);var J=T.scrollLeft,K=T.scrollTop;I+=K-(A=Math.max(0,Math.min(K+A,T.scrollHeight-B+G))),E+=J-(D=Math.max(0,Math.min(J+D,T.scrollWidth-O+F)))}V.push({el:T,top:A,left:D})}return V}});
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