forked from DefinitelyTyped/DefinitelyTyped
-
Notifications
You must be signed in to change notification settings - Fork 0
/
featherlight.d.ts
114 lines (99 loc) · 3.21 KB
/
featherlight.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
// Type definitions for Featherlight v1.3.4
// Project: https://noelboss.github.io/featherlight/
// Definitions by: Kaur Kuut <https://github.com/xStrom>
// Definitions: https://github.com/borisyankov/DefinitelyTyped
///<reference path="../jquery/jquery.d.ts" />
declare module Featherlight {
interface Config {
namespace?: string;
targetAttr?: string;
variant?: string;
resetCss?: boolean;
background?: string;
openTrigger?: string;
closeTrigger?: string;
filter?: string;
root?: string;
openSpeed?: number | string;
closeSpeed?: number | string;
closeOnClick?: boolean | string;
closeOnEsc?: boolean;
closeIcon?: string;
loading?: string;
persist?: boolean | string;
otherClose?: string;
beforeOpen?: (event: JQueryEventObject) => any;
beforeContent?: (event: JQueryEventObject) => any;
beforeClose?: (event: JQueryEventObject) => any;
afterOpen?: (event: JQueryEventObject) => any;
afterContent?: (event: JQueryEventObject) => any;
afterClose?: (event: JQueryEventObject) => any;
onKeyUp?: (event: JQueryEventObject) => any;
onResize?: (event: JQueryEventObject) => any;
type?: string;
contentFilters?: any;
jquery?: JQuery;
image?: string;
html?: string;
ajax?: string;
text?: string;
}
interface ContentFilter {
regex?: RegExp;
test?(data: JQuery | string): boolean;
process?(data: JQuery | string): JQuery | JQueryPromise<JQuery>;
}
interface ContentFilters {
[name: string]: ContentFilter;
}
interface Featherlight extends Config {
target: JQuery | string;
$instance: JQuery;
$content: JQuery;
setup(target: JQuery, config?: Config): Featherlight;
setup(target: string, config?: Config): Featherlight;
setup(config: Config): Featherlight;
setup(): Featherlight;
getContent(): JQuery | JQueryPromise<JQuery>;
setContent($content: JQuery): Featherlight;
setContent($content: JQueryPromise<JQuery>): Featherlight;
open(event?: JQueryEventObject): JQueryPromise<JQuery>;
close(event?: JQueryEventObject): JQueryPromise<JQuery>;
}
interface FeatherlightStatic {
($content: JQuery, config?: Config): Featherlight;
($content: string, config?: Config): Featherlight;
(config: Config): Featherlight;
(): Featherlight;
new($content: JQuery, config?: Config): Featherlight;
new($content: string, config?: Config): Featherlight;
new(config: Config): Featherlight;
new(): Featherlight;
attach($source: JQuery, $content: JQuery, config?: Config): JQuery;
attach($source: JQuery, $content: string, config?: Config): JQuery;
attach($source: JQuery, config: Config): JQuery;
attach($source: JQuery): JQuery;
id: number;
autoBind: boolean | string;
defaults: Config;
contentFilters: ContentFilters;
functionAttributes: string[];
readElementConfig(element: HTMLElement, namespace: string): any;
extend(child: any, defaults: any): any;
current(): Featherlight;
opened(): Featherlight[];
close(): JQueryPromise<JQuery>;
}
interface JQueryExtension {
($content: JQuery, config?: Config): JQuery;
($content: string, config?: Config): JQuery;
(config: Config): JQuery;
(): JQuery;
}
}
interface JQueryStatic {
featherlight: Featherlight.FeatherlightStatic;
}
interface JQuery {
featherlight: Featherlight.JQueryExtension;
}