Skip to content

Commit

Permalink
fix: improve types
Browse files Browse the repository at this point in the history
  • Loading branch information
astagi committed Jan 27, 2023
1 parent 21e89ff commit a9bc9b8
Show file tree
Hide file tree
Showing 39 changed files with 694 additions and 25 deletions.
Empty file modified types/index.d.ts
100644 → 100755
Empty file.
14 changes: 14 additions & 0 deletions types/plugins/accordion.d.ts
100644 → 100755
Original file line number Diff line number Diff line change
@@ -1,10 +1,24 @@
import { default as BaseComponent } from 'bootstrap/js/dist/base-component'
import { GetInstanceFactory, GetOrCreateInstanceFactory } from 'bootstrap/js/dist/base-component';

type KeyName = 'ArrowDown' | 'ArrowUp' | 'Home' | 'End'

declare class Accordion extends BaseComponent {
static get NAME(): string

/**
* Static method which allows you to get the instance associated
* with a DOM element.
*/
static getInstance: GetInstanceFactory<Accordion>;
/**
* Static method which allows you to get the modal instance associated with
* a DOM element, or create a new one in case it wasn’t initialised
*/
static getOrCreateInstance: GetOrCreateInstanceFactory<
Accordion
>;

constructor(element: HTMLElement)

handleKeyDown(keyName: KeyName, target: HTMLElement, evt: Event): void
Expand Down
17 changes: 16 additions & 1 deletion types/plugins/alert.d.ts
100644 → 100755
Original file line number Diff line number Diff line change
@@ -1,5 +1,20 @@
import { Alert as BSAlert } from 'bootstrap'
import { GetInstanceFactory, GetOrCreateInstanceFactory } from 'bootstrap/js/dist/base-component';

declare class Alert extends BSAlert {}
declare class Alert extends BSAlert {
/**
* Static method which allows you to get the instance associated
* with a DOM element.
*/
static getInstance: GetInstanceFactory<Alert>;
/**
* Static method which allows you to get the modal instance associated with
* a DOM element, or create a new one in case it wasn’t initialised
*/
static getOrCreateInstance: GetOrCreateInstanceFactory<
Alert
>;

}

export { Alert }
46 changes: 45 additions & 1 deletion types/plugins/backToTop.d.ts
100644 → 100755
Original file line number Diff line number Diff line change
@@ -1,9 +1,22 @@
import { default as BaseComponent } from 'bootstrap/js/dist/base-component'
import { GetInstanceFactory, GetOrCreateInstanceFactory } from 'bootstrap/js/dist/base-component';

declare class BackToTop extends BaseComponent {
static get NAME(): string
/**
* Static method which allows you to get the instance associated
* with a DOM element.
*/
static getInstance: GetInstanceFactory<BackToTop>;
/**
* Static method which allows you to get the modal instance associated with
* a DOM element, or create a new one in case it wasn’t initialised
*/
static getOrCreateInstance: GetOrCreateInstanceFactory<
BackToTop, Partial<BackToTop.Options>
>;

constructor(element: HTMLElement, config: any)
constructor(element: HTMLElement, config?: Partial<BackToTop.Options>)

_config: any
_scrollCb: {
Expand All @@ -30,4 +43,35 @@ declare class BackToTop extends BaseComponent {
_bindEvents(): void
}

declare namespace BackToTop {

interface Options {
/**
* Top position
*
* @default 0
*/
positionTop: number;
/**
* Scroll limit
*
* @default 100
*/
scrollLimit: number;
/**
* Scroll duration
*
* @default 800
*/
duration: number;
/**
* Scroll easing
*
* @default 'easeInOutSine'
*/
easing: string;
}

}

export { BackToTop }
14 changes: 13 additions & 1 deletion types/plugins/button.d.ts
100644 → 100755
Original file line number Diff line number Diff line change
@@ -1,5 +1,17 @@
import { Button as BSButton } from 'bootstrap'
import { GetInstanceFactory, GetOrCreateInstanceFactory } from 'bootstrap/js/dist/base-component';

declare class Button extends BSButton {}
declare class Button extends BSButton {
/**
* Static method which allows you to get the instance associated
* with a DOM element.
*/
static getInstance: GetInstanceFactory<Button>;
/**
* Static method which allows you to get the modal instance associated with
* a DOM element, or create a new one in case it wasn’t initialised
*/
static getOrCreateInstance: GetOrCreateInstanceFactory<Button>;
}

export { Button }
16 changes: 16 additions & 0 deletions types/plugins/carousel-bi.d.ts
100644 → 100755
Original file line number Diff line number Diff line change
@@ -1,7 +1,23 @@
import { default as BaseComponent } from 'bootstrap/js/dist/base-component'
import { GetInstanceFactory, GetOrCreateInstanceFactory } from 'bootstrap/js/dist/base-component';

import Splide from '@splidejs/splide'

declare class CarouselBI extends BaseComponent {

/**
* Static method which allows you to get the instance associated
* with a DOM element.
*/
static getInstance: GetInstanceFactory<CarouselBI>;
/**
* Static method which allows you to get the modal instance associated with
* a DOM element, or create a new one in case it wasn’t initialised
*/
static getOrCreateInstance: GetOrCreateInstanceFactory<
CarouselBI
>;

static get NAME(): string

constructor(element: HTMLElement)
Expand Down
16 changes: 15 additions & 1 deletion types/plugins/carousel.d.ts
100644 → 100755
Original file line number Diff line number Diff line change
@@ -1,5 +1,19 @@
import { Carousel as BSCarousel } from 'bootstrap'
import { GetInstanceFactory, GetOrCreateInstanceFactory } from 'bootstrap/js/dist/base-component';

declare class Carousel extends BSCarousel {}
declare class Carousel extends BSCarousel {
/**
* Static method which allows you to get the instance associated
* with a DOM element.
*/
static getInstance: GetInstanceFactory<Carousel>;
/**
* Static method which allows you to get the modal instance associated with
* a DOM element, or create a new one in case it wasn’t initialised
*/
static getOrCreateInstance: GetOrCreateInstanceFactory<
Carousel
>;
}

export { Carousel }
16 changes: 15 additions & 1 deletion types/plugins/collapse.d.ts
100644 → 100755
Original file line number Diff line number Diff line change
@@ -1,5 +1,19 @@
import { Collapse as BSCollapse } from 'bootstrap'
import { GetInstanceFactory, GetOrCreateInstanceFactory } from 'bootstrap/js/dist/base-component';

declare class Collapse extends BSCollapse {}
declare class Collapse extends BSCollapse {
/**
* Static method which allows you to get the instance associated
* with a DOM element.
*/
static getInstance: GetInstanceFactory<Collapse>;
/**
* Static method which allows you to get the modal instance associated with
* a DOM element, or create a new one in case it wasn’t initialised
*/
static getOrCreateInstance: GetOrCreateInstanceFactory<
Collapse, Partial<BSCollapse.Options>
>;
}

export { Collapse }
12 changes: 12 additions & 0 deletions types/plugins/cookiebar.d.ts
100644 → 100755
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import { default as BaseComponent } from 'bootstrap/js/dist/base-component'
import { GetInstanceFactory, GetOrCreateInstanceFactory } from 'bootstrap/js/dist/base-component';

/**
* ------------------------------------------------------------------------
Expand All @@ -10,6 +11,17 @@ declare class Cookiebar extends BaseComponent {

static get VERSION(): string

/**
* Static method which allows you to get the instance associated
* with a DOM element.
*/
static getInstance: GetInstanceFactory<Cookiebar>;
/**
* Static method which allows you to get the modal instance associated with
* a DOM element, or create a new one in case it wasn’t initialised
*/
static getOrCreateInstance: GetOrCreateInstanceFactory<Cookiebar>;

static clearCookie(): void

static _handleAccept(cookiebarInstance: any): (event: any) => void
Expand Down
12 changes: 12 additions & 0 deletions types/plugins/dimmer.d.ts
100644 → 100755
Original file line number Diff line number Diff line change
@@ -1,8 +1,20 @@
import { default as BaseComponent } from 'bootstrap/js/dist/base-component'
import { GetInstanceFactory, GetOrCreateInstanceFactory } from 'bootstrap/js/dist/base-component';

declare class Dimmer extends BaseComponent {
static get NAME(): string

/**
* Static method which allows you to get the instance associated
* with a DOM element.
*/
static getInstance: GetInstanceFactory<Dimmer>;
/**
* Static method which allows you to get the modal instance associated with
* a DOM element, or create a new one in case it wasn’t initialised
*/
static getOrCreateInstance: GetOrCreateInstanceFactory<Dimmer>;

constructor(element: HTMLElement)

_isShown: boolean
Expand Down
17 changes: 16 additions & 1 deletion types/plugins/dropdown.d.ts
100644 → 100755
Original file line number Diff line number Diff line change
@@ -1,5 +1,20 @@
import { Dropdown as BSDropdown } from 'bootstrap'
import { GetInstanceFactory, GetOrCreateInstanceFactory } from 'bootstrap/js/dist/base-component';

declare class Dropdown extends BSDropdown {}
declare class Dropdown extends BSDropdown {
/**
* Static method which allows you to get the instance associated
* with a DOM element.
*/
static getInstance: GetInstanceFactory<Dropdown>;
/**
* Static method which allows you to get the modal instance associated with
* a DOM element, or create a new one in case it wasn’t initialised
*/
static getOrCreateInstance: GetOrCreateInstanceFactory<
Dropdown, Partial<BSDropdown.Options>
>;

}

export { Dropdown }
Empty file modified types/plugins/form-validate.d.ts
100644 → 100755
Empty file.
12 changes: 12 additions & 0 deletions types/plugins/form.d.ts
100644 → 100755
Original file line number Diff line number Diff line change
@@ -1,11 +1,23 @@
import { default as BaseComponent } from 'bootstrap/js/dist/base-component'
import { GetInstanceFactory, GetOrCreateInstanceFactory } from 'bootstrap/js/dist/base-component';

/**
* DEPRECATED
*/
declare class Form extends BaseComponent {
static get NAME(): string

/**
* Static method which allows you to get the instance associated
* with a DOM element.
*/
static getInstance: GetInstanceFactory<Form>;
/**
* Static method which allows you to get the modal instance associated with
* a DOM element, or create a new one in case it wasn’t initialised
*/
static getOrCreateInstance: GetOrCreateInstanceFactory<Form>;

constructor(element: HTMLElement)

_bindEvents(): void
Expand Down
34 changes: 33 additions & 1 deletion types/plugins/forward.d.ts
100644 → 100755
Original file line number Diff line number Diff line change
@@ -1,9 +1,23 @@
import { default as BaseComponent } from 'bootstrap/js/dist/base-component'
import { GetInstanceFactory, GetOrCreateInstanceFactory } from 'bootstrap/js/dist/base-component';

declare class Forward extends BaseComponent {
static get NAME(): string

constructor(element: HTMLElement, config: any)
/**
* Static method which allows you to get the instance associated
* with a DOM element.
*/
static getInstance: GetInstanceFactory<Forward>;
/**
* Static method which allows you to get the modal instance associated with
* a DOM element, or create a new one in case it wasn’t initialised
*/
static getOrCreateInstance: GetOrCreateInstanceFactory<
Forward, Partial<Forward.Options>
>;

constructor(element: HTMLElement, config?: Partial<Forward.Options>)

_config: any

Expand All @@ -14,4 +28,22 @@ declare class Forward extends BaseComponent {
_bindEvents(): void
}

declare namespace Forward {

interface Options {
/**
* Scroll duration
*
* @default 800
*/
duration: number;
/**
* Scroll easing
*
* @default 'easeInOutSine'
*/
easing: string;
}
}

export { Forward }
14 changes: 12 additions & 2 deletions types/plugins/header-sticky.d.ts
100644 → 100755
Original file line number Diff line number Diff line change
@@ -1,6 +1,16 @@
declare class HeaderSticky {
static getOrCreateInstance(element: HTMLElement): any
import { GetInstanceFactory, GetOrCreateInstanceFactory } from 'bootstrap/js/dist/base-component';

declare class HeaderSticky {
/**
* Static method which allows you to get the instance associated
* with a DOM element.
*/
static getInstance: GetInstanceFactory<HeaderSticky>;
/**
* Static method which allows you to get the modal instance associated with
* a DOM element, or create a new one in case it wasn’t initialised
*/
static getOrCreateInstance: GetOrCreateInstanceFactory<HeaderSticky>;
constructor(element: HTMLElement)

_element: any
Expand Down
11 changes: 11 additions & 0 deletions types/plugins/history-back.d.ts
100644 → 100755
Original file line number Diff line number Diff line change
@@ -1,7 +1,18 @@
import { default as BaseComponent } from 'bootstrap/js/dist/base-component'
import { GetInstanceFactory, GetOrCreateInstanceFactory } from 'bootstrap/js/dist/base-component';

declare class HistoryBack extends BaseComponent {
static get NAME(): string
/**
* Static method which allows you to get the instance associated
* with a DOM element.
*/
static getInstance: GetInstanceFactory<HistoryBack>;
/**
* Static method which allows you to get the modal instance associated with
* a DOM element, or create a new one in case it wasn’t initialised
*/
static getOrCreateInstance: GetOrCreateInstanceFactory<HistoryBack>;

constructor(element: HTMLElement)

Expand Down
Empty file modified types/plugins/input-label.d.ts
100644 → 100755
Empty file.
12 changes: 12 additions & 0 deletions types/plugins/input-number.d.ts
100644 → 100755
Original file line number Diff line number Diff line change
@@ -1,8 +1,20 @@
import { default as BaseComponent } from 'bootstrap/js/dist/base-component'
import { InputLabel } from './input-label'
import { GetInstanceFactory, GetOrCreateInstanceFactory } from 'bootstrap/js/dist/base-component';


declare class InputNumber extends BaseComponent {
static get NAME(): string
/**
* Static method which allows you to get the instance associated
* with a DOM element.
*/
static getInstance: GetInstanceFactory<InputNumber>;
/**
* Static method which allows you to get the modal instance associated with
* a DOM element, or create a new one in case it wasn’t initialised
*/
static getOrCreateInstance: GetOrCreateInstanceFactory<InputNumber>;

constructor(element: HTMLElement)

Expand Down
Loading

0 comments on commit a9bc9b8

Please sign in to comment.