@wailsio/runtime 3.0.0-alpha.6 → 3.0.0-alpha.60

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 (129) hide show
  1. package/docs/.nojekyll +1 -0
  2. package/docs/assets/highlight.css +22 -0
  3. package/docs/assets/icons.js +15 -0
  4. package/docs/assets/icons.svg +1 -0
  5. package/docs/assets/main.js +59 -0
  6. package/docs/assets/navigation.js +1 -0
  7. package/docs/assets/search.js +1 -0
  8. package/docs/assets/style.css +1415 -0
  9. package/docs/classes/Call.RuntimeError.html +11 -0
  10. package/docs/classes/Events.WailsEvent.html +4 -0
  11. package/docs/functions/Application.Hide.html +2 -0
  12. package/docs/functions/Application.Quit.html +2 -0
  13. package/docs/functions/Application.Show.html +2 -0
  14. package/docs/functions/Browser.OpenURL.html +3 -0
  15. package/docs/functions/Call.ByID.html +8 -0
  16. package/docs/functions/Call.ByName.html +6 -0
  17. package/docs/functions/Call.Call.html +11 -0
  18. package/docs/functions/Clipboard.SetText.html +6 -0
  19. package/docs/functions/Clipboard.Text.html +3 -0
  20. package/docs/functions/Create.Any.html +2 -0
  21. package/docs/functions/Create.Array.html +4 -0
  22. package/docs/functions/Create.ByteSlice.html +3 -0
  23. package/docs/functions/Create.Map.html +4 -0
  24. package/docs/functions/Create.Nullable.html +3 -0
  25. package/docs/functions/Create.Struct.html +3 -0
  26. package/docs/functions/Dialogs.Error.html +5 -0
  27. package/docs/functions/Dialogs.Info.html +5 -0
  28. package/docs/functions/Dialogs.OpenFile.html +3 -0
  29. package/docs/functions/Dialogs.Question.html +5 -0
  30. package/docs/functions/Dialogs.SaveFile.html +3 -0
  31. package/docs/functions/Dialogs.Warning.html +5 -0
  32. package/docs/functions/Events.Emit.html +6 -0
  33. package/docs/functions/Events.Off.html +4 -0
  34. package/docs/functions/Events.OffAll.html +3 -0
  35. package/docs/functions/Events.On.html +7 -0
  36. package/docs/functions/Events.OnMultiple.html +8 -0
  37. package/docs/functions/Events.Once.html +7 -0
  38. package/docs/functions/Events.setup.html +1 -0
  39. package/docs/functions/Flags.GetFlag.html +6 -0
  40. package/docs/functions/Screens.GetAll.html +3 -0
  41. package/docs/functions/Screens.GetCurrent.html +3 -0
  42. package/docs/functions/Screens.GetPrimary.html +3 -0
  43. package/docs/functions/System.Capabilities.html +4 -0
  44. package/docs/functions/System.Environment.html +5 -0
  45. package/docs/functions/System.IsAMD64.html +3 -0
  46. package/docs/functions/System.IsARM.html +3 -0
  47. package/docs/functions/System.IsARM64.html +5 -0
  48. package/docs/functions/System.IsDarkMode.html +5 -0
  49. package/docs/functions/System.IsDebug.html +1 -0
  50. package/docs/functions/System.IsLinux.html +3 -0
  51. package/docs/functions/System.IsMac.html +3 -0
  52. package/docs/functions/System.IsWindows.html +3 -0
  53. package/docs/functions/System.invoke.html +1 -0
  54. package/docs/functions/WML.Enable.html +2 -0
  55. package/docs/functions/WML.Reload.html +2 -0
  56. package/docs/functions/init.html +1 -0
  57. package/docs/index.html +5 -0
  58. package/docs/interfaces/Call.CallOptions.html +7 -0
  59. package/docs/interfaces/Dialogs.Button.html +7 -0
  60. package/docs/interfaces/Dialogs.FileFilter.html +5 -0
  61. package/docs/interfaces/Dialogs.MessageDialogOptions.html +9 -0
  62. package/docs/interfaces/Dialogs.OpenFileDialogOptions.html +33 -0
  63. package/docs/interfaces/Dialogs.SaveFileDialogOptions.html +35 -0
  64. package/docs/interfaces/Screens.Rect.html +9 -0
  65. package/docs/interfaces/Screens.Screen.html +25 -0
  66. package/docs/interfaces/Screens.Size.html +5 -0
  67. package/docs/interfaces/System.EnvironmentInfo.html +11 -0
  68. package/docs/interfaces/System.OSInfo.html +9 -0
  69. package/docs/modules/Application.html +4 -0
  70. package/docs/modules/Browser.html +2 -0
  71. package/docs/modules/Call.html +6 -0
  72. package/docs/modules/Clipboard.html +3 -0
  73. package/docs/modules/Create.html +7 -0
  74. package/docs/modules/Dialogs.html +12 -0
  75. package/docs/modules/Events.html +10 -0
  76. package/docs/modules/Flags.html +2 -0
  77. package/docs/modules/Screens.html +7 -0
  78. package/docs/modules/System.html +14 -0
  79. package/docs/modules/WML.html +3 -0
  80. package/docs/modules.html +14 -0
  81. package/docs/variables/Events.Types.html +1 -0
  82. package/docs/variables/Window.html +2 -0
  83. package/package.json +38 -17
  84. package/{application.js → src/application.js} +46 -46
  85. package/{browser.js → src/browser.js} +24 -24
  86. package/src/calls.js +221 -0
  87. package/{clipboard.js → src/clipboard.js} +35 -35
  88. package/{contextmenu.js → src/contextmenu.js} +97 -98
  89. package/src/create.js +125 -0
  90. package/src/dialogs.js +200 -0
  91. package/{drag.js → src/drag.js} +119 -125
  92. package/src/event_types.js +219 -0
  93. package/{events.js → src/events.js} +140 -134
  94. package/src/flags.js +25 -0
  95. package/src/index.js +60 -0
  96. package/src/nanoid.js +42 -0
  97. package/src/runtime.js +92 -0
  98. package/src/screens.js +71 -0
  99. package/{system.js → src/system.js} +143 -122
  100. package/src/utils.js +86 -0
  101. package/src/window.js +638 -0
  102. package/src/wml.js +250 -0
  103. package/tsconfig.json +20 -0
  104. package/types/application.d.ts +19 -0
  105. package/types/browser.d.ts +6 -0
  106. package/types/calls.d.ts +69 -0
  107. package/types/clipboard.d.ts +12 -0
  108. package/types/create.d.ts +52 -0
  109. package/types/dialogs.d.ts +184 -0
  110. package/types/event_types.d.ts +219 -0
  111. package/types/events.d.ts +271 -0
  112. package/types/flags.d.ts +7 -0
  113. package/types/index.d.ts +14 -0
  114. package/types/nanoid.d.ts +1 -0
  115. package/types/runtime.d.ts +30 -0
  116. package/types/screens.d.ts +94 -0
  117. package/types/system.d.ts +112 -0
  118. package/types/utils.d.ts +14 -0
  119. package/types/window.d.ts +407 -0
  120. package/types/wml.d.ts +12 -0
  121. package/calls.js +0 -123
  122. package/dialogs.js +0 -138
  123. package/flags.js +0 -63
  124. package/index.js +0 -56
  125. package/runtime.js +0 -122
  126. package/screens.js +0 -45
  127. package/types.d.ts +0 -130
  128. package/window.js +0 -122
  129. package/wml.js +0 -149
package/src/wml.js ADDED
@@ -0,0 +1,250 @@
1
+ /*
2
+ _ __ _ __
3
+ | | / /___ _(_) /____
4
+ | | /| / / __ `/ / / ___/
5
+ | |/ |/ / /_/ / / (__ )
6
+ |__/|__/\__,_/_/_/____/
7
+ The electron alternative for Go
8
+ (c) Lea Anthony 2019-present
9
+ */
10
+
11
+ import {OpenURL} from "./browser";
12
+ import {Question} from "./dialogs";
13
+ import {Emit, WailsEvent} from "./events";
14
+ import {canAbortListeners, whenReady} from "./utils";
15
+ import Window from "./window";
16
+
17
+ /**
18
+ * Sends an event with the given name and optional data.
19
+ *
20
+ * @param {string} eventName - The name of the event to send.
21
+ * @param {any} [data=null] - Optional data to send along with the event.
22
+ *
23
+ * @return {void}
24
+ */
25
+ function sendEvent(eventName, data=null) {
26
+ Emit(new WailsEvent(eventName, data));
27
+ }
28
+
29
+ /**
30
+ * Calls a method on a specified window.
31
+ * @param {string} windowName - The name of the window to call the method on.
32
+ * @param {string} methodName - The name of the method to call.
33
+ */
34
+ function callWindowMethod(windowName, methodName) {
35
+ const targetWindow = Window.Get(windowName);
36
+ const method = targetWindow[methodName];
37
+
38
+ if (typeof method !== "function") {
39
+ console.error(`Window method '${methodName}' not found`);
40
+ return;
41
+ }
42
+
43
+ try {
44
+ method.call(targetWindow);
45
+ } catch (e) {
46
+ console.error(`Error calling window method '${methodName}': `, e);
47
+ }
48
+ }
49
+
50
+ /**
51
+ * Responds to a triggering event by running appropriate WML actions for the current target
52
+ *
53
+ * @param {Event} ev
54
+ * @return {void}
55
+ */
56
+ function onWMLTriggered(ev) {
57
+ const element = ev.currentTarget;
58
+
59
+ function runEffect(choice = "Yes") {
60
+ if (choice !== "Yes")
61
+ return;
62
+
63
+ const eventType = element.getAttribute('data-wml-event');
64
+ const targetWindow = element.getAttribute('data-wml-target-window') || "";
65
+ const windowMethod = element.getAttribute('data-wml-window');
66
+ const url = element.getAttribute('data-wml-openURL');
67
+
68
+ if (eventType !== null)
69
+ sendEvent(eventType);
70
+ if (windowMethod !== null)
71
+ callWindowMethod(targetWindow, windowMethod);
72
+ if (url !== null)
73
+ void OpenURL(url);
74
+ }
75
+
76
+ const confirm = element.getAttribute('data-wml-confirm');
77
+
78
+ if (confirm) {
79
+ Question({
80
+ Title: "Confirm",
81
+ Message: confirm,
82
+ Detached: false,
83
+ Buttons: [
84
+ { Label: "Yes" },
85
+ { Label: "No", IsDefault: true }
86
+ ]
87
+ }).then(runEffect);
88
+ } else {
89
+ runEffect();
90
+ }
91
+ }
92
+
93
+ /**
94
+ * @type {symbol}
95
+ */
96
+ const controller = Symbol();
97
+
98
+ /**
99
+ * AbortControllerRegistry does not actually remember active event listeners: instead
100
+ * it ties them to an AbortSignal and uses an AbortController to remove them all at once.
101
+ */
102
+ class AbortControllerRegistry {
103
+ constructor() {
104
+ /**
105
+ * Stores the AbortController that can be used to remove all currently active listeners.
106
+ *
107
+ * @private
108
+ * @name {@link controller}
109
+ * @member {AbortController}
110
+ */
111
+ this[controller] = new AbortController();
112
+ }
113
+
114
+ /**
115
+ * Returns an options object for addEventListener that ties the listener
116
+ * to the AbortSignal from the current AbortController.
117
+ *
118
+ * @param {HTMLElement} element An HTML element
119
+ * @param {string[]} triggers The list of active WML trigger events for the specified elements
120
+ * @returns {AddEventListenerOptions}
121
+ */
122
+ set(element, triggers) {
123
+ return { signal: this[controller].signal };
124
+ }
125
+
126
+ /**
127
+ * Removes all registered event listeners.
128
+ *
129
+ * @returns {void}
130
+ */
131
+ reset() {
132
+ this[controller].abort();
133
+ this[controller] = new AbortController();
134
+ }
135
+ }
136
+
137
+ /**
138
+ * @type {symbol}
139
+ */
140
+ const triggerMap = Symbol();
141
+
142
+ /**
143
+ * @type {symbol}
144
+ */
145
+ const elementCount = Symbol();
146
+
147
+ /**
148
+ * WeakMapRegistry maps active trigger events to each DOM element through a WeakMap.
149
+ * This ensures that the mapping remains private to this module, while still allowing garbage
150
+ * collection of the involved elements.
151
+ */
152
+ class WeakMapRegistry {
153
+ constructor() {
154
+ /**
155
+ * Stores the current element-to-trigger mapping.
156
+ *
157
+ * @private
158
+ * @name {@link triggerMap}
159
+ * @member {WeakMap<HTMLElement, string[]>}
160
+ */
161
+ this[triggerMap] = new WeakMap();
162
+
163
+ /**
164
+ * Counts the number of elements with active WML triggers.
165
+ *
166
+ * @private
167
+ * @name {@link elementCount}
168
+ * @member {number}
169
+ */
170
+ this[elementCount] = 0;
171
+ }
172
+
173
+ /**
174
+ * Sets the active triggers for the specified element.
175
+ *
176
+ * @param {HTMLElement} element An HTML element
177
+ * @param {string[]} triggers The list of active WML trigger events for the specified element
178
+ * @returns {AddEventListenerOptions}
179
+ */
180
+ set(element, triggers) {
181
+ this[elementCount] += !this[triggerMap].has(element);
182
+ this[triggerMap].set(element, triggers);
183
+ return {};
184
+ }
185
+
186
+ /**
187
+ * Removes all registered event listeners.
188
+ *
189
+ * @returns {void}
190
+ */
191
+ reset() {
192
+ if (this[elementCount] <= 0)
193
+ return;
194
+
195
+ for (const element of document.body.querySelectorAll('*')) {
196
+ if (this[elementCount] <= 0)
197
+ break;
198
+
199
+ const triggers = this[triggerMap].get(element);
200
+ this[elementCount] -= (typeof triggers !== "undefined");
201
+
202
+ for (const trigger of triggers || [])
203
+ element.removeEventListener(trigger, onWMLTriggered);
204
+ }
205
+
206
+ this[triggerMap] = new WeakMap();
207
+ this[elementCount] = 0;
208
+ }
209
+ }
210
+
211
+ const triggerRegistry = canAbortListeners() ? new AbortControllerRegistry() : new WeakMapRegistry();
212
+
213
+ /**
214
+ * Adds event listeners to the specified element.
215
+ *
216
+ * @param {HTMLElement} element
217
+ * @return {void}
218
+ */
219
+ function addWMLListeners(element) {
220
+ const triggerRegExp = /\S+/g;
221
+ const triggerAttr = (element.getAttribute('data-wml-trigger') || "click");
222
+ const triggers = [];
223
+
224
+ let match;
225
+ while ((match = triggerRegExp.exec(triggerAttr)) !== null)
226
+ triggers.push(match[0]);
227
+
228
+ const options = triggerRegistry.set(element, triggers);
229
+ for (const trigger of triggers)
230
+ element.addEventListener(trigger, onWMLTriggered, options);
231
+ }
232
+
233
+ /**
234
+ * Schedules an automatic reload of WML to be performed as soon as the document is fully loaded.
235
+ *
236
+ * @return {void}
237
+ */
238
+ export function Enable() {
239
+ whenReady(Reload);
240
+ }
241
+
242
+ /**
243
+ * Reloads the WML page by adding necessary event listeners and browser listeners.
244
+ *
245
+ * @return {void}
246
+ */
247
+ export function Reload() {
248
+ triggerRegistry.reset();
249
+ document.body.querySelectorAll('[data-wml-event], [data-wml-window], [data-wml-openURL]').forEach(addWMLListeners);
250
+ }
package/tsconfig.json ADDED
@@ -0,0 +1,20 @@
1
+ {
2
+ "include": ["./src/**/*"],
3
+ "compilerOptions": {
4
+ "lib": [
5
+ "dom",
6
+ "dom.iterable",
7
+ "esnext"
8
+ ],
9
+ "allowJs": true,
10
+ "declaration": true,
11
+ "declarationMap": true,
12
+ "emitDeclarationOnly": true,
13
+ "esModuleInterop": true,
14
+ "module": "esnext",
15
+ "moduleResolution": "bundler",
16
+ "outDir": "dist",
17
+ "strict": true,
18
+ "target": "es6",
19
+ }
20
+ }
@@ -0,0 +1,19 @@
1
+ /**
2
+ * Hides a certain method by calling the HideMethod function.
3
+ *
4
+ * @return {Promise<void>}
5
+ *
6
+ */
7
+ export function Hide(): Promise<void>;
8
+ /**
9
+ * Calls the ShowMethod and returns the result.
10
+ *
11
+ * @return {Promise<void>}
12
+ */
13
+ export function Show(): Promise<void>;
14
+ /**
15
+ * Calls the QuitMethod to terminate the program.
16
+ *
17
+ * @return {Promise<void>}
18
+ */
19
+ export function Quit(): Promise<void>;
@@ -0,0 +1,6 @@
1
+ /**
2
+ * Open a browser window to the given URL
3
+ * @param {string} url - The URL to open
4
+ * @returns {Promise<string>}
5
+ */
6
+ export function OpenURL(url: string): Promise<string>;
@@ -0,0 +1,69 @@
1
+ /**
2
+ * Call a bound method according to the given call options.
3
+ *
4
+ * In case of failure, the returned promise will reject with an exception
5
+ * among ReferenceError (unknown method), TypeError (wrong argument count or type),
6
+ * {@link RuntimeError} (method returned an error), or other (network or internal errors).
7
+ * The exception might have a "cause" field with the value returned
8
+ * by the application- or service-level error marshaling functions.
9
+ *
10
+ * @param {CallOptions} options - A method call descriptor.
11
+ * @returns {Promise<any>} - The result of the call.
12
+ */
13
+ export function Call(options: CallOptions): Promise<any>;
14
+ /**
15
+ * Calls a bound method by name with the specified arguments.
16
+ * See {@link Call} for details.
17
+ *
18
+ * @param {string} methodName - The name of the method in the format 'package.struct.method'.
19
+ * @param {any[]} args - The arguments to pass to the method.
20
+ * @returns {Promise<any>} The result of the method call.
21
+ */
22
+ export function ByName(methodName: string, ...args: any[]): Promise<any>;
23
+ /**
24
+ * Calls a method by its numeric ID with the specified arguments.
25
+ * See {@link Call} for details.
26
+ *
27
+ * @param {number} methodID - The ID of the method to call.
28
+ * @param {any[]} args - The arguments to pass to the method.
29
+ * @return {Promise<any>} - The result of the method call.
30
+ */
31
+ export function ByID(methodID: number, ...args: any[]): Promise<any>;
32
+ /**
33
+ * Collects all required information for a binding call.
34
+ *
35
+ * @typedef {Object} CallOptions
36
+ * @property {number} [methodID] - The numeric ID of the bound method to call.
37
+ * @property {string} [methodName] - The fully qualified name of the bound method to call.
38
+ * @property {any[]} args - Arguments to be passed into the bound method.
39
+ */
40
+ /**
41
+ * Exception class that will be thrown in case the bound method returns an error.
42
+ * The value of the {@link RuntimeError#name} property is "RuntimeError".
43
+ */
44
+ export class RuntimeError extends Error {
45
+ /**
46
+ * Constructs a new RuntimeError instance.
47
+ *
48
+ * @param {string} message - The error message.
49
+ * @param {any[]} args - Optional arguments for the Error constructor.
50
+ */
51
+ constructor(message: string, ...args: any[]);
52
+ }
53
+ /**
54
+ * Collects all required information for a binding call.
55
+ */
56
+ export type CallOptions = {
57
+ /**
58
+ * - The numeric ID of the bound method to call.
59
+ */
60
+ methodID?: number;
61
+ /**
62
+ * - The fully qualified name of the bound method to call.
63
+ */
64
+ methodName?: string;
65
+ /**
66
+ * - Arguments to be passed into the bound method.
67
+ */
68
+ args: any[];
69
+ };
@@ -0,0 +1,12 @@
1
+ /**
2
+ * Sets the text to the Clipboard.
3
+ *
4
+ * @param {string} text - The text to be set to the Clipboard.
5
+ * @return {Promise} - A Promise that resolves when the operation is successful.
6
+ */
7
+ export function SetText(text: string): Promise<any>;
8
+ /**
9
+ * Get the Clipboard text
10
+ * @returns {Promise<string>} A promise that resolves with the text from the Clipboard.
11
+ */
12
+ export function Text(): Promise<string>;
@@ -0,0 +1,52 @@
1
+ /**
2
+ * Any is a dummy creation function for simple or unknown types.
3
+ * @template T
4
+ * @param {any} source
5
+ * @returns {T}
6
+ */
7
+ export function Any<T>(source: any): T;
8
+ /**
9
+ * ByteSlice is a creation function that replaces
10
+ * null strings with empty strings.
11
+ * @param {any} source
12
+ * @returns {string}
13
+ */
14
+ export function ByteSlice(source: any): string;
15
+ /**
16
+ * Array takes a creation function for an arbitrary type
17
+ * and returns an in-place creation function for an array
18
+ * whose elements are of that type.
19
+ * @template T
20
+ * @param {(source: any) => T} element
21
+ * @returns {(source: any) => T[]}
22
+ */
23
+ export function Array<T>(element: (source: any) => T): (source: any) => T[];
24
+ /**
25
+ * Map takes creation functions for two arbitrary types
26
+ * and returns an in-place creation function for an object
27
+ * whose keys and values are of those types.
28
+ * @template K, V
29
+ * @param {(source: any) => K} key
30
+ * @param {(source: any) => V} value
31
+ * @returns {(source: any) => { [_: K]: V }}
32
+ */
33
+ export function Map<K, V>(key: (source: any) => K, value: (source: any) => V): (source: any) => {};
34
+ /**
35
+ * Nullable takes a creation function for an arbitrary type
36
+ * and returns a creation function for a nullable value of that type.
37
+ * @template T
38
+ * @param {(source: any) => T} element
39
+ * @returns {(source: any) => (T | null)}
40
+ */
41
+ export function Nullable<T>(element: (source: any) => T): (source: any) => T;
42
+ /**
43
+ * Struct takes an object mapping field names to creation functions
44
+ * and returns an in-place creation function for a struct.
45
+ * @template {{ [_: string]: ((source: any) => any) }} T
46
+ * @template {{ [Key in keyof T]?: ReturnType<T[Key]> }} U
47
+ * @param {T} createField
48
+ * @returns {(source: any) => U}
49
+ */
50
+ export function Struct<T extends {
51
+ [_: string]: (source: any) => any;
52
+ }, U extends { [Key in keyof T]?: ReturnType<T[Key]>; }>(createField: T): (source: any) => U;
@@ -0,0 +1,184 @@
1
+ export function Info(options: MessageDialogOptions): Promise<string>;
2
+ export function Warning(options: MessageDialogOptions): Promise<string>;
3
+ export function Error(options: MessageDialogOptions): Promise<string>;
4
+ export function Question(options: MessageDialogOptions): Promise<string>;
5
+ export function OpenFile(options: OpenFileDialogOptions): Promise<string[] | string>;
6
+ export function SaveFile(options: SaveFileDialogOptions): Promise<string>;
7
+ export type OpenFileDialogOptions = {
8
+ /**
9
+ * - Indicates if directories can be chosen.
10
+ */
11
+ CanChooseDirectories?: boolean;
12
+ /**
13
+ * - Indicates if files can be chosen.
14
+ */
15
+ CanChooseFiles?: boolean;
16
+ /**
17
+ * - Indicates if directories can be created.
18
+ */
19
+ CanCreateDirectories?: boolean;
20
+ /**
21
+ * - Indicates if hidden files should be shown.
22
+ */
23
+ ShowHiddenFiles?: boolean;
24
+ /**
25
+ * - Indicates if aliases should be resolved.
26
+ */
27
+ ResolvesAliases?: boolean;
28
+ /**
29
+ * - Indicates if multiple selection is allowed.
30
+ */
31
+ AllowsMultipleSelection?: boolean;
32
+ /**
33
+ * - Indicates if the extension should be hidden.
34
+ */
35
+ HideExtension?: boolean;
36
+ /**
37
+ * - Indicates if hidden extensions can be selected.
38
+ */
39
+ CanSelectHiddenExtension?: boolean;
40
+ /**
41
+ * - Indicates if file packages should be treated as directories.
42
+ */
43
+ TreatsFilePackagesAsDirectories?: boolean;
44
+ /**
45
+ * - Indicates if other file types are allowed.
46
+ */
47
+ AllowsOtherFiletypes?: boolean;
48
+ /**
49
+ * - Array of file filters.
50
+ */
51
+ Filters?: FileFilter[];
52
+ /**
53
+ * - Title of the dialog.
54
+ */
55
+ Title?: string;
56
+ /**
57
+ * - Message to show in the dialog.
58
+ */
59
+ Message?: string;
60
+ /**
61
+ * - Text to display on the button.
62
+ */
63
+ ButtonText?: string;
64
+ /**
65
+ * - Directory to open in the dialog.
66
+ */
67
+ Directory?: string;
68
+ /**
69
+ * - Indicates if the dialog should appear detached from the main window.
70
+ */
71
+ Detached?: boolean;
72
+ };
73
+ export type SaveFileDialogOptions = {
74
+ /**
75
+ * - Default filename to use in the dialog.
76
+ */
77
+ Filename?: string;
78
+ /**
79
+ * - Indicates if directories can be chosen.
80
+ */
81
+ CanChooseDirectories?: boolean;
82
+ /**
83
+ * - Indicates if files can be chosen.
84
+ */
85
+ CanChooseFiles?: boolean;
86
+ /**
87
+ * - Indicates if directories can be created.
88
+ */
89
+ CanCreateDirectories?: boolean;
90
+ /**
91
+ * - Indicates if hidden files should be shown.
92
+ */
93
+ ShowHiddenFiles?: boolean;
94
+ /**
95
+ * - Indicates if aliases should be resolved.
96
+ */
97
+ ResolvesAliases?: boolean;
98
+ /**
99
+ * - Indicates if multiple selection is allowed.
100
+ */
101
+ AllowsMultipleSelection?: boolean;
102
+ /**
103
+ * - Indicates if the extension should be hidden.
104
+ */
105
+ HideExtension?: boolean;
106
+ /**
107
+ * - Indicates if hidden extensions can be selected.
108
+ */
109
+ CanSelectHiddenExtension?: boolean;
110
+ /**
111
+ * - Indicates if file packages should be treated as directories.
112
+ */
113
+ TreatsFilePackagesAsDirectories?: boolean;
114
+ /**
115
+ * - Indicates if other file types are allowed.
116
+ */
117
+ AllowsOtherFiletypes?: boolean;
118
+ /**
119
+ * - Array of file filters.
120
+ */
121
+ Filters?: FileFilter[];
122
+ /**
123
+ * - Title of the dialog.
124
+ */
125
+ Title?: string;
126
+ /**
127
+ * - Message to show in the dialog.
128
+ */
129
+ Message?: string;
130
+ /**
131
+ * - Text to display on the button.
132
+ */
133
+ ButtonText?: string;
134
+ /**
135
+ * - Directory to open in the dialog.
136
+ */
137
+ Directory?: string;
138
+ /**
139
+ * - Indicates if the dialog should appear detached from the main window.
140
+ */
141
+ Detached?: boolean;
142
+ };
143
+ export type MessageDialogOptions = {
144
+ /**
145
+ * - The title of the dialog window.
146
+ */
147
+ Title?: string;
148
+ /**
149
+ * - The main message to show in the dialog.
150
+ */
151
+ Message?: string;
152
+ /**
153
+ * - Array of button options to show in the dialog.
154
+ */
155
+ Buttons?: Button[];
156
+ /**
157
+ * - True if the dialog should appear detached from the main window (if applicable).
158
+ */
159
+ Detached?: boolean;
160
+ };
161
+ export type Button = {
162
+ /**
163
+ * - Text that appears within the button.
164
+ */
165
+ Label?: string;
166
+ /**
167
+ * - True if the button should cancel an operation when clicked.
168
+ */
169
+ IsCancel?: boolean;
170
+ /**
171
+ * - True if the button should be the default action when the user presses enter.
172
+ */
173
+ IsDefault?: boolean;
174
+ };
175
+ export type FileFilter = {
176
+ /**
177
+ * - Display name for the filter, it could be "Text Files", "Images" etc.
178
+ */
179
+ DisplayName?: string;
180
+ /**
181
+ * - Pattern to match for the filter, e.g. "*.txt;*.md" for text markdown files.
182
+ */
183
+ Pattern?: string;
184
+ };