acode-plugin-types 1.11.7-patch.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (79) hide show
  1. package/README.md +8 -0
  2. package/index.d.ts +91 -0
  3. package/package.json +26 -0
  4. package/src/ace/index.d.ts +1 -0
  5. package/src/ace/modelist.d.ts +22 -0
  6. package/src/acode.d.ts +437 -0
  7. package/src/components/collapsibleList.d.ts +11 -0
  8. package/src/components/contextMenu.d.ts +66 -0
  9. package/src/components/index.d.ts +10 -0
  10. package/src/components/inputhints.d.ts +45 -0
  11. package/src/components/page.d.ts +22 -0
  12. package/src/components/palette.d.ts +21 -0
  13. package/src/components/sideButton.d.ts +35 -0
  14. package/src/components/terminal/index.d.ts +1 -0
  15. package/src/components/terminal/terminalManager.d.ts +113 -0
  16. package/src/components/toast.d.ts +20 -0
  17. package/src/components/tutorial.d.ts +13 -0
  18. package/src/components/webComponents/index.d.ts +1 -0
  19. package/src/components/webComponents/wcPage.d.ts +85 -0
  20. package/src/dialogs/alert.d.ts +15 -0
  21. package/src/dialogs/box.d.ts +45 -0
  22. package/src/dialogs/color.d.ts +15 -0
  23. package/src/dialogs/confirm.d.ts +16 -0
  24. package/src/dialogs/index.d.ts +8 -0
  25. package/src/dialogs/loader.d.ts +44 -0
  26. package/src/dialogs/multiPrompt.d.ts +16 -0
  27. package/src/dialogs/prompt.d.ts +47 -0
  28. package/src/dialogs/select.d.ts +66 -0
  29. package/src/fileSystem.d.ts +113 -0
  30. package/src/handlers/index.d.ts +3 -0
  31. package/src/handlers/intent.d.ts +47 -0
  32. package/src/handlers/keyboard.d.ts +30 -0
  33. package/src/handlers/windowResize.d.ts +13 -0
  34. package/src/index.d.ts +12 -0
  35. package/src/lib/actionStack.d.ts +60 -0
  36. package/src/lib/editorFile.d.ts +344 -0
  37. package/src/lib/editorManager.d.ts +127 -0
  38. package/src/lib/fileList.d.ts +70 -0
  39. package/src/lib/fonts.d.ts +29 -0
  40. package/src/lib/index.d.ts +9 -0
  41. package/src/lib/openFolder.d.ts +102 -0
  42. package/src/lib/projects.d.ts +28 -0
  43. package/src/lib/selectionMenu.d.ts +19 -0
  44. package/src/lib/settings.d.ts +155 -0
  45. package/src/pages/fileBrowser/fileBrowser.d.ts +65 -0
  46. package/src/pages/fileBrowser/index.d.ts +1 -0
  47. package/src/pages/index.d.ts +1 -0
  48. package/src/plugins/customtabs/CustomTabs.d.ts +57 -0
  49. package/src/plugins/customtabs/index.d.ts +1 -0
  50. package/src/plugins/index.d.ts +4 -0
  51. package/src/plugins/system/System.d.ts +550 -0
  52. package/src/plugins/system/index.d.ts +1 -0
  53. package/src/plugins/terminal/Executor.d.ts +155 -0
  54. package/src/plugins/terminal/Terminal.d.ts +123 -0
  55. package/src/plugins/terminal/index.d.ts +2 -0
  56. package/src/plugins/websocket/WebSocket.d.ts +224 -0
  57. package/src/plugins/websocket/index.d.ts +1 -0
  58. package/src/sideBarApps.d.ts +39 -0
  59. package/src/test.ts +517 -0
  60. package/src/theme/builder.d.ts +188 -0
  61. package/src/theme/index.d.ts +2 -0
  62. package/src/theme/list.d.ts +29 -0
  63. package/src/utils/KeyboardEvent.d.ts +19 -0
  64. package/src/utils/Url.d.ts +65 -0
  65. package/src/utils/color.d.ts +51 -0
  66. package/src/utils/encodings.d.ts +24 -0
  67. package/src/utils/helpers.d.ts +102 -0
  68. package/src/utils/index.d.ts +5 -0
  69. package/types/ace/VERSION +1 -0
  70. package/types/ace/ace-modes.d.ts +1724 -0
  71. package/types/ace/index.d.ts +1176 -0
  72. package/types/ace/types/ace-ext.d.ts +720 -0
  73. package/types/ace/types/ace-lib.d.ts +302 -0
  74. package/types/ace/types/ace-modules.d.ts +5293 -0
  75. package/types/ace/types/ace-snippets.d.ts +406 -0
  76. package/types/ace/types/ace-theme.d.ts +437 -0
  77. package/types/html-tag-js.d.ts +680 -0
  78. package/types/require.d.ts +412 -0
  79. package/types/xterm.d.ts +1908 -0
@@ -0,0 +1,113 @@
1
+ declare namespace Acode {
2
+ /**
3
+ * The fs module provides a simplified API for interacting with the file system in Acode, primarily for basic file and directory operations.
4
+ * This does not support symbolic links (symlink), due to limitation of the Android platform.
5
+ * To perform file operations, you first need to create a file system object by providing a URL (path) to the file or directory.
6
+ */
7
+ interface FS {
8
+ /**
9
+ * Create a file system object from a URL
10
+ * @param url URL of the file or directory
11
+ * @returns File system object
12
+ */
13
+ (url0: `http:${string}` | `https:${string}`, ...url: string[]): FileUrl;
14
+ (...url: string[]): FileSystem;
15
+
16
+ extend(
17
+ test: (url: string) => boolean,
18
+ fs: (url: string) => FileSystem,
19
+ ): void;
20
+
21
+ remove(test: (url: string) => boolean): void;
22
+ }
23
+
24
+ interface FileUrl {
25
+ /**
26
+ * Reads the contents of a file. Optionally accepts an encoding parameter (encoding) for text files.
27
+ */
28
+ readFile(): Promise<ArrayBuffer>;
29
+ readFile(encoding: "utf-8"): Promise<string>;
30
+ readFile(encoding: "json"): Promise<unknown>;
31
+
32
+ /**
33
+ * Writes data to a file.
34
+ */
35
+ writeFile(content: string | ArrayBuffer): Promise<void>;
36
+ }
37
+
38
+ interface FileSystem {
39
+ /**
40
+ * Returns a list of entries (files and directories) within the specified directory.
41
+ */
42
+ lsDir(): Promise<File[]>;
43
+
44
+ /**
45
+ * Reads the contents of a file. Optionally accepts an encoding parameter (encoding) for text files.
46
+ */
47
+ readFile(): Promise<ArrayBuffer>;
48
+ readFile(encoding: "utf-8"): Promise<string>;
49
+ readFile(encoding: "json"): Promise<unknown>;
50
+
51
+ /**
52
+ * Writes data to a file.
53
+ */
54
+ writeFile(content: string | ArrayBuffer): Promise<void>;
55
+
56
+ /**
57
+ * Creates a new file with the specified name and content.
58
+ * If a file with the same name exists, it will be overwritten.
59
+ */
60
+ createFile(name: string, content?: string): Promise<string>;
61
+
62
+ /**
63
+ * Creates a new directory with the specified name.
64
+ * @param name
65
+ * @returns
66
+ */
67
+ createDirectory(name: string): Promise<string>;
68
+
69
+ /**
70
+ * Deletes the file or directory specified by the URL.
71
+ * @returns
72
+ */
73
+ delete(): Promise<void>;
74
+
75
+ /**
76
+ * Copies the file or directory to the specified destination./
77
+ */
78
+ copyTo(destination: string): Promise<string>;
79
+
80
+ /**
81
+ * It allows you to move a file or directory from its current location to a new destination.
82
+ */
83
+ moveTo(destination: string): Promise<string>;
84
+
85
+ /**
86
+ * It allows for the renaming of a file or directory.
87
+ */
88
+ renameTo(newName: string): Promise<string>;
89
+
90
+ /**
91
+ * Checks if the specified file or directory exists.
92
+ */
93
+ exists(): Promise<boolean>;
94
+
95
+ /** Retrieves information about the file or directory. */
96
+ stat(): Promise<Stat>;
97
+ }
98
+
99
+ interface File {
100
+ name: string;
101
+ url: string;
102
+ isFile: boolean;
103
+ isDirectory: boolean;
104
+ isLink: boolean;
105
+ }
106
+
107
+ interface Stat extends File {
108
+ size: number;
109
+ modifiedDate: number;
110
+ canRead: boolean;
111
+ canWrite: boolean;
112
+ }
113
+ }
@@ -0,0 +1,3 @@
1
+ /// <reference path="./intent.d.ts" />
2
+ /// <reference path="./keyboard.d.ts" />
3
+ /// <reference path="./windowResize.d.ts" />
@@ -0,0 +1,47 @@
1
+ declare namespace Acode {
2
+ /**
3
+ * The Intent API provides functionality to handle intents from other apps and implement custom URI scheme handling in Acode plugins.
4
+ */
5
+ interface Intent {
6
+ /**
7
+ *Adds an intent handler function that will be called when intents are received.
8
+ */
9
+ addHandler(handler: (event: IntentEvent) => void): void;
10
+
11
+ /**
12
+ * Removes a previously added intent handler.
13
+ */
14
+ removeHandler(handler: (event: IntentEvent) => void): void;
15
+ }
16
+
17
+ interface IntentEvent {
18
+ /**
19
+ * The module name from the URI.
20
+ */
21
+ module: string;
22
+
23
+ /**
24
+ * The action to perform.
25
+ */
26
+ action: string;
27
+
28
+ /**
29
+ * Additional data value.
30
+ */
31
+ value: string;
32
+
33
+ /**
34
+ * Prevents default intent handling.
35
+ */
36
+ preventDefault: () => void;
37
+
38
+ /**
39
+ * Stops other handlers from executing.
40
+ */
41
+ stopPropagation: () => void;
42
+
43
+ readonly defaultPrevented: boolean;
44
+
45
+ readonly propagationStopped: boolean;
46
+ }
47
+ }
@@ -0,0 +1,30 @@
1
+ declare namespace Acode {
2
+ interface Keyboard {
3
+ /**
4
+ * Handles keyboard events
5
+ */
6
+ (e: KeyboardEvent): void;
7
+ /**
8
+ * Add an event listener for keyboard events.
9
+ * @param eventName Name of the event to listen for.
10
+ * @param callback Function to execute when the event occurs.
11
+ */
12
+ on(eventName: "key", callback: (ev: KeyboardEvent) => void): void;
13
+ on(eventName: KeyboardEventName, callback: () => void): void;
14
+
15
+ /**
16
+ * Remove an event listener.
17
+ * @param eventName Name of the event to remove listener from.
18
+ * @param callback The callback function to remove.
19
+ */
20
+ off(eventName: "key", callback: (ev: KeyboardEvent) => void): void;
21
+ off(eventName: KeyboardEventName, callback: () => void): void;
22
+ }
23
+
24
+ type KeyboardEventName =
25
+ | "key"
26
+ | "keyboardShow"
27
+ | "keyboardHide"
28
+ | "keyboardShowStart"
29
+ | "keyboardHideStart";
30
+ }
@@ -0,0 +1,13 @@
1
+ declare namespace Acode {
2
+ type WindowResizeEventName = "resize" | "resizeStart";
3
+
4
+ interface WindowResize {
5
+ (): void;
6
+
7
+ /** Adds event listener */
8
+ on(event: WindowResizeEventName, listener: () => void): void;
9
+
10
+ /** Removes event listener */
11
+ off(event: WindowResizeEventName, listener: () => void): void;
12
+ }
13
+ }
package/src/index.d.ts ADDED
@@ -0,0 +1,12 @@
1
+ /// <reference path="./ace/index.d.ts" />
2
+ /// <reference path="./acode.d.ts" />
3
+ /// <reference path="./components/index.d.ts" />
4
+ /// <reference path="./dialogs/index.d.ts" />
5
+ /// <reference path="./fileSystem.d.ts" />
6
+ /// <reference path="./handlers/index.d.ts" />
7
+ /// <reference path="./lib/index.d.ts" />
8
+ /// <reference path="./pages/index.d.ts" />
9
+ /// <reference path="./plugins/index.d.ts" />
10
+ /// <reference path="./sideBarApps.d.ts" />
11
+ /// <reference path="./theme/index.d.ts" />
12
+ /// <reference path="./utils/index.d.ts" />
@@ -0,0 +1,60 @@
1
+ declare namespace Acode {
2
+ interface ActionStack {
3
+ /**
4
+ * Length of stack
5
+ */
6
+ readonly length: number;
7
+
8
+ /**
9
+ * Function to be called when app is closed
10
+ */
11
+ onCloseApp: () => void;
12
+
13
+ /** Adds a new action to the stack. */
14
+ push(action: Action): void;
15
+
16
+ /**
17
+ * Executes and removes the most recent action from the stack.
18
+ * @param repeat Number of actions to pop and execute
19
+ */
20
+ pop(repeat?: number): void;
21
+
22
+ /**
23
+ * Retrieves an action from the stack by its ID.
24
+ * @param id The action identifier
25
+ */
26
+ get(id: string): Action | undefined;
27
+
28
+ /**
29
+ * Removes an action from the stack without executing it.
30
+ * @param id The action identifier
31
+ */
32
+ remove(id: string): void;
33
+
34
+ /**
35
+ * Checks if an action exists in the stack.
36
+ * @param id The action identifier
37
+ */
38
+ has(id: string): boolean;
39
+
40
+ /**
41
+ * Sets a marker at the current stack position.
42
+ */
43
+ setMark(): void;
44
+
45
+ /**
46
+ * Removes all actions added after the last marker.
47
+ */
48
+ clearFromMark(): void;
49
+ freeze(): void;
50
+ unfreeze(): void;
51
+ }
52
+
53
+ interface Action {
54
+ /** Unique identifier for the action */
55
+ id: string;
56
+
57
+ /** Callback function to execute when back is pressed */
58
+ action: () => void;
59
+ }
60
+ }
@@ -0,0 +1,344 @@
1
+ declare namespace Acode {
2
+ /**
3
+ * The Editor File API provides functionality to create, manage, interact with files/tabs in the Acode editor.
4
+ * It handles file operations, state management, editor session control, custom editor tab, etc.
5
+ */
6
+ class EditorFile {
7
+ /**
8
+ * Whether to hide quicktools for this tab
9
+ */
10
+ hideQuickTools: boolean;
11
+
12
+ /**
13
+ * Custom stylesheets for tab
14
+ */
15
+ stylesheets: string | string[];
16
+
17
+ /**
18
+ * If editor was focused before resize
19
+ */
20
+ focusedBefore: boolean;
21
+
22
+ /**
23
+ * State of the editor for this file.
24
+ */
25
+ focused: boolean;
26
+
27
+ /**
28
+ * Has completed loading text?
29
+ */
30
+ loaded: boolean;
31
+
32
+ /** Is still loading text? */
33
+ loading: boolean;
34
+
35
+ /**
36
+ * Weather file is deleted from source.
37
+ */
38
+ deletedFile: boolean;
39
+
40
+ /**
41
+ * EditSession of the file
42
+ */
43
+ session: Ace.EditSession;
44
+
45
+ /**
46
+ * Encoding of the text e.g. 'gbk'
47
+ */
48
+ encoding: string;
49
+
50
+ /**
51
+ * Is file readonly?
52
+ */
53
+ readOnly: boolean;
54
+
55
+ /**
56
+ * Should mark changes when session text changes?
57
+ */
58
+ markChanged: boolean;
59
+
60
+ onsave?: (event: FileEvent) => void;
61
+ onchange?: (event: FileEvent) => void;
62
+ onfocus?: (event: FileEvent) => void;
63
+ onblur?: (event: FileEvent) => void;
64
+ onclose?: (event: FileEvent) => void;
65
+ onrename?: (event: FileEvent) => void;
66
+ onload?: (event: FileEvent) => void;
67
+ onloaderror?: (event: FileEvent) => void;
68
+ onloadstart?: (event: FileEvent) => void;
69
+ onloadend?: (event: FileEvent) => void;
70
+ onchangemode?: (event: FileEvent) => void;
71
+ onrun?: (event: FileEvent) => void;
72
+ oncanrun?: (event: FileEvent) => void;
73
+
74
+ /**
75
+ * Creates a new EditorFile.
76
+ * @param name Name of the file
77
+ * @param options File creation options
78
+ */
79
+ constructor(name: string, options: FileOptions);
80
+
81
+ readonly type: string;
82
+
83
+ readonly tabIcon: string;
84
+
85
+ readonly content: HTMLElement;
86
+
87
+ /**
88
+ * File unique id.
89
+ */
90
+ id: string;
91
+
92
+ /**
93
+ * File name
94
+ */
95
+ filename: string;
96
+
97
+ /**
98
+ * Location of the file i.e. dirname
99
+ */
100
+ location: string;
101
+
102
+ /**
103
+ * File location on the device
104
+ */
105
+ uri: string;
106
+
107
+ /**
108
+ * End of line character
109
+ */
110
+ eol: "windows" | "unix";
111
+
112
+ /**
113
+ * Is editable?
114
+ */
115
+ editable: boolean;
116
+
117
+ /**
118
+ * Has unsaved changes?
119
+ */
120
+ isUnsaved: boolean;
121
+
122
+ /**
123
+ * File name (for plugin compatibility)
124
+ */
125
+ readonly name: string;
126
+
127
+ /**
128
+ * Cache file URL
129
+ */
130
+ readonly cacheFile: string;
131
+
132
+ /**
133
+ * File icon class
134
+ */
135
+ readonly icon: string;
136
+
137
+ /**
138
+ * File tab element
139
+ */
140
+ readonly tab: string;
141
+
142
+ /**
143
+ * Storage access framework mode
144
+ */
145
+ readonly SAFMode: "single" | "tree" | undefined;
146
+
147
+ /**
148
+ * Writes file content to cache.
149
+ */
150
+ writeToCache(): Promise<void>;
151
+
152
+ /**
153
+ * Checks if file has unsaved changes.
154
+ */
155
+ isChanged(): Promise<boolean>;
156
+
157
+ /**
158
+ * Checks if file can be run.
159
+ */
160
+ canRun(): Promise<boolean>;
161
+
162
+ readCanRun(): Promise<boolean>;
163
+
164
+ /**
165
+ * Sets whether to show run button.
166
+ */
167
+ writeCanRun(cb: () => boolean | Promise<boolean>): Promise<boolean>;
168
+
169
+ /**
170
+ * Remove and closes the file.
171
+ * @param force if true, will prompt to save the file
172
+ * @default false
173
+ */
174
+ remove(force: boolean): Promise<void>;
175
+
176
+ /**
177
+ * Saves the file to its current location.
178
+ */
179
+ save(): Promise<boolean>;
180
+
181
+ /**
182
+ * Saves the file to a new location.
183
+ */
184
+ saveAs(): Promise<boolean>;
185
+
186
+ /**
187
+ * Sets syntax highlighting mode for the file.
188
+ */
189
+ setMode(mode: string): void;
190
+
191
+ /**
192
+ * Makes this file the active file in the editor.
193
+ */
194
+ makeActive(): void;
195
+
196
+ /**
197
+ * Removes active state from the file.
198
+ */
199
+ removeActive(): void;
200
+
201
+ /**
202
+ * Opens file with system app.
203
+ */
204
+ openWith(): void;
205
+
206
+ /**
207
+ * Opens file for editing with system app.
208
+ */
209
+ editWith(): void;
210
+
211
+ /**
212
+ * Shares the file.
213
+ */
214
+ share(): void;
215
+
216
+ runAction(): void;
217
+
218
+ /** Runs the file. */
219
+ run(): void;
220
+
221
+ /**
222
+ * Runs the file in app.
223
+ */
224
+ runFile(): void;
225
+
226
+ render(): void;
227
+
228
+ /**
229
+ * Adds event listener.
230
+ */
231
+ on(event: FileEventType, callback: (event: FileEvent) => void): void;
232
+
233
+ /**
234
+ * Removes event listener.
235
+ */
236
+ off(event: FileEventType, callback: (event: FileEvent) => void): void;
237
+
238
+ /**
239
+ * Add stylesheet to tab's shadow DOM
240
+ * @param style URL or CSS string
241
+ */
242
+ addStyle(style: string): void;
243
+
244
+ /**
245
+ * Set custom title function for special tab types
246
+ * @param titleFn Function that returns the title string
247
+ */
248
+ setCustomTitle(titleFn: () => void): void;
249
+ }
250
+
251
+ interface FileOptions {
252
+ /** Whether file needs to be saved
253
+ * @default false
254
+ */
255
+ isUnsaved?: boolean;
256
+
257
+ /** Make file active
258
+ * @default true
259
+ */
260
+ render?: boolean;
261
+
262
+ /** ID for the file */
263
+ id?: string;
264
+
265
+ /** URI of the file */
266
+ uri?: string;
267
+
268
+ /** Session text */
269
+ text?: string;
270
+
271
+ /** Enable file editing
272
+ * @default true
273
+ */
274
+ editable?: boolean;
275
+
276
+ /** File does not exist at source
277
+ * @default false
278
+ */
279
+ deletedFile?: boolean;
280
+
281
+ /** Storage access framework mode */
282
+ SAFMode?: "single" | "tree";
283
+
284
+ /** Text encoding */
285
+ encoding?: string;
286
+
287
+ /** Cursor position */
288
+ cursorPos?: object;
289
+
290
+ /** Scroll left position */
291
+ scrollLeft?: number;
292
+
293
+ /** Scroll top position */
294
+ scrollTop?: number;
295
+
296
+ /** Code folds */
297
+ folds?: Ace.Fold[];
298
+
299
+ /** Type of content (e.g., 'editor')
300
+ * @default "editor"
301
+ */
302
+ type?: string;
303
+
304
+ /** Icon class for the file tab
305
+ * @default "file file_type_default"
306
+ */
307
+ tabIcon?: string;
308
+
309
+ /** Custom content element or HTML string. Strings are sanitized using DOMPurify */
310
+ content?: string | HTMLElement;
311
+
312
+ /** Custom stylesheets for tab. Can be URL, or CSS string */
313
+ stylesheets?: string | string[];
314
+
315
+ /** Whether to hide quicktools for this tab
316
+ * @default false
317
+ */
318
+ hideQuickTools?: boolean;
319
+ }
320
+
321
+ interface FileEvent {
322
+ target: EditorFile;
323
+ stopPropagation(): void;
324
+ preventDefault(): void;
325
+ readonly BUBBLING_PHASE: boolean;
326
+ readonly defaultPrevented: boolean;
327
+ }
328
+
329
+ type FileEventType =
330
+ | "run"
331
+ | "save"
332
+ | "change"
333
+ | "focus"
334
+ | "blur"
335
+ | "close"
336
+ | "rename"
337
+ | "load"
338
+ | "loadError"
339
+ | "loadStart"
340
+ | "loadEnd"
341
+ | "changeMode"
342
+ | "changeEncoding"
343
+ | "changeReadOnly";
344
+ }