@wailsio/runtime 3.0.0-alpha.65 → 3.0.0-alpha.69
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/{src → dist}/application.js +2 -16
- package/dist/browser.js +20 -0
- package/dist/callable.js +144 -0
- package/dist/calls.js +194 -0
- package/dist/cancellable.js +792 -0
- package/dist/clipboard.js +30 -0
- package/dist/contextmenu.js +80 -0
- package/{src → dist}/create.js +2 -33
- package/dist/dialogs.js +134 -0
- package/dist/drag.js +222 -0
- package/dist/event_types.js +232 -0
- package/dist/events.js +114 -0
- package/dist/flags.js +23 -0
- package/dist/index.js +38 -0
- package/dist/listener.js +44 -0
- package/{src → dist}/nanoid.js +7 -11
- package/dist/runtime.js +63 -0
- package/dist/screens.js +38 -0
- package/dist/system.js +146 -0
- package/{src → dist}/utils.js +29 -20
- package/dist/window.js +570 -0
- package/{src → dist}/wml.js +52 -123
- package/package.json +43 -19
- package/types/application.d.ts +3 -10
- package/types/browser.d.ts +4 -4
- package/types/callable.d.ts +3 -0
- package/types/calls.d.ts +43 -49
- package/types/cancellable.d.ts +434 -0
- package/types/clipboard.d.ts +6 -5
- package/types/contextmenu.d.ts +1 -0
- package/types/create.d.ts +6 -27
- package/types/dialogs.d.ts +99 -143
- package/types/drag.d.ts +1 -0
- package/types/event_types.d.ts +221 -219
- package/types/events.d.ts +46 -250
- package/types/flags.d.ts +3 -3
- package/types/index.d.ts +16 -14
- package/types/listener.d.ts +9 -0
- package/types/nanoid.d.ts +1 -1
- package/types/runtime.d.ts +18 -26
- package/types/screens.d.ts +42 -76
- package/types/system.d.ts +59 -79
- package/types/utils.d.ts +15 -8
- package/types/window.d.ts +123 -224
- package/types/wml.d.ts +2 -6
- package/docs/.nojekyll +0 -1
- package/docs/assets/highlight.css +0 -22
- package/docs/assets/icons.js +0 -15
- package/docs/assets/icons.svg +0 -1
- package/docs/assets/main.js +0 -59
- package/docs/assets/navigation.js +0 -1
- package/docs/assets/search.js +0 -1
- package/docs/assets/style.css +0 -1415
- package/docs/classes/Call.RuntimeError.html +0 -11
- package/docs/classes/Events.WailsEvent.html +0 -4
- package/docs/functions/Application.Hide.html +0 -2
- package/docs/functions/Application.Quit.html +0 -2
- package/docs/functions/Application.Show.html +0 -2
- package/docs/functions/Browser.OpenURL.html +0 -3
- package/docs/functions/Call.ByID.html +0 -8
- package/docs/functions/Call.ByName.html +0 -6
- package/docs/functions/Call.Call.html +0 -11
- package/docs/functions/Clipboard.SetText.html +0 -6
- package/docs/functions/Clipboard.Text.html +0 -3
- package/docs/functions/Create.Any.html +0 -2
- package/docs/functions/Create.Array.html +0 -4
- package/docs/functions/Create.ByteSlice.html +0 -3
- package/docs/functions/Create.Map.html +0 -4
- package/docs/functions/Create.Nullable.html +0 -3
- package/docs/functions/Create.Struct.html +0 -3
- package/docs/functions/Dialogs.Error.html +0 -5
- package/docs/functions/Dialogs.Info.html +0 -5
- package/docs/functions/Dialogs.OpenFile.html +0 -3
- package/docs/functions/Dialogs.Question.html +0 -5
- package/docs/functions/Dialogs.SaveFile.html +0 -3
- package/docs/functions/Dialogs.Warning.html +0 -5
- package/docs/functions/Events.Emit.html +0 -6
- package/docs/functions/Events.Off.html +0 -4
- package/docs/functions/Events.OffAll.html +0 -3
- package/docs/functions/Events.On.html +0 -7
- package/docs/functions/Events.OnMultiple.html +0 -8
- package/docs/functions/Events.Once.html +0 -7
- package/docs/functions/Events.setup.html +0 -1
- package/docs/functions/Flags.GetFlag.html +0 -6
- package/docs/functions/Screens.GetAll.html +0 -3
- package/docs/functions/Screens.GetCurrent.html +0 -3
- package/docs/functions/Screens.GetPrimary.html +0 -3
- package/docs/functions/System.Capabilities.html +0 -4
- package/docs/functions/System.Environment.html +0 -5
- package/docs/functions/System.IsAMD64.html +0 -3
- package/docs/functions/System.IsARM.html +0 -3
- package/docs/functions/System.IsARM64.html +0 -5
- package/docs/functions/System.IsDarkMode.html +0 -5
- package/docs/functions/System.IsDebug.html +0 -1
- package/docs/functions/System.IsLinux.html +0 -3
- package/docs/functions/System.IsMac.html +0 -3
- package/docs/functions/System.IsWindows.html +0 -3
- package/docs/functions/System.invoke.html +0 -1
- package/docs/functions/WML.Enable.html +0 -2
- package/docs/functions/WML.Reload.html +0 -2
- package/docs/functions/init.html +0 -1
- package/docs/index.html +0 -5
- package/docs/interfaces/Call.CallOptions.html +0 -7
- package/docs/interfaces/Dialogs.Button.html +0 -7
- package/docs/interfaces/Dialogs.FileFilter.html +0 -5
- package/docs/interfaces/Dialogs.MessageDialogOptions.html +0 -9
- package/docs/interfaces/Dialogs.OpenFileDialogOptions.html +0 -33
- package/docs/interfaces/Dialogs.SaveFileDialogOptions.html +0 -35
- package/docs/interfaces/Screens.Rect.html +0 -9
- package/docs/interfaces/Screens.Screen.html +0 -25
- package/docs/interfaces/Screens.Size.html +0 -5
- package/docs/interfaces/System.EnvironmentInfo.html +0 -11
- package/docs/interfaces/System.OSInfo.html +0 -9
- package/docs/modules/Application.html +0 -4
- package/docs/modules/Browser.html +0 -2
- package/docs/modules/Call.html +0 -6
- package/docs/modules/Clipboard.html +0 -3
- package/docs/modules/Create.html +0 -7
- package/docs/modules/Dialogs.html +0 -12
- package/docs/modules/Events.html +0 -10
- package/docs/modules/Flags.html +0 -2
- package/docs/modules/Screens.html +0 -7
- package/docs/modules/System.html +0 -14
- package/docs/modules/WML.html +0 -3
- package/docs/modules.html +0 -14
- package/docs/variables/Events.Types.html +0 -1
- package/docs/variables/Window.html +0 -2
- package/src/browser.js +0 -24
- package/src/calls.js +0 -221
- package/src/clipboard.js +0 -35
- package/src/contextmenu.js +0 -97
- package/src/dialogs.js +0 -200
- package/src/drag.js +0 -119
- package/src/event_types.js +0 -219
- package/src/events.js +0 -140
- package/src/flags.js +0 -25
- package/src/index.js +0 -60
- package/src/runtime.js +0 -92
- package/src/screens.js +0 -71
- package/src/system.js +0 -143
- package/src/window.js +0 -638
- package/tsconfig.json +0 -20
package/{src → dist}/wml.js
RENAMED
|
@@ -7,64 +7,52 @@
|
|
|
7
7
|
The electron alternative for Go
|
|
8
8
|
(c) Lea Anthony 2019-present
|
|
9
9
|
*/
|
|
10
|
-
|
|
11
|
-
import {
|
|
12
|
-
import {
|
|
13
|
-
import {
|
|
14
|
-
import
|
|
15
|
-
import Window from "./window";
|
|
16
|
-
|
|
10
|
+
import { OpenURL } from "./browser.js";
|
|
11
|
+
import { Question } from "./dialogs.js";
|
|
12
|
+
import { Emit } from "./events.js";
|
|
13
|
+
import { canAbortListeners, whenReady } from "./utils.js";
|
|
14
|
+
import Window from "./window.js";
|
|
17
15
|
/**
|
|
18
16
|
* Sends an event with the given name and optional data.
|
|
19
17
|
*
|
|
20
|
-
* @param
|
|
21
|
-
* @param
|
|
22
|
-
*
|
|
23
|
-
* @return {void}
|
|
18
|
+
* @param eventName - - The name of the event to send.
|
|
19
|
+
* @param [data=null] - - Optional data to send along with the event.
|
|
24
20
|
*/
|
|
25
|
-
function sendEvent(eventName, data=null) {
|
|
26
|
-
Emit(
|
|
21
|
+
function sendEvent(eventName, data = null) {
|
|
22
|
+
Emit(eventName, data);
|
|
27
23
|
}
|
|
28
|
-
|
|
29
24
|
/**
|
|
30
25
|
* Calls a method on a specified window.
|
|
31
|
-
*
|
|
32
|
-
* @param
|
|
26
|
+
*
|
|
27
|
+
* @param windowName - The name of the window to call the method on.
|
|
28
|
+
* @param methodName - The name of the method to call.
|
|
33
29
|
*/
|
|
34
30
|
function callWindowMethod(windowName, methodName) {
|
|
35
31
|
const targetWindow = Window.Get(windowName);
|
|
36
32
|
const method = targetWindow[methodName];
|
|
37
|
-
|
|
38
33
|
if (typeof method !== "function") {
|
|
39
34
|
console.error(`Window method '${methodName}' not found`);
|
|
40
35
|
return;
|
|
41
36
|
}
|
|
42
|
-
|
|
43
37
|
try {
|
|
44
38
|
method.call(targetWindow);
|
|
45
|
-
}
|
|
39
|
+
}
|
|
40
|
+
catch (e) {
|
|
46
41
|
console.error(`Error calling window method '${methodName}': `, e);
|
|
47
42
|
}
|
|
48
43
|
}
|
|
49
|
-
|
|
50
44
|
/**
|
|
51
|
-
* Responds to a triggering event by running appropriate WML actions for the current target
|
|
52
|
-
*
|
|
53
|
-
* @param {Event} ev
|
|
54
|
-
* @return {void}
|
|
45
|
+
* Responds to a triggering event by running appropriate WML actions for the current target.
|
|
55
46
|
*/
|
|
56
47
|
function onWMLTriggered(ev) {
|
|
57
48
|
const element = ev.currentTarget;
|
|
58
|
-
|
|
59
49
|
function runEffect(choice = "Yes") {
|
|
60
50
|
if (choice !== "Yes")
|
|
61
51
|
return;
|
|
62
|
-
|
|
63
|
-
const
|
|
64
|
-
const
|
|
65
|
-
const
|
|
66
|
-
const url = element.getAttribute('data-wml-openURL');
|
|
67
|
-
|
|
52
|
+
const eventType = element.getAttribute('wml-event') || element.getAttribute('data-wml-event');
|
|
53
|
+
const targetWindow = element.getAttribute('wml-target-window') || element.getAttribute('data-wml-target-window') || "";
|
|
54
|
+
const windowMethod = element.getAttribute('wml-window') || element.getAttribute('data-wml-window');
|
|
55
|
+
const url = element.getAttribute('wml-openurl') || element.getAttribute('data-wml-openurl');
|
|
68
56
|
if (eventType !== null)
|
|
69
57
|
sendEvent(eventType);
|
|
70
58
|
if (windowMethod !== null)
|
|
@@ -72,9 +60,7 @@ function onWMLTriggered(ev) {
|
|
|
72
60
|
if (url !== null)
|
|
73
61
|
void OpenURL(url);
|
|
74
62
|
}
|
|
75
|
-
|
|
76
|
-
const confirm = element.getAttribute('data-wml-confirm');
|
|
77
|
-
|
|
63
|
+
const confirm = element.getAttribute('wml-confirm') || element.getAttribute('data-wml-confirm');
|
|
78
64
|
if (confirm) {
|
|
79
65
|
Question({
|
|
80
66
|
Title: "Confirm",
|
|
@@ -85,65 +71,41 @@ function onWMLTriggered(ev) {
|
|
|
85
71
|
{ Label: "No", IsDefault: true }
|
|
86
72
|
]
|
|
87
73
|
}).then(runEffect);
|
|
88
|
-
}
|
|
74
|
+
}
|
|
75
|
+
else {
|
|
89
76
|
runEffect();
|
|
90
77
|
}
|
|
91
78
|
}
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
const controller = Symbol();
|
|
97
|
-
|
|
79
|
+
// Private field names.
|
|
80
|
+
const controllerSym = Symbol("controller");
|
|
81
|
+
const triggerMapSym = Symbol("triggerMap");
|
|
82
|
+
const elementCountSym = Symbol("elementCount");
|
|
98
83
|
/**
|
|
99
84
|
* AbortControllerRegistry does not actually remember active event listeners: instead
|
|
100
85
|
* it ties them to an AbortSignal and uses an AbortController to remove them all at once.
|
|
101
86
|
*/
|
|
102
87
|
class AbortControllerRegistry {
|
|
103
88
|
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();
|
|
89
|
+
this[controllerSym] = new AbortController();
|
|
112
90
|
}
|
|
113
|
-
|
|
114
91
|
/**
|
|
115
92
|
* Returns an options object for addEventListener that ties the listener
|
|
116
93
|
* to the AbortSignal from the current AbortController.
|
|
117
94
|
*
|
|
118
|
-
* @param
|
|
119
|
-
* @param
|
|
120
|
-
* @returns {AddEventListenerOptions}
|
|
95
|
+
* @param element - An HTML element
|
|
96
|
+
* @param triggers - The list of active WML trigger events for the specified elements
|
|
121
97
|
*/
|
|
122
98
|
set(element, triggers) {
|
|
123
|
-
return { signal: this[
|
|
99
|
+
return { signal: this[controllerSym].signal };
|
|
124
100
|
}
|
|
125
|
-
|
|
126
101
|
/**
|
|
127
|
-
* Removes all registered event listeners.
|
|
128
|
-
*
|
|
129
|
-
* @returns {void}
|
|
102
|
+
* Removes all registered event listeners and resets the registry.
|
|
130
103
|
*/
|
|
131
104
|
reset() {
|
|
132
|
-
this[
|
|
133
|
-
this[
|
|
105
|
+
this[controllerSym].abort();
|
|
106
|
+
this[controllerSym] = new AbortController();
|
|
134
107
|
}
|
|
135
108
|
}
|
|
136
|
-
|
|
137
|
-
/**
|
|
138
|
-
* @type {symbol}
|
|
139
|
-
*/
|
|
140
|
-
const triggerMap = Symbol();
|
|
141
|
-
|
|
142
|
-
/**
|
|
143
|
-
* @type {symbol}
|
|
144
|
-
*/
|
|
145
|
-
const elementCount = Symbol();
|
|
146
|
-
|
|
147
109
|
/**
|
|
148
110
|
* WeakMapRegistry maps active trigger events to each DOM element through a WeakMap.
|
|
149
111
|
* This ensures that the mapping remains private to this module, while still allowing garbage
|
|
@@ -151,100 +113,67 @@ const elementCount = Symbol();
|
|
|
151
113
|
*/
|
|
152
114
|
class WeakMapRegistry {
|
|
153
115
|
constructor() {
|
|
154
|
-
|
|
155
|
-
|
|
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;
|
|
116
|
+
this[triggerMapSym] = new WeakMap();
|
|
117
|
+
this[elementCountSym] = 0;
|
|
171
118
|
}
|
|
172
|
-
|
|
173
119
|
/**
|
|
174
|
-
* Sets
|
|
120
|
+
* Sets active triggers for the specified element.
|
|
175
121
|
*
|
|
176
|
-
* @param
|
|
177
|
-
* @param
|
|
178
|
-
* @returns {AddEventListenerOptions}
|
|
122
|
+
* @param element - An HTML element
|
|
123
|
+
* @param triggers - The list of active WML trigger events for the specified element
|
|
179
124
|
*/
|
|
180
125
|
set(element, triggers) {
|
|
181
|
-
|
|
182
|
-
|
|
126
|
+
if (!this[triggerMapSym].has(element)) {
|
|
127
|
+
this[elementCountSym]++;
|
|
128
|
+
}
|
|
129
|
+
this[triggerMapSym].set(element, triggers);
|
|
183
130
|
return {};
|
|
184
131
|
}
|
|
185
|
-
|
|
186
132
|
/**
|
|
187
133
|
* Removes all registered event listeners.
|
|
188
|
-
*
|
|
189
|
-
* @returns {void}
|
|
190
134
|
*/
|
|
191
135
|
reset() {
|
|
192
|
-
if (this[
|
|
136
|
+
if (this[elementCountSym] <= 0)
|
|
193
137
|
return;
|
|
194
|
-
|
|
195
138
|
for (const element of document.body.querySelectorAll('*')) {
|
|
196
|
-
if (this[
|
|
139
|
+
if (this[elementCountSym] <= 0)
|
|
197
140
|
break;
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
141
|
+
const triggers = this[triggerMapSym].get(element);
|
|
142
|
+
if (triggers != null) {
|
|
143
|
+
this[elementCountSym]--;
|
|
144
|
+
}
|
|
202
145
|
for (const trigger of triggers || [])
|
|
203
146
|
element.removeEventListener(trigger, onWMLTriggered);
|
|
204
147
|
}
|
|
205
|
-
|
|
206
|
-
this[
|
|
207
|
-
this[elementCount] = 0;
|
|
148
|
+
this[triggerMapSym] = new WeakMap();
|
|
149
|
+
this[elementCountSym] = 0;
|
|
208
150
|
}
|
|
209
151
|
}
|
|
210
|
-
|
|
211
152
|
const triggerRegistry = canAbortListeners() ? new AbortControllerRegistry() : new WeakMapRegistry();
|
|
212
|
-
|
|
213
153
|
/**
|
|
214
154
|
* Adds event listeners to the specified element.
|
|
215
|
-
*
|
|
216
|
-
* @param {HTMLElement} element
|
|
217
|
-
* @return {void}
|
|
218
155
|
*/
|
|
219
156
|
function addWMLListeners(element) {
|
|
220
157
|
const triggerRegExp = /\S+/g;
|
|
221
|
-
const triggerAttr = (element.getAttribute('data-wml-trigger') || "click");
|
|
158
|
+
const triggerAttr = (element.getAttribute('wml-trigger') || element.getAttribute('data-wml-trigger') || "click");
|
|
222
159
|
const triggers = [];
|
|
223
|
-
|
|
224
160
|
let match;
|
|
225
161
|
while ((match = triggerRegExp.exec(triggerAttr)) !== null)
|
|
226
162
|
triggers.push(match[0]);
|
|
227
|
-
|
|
228
163
|
const options = triggerRegistry.set(element, triggers);
|
|
229
164
|
for (const trigger of triggers)
|
|
230
165
|
element.addEventListener(trigger, onWMLTriggered, options);
|
|
231
166
|
}
|
|
232
|
-
|
|
233
167
|
/**
|
|
234
168
|
* Schedules an automatic reload of WML to be performed as soon as the document is fully loaded.
|
|
235
|
-
*
|
|
236
|
-
* @return {void}
|
|
237
169
|
*/
|
|
238
170
|
export function Enable() {
|
|
239
171
|
whenReady(Reload);
|
|
240
172
|
}
|
|
241
|
-
|
|
242
173
|
/**
|
|
243
174
|
* Reloads the WML page by adding necessary event listeners and browser listeners.
|
|
244
|
-
*
|
|
245
|
-
* @return {void}
|
|
246
175
|
*/
|
|
247
176
|
export function Reload() {
|
|
248
177
|
triggerRegistry.reset();
|
|
249
|
-
document.body.querySelectorAll('[data-wml-event], [data-wml-window], [data-wml-
|
|
178
|
+
document.body.querySelectorAll('[wml-event], [wml-window], [wml-openurl], [data-wml-event], [data-wml-window], [data-wml-openurl]').forEach(addWMLListeners);
|
|
250
179
|
}
|
package/package.json
CHANGED
|
@@ -1,38 +1,62 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@wailsio/runtime",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "3.0.0-alpha.
|
|
4
|
+
"version": "3.0.0-alpha.69",
|
|
5
5
|
"description": "Wails Runtime",
|
|
6
6
|
"types": "types/index.d.ts",
|
|
7
7
|
"exports": {
|
|
8
|
-
"
|
|
9
|
-
|
|
10
|
-
"require": "./src/index.js",
|
|
11
|
-
"import": "./src/index.js"
|
|
12
|
-
}
|
|
8
|
+
"types": "./types/index.d.ts",
|
|
9
|
+
"import": "./dist/index.js"
|
|
13
10
|
},
|
|
14
11
|
"repository": {
|
|
15
12
|
"type": "git",
|
|
16
|
-
"url": "git+https://github.com/wailsapp/wails.git"
|
|
17
|
-
|
|
18
|
-
"scripts": {
|
|
19
|
-
"prebuild:types": "rimraf ./types",
|
|
20
|
-
"build:types": "npx -p typescript tsc src/index.js --declaration --allowJs --emitDeclarationOnly --outDir types",
|
|
21
|
-
"postbuild:types": "task generate:events",
|
|
22
|
-
"build:docs": "npx typedoc ./src/index.js",
|
|
23
|
-
"build:docs:md": "npx typedoc ./src/index.js"
|
|
13
|
+
"url": "git+https://github.com/wailsapp/wails.git",
|
|
14
|
+
"directory": "v3/internal/runtime/desktop/@wailsio/runtime"
|
|
24
15
|
},
|
|
25
16
|
"author": "The Wails Team",
|
|
26
17
|
"license": "MIT",
|
|
18
|
+
"homepage": "https://v3.wails.io",
|
|
27
19
|
"bugs": {
|
|
28
20
|
"url": "https://github.com/wailsapp/wails/issues"
|
|
29
21
|
},
|
|
30
|
-
"
|
|
31
|
-
|
|
22
|
+
"files": [
|
|
23
|
+
"./dist",
|
|
24
|
+
"./types"
|
|
25
|
+
],
|
|
26
|
+
"sideEffects": [
|
|
27
|
+
"./dist/index.js",
|
|
28
|
+
"./dist/contextmenu.js",
|
|
29
|
+
"./dist/drag.js"
|
|
30
|
+
],
|
|
31
|
+
"scripts": {
|
|
32
|
+
"check": "npx tsc --noEmit",
|
|
33
|
+
"test": "npx vitest run",
|
|
34
|
+
"clean": "npx rimraf ./dist ./docs ./types ./tsconfig.tsbuildinfo",
|
|
35
|
+
"generate:events": "task generate:events",
|
|
36
|
+
"generate": "npm run generate:events",
|
|
37
|
+
"prebuild": "npm run clean && npm run generate",
|
|
38
|
+
"build:code": "npx tsc",
|
|
39
|
+
"build:docs": "npx typedoc --gitRevision v3-alpha --plugin typedoc-plugin-mdn-links --plugin typedoc-plugin-missing-exports ./src/index.ts",
|
|
40
|
+
"build:docs:md": "npx typedoc --gitRevision v3-alpha --plugin typedoc-plugin-markdown --plugin typedoc-plugin-mdn-links --plugin typedoc-plugin-missing-exports ./src/index.ts",
|
|
41
|
+
"build": "npm run build:code & npm run build:docs & wait",
|
|
42
|
+
"prepack": "npm run build"
|
|
43
|
+
},
|
|
32
44
|
"devDependencies": {
|
|
45
|
+
"happy-dom": "^17.1.1",
|
|
46
|
+
"promises-aplus-tests": "2.1.2",
|
|
33
47
|
"rimraf": "^5.0.5",
|
|
34
|
-
"typedoc": "^0.
|
|
35
|
-
"typedoc-plugin-markdown": "^
|
|
36
|
-
"
|
|
48
|
+
"typedoc": "^0.27.7",
|
|
49
|
+
"typedoc-plugin-markdown": "^4.4.2",
|
|
50
|
+
"typedoc-plugin-mdn-links": "^4.0.13",
|
|
51
|
+
"typedoc-plugin-missing-exports": "^3.1.0",
|
|
52
|
+
"typescript": "^5.7.3",
|
|
53
|
+
"vitest": "^3.0.6"
|
|
54
|
+
},
|
|
55
|
+
"overrides": {
|
|
56
|
+
"promises-aplus-tests": {
|
|
57
|
+
"mocha": "^11.1.0",
|
|
58
|
+
"sinon": "^19.0.2",
|
|
59
|
+
"underscore": "^1.13.7"
|
|
60
|
+
}
|
|
37
61
|
}
|
|
38
62
|
}
|
package/types/application.d.ts
CHANGED
|
@@ -1,19 +1,12 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Hides a certain method by calling the HideMethod function.
|
|
3
|
-
*
|
|
4
|
-
* @return {Promise<void>}
|
|
5
|
-
*
|
|
6
3
|
*/
|
|
7
|
-
export function Hide(): Promise<void>;
|
|
4
|
+
export declare function Hide(): Promise<void>;
|
|
8
5
|
/**
|
|
9
6
|
* Calls the ShowMethod and returns the result.
|
|
10
|
-
*
|
|
11
|
-
* @return {Promise<void>}
|
|
12
7
|
*/
|
|
13
|
-
export function Show(): Promise<void>;
|
|
8
|
+
export declare function Show(): Promise<void>;
|
|
14
9
|
/**
|
|
15
10
|
* Calls the QuitMethod to terminate the program.
|
|
16
|
-
*
|
|
17
|
-
* @return {Promise<void>}
|
|
18
11
|
*/
|
|
19
|
-
export function Quit(): Promise<void>;
|
|
12
|
+
export declare function Quit(): Promise<void>;
|
package/types/browser.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* Open a browser window to the given URL
|
|
3
|
-
*
|
|
4
|
-
* @
|
|
2
|
+
* Open a browser window to the given URL.
|
|
3
|
+
*
|
|
4
|
+
* @param url - The URL to open
|
|
5
5
|
*/
|
|
6
|
-
export function OpenURL(url: string): Promise<
|
|
6
|
+
export declare function OpenURL(url: string | URL): Promise<void>;
|
package/types/calls.d.ts
CHANGED
|
@@ -1,3 +1,35 @@
|
|
|
1
|
+
import { CancellablePromise } from "./cancellable.js";
|
|
2
|
+
/**
|
|
3
|
+
* Holds all required information for a binding call.
|
|
4
|
+
* May provide either a method ID or a method name, but not both.
|
|
5
|
+
*/
|
|
6
|
+
export type CallOptions = {
|
|
7
|
+
/** The numeric ID of the bound method to call. */
|
|
8
|
+
methodID: number;
|
|
9
|
+
/** The fully qualified name of the bound method to call. */
|
|
10
|
+
methodName?: never;
|
|
11
|
+
/** Arguments to be passed into the bound method. */
|
|
12
|
+
args: any[];
|
|
13
|
+
} | {
|
|
14
|
+
/** The numeric ID of the bound method to call. */
|
|
15
|
+
methodID?: never;
|
|
16
|
+
/** The fully qualified name of the bound method to call. */
|
|
17
|
+
methodName: string;
|
|
18
|
+
/** Arguments to be passed into the bound method. */
|
|
19
|
+
args: any[];
|
|
20
|
+
};
|
|
21
|
+
/**
|
|
22
|
+
* Exception class that will be thrown in case the bound method returns an error.
|
|
23
|
+
* The value of the {@link RuntimeError#name} property is "RuntimeError".
|
|
24
|
+
*/
|
|
25
|
+
export declare class RuntimeError extends Error {
|
|
26
|
+
/**
|
|
27
|
+
* Constructs a new RuntimeError instance.
|
|
28
|
+
* @param message - The error message.
|
|
29
|
+
* @param options - Options to be forwarded to the Error constructor.
|
|
30
|
+
*/
|
|
31
|
+
constructor(message?: string, options?: ErrorOptions);
|
|
32
|
+
}
|
|
1
33
|
/**
|
|
2
34
|
* Call a bound method according to the given call options.
|
|
3
35
|
*
|
|
@@ -7,63 +39,25 @@
|
|
|
7
39
|
* The exception might have a "cause" field with the value returned
|
|
8
40
|
* by the application- or service-level error marshaling functions.
|
|
9
41
|
*
|
|
10
|
-
* @param
|
|
11
|
-
* @returns
|
|
42
|
+
* @param options - A method call descriptor.
|
|
43
|
+
* @returns The result of the call.
|
|
12
44
|
*/
|
|
13
|
-
export function Call(options: CallOptions):
|
|
45
|
+
export declare function Call(options: CallOptions): CancellablePromise<any>;
|
|
14
46
|
/**
|
|
15
47
|
* Calls a bound method by name with the specified arguments.
|
|
16
48
|
* See {@link Call} for details.
|
|
17
49
|
*
|
|
18
|
-
* @param
|
|
19
|
-
* @param
|
|
20
|
-
* @returns
|
|
50
|
+
* @param methodName - The name of the method in the format 'package.struct.method'.
|
|
51
|
+
* @param args - The arguments to pass to the method.
|
|
52
|
+
* @returns The result of the method call.
|
|
21
53
|
*/
|
|
22
|
-
export function ByName(methodName: string, ...args: any[]):
|
|
54
|
+
export declare function ByName(methodName: string, ...args: any[]): CancellablePromise<any>;
|
|
23
55
|
/**
|
|
24
56
|
* Calls a method by its numeric ID with the specified arguments.
|
|
25
57
|
* See {@link Call} for details.
|
|
26
58
|
*
|
|
27
|
-
* @param
|
|
28
|
-
* @param
|
|
29
|
-
* @return
|
|
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.
|
|
59
|
+
* @param methodID - The ID of the method to call.
|
|
60
|
+
* @param args - The arguments to pass to the method.
|
|
61
|
+
* @return The result of the method call.
|
|
55
62
|
*/
|
|
56
|
-
export
|
|
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
|
-
};
|
|
63
|
+
export declare function ByID(methodID: number, ...args: any[]): CancellablePromise<any>;
|