forked from DefinitelyTyped/DefinitelyTyped
-
Notifications
You must be signed in to change notification settings - Fork 0
/
packery.d.ts
294 lines (246 loc) · 8.9 KB
/
packery.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
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
// Type definitions for Packery v1.4.1
// Project: http://packery.metafizzy.co
// Definitions by: Piraveen Kamalathas from Kilix <https://github.com/piraveen>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
declare module "packery" {
interface PackeryOptions {
/**
* [itemSelector Specifies which child elements to be used as item elements. Setting itemSelector is always recommended. itemSelector is useful to exclude sizing elements]
* @type {string}
*/
itemSelector?: string;
/**
* [columnWidth The width of a column of a horizontal grid. When set, Packery will align item elements horizontally to this grid]
* @type {number}
*/
columnWidth?: number;
/**
* [rowHeight Height of a row of a vertical grid. When set, Packery will align item elements vertically to this grid]
* @type {number}
*/
rowHeight?: number;
/**
* [gutter The space between item elements, both vertically and horizontally]
* @type {number}
*/
gutter?: number;
/**
* [percentPosition Will set item position in percent values, rather than pixel values. percentPosition works well with percent-width items, as items will not transition their position on resize]
* @type {boolean}
*/
percentPosition?: boolean;
/**
* [stamp Specifies which elements are stamped within the layout. These are special layout elements which will not be laid out by Packery. Rather, Packery will layout item elements around stamped elements]
* @type {string}
*/
stamp?: string;
/**
* [isHorizontal Arranges items horizontally instead of vertically]
* @type {boolean}
*/
isHorizontal?: boolean;
/**
* [isOriginLeft Controls the horizontal flow of the layout. By default, item elements start positioning at the left. Set to false for right-to-left layouts]
* @type {boolean}
*/
isOriginLeft?: boolean;
/**
* [isOriginTop Controls the vertical flow of the layout. By default, item elements start positioning at the top. Set to false for bottom-up layouts. It’s like Tetris!]
* @type {boolean}
*/
isOriginTop?: boolean;
/**
* [transitionDuration The time duration of transitions for item elements]
* @type {string}
*/
transitionDuration?: string;
/**
* [containerStyle CSS styles that are applied to the container element. To disable Packery from setting any CSS to the container element, set containerStyle: null]
* @type {Object}
*/
containerStyle?: Object;
/**
* [isResizeBound Binds layout to window resizing]
* @type {boolean}
*/
isResizeBound?: boolean;
/**
* [isInitLayout Enables layout on initialization. Set this to false to disable layout on initialization, so you can use methods or add events before the initial layout]
* @type {boolean}
*/
isInitLayout?: boolean;
}
class Packery {
constructor(element: Element, options?: Object);
/**
* [addItems Add item elements to the Packery instance]
* @param {Element} elements [description]
*/
addItems(elements: Element): void;
/**
* [addItems Add item elements to the Packery instance]
* @param {NodeList} elements [description]
*/
addItems(elements: NodeList): void;
/**
* [addItems Add item elements to the Packery instance]
* @param {Array<Element>} elements [description]
*/
addItems(elements: Array<Element>): void;
/**
* [appended Add and lay out newly appended item elements]
* @param {Element} elements [description]
*/
appended(elements: Element): void;
/**
* [appended Add and lay out newly appended item elements]
* @param {NodeList} elements [description]
*/
appended(elements: NodeList): void;
/**
* [appended Add and lay out newly appended item elements]
* @param {Array<Element>} elements [description]
*/
appended(elements: Array<Element>): void;
/**
* [bindDraggabillyEvents Bind Draggabilly events, so that the Packery instance will layout around the dragged element]
* @param {any} draggie [description]
*/
bindDraggabillyEvents(draggie: any): void;
/**
* [bindResize Binds event listener to window resize, so layout is triggered when the browser window is resized]
*/
bindResize(): void;
/**
* [bindUIDraggableEvents Bind jQuery UI Draggable events, so that the Packery instance will layout around the dragged element]
* @param {any} elements [jQuery UI]
*/
bindUIDraggableEvents($element: any): void;
/**
* [data Get the Packery instance from an element. Note this method is of Packery, rather than of a Packery instance]
* @param {Element} element [description]
* @return {Packery} [description]
*/
data(element: Element): Packery;
/**
* [destroy Removes the Packery functionality completely. This will return the element back to its pre-initialized state]
*/
destroy(): void;
/**
* [fit Fit an item element within the layout, and have other item elements laid out around it. This method is useful when expanding an element, and keeping it in its same position.]
* @param {any} element [description]
* @param {number} x [description]
* @param {number} y [description]
*/
fit(element: Element, x ?: number, y ?: number): void;
/**
* [getItemElements Get an array of elements used as the Packery instance's items.]
* @return {Array<Element>} [description]
*/
getItemElements(): Array<Element>;
/**
* [getItem Get a Packery.Item from an element]
* @param {Element} element [description]
* @return {any} [Packery.item]
*/
getItem(element: Element): any;
/**
* [layout Lay out all item elements.]
*/
layout(): void;
/**
* [layoutItems Lay out specified items]
* @param {Array<Packery.items>} items [description]
*/
layoutItems(items: Array<any>): void;
/**
* [off Remove an event listener]
* @param {string} eventName [description]
* @param {Function} listener [description]
* @return {Packery} [description]
*/
off(eventName: string, listener: Function): Packery;
/**
* [on Add an event listener for certain events]
* @param {string} eventName [description]
* @param {Function} listener [description]
* @return {Packery} [description]
*/
on(eventName: string, listener: Function): Packery;
/**
* [once Add an event listener for certain events, to be triggered once]
* @param {string} eventName [description]
* @param {Function} listener [description]
*/
once(eventName: string, listener: Function): void;
/**
* [prepended Add and lay out newly prepended item elements at the beginning of layout]
* @param {Element} elements [description]
*/
prepended(elements: Element): void;
/**
* [prepended Add and lay out newly prepended item elements at the beginning of layout]
* @param {NodeList} elements [description]
*/
prepended(elements: NodeList): void;
/**
* [prepended Add and lay out newly prepended item elements at the beginning of layout]
* @param {Array<Element>} elements [description]
*/
prepended(elements: Array<Element>): void;
/**
* [reloadItems Recollect all item elements]
*/
reloadItems(): void;
/**
* [remove Remove elements from the Packery instance, then from the DOM]
* @param {Element} elements [description]
*/
remove(elements: Element): void;
/**
* [remove Remove elements from the Packery instance, then from the DOM]
* @param {NodeList} elements [description]
*/
remove(elements: NodeList): void;
/**
* [remove Remove elements from the Packery instance, then from the DOM]
* @param {Array<Element>} elements [description]
*/
remove(elements: Array<Element>): void;
/**
* [stamp Stamp the elements in the layout. Packery will lay out item elements around stamped element]
* @param {Element} elements [description]
*/
stamp(elements: Element): void;
/**
* [stamp Stamp the elements in the layout. Packery will lay out item elements around stamped element]
* @param {NodeList} elements [description]
*/
stamp(elements: NodeList): void;
/**
* [stamp Stamp the elements in the layout. Packery will lay out item elements around stamped element]
* @param {Array<Element>} elements [description]
*/
stamp(elements: Array<Element>): void;
/**
* [unbindResize Un-bind layout to window resize event]
*/
unbindResize(): void;
/**
* [unstamp Un-stamp the elements, so that Packery will no longer layout item elements around them]
* @param {Element} element [description]
*/
unstamp(element: Element): void;
/**
* [unstamp Un-stamp the elements, so that Packery will no longer layout item elements around them]
* @param {NodeList} element [description]
*/
unstamp(element: NodeList): void;
/**
* [unstamp Un-stamp the elements, so that Packery will no longer layout item elements around them]
* @param {Array<Element>} element [description]
*/
unstamp(element: Array<Element>): void;
}
export = Packery;
}