Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

scroll-into-view

Package Overview
Dependencies
Maintainers
1
Versions
50
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

scroll-into-view - npm Package Compare versions

Comparing version 1.9.6 to 1.9.7

137

CHANGELOG.md
## 1.9.6 - Fri Apr 19 2019
Add files via upload - [650af702](Kory Nunn@650af7020db3a72198f2fc5c4efa823ab701a337)
Fire 'complete' even if no elements are scrolled - [902069a2](Kory Nunn@902069a2fd1306f425b520213578c4019da31294)
## 1.9.5 - Fri Mar 22 2019
Add changelog on precommit - 26489fc22c58988240567213e010803a107e3666
Add changelog on precommit - [26489fc2](korynunn@26489fc22c58988240567213e010803a107e3666)

@@ -9,7 +16,7 @@

Added backers and sponsors on the README - 8bb98847f59b3c37ed479adbab7cac2c6800e56f
Added backers and sponsors on the README - [8bb98847](Jess@8bb98847f59b3c37ed479adbab7cac2c6800e56f)
Added call to donate after npm install (optional) - 6d6b4805f5fb14e9055a06087d63fa1579f6b220
Added call to donate after npm install (optional) - [6d6b4805](Jess@6d6b4805f5fb14e9055a06087d63fa1579f6b220)
Manual scroll should cancel/override scrollIntoView. Fixes #58. - d9a86baca2c4bc87c3e6e430495c99b150802b31
Manual scroll should cancel/override scrollIntoView. Fixes #58. - [d9a86bac](Dane David@d9a86baca2c4bc87c3e6e430495c99b150802b31)

@@ -19,3 +26,3 @@

Fixes #10 - 712cd28432dd634e2899719e929ec3fbcd0fb350
Fixes #10 - [712cd284](Kory Nunn@712cd28432dd634e2899719e929ec3fbcd0fb350)

@@ -25,11 +32,11 @@

Update package.json license to be consistent with license in project. Add note within readme about IE11 compatability with method used - b027edfafa183117a8a2ef8bbbf566a0b70440e9
Update package.json license to be consistent with license in project. Add note within readme about IE11 compatability with method used - [b027edfa](Marcus Wood@b027edfafa183117a8a2ef8bbbf566a0b70440e9)
update readme - a710fc2ab8c6253b579018ade3b9625c4677c3e6
update readme - [a710fc2a](mwood23@a710fc2ab8c6253b579018ade3b9625c4677c3e6)
Change to ms prefixed method - 369a510abade9059b3027222e1b84b541a3e98f3
Change to ms prefixed method - [369a510a](mwood23@369a510abade9059b3027222e1b84b541a3e98f3)
Added tests for 0 time (instant) scroll. - 34c32a40df77e8f50989e1b3f4cef423327746d2
Added tests for 0 time (instant) scroll. - [34c32a40](Kory Nunn@34c32a40df77e8f50989e1b3f4cef423327746d2)
Added passive: true to handlers - 772d67b4f31bb2d1d2c5d94548bc64b03afa3633
Added passive: true to handlers - [772d67b4](Kory Nunn@772d67b4f31bb2d1d2c5d94548bc64b03afa3633)

@@ -39,11 +46,11 @@

Added logo - dd6b970852c321ed5bc39c6caa28ccd55827f64b
Added logo - [dd6b9708](Kory Nunn@dd6b970852c321ed5bc39c6caa28ccd55827f64b)
Correct logo - 2db2f10ec83186e54a658f3b7fcf7d50d151fbef
Correct logo - [2db2f10e](Kory Nunn@2db2f10ec83186e54a658f3b7fcf7d50d151fbef)
feat: Add iframe support - f667da5456f8c1f58335a15aa13f700fd87bbbe5
feat: Add iframe support - [f667da54](Craig Michael Thompson@f667da5456f8c1f58335a15aa13f700fd87bbbe5)
Change to .self check instead of pageXOffset - 307f257e23cd93541e1e2011278dfa51202b0a89
Change to .self check instead of pageXOffset - [307f257e](Craig Michael Thompson@307f257e23cd93541e1e2011278dfa51202b0a89)
Fixed iframe usage - 29f4f9c5d41a5e33a921259cf7862b9bc7780e55
Fixed iframe usage - [29f4f9c5](Kory Nunn@29f4f9c5d41a5e33a921259cf7862b9bc7780e55)

@@ -53,9 +60,9 @@

settings.validScrollable - 8519abbdbacd5e2297ef66cb0b79180b073dccdc
settings.validScrollable - [8519abbd](Vladimir Barbarosh@8519abbdbacd5e2297ef66cb0b79180b073dccdc)
add test for validScrollable - 0bf72315c349b5a7592a2bd0e5adaa6d1230a20b
add test for validScrollable - [0bf72315](Vladimir Barbarosh@0bf72315c349b5a7592a2bd0e5adaa6d1230a20b)
move check for firefox outside of queue fn - 5ab285688752389d90799090d1fa6e8bf352af40
move check for firefox outside of queue fn - [5ab28568](Vladimir Barbarosh@5ab285688752389d90799090d1fa6e8bf352af40)
Pulled in vbarbarosh's changes, added isScrollable api - 2cd148fce31020c00a6216010c0e7bbb366bdade
Pulled in vbarbarosh's changes, added isScrollable api - [2cd148fc](Kory Nunn@2cd148fce31020c00a6216010c0e7bbb366bdade)

@@ -65,3 +72,3 @@

Fixed absolute positioning bug - 4ab91e7b5c4ec4469fad4a53d2f4f75304f3ff67
Fixed absolute positioning bug - [4ab91e7b](Kory Nunn@4ab91e7b5c4ec4469fad4a53d2f4f75304f3ff67)

@@ -71,3 +78,3 @@

Added built version - 4c78837d2d1b2031fd602bbc765b4250738616c8
Added built version - [4c78837d](Kory Nunn@4c78837d2d1b2031fd602bbc765b4250738616c8)

@@ -77,3 +84,3 @@

Fixed wrong variable name issue - db153b509cefbcd95d587e18287ead84f71c15ec
Fixed wrong variable name issue - [db153b50](Kory Nunn@db153b509cefbcd95d587e18287ead84f71c15ec)

@@ -83,11 +90,11 @@

Set fixed header height - 5ac918bb2b11b15da9614d5059202f6ba80be38f
Set fixed header height - [5ac918bb](Eric van Riet Paap@5ac918bb2b11b15da9614d5059202f6ba80be38f)
align.leftOffset & align.topOffset can by used - 94d53223ca3b02bf62a92c19f310c5010a84ad80
align.leftOffset & align.topOffset can by used - [94d53223](Eric van Riet Paap@94d53223ca3b02bf62a92c19f310c5010a84ad80)
Normalize offsets like align.top and friends - 998bb172330df69eb20d6192c0988586b2e3df53
Normalize offsets like align.top and friends - [998bb172](Eric van Riet Paap@998bb172330df69eb20d6192c0988586b2e3df53)
Document topOffset and leftOffset - 2b134148f6ae28463dc39b9d47616a5672da0012
Document topOffset and leftOffset - [2b134148](Eric van Riet Paap@2b134148f6ae28463dc39b9d47616a5672da0012)
made pixel offset - 628a4b822749a5b23813def58e77e9aec2ef2e74
made pixel offset - [628a4b82](Kory Nunn@628a4b822749a5b23813def58e77e9aec2ef2e74)

@@ -97,7 +104,7 @@

Remove erroneous apostrophe from README - 096ec4b47df4706383fd0c3d4714cc68defd67d1
Remove erroneous apostrophe from README - [096ec4b4](ray hatfield@096ec4b47df4706383fd0c3d4714cc68defd67d1)
Fixed logical check for validTarget - 956ee6f7eb227184eb1c2dea11677e01a00fdab5
Fixed logical check for validTarget - [956ee6f7](Donovan Isherwood@956ee6f7eb227184eb1c2dea11677e01a00fdab5)
Cleanup - b25c2ca8133c957d869751d34f1da4a1358dc041
Cleanup - [b25c2ca8](Kory Nunn@b25c2ca8133c957d869751d34f1da4a1358dc041)

@@ -107,5 +114,5 @@

Use window.pageYOffset over window.scrollY has it is cross browser - 32d17d590ef5357bfe8da85ed0db87eebd9d6d9e
Use window.pageYOffset over window.scrollY has it is cross browser - [32d17d59](Nicolas Duvieusart Déry@32d17d590ef5357bfe8da85ed0db87eebd9d6d9e)
Updated built files - db06d859fafe48339e2a45d32acb88a7b7337ea3
Updated built files - [db06d859](Kory Nunn@db06d859fafe48339e2a45d32acb88a7b7337ea3)

@@ -115,3 +122,3 @@

generified the readme even more - b496e308cecb04d141eb9bdafe3151152e77bd82
generified the readme even more - [b496e308](Kory Nunn@b496e308cecb04d141eb9bdafe3151152e77bd82)

@@ -121,3 +128,3 @@

Removed log - 1ceac5fd183105ffdbc4e03e4db24cb0a43b4343
Removed log - [1ceac5fd](Kory Nunn@1ceac5fd183105ffdbc4e03e4db24cb0a43b4343)

@@ -127,11 +134,11 @@

Readability - 7360f656ae6ed38f618a89002893aeff83b5c59b
Readability - [7360f656](Kory Nunn@7360f656ae6ed38f618a89002893aeff83b5c59b)
Updated readme, fixed easing kinda, resolves #12 - 6c6ac24ba3169bc55307da72e6f597913bb345fc
Updated readme, fixed easing kinda, resolves #12 - [6c6ac24b](Kory Nunn@6c6ac24ba3169bc55307da72e6f597913bb345fc)
fixed example - bd044d80f0766ac3a96026920ece3c73d10dc946
fixed example - [bd044d80](Kory Nunn@bd044d80f0766ac3a96026920ece3c73d10dc946)
Updated example link - 05f4373095d643bab4b5908c8de27f30d5d0aba7
Updated example link - [05f43730](Kory Nunn@05f4373095d643bab4b5908c8de27f30d5d0aba7)
Fixed leaking touchstart handler - 5095dffd8aeda2073714faa48b27c844c8418750
Fixed leaking touchstart handler - [5095dffd](Kory Nunn@5095dffd8aeda2073714faa48b27c844c8418750)

@@ -141,5 +148,5 @@

included built files - f9e795884cd8fc85ebb9261fe3564d69a68d7eb0
included built files - [f9e79588](Kory Nunn@f9e795884cd8fc85ebb9261fe3564d69a68d7eb0)
allowed 0 animation time. Resolves #1 - 613b4f81f68a19b13a9ed4f6e700128f4177fcfd
allowed 0 animation time. Resolves #1 - [613b4f81](Kory Nunn@613b4f81f68a19b13a9ed4f6e700128f4177fcfd)

@@ -149,3 +156,3 @@

timing improvements, example, readme updates - 55909c9188472a4377d065b7f724a95bf506b22d
timing improvements, example, readme updates - [55909c91](Kory Nunn@55909c9188472a4377d065b7f724a95bf506b22d)

@@ -155,3 +162,3 @@

Added callback complete type - 69e83afafadddec6c66c22dbc213a51e47116d92
Added callback complete type - [69e83afa](Kory Nunn@69e83afafadddec6c66c22dbc213a51e47116d92)

@@ -161,3 +168,3 @@

Improved linarity of tween, also set to the final position on complete - 9e1603288bcf2e20c451856c5b7db25da4038878
Improved linarity of tween, also set to the final position on complete - [9e160328](Kory Nunn@9e1603288bcf2e20c451856c5b7db25da4038878)

@@ -167,5 +174,5 @@

Updated test command and readme - 7bea8dd2f237d08e34885657995f99ef7aecea13
Updated test command and readme - [7bea8dd2](Kory Nunn@7bea8dd2f237d08e34885657995f99ef7aecea13)
Added align setting - 61145e7cb6e0f2a2c104e62abc09a0d5b2de6566
Added align setting - [61145e7c](Kory Nunn@61145e7cb6e0f2a2c104e62abc09a0d5b2de6566)

@@ -175,5 +182,5 @@

Failing test for body clientHeight < scrollHeight - 3624e49e36f890bfdbfef1859e0e285a5fb0aba8
Failing test for body clientHeight < scrollHeight - [3624e49e](Randall Leeds@3624e49e36f890bfdbfef1859e0e285a5fb0aba8)
Fix for body clientHeight < scrollHeight - df551e8d14d7f36ca589a1ae8ae6591067c05cbe
Fix for body clientHeight < scrollHeight - [df551e8d](Randall Leeds@df551e8d14d7f36ca589a1ae8ae6591067c05cbe)

@@ -183,5 +190,5 @@

Revert "scroll into view should break out of parent scroll when it matches a scrollable element" - 59217a2fcc6bd771f2d936770a6559eaa2956f12
Revert "scroll into view should break out of parent scroll when it matches a scrollable element" - [59217a2f](pivotal@59217a2fcc6bd771f2d936770a6559eaa2956f12)
Use raf polyfill - de3c568754faef9161bcabf6c8b08c0d252a13d7
Use raf polyfill - [de3c5687](Douglas Blumeyer@de3c568754faef9161bcabf6c8b08c0d252a13d7)

@@ -191,3 +198,3 @@

Added ability to skip scrolling certain elements based on a function. Resolves #6 - 744b1d8eb8ed54b3827cab4752401b05972cb220
Added ability to skip scrolling certain elements based on a function. Resolves #6 - [744b1d8e](KoryNunn@744b1d8eb8ed54b3827cab4752401b05972cb220)

@@ -197,3 +204,3 @@

Added cancel on touchstart - 5c6405f12c93e35094436f18c14fcc74886771de
Added cancel on touchstart - [5c6405f1](KoryNunn@5c6405f12c93e35094436f18c14fcc74886771de)

@@ -203,5 +210,5 @@

scroll into view should break out of parent scroll when it matches a scrollable element - d0bee1632d923e973902e5f578e6f059e3d5caa7
scroll into view should break out of parent scroll when it matches a scrollable element - [d0bee163](Charles Hansen@d0bee1632d923e973902e5f578e6f059e3d5caa7)
Improved animation, cancel handling - 89710ddbead2e184c8de7119cf34ba67654fd1b6
Improved animation, cancel handling - [89710ddb](KoryNunn@89710ddbead2e184c8de7119cf34ba67654fd1b6)

@@ -211,3 +218,3 @@

Fixed offset issue - 6d0ee655756b2da14fa46e3d0a3211723780a52f
Fixed offset issue - [6d0ee655](KoryNunn@6d0ee655756b2da14fa46e3d0a3211723780a52f)

@@ -217,3 +224,3 @@

Fixed window alignment issue - 2ccf5b702553c5e0d50ac1f24e20e12763e369e0
Fixed window alignment issue - [2ccf5b70](KoryNunn@2ccf5b702553c5e0d50ac1f24e20e12763e369e0)

@@ -223,5 +230,5 @@

Add LICENSE file via addalicense.com - 184d142bf3a6629b68bce1ece391bcef90c68ea5
Add LICENSE file via addalicense.com - [184d142b](Kory Nunn@184d142bf3a6629b68bce1ece391bcef90c68ea5)
Updated package.json & removed "bad" file. - 49752e0c5cf0f7b965dda0338e65598f1a7d8434
Updated package.json & removed "bad" file. - [49752e0c](Grant Benvenuti@49752e0c5cf0f7b965dda0338e65598f1a7d8434)

@@ -231,3 +238,3 @@

Removed debug, improved scrolling finctionality - 78d8c39f926b02bb0603d302bd3dce0c75efc131
Removed debug, improved scrolling finctionality - [78d8c39f](KoryNunn@78d8c39f926b02bb0603d302bd3dce0c75efc131)

@@ -237,3 +244,3 @@

Fixed issue where all parents would be scrolled - 901dd1639ccf4a227e53078313cd830da80273cc
Fixed issue where all parents would be scrolled - [901dd163](KoryNunn@901dd1639ccf4a227e53078313cd830da80273cc)

@@ -243,3 +250,3 @@

Transitions to loction - 3b056a5eafb1b3d8ea339e24483df87a0ae9d217
Transitions to loction - [3b056a5e](KoryNunn@3b056a5eafb1b3d8ea339e24483df87a0ae9d217)

@@ -249,5 +256,5 @@

trying to fix implementation - fab21e106b84f54a9f5eb8e7258883d4e8cd31f0
trying to fix implementation - [fab21e10](KoryNunn@fab21e106b84f54a9f5eb8e7258883d4e8cd31f0)
Working - 6f60b2819c6ee207785b136b35ec0a08830917aa
Working - [6f60b281](KoryNunn@6f60b2819c6ee207785b136b35ec0a08830917aa)

@@ -257,3 +264,3 @@

removed log, added readmed - 97f3d9daea390f933f2f5ca678f2831ecb33d681
removed log, added readmed - [97f3d9da](KoryNunn@97f3d9daea390f933f2f5ca678f2831ecb33d681)

@@ -263,4 +270,4 @@

initial commit - 2a5cbfc9f41fad86d3bd97c58af652a3894f7d25
initial commit - [2a5cbfc9](Kory Nunn@2a5cbfc9f41fad86d3bd97c58af652a3894f7d25)

@@ -1,2 +0,2 @@

(function e(t,n,r){function s(o,u){if(!n[o]){if(!t[o]){var a=typeof require=="function"&&require;if(!u&&a)return a(o,!0);if(i)return i(o,!0);var f=new Error("Cannot find module '"+o+"'");throw f.code="MODULE_NOT_FOUND",f}var l=n[o]={exports:{}};t[o][0].call(l.exports,function(e){var n=t[o][1][e];return s(n?n:e)},l,l.exports,e,t,n,r)}return n[o].exports}var i=typeof require=="function"&&require;for(var o=0;o<r.length;o++)s(r[o]);return s})({1:[function(require,module,exports){
(function(){function r(e,n,t){function o(i,f){if(!n[i]){if(!e[i]){var c="function"==typeof require&&require;if(!f&&c)return c(i,!0);if(u)return u(i,!0);var a=new Error("Cannot find module '"+i+"'");throw a.code="MODULE_NOT_FOUND",a}var p=n[i]={exports:{}};e[i][0].call(p.exports,function(r){var n=e[i][1][r];return o(n||r)},p,p.exports,r,e,n,t)}return n[i].exports}for(var u="function"==typeof require&&require,i=0;i<t.length;i++)o(t[i]);return o}return r})()({1:[function(require,module,exports){
var crel = require('crel'),

@@ -3,0 +3,0 @@ scrollIntoView = require('../');

{
"name": "scroll-into-view",
"version": "1.9.6",
"version": "1.9.7",
"description": "",

@@ -19,4 +19,3 @@ "main": "scrollIntoView.js",

"updateChangelog": "git log | chlogit > CHANGELOG.md && git add CHANGELOG.md",
"prepublish": "npm run-script build",
"postinstall": "opencollective-postinstall"
"prepublish": "npm run-script build"
},

@@ -37,6 +36,3 @@ "pre-commit": [

},
"dependencies": {
"opencollective": "^1.0.3",
"opencollective-postinstall": "^2.0.1"
},
"dependencies": {},
"collective": {

@@ -43,0 +39,0 @@ "type": "opencollective",

@@ -0,0 +0,0 @@ ![scroll-into-view](/scrollintoview.png) ![example-gif](/scrollIntoViewExample.gif)

@@ -0,0 +0,0 @@ var COMPLETE = 'complete',

@@ -1,3 +0,3 @@

(function e(t,n,r){function s(o,u){if(!n[o]){if(!t[o]){var a=typeof require=="function"&&require;if(!u&&a)return a(o,!0);if(i)return i(o,!0);var f=new Error("Cannot find module '"+o+"'");throw f.code="MODULE_NOT_FOUND",f}var l=n[o]={exports:{}};t[o][0].call(l.exports,function(e){var n=t[o][1][e];return s(n?n:e)},l,l.exports,e,t,n,r)}return n[o].exports}var i=typeof require=="function"&&require;for(var o=0;o<r.length;o++)s(r[o]);return s})({1:[function(require,module,exports){
function raf(e){if("requestAnimationFrame"in window)return window.requestAnimationFrame(e);setTimeout(e,16)}function setElementScroll(e,t,n){e.self===e?e.scrollTo(t,n):(e.scrollLeft=t,e.scrollTop=n)}function getTargetScrollLocation(e,t,n){var l,i,r,a,o,s,f,c=e.getBoundingClientRect(),d=n&&null!=n.left?n.left:.5,u=n&&null!=n.top?n.top:.5,m=n&&null!=n.leftOffset?n.leftOffset:0,g=n&&null!=n.topOffset?n.topOffset:0,h=d,p=u;if(t.self===t)s=Math.min(c.width,t.innerWidth),f=Math.min(c.height,t.innerHeight),i=c.left+t.pageXOffset-t.innerWidth*h+s*h,r=c.top+t.pageYOffset-t.innerHeight*p+f*p,r-=g,a=(i-=m)-t.pageXOffset,o=r-t.pageYOffset;else{s=c.width,f=c.height,l=t.getBoundingClientRect();var E=c.left-(l.left-t.scrollLeft),v=c.top-(l.top-t.scrollTop);i=E+s*h-t.clientWidth*h,r=v+f*p-t.clientHeight*p,i=Math.max(Math.min(i,t.scrollWidth-t.clientWidth),0),r=Math.max(Math.min(r,t.scrollHeight-t.clientHeight),0),r-=g,a=(i-=m)-t.scrollLeft,o=r-t.scrollTop}return{x:i,y:r,differenceX:a,differenceY:o}}function animate(e){var t=e._scrollSettings;if(t){var n=getTargetScrollLocation(t.target,e,t.align),l=Date.now()-t.startTime,i=Math.min(1/t.time*l,1);if(l>t.time&&t.endIterations>3)return setElementScroll(e,n.x,n.y),e._scrollSettings=null,t.end(COMPLETE);t.endIterations++;var r=1-t.ease(i);if(setElementScroll(e,n.x-n.differenceX*r,n.y-n.differenceY*r),l>=t.time)return animate(e);raf(animate.bind(null,e))}}function transitionScrollTo(e,t,n,l){function i(e){t._scrollSettings=null,t.parentElement&&t.parentElement._scrollSettings&&t.parentElement._scrollSettings.end(e),l(e),t.removeEventListener("touchstart",r,{passive:!0}),t.removeEventListener("wheel",r,{passive:!0})}var r,a=!t._scrollSettings,o=t._scrollSettings,s=Date.now();o&&o.end(CANCELED),t._scrollSettings={startTime:o?o.startTime:Date.now(),endIterations:0,target:e,time:n.time+(o?s-o.startTime:0),ease:n.ease,align:n.align,end:i},r=i.bind(null,CANCELED),t.addEventListener("touchstart",r,{passive:!0}),t.addEventListener("wheel",r,{passive:!0}),a&&animate(t)}function defaultIsScrollable(e){return"pageXOffset"in e||(e.scrollHeight!==e.clientHeight||e.scrollWidth!==e.clientWidth)&&"hidden"!==getComputedStyle(e).overflow}function defaultValidTarget(){return!0}var COMPLETE="complete",CANCELED="canceled";module.exports=function(e,t,n){if(e){"function"==typeof t&&(n=t,t=null),t||(t={}),t.time=isNaN(t.time)?1e3:t.time,t.ease=t.ease||function(e){return 1-Math.pow(1-e,e/2)};for(var l=e.parentElement,i=0,r=t.validTarget||defaultValidTarget,a=t.isScrollable;l;){if(r(l,i)&&(a?a(l,defaultIsScrollable):defaultIsScrollable(l))&&(i++,transitionScrollTo(e,l,t,function(e){--i||n&&n(e)})),!(l=l.parentElement)){i||n&&n(COMPLETE);break}"BODY"===l.tagName&&(l=(l=l.ownerDocument).defaultView||l.ownerWindow)}}};
(function(){function r(e,n,t){function o(i,f){if(!n[i]){if(!e[i]){var c="function"==typeof require&&require;if(!f&&c)return c(i,!0);if(u)return u(i,!0);var a=new Error("Cannot find module '"+i+"'");throw a.code="MODULE_NOT_FOUND",a}var p=n[i]={exports:{}};e[i][0].call(p.exports,function(r){var n=e[i][1][r];return o(n||r)},p,p.exports,r,e,n,t)}return n[i].exports}for(var u="function"==typeof require&&require,i=0;i<t.length;i++)o(t[i]);return o}return r})()({1:[function(require,module,exports){
var COMPLETE="complete",CANCELED="canceled";function raf(e){if("requestAnimationFrame"in window)return window.requestAnimationFrame(e);setTimeout(e,16)}function setElementScroll(e,t,n){e.self===e?e.scrollTo(t,n):(e.scrollLeft=t,e.scrollTop=n)}function getTargetScrollLocation(e,t,n){var l,i,r,a,o,s,f,c=e.getBoundingClientRect(),d=n&&null!=n.left?n.left:.5,u=n&&null!=n.top?n.top:.5,m=n&&null!=n.leftOffset?n.leftOffset:0,g=n&&null!=n.topOffset?n.topOffset:0,h=d,p=u;if(t.self===t)s=Math.min(c.width,t.innerWidth),f=Math.min(c.height,t.innerHeight),i=c.left+t.pageXOffset-t.innerWidth*h+s*h,r=c.top+t.pageYOffset-t.innerHeight*p+f*p,r-=g,a=(i-=m)-t.pageXOffset,o=r-t.pageYOffset;else{s=c.width,f=c.height,l=t.getBoundingClientRect();var E=c.left-(l.left-t.scrollLeft),v=c.top-(l.top-t.scrollTop);i=E+s*h-t.clientWidth*h,r=v+f*p-t.clientHeight*p,i=Math.max(Math.min(i,t.scrollWidth-t.clientWidth),0),r=Math.max(Math.min(r,t.scrollHeight-t.clientHeight),0),r-=g,a=(i-=m)-t.scrollLeft,o=r-t.scrollTop}return{x:i,y:r,differenceX:a,differenceY:o}}function animate(e){var t=e._scrollSettings;if(t){var n=getTargetScrollLocation(t.target,e,t.align),l=Date.now()-t.startTime,i=Math.min(1/t.time*l,1);if(l>t.time&&t.endIterations>3)return setElementScroll(e,n.x,n.y),e._scrollSettings=null,t.end(COMPLETE);t.endIterations++;var r=1-t.ease(i);if(setElementScroll(e,n.x-n.differenceX*r,n.y-n.differenceY*r),l>=t.time)return animate(e);raf(animate.bind(null,e))}}function transitionScrollTo(e,t,n,l){var i,r=!t._scrollSettings,a=t._scrollSettings,o=Date.now();function s(e){t._scrollSettings=null,t.parentElement&&t.parentElement._scrollSettings&&t.parentElement._scrollSettings.end(e),l(e),t.removeEventListener("touchstart",i,{passive:!0}),t.removeEventListener("wheel",i,{passive:!0})}a&&a.end(CANCELED),t._scrollSettings={startTime:a?a.startTime:Date.now(),endIterations:0,target:e,time:n.time+(a?o-a.startTime:0),ease:n.ease,align:n.align,end:s},i=s.bind(null,CANCELED),t.addEventListener("touchstart",i,{passive:!0}),t.addEventListener("wheel",i,{passive:!0}),r&&animate(t)}function defaultIsScrollable(e){return"pageXOffset"in e||(e.scrollHeight!==e.clientHeight||e.scrollWidth!==e.clientWidth)&&"hidden"!==getComputedStyle(e).overflow}function defaultValidTarget(){return!0}module.exports=function(e,t,n){if(e){"function"==typeof t&&(n=t,t=null),t||(t={}),t.time=isNaN(t.time)?1e3:t.time,t.ease=t.ease||function(e){return 1-Math.pow(1-e,e/2)};for(var l=e.parentElement,i=0,r=t.validTarget||defaultValidTarget,a=t.isScrollable;l;){if(r(l,i)&&(a?a(l,defaultIsScrollable):defaultIsScrollable(l))&&(i++,transitionScrollTo(e,l,t,o)),!(l=l.parentElement)){i||n&&n(COMPLETE);break}"BODY"===l.tagName&&(l=(l=l.ownerDocument).defaultView||l.ownerWindow)}}function o(e){--i||n&&n(e)}};

@@ -4,0 +4,0 @@ },{}],2:[function(require,module,exports){

@@ -0,0 +0,0 @@ var test = require('tape'),

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