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.10 to 1.0.11

2

es/index.js

@@ -27,3 +27,3 @@ function isElement(el) {

if (elementEdgeStart < scrollingEdgeStart && elementSize < scrollingSize || elementEdgeEnd > scrollingEdgeEnd && elementSize > scrollingSize) {
if (elementEdgeStart <= scrollingEdgeStart && elementSize <= scrollingSize || elementEdgeEnd >= scrollingEdgeEnd && elementSize >= scrollingSize) {
return elementEdgeStart - scrollingEdgeStart - scrollingBorderStart;

@@ -30,0 +30,0 @@ }

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

if (elementEdgeStart < scrollingEdgeStart && elementSize < scrollingSize || elementEdgeEnd > scrollingEdgeEnd && elementSize > scrollingSize) {
if (elementEdgeStart <= scrollingEdgeStart && elementSize <= scrollingSize || elementEdgeEnd >= scrollingEdgeEnd && elementSize >= scrollingSize) {
return elementEdgeStart - scrollingEdgeStart - scrollingBorderStart;

@@ -35,0 +35,0 @@ }

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

},
"version": "1.0.10",
"version": "1.0.11",
"main": "index.js",

@@ -57,3 +57,3 @@ "module": "es/index.js",

"rollup-plugin-node-resolve": "3.4.0",
"rollup-plugin-replace": "2.0.0",
"rollup-plugin-replace": "2.1.0",
"rollup-plugin-terser": "3.0.0",

@@ -60,0 +60,0 @@ "semantic-release": "15.9.17",

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

if (elementEdgeStart < scrollingEdgeStart && elementSize < scrollingSize || elementEdgeEnd > scrollingEdgeEnd && elementSize > scrollingSize) {
if (elementEdgeStart <= scrollingEdgeStart && elementSize <= scrollingSize || elementEdgeEnd >= scrollingEdgeEnd && elementSize >= scrollingSize) {
return elementEdgeStart - scrollingEdgeStart - scrollingBorderStart;

@@ -36,0 +36,0 @@ }

@@ -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}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}});
!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