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
package/src/test.ts
ADDED
|
@@ -0,0 +1,517 @@
|
|
|
1
|
+
async function _acodeTest() {
|
|
2
|
+
acode.setPluginInit("com.example.plugin", (_baseUrl, $page, _cache) => {
|
|
3
|
+
const { commands } = editorManager.editor;
|
|
4
|
+
commands.addCommand({
|
|
5
|
+
name: "example-plugin",
|
|
6
|
+
bindKey: { win: "Ctrl-Alt-E", mac: "Command-Alt-E" },
|
|
7
|
+
exec: () => {
|
|
8
|
+
$page.innerHTML = `
|
|
9
|
+
<h1>Example Plugin</h1>
|
|
10
|
+
<p>This is an example plugin.</p>
|
|
11
|
+
`;
|
|
12
|
+
$page.show();
|
|
13
|
+
},
|
|
14
|
+
});
|
|
15
|
+
});
|
|
16
|
+
|
|
17
|
+
acode.setPluginUnmount("com.example.plugin", () => {
|
|
18
|
+
const { commands } = editorManager.editor;
|
|
19
|
+
commands.removeCommand("example-plugin");
|
|
20
|
+
});
|
|
21
|
+
|
|
22
|
+
acode.define("say-hello", {
|
|
23
|
+
hello: () => {
|
|
24
|
+
console.log("Hello World!");
|
|
25
|
+
},
|
|
26
|
+
});
|
|
27
|
+
|
|
28
|
+
// You can access the module using the module name
|
|
29
|
+
|
|
30
|
+
(acode.require("say-hello") as any).hello(); // Hello World!
|
|
31
|
+
acode.require("url");
|
|
32
|
+
|
|
33
|
+
acode.exec("console"); // Opens the console
|
|
34
|
+
|
|
35
|
+
acode.registerFormatter("com.example.plugin", ["js"], async () => {
|
|
36
|
+
// formats the active file if supported
|
|
37
|
+
const text = editorManager.editor.session.getValue();
|
|
38
|
+
// format the text
|
|
39
|
+
editorManager.editor.session.setValue(text);
|
|
40
|
+
});
|
|
41
|
+
|
|
42
|
+
acode.addIcon("my-icon", "https://example.com/icon.png");
|
|
43
|
+
|
|
44
|
+
acode.pushNotification("Hello", "This is a notification", {
|
|
45
|
+
icon: "my-icon",
|
|
46
|
+
autoClose: false,
|
|
47
|
+
action: () => {
|
|
48
|
+
console.log("Notification clicked!");
|
|
49
|
+
},
|
|
50
|
+
type: "success",
|
|
51
|
+
});
|
|
52
|
+
|
|
53
|
+
await acode.installPlugin("com.example.pluginid", "mypluin.id");
|
|
54
|
+
|
|
55
|
+
const _file = acode.newEditorFile("example.js", {
|
|
56
|
+
text: 'console.log("Hello World");',
|
|
57
|
+
editable: true,
|
|
58
|
+
});
|
|
59
|
+
|
|
60
|
+
const _fileBrowser = acode.fileBrowser("file", "test");
|
|
61
|
+
Executor.execute("ls -l").then((res) => {
|
|
62
|
+
console.log(res);
|
|
63
|
+
});
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
namespace ui {
|
|
67
|
+
export namespace dialogs {
|
|
68
|
+
export function alert() {
|
|
69
|
+
const alert = acode.require("alert");
|
|
70
|
+
|
|
71
|
+
const handleOnHide = () => {
|
|
72
|
+
window.toast("Alert modal closed", 4000);
|
|
73
|
+
};
|
|
74
|
+
|
|
75
|
+
alert("Title of Alert", "The alert body message..", handleOnHide);
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
export async function confirm() {
|
|
79
|
+
const confirm = acode.require("confirm");
|
|
80
|
+
|
|
81
|
+
const confirmation = await confirm("Warning", "Are you sure?");
|
|
82
|
+
if (confirmation) {
|
|
83
|
+
window.toast("File deleted...", 4000);
|
|
84
|
+
} else {
|
|
85
|
+
window.toast("File not deleted...", 4000);
|
|
86
|
+
}
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
export async function colorPicker() {
|
|
90
|
+
const colorPicker = acode.require("colorPicker");
|
|
91
|
+
|
|
92
|
+
const selectedColor = await colorPicker("#ff0000");
|
|
93
|
+
console.log(`Selected Color: ${selectedColor}`);
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
export function loader() {
|
|
97
|
+
const loader = acode.require("loader");
|
|
98
|
+
|
|
99
|
+
// Create the loader with specified options
|
|
100
|
+
loader.create("Title Text", "Message...", {
|
|
101
|
+
timeout: 5000,
|
|
102
|
+
callback: () => window.toast("Loading cancelled", 4000),
|
|
103
|
+
});
|
|
104
|
+
|
|
105
|
+
// Hide the loader after 2 seconds
|
|
106
|
+
setTimeout(() => {
|
|
107
|
+
loader.hide();
|
|
108
|
+
}, 2000);
|
|
109
|
+
|
|
110
|
+
// Show the loader after 4 seconds
|
|
111
|
+
setTimeout(() => {
|
|
112
|
+
loader.show();
|
|
113
|
+
}, 4000);
|
|
114
|
+
|
|
115
|
+
// Destroy the loader after 6 seconds
|
|
116
|
+
setTimeout(() => {
|
|
117
|
+
loader.destroy();
|
|
118
|
+
}, 6000);
|
|
119
|
+
|
|
120
|
+
// example of `showTitleLoader()` & `removeTitleLoader()`
|
|
121
|
+
loader.showTitleLoader();
|
|
122
|
+
|
|
123
|
+
// remove the title loader after 4 seconds
|
|
124
|
+
setTimeout(() => {
|
|
125
|
+
loader.removeTitleLoader();
|
|
126
|
+
}, 4000);
|
|
127
|
+
}
|
|
128
|
+
|
|
129
|
+
export async function multiPrompt() {
|
|
130
|
+
const multiPrompt = acode.require("multiPrompt");
|
|
131
|
+
const _myPrompt = await multiPrompt(
|
|
132
|
+
"Enter your name & age",
|
|
133
|
+
[
|
|
134
|
+
{ type: "text", id: "name" },
|
|
135
|
+
{ type: "number", id: "age" },
|
|
136
|
+
],
|
|
137
|
+
"https://example.com/help/",
|
|
138
|
+
);
|
|
139
|
+
}
|
|
140
|
+
|
|
141
|
+
export async function prompt() {
|
|
142
|
+
const prompt = acode.require("prompt");
|
|
143
|
+
|
|
144
|
+
const emailRegex = /^[a-zA-Z0-9._-]+@[a-zA-Z0-9.-]+\.[a-zA-Z]{2,4}$/;
|
|
145
|
+
const options = {
|
|
146
|
+
match: emailRegex,
|
|
147
|
+
required: true,
|
|
148
|
+
placeholder: "Enter your email",
|
|
149
|
+
test: (value: string) => emailRegex.test(value),
|
|
150
|
+
};
|
|
151
|
+
|
|
152
|
+
const _userEmail = await prompt(
|
|
153
|
+
"What is your email?",
|
|
154
|
+
"",
|
|
155
|
+
"email",
|
|
156
|
+
options,
|
|
157
|
+
);
|
|
158
|
+
}
|
|
159
|
+
|
|
160
|
+
export async function select() {
|
|
161
|
+
const select = acode.require("select");
|
|
162
|
+
const _result = await select("Pick a color", ["Red", "Green", "Blue"]);
|
|
163
|
+
|
|
164
|
+
const items = [
|
|
165
|
+
["edit", "Edit File", "edit", false],
|
|
166
|
+
["delete", "Delete File", "delete", false],
|
|
167
|
+
["share", "Share File", "share", true],
|
|
168
|
+
];
|
|
169
|
+
|
|
170
|
+
const options = {
|
|
171
|
+
hideOnSelect: true,
|
|
172
|
+
default: "edit",
|
|
173
|
+
onCancel: () => console.log("Selection cancelled"),
|
|
174
|
+
};
|
|
175
|
+
|
|
176
|
+
const _action = await select("File Actions", items, options);
|
|
177
|
+
|
|
178
|
+
const features = [
|
|
179
|
+
{ value: "sync", text: "Cloud Sync", checkbox: true },
|
|
180
|
+
{ value: "backup", text: "Auto Backup", checkbox: false },
|
|
181
|
+
{
|
|
182
|
+
value: "formatting",
|
|
183
|
+
text: "Code Formatting",
|
|
184
|
+
checkbox: true,
|
|
185
|
+
},
|
|
186
|
+
];
|
|
187
|
+
|
|
188
|
+
const _selected = await select("Enable Features", features, {
|
|
189
|
+
hideOnSelect: false,
|
|
190
|
+
});
|
|
191
|
+
|
|
192
|
+
const users = [
|
|
193
|
+
{
|
|
194
|
+
value: "john",
|
|
195
|
+
text: "John Smith",
|
|
196
|
+
icon: "letters",
|
|
197
|
+
letters: "JS",
|
|
198
|
+
},
|
|
199
|
+
{
|
|
200
|
+
value: "jane",
|
|
201
|
+
text: "Jane Doe",
|
|
202
|
+
icon: "letters",
|
|
203
|
+
letters: "JD",
|
|
204
|
+
},
|
|
205
|
+
];
|
|
206
|
+
|
|
207
|
+
const _selectedUser = await select("Choose User", users);
|
|
208
|
+
}
|
|
209
|
+
|
|
210
|
+
export function dialogBox() {
|
|
211
|
+
const DialogBox = acode.require("dialogBox");
|
|
212
|
+
const myDialogBox = DialogBox(
|
|
213
|
+
"Title", // Title of the dialog box
|
|
214
|
+
"<h1>Dialog content</h1>", // Content of the dialog box (HTML supported)
|
|
215
|
+
"hideButtonText", // Text for the hide button
|
|
216
|
+
"cancelButtonText", // Text for the cancel button
|
|
217
|
+
);
|
|
218
|
+
|
|
219
|
+
myDialogBox.hide();
|
|
220
|
+
|
|
221
|
+
myDialogBox.wait(1000);
|
|
222
|
+
|
|
223
|
+
myDialogBox.onhide(() => {
|
|
224
|
+
console.log("Dialog box is hidden");
|
|
225
|
+
});
|
|
226
|
+
|
|
227
|
+
myDialogBox.onclick((e) => {
|
|
228
|
+
const target = e.target;
|
|
229
|
+
console.log(target, "is clicked");
|
|
230
|
+
});
|
|
231
|
+
|
|
232
|
+
myDialogBox.then(() => {
|
|
233
|
+
console.log("OK button is clicked");
|
|
234
|
+
});
|
|
235
|
+
|
|
236
|
+
myDialogBox.ok(() => {
|
|
237
|
+
console.log("OK button is clicked");
|
|
238
|
+
});
|
|
239
|
+
|
|
240
|
+
myDialogBox.cancel(() => {
|
|
241
|
+
console.log("Cancel button is clicked");
|
|
242
|
+
});
|
|
243
|
+
|
|
244
|
+
const c = new HTMLButtonElement();
|
|
245
|
+
c.onclick;
|
|
246
|
+
}
|
|
247
|
+
}
|
|
248
|
+
|
|
249
|
+
export function toast() {
|
|
250
|
+
const toast = acode.require("toast");
|
|
251
|
+
|
|
252
|
+
toast("Hello, World!", 3000);
|
|
253
|
+
|
|
254
|
+
// or
|
|
255
|
+
window.toast("Hello, World!", 3000);
|
|
256
|
+
}
|
|
257
|
+
|
|
258
|
+
export function tutorial() {
|
|
259
|
+
const tutorial = acode.require("tutorial");
|
|
260
|
+
// Basic text message
|
|
261
|
+
tutorial("welcome-msg", "Welcome to my plugin!");
|
|
262
|
+
|
|
263
|
+
// HTML message
|
|
264
|
+
const msgEl = document.createElement("div");
|
|
265
|
+
msgEl.innerHTML = `
|
|
266
|
+
<h3>Getting Started</h3>
|
|
267
|
+
<p>Click the button below to begin:</p>
|
|
268
|
+
<button onclick="startTutorial()">Start</button>
|
|
269
|
+
`;
|
|
270
|
+
tutorial("start-guide", msgEl);
|
|
271
|
+
|
|
272
|
+
// Function with hide callback
|
|
273
|
+
tutorial("feature-intro", (hide) => {
|
|
274
|
+
const container = document.createElement("div");
|
|
275
|
+
const closeBtn = document.createElement("button");
|
|
276
|
+
closeBtn.textContent = "Got it";
|
|
277
|
+
closeBtn.onclick = hide;
|
|
278
|
+
container.appendChild(closeBtn);
|
|
279
|
+
return container;
|
|
280
|
+
});
|
|
281
|
+
}
|
|
282
|
+
|
|
283
|
+
export function selectionMenu() {
|
|
284
|
+
const selectionMenu = acode.require("selectionMenu");
|
|
285
|
+
|
|
286
|
+
const onclick = () => {
|
|
287
|
+
// Action to perform when the menu item is clicked
|
|
288
|
+
console.log("Menu item clicked!");
|
|
289
|
+
};
|
|
290
|
+
|
|
291
|
+
// Adding a new item to the selection menu
|
|
292
|
+
selectionMenu.add(onclick, "Hi", "all");
|
|
293
|
+
}
|
|
294
|
+
}
|
|
295
|
+
|
|
296
|
+
namespace interfaceApi {
|
|
297
|
+
export function contextMenu() {
|
|
298
|
+
const contextMenu = acode.require("contextMenu");
|
|
299
|
+
|
|
300
|
+
const menu = contextMenu("Menu Content", {
|
|
301
|
+
top: 50,
|
|
302
|
+
left: 100,
|
|
303
|
+
items: [
|
|
304
|
+
["Item 1", "action1"],
|
|
305
|
+
["Item 2", "action2"],
|
|
306
|
+
],
|
|
307
|
+
onselect(action) {
|
|
308
|
+
console.log("Selected:", action);
|
|
309
|
+
},
|
|
310
|
+
});
|
|
311
|
+
|
|
312
|
+
// Show the menu
|
|
313
|
+
menu.show();
|
|
314
|
+
|
|
315
|
+
// Hide the menu
|
|
316
|
+
menu.hide();
|
|
317
|
+
}
|
|
318
|
+
|
|
319
|
+
export function sideBarApps() {
|
|
320
|
+
const sideBarApps = acode.require("sidebarApps");
|
|
321
|
+
|
|
322
|
+
sideBarApps.add(
|
|
323
|
+
"icon_class", // Icon for the app
|
|
324
|
+
"my_app_id", // Unique ID
|
|
325
|
+
"My App", // Display title
|
|
326
|
+
(container) => {
|
|
327
|
+
// Initialize app UI
|
|
328
|
+
container.innerHTML = "<div>App Content</div>";
|
|
329
|
+
},
|
|
330
|
+
false, // Add to end of sidebar
|
|
331
|
+
(_container) => {
|
|
332
|
+
// Handle when app is selected
|
|
333
|
+
console.log("App selected");
|
|
334
|
+
},
|
|
335
|
+
);
|
|
336
|
+
|
|
337
|
+
const _container = sideBarApps.get("my_app_id");
|
|
338
|
+
|
|
339
|
+
sideBarApps.remove("my_app_id");
|
|
340
|
+
}
|
|
341
|
+
|
|
342
|
+
export function sideButton() {
|
|
343
|
+
const SideButton = acode.require("sideButton");
|
|
344
|
+
|
|
345
|
+
const sideButton = SideButton({
|
|
346
|
+
text: "My Side Button",
|
|
347
|
+
icon: "my-icon",
|
|
348
|
+
onclick() {
|
|
349
|
+
console.log("clicked");
|
|
350
|
+
},
|
|
351
|
+
backgroundColor: "#fff",
|
|
352
|
+
textColor: "#000",
|
|
353
|
+
});
|
|
354
|
+
|
|
355
|
+
// Show the side button
|
|
356
|
+
sideButton.show();
|
|
357
|
+
|
|
358
|
+
// Hide the side button
|
|
359
|
+
sideButton.hide();
|
|
360
|
+
}
|
|
361
|
+
}
|
|
362
|
+
|
|
363
|
+
namespace utils {
|
|
364
|
+
export function aceModes() {
|
|
365
|
+
const aceModes = acode.require("aceModes");
|
|
366
|
+
|
|
367
|
+
const _onClick = () => {
|
|
368
|
+
// Action to perform when the menu item is clicked
|
|
369
|
+
console.log("Custom Mode Menu Item Clicked!");
|
|
370
|
+
};
|
|
371
|
+
|
|
372
|
+
// Adding the custom mode
|
|
373
|
+
aceModes.addMode("myMode", ["mymode"], "My Custom Mode");
|
|
374
|
+
|
|
375
|
+
// Assuming you have the necessary mode definitions loaded for 'myMode'
|
|
376
|
+
// Example of using the custom mode in the editor
|
|
377
|
+
const editor = editorManager.editor;
|
|
378
|
+
editor.session.setMode("ace/mode/myMode");
|
|
379
|
+
|
|
380
|
+
// Removing the custom mode
|
|
381
|
+
aceModes.removeMode("myMode");
|
|
382
|
+
}
|
|
383
|
+
|
|
384
|
+
export function encodings() {
|
|
385
|
+
const encodings = acode.require("encodings");
|
|
386
|
+
|
|
387
|
+
async function example() {
|
|
388
|
+
const text = "Hello World!";
|
|
389
|
+
const charset = "utf-8";
|
|
390
|
+
|
|
391
|
+
try {
|
|
392
|
+
// Encoding text
|
|
393
|
+
const encoded = await encodings.encode(text, charset);
|
|
394
|
+
console.log("Encoded:", encoded);
|
|
395
|
+
|
|
396
|
+
// Decoding text
|
|
397
|
+
const decoded = await encodings.decode(encoded, charset);
|
|
398
|
+
console.log("Decoded:", decoded);
|
|
399
|
+
} catch (error) {
|
|
400
|
+
console.error("Encoding/Decoding error:", error);
|
|
401
|
+
}
|
|
402
|
+
}
|
|
403
|
+
|
|
404
|
+
example();
|
|
405
|
+
}
|
|
406
|
+
|
|
407
|
+
export async function fileSystem() {
|
|
408
|
+
// Importing via requiring 'fs'
|
|
409
|
+
const fs = acode.require("fs");
|
|
410
|
+
|
|
411
|
+
const filesystem = fs("url");
|
|
412
|
+
|
|
413
|
+
const _link1 = fs("http://example.com");
|
|
414
|
+
const _link2 = fs("https://example.com");
|
|
415
|
+
|
|
416
|
+
if (filesystem.lsDir) {
|
|
417
|
+
const _allFiles = await filesystem.lsDir();
|
|
418
|
+
}
|
|
419
|
+
|
|
420
|
+
const _fileContent = await filesystem.readFile();
|
|
421
|
+
|
|
422
|
+
await filesystem.writeFile("content to write");
|
|
423
|
+
|
|
424
|
+
const _createdFile = await filesystem.createFile(
|
|
425
|
+
"filename.js",
|
|
426
|
+
"file content",
|
|
427
|
+
);
|
|
428
|
+
|
|
429
|
+
const _createdDirectory = await filesystem.createDirectory("newDirectory");
|
|
430
|
+
|
|
431
|
+
await filesystem.delete();
|
|
432
|
+
|
|
433
|
+
const _copiedItem = await filesystem.copyTo("destination");
|
|
434
|
+
|
|
435
|
+
const _movedItem = await filesystem.moveTo("destination");
|
|
436
|
+
|
|
437
|
+
const _renamedItem = await filesystem.renameTo("newName");
|
|
438
|
+
|
|
439
|
+
const _doesExist = await filesystem.exists();
|
|
440
|
+
}
|
|
441
|
+
|
|
442
|
+
export function projects() {
|
|
443
|
+
const projects = acode.require("projects");
|
|
444
|
+
|
|
445
|
+
async function addNewProject() {
|
|
446
|
+
const projectFiles = {
|
|
447
|
+
"index.html": "<!DOCTYPE html>...",
|
|
448
|
+
"css/index.css": "/* CSS file */",
|
|
449
|
+
"js/index.js": "// JavaScript file",
|
|
450
|
+
};
|
|
451
|
+
|
|
452
|
+
const iconSrc =
|
|
453
|
+
"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACAAAAAgCAMAAABEpIrGAAAABGdBTUEAALGPC/xhBQAAAAFzUkdCAK7OHOkAAABIUExURUdwTORPJuRPJuNOJeRPJuNQJ+RPJuNOJuNPJuROJeRPJuNOJuRPJuRQJONPJuNPJeVQI+NPJeROJuNPJuZPJ+NOJuRPJuNPJkmKsooAAAAXdFJOUwA6h5uxKGh/60/VE8BBll8izqXdDHT3jnqTYwAAAQRJREFUGBl9wY22azAURtGFhMS/Vvu9/5veHeGMMrhzAvoPkqBHgWTRo4XE6ZEjqfSoImn0qCGpZQYuBpmaJMpMXESZSFLIfLioZQoSLzMCzYmMJ+lkXsBbVx0bmR546YosSGqBUheBbJEUuFgkLWROpuMsSHJklYznTKYiK2WaHwWsMiXZRxceZpkP2SQzGO1mKGQmsigTwWvXQZSJZIVMDZ12K9QyBdks0wBDuUjvVw00MjNZJ1OxmWc2o0zHLkhynl9OUuDQyoS+jGx8PfZfSS2HXrvg6unVatdzcLrlOIy6NXIog26Ekj9+qlqdtNXkOSua/qvNt28Kbq1xfL/HuPLjH4f8MW+juHZUAAAAAElFTkSuQmCC";
|
|
454
|
+
|
|
455
|
+
projects.set("newProject", async () => projectFiles, iconSrc);
|
|
456
|
+
|
|
457
|
+
// List all projects
|
|
458
|
+
const projectList = projects.list();
|
|
459
|
+
console.log("Project List:", projectList);
|
|
460
|
+
|
|
461
|
+
// Get details of the newly added project
|
|
462
|
+
const newProjectDetails = projects.get("newProject");
|
|
463
|
+
console.log("New Project Details:", newProjectDetails);
|
|
464
|
+
}
|
|
465
|
+
|
|
466
|
+
addNewProject();
|
|
467
|
+
}
|
|
468
|
+
|
|
469
|
+
export function url() {
|
|
470
|
+
const Url = acode.require("Url");
|
|
471
|
+
|
|
472
|
+
const _basename = Url.basename("ftp://localhost/foo/bar/index.html");
|
|
473
|
+
// Output: 'index.html'
|
|
474
|
+
|
|
475
|
+
const _areSame = Url.areSame("https://example.com", "https://example.com");
|
|
476
|
+
// Output: true
|
|
477
|
+
|
|
478
|
+
const _extname = Url.extname("ftp://localhost/foo/bar/index.html");
|
|
479
|
+
// Output: '.html'
|
|
480
|
+
|
|
481
|
+
const _safeUrl = Url.safe(
|
|
482
|
+
"https://www.example.com/path/to/file.html?query=string#hash",
|
|
483
|
+
);
|
|
484
|
+
// Output: 'https://www.example.com/path/to/file.html%3Fquery%3Dstring%23hash'
|
|
485
|
+
|
|
486
|
+
const _pathname = Url.pathname("ftp://myhost.com/foo/bar/index.html");
|
|
487
|
+
// Output: '/foo/bar'
|
|
488
|
+
|
|
489
|
+
const _dirname = Url.dirname("ftp://localhost/foo/bar");
|
|
490
|
+
// Output: 'ftp://localhost/foo/'
|
|
491
|
+
|
|
492
|
+
const _parsedUrl = Url.parse("https://example.com/path?query=string");
|
|
493
|
+
// Output: { url: 'https://example.com/path', query: '?query=string' }
|
|
494
|
+
|
|
495
|
+
const urlObj = {
|
|
496
|
+
protocol: "https:",
|
|
497
|
+
hostname: "example.com",
|
|
498
|
+
path: "path/to/page",
|
|
499
|
+
query: { key: "value" },
|
|
500
|
+
} as const;
|
|
501
|
+
const _formattedUrl = Url.formate(urlObj);
|
|
502
|
+
// Output: 'https://example.com/path/to/page?key=value'
|
|
503
|
+
|
|
504
|
+
const _hiddenPasswordUrl = Url.hidePassword(
|
|
505
|
+
"ftp://user:password@localhost/foo/bar",
|
|
506
|
+
);
|
|
507
|
+
// Output: 'ftp://user@localhost/foo/bar'
|
|
508
|
+
|
|
509
|
+
const _decodedUrl = Url.decodeUrl(
|
|
510
|
+
"https://user:pass@host.com:8080/path?query=string",
|
|
511
|
+
);
|
|
512
|
+
// Output: { username: 'user', password: 'pass', hostname: 'host.com', pathname: '/path', port: 8080, query: { query: 'string' } }
|
|
513
|
+
|
|
514
|
+
const _trimmedUrl = Url.trimSlash("https://example.com/path/");
|
|
515
|
+
// Output: 'https://example.com/path'
|
|
516
|
+
}
|
|
517
|
+
}
|
|
@@ -0,0 +1,188 @@
|
|
|
1
|
+
declare namespace Acode {
|
|
2
|
+
/**
|
|
3
|
+
* This module is used to create a theme object that can be used as a theme for the Acode.
|
|
4
|
+
*/
|
|
5
|
+
export class ThemeBuilder {
|
|
6
|
+
version: "free" | "paid";
|
|
7
|
+
/**
|
|
8
|
+
* The name of the theme.
|
|
9
|
+
*/
|
|
10
|
+
name: string;
|
|
11
|
+
|
|
12
|
+
/**
|
|
13
|
+
* The type of the theme.
|
|
14
|
+
*/
|
|
15
|
+
type: "dark" | "light";
|
|
16
|
+
|
|
17
|
+
/**
|
|
18
|
+
* Automatically darken the primary color.
|
|
19
|
+
* @default true
|
|
20
|
+
*/
|
|
21
|
+
autoDarkened: boolean;
|
|
22
|
+
|
|
23
|
+
/**
|
|
24
|
+
* The preferred editor theme.
|
|
25
|
+
* @default undefined
|
|
26
|
+
*/
|
|
27
|
+
preferredEditorTheme: string;
|
|
28
|
+
|
|
29
|
+
/**
|
|
30
|
+
* preferredFont string
|
|
31
|
+
* @default undefined
|
|
32
|
+
*/
|
|
33
|
+
preferredFont: string;
|
|
34
|
+
|
|
35
|
+
/**
|
|
36
|
+
* This module is used to create a theme object that can be used as a theme for the Acode.
|
|
37
|
+
* @param name
|
|
38
|
+
* @param type
|
|
39
|
+
* @param version
|
|
40
|
+
*/
|
|
41
|
+
constructor(
|
|
42
|
+
name: string,
|
|
43
|
+
type?: "dark" | "light",
|
|
44
|
+
version?: "free" | "paid",
|
|
45
|
+
);
|
|
46
|
+
|
|
47
|
+
readonly id: string;
|
|
48
|
+
|
|
49
|
+
/**
|
|
50
|
+
* The border radius of the popup.
|
|
51
|
+
*/
|
|
52
|
+
popupBorderRadius: string;
|
|
53
|
+
|
|
54
|
+
/**
|
|
55
|
+
* The color of the active element.
|
|
56
|
+
*/
|
|
57
|
+
activeColor: string;
|
|
58
|
+
|
|
59
|
+
/**
|
|
60
|
+
* The color of the icon of the active element.
|
|
61
|
+
*/
|
|
62
|
+
activeIconColor: string;
|
|
63
|
+
|
|
64
|
+
/**
|
|
65
|
+
* The color of the border.
|
|
66
|
+
*/
|
|
67
|
+
borderColor: string;
|
|
68
|
+
|
|
69
|
+
/**
|
|
70
|
+
* The color of the box shadow.
|
|
71
|
+
*/
|
|
72
|
+
boxShadowColor: string;
|
|
73
|
+
|
|
74
|
+
/**
|
|
75
|
+
* The color of the active button.
|
|
76
|
+
*/
|
|
77
|
+
buttonActiveColor: string;
|
|
78
|
+
|
|
79
|
+
/**
|
|
80
|
+
* The background color of the button.
|
|
81
|
+
*/
|
|
82
|
+
buttonBackgroundColor: string;
|
|
83
|
+
|
|
84
|
+
/**
|
|
85
|
+
* The text color of the button.
|
|
86
|
+
*/
|
|
87
|
+
buttonTextColor: string;
|
|
88
|
+
|
|
89
|
+
/**
|
|
90
|
+
* The text color of the error message.
|
|
91
|
+
*/
|
|
92
|
+
errorTextColor: string;
|
|
93
|
+
|
|
94
|
+
/**
|
|
95
|
+
* The primary color of the application.
|
|
96
|
+
*/
|
|
97
|
+
primaryColor: string;
|
|
98
|
+
|
|
99
|
+
/**
|
|
100
|
+
* The text color of the primary color.
|
|
101
|
+
*/
|
|
102
|
+
primaryTextColor: string;
|
|
103
|
+
|
|
104
|
+
/**
|
|
105
|
+
* The secondary color of the application.
|
|
106
|
+
*/
|
|
107
|
+
secondaryColor: string;
|
|
108
|
+
|
|
109
|
+
/**
|
|
110
|
+
* The text color of the secondary color.
|
|
111
|
+
*/
|
|
112
|
+
secondaryTextColor: string;
|
|
113
|
+
|
|
114
|
+
/**
|
|
115
|
+
* The text color of the link.
|
|
116
|
+
*/
|
|
117
|
+
linkTextColor: string;
|
|
118
|
+
|
|
119
|
+
/**
|
|
120
|
+
* The color of the scrollbar.
|
|
121
|
+
*/
|
|
122
|
+
scrollbarColor: string;
|
|
123
|
+
|
|
124
|
+
/**
|
|
125
|
+
* The color of the popup border.
|
|
126
|
+
*/
|
|
127
|
+
popupBorderColor: string;
|
|
128
|
+
|
|
129
|
+
/**
|
|
130
|
+
* The color of the popup icon.
|
|
131
|
+
*/
|
|
132
|
+
popupIconColor: string;
|
|
133
|
+
|
|
134
|
+
/**
|
|
135
|
+
* The background color of the popup.
|
|
136
|
+
*/
|
|
137
|
+
popupBackgroundColor: string;
|
|
138
|
+
|
|
139
|
+
/**
|
|
140
|
+
* The text color of the popup.
|
|
141
|
+
*/
|
|
142
|
+
popupTextColor: string;
|
|
143
|
+
|
|
144
|
+
/**
|
|
145
|
+
* The color of the active popup element.
|
|
146
|
+
*/
|
|
147
|
+
popupActiveColor: string;
|
|
148
|
+
|
|
149
|
+
dangerColor: string;
|
|
150
|
+
|
|
151
|
+
/**
|
|
152
|
+
* The width of the file tab.
|
|
153
|
+
* The color of the active popup element.
|
|
154
|
+
*/
|
|
155
|
+
fileTabWidth: string;
|
|
156
|
+
|
|
157
|
+
activeTextColor: string;
|
|
158
|
+
|
|
159
|
+
/**
|
|
160
|
+
* The CSS string of the theme.
|
|
161
|
+
*/
|
|
162
|
+
readonly css: string;
|
|
163
|
+
|
|
164
|
+
/**
|
|
165
|
+
* Gets the theme as an object
|
|
166
|
+
*/
|
|
167
|
+
toJSON(colorType: "rgba" | "hex" | "none"): Record<string, string>;
|
|
168
|
+
|
|
169
|
+
toString(): string;
|
|
170
|
+
|
|
171
|
+
/**
|
|
172
|
+
* This method is used to set a darkened primary color.
|
|
173
|
+
*/
|
|
174
|
+
darkenPrimaryColor(): void;
|
|
175
|
+
|
|
176
|
+
/**
|
|
177
|
+
* Creates a theme from a CSS string
|
|
178
|
+
* @param css The CSS string.
|
|
179
|
+
*/
|
|
180
|
+
static fromCSS(css: string): ThemeBuilder;
|
|
181
|
+
|
|
182
|
+
/**
|
|
183
|
+
* Creates a theme builder object from a JSON object.
|
|
184
|
+
* @param json The JSON object.
|
|
185
|
+
*/
|
|
186
|
+
static fromJSON(json: Record<string, string>): ThemeBuilder;
|
|
187
|
+
}
|
|
188
|
+
}
|