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,45 @@
1
+ declare namespace Acode {
2
+ /**
3
+ * Functionality:
4
+ * - Generates a list of hints based on user input.
5
+ * - Displays matching hints as the user types.
6
+ * - Allows users to select a hint and populate the input field.
7
+ */
8
+ interface InputHints {
9
+ /**
10
+ *
11
+ * @param $input The HTMLInputElement representing the input field.
12
+ * @param hints An array of hint strings or a callback function that generates hints dynamically.
13
+ * @param onSelect A callback function called when a user selects a hint.
14
+ */
15
+ (
16
+ $input: HTMLInputElement,
17
+ hints: Hint[] | HintCallback,
18
+ onSelect?: (value: string) => void,
19
+ ): {
20
+ /** Returns the currently selected hint element */
21
+ getSelected(): HTMLLIElement | undefined;
22
+
23
+ /** The hint list container */
24
+ container: HTMLUListElement;
25
+ };
26
+ }
27
+
28
+ interface HintObj {
29
+ value: string;
30
+ text: string;
31
+ }
32
+
33
+ type Hint = string | HintObj;
34
+
35
+ interface HintModification {
36
+ add(hint: Hint, index?: number): void;
37
+ remove(hint: Hint): void;
38
+ removeIndex(index: number): void;
39
+ }
40
+
41
+ type HintCallback = (
42
+ setHints: (hints: Array<Hint>) => void,
43
+ modification: HintModification,
44
+ ) => void;
45
+ }
@@ -0,0 +1,22 @@
1
+ declare namespace Acode {
2
+ interface Page {
3
+ /**
4
+ * @param title The title text shown in the page header.
5
+ * @param options Optional configuration object.
6
+ */
7
+ (
8
+ title: string,
9
+ options: {
10
+ /**
11
+ * Element shown before the title (e.g. back button).
12
+ */
13
+ lead: HTMLElement;
14
+
15
+ /**
16
+ * Element shown after the title (e.g. menu icon).
17
+ */
18
+ tail: HTMLElement;
19
+ },
20
+ ): WCPage;
21
+ }
22
+ }
@@ -0,0 +1,21 @@
1
+ declare namespace Acode {
2
+ /**
3
+ * The Palette component provides an interactive search interface with dynamic suggestions for your Acode plugin.
4
+ * It creates a searchable input field with a dropdown list of options that updates as the user types.
5
+ * This is what used in command palettes, find files etc.
6
+ */
7
+ interface Palette {
8
+ /**
9
+ * @param getList Function that returns an array of options or Promises resolving to options. Called whenever the search input changes.
10
+ * @param onSelect Callback function executed when the user selects an option. Receives the selected option value.
11
+ * @param placeholder Optional text to display in the input field when empty.
12
+ * @param onRemove Optional callback triggered when the palette is closed/removed.
13
+ */
14
+ (
15
+ getList: (hints: HintModification) => Array<string | string[]>,
16
+ onSelect: (value: string) => void,
17
+ placeholder?: string,
18
+ onRemove?: () => void,
19
+ ): void;
20
+ }
21
+ }
@@ -0,0 +1,35 @@
1
+ declare namespace Acode {
2
+ /** The side buttons are buttons that appear vertically along the right side of the editor screen.
3
+ * @since versionCode: 316
4
+ */
5
+ interface SideButton {
6
+ /** Shows the side button */
7
+ show(): void;
8
+
9
+ /** Hides the side button */
10
+ hide(): void;
11
+ }
12
+
13
+ /** A function that creates and renders side button that is shown in right side of the editor in vertical direction.
14
+ * @since versionCode: 316
15
+ * */
16
+ type SideButtonConstructor = (options: SideButtonOptions) => SideButton;
17
+
18
+ /** The options of the side button */
19
+ interface SideButtonOptions {
20
+ /** The text label for the button */
21
+ text: string;
22
+
23
+ /** CSS class name for the button icon */
24
+ icon?: string;
25
+
26
+ /** Click handler function */
27
+ onclick: (ev: MouseEvent) => void;
28
+
29
+ /** Background color of the button */
30
+ backgroundColor?: string;
31
+
32
+ /** Text color of the button */
33
+ textColor?: string;
34
+ }
35
+ }
@@ -0,0 +1 @@
1
+ /// <reference path="./terminalManager.d.ts" />
@@ -0,0 +1,113 @@
1
+ declare namespace Acode {
2
+ interface Terminal {
3
+ /**
4
+ * Create a new terminal session
5
+ * @param options Terminal options
6
+ */
7
+ create(options: TerminalOptions): Promise<TerminalInstance>;
8
+
9
+ /**
10
+ * Create a local terminal (no server connection)
11
+ * @param options Terminal options
12
+ */
13
+ createLocal(options: TerminalOptions): Promise<TerminalInstance>;
14
+
15
+ /**
16
+ * Create a server terminal (with backend connection)
17
+ * @param options Terminal options
18
+ */
19
+ createServer(options: TerminalOptions): Promise<TerminalInstance>;
20
+
21
+ /**
22
+ * Get terminal by ID
23
+ * @param id Terminal ID
24
+ * @returns Terminal instance
25
+ */
26
+ get(id: string): TerminalInstance;
27
+
28
+ /**
29
+ * Get all active terminals
30
+ * @returns All terminals
31
+ */
32
+ getAll(): Map<string, TerminalInstance>;
33
+
34
+ /**
35
+ * Write to a specific terminal
36
+ * @param id Terminal ID
37
+ * @param data Data to write
38
+ */
39
+ write(id: string, data: string): void;
40
+
41
+ /**
42
+ * Clear a specific terminal
43
+ * @param id Terminal ID
44
+ */
45
+ clear(id: string): void;
46
+
47
+ /**
48
+ * Close a terminal session
49
+ * @param id Terminal ID
50
+ */
51
+ close(id: string): void;
52
+
53
+ themes: {
54
+ /**
55
+ * Register a plugin theme
56
+ * @param name Theme name
57
+ * @param theme Theme object
58
+ * @param pluginId Plugin ID for cleanup
59
+ * @returns success
60
+ */
61
+ register(name: string, theme: Xterm.ITheme, pluginId: string): boolean;
62
+
63
+ /**
64
+ * Unregister a plugin theme
65
+ * @param name Theme name
66
+ * @param pluginId Plugin ID for verification
67
+ */
68
+ unregister(name: string, pluginId: string): boolean;
69
+
70
+ /**
71
+ * Get a theme by name
72
+ * @param themeName Theme name
73
+ * @returns Theme object
74
+ */
75
+ get(name: string): Xterm.ITheme;
76
+
77
+ /**
78
+ * Get all available themes
79
+ * @returns All themes
80
+ */
81
+ getAll(): Record<string, Xterm.ITheme>;
82
+
83
+ /**
84
+ * Get all theme names
85
+ * @returns Array of theme names
86
+ */
87
+ getNames(): string[];
88
+
89
+ /**
90
+ * Create a theme variant based on existing theme
91
+ * @param baseName Base theme name
92
+ * @param overrides Color overrides
93
+ * @returns New theme object
94
+ */
95
+ createVariant(baseName: string, overrides: Xterm.ITheme): Xterm.ITheme;
96
+ };
97
+ }
98
+
99
+ interface TerminalOptions
100
+ extends Xterm.ITerminalOptions,
101
+ Xterm.ITerminalInitOnlyOptions {
102
+ name?: string;
103
+ serverMode?: boolean;
104
+ port?: number;
105
+ }
106
+
107
+ interface TerminalInstance {
108
+ id: string;
109
+ name: string;
110
+ file: EditorFile;
111
+ container: HTMLDivElement;
112
+ }
113
+ }
@@ -0,0 +1,20 @@
1
+ declare namespace Acode {
2
+ /**
3
+ * This ui component help in showing toast messages for given time interval.
4
+ */
5
+ interface Toast {
6
+ /**
7
+ * @param message The message to be displayed in the toast.
8
+ * @param duration The duration in milliseconds for which the toast should be displayed.
9
+ */
10
+ (message: string, duration: number): void;
11
+ }
12
+ }
13
+
14
+ /** This ui component help in showing toast messages for given time interval. */
15
+ declare const toast: Acode.Toast;
16
+
17
+ interface Window {
18
+ /** This ui component help in showing toast messages for given time interval. */
19
+ toast: Acode.Toast;
20
+ }
@@ -0,0 +1,13 @@
1
+ declare namespace Acode {
2
+ /** The tutorial module provides functionality to display one-time tutorial messages to users. */
3
+ export interface Tutorial {
4
+ /**
5
+ * @param id Unique identifier for the tutorial message.
6
+ * @param message The content to display, can be: - string: Plain text message - HTMLElement: Custom HTML content - Function: A function that returns HTMLElement and receives hide callback;
7
+ */
8
+ (
9
+ id: string,
10
+ message: string | HTMLElement | ((hide: () => void) => void),
11
+ ): void;
12
+ }
13
+ }
@@ -0,0 +1 @@
1
+ /// <reference path="./wcPage.d.ts" />
@@ -0,0 +1,85 @@
1
+ declare namespace Acode {
2
+ interface WCPage extends HTMLElement {
3
+ handler: PageHandler;
4
+
5
+ onhide?: (this: WCPage) => void;
6
+ onconnect?: (this: WCPage) => void;
7
+ ondisconnect?: (this: WCPage) => void;
8
+ onwillconnect?: (this: WCPage) => void;
9
+ onwilldisconnect?: (this: WCPage) => void;
10
+
11
+ /** Adds elements to the main page content area */
12
+ appendBody(...elements: HTMLElement[]): void;
13
+
14
+ /** Adds elements outside the main content area */
15
+ appendOuter(...elements: HTMLElement[]): void;
16
+
17
+ connectedCallback(): void;
18
+
19
+ disconnectedCallback(): void;
20
+
21
+ /** Adds event listener to the page */
22
+ on(event: "hide" | "show", cb: (this: WCPage) => void): void;
23
+
24
+ /** Removes an event listener from the page */
25
+ off(event: "hide" | "show", cb: (this: WCPage) => void): void;
26
+
27
+ /** Updates the page title */
28
+ setTitle(title: string): void;
29
+
30
+ /** Hides the page */
31
+ hide(): string;
32
+
33
+ /** Shows the page */
34
+ show(): string;
35
+
36
+ /**
37
+ * The main content container
38
+ */
39
+ body: HTMLElement;
40
+
41
+ /**
42
+ * The page's inner HTML content
43
+ */
44
+ innerHTML: string;
45
+
46
+ /**
47
+ * The page's text content
48
+ */
49
+ textContent: string;
50
+
51
+ /** The lead element if defined */
52
+ lead: HTMLElement;
53
+
54
+ /**
55
+ * The header container element
56
+ */
57
+ header: HTMLElement;
58
+
59
+ initializeIfNotAlreadyInitialized(): void;
60
+ }
61
+
62
+ interface PageHandler {
63
+ $el: HTMLElement;
64
+
65
+ $replacement: HTMLElement;
66
+
67
+ onRestore?: () => void;
68
+ onReplace?: () => void;
69
+
70
+ /**
71
+ * Replace current element with a replacement element
72
+ */
73
+ replaceEl(): void;
74
+
75
+ /**
76
+ * Restore current element from a replacement element
77
+ */
78
+ restoreEl(): void;
79
+
80
+ onhide(): void;
81
+ onshow(): void;
82
+
83
+ remove(): void;
84
+ }
85
+ }
@@ -0,0 +1,15 @@
1
+ declare namespace Acode {
2
+ /**
3
+ * The alert component in Acode is a dialog box for displaying messages,
4
+ * warnings, or errors to users within a modal window.
5
+ * Similar to the traditional JavaScript alert().
6
+ */
7
+ interface Alert {
8
+ /**
9
+ * @param titleText The text to display in the title of the alert modal.
10
+ * @param message The message to display in the body of the alert modal.
11
+ * @param onhide An optional function to call when the alert modal is closed.
12
+ */
13
+ (titleText: string, message: string, onhide?: () => void): void;
14
+ }
15
+ }
@@ -0,0 +1,45 @@
1
+ declare namespace Acode {
2
+ /**
3
+ * The dialogBox API in Acode provides a way to create custom dialog boxes within your plugins.
4
+ * Basically it creates a dialog and gives you the freedom to display whatever you wish.
5
+ */
6
+ interface DialogBoxConstructor {
7
+ /**
8
+ * Dialog Box Instance
9
+ * @param titleText Title text
10
+ * @param html HTML string
11
+ * @param hideButtonText Text for hide button
12
+ * @param cancelButtonText Text for cancel button
13
+ * @returns Dialog Box instance
14
+ */
15
+ (
16
+ titleText: string,
17
+ html: string,
18
+ hideButtonText: string,
19
+ cancelButtonText: string,
20
+ ): DialogBox;
21
+ }
22
+
23
+ interface DialogBox {
24
+ /** The hide method is used to hide the dialog box. */
25
+ hide(): void;
26
+
27
+ /** The wait method disables the OK button for the specified time (in milliseconds). */
28
+ wait(time: number): DialogBox;
29
+
30
+ /** The onhide method sets a callback function to be called when the dialog box is hidden. */
31
+ onhide(onhide: () => void): DialogBox;
32
+
33
+ /** The onclick method sets a callback function to be called when the content is clicked. */
34
+ onclick(onclick: (this: HTMLElement, ev: MouseEvent) => void): DialogBox;
35
+
36
+ /** The then method sets a callback function to be called when the OK button is clicked. */
37
+ then(callback: (arg0: HTMLCollection) => void): DialogBox;
38
+
39
+ /** The ok method sets a callback function to be called when the OK button is clicked. */
40
+ ok(onOk: () => void): DialogBox;
41
+
42
+ /** The cancel method sets a callback function to be called when the Cancel button is clicked. */
43
+ cancel(onCancel: () => void): DialogBox;
44
+ }
45
+ }
@@ -0,0 +1,15 @@
1
+ declare namespace Acode {
2
+ /**
3
+ * The colorPicker dialog box in Acode offers a way for users to choose colors within your plugins.
4
+ * This feature-rich color picker opens a dialog box showcasing a spectrum of color options, providing users with an intuitive and visually pleasing experience.
5
+ */
6
+ interface ColorPicker {
7
+ /**
8
+ * @param defaultColor The default color that the color picker will display initially.
9
+ * It should be a string representing a color in hexadecimal format or rgba or hsl.
10
+ * @param onhide The callback function to be called when the color picker dialog box is closed.
11
+ * @returns The colorPicker component returns a promise that resolves to a string representing the selected color.
12
+ */
13
+ (defaultColor: string, onhide?: () => void): Promise<string>;
14
+ }
15
+ }
@@ -0,0 +1,16 @@
1
+ declare namespace Acode {
2
+ /**
3
+ * The confirm ui component in Acode is a dialog box for displaying confirmation message modals to users.
4
+ * Whether you're seeking user approval for a critical action or confirming a decision, this component is best suited for this process.
5
+ */
6
+ interface Confirm {
7
+ /**
8
+ * @param titleText A string representing the title of the confirmation message modal. This title will be displayed at the top of the message modal.
9
+ * @param message A string representing the body of the confirmation message modal.
10
+ * @returns The confirm component returns a promise that resolves to a boolean value.
11
+ * The boolean value represents whether the user confirmed or denied the message.
12
+ * A value of true represents confirmation, while false represents denial.
13
+ */
14
+ (titleText: string, message: string): Promise<boolean>;
15
+ }
16
+ }
@@ -0,0 +1,8 @@
1
+ /// <reference path="./alert.d.ts" />
2
+ /// <reference path="./box.d.ts" />
3
+ /// <reference path="./color.d.ts" />
4
+ /// <reference path="./confirm.d.ts" />
5
+ /// <reference path="./loader.d.ts" />
6
+ /// <reference path="./multiPrompt.d.ts" />
7
+ /// <reference path="./prompt.d.ts" />
8
+ /// <reference path="./select.d.ts" />
@@ -0,0 +1,44 @@
1
+ declare namespace Acode {
2
+ /**
3
+ * The loader ui component in Acode is utility that help you to display loading dialogs with customizable titles and messages.
4
+ * These loading dialogs offer an informative and engaging experience for users while waiting for various processes to complete.
5
+ * The component also provides options for setting timeouts and callback functions for handling loading process cancellations.
6
+ */
7
+ interface Loader {
8
+ /** Shows the title loader.
9
+ * @param immortal If true, the loader will not be removed automatically.
10
+ */
11
+ showTitleLoader(immortal?: boolean): void;
12
+
13
+ /**
14
+ * Hides the title loader.
15
+ * @param immortal If not true, the loader will not remove when immortal was true when it was created.
16
+ */
17
+ removeTitleLoader(immortal?: boolean): void;
18
+
19
+ /** Creates a new loading dialog with the specified options.
20
+ * @param titleText The title text to display on the loading dialog.
21
+ * @param message The message to display on the loading dialog.
22
+ */
23
+ create(
24
+ titleText: string,
25
+ message: string,
26
+ cancel: {
27
+ /** The time (in milliseconds) after which the loading process will automatically be cancelled. */
28
+ timeout: number;
29
+
30
+ /** A function that will be called when the loading process is cancelled. */
31
+ callback: () => void;
32
+ },
33
+ ): void;
34
+
35
+ /** Removes the loading dialog from the DOM permanently. */
36
+ destroy(): void;
37
+
38
+ /** Hides the loading dialog temporarily. The dialog can be restored using the show() method. */
39
+ hide(): void;
40
+
41
+ /** Shows a previously hidden loading dialog. */
42
+ show(): void;
43
+ }
44
+ }
@@ -0,0 +1,16 @@
1
+ declare namespace Acode {
2
+ /**
3
+ * The multiPrompt ui component in Acode is a dialog box for prompting users with multiple inputs at once.
4
+ * Whether you need to collect various pieces of information or gather complex input data.
5
+ */
6
+ interface MultiPrompt {
7
+ /**
8
+ * @param message The title for the prompt modal.
9
+ * @param inputs The inputs to prompt the user for. It can be a single input or an array of inputs. Each input is defined by an object with various properties such as id, type, placeholder, etc.
10
+ * @param help The help icon at the top of the multiPrompt will be enabled with the specified help URL. It must be valid url.
11
+ */
12
+ (message: string, inputs: (Input | Input[])[], help: string): Promise<void>;
13
+ }
14
+
15
+ type Input = Partial<HTMLInputElement>;
16
+ }
@@ -0,0 +1,47 @@
1
+ declare namespace Acode {
2
+ /**
3
+ * The prompt ui component in Acode is a dialog box for displaying prompts to users,
4
+ * allowing them to provide input in a convenient and straightforward manner.
5
+ */
6
+ interface Prompt {
7
+ /**
8
+ * @param message A string that represents the message to be displayed to the user.
9
+ * @param defaultValue A string that represents the default value of the input.
10
+ * @param type A string that represents the type of input.
11
+ * @param options An object that contains additional options for the prompt.
12
+ * @returns The prompt component returns a promise that resolves to a string, number, or null if the prompt is canceled.
13
+ */
14
+ (
15
+ message: string,
16
+ defaultValue: string,
17
+ type: "number" | "tel", // TODO: verify
18
+ options: PromptOptions<number>,
19
+ ): Promise<number | null>;
20
+ (
21
+ message: string,
22
+ defaultValue: string,
23
+ type: PromptType,
24
+ options: PromptOptions<string>,
25
+ ): Promise<string | null>;
26
+ }
27
+
28
+ type PromptType =
29
+ | "textarea"
30
+ | "text"
31
+ | "number"
32
+ | "tel"
33
+ | "search"
34
+ | "email"
35
+ | "url";
36
+
37
+ type PromptOptions<T> = Partial<{
38
+ /** A regular expression that the input must match. */
39
+ match: RegExp;
40
+ /** A boolean that indicates whether the input is required or not. */
41
+ required: boolean;
42
+ /** A string that represents the placeholder text of the input. */
43
+ placeholder: string;
44
+ /** A function that takes in a value and returns a boolean indicating whether the value is valid. */
45
+ test: (value: T) => boolean;
46
+ }>;
47
+ }
@@ -0,0 +1,66 @@
1
+ declare namespace Acode {
2
+ interface Select {
3
+ /**
4
+ * @param title The header text shown at the top of the selection dialog.
5
+ * @param items Options to display.
6
+ * @param options Pass true to reject the promise on cancel instead of using an object.
7
+ * @returns The value of the selected item as a string, or rejects if cancelled with `options`: true.
8
+ */
9
+ (
10
+ title: string,
11
+ items: SelectItems,
12
+ options?: boolean | SelectOptions,
13
+ ): Promise<string>;
14
+ }
15
+
16
+ type SelectItems = string[] | (string | boolean | null)[][] | SelectItem[];
17
+
18
+ interface SelectItem {
19
+ /** Unique identifier returned when selected */
20
+ value: string;
21
+
22
+ /** Display text shown to the user */
23
+ text: string;
24
+
25
+ /** CSS class for icon or 'letters' to use the letters parameter */
26
+ icon?: string;
27
+
28
+ /** Whether the option can be selected */
29
+ disabled?: boolean;
30
+
31
+ /** Shows letter initials as an icon (when icon='letters') */
32
+ letters?: string;
33
+
34
+ /** Adds a checkbox to the option when set */
35
+ checkbox?: boolean;
36
+ }
37
+
38
+ type SelectOptions = Partial<{
39
+ /** Close dialog after selection.
40
+ * @default true
41
+ */
42
+ hideOnSelect: boolean;
43
+
44
+ /** Apply text transformation to options.
45
+ * @default true
46
+ */
47
+ textTransform: boolean;
48
+
49
+ /** Pre-selected option value.
50
+ * @default undefined
51
+ */
52
+ default: string;
53
+
54
+ /**
55
+ * Called when dialog is cancelled.
56
+ * @default undefined
57
+ */
58
+ onCancel: () => void;
59
+
60
+ /**
61
+ * Called when dialog is hidden.
62
+ * @default undefined
63
+ */
64
+ onHide: () => void;
65
+ }>;
66
+ }