scrollmirror
Advanced tools
Comparing version 1.1.0 to 1.2.0
@@ -1,2 +0,2 @@ | ||
const e=()=>new Promise(e=>{requestAnimationFrame(()=>e())}),t=({clientWidth:e,clientHeight:t,scrollWidth:o,scrollHeight:r})=>r>t||o>e,o=e=>{const t=window.getComputedStyle(e).overflow;return t.includes("auto")||t.includes("scroll")},r=e=>{if(null==e)return{x:0,y:0};const{scrollTop:t,scrollHeight:o,clientHeight:r,scrollLeft:n,scrollWidth:l,clientWidth:s}=e,i=o-r;return{x:n?n/Math.max(1e-5,l-s):0,y:t?t/Math.max(1e-5,i):0}};function n(){return n=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var o=arguments[t];for(var r in o)({}).hasOwnProperty.call(o,r)&&(e[r]=o[r])}return e},n.apply(null,arguments)}function l(e){return e.matches("body *")?e:window}class s{constructor(l,s={}){var i,c=this;this.elements=void 0,this.defaults={vertical:!0,horizontal:!0,debug:!0},this.options=void 0,this.paused=!1,this.logger=void 0,this.handleScroll=async function(t){if(c.paused)return;if(!t.currentTarget)return;const o=c.getScrollContainer(t.currentTarget);await e(),c.mirrorScrollPositions(r(o),o)},this.elements=[...l].filter(Boolean).map(e=>this.getScrollContainer(e)),this.elements=[...new Set(this.elements)],this.options=n({},this.defaults,s),this.options.debug&&(this.logger=(i="[scroll-mirror]",{log:(...e)=>console.log(i,...e),warn:(...e)=>console.warn(i,...e),error:(...e)=>console.error(i,...e)}),function(e,r){if(e.length<1)null==r||r.warn("No elements provided.");else{e.length<2&&(null==r||r.warn("Only one element provided.",e)),e.some(e=>!e)&&(null==r||r.error("Some elements are not defined.",e));for(const n of e)n instanceof HTMLElement&&!t(n)&&(null==r||r.warn("Element doesn't have overflow:",n)),n instanceof HTMLElement&&n.matches("body *")&&!o(n)&&(null==r||r.warn('No "overflow: auto;" or "overflow: scroll;" set on element:',n))}}(this.elements,this.logger)),this.elements.forEach(e=>this.addScrollHandler(e)),this.elements.includes(document.documentElement)&&this.mirrorScrollPositions(r(document.documentElement),document.documentElement)}pause(){this.paused=!0}resume(){this.paused=!1}destroy(){this.elements.forEach(e=>this.removeScrollHandler(e))}addScrollHandler(e){this.removeScrollHandler(e),l(e).addEventListener("scroll",this.handleScroll)}removeScrollHandler(e){l(e).removeEventListener("scroll",this.handleScroll)}getScrollContainer(e){return e instanceof HTMLElement&&e.matches("body *")?e:document.documentElement}mirrorScrollPositions(e,t=void 0){this.elements.forEach(o=>{t!==o&&(this.removeScrollHandler(o),this.setScrollPosition(e,o),window.requestAnimationFrame(()=>{this.addScrollHandler(o)}))})}setScrollPosition(e,t){const{vertical:o,horizontal:r}=this.options,n=t.scrollWidth-t.clientWidth,l=t.scrollHeight-t.clientHeight;o&&l&&t.scrollTo({top:l*e.y,behavior:"instant"}),r&&n&&t.scrollTo({left:n*e.x,behavior:"instant"})}get progress(){const e=this.elements.find(e=>t(e));return r(e)}set progress(e){"number"==typeof e&&(e={x:e,y:e});const t=n({},this.progress,e);(function(e,t){let o=!0;for(const[r,n]of Object.entries(e))("number"!=typeof n||n<0||n>1)&&(null==t||t.error(`progress.${r} must be a number between 0-1`),o=!1);return o})(t,this.logger)&&this.mirrorScrollPositions(t)}}export{s as default,r as getScrollProgress,o as hasCSSOverflow,t as hasOverflow,e as nextTick}; | ||
const e=()=>new Promise(e=>{requestAnimationFrame(()=>e())}),t=({clientWidth:e,clientHeight:t,scrollWidth:o,scrollHeight:r})=>r>t||o>e,o=e=>{const t=window.getComputedStyle(e).overflow;return t.includes("auto")||t.includes("scroll")},r=e=>{if(null==e)return{x:0,y:0};const{scrollTop:t,scrollHeight:o,clientHeight:r,scrollLeft:n,scrollWidth:l,clientWidth:s}=e,i=o-r;return{x:n?n/Math.max(1e-5,l-s):0,y:t?t/Math.max(1e-5,i):0}};function n(){return n=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var o=arguments[t];for(var r in o)({}).hasOwnProperty.call(o,r)&&(e[r]=o[r])}return e},n.apply(null,arguments)}function l(e){return e.matches("body *")?e:window}class s{constructor(l,s={}){var i,c=this;this.elements=void 0,this.defaults={vertical:!0,horizontal:!0,debug:!0},this.options=void 0,this.paused=!1,this.logger=void 0,this.handleScroll=async function(t){if(c.paused)return;if(!t.currentTarget)return;const o=c.getScrollContainer(t.currentTarget);await e(),c.mirrorScrollPositions(r(o),o)},this.elements=[...l].filter(Boolean).map(e=>this.getScrollContainer(e)),this.elements=[...new Set(this.elements)],this.options=n({},this.defaults,s),this.options.debug&&(this.logger=(i="[scroll-mirror]",{log:(...e)=>console.log(i,...e),warn:(...e)=>console.warn(i,...e),error:(...e)=>console.error(i,...e)}),function(e,r){if(e.length<1)null==r||r.warn("No elements provided.");else{e.length<2&&(null==r||r.warn("Only one element provided.",e)),e.some(e=>!e)&&(null==r||r.error("Some elements are not defined.",e));for(const n of e)n instanceof HTMLElement&&!t(n)&&(null==r||r.warn("Element doesn't have overflow:",n)),n instanceof HTMLElement&&n.matches("body *")&&!o(n)&&(null==r||r.warn('No "overflow: auto;" or "overflow: scroll;" set on element:',n))}}(this.elements,this.logger)),this.elements.forEach(e=>this.addScrollHandler(e)),this.elements.includes(document.documentElement)&&this.mirrorScrollPositions(r(document.documentElement),document.documentElement)}pause(){this.paused=!0}resume(){this.paused=!1}destroy(){this.elements.forEach(e=>this.removeScrollHandler(e))}addScrollHandler(e){this.removeScrollHandler(e),l(e).addEventListener("scroll",this.handleScroll,{passive:!0})}removeScrollHandler(e){l(e).removeEventListener("scroll",this.handleScroll)}getScrollContainer(e){return e instanceof HTMLElement&&e.matches("body *")?e:document.documentElement}mirrorScrollPositions(e,t=void 0){this.elements.forEach(o=>{t!==o&&(this.removeScrollHandler(o),this.setScrollPosition(e,o),window.requestAnimationFrame(()=>{this.addScrollHandler(o)}))})}setScrollPosition(e,t){const{vertical:o,horizontal:r}=this.options,n=t.scrollWidth-t.clientWidth,l=t.scrollHeight-t.clientHeight;o&&l&&t.scrollTo({top:l*e.y,behavior:"instant"}),r&&n&&t.scrollTo({left:n*e.x,behavior:"instant"})}get progress(){const e=this.elements.find(e=>t(e));return r(e)}set progress(e){"number"==typeof e&&(e={x:e,y:e});const t=n({},this.progress,e);(function(e,t){let o=!0;for(const[r,n]of Object.entries(e))("number"!=typeof n||n<0||n>1)&&(null==t||t.error(`progress.${r} must be a number between 0-1`),o=!1);return o})(t,this.logger)&&this.mirrorScrollPositions(t)}}export{s as default,r as getScrollProgress,o as hasCSSOverflow,t as hasOverflow,e as nextTick}; | ||
//# sourceMappingURL=ScrollMirror.modern.js.map |
@@ -1,2 +0,2 @@ | ||
const e=()=>new Promise(e=>{requestAnimationFrame(()=>e())}),t=({clientWidth:e,clientHeight:t,scrollWidth:o,scrollHeight:r})=>r>t||o>e,o=e=>{const t=window.getComputedStyle(e).overflow;return t.includes("auto")||t.includes("scroll")},r=e=>{if(null==e)return{x:0,y:0};const{scrollTop:t,scrollHeight:o,clientHeight:r,scrollLeft:n,scrollWidth:l,clientWidth:s}=e,i=o-r;return{x:n?n/Math.max(1e-5,l-s):0,y:t?t/Math.max(1e-5,i):0}};function n(e){return e.matches("body *")?e:window}class l{constructor(n,l={}){const s=this;var i;this.elements=void 0,this.defaults={vertical:!0,horizontal:!0,debug:!0},this.options=void 0,this.paused=!1,this.logger=void 0,this.handleScroll=function(t){try{if(s.paused)return Promise.resolve();if(!t.currentTarget)return Promise.resolve();const o=s.getScrollContainer(t.currentTarget);return Promise.resolve(e()).then(function(){s.mirrorScrollPositions(r(o),o)})}catch(e){return Promise.reject(e)}},this.elements=[...n].filter(Boolean).map(e=>this.getScrollContainer(e)),this.elements=[...new Set(this.elements)],this.options={...this.defaults,...l},this.options.debug&&(this.logger=(i="[scroll-mirror]",{log:function(){return console.log(i,...[].slice.call(arguments))},warn:function(){return console.warn(i,...[].slice.call(arguments))},error:function(){return console.error(i,...[].slice.call(arguments))}}),function(e,r){if(e.length<1)r?.warn("No elements provided.");else{e.length<2&&r?.warn("Only one element provided.",e),e.some(e=>!e)&&r?.error("Some elements are not defined.",e);for(const n of e)n instanceof HTMLElement&&!t(n)&&r?.warn("Element doesn't have overflow:",n),n instanceof HTMLElement&&n.matches("body *")&&!o(n)&&r?.warn('No "overflow: auto;" or "overflow: scroll;" set on element:',n)}}(this.elements,this.logger)),this.elements.forEach(e=>this.addScrollHandler(e)),this.elements.includes(document.documentElement)&&this.mirrorScrollPositions(r(document.documentElement),document.documentElement)}pause(){this.paused=!0}resume(){this.paused=!1}destroy(){this.elements.forEach(e=>this.removeScrollHandler(e))}addScrollHandler(e){this.removeScrollHandler(e),n(e).addEventListener("scroll",this.handleScroll)}removeScrollHandler(e){n(e).removeEventListener("scroll",this.handleScroll)}getScrollContainer(e){return e instanceof HTMLElement&&e.matches("body *")?e:document.documentElement}mirrorScrollPositions(e,t=void 0){this.elements.forEach(o=>{t!==o&&(this.removeScrollHandler(o),this.setScrollPosition(e,o),window.requestAnimationFrame(()=>{this.addScrollHandler(o)}))})}setScrollPosition(e,t){const{vertical:o,horizontal:r}=this.options,n=t.scrollWidth-t.clientWidth,l=t.scrollHeight-t.clientHeight;o&&l&&t.scrollTo({top:l*e.y,behavior:"instant"}),r&&n&&t.scrollTo({left:n*e.x,behavior:"instant"})}get progress(){const e=this.elements.find(e=>t(e));return r(e)}set progress(e){"number"==typeof e&&(e={x:e,y:e});const t={...this.progress,...e};(function(e,t){let o=!0;for(const[r,n]of Object.entries(e))("number"!=typeof n||n<0||n>1)&&(t?.error(`progress.${r} must be a number between 0-1`),o=!1);return o})(t,this.logger)&&this.mirrorScrollPositions(t)}}export{l as default,r as getScrollProgress,o as hasCSSOverflow,t as hasOverflow,e as nextTick}; | ||
const e=()=>new Promise(e=>{requestAnimationFrame(()=>e())}),t=({clientWidth:e,clientHeight:t,scrollWidth:o,scrollHeight:r})=>r>t||o>e,o=e=>{const t=window.getComputedStyle(e).overflow;return t.includes("auto")||t.includes("scroll")},r=e=>{if(null==e)return{x:0,y:0};const{scrollTop:t,scrollHeight:o,clientHeight:r,scrollLeft:n,scrollWidth:l,clientWidth:s}=e,i=o-r;return{x:n?n/Math.max(1e-5,l-s):0,y:t?t/Math.max(1e-5,i):0}};function n(e){return e.matches("body *")?e:window}class l{constructor(n,l={}){const s=this;var i;this.elements=void 0,this.defaults={vertical:!0,horizontal:!0,debug:!0},this.options=void 0,this.paused=!1,this.logger=void 0,this.handleScroll=function(t){try{if(s.paused)return Promise.resolve();if(!t.currentTarget)return Promise.resolve();const o=s.getScrollContainer(t.currentTarget);return Promise.resolve(e()).then(function(){s.mirrorScrollPositions(r(o),o)})}catch(e){return Promise.reject(e)}},this.elements=[...n].filter(Boolean).map(e=>this.getScrollContainer(e)),this.elements=[...new Set(this.elements)],this.options={...this.defaults,...l},this.options.debug&&(this.logger=(i="[scroll-mirror]",{log:function(){return console.log(i,...[].slice.call(arguments))},warn:function(){return console.warn(i,...[].slice.call(arguments))},error:function(){return console.error(i,...[].slice.call(arguments))}}),function(e,r){if(e.length<1)r?.warn("No elements provided.");else{e.length<2&&r?.warn("Only one element provided.",e),e.some(e=>!e)&&r?.error("Some elements are not defined.",e);for(const n of e)n instanceof HTMLElement&&!t(n)&&r?.warn("Element doesn't have overflow:",n),n instanceof HTMLElement&&n.matches("body *")&&!o(n)&&r?.warn('No "overflow: auto;" or "overflow: scroll;" set on element:',n)}}(this.elements,this.logger)),this.elements.forEach(e=>this.addScrollHandler(e)),this.elements.includes(document.documentElement)&&this.mirrorScrollPositions(r(document.documentElement),document.documentElement)}pause(){this.paused=!0}resume(){this.paused=!1}destroy(){this.elements.forEach(e=>this.removeScrollHandler(e))}addScrollHandler(e){this.removeScrollHandler(e),n(e).addEventListener("scroll",this.handleScroll,{passive:!0})}removeScrollHandler(e){n(e).removeEventListener("scroll",this.handleScroll)}getScrollContainer(e){return e instanceof HTMLElement&&e.matches("body *")?e:document.documentElement}mirrorScrollPositions(e,t=void 0){this.elements.forEach(o=>{t!==o&&(this.removeScrollHandler(o),this.setScrollPosition(e,o),window.requestAnimationFrame(()=>{this.addScrollHandler(o)}))})}setScrollPosition(e,t){const{vertical:o,horizontal:r}=this.options,n=t.scrollWidth-t.clientWidth,l=t.scrollHeight-t.clientHeight;o&&l&&t.scrollTo({top:l*e.y,behavior:"instant"}),r&&n&&t.scrollTo({left:n*e.x,behavior:"instant"})}get progress(){const e=this.elements.find(e=>t(e));return r(e)}set progress(e){"number"==typeof e&&(e={x:e,y:e});const t={...this.progress,...e};(function(e,t){let o=!0;for(const[r,n]of Object.entries(e))("number"!=typeof n||n<0||n>1)&&(t?.error(`progress.${r} must be a number between 0-1`),o=!1);return o})(t,this.logger)&&this.mirrorScrollPositions(t)}}export{l as default,r as getScrollProgress,o as hasCSSOverflow,t as hasOverflow,e as nextTick}; | ||
//# sourceMappingURL=ScrollMirror.module.js.map |
@@ -1,2 +0,2 @@ | ||
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?module.exports=t():"function"==typeof define&&define.amd?define(t):(e||self).ScrollMirror=t()}(this,function(){const e=e=>{let{clientWidth:t,clientHeight:o,scrollWidth:r,scrollHeight:n}=e;return n>o||r>t},t=e=>{const t=window.getComputedStyle(e).overflow;return t.includes("auto")||t.includes("scroll")},o=e=>{if(null==e)return{x:0,y:0};const{scrollTop:t,scrollHeight:o,clientHeight:r,scrollLeft:n,scrollWidth:l,clientWidth:s}=e,i=o-r;return{x:n?n/Math.max(1e-5,l-s):0,y:t?t/Math.max(1e-5,i):0}};function r(e){return e.matches("body *")?e:window}return class{constructor(r,n){const l=this;var s;void 0===n&&(n={}),this.elements=void 0,this.defaults={vertical:!0,horizontal:!0,debug:!0},this.options=void 0,this.paused=!1,this.logger=void 0,this.handleScroll=function(e){try{if(l.paused)return Promise.resolve();if(!e.currentTarget)return Promise.resolve();const t=l.getScrollContainer(e.currentTarget);return Promise.resolve(new Promise(e=>{requestAnimationFrame(()=>e())})).then(function(){l.mirrorScrollPositions(o(t),t)})}catch(e){return Promise.reject(e)}},this.elements=[...r].filter(Boolean).map(e=>this.getScrollContainer(e)),this.elements=[...new Set(this.elements)],this.options={...this.defaults,...n},this.options.debug&&(this.logger=(s="[scroll-mirror]",{log:function(){return console.log(s,...[].slice.call(arguments))},warn:function(){return console.warn(s,...[].slice.call(arguments))},error:function(){return console.error(s,...[].slice.call(arguments))}}),function(o,r){if(o.length<1)r?.warn("No elements provided.");else{o.length<2&&r?.warn("Only one element provided.",o),o.some(e=>!e)&&r?.error("Some elements are not defined.",o);for(const n of o)n instanceof HTMLElement&&!e(n)&&r?.warn("Element doesn't have overflow:",n),n instanceof HTMLElement&&n.matches("body *")&&!t(n)&&r?.warn('No "overflow: auto;" or "overflow: scroll;" set on element:',n)}}(this.elements,this.logger)),this.elements.forEach(e=>this.addScrollHandler(e)),this.elements.includes(document.documentElement)&&this.mirrorScrollPositions(o(document.documentElement),document.documentElement)}pause(){this.paused=!0}resume(){this.paused=!1}destroy(){this.elements.forEach(e=>this.removeScrollHandler(e))}addScrollHandler(e){this.removeScrollHandler(e),r(e).addEventListener("scroll",this.handleScroll)}removeScrollHandler(e){r(e).removeEventListener("scroll",this.handleScroll)}getScrollContainer(e){return e instanceof HTMLElement&&e.matches("body *")?e:document.documentElement}mirrorScrollPositions(e,t){void 0===t&&(t=void 0),this.elements.forEach(o=>{t!==o&&(this.removeScrollHandler(o),this.setScrollPosition(e,o),window.requestAnimationFrame(()=>{this.addScrollHandler(o)}))})}setScrollPosition(e,t){const{vertical:o,horizontal:r}=this.options,n=t.scrollWidth-t.clientWidth,l=t.scrollHeight-t.clientHeight;o&&l&&t.scrollTo({top:l*e.y,behavior:"instant"}),r&&n&&t.scrollTo({left:n*e.x,behavior:"instant"})}get progress(){const t=this.elements.find(t=>e(t));return o(t)}set progress(e){"number"==typeof e&&(e={x:e,y:e});const t={...this.progress,...e};(function(e,t){let o=!0;for(const[r,n]of Object.entries(e))("number"!=typeof n||n<0||n>1)&&(t?.error(`progress.${r} must be a number between 0-1`),o=!1);return o})(t,this.logger)&&this.mirrorScrollPositions(t)}}}); | ||
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?module.exports=t():"function"==typeof define&&define.amd?define(t):(e||self).ScrollMirror=t()}(this,function(){const e=e=>{let{clientWidth:t,clientHeight:o,scrollWidth:r,scrollHeight:n}=e;return n>o||r>t},t=e=>{const t=window.getComputedStyle(e).overflow;return t.includes("auto")||t.includes("scroll")},o=e=>{if(null==e)return{x:0,y:0};const{scrollTop:t,scrollHeight:o,clientHeight:r,scrollLeft:n,scrollWidth:l,clientWidth:s}=e,i=o-r;return{x:n?n/Math.max(1e-5,l-s):0,y:t?t/Math.max(1e-5,i):0}};function r(e){return e.matches("body *")?e:window}return class{constructor(r,n){const l=this;var s;void 0===n&&(n={}),this.elements=void 0,this.defaults={vertical:!0,horizontal:!0,debug:!0},this.options=void 0,this.paused=!1,this.logger=void 0,this.handleScroll=function(e){try{if(l.paused)return Promise.resolve();if(!e.currentTarget)return Promise.resolve();const t=l.getScrollContainer(e.currentTarget);return Promise.resolve(new Promise(e=>{requestAnimationFrame(()=>e())})).then(function(){l.mirrorScrollPositions(o(t),t)})}catch(e){return Promise.reject(e)}},this.elements=[...r].filter(Boolean).map(e=>this.getScrollContainer(e)),this.elements=[...new Set(this.elements)],this.options={...this.defaults,...n},this.options.debug&&(this.logger=(s="[scroll-mirror]",{log:function(){return console.log(s,...[].slice.call(arguments))},warn:function(){return console.warn(s,...[].slice.call(arguments))},error:function(){return console.error(s,...[].slice.call(arguments))}}),function(o,r){if(o.length<1)r?.warn("No elements provided.");else{o.length<2&&r?.warn("Only one element provided.",o),o.some(e=>!e)&&r?.error("Some elements are not defined.",o);for(const n of o)n instanceof HTMLElement&&!e(n)&&r?.warn("Element doesn't have overflow:",n),n instanceof HTMLElement&&n.matches("body *")&&!t(n)&&r?.warn('No "overflow: auto;" or "overflow: scroll;" set on element:',n)}}(this.elements,this.logger)),this.elements.forEach(e=>this.addScrollHandler(e)),this.elements.includes(document.documentElement)&&this.mirrorScrollPositions(o(document.documentElement),document.documentElement)}pause(){this.paused=!0}resume(){this.paused=!1}destroy(){this.elements.forEach(e=>this.removeScrollHandler(e))}addScrollHandler(e){this.removeScrollHandler(e),r(e).addEventListener("scroll",this.handleScroll,{passive:!0})}removeScrollHandler(e){r(e).removeEventListener("scroll",this.handleScroll)}getScrollContainer(e){return e instanceof HTMLElement&&e.matches("body *")?e:document.documentElement}mirrorScrollPositions(e,t){void 0===t&&(t=void 0),this.elements.forEach(o=>{t!==o&&(this.removeScrollHandler(o),this.setScrollPosition(e,o),window.requestAnimationFrame(()=>{this.addScrollHandler(o)}))})}setScrollPosition(e,t){const{vertical:o,horizontal:r}=this.options,n=t.scrollWidth-t.clientWidth,l=t.scrollHeight-t.clientHeight;o&&l&&t.scrollTo({top:l*e.y,behavior:"instant"}),r&&n&&t.scrollTo({left:n*e.x,behavior:"instant"})}get progress(){const t=this.elements.find(t=>e(t));return o(t)}set progress(e){"number"==typeof e&&(e={x:e,y:e});const t={...this.progress,...e};(function(e,t){let o=!0;for(const[r,n]of Object.entries(e))("number"!=typeof n||n<0||n>1)&&(t?.error(`progress.${r} must be a number between 0-1`),o=!1);return o})(t,this.logger)&&this.mirrorScrollPositions(t)}}}); | ||
//# sourceMappingURL=ScrollMirror.umd.js.map |
{ | ||
"name": "scrollmirror", | ||
"amdName": "ScrollMirror", | ||
"version": "1.1.0", | ||
"version": "1.2.0", | ||
"description": "Sync the scroll position of multiple elements on your page", | ||
@@ -6,0 +6,0 @@ "author": { |
@@ -9,3 +9,4 @@ <p align="center"> | ||
[![Test status](https://img.shields.io/github/actions/workflow/status/hirasso/scrollmirror/e2e-tests.yml?branch=main&label=tests)](https://github.com/hirasso/scrollmirror/actions/workflows/e2e-tests.yml) | ||
[![e2e test status](https://img.shields.io/github/actions/workflow/status/hirasso/scrollmirror/e2e-tests.yml?branch=main&label=e2e%20tests)](https://github.com/hirasso/scrollmirror/actions/workflows/e2e-tests.yml) | ||
[![unit test status](https://img.shields.io/github/actions/workflow/status/hirasso/scrollmirror/unit-tests.yml?branch=main&label=unit%20tests)](https://github.com/hirasso/scrollmirror/actions/workflows/unit-tests.yml) | ||
[![License](https://img.shields.io/github/license/hirasso/scrollmirror.svg)](https://github.com/hirasso/scrollmirror/blob/master/LICENSE) | ||
@@ -12,0 +13,0 @@ |
import type { Progress, Options, Logger } from "./support/defs.js"; | ||
import { | ||
getScrollProgress, | ||
hasOverflow, | ||
nextTick, | ||
} from "./support/helpers.js"; | ||
import { getScrollProgress, hasOverflow, nextTick } from "./support/helpers.js"; | ||
@@ -25,3 +21,3 @@ import { | ||
horizontal: true, | ||
debug: true | ||
debug: true, | ||
}; | ||
@@ -88,3 +84,3 @@ /** The parsed options */ | ||
const target = getScrollEventTarget(element); | ||
target.addEventListener("scroll", this.handleScroll); | ||
target.addEventListener("scroll", this.handleScroll, { passive: true }); | ||
} | ||
@@ -91,0 +87,0 @@ |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
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
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
93195
158
0
450