-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathimage-slider.d.ts
53 lines (50 loc) · 2.27 KB
/
image-slider.d.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
declare module '@lindelwa122/image-slider' {
type Image = { src: string; alt?: string };
/**
* Creates an image slider with the specified dimensions and images.
*
* @param {string} height - The height of the image slider container (e.g., '350px').
* @param {string} width - The width of the image slider container (e.g., '450px').
* @param {...Image} images - Image objects in the format { src: 'image_url', alt: 'image_description' }.
* @throws Will throw an error if image objects are not provided or if they don't have the src attribute.
* @returns {Object} An object with methods to manage the image slider.
*/
export default function imageSlider(
height: string,
width: string,
...images: Image[]
): {
/**
* Adds the image slider to the specified parent element using its selector.
*
* @param {string} selectors - The CSS selector of the parent element where the image slider will be appended.
*/
append(selectors: string): void;
/**
* Creates an interval to automatically advance the image in the slider.
*
* @param {number} [ms=1000] - The number of milliseconds between each image update.
* @returns {number} An interval ID that can be used with clearInterval to stop the automatic image updates.
*/
auto(ms?: number): number;
/**
* Updates the slider configuration with the specified new settings.
*
* @param {Object} updatedConfig - The updated configurations for the slider.
* @param {boolean} updatedConfig.animation - Whether to enable animation.
* @param {number} updatedConfig.animationDuration - The duration of the animation in milliseconds.
* @param {"cover" | "none" | "fill" | "contain"} updatedConfig.imageFit - The image fit mode.
* @param {boolean} updatedConfig.showCounter - Whether to display the image counter.
* @param {boolean} updatedConfig.showControls - Whether to display navigation controls.
* @param {boolean} updatedConfig.showDots - Whether to display navigation dots.
*/
updateConfig(updatedConfig: {
animation?: boolean;
animationDuration?: number;
imageFit?: 'cover' | 'none' | 'fill' | 'contain';
showCounter?: boolean;
showControls?: boolean;
showDots?: boolean;
}): void;
};
}