-
Notifications
You must be signed in to change notification settings - Fork 1.2k
/
index.d.ts
178 lines (160 loc) · 4.72 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
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
declare namespace Viewer {
export type Visibility = 0 | 1 | 2 | 3 | 4;
export type ToolbarButtonSize = 'small' | 'medium' | 'large';
export type ToolbarOption = boolean | Visibility | ToolbarButtonSize | Function | ToolbarButtonOptions | undefined;
export interface ToolbarButtonOptions {
click?: Function,
show?: boolean | Visibility;
size?: ToolbarButtonSize,
}
export interface ToolbarOptions {
flipHorizontal?: ToolbarOption;
flipVertical?: ToolbarOption;
next?: ToolbarOption;
oneToOne?: ToolbarOption;
play?: ToolbarOption;
prev?: ToolbarOption;
reset?: ToolbarOption;
rotateLeft?: ToolbarOption;
rotateRight?: ToolbarOption;
zoomIn?: ToolbarOption;
zoomOut?: ToolbarOption;
[x: string]: ToolbarOption;
}
export interface Pivot {
x: Number;
y: Number;
}
export interface MoveEventData {
x: number;
y: number;
oldX: number;
oldY: number;
originalEvent: PointerEvent | TouchEvent | MouseEvent | null;
}
export interface MoveEvent extends CustomEvent {
detail: MoveEventData;
}
export interface MovedEvent extends CustomEvent {
detail: MoveEventData;
}
export interface RotateEventData {
degree: number;
oldDegree: number;
}
export interface RotateEvent extends CustomEvent {
detail: RotateEventData;
}
export interface RotatedEvent extends CustomEvent {
detail: RotateEventData;
}
export interface ScaleEventData {
scaleX: number;
scaleY: number;
oldScaleX: number;
oldScaleY: number;
}
export interface ScaleEvent extends CustomEvent {
detail: ScaleEventData;
}
export interface ScaledEvent extends CustomEvent {
detail: ScaleEventData;
}
export interface ZoomEventData {
ratio: number;
oldRatio: number;
originalEvent: WheelEvent | PointerEvent | TouchEvent | MouseEvent | null;
}
export interface ZoomEvent extends CustomEvent {
detail: ZoomEventData;
}
export interface ZoomedEvent extends CustomEvent {
detail: ZoomEventData;
}
export interface Options {
backdrop?: boolean | string;
button?: boolean;
className?: string;
container?: string | HTMLElement;
filter?: Function;
fullscreen?: boolean | FullscreenOptions;
focus?: boolean;
hidden?(event: CustomEvent): void;
hide?(event: CustomEvent): void;
inheritedAttributes?: string[];
initialCoverage?: number;
initialViewIndex?: number;
inline?: boolean;
interval?: number;
keyboard?: boolean;
loading?: boolean;
loop?: boolean;
maxZoomRatio?: number;
minHeight?: number;
minWidth?: number;
minZoomRatio?: number;
movable?: boolean;
move?(event: MoveEvent): void;
moved?(event: MovedEvent): void;
navbar?: boolean | Visibility;
play?(event: CustomEvent): void;
ready?(event: CustomEvent): void;
rotatable?: boolean;
rotate?(event: RotateEvent): void;
rotated?(event: RotatedEvent): void;
scalable?: boolean;
scale?(event: ScaleEvent): void;
scaled?(event: ScaledEvent): void;
show?(event: CustomEvent): void;
shown?(event: CustomEvent): void;
slideOnTouch?: boolean;
stop?(event: CustomEvent): void;
title?: boolean | Visibility | Function | [Visibility, Function];
toggleOnDblclick?: boolean;
toolbar?: boolean | Visibility | ToolbarOptions;
tooltip?: boolean;
transition?: boolean;
url?: string | Function;
view?(event: CustomEvent): void;
viewed?(event: CustomEvent): void;
zIndex?: number;
zIndexInline?: number;
zoom?(event: ZoomEvent): void;
zoomOnTouch?: boolean;
zoomOnWheel?: boolean;
zoomRatio?: number;
zoomable?: boolean;
zoomed?(event: ZoomedEvent): void;
}
}
declare class Viewer {
constructor(element: HTMLElement, options?: Viewer.Options);
destroy(): Viewer;
exit(): Viewer;
full(): Viewer;
hide(immediate?: boolean): Viewer;
move(offsetX: number, offsetY?: number): Viewer;
moveTo(x: number, y?: number): Viewer;
next(loop?: boolean): Viewer;
play(fullscreen?: boolean | FullscreenOptions): Viewer;
prev(loop?: boolean): Viewer;
reset(): Viewer;
rotate(degree: number): Viewer;
rotateTo(degree: number): Viewer;
scale(scaleX: number, scaleY?: number): Viewer;
scaleX(scaleX: number): Viewer;
scaleY(scaleY: number): Viewer;
show(immediate?: boolean): Viewer;
stop(): Viewer;
toggle(): Viewer;
tooltip(): Viewer;
update(): Viewer;
view(index?: number): Viewer;
zoom(ratio: number, hasTooltip?: boolean, pivot?: Viewer.Pivot): Viewer;
zoomTo(ratio: number, hasTooltip?: boolean, pivot?: Viewer.Pivot): Viewer;
static noConflict(): Viewer;
static setDefaults(options: Viewer.Options): void;
}
declare module 'viewerjs' {
export default Viewer;
}