acode-plugin-types 1.11.7
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 +5 -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/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,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="./sideBarApps.d.ts" />
|
|
9
|
+
/// <reference path="./theme/index.d.ts" />
|
|
10
|
+
/// <reference path="./utils/index.d.ts" />
|
|
11
|
+
/// <reference path="./plugins/index.d.ts" />
|
|
12
|
+
|
|
@@ -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
|
+
}
|
|
@@ -0,0 +1,127 @@
|
|
|
1
|
+
declare namespace Acode {
|
|
2
|
+
/**
|
|
3
|
+
* The editorManager allows to interact with the Editor Instance and listen to various events
|
|
4
|
+
* of Acode app with the help of various methods and Properties.
|
|
5
|
+
* Basically for interacting with the opened files and tabs.
|
|
6
|
+
*/
|
|
7
|
+
interface EditorManager {
|
|
8
|
+
/** This property returns a list of all files. */
|
|
9
|
+
files: EditorFile[];
|
|
10
|
+
|
|
11
|
+
onupdate: () => void;
|
|
12
|
+
/**
|
|
13
|
+
* This property returns the current file.
|
|
14
|
+
*/
|
|
15
|
+
activeFile: EditorFile;
|
|
16
|
+
|
|
17
|
+
/**
|
|
18
|
+
* Adds a file to the manager's file list and updates the UI.
|
|
19
|
+
* @param file - The file to be added.
|
|
20
|
+
*/
|
|
21
|
+
addFile(file: EditorFile): void;
|
|
22
|
+
|
|
23
|
+
/**
|
|
24
|
+
* This is an instance of the Ace editor.
|
|
25
|
+
*/
|
|
26
|
+
editor: Ace.Editor;
|
|
27
|
+
|
|
28
|
+
/**
|
|
29
|
+
* This function gets files from the list of opened files.
|
|
30
|
+
* @param test the file id, uri, repo, or gist to find the file.
|
|
31
|
+
* @param type the type of test.
|
|
32
|
+
*/
|
|
33
|
+
getFile(test: string, type: "uri" | "id" | "name"): EditorFile;
|
|
34
|
+
|
|
35
|
+
/**
|
|
36
|
+
* This function switches the tab to the given file id.
|
|
37
|
+
*/
|
|
38
|
+
switchFile(id: string): void;
|
|
39
|
+
|
|
40
|
+
/**
|
|
41
|
+
* This function returns the number of unsaved files.
|
|
42
|
+
*/
|
|
43
|
+
hasUnsavedFiles(): number;
|
|
44
|
+
|
|
45
|
+
/**
|
|
46
|
+
* Gets the height of the editor
|
|
47
|
+
*/
|
|
48
|
+
getEditorHeight(editor: Ace.Editor): number;
|
|
49
|
+
|
|
50
|
+
/**
|
|
51
|
+
* Gets the height of the editor
|
|
52
|
+
*/
|
|
53
|
+
getEditorWidth(editor: Ace.Editor): number;
|
|
54
|
+
|
|
55
|
+
/**
|
|
56
|
+
* container: HTMLElement
|
|
57
|
+
*/
|
|
58
|
+
container: HTMLElement;
|
|
59
|
+
|
|
60
|
+
/**
|
|
61
|
+
* The header element
|
|
62
|
+
*/
|
|
63
|
+
header: HTMLElement;
|
|
64
|
+
|
|
65
|
+
/**
|
|
66
|
+
* Whether the editor is currently scrolling.
|
|
67
|
+
*/
|
|
68
|
+
readonly isScrolling: boolean;
|
|
69
|
+
|
|
70
|
+
readonly TIMEOUT_VALUE: number;
|
|
71
|
+
|
|
72
|
+
readonly openFileList: HTMLElement;
|
|
73
|
+
|
|
74
|
+
/** This function adds a listener for the specified event. */
|
|
75
|
+
on(
|
|
76
|
+
event:
|
|
77
|
+
| "file-content-changed"
|
|
78
|
+
| "file-loaded"
|
|
79
|
+
| "remove-file"
|
|
80
|
+
| "save-file"
|
|
81
|
+
| "switch-file",
|
|
82
|
+
listener: (file: EditorFile) => void,
|
|
83
|
+
): void;
|
|
84
|
+
on(
|
|
85
|
+
event: "add-folder" | "remove-folder" | "update-folder",
|
|
86
|
+
listener: (ev: { url: string; name: string }) => void,
|
|
87
|
+
): void;
|
|
88
|
+
on(event: EditorEvent, listener: (...args: any[]) => void): void;
|
|
89
|
+
|
|
90
|
+
/** This function removes a listener for the specified event. */
|
|
91
|
+
off(event: string, listener: (...args: any[]) => void): void;
|
|
92
|
+
|
|
93
|
+
/** This function emits an event with the specified arguments. */
|
|
94
|
+
emit(event: EditorEvent, ...args: any[]): void;
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
/** Editor Event */
|
|
98
|
+
type EditorEvent =
|
|
99
|
+
| "add-folder"
|
|
100
|
+
| "change"
|
|
101
|
+
| "file-content-changed"
|
|
102
|
+
| "file-loaded"
|
|
103
|
+
| "init-open-file-list"
|
|
104
|
+
| "new-file"
|
|
105
|
+
| "remove-file"
|
|
106
|
+
| "remove-folder"
|
|
107
|
+
| "rename-file"
|
|
108
|
+
| "save-file"
|
|
109
|
+
| "switch-file"
|
|
110
|
+
| "update-folder";
|
|
111
|
+
}
|
|
112
|
+
|
|
113
|
+
/**
|
|
114
|
+
* The editorManager allows to interact with the Editor Instance and listen to various events
|
|
115
|
+
* of Acode app with the help of various methods and Properties.
|
|
116
|
+
* Basically for interacting with the opened files and tabs.
|
|
117
|
+
*/
|
|
118
|
+
declare const editorManager: Acode.EditorManager;
|
|
119
|
+
|
|
120
|
+
interface Window {
|
|
121
|
+
/**
|
|
122
|
+
* The editorManager allows to interact with the Editor Instance and listen to various events
|
|
123
|
+
* of Acode app with the help of various methods and Properties.
|
|
124
|
+
* Basically for interacting with the opened files and tabs.
|
|
125
|
+
*/
|
|
126
|
+
editorManager: Acode.EditorManager;
|
|
127
|
+
}
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
declare namespace Acode {
|
|
2
|
+
/**
|
|
3
|
+
* The File List API provides functionality to manage and interact with files and folders in the Acode workspace.
|
|
4
|
+
* It returns a tree structure representing the file system hierarchy.
|
|
5
|
+
*/
|
|
6
|
+
interface FileList {
|
|
7
|
+
/** Get all files in a folder */
|
|
8
|
+
(dir: string | (() => object)): Tree[];
|
|
9
|
+
|
|
10
|
+
/**
|
|
11
|
+
* Adds event listener for file list
|
|
12
|
+
* @param event - Event name
|
|
13
|
+
* @param callback - Callback function
|
|
14
|
+
*/
|
|
15
|
+
on(event: FileListEvent, callback: (tree: Tree) => void): void;
|
|
16
|
+
|
|
17
|
+
/**
|
|
18
|
+
* Removes event listener for file list
|
|
19
|
+
* @param event - Event name
|
|
20
|
+
* @param callback - Callback function
|
|
21
|
+
*/
|
|
22
|
+
off(event: FileListEvent, callback: (tree: Tree) => void): void;
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
interface Tree {
|
|
26
|
+
/** Name of the file/folder */
|
|
27
|
+
name: string;
|
|
28
|
+
|
|
29
|
+
/** Absolute URL path */
|
|
30
|
+
url: string;
|
|
31
|
+
|
|
32
|
+
/** Relative path */
|
|
33
|
+
path: string;
|
|
34
|
+
|
|
35
|
+
/** Child files/folders (if directory) */
|
|
36
|
+
children: Tree[];
|
|
37
|
+
|
|
38
|
+
/** Parent folder reference */
|
|
39
|
+
parent: Tree;
|
|
40
|
+
|
|
41
|
+
/** Whether root is in open folder list */
|
|
42
|
+
readonly isConnected: boolean;
|
|
43
|
+
|
|
44
|
+
/** Root folder reference */
|
|
45
|
+
readonly root: Tree;
|
|
46
|
+
|
|
47
|
+
/**
|
|
48
|
+
* Updates the file/folder URL and name
|
|
49
|
+
*/
|
|
50
|
+
update(url: string, name?: string): void;
|
|
51
|
+
|
|
52
|
+
/** Converts tree to JSON representation */
|
|
53
|
+
toJSON(): TreeJson;
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
interface TreeJson {
|
|
57
|
+
name: string;
|
|
58
|
+
url: string;
|
|
59
|
+
path: string;
|
|
60
|
+
parent: string;
|
|
61
|
+
isDirectory: boolean;
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
type FileListEvent =
|
|
65
|
+
| "add-file"
|
|
66
|
+
| "remove-file"
|
|
67
|
+
| "add-folder"
|
|
68
|
+
| "remove-folder"
|
|
69
|
+
| "refresh";
|
|
70
|
+
}
|