compute-scroll-into-view
Advanced tools
Comparing version 1.0.2 to 1.0.3
@@ -98,3 +98,3 @@ function isElement(el) { | ||
if (scrollMode === 'if-needed' && targetTop >= 0 && targetRight >= 0) { | ||
if (frame === scrollingElement ? targetBottom <= viewportHeight && targetLeft <= viewportWidth : targetTop >= top && targetBottom <= bottom) { | ||
if (frame === scrollingElement ? targetBottom <= viewportHeight && targetRight <= viewportWidth : targetTop >= top && targetBottom <= bottom && targetLeft >= left && targetRight <= right) { | ||
return computations; | ||
@@ -101,0 +101,0 @@ } |
@@ -103,3 +103,3 @@ "use strict"; | ||
if (scrollMode === 'if-needed' && targetTop >= 0 && targetRight >= 0) { | ||
if (frame === scrollingElement ? targetBottom <= viewportHeight && targetLeft <= viewportWidth : targetTop >= top && targetBottom <= bottom) { | ||
if (frame === scrollingElement ? targetBottom <= viewportHeight && targetRight <= viewportWidth : targetTop >= top && targetBottom <= bottom && targetLeft >= left && targetRight <= right) { | ||
return computations; | ||
@@ -106,0 +106,0 @@ } |
@@ -11,3 +11,3 @@ { | ||
}, | ||
"version": "1.0.2", | ||
"version": "1.0.3", | ||
"main": "index.js", | ||
@@ -32,10 +32,11 @@ "module": "es/index.js", | ||
"prepublishOnly": "unset npm_config_cafile && yarn build", | ||
"test": "jest -c integration/jest.config.js", | ||
"typecheck": "tsc --noEmit" | ||
}, | ||
"devDependencies": { | ||
"@babel/cli": "7.0.0-beta.51", | ||
"@babel/core": "7.0.0-beta.51", | ||
"@babel/plugin-external-helpers": "7.0.0-beta.51", | ||
"@babel/preset-env": "7.0.0-beta.51", | ||
"@babel/preset-typescript": "7.0.0-beta.51", | ||
"@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-plugin-add-module-exports": "0.2.1", | ||
@@ -45,8 +46,11 @@ "babel-plugin-dev-expression": "0.2.1", | ||
"husky": "0.14.3", | ||
"jest": "23.4.1", | ||
"jest-puppeteer": "3.2.1", | ||
"lint-staged": "7.2.0", | ||
"prettier": "1.13.7", | ||
"prettier-package-json": "1.6.0", | ||
"puppeteer": "1.6.0", | ||
"rimraf": "2.6.2", | ||
"rollup": "0.61.2", | ||
"rollup-plugin-babel": "4.0.0-beta.5", | ||
"rollup": "0.63.0", | ||
"rollup-plugin-babel": "4.0.0-beta.7", | ||
"rollup-plugin-commonjs": "9.1.3", | ||
@@ -56,4 +60,5 @@ "rollup-plugin-node-resolve": "3.3.0", | ||
"rollup-plugin-terser": "1.0.1", | ||
"semantic-release": "15.6.0", | ||
"tslint": "5.10.0", | ||
"semantic-release": "15.8.0", | ||
"serve": "9.2.0", | ||
"tslint": "5.11.0", | ||
"tslint-config-prettier": "1.13.0", | ||
@@ -60,0 +65,0 @@ "typescript": "2.9.2" |
@@ -104,3 +104,3 @@ (function (global, factory) { | ||
if (scrollMode === 'if-needed' && targetTop >= 0 && targetRight >= 0) { | ||
if (frame === scrollingElement ? targetBottom <= viewportHeight && targetLeft <= viewportWidth : targetTop >= top && targetBottom <= bottom) { | ||
if (frame === scrollingElement ? targetBottom <= viewportHeight && targetRight <= viewportWidth : targetTop >= top && targetBottom <= bottom && targetLeft >= left && targetRight <= right) { | ||
return computations; | ||
@@ -107,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&&M<=p:W>=R&&I<=X))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&&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}}); |
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
33234
488
27