forked from DefinitelyTyped/DefinitelyTyped
-
Notifications
You must be signed in to change notification settings - Fork 0
/
jquery.mmenu.d.ts
242 lines (194 loc) · 6.65 KB
/
jquery.mmenu.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
// Type definitions for jQuery mmenu v5.5.3
// Project: http://mmenu.frebsite.nl/
// Definitions by: John Gouigouix <https://github.com/orchestra-ts/DefinitelyTyped/>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
/// <reference path="../jquery/jquery.d.ts"/>
declare namespace JQueryMmenu {
interface NavbarOptions {
/**
* Whether or not to add a navbar above the panels.
* Default: true
*/
add?: boolean;
/**
* The title above the main panel.
* Default: "Menu"
*/
title?: string;
/**
* The type of link to set for the title.
* Possible values: "parent", "anchor" or "none".
* Default: "parent"
*/
titleLink?: string;
}
interface OnclickOptions {
/**
* Whether or not the menu should close after clicking a link inside it.
* The default value varies per link: true if the default behavior for
* the clicked link is prevented, false otherwise.
* Default: null
*/
close?: boolean | any;
/**
* Whether or not to prevent the default behavior for the clicked link.
* The default value varies per link: true if its href is equal to
* or starts with a hash (#), false otherwise.
* Default: null
*/
preventDefault?: boolean | any;
/**
* Whether or not the clicked link should be visibly "selected".
* Default: true
*/
setSelected?: boolean | any;
}
interface Options {
/**
* A collection of extension names to enable for the menu.
* You'll need this option when using the extensions.
* Default: []
*/
extensions?: Array<Object>;
/**
* navbar options
*/
navbar?: NavbarOptions;
/**
* onClick options
*/
onClick?: OnclickOptions;
/**
* Whether or not submenus should come sliding in from the right.
* If false, submenus expand below their parent.
* To expand a single submenu below its parent item, add the class "Vertical" to it.
* Default: true
*/
slidingSubmenus?: boolean;
}
interface ClassnamesConfigurations {
/**
* The classname on a LI that should be displayed as a divider.
* Default: "Divider"
*/
divider?: string;
/**
* The classname on a submenu (a nested UL) that should be displayed as a default list.
* Default: "Inset"
*/
inset?: string;
/**
* The classname on an element (for example a DIV) that should be considered to be a panel.
* Only applies if the "isMenu" option is set to false.
* Default: "Panel"
*/
panel?: string;
/**
* The classname on the LI that should be displayed as selected.
* Default: "Selected"
*/
selected?: string;
/**
* The classname on a submenu (a nested UL) that should expand below
* their parent instead of slide in from the right.
* Default: "vertical"
*/
vertical?: string;
}
interface Configurations {
/**
* the CSS class names object
*/
classNames?: ClassnamesConfigurations;
/**
* Whether or not the menu should be cloned (and the original menu kept intact).
* Default: false
*/
clone?: boolean;
/**
* The number of milliseconds between opening/closing the menu and panels,
* needed to force CSS transitions.
* Default: 25
*/
openingInterval?: number;
/**
* jQuery selector containing the node-type of panels.
* Default: "div, ul, ol"
*/
panelNodetype?: string;
/**
* The number of milliseconds used in the CSS transitions.
* Default: 400 (The value should match the associated CSS value.)
*/
transitionDuration?: number;
}
interface API {
/**
* Trigger non-specialized signature method
* @param methodName
* @param callback
*/
bind(methodName: string, callback: (...args: any[]) => void): any;
/**
* Trigger this method to close all opened panels and go back to the first panel.
*/
closeAllPanels(): JQuery;
/** @see closeAllPanels() */
bind(methodName: "closeAllPanels", callback: () => void): JQuery;
/**
* Trigger this method to close a panel
* (only available if the "slidingSubmenus" option is set to false).
* @param panel
*/
closePanel(panel: JQuery): void;
/** @see closePanel() */
bind(methodName: "closePanel", callback: (panel: JQuery) => void): void;
/**
* Trigger this method to get the class instance for the menu.
*/
getInstance(): void;
/** @see getInstance() */
bind(methodName: "getInstance", callback: () => void): void;
/**
* Trigger this method to (re)initialize a newly added panel.
* @param panel The panel to (re)initialize.
*/
init(panel: JQuery): void;
/** @see init() */
bind(methodName: "init", callback: (panel: JQuery) => void): void;
/**
* Trigger this method to open a panel.
* @param panel The panel to open.
*/
openPanel(panel: JQuery): void;
/** @see openPanel() */
bind(methodName: "openPanel", callback: (panel: JQuery) => void): void;
/**
* Trigger this method to set or unset a list item as "selected".
* @param li The list item to set or unset as "selected".
* @param selected Whether to set or unset the list item as "selected". Default: true
*/
setSelected(li: JQuery, selected?: boolean): void;
/** @see setSelected() */
bind(methodName: "setSelected", callback: (li: JQuery, selected?: boolean) => void): void;
/**
* Trigger this method to update the appearance for the menu.
*/
update(): void;
/** @see update() */
bind(methodName: "update", callback: () => void): void;
}
}
interface JQuery {
/**
* Create mmenu component
*/
mmenu(): JQuery;
mmenu(options: JQueryMmenu.Options): JQuery;
mmenu(options: JQueryMmenu.Options, configurations: JQueryMmenu.Configurations): JQuery;
/**
* Return the mmenu object
* @param element
*/
data(element: "mmenu"): JQueryMmenu.API;
}