Skip to content

Commit 0b076ef

Browse files
authored
Merge pull request #469 from ismail9k/refactor/enhancments
Refactor/enhancments
2 parents cc629f4 + 19d1fed commit 0b076ef

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

44 files changed

+752
-603
lines changed

docs/api/data.md

Lines changed: 9 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -21,13 +21,12 @@ if (myCarousel.data.currentSlide === 10) {
2121

2222
## Available Data
2323

24-
| Data | Description |
25-
| ---------------- | -------------------------------------------------------------------------- |
26-
| `config` | the current carousel configuration |
27-
| `slidesCount` | slides total count |
28-
| ~~`slideWidth`~~ | ~~single slide width~~ <Badge type="danger" text="Rename to slideSize"/> |
29-
| `slideSize` | single slide width or height |
30-
| `currentSlide` | current slide index |
31-
| `maxSlide` | maximum slide index |
32-
| `minSlide` | minimum slide index |
33-
| `middleSlide` | middle slide index |
24+
| Data | Description |
25+
| -------------- | ---------------------------------- |
26+
| `config` | the current carousel configuration |
27+
| `currentSlide` | current slide index |
28+
| `maxSlide` | maximum slide index |
29+
| `middleSlide` | middle slide index |
30+
| `minSlide` | minimum slide index |
31+
| `slideSize` | single slide width or height |
32+
| `slidesCount` | slides total count |

docs/api/events.md

Lines changed: 22 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -30,18 +30,23 @@ const handleSlideStart = (data) => {
3030

3131
Triggered before the carousel is initialized. Use this to perform any setup tasks required before the carousel is ready.
3232

33+
### @drag
34+
35+
Triggered while the carousel is being dragged, providing live positional data. Emits the following:
36+
37+
- `x`: The horizontal drag position.
38+
- `y`: The vertical drag position.
39+
3340
### @init
3441

3542
Triggered once the carousel is mounted and fully initialized. This is ideal for executing post-initialization logic.
3643

37-
### slide-start
44+
### @loop
3845

39-
Triggered at the beginning of the sliding function. Emits the following data:
46+
Triggered when the carousel loops over (wraps around), only in wrap-around mode. Emits the following data:
4047

41-
- `slidingToIndex`: The index of the slide the carousel is moving to.
42-
- `currentSlideIndex`: The current slide index before the transition starts.
43-
- `prevSlideIndex`: The index of the slide before the current one.
44-
- `slidesCount`: The total number of slides in the carousel.
48+
- `currentSlideIndex`: The current slide index before the loop occurs.
49+
- `slidingToIndex`: The index of the slide the carousel loops to.
4550

4651
### @slide-end
4752

@@ -51,33 +56,28 @@ Triggered after the sliding animation completes and the current slide is updated
5156
- `prevSlideIndex`: The index of the slide before the transition.
5257
- `slidesCount`: The total number of slides in the carousel.
5358

54-
### @loop
55-
56-
Triggered when the carousel loops over (wraps around), only in wrap-around mode. Emits the following data:
57-
58-
- `slidingToIndex`: The index of the slide the carousel loops to.
59-
- `currentSlideIndex`: The current slide index before the loop occurs.
60-
61-
### @drag
62-
63-
Triggered while the carousel is being dragged, providing live positional data. Emits the following:
64-
65-
- `x`: The horizontal drag position.
66-
- `y`: The vertical drag position.
67-
6859
### @slide-registered
6960

7061
Triggered when a new slide is registered with the carousel. Emits the following data:
7162

72-
- `slide`: The Vue component instance of the registered slide
7363
- `index`: The index position where the slide was registered
64+
- `slide`: The Vue component instance of the registered slide
65+
66+
### @slide-start
67+
68+
Triggered at the beginning of the sliding function. Emits the following data:
69+
70+
- `currentSlideIndex`: The current slide index before the transition starts.
71+
- `prevSlideIndex`: The index of the slide before the current one.
72+
- `slidingToIndex`: The index of the slide the carousel is moving to.
73+
- `slidesCount`: The total number of slides in the carousel.
7474

7575
### @slide-unregistered
7676

7777
Triggered when a slide is unregistered (removed) from the carousel. Emits the following data:
7878

79-
- `slide`: The Vue component instance of the unregistered slide
8079
- `index`: The index position from which the slide was removed
80+
- `slide`: The Vue component instance of the unregistered slide
8181

8282
## Notes
8383

docs/api/methods.md

Lines changed: 14 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -17,10 +17,6 @@ myCarousel.next()
1717
myCarousel.updateSlideSize()
1818
```
1919

20-
## slideTo(index: number)
21-
22-
Slide to specific slide index
23-
2420
## next()
2521

2622
Slide to the next slide
@@ -29,37 +25,32 @@ Slide to the next slide
2925

3026
Slide to the previous slide
3127

32-
## ~~updateSlideWidth()~~ <Badge type="danger" text="Rename to updateSlideSize"/>
28+
## restartCarousel()
3329

34-
~~Update `slideWidth` value based on `itemsToShow` and the current carousel width~~
30+
Restart the carousel settings and data, internally it calls:
3531

36-
## updateSlideSize()
32+
- `resetAutoplay`
33+
- `updateBreakpointsConfig`
34+
- `updateSlidesData`
35+
- `updateSlideSize`
3736

38-
Update `slideSize` value based on `itemsToShow`, `dir` and the current carousel width/height
37+
## slideTo(index: number, skipTransition = false)
38+
39+
Slide to specific slide index
3940

4041
## updateBreakpointsConfig()
4142

4243
Update the current carousel config based on `breakpoints` settings and screen width
4344

45+
## updateSlideSize()
46+
47+
Update `slideSize` value based on `itemsToShow`, `dir` and the current carousel width/height
48+
4449
## updateSlidesData()
4550

4651
Update all the slide related date includes:
4752

4853
- `currentSlideIndex`
49-
- `middleSlide`
5054
- `maxSlide`
55+
- `middleSlide`
5156
- `minSlide`
52-
53-
## ~~initDefaultConfig()~~ <Badge type="danger" text="This method is deprecated"/>
54-
55-
~~Init carousel default configurations~~
56-
57-
## restartCarousel()
58-
59-
Restart the carousel settings and data, internally it calls:
60-
61-
- ~~`initDefaultConfig`~~
62-
- `resetAutoplay`
63-
- `updateBreakpointsConfig`
64-
- `updateSlidesData`
65-
- `updateSlideSize`

docs/components/navigation.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -61,12 +61,12 @@ You can customize the navigation buttons using slots:
6161

6262
| Variable | Default Value | Description |
6363
| ------------------------ | ------------------------- | ------------------------------- |
64-
| `--vc-nav-width` | `30px` | Navigation button width |
65-
| `--vc-nav-height` | `30px` | Navigation button height |
64+
| `--vc-nav-background` | `transparent` | Navigation button background |
6665
| `--vc-nav-border-radius` | `0` | Navigation button border radius |
6766
| `--vc-nav-color` | `var(--vc-clr-primary)` | Navigation button color |
6867
| `--vc-nav-color-hover` | `var(--vc-clr-secondary)` | Navigation button hover color |
69-
| `--vc-nav-background` | `transparent` | Navigation button background |
68+
| `--vc-nav-height` | `30px` | Navigation button height |
69+
| `--vc-nav-width` | `30px` | Navigation button width |
7070

7171
## Accessibility
7272

docs/components/pagination.md

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -35,13 +35,12 @@ import { Pagination as CarouselPagination } from 'vue3-carousel'
3535

3636
| Variable | Default Value | Description |
3737
| --------------------------- | ------------------------- | ---------------------------------- |
38-
| `--vc-pgn-width` | `16px` | Pagination button width |
38+
| `--vc-pgn-active-color` | `var(--vc-clr-primary)` | Active pagination button color |
39+
| `--vc-pgn-background-color` | `var(--vc-clr-secondary)` | Pagination button background color |
40+
| `--vc-pgn-border-radius` | `0` | Pagination button border radius |
3941
| `--vc-pgn-height` | `4px` | Pagination button height |
4042
| `--vc-pgn-margin` | `6px 5px` | Pagination button margin |
41-
| `--vc-pgn-border-radius` | `0` | Pagination button border radius |
42-
| `--vc-pgn-background-color` | `var(--vc-clr-secondary)` | Pagination button background color |
43-
| `--vc-pgn-active-color` | `var(--vc-clr-primary)` | Active pagination button color |
44-
43+
| `--vc-pgn-width` | `16px` | Pagination button width |
4544

4645
## Accessibility
4746

docs/components/slide.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -31,8 +31,8 @@ The default slot exposes these reactive properties for custom slide content:
3131
| currentIndex | Number | Current index position of the slide |
3232
| isActive | Boolean | True when this slide is the current active slide |
3333
| isClone | Boolean | True if this is a clone slide (used for infinite scroll) |
34-
| isPrev | Boolean | True if this slide is immediately before the active slide |
3534
| isNext | Boolean | True if this slide is immediately after the active slide |
35+
| isPrev | Boolean | True if this slide is immediately before the active slide |
3636
| isSliding | Boolean | True during slide transition animations |
3737
| isVisible | Boolean | True when the slide is within the visible viewport |
3838

@@ -80,12 +80,12 @@ The component provides these CSS classes for styling:
8080
| CSS Class | Description |
8181
| --------------------------- | ------------------------- |
8282
| `.carousel__slide` | Base slide styles |
83-
| `.carousel__slide--clone` | Cloned slide styles |
84-
| `.carousel__slide--visible` | Visible slide styles |
8583
| `.carousel__slide--active` | Active slide styles |
86-
| `.carousel__slide--prev` | Previous slide styles |
84+
| `.carousel__slide--clone` | Cloned slide styles |
8785
| `.carousel__slide--next` | Next slide styles |
86+
| `.carousel__slide--prev` | Previous slide styles |
8887
| `.carousel__slide--sliding` | Styles during transitions |
88+
| `.carousel__slide--visible` | Visible slide styles |
8989

9090
## Best Practices
9191

0 commit comments

Comments
 (0)