forked from e-oj/Magic-Grid
-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.d.ts
119 lines (107 loc) · 2.13 KB
/
index.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
/**
* main decleration file
*
* @author zakaria harti
*/
/**
* configuration object of the MagicGrid constructor
*/
export interface MagicGridProps{
containerClass?: string;
container?: string | HTMLElement;
static?: boolean;
items?: number;
gutter?: number;
maxColumns: number,
useMin: boolean,
animate: boolean,
}
/**
* MagicGrid class
*/
declare class MagicGrid {
/**
* class constructor
*
* @param {object} config
*/
constructor(config: MagicGridProps);
/**
* Positions all the items and
* repositions them whenever the
* window size changes.
*
* @returns {void}
*/
listen(): void;
/**
* Position each items in the container
* based on their corresponding columns
* values.
*
* @returns {void}
*/
positionItems(): void;
/**
* Checks if every items has been loaded
* in the dom.
*
* @return {Boolean} true if every items is present
*/
ready(): boolean;
/**
* Initializes styles
*
* @private
*/
private init(): void;
/**
* Calculates the width of a column.
*
* @return width of a column in the grid
* @private
*/
private colWidth(): number;
/**
* Initializes an array of empty columns
* and calculates the leftover whitespace.
*
* @return {{cols: Array, wSpace: number}}
* @private
*/
private setup(): object;
/**
* Gets the next available column.
*
* @param cols list of columns
* @param i index of dom element
*
* @return {*} next available column
* @private
*/
private nextCol(cols: object[], i: number): object;
/**
* Periodically checks that all items
* have been loaded in the dom. Calls
* this.listen() once all the items are
* present.
*
* @private
*/
private getReady(): void;
}
/**
* Validates the configuration object.
*
* @param config - configuration object
*/
declare function checkParams(config: MagicGridProps): void;
/**
* Finds the shortest column in
* a column list
*
* @param cols - list of columns
*
* @return longest column
*/
declare function getMin(cols: object[]): object;