forked from DefinitelyTyped/DefinitelyTyped
-
Notifications
You must be signed in to change notification settings - Fork 0
/
tether-shepherd.d.ts
175 lines (142 loc) · 4.53 KB
/
tether-shepherd.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
// Type definitions for Tether-Shepherd v1.2.0
// Project: http://github.hubspot.com/shepherd/
// Definitions by: Matt Gibbs <https://github.com/mtgibbs>
// Definitions: https://github.com/borisyankov/DefinitelyTyped
declare module TetherShepherd {
interface ShepherdStatic {
on(eventName: string, handler: Function, context?: any): any;
off(eventName: string, handler?: Function): any;
once(eventName: string, handler: Function, context?: any): any;
activeTour: IShepherdTour;
Tour: IShepherdTour;
}
interface IShepherdTourOptions {
steps?: IShepherdTourStep[];
defaults?: IShepherdTourStepOptions;
}
interface IShepherdTour {
new (options?: IShepherdTourOptions): IShepherdTour
/**
* Creates a new Step object with options, and returns the Tour object for convenient chaining when creating multiple steps. If you'd like you can also just pass an options hash which includes id as a key. If the options hash doesn't include an id, one will be generated. You can also pass an existing Step instance rather than options, but note that Shepherd does not support a Step being attached to multiple Tours.
*/
addStep(id: string, options: IShepherdTourStepOptions): IShepherdTour;
addStep(id: string, options: IShepherdTourStep): IShepherdTour;
/**
* Return a step with a specific id
*/
getById(id: string): IShepherdTourStep;
/**
* Advance to the next step, in the order they were added
*/
next(): void;
/**
* Show the previous step, in the order they were added
*/
back(): void;
/**
* Trigger cancel on the current step, hiding it without advancing
*/
cancel(): void;
/**
* Hide the current step
*/
hide(): void;
/**
* Show the step specified by id (if it's a string), or index (if it's a number) provided. Defaults to the first step.
*/
show(): void;
show(id: number): void;
show(id: string): void;
/**
* Show the first step and begin the tour
*/
start(): void;
/**
* Returns the currently shown step
*/
getCurrentStep(): IShepherdTourStep;
/**
* Bind an event
*/
on(eventName: string, handler: Function, context?: any): any;
/**
* Unbind an event
*/
off(eventName: string, handler?: Function): any;
/**
* Bind just the next instance of an event
*/
once(eventName: string, handler: Function, context?: any): any;
}
interface IShepherdTourStep {
/**
* Show this step
*/
show(): void;
/**
* Hide this step
*/
hide(): void;
/**
* Hide this step and trigger the cancel event
*/
cancel(): void;
/**
* Hide this step and trigger the complete event
*/
complete(): void;
/**
* Scroll to this step's element
*/
scrollTo(): void;
/**
* Returns true if the step is currently shown
*/
isOpen(): boolean;
/**
* Remove the element
*/
destroy(): void;
/**
* Bind an event
*/
on(eventName: string, handler: Function, context?: any): any;
/**
* Unbind an event
*/
off(eventName: string, handler?: Function): any;
/**
* Bind just the next instance of an event
*/
once(eventName: string, handler: Function, context?: any): any;
}
interface IShepherdTourStepOptions {
text?: any;
title?: string;
attachTo?: any;
beforeShowPromise?: any;
classes?: string;
buttons?: IShepherdTourButton[];
advanceOn?: any;
showCancelLink?: boolean;
scrollTo?: boolean;
when?: any;
showOn?: () => boolean;
// TODO: Tie this in with the tether.d.ts
tetherOptions?: any;
}
interface IShepherdTourButton {
text: string;
classes?: string;
action?: Function;
events?: IShepherdTourButtonEventHash;
}
interface IShepherdTourButtonEventHash {
[Key: string]: Function;
}
interface IShepherdTourAttachProperties {
element: string;
on: string;
}
}
declare var Shepherd: TetherShepherd.ShepherdStatic;