-
Notifications
You must be signed in to change notification settings - Fork 18
Expand file tree
/
Copy pathenv.d.ts
More file actions
303 lines (245 loc) · 7.86 KB
/
env.d.ts
File metadata and controls
303 lines (245 loc) · 7.86 KB
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
295
296
297
298
299
300
301
302
declare type WindowType = "normal" | "menu"
declare type RenderBackend = "SoftBuffer" | "GL" | "SoftGL"
declare interface WindowAttrs {
width ?: number
height ?: number
title ?: string
resizable ?: boolean,
decorations ?: boolean,
overrideRedirect ?: boolean,
position ?: [number, number],
visible ?: boolean,
windowType ?: WindowType,
minimizable ?: boolean,
maximizable ?: boolean,
closable ?: boolean,
preferredRenderers ?: RenderBackend | RenderBackend[],
}
declare interface ResizeDetail {
width: number;
height: number;
}
declare interface ElementRect {
x: number;
y: number;
width: number;
height: number;
}
declare interface Size {
width: number;
height: number;
}
declare interface MouseDetail {
button: number,
offsetX: number;
offsetY: number;
windowX: number;
windowY: number;
screenX: number;
screenY: number;
}
declare interface CaretDetail {
position: number,
originBounds: ElementRect,
bounds: ElementRect,
}
declare interface KeyDetail {
modifiers: number,
ctrlKey: boolean,
altKey: boolean,
metaKey: boolean,
shiftKey: boolean,
key: string,
keyStr: string,
repeat: boolean,
pressed: boolean,
}
declare interface MouseWheelDetail {
cols: number;
rows: number;
}
declare interface TextDetail {
value: string;
}
declare interface TextChangeDetail {
value: string;
}
declare interface ScrollDetail {
scrollTop: number;
scrollLeft: number;
}
declare interface BoundsChangeDetail {
originBounds: ElementRect,
}
declare interface TouchInfo {
identifier: number;
offsetX: number;
offsetY: number;
windowX: number;
windowY: number;
}
declare interface TouchDetail {
touches: TouchInfo[],
}
declare type Align =
'auto'
| 'flex-start'
| 'center'
| 'flex-end'
| 'stretch'
| 'baseline'
| 'space-between'
| 'space-around'
declare interface SelectOption {
label: string,
value: string,
}
declare interface AlertOptions {
title ?: string;
confirmBtnText ?: string;
callback ?: () => void;
}
declare interface ConfirmOptions {
title ?: string;
confirmBtnText ?: string;
cancelBtnText ?: string;
hideCancel ?: boolean;
}
declare interface StyleProps extends Record<string, number | string>{
color?: string,
backgroundColor?: string;
fontSize?: number;
lineHeight?: number;
borderTop?: string;
borderRight?: string;
borderBottom?: string;
borderLeft?: string;
display?: "none" | "flex",
width?: number | string,
height?: number | string,
maxWidth?: number | string,
maxHeight?: number | string,
minWidth?: number | string,
minHeight?: number | string,
marginTop?: number | string,
marginRight?: number | string,
marginBottom?: number | string,
marginLeft?: number | string,
paddingTop?: number | string,
paddingRight?: number | string,
paddingBottom?: number | string,
paddingLeft?: number | string,
flex?: number,
flexBasis?: number | string,
flexGrow?: number,
flexShrink?: number,
alignSelf?: Align,
direction?: 'inherit' | 'ltr' | 'rtl',
position?: 'static' | 'relative' | 'absolute',
overflow?: 'visible' | 'hidden' | 'scroll',
borderTopLeftRadius?: number,
borderTopRightRadius?: number,
borderBottomRightRadius?: number,
borderBottomLeftRadius?: number,
justifyContent?: 'flex-start' | 'center' | 'flex-end' | 'space-between' | 'space-around' | 'space-evenly',
flexDirection?: 'column' | 'column-reverse' | 'row' | 'row-reverse',
alignContent?: Align,
alignItems?: Align,
flexWrap?: 'no-wrap' | 'wrap' | 'wrap-reverse',
columnGap?: number,
rowGap?: number,
top?: number | string,
right?: number | string,
bottom?: number | string,
left?: number | string,
transform?: string,
animationName?: string,
animationDuration?: number,
animationIterationCount?: number,
// short hands
background?: string,
gap?: number,
border?: string,
margin?: number | string,
padding?: number | string,
borderRadius?: number | string,
}
declare interface LocalStorage {
getItem(key: string): string | null,
setItem(key: string, value: string): void,
}
// @ts-ignore
declare const localStorage: LocalStorage;
declare interface TrayMenu {
kind ?: "standard" | "checkmark" | "separator"
id ?: string,
label ?: string,
checked ?: boolean,
enabled ?: boolean,
handler ?: () => void,
}
declare function process_exit(code: number);
declare function path_filename(path: string): string;
declare function path_join(path: string, other: string): string;
declare function animation_create(name: string, keyFrames: Record<string, Record<string, any>>)
declare interface TypefaceParams {
family: string,
weight?: string,
}
declare function typeface_create(name: string, params: TypefaceParams): boolean;
declare function env_exe_dir(): String;
declare function env_exe_path(): String;
declare interface UploadOptions {
file: string,
field: string,
data ?: Record<string, string>,
headers ?: Record<string, string>,
}
declare function http_upload(url: string, options: UploadOptions) : Promise<{status: number, body: string}>;
declare function http_request(url: string) : Promise<any>;
declare interface FetchOptions {
method ?: 'GET' | 'POST',
headers ?: Record<string, string>,
body ?: string,
proxy ?: string,
}
declare function fetch_create(url: string, options ?: FetchOptions) : Promise<any>;
declare function fetch_response_status(rsp): Promise<number>;
declare function fetch_response_headers(rsp): Promise<{name: string, value: string}[]>;
declare function fetch_response_save(rsp, path: string): Promise<number>;
declare function fetch_response_body_string(rsp): Promise<string>;
declare function AudioRef_create(path: string);
declare function AudioRef_destroy(id): void;
declare function AudioRef_position(id): number;
declare function AudioRef_duration(id): number;
declare function Base64_encode_str(str: string): string;
declare interface ShowFileDialogOptions {
dialogType ?: "single" | "multiple" | "save" | "dir",
//TODO fix type
window ?: any,
}
declare function dialog_show_file_dialog(options ?: ShowFileDialogOptions): Promise<string[]>;
declare function fs_read_dir(path: string): Promise<string[]>;
declare function fs_exists(path: string): Promise<boolean>;
declare function fs_rename(path: string, dest:string): Promise<void>;
declare function fs_delete_file(path: string): Promise<void>;
declare function fs_create_dir(path: string): Promise<void>;
declare function fs_create_dir_all(path: string): Promise<void>;
declare function fs_remove_dir(path: string): Promise<void>;
declare function fs_remove_dir_all(path: string): Promise<void>;
declare function appfs_data_path(path ?: string): string;
declare function appfs_exists(path: string): Promise<boolean>;
declare function appfs_readdir(path: string): Promise<string[]>;
declare function appfs_read(path: string): Promise<string>;
declare function appfs_write_new(path: string, content: string): Promise<void>;
declare function appfs_write(path: string, content: string): Promise<void>;
declare function appfs_delete_file(path: string): Promise<void>;
declare function appfs_create_dir(path: string): Promise<void>;
declare function appfs_create_dir_all(path: string): Promise<void>;
declare function appfs_remove_dir(path: string): Promise<void>;
declare function appfs_remove_dir_all(path: string): Promise<void>;
declare function shell_spawn(executable: string, args ?: string[]): void;
declare function setTimeout(callback: () => void, timeout: number): number;
declare function clearTimeout(timer: number): void;
declare function setInterval(callback: () => void, interval: number): number;
declare function clearInterval(timer: number): void;