Socket
Socket
Sign inDemoInstall

scroll-into-view-if-needed

Package Overview
Dependencies
Maintainers
1
Versions
83
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

scroll-into-view-if-needed - npm Package Compare versions

Comparing version 2.2.11 to 2.2.12

3

index.js

@@ -66,2 +66,3 @@ "use strict";

var _default = scrollIntoView;
exports.default = _default;
exports.default = _default;
module.exports = exports.default;

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

},
"version": "2.2.11",
"version": "2.2.12",
"main": "index.js",

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

"dependencies": {
"compute-scroll-into-view": "1.0.2"
"compute-scroll-into-view": "1.0.3"
},
"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-eslint": "8.2.5",
"babel-plugin-add-module-exports": "0.3.1",
"@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-eslint": "8.2.6",
"babel-plugin-add-module-exports": "0.3.2",
"babel-plugin-dev-expression": "0.2.1",

@@ -59,3 +59,3 @@ "concurrently": "3.6.0",

"rimraf": "2.6.2",
"rollup": "0.62.0",
"rollup": "0.63.0",
"rollup-plugin-babel": "4.0.0-beta.7",

@@ -66,4 +66,4 @@ "rollup-plugin-commonjs": "9.1.3",

"rollup-plugin-terser": "1.0.1",
"semantic-release": "15.6.3",
"tslint": "5.10.0",
"semantic-release": "15.8.0",
"tslint": "5.11.0",
"tslint-config-prettier": "1.13.0",

@@ -70,0 +70,0 @@ "typescript": "2.9.2"

@@ -195,3 +195,3 @@ [![CircleCI Status](https://img.shields.io/circleci/project/github/stipsan/scroll-into-view-if-needed.svg?style=flat-square)](https://circleci.com/gh/stipsan/scroll-into-view-if-needed)

Check the demo to see an [example with popmotion and a spring transition](https://scroll-into-view-if-needed.netlify.com/#override-behavior).
Check the demo to see an [example with popmotion and a spring transition](https://scroll-into-view-if-needed.netlify.com/#custom-transition).

@@ -198,0 +198,0 @@ > If you only need the custom behavior you might be better off by using the compute library directly: https://github.com/stipsan/compute-scroll-into-view

@@ -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.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&&I<=p:W>=C&&k<=R))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&&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)}});
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