embla-carousel-auto-scroll
Advanced tools
Comparing version 8.0.0-rc23 to 8.0.0
@@ -74,6 +74,6 @@ 'use strict'; | ||
function destroy() { | ||
emblaApi.off('init', startScroll).off('reInit', startScroll).off('pointerDown', stopScroll).off('pointerUp', startScrollOnSettle).off('settle', onSettle); | ||
stopScroll(); | ||
destroyed = true; | ||
playing = false; | ||
emblaApi.off('init', startScroll).off('reInit', startScroll).off('pointerDown', stopScroll).off('pointerUp', startScrollOnSettle).off('settle', onSettle); | ||
stopScroll(); | ||
} | ||
@@ -80,0 +80,0 @@ function startScroll() { |
{ | ||
"name": "embla-carousel-auto-scroll", | ||
"version": "8.0.0-rc23", | ||
"version": "8.0.0", | ||
"author": "David Jerleke", | ||
@@ -51,3 +51,3 @@ "description": "An auto scroll plugin for Embla Carousel", | ||
"peerDependencies": { | ||
"embla-carousel": "8.0.0-rc23" | ||
"embla-carousel": "8.0.0" | ||
}, | ||
@@ -54,0 +54,0 @@ "main": "embla-carousel-auto-scroll.cjs.js", |
@@ -1,1 +0,1 @@ | ||
!function(t,n){"object"==typeof exports&&"undefined"!=typeof module?module.exports=n():"function"==typeof define&&define.amd?define(n):(t="undefined"!=typeof globalThis?globalThis:t||self).EmblaCarouselAutoScroll=n()}(this,(function(){"use strict";const t={direction:"forward",speed:2,startDelay:1e3,active:!0,breakpoints:{},playOnInit:!0,stopOnFocusIn:!0,stopOnInteraction:!0,stopOnMouseEnter:!1,rootNode:null};function n(o={}){let e,i,r,s,c,l=!1,a=!0,u=0;function d(){if(r||l)return;if(!a)return;i.emit("autoScroll:play");const t=i.internalEngine(),{ownerWindow:n}=t;u=n.setTimeout((()=>{t.scrollBody=function(t){const{location:n,target:o,scrollTarget:r,index:s,indexPrevious:c,limit:{reachedMin:l,reachedMax:a,constrain:u},options:{loop:d}}=t,p="forward"===e.direction?-1:1,g=()=>S;let y=0,m=0,O=n.get(),I=0,w=!1;function b(){let t=0;y=p*e.speed,O+=y,n.add(y),o.set(n),t=O-I,m=Math.sign(t),I=O;const g=r.byDistance(0,!1).index;s.get()!==g&&(c.set(s.get()),s.set(g),i.emit("select"));const b="forward"===e.direction?l(n.get()):a(n.get());if(!d&&b){w=!0;const t=u(n.get());n.set(t),o.set(n),f()}return S}const S={direction:()=>m,duration:()=>-1,velocity:()=>y,settled:()=>w,seek:b,useBaseFriction:g,useBaseDuration:g,useFriction:g,useDuration:g};return S}(t),t.animation.start()}),s),l=!0}function f(){if(r||!l)return;i.emit("autoScroll:stop");const t=i.internalEngine(),{ownerWindow:n}=t;t.scrollBody=c,n.clearTimeout(u),u=0,l=!1}function p(){a&&d(),i.off("settle",p)}function g(){i.on("settle",p)}return{name:"autoScroll",options:o,init:function(l,u){i=l;const{mergeOptions:p,optionsAtMedia:y}=u,m=p(t,n.globalOptions),O=p(m,o);if(e=y(O),i.scrollSnapList().length<=1)return;s=e.startDelay,r=!1,c=i.internalEngine().scrollBody;const{eventStore:I}=i.internalEngine(),w=i.rootNode(),b=e.rootNode&&e.rootNode(w)||w,S=i.containerNode();i.on("pointerDown",f),e.stopOnInteraction||i.on("pointerUp",g),e.stopOnMouseEnter&&(I.add(b,"mouseenter",(()=>{a=!1,f()})),e.stopOnInteraction||I.add(b,"mouseleave",(()=>{a=!0,d()}))),e.stopOnFocusIn&&(I.add(S,"focusin",(()=>{f(),i.scrollTo(i.selectedScrollSnap(),!0)})),e.stopOnInteraction||I.add(S,"focusout",d)),e.playOnInit&&i.on("init",d).on("reInit",d)},destroy:function(){r=!0,l=!1,i.off("init",d).off("reInit",d).off("pointerDown",f).off("pointerUp",g).off("settle",p),f()},play:function(t){void 0!==t&&(s=t),a=!0,d()},stop:function(){l&&f()},reset:function(){l&&(f(),g())},isPlaying:function(){return l}}}return n.globalOptions=void 0,n})); | ||
!function(t,n){"object"==typeof exports&&"undefined"!=typeof module?module.exports=n():"function"==typeof define&&define.amd?define(n):(t="undefined"!=typeof globalThis?globalThis:t||self).EmblaCarouselAutoScroll=n()}(this,(function(){"use strict";const t={direction:"forward",speed:2,startDelay:1e3,active:!0,breakpoints:{},playOnInit:!0,stopOnFocusIn:!0,stopOnInteraction:!0,stopOnMouseEnter:!1,rootNode:null};function n(o={}){let e,i,r,s,c,l=!1,a=!0,u=0;function d(){if(r||l)return;if(!a)return;i.emit("autoScroll:play");const t=i.internalEngine(),{ownerWindow:n}=t;u=n.setTimeout((()=>{t.scrollBody=function(t){const{location:n,target:o,scrollTarget:r,index:s,indexPrevious:c,limit:{reachedMin:l,reachedMax:a,constrain:u},options:{loop:d}}=t,p="forward"===e.direction?-1:1,g=()=>S;let y=0,m=0,O=n.get(),I=0,w=!1;function b(){let t=0;y=p*e.speed,O+=y,n.add(y),o.set(n),t=O-I,m=Math.sign(t),I=O;const g=r.byDistance(0,!1).index;s.get()!==g&&(c.set(s.get()),s.set(g),i.emit("select"));const b="forward"===e.direction?l(n.get()):a(n.get());if(!d&&b){w=!0;const t=u(n.get());n.set(t),o.set(n),f()}return S}const S={direction:()=>m,duration:()=>-1,velocity:()=>y,settled:()=>w,seek:b,useBaseFriction:g,useBaseDuration:g,useFriction:g,useDuration:g};return S}(t),t.animation.start()}),s),l=!0}function f(){if(r||!l)return;i.emit("autoScroll:stop");const t=i.internalEngine(),{ownerWindow:n}=t;t.scrollBody=c,n.clearTimeout(u),u=0,l=!1}function p(){a&&d(),i.off("settle",p)}function g(){i.on("settle",p)}return{name:"autoScroll",options:o,init:function(l,u){i=l;const{mergeOptions:p,optionsAtMedia:y}=u,m=p(t,n.globalOptions),O=p(m,o);if(e=y(O),i.scrollSnapList().length<=1)return;s=e.startDelay,r=!1,c=i.internalEngine().scrollBody;const{eventStore:I}=i.internalEngine(),w=i.rootNode(),b=e.rootNode&&e.rootNode(w)||w,S=i.containerNode();i.on("pointerDown",f),e.stopOnInteraction||i.on("pointerUp",g),e.stopOnMouseEnter&&(I.add(b,"mouseenter",(()=>{a=!1,f()})),e.stopOnInteraction||I.add(b,"mouseleave",(()=>{a=!0,d()}))),e.stopOnFocusIn&&(I.add(S,"focusin",(()=>{f(),i.scrollTo(i.selectedScrollSnap(),!0)})),e.stopOnInteraction||I.add(S,"focusout",d)),e.playOnInit&&i.on("init",d).on("reInit",d)},destroy:function(){i.off("init",d).off("reInit",d).off("pointerDown",f).off("pointerUp",g).off("settle",p),f(),r=!0,l=!1},play:function(t){void 0!==t&&(s=t),a=!0,d()},stop:function(){l&&f()},reset:function(){l&&(f(),g())},isPlaying:function(){return l}}}return n.globalOptions=void 0,n})); |
@@ -72,6 +72,6 @@ const defaultOptions = { | ||
function destroy() { | ||
emblaApi.off('init', startScroll).off('reInit', startScroll).off('pointerDown', stopScroll).off('pointerUp', startScrollOnSettle).off('settle', onSettle); | ||
stopScroll(); | ||
destroyed = true; | ||
playing = false; | ||
emblaApi.off('init', startScroll).off('reInit', startScroll).off('pointerDown', stopScroll).off('pointerUp', startScrollOnSettle).off('settle', onSettle); | ||
stopScroll(); | ||
} | ||
@@ -78,0 +78,0 @@ function startScroll() { |
{ | ||
"name": "embla-carousel-auto-scroll", | ||
"version": "8.0.0-rc23", | ||
"version": "8.0.0", | ||
"author": "David Jerleke", | ||
@@ -51,3 +51,3 @@ "description": "An auto scroll plugin for Embla Carousel", | ||
"peerDependencies": { | ||
"embla-carousel": "8.0.0-rc23" | ||
"embla-carousel": "8.0.0" | ||
}, | ||
@@ -54,0 +54,0 @@ "module": "embla-carousel-auto-scroll.esm.js", |
{ | ||
"name": "embla-carousel-auto-scroll", | ||
"version": "8.0.0-rc23", | ||
"version": "8.0.0", | ||
"author": "David Jerleke", | ||
@@ -62,3 +62,3 @@ "description": "An auto scroll plugin for Embla Carousel", | ||
"peerDependencies": { | ||
"embla-carousel": "8.0.0-rc23" | ||
"embla-carousel": "8.0.0" | ||
}, | ||
@@ -65,0 +65,0 @@ "exports": { |
@@ -57,22 +57,20 @@ <br /> | ||
</a> | ||
| ||
<a href="https://www.embla-carousel.com/get-started/module/"> | ||
<img src="https://www.embla-carousel.com/typescript-logo.svg" width="40" height="40" /> | ||
</a> | ||
| ||
<a href="https://www.embla-carousel.com/get-started/react/"> | ||
<img src="https://www.embla-carousel.com/react-logo.svg" width="40" height="40" /> | ||
</a> | ||
| ||
<a href="https://www.embla-carousel.com/get-started/vue/"> | ||
<img src="https://www.embla-carousel.com/vue-logo.svg" width="40" height="40" /> | ||
</a> | ||
| ||
<a href="https://www.embla-carousel.com/get-started/svelte/"> | ||
<img src="https://www.embla-carousel.com/svelte-logo.svg" width="40" height="40" /> | ||
</a> | ||
| ||
<a href="https://www.embla-carousel.com/get-started/solid/"> | ||
<img src="https://www.embla-carousel.com/solid-logo.svg" width="40" height="40" /> | ||
</a> | ||
<a href="https://github.com/donaldxdonald/embla-carousel-angular?tab=readme-ov-file#installation"> | ||
<img src="https://www.embla-carousel.com/angular-logo.svg" width="40" height="40" /> | ||
</a> | ||
</p> | ||
@@ -145,4 +143,4 @@ </div> | ||
<img src="https://avatars2.githubusercontent.com/u/75290989?s=120&v=4" title="fcasibu" width="50" height="50" style="max-width: 100%" /> | ||
</a><a href="https://github.com/sedlukha"> | ||
<img src="https://avatars2.githubusercontent.com/u/14075940?s=120&v=4" title="sedlukha" width="50" height="50" style="max-width: 100%" /> | ||
</a><a href="https://github.com/cundd"> | ||
<img src="https://avatars2.githubusercontent.com/u/743122?s=120&v=4" title="cundd" width="50" height="50" style="max-width: 100%" /> | ||
</a> | ||
@@ -159,10 +157,22 @@ </p> | ||
<p align="center"> | ||
Special thanks to <a href="https://github.com/gunnarx2">gunnarx2</a> for creating the React wrapper <a href="https://www.embla-carousel.com/get-started/react/">useEmblaCarousel</a>, to <a href="https://github.com/xiel">xiel</a> for creating the <a href="https://github.com/xiel/embla-carousel-wheel-gestures">Embla Carousel Wheel Gestures</a> plugin, to <a href="https://github.com/LiamMartens">LiamMartens</a> for creating the Solid wrapper <a href="https://www.embla-carousel.com/get-started/solid/">createEmblaCarousel</a>, and to <a href="https://github.com/zaaakher">zaaakher</a> for your continuous and awesome contributions. | ||
<sup> | ||
<a href="https://github.com/gunnarx2">gunnarx2</a> - React wrapper <a href="https://www.embla-carousel.com/get-started/react/">useEmblaCarousel</a>. | ||
</sup> | ||
<br> | ||
<sup> | ||
<a href="https://github.com/LiamMartens">LiamMartens</a> - Solid wrapper <a href="https://www.embla-carousel.com/get-started/solid/">createEmblaCarousel</a>. | ||
</sup> | ||
<br> | ||
<sup> | ||
<a href="https://github.com/donaldxdonald">donaldxdonald</a>, <a href="https://github.com/zip-fa">zip-fa</a>, <a href="https://github.com/JeanMeche">JeanMeche</a> - Angular wrapper <a href="https://github.com/donaldxdonald/embla-carousel-angular?tab=readme-ov-file#installation">EmblaCarouselDirective</a>. | ||
</sup> | ||
<br> | ||
<sup> | ||
<a href="https://github.com/xiel">xiel</a> - Plugin <a href="https://github.com/xiel/embla-carousel-wheel-gestures">Embla Carousel Wheel Gestures</a>. | ||
</sup> | ||
<br> | ||
<sup> | ||
<a href="https://github.com/zaaakher">zaaakher</a> - Contributing <a href="https://github.com/davidjerleke/embla-carousel/blob/master/CONTRIBUTING.md">guidelines</a>. | ||
</sup> | ||
</p> | ||
<p align="center"> | ||
<a href="https://github.com/gunnarx2"><img src="https://avatars2.githubusercontent.com/u/10469652?s=120&v=4" title="gunnarx2" width="50" height="50" style="max-width:100%;"></a> | ||
<a href="https://github.com/xiel"><img src="https://avatars0.githubusercontent.com/u/615522?s=120&v=4" title="xiel" width="50" height="50" style="max-width:100%;"></a> | ||
<a href="https://github.com/LiamMartens"><img src="https://avatars0.githubusercontent.com/u/5265324?s=120&v=4" title="LiamMartens" width="50" height="50" style="max-width:100%;"></a> | ||
<a href="https://github.com/zaaakher"><img src="https://avatars0.githubusercontent.com/u/46135573?s=120&v=4" title="zaaakher" width="50" height="50" style="max-width:100%;"></a> | ||
</p> | ||
</div> | ||
@@ -175,4 +185,5 @@ | ||
<p align="center"> | ||
<sup>Copyright © 2019-present, David Jerleke.</sup><br> | ||
Embla is <a href="https://github.com/davidjerleke/embla-carousel/blob/master/LICENSE">MIT licensed</a> 💖. | ||
Embla is <a href="https://github.com/davidjerleke/embla-carousel/blob/master/LICENSE">MIT licensed</a> 💖.<br><br> | ||
<sup>Embla Carousel - Copyright © 2019-present.</sup><br /> | ||
<sup>Package created by David Jerleke.</sup> | ||
</p> | ||
@@ -179,0 +190,0 @@ |
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
No v1
QualityPackage is not semver >=1. This means it is not stable and does not support ^ ranges.
Found 1 instance in 1 package
1
200
64962