@wailsio/runtime 3.0.0-alpha.4 → 3.0.0-alpha.42
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/docs/.nojekyll +1 -0
- package/docs/assets/highlight.css +22 -0
- package/docs/assets/icons.js +15 -0
- package/docs/assets/icons.svg +1 -0
- package/docs/assets/main.js +59 -0
- package/docs/assets/navigation.js +1 -0
- package/docs/assets/search.js +1 -0
- package/docs/assets/style.css +1415 -0
- package/docs/classes/Events.WailsEvent.html +4 -0
- package/docs/functions/Application.Hide.html +2 -0
- package/docs/functions/Application.Quit.html +2 -0
- package/docs/functions/Application.Show.html +2 -0
- package/docs/functions/Browser.OpenURL.html +3 -0
- package/docs/functions/Call.ByID.html +7 -0
- package/docs/functions/Call.ByName.html +6 -0
- package/docs/functions/Call.Call.html +6 -0
- package/docs/functions/Call.Plugin.html +8 -0
- package/docs/functions/Clipboard.SetText.html +6 -0
- package/docs/functions/Clipboard.Text.html +3 -0
- package/docs/functions/Create.Any.html +2 -0
- package/docs/functions/Create.Array.html +4 -0
- package/docs/functions/Create.ByteSlice.html +3 -0
- package/docs/functions/Create.Map.html +4 -0
- package/docs/functions/Create.Nullable.html +3 -0
- package/docs/functions/Create.Struct.html +3 -0
- package/docs/functions/Dialogs.Error.html +5 -0
- package/docs/functions/Dialogs.Info.html +5 -0
- package/docs/functions/Dialogs.OpenFile.html +3 -0
- package/docs/functions/Dialogs.Question.html +5 -0
- package/docs/functions/Dialogs.SaveFile.html +3 -0
- package/docs/functions/Dialogs.Warning.html +5 -0
- package/docs/functions/Events.Emit.html +6 -0
- package/docs/functions/Events.Off.html +4 -0
- package/docs/functions/Events.OffAll.html +3 -0
- package/docs/functions/Events.On.html +7 -0
- package/docs/functions/Events.OnMultiple.html +8 -0
- package/docs/functions/Events.Once.html +7 -0
- package/docs/functions/Events.setup.html +1 -0
- package/docs/functions/Flags.GetFlag.html +6 -0
- package/docs/functions/Screens.GetAll.html +3 -0
- package/docs/functions/Screens.GetCurrent.html +3 -0
- package/docs/functions/Screens.GetPrimary.html +3 -0
- package/docs/functions/System.Capabilities.html +4 -0
- package/docs/functions/System.Environment.html +5 -0
- package/docs/functions/System.IsAMD64.html +3 -0
- package/docs/functions/System.IsARM.html +3 -0
- package/docs/functions/System.IsARM64.html +5 -0
- package/docs/functions/System.IsDarkMode.html +5 -0
- package/docs/functions/System.IsDebug.html +1 -0
- package/docs/functions/System.IsLinux.html +3 -0
- package/docs/functions/System.IsMac.html +3 -0
- package/docs/functions/System.IsWindows.html +3 -0
- package/docs/functions/System.invoke.html +1 -0
- package/docs/functions/WML.Enable.html +2 -0
- package/docs/functions/WML.Reload.html +2 -0
- package/docs/functions/init.html +1 -0
- package/docs/index.html +5 -0
- package/docs/interfaces/Dialogs.Button.html +7 -0
- package/docs/interfaces/Dialogs.FileFilter.html +5 -0
- package/docs/interfaces/Dialogs.MessageDialogOptions.html +9 -0
- package/docs/interfaces/Dialogs.OpenFileDialogOptions.html +33 -0
- package/docs/interfaces/Dialogs.SaveFileDialogOptions.html +35 -0
- package/docs/interfaces/Screens.Rect.html +9 -0
- package/docs/interfaces/Screens.Screen.html +25 -0
- package/docs/interfaces/Screens.Size.html +5 -0
- package/docs/interfaces/System.EnvironmentInfo.html +11 -0
- package/docs/interfaces/System.OSInfo.html +9 -0
- package/docs/modules/Application.html +4 -0
- package/docs/modules/Browser.html +2 -0
- package/docs/modules/Call.html +5 -0
- package/docs/modules/Clipboard.html +3 -0
- package/docs/modules/Create.html +7 -0
- package/docs/modules/Dialogs.html +12 -0
- package/docs/modules/Events.html +10 -0
- package/docs/modules/Flags.html +2 -0
- package/docs/modules/Screens.html +7 -0
- package/docs/modules/System.html +14 -0
- package/docs/modules/WML.html +3 -0
- package/docs/modules.html +14 -0
- package/docs/variables/Events.Types.html +1 -0
- package/docs/variables/Window.html +2 -0
- package/package.json +38 -17
- package/{application.js → src/application.js} +46 -46
- package/{browser.js → src/browser.js} +24 -24
- package/src/calls.js +174 -0
- package/{clipboard.js → src/clipboard.js} +35 -35
- package/{contextmenu.js → src/contextmenu.js} +97 -96
- package/src/create.js +125 -0
- package/src/dialogs.js +200 -0
- package/{drag.js → src/drag.js} +119 -125
- package/src/event_types.js +217 -0
- package/{events.js → src/events.js} +140 -134
- package/src/flags.js +25 -0
- package/src/index.js +60 -0
- package/src/nanoid.js +42 -0
- package/{runtime.js → src/runtime.js} +123 -122
- package/src/screens.js +71 -0
- package/{system.js → src/system.js} +143 -118
- package/src/utils.js +86 -0
- package/src/window.js +638 -0
- package/src/wml.js +250 -0
- package/tsconfig.json +20 -0
- package/types/application.d.ts +19 -0
- package/types/browser.d.ts +6 -0
- package/types/calls.d.ts +33 -0
- package/types/clipboard.d.ts +12 -0
- package/types/create.d.ts +52 -0
- package/types/dialogs.d.ts +184 -0
- package/types/event_types.d.ts +217 -0
- package/types/events.d.ts +269 -0
- package/types/flags.d.ts +7 -0
- package/types/index.d.ts +14 -0
- package/types/nanoid.d.ts +1 -0
- package/types/runtime.d.ts +30 -0
- package/types/screens.d.ts +94 -0
- package/types/system.d.ts +112 -0
- package/types/utils.d.ts +14 -0
- package/types/window.d.ts +407 -0
- package/types/wml.d.ts +12 -0
- package/calls.js +0 -123
- package/dialogs.js +0 -138
- package/flags.js +0 -63
- package/index.js +0 -56
- package/screens.js +0 -45
- package/types.d.ts +0 -130
- package/window.js +0 -122
- package/wml.js +0 -148
|
@@ -0,0 +1,112 @@
|
|
|
1
|
+
export function invoke(msg: any): any;
|
|
2
|
+
/**
|
|
3
|
+
* @function
|
|
4
|
+
* Retrieves the system dark mode status.
|
|
5
|
+
* @returns {Promise<boolean>} - A promise that resolves to a boolean value indicating if the system is in dark mode.
|
|
6
|
+
*/
|
|
7
|
+
export function IsDarkMode(): Promise<boolean>;
|
|
8
|
+
/**
|
|
9
|
+
* Fetches the capabilities of the application from the server.
|
|
10
|
+
*
|
|
11
|
+
* @async
|
|
12
|
+
* @function Capabilities
|
|
13
|
+
* @returns {Promise<Object>} A promise that resolves to an object containing the capabilities.
|
|
14
|
+
*/
|
|
15
|
+
export function Capabilities(): Promise<any>;
|
|
16
|
+
/**
|
|
17
|
+
* @typedef {Object} OSInfo
|
|
18
|
+
* @property {string} Branding - The branding of the OS.
|
|
19
|
+
* @property {string} ID - The ID of the OS.
|
|
20
|
+
* @property {string} Name - The name of the OS.
|
|
21
|
+
* @property {string} Version - The version of the OS.
|
|
22
|
+
*/
|
|
23
|
+
/**
|
|
24
|
+
* @typedef {Object} EnvironmentInfo
|
|
25
|
+
* @property {string} Arch - The architecture of the system.
|
|
26
|
+
* @property {boolean} Debug - True if the application is running in debug mode, otherwise false.
|
|
27
|
+
* @property {string} OS - The operating system in use.
|
|
28
|
+
* @property {OSInfo} OSInfo - Details of the operating system.
|
|
29
|
+
* @property {Object} PlatformInfo - Additional platform information.
|
|
30
|
+
*/
|
|
31
|
+
/**
|
|
32
|
+
* @function
|
|
33
|
+
* Retrieves environment details.
|
|
34
|
+
* @returns {Promise<EnvironmentInfo>} - A promise that resolves to an object containing OS and system architecture.
|
|
35
|
+
*/
|
|
36
|
+
export function Environment(): Promise<EnvironmentInfo>;
|
|
37
|
+
/**
|
|
38
|
+
* Checks if the current operating system is Windows.
|
|
39
|
+
*
|
|
40
|
+
* @return {boolean} True if the operating system is Windows, otherwise false.
|
|
41
|
+
*/
|
|
42
|
+
export function IsWindows(): boolean;
|
|
43
|
+
/**
|
|
44
|
+
* Checks if the current operating system is Linux.
|
|
45
|
+
*
|
|
46
|
+
* @returns {boolean} Returns true if the current operating system is Linux, false otherwise.
|
|
47
|
+
*/
|
|
48
|
+
export function IsLinux(): boolean;
|
|
49
|
+
/**
|
|
50
|
+
* Checks if the current environment is a macOS operating system.
|
|
51
|
+
*
|
|
52
|
+
* @returns {boolean} True if the environment is macOS, false otherwise.
|
|
53
|
+
*/
|
|
54
|
+
export function IsMac(): boolean;
|
|
55
|
+
/**
|
|
56
|
+
* Checks if the current environment architecture is AMD64.
|
|
57
|
+
* @returns {boolean} True if the current environment architecture is AMD64, false otherwise.
|
|
58
|
+
*/
|
|
59
|
+
export function IsAMD64(): boolean;
|
|
60
|
+
/**
|
|
61
|
+
* Checks if the current architecture is ARM.
|
|
62
|
+
*
|
|
63
|
+
* @returns {boolean} True if the current architecture is ARM, false otherwise.
|
|
64
|
+
*/
|
|
65
|
+
export function IsARM(): boolean;
|
|
66
|
+
/**
|
|
67
|
+
* Checks if the current environment is ARM64 architecture.
|
|
68
|
+
*
|
|
69
|
+
* @returns {boolean} - Returns true if the environment is ARM64 architecture, otherwise returns false.
|
|
70
|
+
*/
|
|
71
|
+
export function IsARM64(): boolean;
|
|
72
|
+
export function IsDebug(): boolean;
|
|
73
|
+
export type OSInfo = {
|
|
74
|
+
/**
|
|
75
|
+
* - The branding of the OS.
|
|
76
|
+
*/
|
|
77
|
+
Branding: string;
|
|
78
|
+
/**
|
|
79
|
+
* - The ID of the OS.
|
|
80
|
+
*/
|
|
81
|
+
ID: string;
|
|
82
|
+
/**
|
|
83
|
+
* - The name of the OS.
|
|
84
|
+
*/
|
|
85
|
+
Name: string;
|
|
86
|
+
/**
|
|
87
|
+
* - The version of the OS.
|
|
88
|
+
*/
|
|
89
|
+
Version: string;
|
|
90
|
+
};
|
|
91
|
+
export type EnvironmentInfo = {
|
|
92
|
+
/**
|
|
93
|
+
* - The architecture of the system.
|
|
94
|
+
*/
|
|
95
|
+
Arch: string;
|
|
96
|
+
/**
|
|
97
|
+
* - True if the application is running in debug mode, otherwise false.
|
|
98
|
+
*/
|
|
99
|
+
Debug: boolean;
|
|
100
|
+
/**
|
|
101
|
+
* - The operating system in use.
|
|
102
|
+
*/
|
|
103
|
+
OS: string;
|
|
104
|
+
/**
|
|
105
|
+
* - Details of the operating system.
|
|
106
|
+
*/
|
|
107
|
+
OSInfo: OSInfo;
|
|
108
|
+
/**
|
|
109
|
+
* - Additional platform information.
|
|
110
|
+
*/
|
|
111
|
+
PlatformInfo: any;
|
|
112
|
+
};
|
package/types/utils.d.ts
ADDED
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Logs a message to the console with custom formatting.
|
|
3
|
+
* @param {string} message - The message to be logged.
|
|
4
|
+
* @return {void}
|
|
5
|
+
*/
|
|
6
|
+
export function debugLog(message: string): void;
|
|
7
|
+
/**
|
|
8
|
+
* Checks whether the browser supports removing listeners by triggering an AbortSignal
|
|
9
|
+
* (see https://developer.mozilla.org/en-US/docs/Web/API/EventTarget/addEventListener#signal)
|
|
10
|
+
*
|
|
11
|
+
* @return {boolean}
|
|
12
|
+
*/
|
|
13
|
+
export function canAbortListeners(): boolean;
|
|
14
|
+
export function whenReady(callback: any): void;
|
|
@@ -0,0 +1,407 @@
|
|
|
1
|
+
export class Window {
|
|
2
|
+
/**
|
|
3
|
+
* Initialises a window object with the specified name.
|
|
4
|
+
*
|
|
5
|
+
* @private
|
|
6
|
+
* @param {string} name - The name of the target window.
|
|
7
|
+
*/
|
|
8
|
+
private constructor();
|
|
9
|
+
/**
|
|
10
|
+
* Gets the specified window.
|
|
11
|
+
*
|
|
12
|
+
* @public
|
|
13
|
+
* @param {string} name - The name of the window to get.
|
|
14
|
+
* @return {Window} - The corresponding window object.
|
|
15
|
+
*/
|
|
16
|
+
public Get(name: string): Window;
|
|
17
|
+
/**
|
|
18
|
+
* Returns the absolute position of the window.
|
|
19
|
+
*
|
|
20
|
+
* @public
|
|
21
|
+
* @return {Promise<Position>} - The current absolute position of the window.
|
|
22
|
+
*/
|
|
23
|
+
public Position(): Promise<Position>;
|
|
24
|
+
/**
|
|
25
|
+
* Centers the window on the screen.
|
|
26
|
+
*
|
|
27
|
+
* @public
|
|
28
|
+
* @return {Promise<void>}
|
|
29
|
+
*/
|
|
30
|
+
public Center(): Promise<void>;
|
|
31
|
+
/**
|
|
32
|
+
* Closes the window.
|
|
33
|
+
*
|
|
34
|
+
* @public
|
|
35
|
+
* @return {Promise<void>}
|
|
36
|
+
*/
|
|
37
|
+
public Close(): Promise<void>;
|
|
38
|
+
/**
|
|
39
|
+
* Disables min/max size constraints.
|
|
40
|
+
*
|
|
41
|
+
* @public
|
|
42
|
+
* @return {Promise<void>}
|
|
43
|
+
*/
|
|
44
|
+
public DisableSizeConstraints(): Promise<void>;
|
|
45
|
+
/**
|
|
46
|
+
* Enables min/max size constraints.
|
|
47
|
+
*
|
|
48
|
+
* @public
|
|
49
|
+
* @return {Promise<void>}
|
|
50
|
+
*/
|
|
51
|
+
public EnableSizeConstraints(): Promise<void>;
|
|
52
|
+
/**
|
|
53
|
+
* Focuses the window.
|
|
54
|
+
*
|
|
55
|
+
* @public
|
|
56
|
+
* @return {Promise<void>}
|
|
57
|
+
*/
|
|
58
|
+
public Focus(): Promise<void>;
|
|
59
|
+
/**
|
|
60
|
+
* Forces the window to reload the page assets.
|
|
61
|
+
*
|
|
62
|
+
* @public
|
|
63
|
+
* @return {Promise<void>}
|
|
64
|
+
*/
|
|
65
|
+
public ForceReload(): Promise<void>;
|
|
66
|
+
/**
|
|
67
|
+
* Doc.
|
|
68
|
+
*
|
|
69
|
+
* @public
|
|
70
|
+
* @return {Promise<void>}
|
|
71
|
+
*/
|
|
72
|
+
public Fullscreen(): Promise<void>;
|
|
73
|
+
/**
|
|
74
|
+
* Returns the screen that the window is on.
|
|
75
|
+
*
|
|
76
|
+
* @public
|
|
77
|
+
* @return {Promise<Screen>} - The screen the window is currently on
|
|
78
|
+
*/
|
|
79
|
+
public GetScreen(): Promise<Screen>;
|
|
80
|
+
/**
|
|
81
|
+
* Returns the current zoom level of the window.
|
|
82
|
+
*
|
|
83
|
+
* @public
|
|
84
|
+
* @return {Promise<number>} - The current zoom level
|
|
85
|
+
*/
|
|
86
|
+
public GetZoom(): Promise<number>;
|
|
87
|
+
/**
|
|
88
|
+
* Returns the height of the window.
|
|
89
|
+
*
|
|
90
|
+
* @public
|
|
91
|
+
* @return {Promise<number>} - The current height of the window
|
|
92
|
+
*/
|
|
93
|
+
public Height(): Promise<number>;
|
|
94
|
+
/**
|
|
95
|
+
* Hides the window.
|
|
96
|
+
*
|
|
97
|
+
* @public
|
|
98
|
+
* @return {Promise<void>}
|
|
99
|
+
*/
|
|
100
|
+
public Hide(): Promise<void>;
|
|
101
|
+
/**
|
|
102
|
+
* Returns true if the window is focused.
|
|
103
|
+
*
|
|
104
|
+
* @public
|
|
105
|
+
* @return {Promise<boolean>} - Whether the window is currently focused
|
|
106
|
+
*/
|
|
107
|
+
public IsFocused(): Promise<boolean>;
|
|
108
|
+
/**
|
|
109
|
+
* Returns true if the window is fullscreen.
|
|
110
|
+
*
|
|
111
|
+
* @public
|
|
112
|
+
* @return {Promise<boolean>} - Whether the window is currently fullscreen
|
|
113
|
+
*/
|
|
114
|
+
public IsFullscreen(): Promise<boolean>;
|
|
115
|
+
/**
|
|
116
|
+
* Returns true if the window is maximised.
|
|
117
|
+
*
|
|
118
|
+
* @public
|
|
119
|
+
* @return {Promise<boolean>} - Whether the window is currently maximised
|
|
120
|
+
*/
|
|
121
|
+
public IsMaximised(): Promise<boolean>;
|
|
122
|
+
/**
|
|
123
|
+
* Returns true if the window is minimised.
|
|
124
|
+
*
|
|
125
|
+
* @public
|
|
126
|
+
* @return {Promise<boolean>} - Whether the window is currently minimised
|
|
127
|
+
*/
|
|
128
|
+
public IsMinimised(): Promise<boolean>;
|
|
129
|
+
/**
|
|
130
|
+
* Maximises the window.
|
|
131
|
+
*
|
|
132
|
+
* @public
|
|
133
|
+
* @return {Promise<void>}
|
|
134
|
+
*/
|
|
135
|
+
public Maximise(): Promise<void>;
|
|
136
|
+
/**
|
|
137
|
+
* Minimises the window.
|
|
138
|
+
*
|
|
139
|
+
* @public
|
|
140
|
+
* @return {Promise<void>}
|
|
141
|
+
*/
|
|
142
|
+
public Minimise(): Promise<void>;
|
|
143
|
+
/**
|
|
144
|
+
* Returns the name of the window.
|
|
145
|
+
*
|
|
146
|
+
* @public
|
|
147
|
+
* @return {Promise<string>} - The name of the window
|
|
148
|
+
*/
|
|
149
|
+
public Name(): Promise<string>;
|
|
150
|
+
/**
|
|
151
|
+
* Opens the development tools pane.
|
|
152
|
+
*
|
|
153
|
+
* @public
|
|
154
|
+
* @return {Promise<void>}
|
|
155
|
+
*/
|
|
156
|
+
public OpenDevTools(): Promise<void>;
|
|
157
|
+
/**
|
|
158
|
+
* Returns the relative position of the window to the screen.
|
|
159
|
+
*
|
|
160
|
+
* @public
|
|
161
|
+
* @return {Promise<Position>} - The current relative position of the window
|
|
162
|
+
*/
|
|
163
|
+
public RelativePosition(): Promise<Position>;
|
|
164
|
+
/**
|
|
165
|
+
* Reloads the page assets.
|
|
166
|
+
*
|
|
167
|
+
* @public
|
|
168
|
+
* @return {Promise<void>}
|
|
169
|
+
*/
|
|
170
|
+
public Reload(): Promise<void>;
|
|
171
|
+
/**
|
|
172
|
+
* Returns true if the window is resizable.
|
|
173
|
+
*
|
|
174
|
+
* @public
|
|
175
|
+
* @return {Promise<boolean>} - Whether the window is currently resizable
|
|
176
|
+
*/
|
|
177
|
+
public Resizable(): Promise<boolean>;
|
|
178
|
+
/**
|
|
179
|
+
* Restores the window to its previous state if it was previously minimised, maximised or fullscreen.
|
|
180
|
+
*
|
|
181
|
+
* @public
|
|
182
|
+
* @return {Promise<void>}
|
|
183
|
+
*/
|
|
184
|
+
public Restore(): Promise<void>;
|
|
185
|
+
/**
|
|
186
|
+
* Sets the absolute position of the window.
|
|
187
|
+
*
|
|
188
|
+
* @public
|
|
189
|
+
* @param {number} x - The desired horizontal absolute position of the window
|
|
190
|
+
* @param {number} y - The desired vertical absolute position of the window
|
|
191
|
+
* @return {Promise<void>}
|
|
192
|
+
*/
|
|
193
|
+
public SetPosition(x: number, y: number): Promise<void>;
|
|
194
|
+
/**
|
|
195
|
+
* Sets the window to be always on top.
|
|
196
|
+
*
|
|
197
|
+
* @public
|
|
198
|
+
* @param {boolean} alwaysOnTop - Whether the window should stay on top
|
|
199
|
+
* @return {Promise<void>}
|
|
200
|
+
*/
|
|
201
|
+
public SetAlwaysOnTop(alwaysOnTop: boolean): Promise<void>;
|
|
202
|
+
/**
|
|
203
|
+
* Sets the background colour of the window.
|
|
204
|
+
*
|
|
205
|
+
* @public
|
|
206
|
+
* @param {number} r - The desired red component of the window background
|
|
207
|
+
* @param {number} g - The desired green component of the window background
|
|
208
|
+
* @param {number} b - The desired blue component of the window background
|
|
209
|
+
* @param {number} a - The desired alpha component of the window background
|
|
210
|
+
* @return {Promise<void>}
|
|
211
|
+
*/
|
|
212
|
+
public SetBackgroundColour(r: number, g: number, b: number, a: number): Promise<void>;
|
|
213
|
+
/**
|
|
214
|
+
* Removes the window frame and title bar.
|
|
215
|
+
*
|
|
216
|
+
* @public
|
|
217
|
+
* @param {boolean} frameless - Whether the window should be frameless
|
|
218
|
+
* @return {Promise<void>}
|
|
219
|
+
*/
|
|
220
|
+
public SetFrameless(frameless: boolean): Promise<void>;
|
|
221
|
+
/**
|
|
222
|
+
* Disables the system fullscreen button.
|
|
223
|
+
*
|
|
224
|
+
* @public
|
|
225
|
+
* @param {boolean} enabled - Whether the fullscreen button should be enabled
|
|
226
|
+
* @return {Promise<void>}
|
|
227
|
+
*/
|
|
228
|
+
public SetFullscreenButtonEnabled(enabled: boolean): Promise<void>;
|
|
229
|
+
/**
|
|
230
|
+
* Sets the maximum size of the window.
|
|
231
|
+
*
|
|
232
|
+
* @public
|
|
233
|
+
* @param {number} width - The desired maximum width of the window
|
|
234
|
+
* @param {number} height - The desired maximum height of the window
|
|
235
|
+
* @return {Promise<void>}
|
|
236
|
+
*/
|
|
237
|
+
public SetMaxSize(width: number, height: number): Promise<void>;
|
|
238
|
+
/**
|
|
239
|
+
* Sets the minimum size of the window.
|
|
240
|
+
*
|
|
241
|
+
* @public
|
|
242
|
+
* @param {number} width - The desired minimum width of the window
|
|
243
|
+
* @param {number} height - The desired minimum height of the window
|
|
244
|
+
* @return {Promise<void>}
|
|
245
|
+
*/
|
|
246
|
+
public SetMinSize(width: number, height: number): Promise<void>;
|
|
247
|
+
/**
|
|
248
|
+
* Sets the relative position of the window to the screen.
|
|
249
|
+
*
|
|
250
|
+
* @public
|
|
251
|
+
* @param {number} x - The desired horizontal relative position of the window
|
|
252
|
+
* @param {number} y - The desired vertical relative position of the window
|
|
253
|
+
* @return {Promise<void>}
|
|
254
|
+
*/
|
|
255
|
+
public SetRelativePosition(x: number, y: number): Promise<void>;
|
|
256
|
+
/**
|
|
257
|
+
* Sets whether the window is resizable.
|
|
258
|
+
*
|
|
259
|
+
* @public
|
|
260
|
+
* @param {boolean} resizable - Whether the window should be resizable
|
|
261
|
+
* @return {Promise<void>}
|
|
262
|
+
*/
|
|
263
|
+
public SetResizable(resizable: boolean): Promise<void>;
|
|
264
|
+
/**
|
|
265
|
+
* Sets the size of the window.
|
|
266
|
+
*
|
|
267
|
+
* @public
|
|
268
|
+
* @param {number} width - The desired width of the window
|
|
269
|
+
* @param {number} height - The desired height of the window
|
|
270
|
+
* @return {Promise<void>}
|
|
271
|
+
*/
|
|
272
|
+
public SetSize(width: number, height: number): Promise<void>;
|
|
273
|
+
/**
|
|
274
|
+
* Sets the title of the window.
|
|
275
|
+
*
|
|
276
|
+
* @public
|
|
277
|
+
* @param {string} title - The desired title of the window
|
|
278
|
+
* @return {Promise<void>}
|
|
279
|
+
*/
|
|
280
|
+
public SetTitle(title: string): Promise<void>;
|
|
281
|
+
/**
|
|
282
|
+
* Sets the zoom level of the window.
|
|
283
|
+
*
|
|
284
|
+
* @public
|
|
285
|
+
* @param {number} zoom - The desired zoom level
|
|
286
|
+
* @return {Promise<void>}
|
|
287
|
+
*/
|
|
288
|
+
public SetZoom(zoom: number): Promise<void>;
|
|
289
|
+
/**
|
|
290
|
+
* Shows the window.
|
|
291
|
+
*
|
|
292
|
+
* @public
|
|
293
|
+
* @return {Promise<void>}
|
|
294
|
+
*/
|
|
295
|
+
public Show(): Promise<void>;
|
|
296
|
+
/**
|
|
297
|
+
* Returns the size of the window.
|
|
298
|
+
*
|
|
299
|
+
* @public
|
|
300
|
+
* @return {Promise<Size>} - The current size of the window
|
|
301
|
+
*/
|
|
302
|
+
public Size(): Promise<Size>;
|
|
303
|
+
/**
|
|
304
|
+
* Toggles the window between fullscreen and normal.
|
|
305
|
+
*
|
|
306
|
+
* @public
|
|
307
|
+
* @return {Promise<void>}
|
|
308
|
+
*/
|
|
309
|
+
public ToggleFullscreen(): Promise<void>;
|
|
310
|
+
/**
|
|
311
|
+
* Toggles the window between maximised and normal.
|
|
312
|
+
*
|
|
313
|
+
* @public
|
|
314
|
+
* @return {Promise<void>}
|
|
315
|
+
*/
|
|
316
|
+
public ToggleMaximise(): Promise<void>;
|
|
317
|
+
/**
|
|
318
|
+
* Un-fullscreens the window.
|
|
319
|
+
*
|
|
320
|
+
* @public
|
|
321
|
+
* @return {Promise<void>}
|
|
322
|
+
*/
|
|
323
|
+
public UnFullscreen(): Promise<void>;
|
|
324
|
+
/**
|
|
325
|
+
* Un-maximises the window.
|
|
326
|
+
*
|
|
327
|
+
* @public
|
|
328
|
+
* @return {Promise<void>}
|
|
329
|
+
*/
|
|
330
|
+
public UnMaximise(): Promise<void>;
|
|
331
|
+
/**
|
|
332
|
+
* Un-minimises the window.
|
|
333
|
+
*
|
|
334
|
+
* @public
|
|
335
|
+
* @return {Promise<void>}
|
|
336
|
+
*/
|
|
337
|
+
public UnMinimise(): Promise<void>;
|
|
338
|
+
/**
|
|
339
|
+
* Returns the width of the window.
|
|
340
|
+
*
|
|
341
|
+
* @public
|
|
342
|
+
* @return {Promise<number>} - The current width of the window
|
|
343
|
+
*/
|
|
344
|
+
public Width(): Promise<number>;
|
|
345
|
+
/**
|
|
346
|
+
* Zooms the window.
|
|
347
|
+
*
|
|
348
|
+
* @public
|
|
349
|
+
* @return {Promise<void>}
|
|
350
|
+
*/
|
|
351
|
+
public Zoom(): Promise<void>;
|
|
352
|
+
/**
|
|
353
|
+
* Increases the zoom level of the webview content.
|
|
354
|
+
*
|
|
355
|
+
* @public
|
|
356
|
+
* @return {Promise<void>}
|
|
357
|
+
*/
|
|
358
|
+
public ZoomIn(): Promise<void>;
|
|
359
|
+
/**
|
|
360
|
+
* Decreases the zoom level of the webview content.
|
|
361
|
+
*
|
|
362
|
+
* @public
|
|
363
|
+
* @return {Promise<void>}
|
|
364
|
+
*/
|
|
365
|
+
public ZoomOut(): Promise<void>;
|
|
366
|
+
/**
|
|
367
|
+
* Resets the zoom level of the webview content.
|
|
368
|
+
*
|
|
369
|
+
* @public
|
|
370
|
+
* @return {Promise<void>}
|
|
371
|
+
*/
|
|
372
|
+
public ZoomReset(): Promise<void>;
|
|
373
|
+
}
|
|
374
|
+
export default thisWindow;
|
|
375
|
+
export type Screen = import("./screens").Screen;
|
|
376
|
+
/**
|
|
377
|
+
* A record describing the position of a window.
|
|
378
|
+
*/
|
|
379
|
+
export type Position = {
|
|
380
|
+
/**
|
|
381
|
+
* - The horizontal position of the window
|
|
382
|
+
*/
|
|
383
|
+
x: number;
|
|
384
|
+
/**
|
|
385
|
+
* - The vertical position of the window
|
|
386
|
+
*/
|
|
387
|
+
y: number;
|
|
388
|
+
};
|
|
389
|
+
/**
|
|
390
|
+
* A record describing the size of a window.
|
|
391
|
+
*/
|
|
392
|
+
export type Size = {
|
|
393
|
+
/**
|
|
394
|
+
* - The width of the window
|
|
395
|
+
*/
|
|
396
|
+
width: number;
|
|
397
|
+
/**
|
|
398
|
+
* - The height of the window
|
|
399
|
+
*/
|
|
400
|
+
height: number;
|
|
401
|
+
};
|
|
402
|
+
/**
|
|
403
|
+
* The window within which the script is running.
|
|
404
|
+
*
|
|
405
|
+
* @type {Window}
|
|
406
|
+
*/
|
|
407
|
+
declare const thisWindow: Window;
|
package/types/wml.d.ts
ADDED
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Schedules an automatic reload of WML to be performed as soon as the document is fully loaded.
|
|
3
|
+
*
|
|
4
|
+
* @return {void}
|
|
5
|
+
*/
|
|
6
|
+
export function Enable(): void;
|
|
7
|
+
/**
|
|
8
|
+
* Reloads the WML page by adding necessary event listeners and browser listeners.
|
|
9
|
+
*
|
|
10
|
+
* @return {void}
|
|
11
|
+
*/
|
|
12
|
+
export function Reload(): void;
|
package/calls.js
DELETED
|
@@ -1,123 +0,0 @@
|
|
|
1
|
-
/*
|
|
2
|
-
_ __ _ __
|
|
3
|
-
| | / /___ _(_) /____
|
|
4
|
-
| | /| / / __ `/ / / ___/
|
|
5
|
-
| |/ |/ / /_/ / / (__ )
|
|
6
|
-
|__/|__/\__,_/_/_/____/
|
|
7
|
-
The electron alternative for Go
|
|
8
|
-
(c) Lea Anthony 2019-present
|
|
9
|
-
*/
|
|
10
|
-
|
|
11
|
-
/* jshint esversion: 9 */
|
|
12
|
-
import { newRuntimeCallerWithID, objectNames } from "./runtime";
|
|
13
|
-
import { nanoid } from 'nanoid/non-secure';
|
|
14
|
-
|
|
15
|
-
const CallBinding = 0;
|
|
16
|
-
const call = newRuntimeCallerWithID(objectNames.Call, '');
|
|
17
|
-
let callResponses = new Map();
|
|
18
|
-
|
|
19
|
-
window._wails = window._wails || {};
|
|
20
|
-
window._wails.callCallback = resultHandler;
|
|
21
|
-
window._wails.callErrorCallback = errorHandler;
|
|
22
|
-
|
|
23
|
-
function generateID() {
|
|
24
|
-
let result;
|
|
25
|
-
do {
|
|
26
|
-
result = nanoid();
|
|
27
|
-
} while (callResponses.has(result));
|
|
28
|
-
return result;
|
|
29
|
-
}
|
|
30
|
-
|
|
31
|
-
export function resultHandler(id, data, isJSON) {
|
|
32
|
-
const promiseHandler = getAndDeleteResponse(id);
|
|
33
|
-
if (promiseHandler) {
|
|
34
|
-
promiseHandler.resolve(isJSON ? JSON.parse(data) : data);
|
|
35
|
-
}
|
|
36
|
-
}
|
|
37
|
-
|
|
38
|
-
export function errorHandler(id, message) {
|
|
39
|
-
const promiseHandler = getAndDeleteResponse(id);
|
|
40
|
-
if (promiseHandler) {
|
|
41
|
-
promiseHandler.reject(message);
|
|
42
|
-
}
|
|
43
|
-
}
|
|
44
|
-
|
|
45
|
-
function getAndDeleteResponse(id) {
|
|
46
|
-
const response = callResponses.get(id);
|
|
47
|
-
callResponses.delete(id);
|
|
48
|
-
return response;
|
|
49
|
-
}
|
|
50
|
-
|
|
51
|
-
function callBinding(type, options = {}) {
|
|
52
|
-
return new Promise((resolve, reject) => {
|
|
53
|
-
const id = generateID();
|
|
54
|
-
options["call-id"] = id;
|
|
55
|
-
callResponses.set(id, { resolve, reject });
|
|
56
|
-
call(type, options).catch((error) => {
|
|
57
|
-
reject(error);
|
|
58
|
-
callResponses.delete(id);
|
|
59
|
-
});
|
|
60
|
-
});
|
|
61
|
-
}
|
|
62
|
-
|
|
63
|
-
/**
|
|
64
|
-
* Call method.
|
|
65
|
-
*
|
|
66
|
-
* @param {Object} options - The options for the method.
|
|
67
|
-
* @returns {Object} - The result of the call.
|
|
68
|
-
*/
|
|
69
|
-
export function Call(options) {
|
|
70
|
-
return callBinding(CallBinding, options);
|
|
71
|
-
}
|
|
72
|
-
|
|
73
|
-
/**
|
|
74
|
-
* Executes a method by name.
|
|
75
|
-
*
|
|
76
|
-
* @param {string} name - The name of the method in the format 'package.struct.method'.
|
|
77
|
-
* @param {...*} args - The arguments to pass to the method.
|
|
78
|
-
* @throws {Error} If the name is not a string or is not in the correct format.
|
|
79
|
-
* @returns {*} The result of the method execution.
|
|
80
|
-
*/
|
|
81
|
-
export function ByName(name, ...args) {
|
|
82
|
-
if (typeof name !== "string" || name.split(".").length !== 3) {
|
|
83
|
-
throw new Error("CallByName requires a string in the format 'package.struct.method'");
|
|
84
|
-
}
|
|
85
|
-
let [packageName, structName, methodName] = name.split(".");
|
|
86
|
-
return callBinding(CallBinding, {
|
|
87
|
-
packageName,
|
|
88
|
-
structName,
|
|
89
|
-
methodName,
|
|
90
|
-
args
|
|
91
|
-
});
|
|
92
|
-
}
|
|
93
|
-
|
|
94
|
-
/**
|
|
95
|
-
* Calls a method by its ID with the specified arguments.
|
|
96
|
-
*
|
|
97
|
-
* @param {string} methodID - The ID of the method to call.
|
|
98
|
-
* @param {...*} args - The arguments to pass to the method.
|
|
99
|
-
* @return {*} - The result of the method call.
|
|
100
|
-
*/
|
|
101
|
-
export function ByID(methodID, ...args) {
|
|
102
|
-
return callBinding(CallBinding, {
|
|
103
|
-
methodID,
|
|
104
|
-
args
|
|
105
|
-
});
|
|
106
|
-
}
|
|
107
|
-
|
|
108
|
-
/**
|
|
109
|
-
* Calls a method on a plugin.
|
|
110
|
-
*
|
|
111
|
-
* @param {string} pluginName - The name of the plugin.
|
|
112
|
-
* @param {string} methodName - The name of the method to call.
|
|
113
|
-
* @param {...*} args - The arguments to pass to the method.
|
|
114
|
-
* @returns {*} - The result of the method call.
|
|
115
|
-
*/
|
|
116
|
-
export function Plugin(pluginName, methodName, ...args) {
|
|
117
|
-
return callBinding(CallBinding, {
|
|
118
|
-
packageName: "wails-plugins",
|
|
119
|
-
structName: pluginName,
|
|
120
|
-
methodName,
|
|
121
|
-
args
|
|
122
|
-
});
|
|
123
|
-
}
|