-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathwin93.d.ts
312 lines (283 loc) · 7.86 KB
/
win93.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
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
type Func = (...args: any[]) => any;
declare type _AlertObject = WinObject & {
msg: string;
img: string;
}
/** @description Shows an alert box that the user can close. */
declare function $alert(options:_AlertObject, callback:Func)
declare function $alert(message:string, callback:Func)
/** @description Shows a confirmation alert box that the user can close. The same as $alert, except with a question mark icon and a OK and Cancel button, where the OK buttons returns true in a callback.*/
declare function $confirm(options:_AlertObject, callback:Func)
declare function $confirm(message:string, callback:Func)
/** @description Runs an application. You can also specify arguments like in the terminal. Returns true if the app exists, and false if it doesn't. */
declare function $exe(name:string): boolean
/** @description Opens a new file explorer window. Returns an ExplorerInstance. */
declare function $explorer(path:string): ExplorerInstance
declare interface ExplorerInstance {
cfg: ExplorerCfg;
el: HTMLElement[];
getPath(): string;
getSaveInput(): unknown; //todo: Document this
getSelectionInput(): unknown; //todo: Document this
getWindow(): WinInstance;
go(path:string): void;
id: number;
refresh(): void;
reorder(): unknown; //todo: Document this
}
declare interface ExplorerCfg {
backgroundClass: string;
browse: boolean; //todo: Document this
footer: boolean;
id: number;
menu: boolean;
nav: boolean;
onclose(): void;
onopen(): void;
onready(): void;
save: boolean;
silent: boolean; //todo: Document this
viewType: "icons" | "list";
}
declare interface $kernel{ //todo: proper documentation
on(event: string, callback: Func): void;
on(event: "splash:ready", callback: Func): void;
}
declare const $kernel: $kernel;
declare interface $log{
(text: string): void;
pass(text: string): void;
fail(text: string): void;
bold(text: string): void;
italic(text: string): void;
code(text: string): void;
error(text: string): void;
success(text: string): void;
any_color(text: string): void; //Didn't recieve much info on this one.
}
declare const $log: $log;
declare function $notif(options:NotifObject): void;
declare function $notif(message: string): void;
declare interface NotifObject {
msg: string;
title?: string;
img?: string;
length?: number;
}
declare function $prompt(text:string, placeholder:string, callback:Func): void;
declare function $prompt(options: WinObject, placeholder:string, callback:Func): void;
declare interface $window{
(options:WinObject): WinInstance;
instances: WinInstance[];
current(): WinInstance;
form(form:string, callback:Func): WinInstance; //? Does this return a WinInstance?
active(id: number): void;
close(id: number): void;
destroy(id: number): void;
maximize(id: number): void;
/** @throws This will throw an error if the specified window is not minimized. */
restore(id: number): void;
}
declare const $window: $window;
declare interface WinInstance {
active(): boolean;
cfg: WinObject;
changeFooter(text:string): void;
changeIcon(icon:string): void;
changeTitle(text:string): void;
changeSize(width:number, height:number): void;
close(): void;
destroy(): void;
el: HTMLElement[];
id: number;
maximize(): void;
menu: MenuArr;
minimize(): void;
restore(): void;
}
declare interface WinObject {
url?: string;
title?: string;
width: number;
height: number;
html?: string;
icon?: string;
header?: boolean;
resizable?: boolean;
maximizable?: boolean;
minimizable?: boolean;
draggable?: boolean;
closable?: boolean;
dockable?: boolean;
center?: boolean;
help?: string;
menu?: MenuArr;
footer?: string;
contextmenu?: MenuArr;
animationIn: AnimationIn;
animationOut: AnimationOut;
onactive(): void;
oncancel(): void;
onclose(): void;
ondestroy(): void;
ondrag(): void;
ondragstop(): void;
onminimize(): void;
onok(): void;
onopen(): void;
onready(): void;
automaximize?: boolean;
}
declare interface $db{}; //todo: proper documentation
declare const $db: $db;
declare interface $file{
save(path:string, content:string, callback?:Func): void;
open(path:string, type:"String"|"Object"|"Blob", callback?:Func): void;
copy(fromPath:string, toPath:string, callback?:Func): void;
delete(path:string, callback?:Func): void;
download(path:string, name:string): void;
format(callback: Func): void;
move(fromPath:string, toPath:string, callback?:Func): void;
rename(path:string, newName:string, callback?:Func): void;
upload(callback: (files:FileList)=>void, todo)
}
declare const $file: $file;
declare interface $fs{ //todo: proper documentation
utils: {
exist(path:string): boolean;
find(origin:string, term:string): string[];
getMime(path:string): string;
getFileName(file): string; //todo: Find out what this does
getFolderName(file): string; //todo: Find out what this does
getFolderObj(path:string): FolderObj;
getFolderPath(file): string;
getIcon(path:string): string;
getName(path:string): string; //todo: Find out what this does
}
}
declare const $fs: $fs;
declare interface FolderObj {
cwd: string;
obj: _FolderObjItem
}
/** @description Objects are subfolders, 0 means file. */
declare interface _FolderObjItem {
[key:string]: _FolderObjItem | 0;
}
declare interface $store{}; //todo: proper documentation
declare const $store: $store;
/** @deprecated Used internally for making web requests using Ajax. Look into the Fetch API instead.*/
declare function $ajax(...args:unknown[]);
declare interface $animate{
(el: HTMLElement, anim:string, cb: Func): void;
i: AnimationIn[],
o: AnimationOut[],
}
declare const $animate: $animate;
declare function $archive(path:string, name:string)
/** @description Wrapper of Howler.js */
declare interface $audio{} //todo: proper documentation (Wrapper of Howler.js)
declare const $audio: $audio;
declare interface $boot{
BIOS: HTMLElement;
BIOSERROR: HTMLElement;
BOOTLOG: HTMLElement;
REINSTALL: HTMLElement;
TOOLONG: HTMLElement;
VERSION: string;
hasError: boolean;
onerror(): void;
}
declare const $boot: $boot;
declare interface $box{ //todo: proper documentation
overlap(elem1:HTMLElement, elem2:HTMLElement): boolean;
}
declare const $box: $box;
/** @deprecated Internal Function for creating a terminal. Instead, set cli & terminal to true in your le._apps entry*/
declare function $cli(e:HTMLElement, t:unknown) //!Internal
declare function $drag(element:HTMLElement, options: DragOptions): void;
declare interface DragOptions {
constrain?: boolean;
ghost?: boolean;
grid?: boolean;
handle?: HTMLElement;
distance?: number; //:UNDOCUMENTED
oninit?: Func;
onstart?: Func;
ondrag?: Func;
onstop?: Func;
}
declare interface $loader{
script(path:string): void;
css(path:string): void;
}
declare const $loader: $loader;
declare type AnimationIn =
"rubberBand" |
"swing" |
"tada" |
"wobble" |
"bounceIn" |
"bounceInDown" |
"bounceInLeft" |
"fadeIn" |
"fadeInDown" |
"fadeInDownBig" |
"fadeInLeft" |
"fadeInLeftBig" |
"fadeInRight" |
"flip" |
"flipInX" |
"flipInY" |
"lightSpeedIn" |
"rotateIn" |
"rotateInDownLeft" |
"rotateInDownRight" |
"rotateInUpRight" |
"slideInDown" |
"slideInLeft" |
"rollIn" |
"zoomIn" |
"zoomInDown" |
"zoomInLeft" |
"zoomInRight" |
"zoomInUp" ;
declare type AnimationOut =
"bounceOut" |
"bounceOutDown" |
"bounceOutLeft" |
"bounceOutRight" |
"bounceOutUp" |
"fadeOut" |
"fadeOutDown" |
"fadeOutDownBig" |
"fadeOutLeft" |
"fadeOutLeftBig" |
"fadeOutRight" |
"fadeOutRightBig" |
"fadeOutUp" |
"lightSpeedOut" |
"rotateOut" |
"rotateOutDownLeft" |
"rotateOutDownRight"|
"rotateOutUpLeft" |
"rotateOutUpRight" |
"slideOutUp" |
"slideOutLeft" |
"slideOutRight" |
"hinge" |
"rollOut" |
"zoomOut" |
"zoomOutDown" |
"zoomOutLeft" |
"zoomOutRight" |
"zoomOutUp" ;
declare type MenuArr = MenuSection[]
declare interface MenuSection {
name: string;
items: MenuItem[]
}
declare interface MenuItem {
name: string | "---";
action(): void;
}