compute-scroll-into-view
Advanced tools
Comparing version 1.0.3 to 1.0.4
@@ -97,6 +97,4 @@ function isElement(el) { | ||
if (scrollMode === 'if-needed' && targetTop >= 0 && targetRight >= 0) { | ||
if (frame === scrollingElement ? targetBottom <= viewportHeight && targetRight <= viewportWidth : targetTop >= top && targetBottom <= bottom && targetLeft >= left && targetRight <= right) { | ||
return computations; | ||
} | ||
if (scrollMode === 'if-needed' && targetTop >= 0 && targetLeft >= 0 && targetBottom <= viewportHeight && targetRight <= viewportWidth && targetTop >= top && targetBottom <= bottom && targetLeft >= left && targetRight <= right) { | ||
return computations; | ||
} | ||
@@ -103,0 +101,0 @@ |
@@ -102,6 +102,4 @@ "use strict"; | ||
if (scrollMode === 'if-needed' && targetTop >= 0 && targetRight >= 0) { | ||
if (frame === scrollingElement ? targetBottom <= viewportHeight && targetRight <= viewportWidth : targetTop >= top && targetBottom <= bottom && targetLeft >= left && targetRight <= right) { | ||
return computations; | ||
} | ||
if (scrollMode === 'if-needed' && targetTop >= 0 && targetLeft >= 0 && targetBottom <= viewportHeight && targetRight <= viewportWidth && targetTop >= top && targetBottom <= bottom && targetLeft >= left && targetRight <= right) { | ||
return computations; | ||
} | ||
@@ -108,0 +106,0 @@ |
@@ -11,3 +11,3 @@ { | ||
}, | ||
"version": "1.0.3", | ||
"version": "1.0.4", | ||
"main": "index.js", | ||
@@ -46,2 +46,3 @@ "module": "es/index.js", | ||
"jest": "23.4.1", | ||
"jest-junit": "5.1.0", | ||
"jest-puppeteer": "3.2.1", | ||
@@ -53,3 +54,3 @@ "lint-staged": "7.2.0", | ||
"rimraf": "2.6.2", | ||
"rollup": "0.63.0", | ||
"rollup": "0.63.2", | ||
"rollup-plugin-babel": "4.0.0-beta.7", | ||
@@ -56,0 +57,0 @@ "rollup-plugin-commonjs": "9.1.3", |
@@ -103,6 +103,4 @@ (function (global, factory) { | ||
if (scrollMode === 'if-needed' && targetTop >= 0 && targetRight >= 0) { | ||
if (frame === scrollingElement ? targetBottom <= viewportHeight && targetRight <= viewportWidth : targetTop >= top && targetBottom <= bottom && targetLeft >= left && targetRight <= right) { | ||
return computations; | ||
} | ||
if (scrollMode === 'if-needed' && targetTop >= 0 && targetLeft >= 0 && targetBottom <= viewportHeight && targetRight <= viewportWidth && targetTop >= top && targetBottom <= bottom && targetLeft >= left && targetRight <= right) { | ||
return computations; | ||
} | ||
@@ -109,0 +107,0 @@ |
@@ -1,1 +0,1 @@ | ||
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?module.exports=t():"function"==typeof define&&define.amd?define(t):e.computeScrollIntoView=t()}(this,function(){"use strict";function e(e){return null!=e&&"object"==typeof e&&(1===e.nodeType||11===e.nodeType)}function t(e,t){return(!t||"hidden"!==e)&&("visible"!==e&&"clip"!==e)}function n(e,n){if(e.clientHeight<e.scrollHeight||e.clientWidth<e.scrollWidth){var i=getComputedStyle(e,null);return t(i.overflowY,n)||t(i.overflowX,n)}return!1}function i(e,t,n,i,o,r,l,d){return r<e&&l>t||r>e&&l<t?0:r<e&&d<n||l>t&&d>n?r-e-i:l>t&&d<n||r<e&&d>n?l-t+o:0}return function(t,o){var r=o.scrollMode,l=o.block,d=o.inline,f=o.boundary,s=o.skipOverflowHiddenElements,h="function"==typeof f?f:function(e){return e!==f};if(!e(t))throw new TypeError("Invalid target");for(var u=document.scrollingElement||document.documentElement,c=[],a=t;e(a)&&h(a);){if((a=a.parentNode||a.host)===u){c.push(a);break}n(a,s)&&c.push(a)}for(var p=window.visualViewport?visualViewport.width:innerWidth,g=window.visualViewport?visualViewport.height:innerHeight,w=window.scrollX||pageXOffset,m=window.scrollY||pageYOffset,v=t.getBoundingClientRect(),b=v.height,y=v.width,W=v.top,H=v.right,I=v.bottom,M=v.left,T="start"===l||"nearest"===l?W:"end"===l?I:W+b/2,V="center"===d?M+y/2:"end"===d?H:M,x=[],C=0;C<c.length;C++){var E=c[C],k=E.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&&H>=0&&(E===u?I<=g&&H<=p:W>=R&&I<=X&&M>=Y&&H<=S))return x;var j=getComputedStyle(E),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 E?E.offsetWidth-E.clientWidth-L-q:0,G="offsetHeight"in E?E.offsetHeight-E.clientHeight-N-z:0;if(u===E)A="start"===l?T:"end"===l?T-g:"nearest"===l?i(m,m+g,g,N,z,m+T,m+T+b,b):T-g/2,D="start"===d?V:"center"===d?V-p/2:"end"===d?V-p:i(w,w+p,p,L,q,w+V,w+V+y,y),A+=m,D+=w;else{A="start"===l?T-R-N:"end"===l?T-X+z+G:"nearest"===l?i(R,X,B,N,z+G,T,T+b,b):T-(R+B/2)+G/2,D="start"===d?V-Y-L:"center"===d?V-(Y+O/2)+F/2:"end"===d?V-S+q+F:i(Y,S,O,L,q+F,V,V+y,y);var J=E.scrollLeft,K=E.scrollTop;T+=K-(A=Math.max(0,Math.min(K+A,E.scrollHeight-B+G))),V+=J-(D=Math.max(0,Math.min(J+D,E.scrollWidth-O+F)))}x.push({el:E,top:A,left:D})}return x}}); | ||
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?module.exports=t():"function"==typeof define&&define.amd?define(t):e.computeScrollIntoView=t()}(this,function(){"use strict";function e(e){return null!=e&&"object"==typeof e&&(1===e.nodeType||11===e.nodeType)}function t(e,t){return(!t||"hidden"!==e)&&("visible"!==e&&"clip"!==e)}function n(e,n){if(e.clientHeight<e.scrollHeight||e.clientWidth<e.scrollWidth){var i=getComputedStyle(e,null);return t(i.overflowY,n)||t(i.overflowX,n)}return!1}function i(e,t,n,i,o,r,l,d){return r<e&&l>t||r>e&&l<t?0:r<e&&d<n||l>t&&d>n?r-e-i:l>t&&d<n||r<e&&d>n?l-t+o:0}return function(t,o){var r=o.scrollMode,l=o.block,d=o.inline,f=o.boundary,s=o.skipOverflowHiddenElements,h="function"==typeof f?f:function(e){return e!==f};if(!e(t))throw new TypeError("Invalid target");for(var u=document.scrollingElement||document.documentElement,c=[],a=t;e(a)&&h(a);){if((a=a.parentNode||a.host)===u){c.push(a);break}n(a,s)&&c.push(a)}for(var p=window.visualViewport?visualViewport.width:innerWidth,g=window.visualViewport?visualViewport.height:innerHeight,w=window.scrollX||pageXOffset,m=window.scrollY||pageYOffset,v=t.getBoundingClientRect(),b=v.height,y=v.width,W=v.top,H=v.right,I=v.bottom,M=v.left,T="start"===l||"nearest"===l?W:"end"===l?I:W+b/2,V="center"===d?M+y/2:"end"===d?H:M,x=[],C=0;C<c.length;C++){var E=c[C],k=E.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&&M>=0&&I<=g&&H<=p&&W>=R&&I<=X&&M>=Y&&H<=S)return x;var j=getComputedStyle(E),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 E?E.offsetWidth-E.clientWidth-L-q:0,G="offsetHeight"in E?E.offsetHeight-E.clientHeight-N-z:0;if(u===E)A="start"===l?T:"end"===l?T-g:"nearest"===l?i(m,m+g,g,N,z,m+T,m+T+b,b):T-g/2,D="start"===d?V:"center"===d?V-p/2:"end"===d?V-p:i(w,w+p,p,L,q,w+V,w+V+y,y),A+=m,D+=w;else{A="start"===l?T-R-N:"end"===l?T-X+z+G:"nearest"===l?i(R,X,B,N,z+G,T,T+b,b):T-(R+B/2)+G/2,D="start"===d?V-Y-L:"center"===d?V-(Y+O/2)+F/2:"end"===d?V-S+q+F:i(Y,S,O,L,q+F,V,V+y,y);var J=E.scrollLeft,K=E.scrollTop;T+=K-(A=Math.max(0,Math.min(K+A,E.scrollHeight-B+G))),V+=J-(D=Math.max(0,Math.min(J+D,E.scrollWidth-O+F)))}x.push({el:E,top:A,left:D})}return x}}); |
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
33103
28
482