@wailsio/runtime 3.0.0-alpha.65 → 3.0.0-alpha.66
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 +229 -0
- package/dist/events.js +101 -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 +116 -0
- package/{src → dist}/utils.js +29 -20
- package/dist/window.js +438 -0
- package/{src → dist}/wml.js +51 -122
- 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 +218 -219
- package/types/events.d.ts +45 -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 +50 -79
- package/types/utils.d.ts +15 -8
- package/types/window.d.ts +110 -225
- 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/dist/system.js
ADDED
|
@@ -0,0 +1,116 @@
|
|
|
1
|
+
/*
|
|
2
|
+
_ __ _ __
|
|
3
|
+
| | / /___ _(_) /____
|
|
4
|
+
| | /| / / __ `/ / / ___/
|
|
5
|
+
| |/ |/ / /_/ / / (__ )
|
|
6
|
+
|__/|__/\__,_/_/_/____/
|
|
7
|
+
The electron alternative for Go
|
|
8
|
+
(c) Lea Anthony 2019-present
|
|
9
|
+
*/
|
|
10
|
+
import { newRuntimeCaller, objectNames } from "./runtime.js";
|
|
11
|
+
const call = newRuntimeCaller(objectNames.System);
|
|
12
|
+
const SystemIsDarkMode = 0;
|
|
13
|
+
const SystemEnvironment = 1;
|
|
14
|
+
const _invoke = (function () {
|
|
15
|
+
var _a, _b, _c, _d, _e;
|
|
16
|
+
try {
|
|
17
|
+
if ((_b = (_a = window.chrome) === null || _a === void 0 ? void 0 : _a.webview) === null || _b === void 0 ? void 0 : _b.postMessage) {
|
|
18
|
+
return window.chrome.webview.postMessage.bind(window.chrome.webview);
|
|
19
|
+
}
|
|
20
|
+
else if ((_e = (_d = (_c = window.webkit) === null || _c === void 0 ? void 0 : _c.messageHandlers) === null || _d === void 0 ? void 0 : _d['external']) === null || _e === void 0 ? void 0 : _e.postMessage) {
|
|
21
|
+
return window.webkit.messageHandlers['external'].postMessage.bind(window.webkit.messageHandlers['external']);
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
catch (e) { }
|
|
25
|
+
console.warn('\n%c⚠️ Browser Environment Detected %c\n\n%cOnly UI previews are available in the browser. For full functionality, please run the application in desktop mode.\nMore information at: https://v3.wails.io/learn/build/#using-a-browser-for-development\n', 'background: #ffffff; color: #000000; font-weight: bold; padding: 4px 8px; border-radius: 4px; border: 2px solid #000000;', 'background: transparent;', 'color: #ffffff; font-style: italic; font-weight: bold;');
|
|
26
|
+
return null;
|
|
27
|
+
})();
|
|
28
|
+
export function invoke(msg) {
|
|
29
|
+
_invoke === null || _invoke === void 0 ? void 0 : _invoke(msg);
|
|
30
|
+
}
|
|
31
|
+
/**
|
|
32
|
+
* Retrieves the system dark mode status.
|
|
33
|
+
*
|
|
34
|
+
* @returns A promise that resolves to a boolean value indicating if the system is in dark mode.
|
|
35
|
+
*/
|
|
36
|
+
export function IsDarkMode() {
|
|
37
|
+
return call(SystemIsDarkMode);
|
|
38
|
+
}
|
|
39
|
+
/**
|
|
40
|
+
* Fetches the capabilities of the application from the server.
|
|
41
|
+
*
|
|
42
|
+
* @returns A promise that resolves to an object containing the capabilities.
|
|
43
|
+
*/
|
|
44
|
+
export async function Capabilities() {
|
|
45
|
+
let response = await fetch("/wails/capabilities");
|
|
46
|
+
if (response.ok) {
|
|
47
|
+
return response.json();
|
|
48
|
+
}
|
|
49
|
+
else {
|
|
50
|
+
throw new Error("could not fetch capabilities: " + response.statusText);
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
/**
|
|
54
|
+
* Retrieves environment details.
|
|
55
|
+
*
|
|
56
|
+
* @returns A promise that resolves to an object containing OS and system architecture.
|
|
57
|
+
*/
|
|
58
|
+
export function Environment() {
|
|
59
|
+
return call(SystemEnvironment);
|
|
60
|
+
}
|
|
61
|
+
/**
|
|
62
|
+
* Checks if the current operating system is Windows.
|
|
63
|
+
*
|
|
64
|
+
* @return True if the operating system is Windows, otherwise false.
|
|
65
|
+
*/
|
|
66
|
+
export function IsWindows() {
|
|
67
|
+
return window._wails.environment.OS === "windows";
|
|
68
|
+
}
|
|
69
|
+
/**
|
|
70
|
+
* Checks if the current operating system is Linux.
|
|
71
|
+
*
|
|
72
|
+
* @returns Returns true if the current operating system is Linux, false otherwise.
|
|
73
|
+
*/
|
|
74
|
+
export function IsLinux() {
|
|
75
|
+
return window._wails.environment.OS === "linux";
|
|
76
|
+
}
|
|
77
|
+
/**
|
|
78
|
+
* Checks if the current environment is a macOS operating system.
|
|
79
|
+
*
|
|
80
|
+
* @returns True if the environment is macOS, false otherwise.
|
|
81
|
+
*/
|
|
82
|
+
export function IsMac() {
|
|
83
|
+
return window._wails.environment.OS === "darwin";
|
|
84
|
+
}
|
|
85
|
+
/**
|
|
86
|
+
* Checks if the current environment architecture is AMD64.
|
|
87
|
+
*
|
|
88
|
+
* @returns True if the current environment architecture is AMD64, false otherwise.
|
|
89
|
+
*/
|
|
90
|
+
export function IsAMD64() {
|
|
91
|
+
return window._wails.environment.Arch === "amd64";
|
|
92
|
+
}
|
|
93
|
+
/**
|
|
94
|
+
* Checks if the current architecture is ARM.
|
|
95
|
+
*
|
|
96
|
+
* @returns True if the current architecture is ARM, false otherwise.
|
|
97
|
+
*/
|
|
98
|
+
export function IsARM() {
|
|
99
|
+
return window._wails.environment.Arch === "arm";
|
|
100
|
+
}
|
|
101
|
+
/**
|
|
102
|
+
* Checks if the current environment is ARM64 architecture.
|
|
103
|
+
*
|
|
104
|
+
* @returns Returns true if the environment is ARM64 architecture, otherwise returns false.
|
|
105
|
+
*/
|
|
106
|
+
export function IsARM64() {
|
|
107
|
+
return window._wails.environment.Arch === "arm64";
|
|
108
|
+
}
|
|
109
|
+
/**
|
|
110
|
+
* Reports whether the app is being run in debug mode.
|
|
111
|
+
*
|
|
112
|
+
* @returns True if the app is being run in debug mode.
|
|
113
|
+
*/
|
|
114
|
+
export function IsDebug() {
|
|
115
|
+
return Boolean(window._wails.environment.Debug);
|
|
116
|
+
}
|
package/{src → dist}/utils.js
RENAMED
|
@@ -7,42 +7,52 @@
|
|
|
7
7
|
The electron alternative for Go
|
|
8
8
|
(c) Lea Anthony 2019-present
|
|
9
9
|
*/
|
|
10
|
-
|
|
11
10
|
/**
|
|
12
11
|
* Logs a message to the console with custom formatting.
|
|
13
|
-
*
|
|
14
|
-
* @
|
|
12
|
+
*
|
|
13
|
+
* @param message - The message to be logged.
|
|
15
14
|
*/
|
|
16
15
|
export function debugLog(message) {
|
|
17
16
|
// eslint-disable-next-line
|
|
18
|
-
console.log(
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
17
|
+
console.log('%c wails3 %c ' + message + ' ', 'background: #aa0000; color: #fff; border-radius: 3px 0px 0px 3px; padding: 1px; font-size: 0.7rem', 'background: #009900; color: #fff; border-radius: 0px 3px 3px 0px; padding: 1px; font-size: 0.7rem');
|
|
18
|
+
}
|
|
19
|
+
/**
|
|
20
|
+
* Checks whether the webview supports the {@link MouseEvent#buttons} property.
|
|
21
|
+
* Looking at you macOS High Sierra!
|
|
22
|
+
*/
|
|
23
|
+
export function canTrackButtons() {
|
|
24
|
+
return (new MouseEvent('mousedown')).buttons === 0;
|
|
23
25
|
}
|
|
24
|
-
|
|
25
26
|
/**
|
|
26
27
|
* Checks whether the browser supports removing listeners by triggering an AbortSignal
|
|
27
|
-
* (see https://developer.mozilla.org/en-US/docs/Web/API/EventTarget/addEventListener#signal)
|
|
28
|
-
*
|
|
29
|
-
* @return {boolean}
|
|
28
|
+
* (see https://developer.mozilla.org/en-US/docs/Web/API/EventTarget/addEventListener#signal).
|
|
30
29
|
*/
|
|
31
30
|
export function canAbortListeners() {
|
|
32
31
|
if (!EventTarget || !AbortSignal || !AbortController)
|
|
33
32
|
return false;
|
|
34
|
-
|
|
35
33
|
let result = true;
|
|
36
|
-
|
|
37
34
|
const target = new EventTarget();
|
|
38
35
|
const controller = new AbortController();
|
|
39
36
|
target.addEventListener('test', () => { result = false; }, { signal: controller.signal });
|
|
40
37
|
controller.abort();
|
|
41
38
|
target.dispatchEvent(new CustomEvent('test'));
|
|
42
|
-
|
|
43
39
|
return result;
|
|
44
40
|
}
|
|
45
|
-
|
|
41
|
+
/**
|
|
42
|
+
* Resolves the closest HTMLElement ancestor of an event's target.
|
|
43
|
+
*/
|
|
44
|
+
export function eventTarget(event) {
|
|
45
|
+
var _a;
|
|
46
|
+
if (event.target instanceof HTMLElement) {
|
|
47
|
+
return event.target;
|
|
48
|
+
}
|
|
49
|
+
else if (!(event.target instanceof HTMLElement) && event.target instanceof Node) {
|
|
50
|
+
return (_a = event.target.parentElement) !== null && _a !== void 0 ? _a : document.body;
|
|
51
|
+
}
|
|
52
|
+
else {
|
|
53
|
+
return document.body;
|
|
54
|
+
}
|
|
55
|
+
}
|
|
46
56
|
/***
|
|
47
57
|
This technique for proper load detection is taken from HTMX:
|
|
48
58
|
|
|
@@ -73,14 +83,13 @@ export function canAbortListeners() {
|
|
|
73
83
|
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|
74
84
|
|
|
75
85
|
***/
|
|
76
|
-
|
|
77
86
|
let isReady = false;
|
|
78
|
-
document.addEventListener('DOMContentLoaded', () => isReady = true);
|
|
79
|
-
|
|
87
|
+
document.addEventListener('DOMContentLoaded', () => { isReady = true; });
|
|
80
88
|
export function whenReady(callback) {
|
|
81
89
|
if (isReady || document.readyState === 'complete') {
|
|
82
90
|
callback();
|
|
83
|
-
}
|
|
91
|
+
}
|
|
92
|
+
else {
|
|
84
93
|
document.addEventListener('DOMContentLoaded', callback);
|
|
85
94
|
}
|
|
86
95
|
}
|
package/dist/window.js
ADDED
|
@@ -0,0 +1,438 @@
|
|
|
1
|
+
/*
|
|
2
|
+
_ __ _ __
|
|
3
|
+
| | / /___ _(_) /____
|
|
4
|
+
| | /| / / __ `/ / / ___/
|
|
5
|
+
| |/ |/ / /_/ / / (__ )
|
|
6
|
+
|__/|__/\__,_/_/_/____/
|
|
7
|
+
The electron alternative for Go
|
|
8
|
+
(c) Lea Anthony 2019-present
|
|
9
|
+
*/
|
|
10
|
+
import { newRuntimeCaller, objectNames } from "./runtime.js";
|
|
11
|
+
const PositionMethod = 0;
|
|
12
|
+
const CenterMethod = 1;
|
|
13
|
+
const CloseMethod = 2;
|
|
14
|
+
const DisableSizeConstraintsMethod = 3;
|
|
15
|
+
const EnableSizeConstraintsMethod = 4;
|
|
16
|
+
const FocusMethod = 5;
|
|
17
|
+
const ForceReloadMethod = 6;
|
|
18
|
+
const FullscreenMethod = 7;
|
|
19
|
+
const GetScreenMethod = 8;
|
|
20
|
+
const GetZoomMethod = 9;
|
|
21
|
+
const HeightMethod = 10;
|
|
22
|
+
const HideMethod = 11;
|
|
23
|
+
const IsFocusedMethod = 12;
|
|
24
|
+
const IsFullscreenMethod = 13;
|
|
25
|
+
const IsMaximisedMethod = 14;
|
|
26
|
+
const IsMinimisedMethod = 15;
|
|
27
|
+
const MaximiseMethod = 16;
|
|
28
|
+
const MinimiseMethod = 17;
|
|
29
|
+
const NameMethod = 18;
|
|
30
|
+
const OpenDevToolsMethod = 19;
|
|
31
|
+
const RelativePositionMethod = 20;
|
|
32
|
+
const ReloadMethod = 21;
|
|
33
|
+
const ResizableMethod = 22;
|
|
34
|
+
const RestoreMethod = 23;
|
|
35
|
+
const SetPositionMethod = 24;
|
|
36
|
+
const SetAlwaysOnTopMethod = 25;
|
|
37
|
+
const SetBackgroundColourMethod = 26;
|
|
38
|
+
const SetFramelessMethod = 27;
|
|
39
|
+
const SetFullscreenButtonEnabledMethod = 28;
|
|
40
|
+
const SetMaxSizeMethod = 29;
|
|
41
|
+
const SetMinSizeMethod = 30;
|
|
42
|
+
const SetRelativePositionMethod = 31;
|
|
43
|
+
const SetResizableMethod = 32;
|
|
44
|
+
const SetSizeMethod = 33;
|
|
45
|
+
const SetTitleMethod = 34;
|
|
46
|
+
const SetZoomMethod = 35;
|
|
47
|
+
const ShowMethod = 36;
|
|
48
|
+
const SizeMethod = 37;
|
|
49
|
+
const ToggleFullscreenMethod = 38;
|
|
50
|
+
const ToggleMaximiseMethod = 39;
|
|
51
|
+
const UnFullscreenMethod = 40;
|
|
52
|
+
const UnMaximiseMethod = 41;
|
|
53
|
+
const UnMinimiseMethod = 42;
|
|
54
|
+
const WidthMethod = 43;
|
|
55
|
+
const ZoomMethod = 44;
|
|
56
|
+
const ZoomInMethod = 45;
|
|
57
|
+
const ZoomOutMethod = 46;
|
|
58
|
+
const ZoomResetMethod = 47;
|
|
59
|
+
// Private field names.
|
|
60
|
+
const callerSym = Symbol("caller");
|
|
61
|
+
class Window {
|
|
62
|
+
/**
|
|
63
|
+
* Initialises a window object with the specified name.
|
|
64
|
+
*
|
|
65
|
+
* @private
|
|
66
|
+
* @param name - The name of the target window.
|
|
67
|
+
*/
|
|
68
|
+
constructor(name = '') {
|
|
69
|
+
this[callerSym] = newRuntimeCaller(objectNames.Window, name);
|
|
70
|
+
// bind instance method to make them easily usable in event handlers
|
|
71
|
+
for (const method of Object.getOwnPropertyNames(Window.prototype)) {
|
|
72
|
+
if (method !== "constructor"
|
|
73
|
+
&& typeof this[method] === "function") {
|
|
74
|
+
this[method] = this[method].bind(this);
|
|
75
|
+
}
|
|
76
|
+
}
|
|
77
|
+
}
|
|
78
|
+
/**
|
|
79
|
+
* Gets the specified window.
|
|
80
|
+
*
|
|
81
|
+
* @param name - The name of the window to get.
|
|
82
|
+
* @returns The corresponding window object.
|
|
83
|
+
*/
|
|
84
|
+
Get(name) {
|
|
85
|
+
return new Window(name);
|
|
86
|
+
}
|
|
87
|
+
/**
|
|
88
|
+
* Returns the absolute position of the window.
|
|
89
|
+
*
|
|
90
|
+
* @returns The current absolute position of the window.
|
|
91
|
+
*/
|
|
92
|
+
Position() {
|
|
93
|
+
return this[callerSym](PositionMethod);
|
|
94
|
+
}
|
|
95
|
+
/**
|
|
96
|
+
* Centers the window on the screen.
|
|
97
|
+
*/
|
|
98
|
+
Center() {
|
|
99
|
+
return this[callerSym](CenterMethod);
|
|
100
|
+
}
|
|
101
|
+
/**
|
|
102
|
+
* Closes the window.
|
|
103
|
+
*/
|
|
104
|
+
Close() {
|
|
105
|
+
return this[callerSym](CloseMethod);
|
|
106
|
+
}
|
|
107
|
+
/**
|
|
108
|
+
* Disables min/max size constraints.
|
|
109
|
+
*/
|
|
110
|
+
DisableSizeConstraints() {
|
|
111
|
+
return this[callerSym](DisableSizeConstraintsMethod);
|
|
112
|
+
}
|
|
113
|
+
/**
|
|
114
|
+
* Enables min/max size constraints.
|
|
115
|
+
*/
|
|
116
|
+
EnableSizeConstraints() {
|
|
117
|
+
return this[callerSym](EnableSizeConstraintsMethod);
|
|
118
|
+
}
|
|
119
|
+
/**
|
|
120
|
+
* Focuses the window.
|
|
121
|
+
*/
|
|
122
|
+
Focus() {
|
|
123
|
+
return this[callerSym](FocusMethod);
|
|
124
|
+
}
|
|
125
|
+
/**
|
|
126
|
+
* Forces the window to reload the page assets.
|
|
127
|
+
*/
|
|
128
|
+
ForceReload() {
|
|
129
|
+
return this[callerSym](ForceReloadMethod);
|
|
130
|
+
}
|
|
131
|
+
/**
|
|
132
|
+
* Switches the window to fullscreen mode.
|
|
133
|
+
*/
|
|
134
|
+
Fullscreen() {
|
|
135
|
+
return this[callerSym](FullscreenMethod);
|
|
136
|
+
}
|
|
137
|
+
/**
|
|
138
|
+
* Returns the screen that the window is on.
|
|
139
|
+
*
|
|
140
|
+
* @returns The screen the window is currently on.
|
|
141
|
+
*/
|
|
142
|
+
GetScreen() {
|
|
143
|
+
return this[callerSym](GetScreenMethod);
|
|
144
|
+
}
|
|
145
|
+
/**
|
|
146
|
+
* Returns the current zoom level of the window.
|
|
147
|
+
*
|
|
148
|
+
* @returns The current zoom level.
|
|
149
|
+
*/
|
|
150
|
+
GetZoom() {
|
|
151
|
+
return this[callerSym](GetZoomMethod);
|
|
152
|
+
}
|
|
153
|
+
/**
|
|
154
|
+
* Returns the height of the window.
|
|
155
|
+
*
|
|
156
|
+
* @returns The current height of the window.
|
|
157
|
+
*/
|
|
158
|
+
Height() {
|
|
159
|
+
return this[callerSym](HeightMethod);
|
|
160
|
+
}
|
|
161
|
+
/**
|
|
162
|
+
* Hides the window.
|
|
163
|
+
*/
|
|
164
|
+
Hide() {
|
|
165
|
+
return this[callerSym](HideMethod);
|
|
166
|
+
}
|
|
167
|
+
/**
|
|
168
|
+
* Returns true if the window is focused.
|
|
169
|
+
*
|
|
170
|
+
* @returns Whether the window is currently focused.
|
|
171
|
+
*/
|
|
172
|
+
IsFocused() {
|
|
173
|
+
return this[callerSym](IsFocusedMethod);
|
|
174
|
+
}
|
|
175
|
+
/**
|
|
176
|
+
* Returns true if the window is fullscreen.
|
|
177
|
+
*
|
|
178
|
+
* @returns Whether the window is currently fullscreen.
|
|
179
|
+
*/
|
|
180
|
+
IsFullscreen() {
|
|
181
|
+
return this[callerSym](IsFullscreenMethod);
|
|
182
|
+
}
|
|
183
|
+
/**
|
|
184
|
+
* Returns true if the window is maximised.
|
|
185
|
+
*
|
|
186
|
+
* @returns Whether the window is currently maximised.
|
|
187
|
+
*/
|
|
188
|
+
IsMaximised() {
|
|
189
|
+
return this[callerSym](IsMaximisedMethod);
|
|
190
|
+
}
|
|
191
|
+
/**
|
|
192
|
+
* Returns true if the window is minimised.
|
|
193
|
+
*
|
|
194
|
+
* @returns Whether the window is currently minimised.
|
|
195
|
+
*/
|
|
196
|
+
IsMinimised() {
|
|
197
|
+
return this[callerSym](IsMinimisedMethod);
|
|
198
|
+
}
|
|
199
|
+
/**
|
|
200
|
+
* Maximises the window.
|
|
201
|
+
*/
|
|
202
|
+
Maximise() {
|
|
203
|
+
return this[callerSym](MaximiseMethod);
|
|
204
|
+
}
|
|
205
|
+
/**
|
|
206
|
+
* Minimises the window.
|
|
207
|
+
*/
|
|
208
|
+
Minimise() {
|
|
209
|
+
return this[callerSym](MinimiseMethod);
|
|
210
|
+
}
|
|
211
|
+
/**
|
|
212
|
+
* Returns the name of the window.
|
|
213
|
+
*
|
|
214
|
+
* @returns The name of the window.
|
|
215
|
+
*/
|
|
216
|
+
Name() {
|
|
217
|
+
return this[callerSym](NameMethod);
|
|
218
|
+
}
|
|
219
|
+
/**
|
|
220
|
+
* Opens the development tools pane.
|
|
221
|
+
*/
|
|
222
|
+
OpenDevTools() {
|
|
223
|
+
return this[callerSym](OpenDevToolsMethod);
|
|
224
|
+
}
|
|
225
|
+
/**
|
|
226
|
+
* Returns the relative position of the window to the screen.
|
|
227
|
+
*
|
|
228
|
+
* @returns The current relative position of the window.
|
|
229
|
+
*/
|
|
230
|
+
RelativePosition() {
|
|
231
|
+
return this[callerSym](RelativePositionMethod);
|
|
232
|
+
}
|
|
233
|
+
/**
|
|
234
|
+
* Reloads the page assets.
|
|
235
|
+
*/
|
|
236
|
+
Reload() {
|
|
237
|
+
return this[callerSym](ReloadMethod);
|
|
238
|
+
}
|
|
239
|
+
/**
|
|
240
|
+
* Returns true if the window is resizable.
|
|
241
|
+
*
|
|
242
|
+
* @returns Whether the window is currently resizable.
|
|
243
|
+
*/
|
|
244
|
+
Resizable() {
|
|
245
|
+
return this[callerSym](ResizableMethod);
|
|
246
|
+
}
|
|
247
|
+
/**
|
|
248
|
+
* Restores the window to its previous state if it was previously minimised, maximised or fullscreen.
|
|
249
|
+
*/
|
|
250
|
+
Restore() {
|
|
251
|
+
return this[callerSym](RestoreMethod);
|
|
252
|
+
}
|
|
253
|
+
/**
|
|
254
|
+
* Sets the absolute position of the window.
|
|
255
|
+
*
|
|
256
|
+
* @param x - The desired horizontal absolute position of the window.
|
|
257
|
+
* @param y - The desired vertical absolute position of the window.
|
|
258
|
+
*/
|
|
259
|
+
SetPosition(x, y) {
|
|
260
|
+
return this[callerSym](SetPositionMethod, { x, y });
|
|
261
|
+
}
|
|
262
|
+
/**
|
|
263
|
+
* Sets the window to be always on top.
|
|
264
|
+
*
|
|
265
|
+
* @param alwaysOnTop - Whether the window should stay on top.
|
|
266
|
+
*/
|
|
267
|
+
SetAlwaysOnTop(alwaysOnTop) {
|
|
268
|
+
return this[callerSym](SetAlwaysOnTopMethod, { alwaysOnTop });
|
|
269
|
+
}
|
|
270
|
+
/**
|
|
271
|
+
* Sets the background colour of the window.
|
|
272
|
+
*
|
|
273
|
+
* @param r - The desired red component of the window background.
|
|
274
|
+
* @param g - The desired green component of the window background.
|
|
275
|
+
* @param b - The desired blue component of the window background.
|
|
276
|
+
* @param a - The desired alpha component of the window background.
|
|
277
|
+
*/
|
|
278
|
+
SetBackgroundColour(r, g, b, a) {
|
|
279
|
+
return this[callerSym](SetBackgroundColourMethod, { r, g, b, a });
|
|
280
|
+
}
|
|
281
|
+
/**
|
|
282
|
+
* Removes the window frame and title bar.
|
|
283
|
+
*
|
|
284
|
+
* @param frameless - Whether the window should be frameless.
|
|
285
|
+
*/
|
|
286
|
+
SetFrameless(frameless) {
|
|
287
|
+
return this[callerSym](SetFramelessMethod, { frameless });
|
|
288
|
+
}
|
|
289
|
+
/**
|
|
290
|
+
* Disables the system fullscreen button.
|
|
291
|
+
*
|
|
292
|
+
* @param enabled - Whether the fullscreen button should be enabled.
|
|
293
|
+
*/
|
|
294
|
+
SetFullscreenButtonEnabled(enabled) {
|
|
295
|
+
return this[callerSym](SetFullscreenButtonEnabledMethod, { enabled });
|
|
296
|
+
}
|
|
297
|
+
/**
|
|
298
|
+
* Sets the maximum size of the window.
|
|
299
|
+
*
|
|
300
|
+
* @param width - The desired maximum width of the window.
|
|
301
|
+
* @param height - The desired maximum height of the window.
|
|
302
|
+
*/
|
|
303
|
+
SetMaxSize(width, height) {
|
|
304
|
+
return this[callerSym](SetMaxSizeMethod, { width, height });
|
|
305
|
+
}
|
|
306
|
+
/**
|
|
307
|
+
* Sets the minimum size of the window.
|
|
308
|
+
*
|
|
309
|
+
* @param width - The desired minimum width of the window.
|
|
310
|
+
* @param height - The desired minimum height of the window.
|
|
311
|
+
*/
|
|
312
|
+
SetMinSize(width, height) {
|
|
313
|
+
return this[callerSym](SetMinSizeMethod, { width, height });
|
|
314
|
+
}
|
|
315
|
+
/**
|
|
316
|
+
* Sets the relative position of the window to the screen.
|
|
317
|
+
*
|
|
318
|
+
* @param x - The desired horizontal relative position of the window.
|
|
319
|
+
* @param y - The desired vertical relative position of the window.
|
|
320
|
+
*/
|
|
321
|
+
SetRelativePosition(x, y) {
|
|
322
|
+
return this[callerSym](SetRelativePositionMethod, { x, y });
|
|
323
|
+
}
|
|
324
|
+
/**
|
|
325
|
+
* Sets whether the window is resizable.
|
|
326
|
+
*
|
|
327
|
+
* @param resizable - Whether the window should be resizable.
|
|
328
|
+
*/
|
|
329
|
+
SetResizable(resizable) {
|
|
330
|
+
return this[callerSym](SetResizableMethod, { resizable });
|
|
331
|
+
}
|
|
332
|
+
/**
|
|
333
|
+
* Sets the size of the window.
|
|
334
|
+
*
|
|
335
|
+
* @param width - The desired width of the window.
|
|
336
|
+
* @param height - The desired height of the window.
|
|
337
|
+
*/
|
|
338
|
+
SetSize(width, height) {
|
|
339
|
+
return this[callerSym](SetSizeMethod, { width, height });
|
|
340
|
+
}
|
|
341
|
+
/**
|
|
342
|
+
* Sets the title of the window.
|
|
343
|
+
*
|
|
344
|
+
* @param title - The desired title of the window.
|
|
345
|
+
*/
|
|
346
|
+
SetTitle(title) {
|
|
347
|
+
return this[callerSym](SetTitleMethod, { title });
|
|
348
|
+
}
|
|
349
|
+
/**
|
|
350
|
+
* Sets the zoom level of the window.
|
|
351
|
+
*
|
|
352
|
+
* @param zoom - The desired zoom level.
|
|
353
|
+
*/
|
|
354
|
+
SetZoom(zoom) {
|
|
355
|
+
return this[callerSym](SetZoomMethod, { zoom });
|
|
356
|
+
}
|
|
357
|
+
/**
|
|
358
|
+
* Shows the window.
|
|
359
|
+
*/
|
|
360
|
+
Show() {
|
|
361
|
+
return this[callerSym](ShowMethod);
|
|
362
|
+
}
|
|
363
|
+
/**
|
|
364
|
+
* Returns the size of the window.
|
|
365
|
+
*
|
|
366
|
+
* @returns The current size of the window.
|
|
367
|
+
*/
|
|
368
|
+
Size() {
|
|
369
|
+
return this[callerSym](SizeMethod);
|
|
370
|
+
}
|
|
371
|
+
/**
|
|
372
|
+
* Toggles the window between fullscreen and normal.
|
|
373
|
+
*/
|
|
374
|
+
ToggleFullscreen() {
|
|
375
|
+
return this[callerSym](ToggleFullscreenMethod);
|
|
376
|
+
}
|
|
377
|
+
/**
|
|
378
|
+
* Toggles the window between maximised and normal.
|
|
379
|
+
*/
|
|
380
|
+
ToggleMaximise() {
|
|
381
|
+
return this[callerSym](ToggleMaximiseMethod);
|
|
382
|
+
}
|
|
383
|
+
/**
|
|
384
|
+
* Un-fullscreens the window.
|
|
385
|
+
*/
|
|
386
|
+
UnFullscreen() {
|
|
387
|
+
return this[callerSym](UnFullscreenMethod);
|
|
388
|
+
}
|
|
389
|
+
/**
|
|
390
|
+
* Un-maximises the window.
|
|
391
|
+
*/
|
|
392
|
+
UnMaximise() {
|
|
393
|
+
return this[callerSym](UnMaximiseMethod);
|
|
394
|
+
}
|
|
395
|
+
/**
|
|
396
|
+
* Un-minimises the window.
|
|
397
|
+
*/
|
|
398
|
+
UnMinimise() {
|
|
399
|
+
return this[callerSym](UnMinimiseMethod);
|
|
400
|
+
}
|
|
401
|
+
/**
|
|
402
|
+
* Returns the width of the window.
|
|
403
|
+
*
|
|
404
|
+
* @returns The current width of the window.
|
|
405
|
+
*/
|
|
406
|
+
Width() {
|
|
407
|
+
return this[callerSym](WidthMethod);
|
|
408
|
+
}
|
|
409
|
+
/**
|
|
410
|
+
* Zooms the window.
|
|
411
|
+
*/
|
|
412
|
+
Zoom() {
|
|
413
|
+
return this[callerSym](ZoomMethod);
|
|
414
|
+
}
|
|
415
|
+
/**
|
|
416
|
+
* Increases the zoom level of the webview content.
|
|
417
|
+
*/
|
|
418
|
+
ZoomIn() {
|
|
419
|
+
return this[callerSym](ZoomInMethod);
|
|
420
|
+
}
|
|
421
|
+
/**
|
|
422
|
+
* Decreases the zoom level of the webview content.
|
|
423
|
+
*/
|
|
424
|
+
ZoomOut() {
|
|
425
|
+
return this[callerSym](ZoomOutMethod);
|
|
426
|
+
}
|
|
427
|
+
/**
|
|
428
|
+
* Resets the zoom level of the webview content.
|
|
429
|
+
*/
|
|
430
|
+
ZoomReset() {
|
|
431
|
+
return this[callerSym](ZoomResetMethod);
|
|
432
|
+
}
|
|
433
|
+
}
|
|
434
|
+
/**
|
|
435
|
+
* The window within which the script is running.
|
|
436
|
+
*/
|
|
437
|
+
const thisWindow = new Window('');
|
|
438
|
+
export default thisWindow;
|