Skip to content

Commit

Permalink
Implement #617.
Browse files Browse the repository at this point in the history
  • Loading branch information
davidjerleke committed Nov 2, 2023
1 parent 4146252 commit a5687cb
Show file tree
Hide file tree
Showing 5 changed files with 28 additions and 16 deletions.
5 changes: 4 additions & 1 deletion packages/embla-carousel-react/src/index.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
export { EmblaOptionsType } from 'embla-carousel/components/Options'
export { EmblaEventType } from 'embla-carousel/components/EventHandler'
export {
EmblaEventType,
EmblaEventListType
} from 'embla-carousel/components/EventHandler'
export { EmblaPluginType } from 'embla-carousel/components/Plugins'
export { EmblaCarouselType } from 'embla-carousel/components/EmblaCarousel'
export { UseEmblaCarouselType } from './components/useEmblaCarousel'
Expand Down
5 changes: 4 additions & 1 deletion packages/embla-carousel-svelte/src/index.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
export { EmblaOptionsType } from 'embla-carousel/components/Options'
export { EmblaEventType } from 'embla-carousel/components/EventHandler'
export {
EmblaEventType,
EmblaEventListType
} from 'embla-carousel/components/EventHandler'
export { EmblaPluginType } from 'embla-carousel/components/Plugins'
export { EmblaCarouselType } from 'embla-carousel/components/EmblaCarousel'
export { EmblaCarouselSvelteType } from './components/emblaCarouselSvelte'
Expand Down
5 changes: 4 additions & 1 deletion packages/embla-carousel-vue/src/index.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
export { EmblaOptionsType } from 'embla-carousel/components/Options'
export { EmblaEventType } from 'embla-carousel/components/EventHandler'
export {
EmblaEventType,
EmblaEventListType
} from 'embla-carousel/components/EventHandler'
export { EmblaPluginType } from 'embla-carousel/components/Plugins'
export { EmblaCarouselType } from 'embla-carousel/components/EmblaCarousel'
export { EmblaCarouselVueType } from './components/emblaCarouselVue'
Expand Down
27 changes: 15 additions & 12 deletions packages/embla-carousel/src/components/EventHandler.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,18 +3,21 @@ import { EmblaCarouselType } from './EmblaCarousel'
type CallbackType = (emblaApi: EmblaCarouselType, evt: EmblaEventType) => void
type ListenersType = Partial<{ [key in EmblaEventType]: CallbackType[] }>

export type EmblaEventType =
| 'init'
| 'pointerDown'
| 'pointerUp'
| 'slidesChanged'
| 'slidesInView'
| 'scroll'
| 'select'
| 'settle'
| 'destroy'
| 'reInit'
| 'resize'
export type EmblaEventType = EmblaEventListType[keyof EmblaEventListType]

export interface EmblaEventListType {
init: 'init'
pointerDown: 'pointerDown'
pointerUp: 'pointerUp'
slidesChanged: 'slidesChanged'
slidesInView: 'slidesInView'
scroll: 'scroll'
select: 'select'
settle: 'settle'
destroy: 'destroy'
reInit: 'reInit'
resize: 'resize'
}

export type EventHandlerType = {
init: (emblaApi: EmblaCarouselType) => void
Expand Down
2 changes: 1 addition & 1 deletion packages/embla-carousel/src/index.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
export { EmblaOptionsType } from './components/Options'
export { EmblaEventType } from './components/EventHandler'
export { EmblaEventType, EmblaEventListType } from './components/EventHandler'
export { EmblaPluginType } from './components/Plugins'
export { EmblaCarouselType } from './components/EmblaCarousel'

Expand Down

0 comments on commit a5687cb

Please sign in to comment.