supercharged-slider
Advanced tools
Comparing version 0.3.2 to 0.3.3
@@ -182,3 +182,2 @@ var index = ""; | ||
return; | ||
console.log({ middlewares, currentBreakpoint }); | ||
runMiddlewares(Object.values(middlewares), slider); | ||
@@ -213,3 +212,3 @@ } | ||
const isVertical = () => slider.direction === "vertical"; | ||
const isTargetValid = (e) => e.composedPath().includes(slider.element); | ||
const isTargetValid = (e) => e.composedPath().includes(slider.wrapper); | ||
let isDragging = false; | ||
@@ -260,3 +259,2 @@ let wrapperPositionBeforeDrag = 0; | ||
const onCleanUp = () => { | ||
console.log("cleanUp"); | ||
isDragging = false; | ||
@@ -263,0 +261,0 @@ wrapperPositionBeforeDrag = 0; |
@@ -1,2 +0,2 @@ | ||
export declare type Hook<T extends unknown> = (props?: T) => void; | ||
export declare type Hook<T extends unknown> = (props: T) => void; | ||
export interface Slider { | ||
@@ -3,0 +3,0 @@ element: HTMLElement; |
{ | ||
"name": "supercharged-slider", | ||
"version": "0.3.2", | ||
"version": "0.3.3", | ||
"description": "A super modular tiny slider library.", | ||
@@ -5,0 +5,0 @@ "license": "MIT", |
@@ -11,3 +11,3 @@ import './demo.scss'; | ||
import vertical from './middlewares/vertical'; | ||
import autoplay from './middlewares/autoplay'; | ||
import navigation from './middlewares/navigation'; | ||
@@ -28,3 +28,6 @@ const instance1 = createSlider({ | ||
slidesPerView(6), | ||
autoplay({ interval: 1000 }), | ||
navigation({ | ||
prev: '.s-slider-2 .s-navigation-button-prev', | ||
next: '.s-slider-2 .s-navigation-button-next', | ||
}), | ||
breakpoints({ | ||
@@ -31,0 +34,0 @@ 768: [slidesPerView(1)], |
@@ -26,4 +26,10 @@ import { Middleware } from '~/types'; | ||
const onCleanUp = () => { | ||
clearTimeout(timeout); | ||
slider.removeSlideChangeHook(start); | ||
slider.removeCleanUpHook(onCleanUp); | ||
}; | ||
slider.onCleanUp(onCleanUp); | ||
slider.onSlideChange(start); | ||
slider.onCleanUp(() => clearTimeout(timeout)); | ||
}, | ||
@@ -30,0 +36,0 @@ }); |
@@ -40,4 +40,2 @@ import runMiddlewares from '~/utils/runMiddlewares'; | ||
console.log({ middlewares, currentBreakpoint }); | ||
runMiddlewares(Object.values(middlewares), slider); | ||
@@ -44,0 +42,0 @@ }, |
@@ -8,3 +8,3 @@ import { Middleware } from '~/types'; | ||
const isVertical = () => slider.direction === 'vertical'; | ||
const isTargetValid = (e: MouseEvent) => e.composedPath().includes(slider.element); | ||
const isTargetValid = (e: MouseEvent) => e.composedPath().includes(slider.wrapper); | ||
@@ -67,3 +67,2 @@ let isDragging = false; | ||
const onCleanUp = () => { | ||
console.log('cleanUp'); | ||
isDragging = false; | ||
@@ -70,0 +69,0 @@ wrapperPositionBeforeDrag = 0; |
@@ -1,2 +0,2 @@ | ||
export type Hook<T extends unknown> = (props?: T) => void; | ||
export type Hook<T extends unknown> = (props: T) => void; | ||
export interface Slider { | ||
@@ -3,0 +3,0 @@ element: HTMLElement |
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
41158
49
1053