esl
esl copied to clipboard
[🚀esl-carousel]: extend `ESLCarousel.[proto].go` method API
As an ESLCarousel consumer, I want to have a smart unified API to change the carousel active slide.
It is requested to extend API to the following:
type AbstractItemTraget =
ESLCarouselSlide | // Exact slide instance
number | // Exact index of the item
`+${number}` | // Offset count of items to add to the current index
`-${number}` | // Offset count of items to subtract from the current index
'next' | // Increment current index by 1
'prev' | // Decrement current index by 1
`set${number}` | // Move to the n-th set of items
'nextset' | // Move to the next set of items
'prevset'; // Move to the previous set of items
public async go(next: AbstractItemTraget, direction?: CarouselDirection, force: boolean = false): Promise<void>;
NOTE:
- by
set
is called a sequence of slides, count of visible items limit. the last set of items should end with the last item and could intersect with the previous set. e.g. :
slides: 1, 2, 3, 4, 5
limit 2
sets: [1,2], [3, 4], [4, 5]
limit: 3
sets: [1,2,3], [3,4,5]
-
next | prev | nextset | prevset
target looped (meaning that the next from the last item or set is first, and vice-versa ) only if the carousel is in loop mode
Priority: High
Notes: TBD
group: 0
, group: 1
, group: -1
, group: +1
, group:next
, group:prev
slide: 0
, slide: 1
, slide: -1
, slide: +1
, slide:next
, slide:prev
@ala-n to update the spec