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.
- package/README.md +8 -0
- package/index.d.ts +91 -0
- package/package.json +26 -0
- package/src/ace/index.d.ts +1 -0
- package/src/ace/modelist.d.ts +22 -0
- package/src/acode.d.ts +437 -0
- package/src/components/collapsibleList.d.ts +11 -0
- package/src/components/contextMenu.d.ts +66 -0
- package/src/components/index.d.ts +10 -0
- package/src/components/inputhints.d.ts +45 -0
- package/src/components/page.d.ts +22 -0
- package/src/components/palette.d.ts +21 -0
- package/src/components/sideButton.d.ts +35 -0
- package/src/components/terminal/index.d.ts +1 -0
- package/src/components/terminal/terminalManager.d.ts +113 -0
- package/src/components/toast.d.ts +20 -0
- package/src/components/tutorial.d.ts +13 -0
- package/src/components/webComponents/index.d.ts +1 -0
- package/src/components/webComponents/wcPage.d.ts +85 -0
- package/src/dialogs/alert.d.ts +15 -0
- package/src/dialogs/box.d.ts +45 -0
- package/src/dialogs/color.d.ts +15 -0
- package/src/dialogs/confirm.d.ts +16 -0
- package/src/dialogs/index.d.ts +8 -0
- package/src/dialogs/loader.d.ts +44 -0
- package/src/dialogs/multiPrompt.d.ts +16 -0
- package/src/dialogs/prompt.d.ts +47 -0
- package/src/dialogs/select.d.ts +66 -0
- package/src/fileSystem.d.ts +113 -0
- package/src/handlers/index.d.ts +3 -0
- package/src/handlers/intent.d.ts +47 -0
- package/src/handlers/keyboard.d.ts +30 -0
- package/src/handlers/windowResize.d.ts +13 -0
- package/src/index.d.ts +12 -0
- package/src/lib/actionStack.d.ts +60 -0
- package/src/lib/editorFile.d.ts +344 -0
- package/src/lib/editorManager.d.ts +127 -0
- package/src/lib/fileList.d.ts +70 -0
- package/src/lib/fonts.d.ts +29 -0
- package/src/lib/index.d.ts +9 -0
- package/src/lib/openFolder.d.ts +102 -0
- package/src/lib/projects.d.ts +28 -0
- package/src/lib/selectionMenu.d.ts +19 -0
- package/src/lib/settings.d.ts +155 -0
- package/src/pages/fileBrowser/fileBrowser.d.ts +65 -0
- package/src/pages/fileBrowser/index.d.ts +1 -0
- package/src/pages/index.d.ts +1 -0
- package/src/plugins/customtabs/CustomTabs.d.ts +57 -0
- package/src/plugins/customtabs/index.d.ts +1 -0
- package/src/plugins/index.d.ts +4 -0
- package/src/plugins/system/System.d.ts +550 -0
- package/src/plugins/system/index.d.ts +1 -0
- package/src/plugins/terminal/Executor.d.ts +155 -0
- package/src/plugins/terminal/Terminal.d.ts +123 -0
- package/src/plugins/terminal/index.d.ts +2 -0
- package/src/plugins/websocket/WebSocket.d.ts +224 -0
- package/src/plugins/websocket/index.d.ts +1 -0
- package/src/sideBarApps.d.ts +39 -0
- package/src/test.ts +517 -0
- package/src/theme/builder.d.ts +188 -0
- package/src/theme/index.d.ts +2 -0
- package/src/theme/list.d.ts +29 -0
- package/src/utils/KeyboardEvent.d.ts +19 -0
- package/src/utils/Url.d.ts +65 -0
- package/src/utils/color.d.ts +51 -0
- package/src/utils/encodings.d.ts +24 -0
- package/src/utils/helpers.d.ts +102 -0
- package/src/utils/index.d.ts +5 -0
- package/types/ace/VERSION +1 -0
- package/types/ace/ace-modes.d.ts +1724 -0
- package/types/ace/index.d.ts +1176 -0
- package/types/ace/types/ace-ext.d.ts +720 -0
- package/types/ace/types/ace-lib.d.ts +302 -0
- package/types/ace/types/ace-modules.d.ts +5293 -0
- package/types/ace/types/ace-snippets.d.ts +406 -0
- package/types/ace/types/ace-theme.d.ts +437 -0
- package/types/html-tag-js.d.ts +680 -0
- package/types/require.d.ts +412 -0
- package/types/xterm.d.ts +1908 -0
|
@@ -0,0 +1,123 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Logger function type for terminal operations.
|
|
3
|
+
*/
|
|
4
|
+
type TerminalLogger = (message: string, ...args: unknown[]) => void;
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* Terminal module providing Alpine Linux sandbox management for Acode.
|
|
8
|
+
* Handles installation, lifecycle management, backup/restore, and process control
|
|
9
|
+
* for the AXS environment.
|
|
10
|
+
*/
|
|
11
|
+
interface Terminal {
|
|
12
|
+
/**
|
|
13
|
+
* Starts the AXS environment by writing init scripts and executing the sandbox.
|
|
14
|
+
*
|
|
15
|
+
* @param installing - Whether AXS is being started during installation
|
|
16
|
+
* @param logger - Function to log standard output
|
|
17
|
+
* @param err_logger - Function to log errors
|
|
18
|
+
* @returns Promise resolving to `true` if installation completes with exit code 0, or `undefined` if not installing
|
|
19
|
+
*/
|
|
20
|
+
startAxs(
|
|
21
|
+
installing?: boolean,
|
|
22
|
+
logger?: TerminalLogger,
|
|
23
|
+
err_logger?: TerminalLogger,
|
|
24
|
+
): Promise<boolean | undefined>;
|
|
25
|
+
|
|
26
|
+
/**
|
|
27
|
+
* Stops the AXS process by forcefully killing it.
|
|
28
|
+
*
|
|
29
|
+
* @returns Promise resolving when the process is stopped
|
|
30
|
+
*/
|
|
31
|
+
stopAxs(): Promise<void>;
|
|
32
|
+
|
|
33
|
+
/**
|
|
34
|
+
* Checks if the AXS process is currently running.
|
|
35
|
+
*
|
|
36
|
+
* @returns Promise resolving to `true` if AXS is running, `false` otherwise
|
|
37
|
+
*/
|
|
38
|
+
isAxsRunning(): Promise<boolean>;
|
|
39
|
+
|
|
40
|
+
/**
|
|
41
|
+
* Installs Alpine by downloading binaries and extracting the root filesystem.
|
|
42
|
+
* Also sets up additional dependencies for F-Droid variant.
|
|
43
|
+
*
|
|
44
|
+
* @param logger - Function to log standard output
|
|
45
|
+
* @param err_logger - Function to log errors
|
|
46
|
+
* @returns Promise resolving to `true` if installation completes with exit code 0, `false` otherwise
|
|
47
|
+
*/
|
|
48
|
+
install(
|
|
49
|
+
logger?: TerminalLogger,
|
|
50
|
+
err_logger?: TerminalLogger,
|
|
51
|
+
): Promise<boolean>;
|
|
52
|
+
|
|
53
|
+
/**
|
|
54
|
+
* Checks if Alpine is already installed.
|
|
55
|
+
*
|
|
56
|
+
* @returns Promise resolving to `true` if all required files and directories exist
|
|
57
|
+
*/
|
|
58
|
+
isInstalled(): Promise<boolean>;
|
|
59
|
+
|
|
60
|
+
/**
|
|
61
|
+
* Checks if the current device architecture is supported.
|
|
62
|
+
*
|
|
63
|
+
* @returns Promise resolving to `true` if architecture is supported (`arm64-v8a`, `armeabi-v7a`, or `x86_64`), otherwise `false`
|
|
64
|
+
*/
|
|
65
|
+
isSupported(): Promise<boolean>;
|
|
66
|
+
|
|
67
|
+
/**
|
|
68
|
+
* Creates a backup of the Alpine Linux installation.
|
|
69
|
+
* Creates a compressed tar archive of the Alpine installation.
|
|
70
|
+
*
|
|
71
|
+
* @returns Promise resolving to the file URI of the created backup file (`aterm_backup.tar`)
|
|
72
|
+
* @throws Rejects with "Alpine is not installed." if Alpine is not currently installed
|
|
73
|
+
* @throws Rejects with command output if backup creation fails
|
|
74
|
+
*
|
|
75
|
+
* @example
|
|
76
|
+
* try {
|
|
77
|
+
* const backupPath = await Terminal.backup();
|
|
78
|
+
* console.log(`Backup created at: ${backupPath}`);
|
|
79
|
+
* } catch (error) {
|
|
80
|
+
* console.error(`Backup failed: ${error}`);
|
|
81
|
+
* }
|
|
82
|
+
*/
|
|
83
|
+
backup(): Promise<string>;
|
|
84
|
+
|
|
85
|
+
/**
|
|
86
|
+
* Restores Alpine Linux installation from a backup file.
|
|
87
|
+
* Restores the Alpine installation from a previously created backup file (`aterm_backup.tar`).
|
|
88
|
+
* This function stops any running Alpine processes, removes existing installation files,
|
|
89
|
+
* and extracts the backup to restore the previous state.
|
|
90
|
+
*
|
|
91
|
+
* @returns Promise resolving to "ok" when restoration completes successfully
|
|
92
|
+
* @throws Rejects with "Backup File does not exist" if `aterm_backup.tar` is not found
|
|
93
|
+
* @throws Rejects with command output if restoration fails
|
|
94
|
+
*
|
|
95
|
+
* @example
|
|
96
|
+
* try {
|
|
97
|
+
* await Terminal.restore();
|
|
98
|
+
* console.log("Alpine installation restored successfully");
|
|
99
|
+
* } catch (error) {
|
|
100
|
+
* console.error(`Restore failed: ${error}`);
|
|
101
|
+
* }
|
|
102
|
+
*/
|
|
103
|
+
restore(): Promise<string>;
|
|
104
|
+
|
|
105
|
+
/**
|
|
106
|
+
* Uninstalls the Alpine Linux installation.
|
|
107
|
+
* Completely removes the Alpine Linux installation from the device by deleting all
|
|
108
|
+
* Alpine-related files and directories. This function stops any running Alpine processes
|
|
109
|
+
* before removal.
|
|
110
|
+
*
|
|
111
|
+
* @returns Promise resolving to "ok" when uninstallation completes successfully
|
|
112
|
+
* @throws Rejects with command output if uninstallation fails
|
|
113
|
+
*
|
|
114
|
+
* @example
|
|
115
|
+
* try {
|
|
116
|
+
* await Terminal.uninstall();
|
|
117
|
+
* console.log("Alpine installation removed successfully");
|
|
118
|
+
* } catch (error) {
|
|
119
|
+
* console.error(`Uninstall failed: ${error}`);
|
|
120
|
+
* }
|
|
121
|
+
*/
|
|
122
|
+
uninstall(): Promise<string>;
|
|
123
|
+
}
|
|
@@ -0,0 +1,224 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Ready state constants for WebSocket connection.
|
|
3
|
+
*/
|
|
4
|
+
type WebSocketReadyState = 0 | 1 | 2 | 3;
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* Binary type for WebSocket messages.
|
|
8
|
+
* Note: 'blob' is not supported but checked for browser compatibility.
|
|
9
|
+
*/
|
|
10
|
+
type WebSocketBinaryType = "" | "arraybuffer" | "blob";
|
|
11
|
+
|
|
12
|
+
/**
|
|
13
|
+
* Event handler type for WebSocket open events.
|
|
14
|
+
*/
|
|
15
|
+
type WebSocketOpenHandler = (event: Event) => void;
|
|
16
|
+
|
|
17
|
+
/**
|
|
18
|
+
* Extended MessageEvent with binary indicator.
|
|
19
|
+
*/
|
|
20
|
+
interface WebSocketMessageEvent extends MessageEvent {
|
|
21
|
+
readonly binary: boolean;
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
/**
|
|
25
|
+
* Event handler type for WebSocket message events.
|
|
26
|
+
*/
|
|
27
|
+
type WebSocketMessageHandler = (event: WebSocketMessageEvent) => void;
|
|
28
|
+
|
|
29
|
+
/**
|
|
30
|
+
* Event handler type for WebSocket close events.
|
|
31
|
+
*/
|
|
32
|
+
type WebSocketCloseHandler = (event: CloseEvent) => void;
|
|
33
|
+
|
|
34
|
+
/**
|
|
35
|
+
* Extended Error event with optional message property.
|
|
36
|
+
*/
|
|
37
|
+
interface WebSocketErrorEvent extends Event {
|
|
38
|
+
message?: string;
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
/**
|
|
42
|
+
* Event handler type for WebSocket error events.
|
|
43
|
+
*/
|
|
44
|
+
type WebSocketErrorHandler = (event: WebSocketErrorEvent) => void;
|
|
45
|
+
|
|
46
|
+
/**
|
|
47
|
+
* Represents an active WebSocket connection instance.
|
|
48
|
+
* Extends EventTarget for native event handling support.
|
|
49
|
+
*/
|
|
50
|
+
interface CordovaWebSocketInstance extends EventTarget {
|
|
51
|
+
/**
|
|
52
|
+
* Unique identifier for this WebSocket instance.
|
|
53
|
+
*/
|
|
54
|
+
readonly instanceId: string;
|
|
55
|
+
|
|
56
|
+
/**
|
|
57
|
+
* The extensions selected by the server.
|
|
58
|
+
*/
|
|
59
|
+
readonly extensions: string;
|
|
60
|
+
|
|
61
|
+
/**
|
|
62
|
+
* The current state of the connection.
|
|
63
|
+
* - 0: CONNECTING
|
|
64
|
+
* - 1: OPEN
|
|
65
|
+
* - 2: CLOSING
|
|
66
|
+
* - 3: CLOSED
|
|
67
|
+
*/
|
|
68
|
+
readonly readyState: WebSocketReadyState;
|
|
69
|
+
|
|
70
|
+
/**
|
|
71
|
+
* The URL of the WebSocket connection.
|
|
72
|
+
*/
|
|
73
|
+
readonly url: string;
|
|
74
|
+
|
|
75
|
+
/**
|
|
76
|
+
* The binary data type used by the connection.
|
|
77
|
+
* Set to 'arraybuffer' to receive binary data as ArrayBuffer.
|
|
78
|
+
* Empty string means text mode (default).
|
|
79
|
+
*/
|
|
80
|
+
binaryType: WebSocketBinaryType;
|
|
81
|
+
|
|
82
|
+
/**
|
|
83
|
+
* Event handler called when the connection is opened.
|
|
84
|
+
*/
|
|
85
|
+
onopen: WebSocketOpenHandler | null;
|
|
86
|
+
|
|
87
|
+
/**
|
|
88
|
+
* Event handler called when a message is received.
|
|
89
|
+
*/
|
|
90
|
+
onmessage: WebSocketMessageHandler | null;
|
|
91
|
+
|
|
92
|
+
/**
|
|
93
|
+
* Event handler called when the connection is closed.
|
|
94
|
+
*/
|
|
95
|
+
onclose: WebSocketCloseHandler | null;
|
|
96
|
+
|
|
97
|
+
/**
|
|
98
|
+
* Event handler called when an error occurs.
|
|
99
|
+
*/
|
|
100
|
+
onerror: WebSocketErrorHandler | null;
|
|
101
|
+
|
|
102
|
+
/**
|
|
103
|
+
* Sends data through the WebSocket connection.
|
|
104
|
+
*
|
|
105
|
+
* @param message - The data to send. Can be a string, ArrayBuffer, or ArrayBufferView.
|
|
106
|
+
* @param binary - If true, sends the message as binary data. For ArrayBuffer/ArrayBufferView, this is automatically set to true.
|
|
107
|
+
* @throws Error if the WebSocket is not in OPEN state.
|
|
108
|
+
*
|
|
109
|
+
* @example
|
|
110
|
+
* // Send text message
|
|
111
|
+
* ws.send('Hello, World!');
|
|
112
|
+
*
|
|
113
|
+
* // Send binary data
|
|
114
|
+
* const buffer = new Uint8Array([0x48, 0x65, 0x6c, 0x6c, 0x6f]);
|
|
115
|
+
* ws.send(buffer);
|
|
116
|
+
*/
|
|
117
|
+
send(message: string | ArrayBuffer | ArrayBufferView, binary?: boolean): void;
|
|
118
|
+
|
|
119
|
+
/**
|
|
120
|
+
* Closes the WebSocket connection.
|
|
121
|
+
*
|
|
122
|
+
* @param code - The status code explaining why the connection is being closed.
|
|
123
|
+
* @param reason - A human-readable string explaining why the connection is being closed.
|
|
124
|
+
*
|
|
125
|
+
* @example
|
|
126
|
+
* ws.close(1000, 'Normal closure');
|
|
127
|
+
*/
|
|
128
|
+
close(code?: number, reason?: string): void;
|
|
129
|
+
}
|
|
130
|
+
|
|
131
|
+
/**
|
|
132
|
+
* Static constants for WebSocket ready states.
|
|
133
|
+
*/
|
|
134
|
+
interface CordovaWebSocketInstanceStatic {
|
|
135
|
+
readonly CONNECTING: 0;
|
|
136
|
+
readonly OPEN: 1;
|
|
137
|
+
readonly CLOSING: 2;
|
|
138
|
+
readonly CLOSED: 3;
|
|
139
|
+
}
|
|
140
|
+
|
|
141
|
+
/**
|
|
142
|
+
* Cordova WebSocket plugin interface.
|
|
143
|
+
* Provides native WebSocket functionality for Cordova applications.
|
|
144
|
+
* Available globally at `cordova.websocket`.
|
|
145
|
+
*/
|
|
146
|
+
interface CordovaWebSocket {
|
|
147
|
+
/**
|
|
148
|
+
* Whether to log debug messages.
|
|
149
|
+
*/
|
|
150
|
+
DEBUG: boolean;
|
|
151
|
+
|
|
152
|
+
/**
|
|
153
|
+
* Creates a new WebSocket connection to the specified URL.
|
|
154
|
+
*
|
|
155
|
+
* @param url - The URL to connect to (e.g., 'wss://example.com/socket').
|
|
156
|
+
* @param protocols - Optional subprotocol(s) to use.
|
|
157
|
+
* @param headers - Optional custom headers to send with the connection request.
|
|
158
|
+
* @param binaryType - Optional binary type for the connection ('arraybuffer' or empty string).
|
|
159
|
+
* @returns Promise resolving to a WebSocketInstance on successful connection.
|
|
160
|
+
*
|
|
161
|
+
* @example
|
|
162
|
+
* const ws = await cordova.websocket.connect('wss://echo.websocket.org');
|
|
163
|
+
* ws.onmessage = (event) => console.log('Received:', event.data);
|
|
164
|
+
* ws.send('Hello!');
|
|
165
|
+
*/
|
|
166
|
+
connect(
|
|
167
|
+
url: string,
|
|
168
|
+
protocols?: string | string[] | null,
|
|
169
|
+
headers?: Record<string, string> | null,
|
|
170
|
+
binaryType?: WebSocketBinaryType,
|
|
171
|
+
): Promise<CordovaWebSocketInstance>;
|
|
172
|
+
|
|
173
|
+
/**
|
|
174
|
+
* Lists all active WebSocket client instance IDs.
|
|
175
|
+
*
|
|
176
|
+
* @returns Promise resolving to an array of active instance IDs.
|
|
177
|
+
*
|
|
178
|
+
* @example
|
|
179
|
+
* const clients = await cordova.websocket.listClients();
|
|
180
|
+
* console.log('Active connections:', clients);
|
|
181
|
+
*/
|
|
182
|
+
listClients(): Promise<string[]>;
|
|
183
|
+
|
|
184
|
+
/**
|
|
185
|
+
* Utility function to send a message through a WebSocket by its instance ID.
|
|
186
|
+
* Useful when you've lost the reference to the WebSocketInstance object.
|
|
187
|
+
*
|
|
188
|
+
* @param instanceId - The ID of the WebSocket instance.
|
|
189
|
+
* @param message - The data to send. Can be a string, ArrayBuffer, or ArrayBufferView.
|
|
190
|
+
* @param binary - If true, sends the message as binary data.
|
|
191
|
+
* @returns Promise resolving when the message is sent.
|
|
192
|
+
*
|
|
193
|
+
* @example
|
|
194
|
+
* await cordova.websocket.send('instance-123', 'Hello!');
|
|
195
|
+
*/
|
|
196
|
+
send(
|
|
197
|
+
instanceId: string,
|
|
198
|
+
message: string | ArrayBuffer | ArrayBufferView,
|
|
199
|
+
binary?: boolean,
|
|
200
|
+
): Promise<void>;
|
|
201
|
+
|
|
202
|
+
/**
|
|
203
|
+
* Utility function to close a WebSocket connection by its instance ID.
|
|
204
|
+
* Useful when you've lost the reference to the WebSocketInstance object.
|
|
205
|
+
*
|
|
206
|
+
* @param instanceId - The ID of the WebSocket instance to close.
|
|
207
|
+
* @param code - Optional status code explaining why the connection is being closed.
|
|
208
|
+
* @param reason - Optional human-readable string explaining why the connection is being closed.
|
|
209
|
+
* @returns Promise resolving when the close operation has completed.
|
|
210
|
+
*
|
|
211
|
+
* @example
|
|
212
|
+
* await cordova.websocket.close('instance-123', 1000, 'Done');
|
|
213
|
+
*/
|
|
214
|
+
close(instanceId: string, code?: number, reason?: string): Promise<void>;
|
|
215
|
+
}
|
|
216
|
+
|
|
217
|
+
interface Cordova {
|
|
218
|
+
/**
|
|
219
|
+
* Native WebSocket plugin providing WebSocket functionality.
|
|
220
|
+
*/
|
|
221
|
+
websocket: CordovaWebSocket;
|
|
222
|
+
}
|
|
223
|
+
|
|
224
|
+
declare const cordova: Cordova;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
/// <reference path="./WebSocket.d.ts" />
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
declare namespace Acode {
|
|
2
|
+
/**
|
|
3
|
+
* The SideBar Apps API allows you to add mini app to the sidebar of the Acode editor.
|
|
4
|
+
* This provides a way to extend the editor's functionality with
|
|
5
|
+
* custom UI components that are easily accessible from the sidebar.
|
|
6
|
+
*/
|
|
7
|
+
interface SidebarApps {
|
|
8
|
+
/**
|
|
9
|
+
* Adds a new app to the sidebar.
|
|
10
|
+
* @param icon Icon class name to display for the app
|
|
11
|
+
* @param id Unique identifier for the app
|
|
12
|
+
* @param title Display title of the app
|
|
13
|
+
* @param initFunction Called when app is first initialized, receives container element
|
|
14
|
+
* @param prepend Whether to add app at start (true) or end (false) of sidebar
|
|
15
|
+
* @param onSelected Called whenever app tab is selected, receives container element
|
|
16
|
+
*/
|
|
17
|
+
add(
|
|
18
|
+
icon: string,
|
|
19
|
+
id: string,
|
|
20
|
+
title: string,
|
|
21
|
+
initFunction: (container: HTMLElement) => void,
|
|
22
|
+
prepend?: boolean,
|
|
23
|
+
onSelected?: (container: HTMLElement) => void,
|
|
24
|
+
): void;
|
|
25
|
+
|
|
26
|
+
/**
|
|
27
|
+
* Gets the container element for the app with the given ID.
|
|
28
|
+
* @param id ID of the app to get
|
|
29
|
+
*/
|
|
30
|
+
get(id: string): HTMLElement | undefined;
|
|
31
|
+
|
|
32
|
+
/**
|
|
33
|
+
* Removes the app with the given ID from the sidebar.
|
|
34
|
+
* @param id ID of the app to remove
|
|
35
|
+
* @returns
|
|
36
|
+
*/
|
|
37
|
+
remove(id: string): void;
|
|
38
|
+
}
|
|
39
|
+
}
|