scroll-into-view-if-needed
Advanced tools
Comparing version 2.2.12 to 2.2.13
@@ -11,3 +11,3 @@ { | ||
}, | ||
"version": "2.2.12", | ||
"version": "2.2.13", | ||
"main": "index.js", | ||
@@ -36,3 +36,3 @@ "module": "es/index.js", | ||
"dependencies": { | ||
"compute-scroll-into-view": "1.0.3" | ||
"compute-scroll-into-view": "1.0.4" | ||
}, | ||
@@ -59,3 +59,3 @@ "devDependencies": { | ||
"rimraf": "2.6.2", | ||
"rollup": "0.63.0", | ||
"rollup": "0.63.2", | ||
"rollup-plugin-babel": "4.0.0-beta.7", | ||
@@ -62,0 +62,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.scrollIntoView=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 o=getComputedStyle(e,null);return t(o.overflowY,n)||t(o.overflowX,n)}return!1}function o(e,t,n,o,r,i,l,d){return i<e&&l>t||i>e&&l<t?0:i<e&&d<n||l>t&&d>n?i-e-o:l>t&&d<n||i<e&&d>n?l-t+r:0}var r=function(t,r){var i=r.scrollMode,l=r.block,d=r.inline,f=r.boundary,s=r.skipOverflowHiddenElements,c="function"==typeof f?f:function(e){return e!==f};if(!e(t))throw new TypeError("Invalid target");for(var u=document.scrollingElement||document.documentElement,a=[],h=t;e(h)&&c(h);){if((h=h.parentNode||h.host)===u){a.push(h);break}n(h,s)&&a.push(h)}for(var p=window.visualViewport?visualViewport.width:innerWidth,v=window.visualViewport?visualViewport.height:innerHeight,g=window.scrollX||pageXOffset,b=window.scrollY||pageYOffset,w=t.getBoundingClientRect(),m=w.height,y=w.width,W=w.top,H=w.right,k=w.bottom,I=w.left,T="start"===l||"nearest"===l?W:"end"===l?k:W+m/2,E="center"===d?I+y/2:"end"===d?H:I,M=[],O=0;O<a.length;O++){var V=a[O],j=V.getBoundingClientRect(),x=j.height,B=j.width,C=j.top,L=j.right,R=j.bottom,X=j.left;if("if-needed"===i&&W>=0&&H>=0&&(V===u?k<=v&&H<=p:W>=C&&k<=R&&I>=X&&H<=L))return M;var Y=getComputedStyle(V),S=parseInt(Y.borderLeftWidth,10),N=parseInt(Y.borderTopWidth,10),q=parseInt(Y.borderRightWidth,10),z=parseInt(Y.borderBottomWidth,10),A=0,D=0,F="offsetWidth"in V?V.offsetWidth-V.clientWidth-S-q:0,G="offsetHeight"in V?V.offsetHeight-V.clientHeight-N-z:0;if(u===V)A="start"===l?T:"end"===l?T-v:"nearest"===l?o(b,b+v,v,N,z,b+T,b+T+m,m):T-v/2,D="start"===d?E:"center"===d?E-p/2:"end"===d?E-p:o(g,g+p,p,S,q,g+E,g+E+y,y),A+=b,D+=g;else{A="start"===l?T-C-N:"end"===l?T-R+z+G:"nearest"===l?o(C,R,x,N,z+G,T,T+m,m):T-(C+x/2)+G/2,D="start"===d?E-X-S:"center"===d?E-(X+B/2)+F/2:"end"===d?E-L+q+F:o(X,L,B,S,q+F,E,E+y,y);var J=V.scrollLeft,K=V.scrollTop;T+=K-(A=Math.max(0,Math.min(K+A,V.scrollHeight-x+G))),E+=J-(D=Math.max(0,Math.min(J+D,V.scrollWidth-B+F)))}M.push({el:V,top:A,left:D})}return M};function i(e){return e===Object(e)&&0!==Object.keys(e).length}return function(e,t){if(i(t)&&"function"==typeof t.behavior)return t.behavior(r(e,t));var n=function(e){return!1===e?{block:"end",inline:"nearest"}:i(e)?e:{block:"start",inline:"nearest"}}(t);return function(e,t){void 0===t&&(t="auto");var n="scrollBehavior"in document.body.style;e.forEach(function(e){var o=e.el,r=e.top,i=e.left;o.scroll&&n?o.scroll({top:r,left:i,behavior:t}):(o.scrollTop=r,o.scrollLeft=i)})}(r(e,n),n.behavior)}}); | ||
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?module.exports=t():"function"==typeof define&&define.amd?define(t):e.scrollIntoView=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 o=getComputedStyle(e,null);return t(o.overflowY,n)||t(o.overflowX,n)}return!1}function o(e,t,n,o,r,i,l,d){return i<e&&l>t||i>e&&l<t?0:i<e&&d<n||l>t&&d>n?i-e-o:l>t&&d<n||i<e&&d>n?l-t+r:0}var r=function(t,r){var i=r.scrollMode,l=r.block,d=r.inline,f=r.boundary,s=r.skipOverflowHiddenElements,c="function"==typeof f?f:function(e){return e!==f};if(!e(t))throw new TypeError("Invalid target");for(var u=document.scrollingElement||document.documentElement,a=[],h=t;e(h)&&c(h);){if((h=h.parentNode||h.host)===u){a.push(h);break}n(h,s)&&a.push(h)}for(var p=window.visualViewport?visualViewport.width:innerWidth,v=window.visualViewport?visualViewport.height:innerHeight,g=window.scrollX||pageXOffset,b=window.scrollY||pageYOffset,w=t.getBoundingClientRect(),m=w.height,y=w.width,W=w.top,H=w.right,k=w.bottom,I=w.left,T="start"===l||"nearest"===l?W:"end"===l?k:W+m/2,E="center"===d?I+y/2:"end"===d?H:I,M=[],O=0;O<a.length;O++){var V=a[O],j=V.getBoundingClientRect(),x=j.height,B=j.width,C=j.top,L=j.right,R=j.bottom,X=j.left;if("if-needed"===i&&W>=0&&I>=0&&k<=v&&H<=p&&W>=C&&k<=R&&I>=X&&H<=L)return M;var Y=getComputedStyle(V),S=parseInt(Y.borderLeftWidth,10),N=parseInt(Y.borderTopWidth,10),q=parseInt(Y.borderRightWidth,10),z=parseInt(Y.borderBottomWidth,10),A=0,D=0,F="offsetWidth"in V?V.offsetWidth-V.clientWidth-S-q:0,G="offsetHeight"in V?V.offsetHeight-V.clientHeight-N-z:0;if(u===V)A="start"===l?T:"end"===l?T-v:"nearest"===l?o(b,b+v,v,N,z,b+T,b+T+m,m):T-v/2,D="start"===d?E:"center"===d?E-p/2:"end"===d?E-p:o(g,g+p,p,S,q,g+E,g+E+y,y),A+=b,D+=g;else{A="start"===l?T-C-N:"end"===l?T-R+z+G:"nearest"===l?o(C,R,x,N,z+G,T,T+m,m):T-(C+x/2)+G/2,D="start"===d?E-X-S:"center"===d?E-(X+B/2)+F/2:"end"===d?E-L+q+F:o(X,L,B,S,q+F,E,E+y,y);var J=V.scrollLeft,K=V.scrollTop;T+=K-(A=Math.max(0,Math.min(K+A,V.scrollHeight-x+G))),E+=J-(D=Math.max(0,Math.min(J+D,V.scrollWidth-B+F)))}M.push({el:V,top:A,left:D})}return M};function i(e){return e===Object(e)&&0!==Object.keys(e).length}return function(e,t){if(i(t)&&"function"==typeof t.behavior)return t.behavior(r(e,t));var n=function(e){return!1===e?{block:"end",inline:"nearest"}:i(e)?e:{block:"start",inline:"nearest"}}(t);return function(e,t){void 0===t&&(t="auto");var n="scrollBehavior"in document.body.style;e.forEach(function(e){var o=e.el,r=e.top,i=e.left;o.scroll&&n?o.scroll({top:r,left:i,behavior:t}):(o.scrollTop=r,o.scrollLeft=i)})}(r(e,n),n.behavior)}}); |
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
45679
339
+ Addedcompute-scroll-into-view@1.0.4(transitive)
- Removedcompute-scroll-into-view@1.0.3(transitive)