-
Notifications
You must be signed in to change notification settings - Fork 0
/
bootstrap-tour.d.ts
244 lines (222 loc) · 4.66 KB
/
bootstrap-tour.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
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
// Type definitions for bootstrap-tour v0.12.0
// Project: https://github.com/parxal/bootstrap-tour
// Definitions by: Ivan Valadares https://github.com/parxal/bootstrap-tour/bootstrap-tour.d.ts
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
/**
* @class
* Creates an instance of a Tour
*/
declare class Tour {
constructor();
constructor(options: Tour.Options);
/**
* Add a new step
*/
addSteps(steps: Tour.Step): void;
/**
* Add multiple step
*/
addSteps(steps: Tour.Step[]): void;
/**
* Get step by its indice
*
* @param {number} i
* @return {Tour.Step}
*/
getStep(i: number): Tour.Step;
/**
* Setup event bindings and continue a tour that has already started
*/
init(): void;
/**
* Setup event bindings and continue a tour that has already started forcefully
*
* @param {boolean} [force]
*/
init(force: boolean): void;
/**
* Start tour from current step
*/
start(): void;
/**
* Start tour from current step forcefully
*
* @param {boolean} [force]
*/
start(force?: boolean): void;
/**
* Hide current step and show next step
*/
next(): void;
/**
* Hide current step and show prev step
*/
prev(): void;
/**
* Hide current step and go to step by indice
*
* @param {number} i
*/
goTo(i: number): void;
/**
* End tour
*/
end(): void;
/**
* Verify if tour is enabled
*/
ended(): void;
/**
* Restart tour
*/
restart(): void;
/**
* Pause step timer
*/
pause(): Tour.Step;
/**
* Resume step timer
*/
resume(): Tour.Step;
/**
* Hide the specified step
*
* @param {number} i - indice of step to hide
*/
hideStep(i: number): void;
/**
* Hide the specified step
*
* @param {number} i - indice of step to hide
* @param {number} [iNext]
*/
hideStep(i: number, iNext: number): void;
/**
* Show the specified step
*
* @param {number} i - indice of step to show
*/
showStep(i: number): void;
/**
* Return step tour is currently showing
*
* @return {Tour.Step}
*/
getCurrentStep(): Tour.Step;
/**
* Setup current step variable
*/
setCurrentStep(): void;
/**
* Setup current step variable
*
* @param {Tour.Step} value - Step to show
*/
setCurrentStep(value: Tour.Step): void;
/**
* Manually trigger a redraw on the overlay element
*/
redraw(): void;
/**
* @member {JQuery[]}
*/
backdrops: JQuery[];
}
declare namespace Tour {
/**
* @typedef {function} Event
*/
type Event = (tour: Tour) => void;
/**
* @typedef {function} StateEvent
*/
type StateEvent = (key: string, value: string | number) => void;
/**
* @typedef {function} SuspendEvent
*/
type SuspendEvent = (tour: Tour, duration: number) => void;
/**
* @typedef {function} Template
*/
type Template = string | {(step: Tour.Step, i: number): string};
/**
* @typedef {number|object} BackDropPadding
*/
type BackDropPadding = number | {
top?: number;
right?: number;
bottom?: number;
left?: number;
};
/**
* Options to be passed to the Tour class constructor
* @typedef {object} Options
*/
export interface Options {
name?: string;
steps?: Step[];
container?: string;
smartPlacement?: boolean;
autoscroll?: boolean;
keyboard?: boolean;
storage?: boolean | WindowLocalStorage | WindowSessionStorage | {};
debug?: boolean;
template?: Template;
backdrop?: boolean;
backdropContainer?: string;
backdropPadding?: BackDropPadding;
redirect?: boolean | Function;
orphan?: boolean | string | Function;
duration?: boolean | number;
delay?: boolean | number;
basePath?: string;
afterGetState?: StateEvent;
afterSetState?: StateEvent;
afterRemoveState?: StateEvent;
onStart?: Event;
onEnd?: Event;
onShow?: Event;
onShown?: Event;
onHide?: Event;
onHidden?: Event;
onNext?: Event;
onPrev?: Event;
onPause?: SuspendEvent;
onResume?: SuspendEvent;
onRedirectError?: Event;
}
/**
* A step belonging to a tour.
* @typedef {object} Step
*/
export interface Step {
path?: string | RegExp;
host?: string | RegExp;
element?: string;
placement?: string | {(): string};
smartPlacement?: boolean;
title?: string | {(): string};
content?: string | {(): string};
next?: number;
prev?: number;
animation?: boolean;
container?: string;
template?: Template;
backdrop?: boolean;
backdropContainer?: string;
backdropPadding?: BackDropPadding;
redirect?: boolean | {(): void};
reflex?: boolean | string;
orphan?: boolean | string | {(): string};
duration?: boolean | string;
onShow?: Event;
onShown?: Event;
onHide?: Event;
onHidden?: Event;
onNext?: Event;
onPrev?: Event;
onPause?: SuspendEvent;
onResume?: SuspendEvent;
onRedirectError?: Event;
}
}