@wailsio/runtime 3.0.0-alpha.6 → 3.0.0-alpha.8
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/package.json +12 -3
- package/{application.js → src/application.js} +1 -1
- package/src/index.d.ts +136 -0
- package/{index.js → src/index.js} +11 -9
- package/{wml.js → src/wml.js} +15 -13
- package/tsconfig.json +20 -0
- package/types/application.d.ts +19 -0
- package/types/browser.d.ts +6 -0
- package/types/calls.d.ts +35 -0
- package/types/clipboard.d.ts +12 -0
- package/types/contextmenu.d.ts +1 -0
- package/types/dialogs.d.ts +28 -0
- package/types/drag.d.ts +4 -0
- package/types/events.d.ts +53 -0
- package/types/flags.d.ts +7 -0
- package/types/index.d.ts +48 -0
- package/types/runtime.d.ts +29 -0
- package/types/screens.d.ts +17 -0
- package/types/system.d.ts +72 -0
- package/types/window.d.ts +17 -0
- package/types/wml.d.ts +6 -0
- package/types.d.ts +0 -130
- /package/{browser.js → src/browser.js} +0 -0
- /package/{calls.js → src/calls.js} +0 -0
- /package/{clipboard.js → src/clipboard.js} +0 -0
- /package/{contextmenu.js → src/contextmenu.js} +0 -0
- /package/{dialogs.js → src/dialogs.js} +0 -0
- /package/{drag.js → src/drag.js} +0 -0
- /package/{events.js → src/events.js} +0 -0
- /package/{flags.js → src/flags.js} +0 -0
- /package/{runtime.js → src/runtime.js} +0 -0
- /package/{screens.js → src/screens.js} +0 -0
- /package/{system.js → src/system.js} +0 -0
- /package/{window.js → src/window.js} +0 -0
package/package.json
CHANGED
|
@@ -1,17 +1,26 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@wailsio/runtime",
|
|
3
|
-
"version": "3.0.0-alpha.
|
|
3
|
+
"version": "3.0.0-alpha.8",
|
|
4
4
|
"description": "Wails Runtime",
|
|
5
|
-
"main": "index.js",
|
|
5
|
+
"main": "src/index.js",
|
|
6
|
+
"types": "types/index.d.ts",
|
|
6
7
|
"repository": {
|
|
7
8
|
"type": "git",
|
|
8
9
|
"url": "https://github.com/wailsapp/wails.git"
|
|
9
10
|
},
|
|
11
|
+
"scripts": {
|
|
12
|
+
"prebuild:types": "rimraf ./types",
|
|
13
|
+
"build:types": "npx -p typescript tsc src/index.js --declaration --allowJs --emitDeclarationOnly --outDir types"
|
|
14
|
+
},
|
|
10
15
|
"author": "The Wails Team",
|
|
11
16
|
"license": "MIT",
|
|
12
17
|
"bugs": {
|
|
13
18
|
"url": "https://github.com/wailsapp/wails/issues"
|
|
14
19
|
},
|
|
15
20
|
"homepage": "https://wails.io",
|
|
16
|
-
"private": false
|
|
21
|
+
"private": false,
|
|
22
|
+
"devDependencies": {
|
|
23
|
+
"rimraf": "^5.0.5",
|
|
24
|
+
"typescript": "^5.3.3"
|
|
25
|
+
}
|
|
17
26
|
}
|
|
@@ -11,7 +11,7 @@ The electron alternative for Go
|
|
|
11
11
|
/* jshint esversion: 9 */
|
|
12
12
|
|
|
13
13
|
import { newRuntimeCallerWithID, objectNames } from "./runtime";
|
|
14
|
-
const call = newRuntimeCallerWithID(objectNames.Application);
|
|
14
|
+
const call = newRuntimeCallerWithID(objectNames.Application, '');
|
|
15
15
|
|
|
16
16
|
const HideMethod = 0;
|
|
17
17
|
const ShowMethod = 1;
|
package/src/index.d.ts
ADDED
|
@@ -0,0 +1,136 @@
|
|
|
1
|
+
declare module '@wailsio/runtime';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Describes the properties of a Button object.
|
|
5
|
+
*/
|
|
6
|
+
export interface Button {
|
|
7
|
+
// Text that appears within the button.
|
|
8
|
+
Label?: string;
|
|
9
|
+
// True if the button should cancel an operation when clicked.
|
|
10
|
+
IsCancel?: boolean;
|
|
11
|
+
// True if the button should be the default action when the user presses enter.
|
|
12
|
+
IsDefault?: boolean;
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
/**
|
|
16
|
+
* Describes the properties of a FileFilter object.
|
|
17
|
+
*/
|
|
18
|
+
export interface FileFilter {
|
|
19
|
+
// Display name for the filter, it could be "Text Files", "Images" etc.
|
|
20
|
+
DisplayName?: string;
|
|
21
|
+
// Pattern to match for the filter, e.g. "*.txt;*.md" for text markdown files.
|
|
22
|
+
Pattern?: string;
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
/**
|
|
26
|
+
* Describes the properties of a Position object.
|
|
27
|
+
*/
|
|
28
|
+
export interface Position {
|
|
29
|
+
X: number;
|
|
30
|
+
Y: number;
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
/**
|
|
34
|
+
* Describes the properties of a Size object.
|
|
35
|
+
* Extends the properties of Position.
|
|
36
|
+
*/
|
|
37
|
+
export type Size = Position;
|
|
38
|
+
|
|
39
|
+
/**
|
|
40
|
+
* Describes the properties of a Rect object.
|
|
41
|
+
* Extends the properties of Size.
|
|
42
|
+
*/
|
|
43
|
+
export type Rect = Size & Position;
|
|
44
|
+
|
|
45
|
+
/**
|
|
46
|
+
* Describes the possible rotations a Screen can have.
|
|
47
|
+
*/
|
|
48
|
+
export enum Rotation {
|
|
49
|
+
Zero = 0,
|
|
50
|
+
Ninety = 90,
|
|
51
|
+
OneEighty = 180,
|
|
52
|
+
TwoSeventy = 270
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
/**
|
|
56
|
+
* Describes the properties of a Screen object.
|
|
57
|
+
*/
|
|
58
|
+
export interface Screen {
|
|
59
|
+
// Unique identifier for the screen.
|
|
60
|
+
Id: string;
|
|
61
|
+
// Human readable name of the screen.
|
|
62
|
+
Name: string;
|
|
63
|
+
// The resolution scale of the screen. 1 = standard resolution, 2 = high (Retina), etc.
|
|
64
|
+
Scale: number;
|
|
65
|
+
// Contains the X and Y coordinates of the screen's position.
|
|
66
|
+
Position: Position;
|
|
67
|
+
// Contains the width and height of the screen.
|
|
68
|
+
Size: Size;
|
|
69
|
+
// Contains the bounds of the screen in terms of X, Y, Width, and Height.
|
|
70
|
+
Bounds: Rect;
|
|
71
|
+
// Contains the area of the screen that is actually usable (excluding taskbar and other system UI).
|
|
72
|
+
WorkArea: Rect;
|
|
73
|
+
// True if this is the primary monitor selected by the user in the operating system.
|
|
74
|
+
IsPrimary: boolean;
|
|
75
|
+
// The rotation of the screen. Can be one of 0, 90, 180, 270 degrees.
|
|
76
|
+
Rotation: Rotation;
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
/**
|
|
80
|
+
* Describes the properties of a MessageDialogOptions object.
|
|
81
|
+
*/
|
|
82
|
+
export interface MessageDialogOptions {
|
|
83
|
+
// The title of the dialog window.
|
|
84
|
+
Title?: string;
|
|
85
|
+
// The main message to show in the dialog.
|
|
86
|
+
Message?: string;
|
|
87
|
+
// Array of button options to show in the dialog.
|
|
88
|
+
Buttons?: Button[];
|
|
89
|
+
// True if the dialog should appear detached from the main window (if applicable).
|
|
90
|
+
Detached?: boolean;
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
/**
|
|
94
|
+
* Describes the properties common to OpenFileDialogOptions and SaveFileDialogOptions objects.
|
|
95
|
+
*/
|
|
96
|
+
export interface DialogOptions {
|
|
97
|
+
CanChooseDirectories?: boolean;
|
|
98
|
+
CanChooseFiles?: boolean;
|
|
99
|
+
CanCreateDirectories?: boolean;
|
|
100
|
+
ShowHiddenFiles?: boolean;
|
|
101
|
+
ResolvesAliases?: boolean;
|
|
102
|
+
AllowsMultipleSelection?: boolean;
|
|
103
|
+
HideExtension?: boolean;
|
|
104
|
+
CanSelectHiddenExtension?: boolean;
|
|
105
|
+
TreatsFilePackagesAsDirectories?: boolean;
|
|
106
|
+
AllowsOtherFiletypes?: boolean;
|
|
107
|
+
Filters?: FileFilter[];
|
|
108
|
+
Title?: string;
|
|
109
|
+
Message?: string;
|
|
110
|
+
ButtonText?: string;
|
|
111
|
+
Directory?: string;
|
|
112
|
+
Detached?: boolean;
|
|
113
|
+
}
|
|
114
|
+
|
|
115
|
+
/**
|
|
116
|
+
* Describes properties unique to OpenFileDialogOptions.
|
|
117
|
+
*/
|
|
118
|
+
export type OpenFileDialogOptions = DialogOptions;
|
|
119
|
+
|
|
120
|
+
/**
|
|
121
|
+
* Describes properties unique to SaveFileDialogOptions.
|
|
122
|
+
*/
|
|
123
|
+
export type SaveFileDialogOptions = DialogOptions & {
|
|
124
|
+
// Default filename to use for the save dialog.
|
|
125
|
+
Filename?: string;
|
|
126
|
+
};
|
|
127
|
+
|
|
128
|
+
/**
|
|
129
|
+
* Describes the properties of a WailsEvent object.
|
|
130
|
+
*/
|
|
131
|
+
export interface WailsEvent {
|
|
132
|
+
// The name of the event.
|
|
133
|
+
Name: string;
|
|
134
|
+
// Any data associated with the event.
|
|
135
|
+
Data?: unknown;
|
|
136
|
+
}
|
|
@@ -15,15 +15,17 @@ import {Emit, Off, OffAll, On, Once, OnMultiple, WailsEvent} from './events';
|
|
|
15
15
|
import {ByID, ByName, Plugin} from "./calls";
|
|
16
16
|
import {Error, Info, OpenFile, Question, SaveFile, Warning} from "./dialogs";
|
|
17
17
|
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
18
|
+
import * as Application from "./application";
|
|
19
|
+
import * as Browser from "./browser";
|
|
20
|
+
import * as Clipboard from "./clipboard";
|
|
21
|
+
import * as ContextMenu from "./contextmenu";
|
|
22
|
+
import * as Flags from "./flags";
|
|
23
|
+
import * as Runtime from "./runtime";
|
|
24
|
+
import * as Screens from "./screens";
|
|
25
|
+
import * as System from "./system";
|
|
26
|
+
import * as Window from "./window";
|
|
27
|
+
|
|
28
|
+
export { Application, Browser, Clipboard, ContextMenu, Flags, Runtime, Screens, System, Window };
|
|
27
29
|
|
|
28
30
|
export const Events = {
|
|
29
31
|
On,
|
package/{wml.js → src/wml.js}
RENAMED
|
@@ -49,22 +49,23 @@ function addWMLEventListeners() {
|
|
|
49
49
|
});
|
|
50
50
|
}
|
|
51
51
|
|
|
52
|
+
|
|
52
53
|
/**
|
|
53
|
-
* Calls a method on
|
|
54
|
-
*
|
|
55
|
-
* @param {string} method - The name of the method to call
|
|
56
|
-
*
|
|
57
|
-
* @return {void}
|
|
54
|
+
* Calls a method on a specified window.
|
|
55
|
+
* @param {string} windowName - The name of the window to call the method on.
|
|
56
|
+
* @param {string} method - The name of the method to call.
|
|
58
57
|
*/
|
|
59
|
-
function callWindowMethod(method) {
|
|
60
|
-
|
|
61
|
-
let windowName = '';
|
|
62
|
-
let targetWindow = Get('');
|
|
58
|
+
function callWindowMethod(windowName, method) {
|
|
59
|
+
let targetWindow = Get(windowName);
|
|
63
60
|
let methodMap = WindowMethods(targetWindow);
|
|
64
61
|
if (!methodMap.has(method)) {
|
|
65
62
|
console.log("Window method " + method + " not found");
|
|
66
63
|
}
|
|
67
|
-
|
|
64
|
+
try {
|
|
65
|
+
methodMap.get(method)();
|
|
66
|
+
} catch (e) {
|
|
67
|
+
console.error("Error calling window method '" + method + "': " + e);
|
|
68
|
+
}
|
|
68
69
|
}
|
|
69
70
|
|
|
70
71
|
/**
|
|
@@ -78,18 +79,19 @@ function addWMLWindowListeners() {
|
|
|
78
79
|
elements.forEach(function (element) {
|
|
79
80
|
const windowMethod = element.getAttribute('wml-window');
|
|
80
81
|
const confirm = element.getAttribute('wml-confirm');
|
|
81
|
-
const trigger = element.getAttribute('wml-trigger') ||
|
|
82
|
+
const trigger = element.getAttribute('wml-trigger') || 'click';
|
|
83
|
+
const targetWindow = element.getAttribute('wml-target-window') || '';
|
|
82
84
|
|
|
83
85
|
let callback = function () {
|
|
84
86
|
if (confirm) {
|
|
85
87
|
Question({Title: "Confirm", Message:confirm, Buttons:[{Label:"Yes"},{Label:"No", IsDefault:true}]}).then(function (result) {
|
|
86
88
|
if (result !== "No") {
|
|
87
|
-
callWindowMethod(windowMethod);
|
|
89
|
+
callWindowMethod(targetWindow, windowMethod);
|
|
88
90
|
}
|
|
89
91
|
});
|
|
90
92
|
return;
|
|
91
93
|
}
|
|
92
|
-
callWindowMethod(windowMethod);
|
|
94
|
+
callWindowMethod(targetWindow, windowMethod);
|
|
93
95
|
};
|
|
94
96
|
|
|
95
97
|
// Remove existing listeners
|
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": "node",
|
|
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>;
|
package/types/calls.d.ts
ADDED
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
export function resultHandler(id: any, data: any, isJSON: any): void;
|
|
2
|
+
export function errorHandler(id: any, message: any): void;
|
|
3
|
+
/**
|
|
4
|
+
* Call method.
|
|
5
|
+
*
|
|
6
|
+
* @param {Object} options - The options for the method.
|
|
7
|
+
* @returns {Object} - The result of the call.
|
|
8
|
+
*/
|
|
9
|
+
export function Call(options: any): any;
|
|
10
|
+
/**
|
|
11
|
+
* Executes a method by name.
|
|
12
|
+
*
|
|
13
|
+
* @param {string} name - The name of the method in the format 'package.struct.method'.
|
|
14
|
+
* @param {...*} args - The arguments to pass to the method.
|
|
15
|
+
* @throws {Error} If the name is not a string or is not in the correct format.
|
|
16
|
+
* @returns {*} The result of the method execution.
|
|
17
|
+
*/
|
|
18
|
+
export function ByName(name: string, ...args: any[]): any;
|
|
19
|
+
/**
|
|
20
|
+
* Calls a method by its ID with the specified arguments.
|
|
21
|
+
*
|
|
22
|
+
* @param {string} methodID - The ID of the method to call.
|
|
23
|
+
* @param {...*} args - The arguments to pass to the method.
|
|
24
|
+
* @return {*} - The result of the method call.
|
|
25
|
+
*/
|
|
26
|
+
export function ByID(methodID: string, ...args: any[]): any;
|
|
27
|
+
/**
|
|
28
|
+
* Calls a method on a plugin.
|
|
29
|
+
*
|
|
30
|
+
* @param {string} pluginName - The name of the plugin.
|
|
31
|
+
* @param {string} methodName - The name of the method to call.
|
|
32
|
+
* @param {...*} args - The arguments to pass to the method.
|
|
33
|
+
* @returns {*} - The result of the method call.
|
|
34
|
+
*/
|
|
35
|
+
export function Plugin(pluginName: string, methodName: string, ...args: any[]): any;
|
|
@@ -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 @@
|
|
|
1
|
+
export function setupContextMenus(): void;
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Handles the callback from a dialog.
|
|
3
|
+
*
|
|
4
|
+
* @param {string} id - The ID of the dialog response.
|
|
5
|
+
* @param {string} data - The data received from the dialog.
|
|
6
|
+
* @param {boolean} isJSON - Flag indicating whether the data is in JSON format.
|
|
7
|
+
*
|
|
8
|
+
* @return {undefined}
|
|
9
|
+
*/
|
|
10
|
+
export function dialogCallback(id: string, data: string, isJSON: boolean): undefined;
|
|
11
|
+
/**
|
|
12
|
+
* Callback function for handling errors in dialog.
|
|
13
|
+
*
|
|
14
|
+
* @param {string} id - The id of the dialog response.
|
|
15
|
+
* @param {string} message - The error message.
|
|
16
|
+
*
|
|
17
|
+
* @return {void}
|
|
18
|
+
*/
|
|
19
|
+
export function dialogErrorCallback(id: string, message: string): void;
|
|
20
|
+
export function Info(options: any): Promise<string>;
|
|
21
|
+
export function Warning(options: any): Promise<string>;
|
|
22
|
+
export function Error(options: any): Promise<string>;
|
|
23
|
+
export function Question(options: any): Promise<string>;
|
|
24
|
+
export function OpenFile(options: any): Promise<string[] | string>;
|
|
25
|
+
export function SaveFile(options: any): Promise<string>;
|
|
26
|
+
export type MessageDialogOptions = any;
|
|
27
|
+
export type OpenDialogOptions = any;
|
|
28
|
+
export type SaveDialogOptions = any;
|
package/types/drag.d.ts
ADDED
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
export function dispatchWailsEvent(event: any): void;
|
|
2
|
+
/**
|
|
3
|
+
* Register a callback function to be called multiple times for a specific event.
|
|
4
|
+
*
|
|
5
|
+
* @param {string} eventName - The name of the event to register the callback for.
|
|
6
|
+
* @param {function} callback - The callback function to be called when the event is triggered.
|
|
7
|
+
* @param {number} maxCallbacks - The maximum number of times the callback can be called for the event. Once the maximum number is reached, the callback will no longer be called.
|
|
8
|
+
*
|
|
9
|
+
@return {function} - A function that, when called, will unregister the callback from the event.
|
|
10
|
+
*/
|
|
11
|
+
export function OnMultiple(eventName: string, callback: Function, maxCallbacks: number): Function;
|
|
12
|
+
/**
|
|
13
|
+
* Registers a callback function to be executed when the specified event occurs.
|
|
14
|
+
*
|
|
15
|
+
* @param {string} eventName - The name of the event.
|
|
16
|
+
* @param {function} callback - The callback function to be executed. It takes no parameters.
|
|
17
|
+
* @return {function} - A function that, when called, will unregister the callback from the event. */
|
|
18
|
+
export function On(eventName: string, callback: Function): Function;
|
|
19
|
+
/**
|
|
20
|
+
* Registers a callback function to be executed only once for the specified event.
|
|
21
|
+
*
|
|
22
|
+
* @param {string} eventName - The name of the event.
|
|
23
|
+
* @param {function} callback - The function to be executed when the event occurs.
|
|
24
|
+
* @return {void@return {function} - A function that, when called, will unregister the callback from the event.
|
|
25
|
+
*/
|
|
26
|
+
export function Once(eventName: string, callback: Function): void;
|
|
27
|
+
/**
|
|
28
|
+
* Removes event listeners for the specified event names.
|
|
29
|
+
*
|
|
30
|
+
* @param {string} eventName - The name of the event to remove listeners for.
|
|
31
|
+
* @param {...string} additionalEventNames - Additional event names to remove listeners for.
|
|
32
|
+
* @return {undefined}
|
|
33
|
+
*/
|
|
34
|
+
export function Off(eventName: string, ...additionalEventNames: string[]): undefined;
|
|
35
|
+
/**
|
|
36
|
+
* Removes all event listeners.
|
|
37
|
+
*
|
|
38
|
+
* @function OffAll
|
|
39
|
+
* @returns {void}
|
|
40
|
+
*/
|
|
41
|
+
export function OffAll(): void;
|
|
42
|
+
/**
|
|
43
|
+
* Emits an event using the given event name.
|
|
44
|
+
*
|
|
45
|
+
* @param {WailsEvent} event - The name of the event to emit.
|
|
46
|
+
* @returns {any} - The result of the emitted event.
|
|
47
|
+
*/
|
|
48
|
+
export function Emit(event: WailsEvent): any;
|
|
49
|
+
export class WailsEvent {
|
|
50
|
+
constructor(name: any, data?: any);
|
|
51
|
+
name: any;
|
|
52
|
+
data: any;
|
|
53
|
+
}
|
package/types/flags.d.ts
ADDED
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Retrieves the value associated with the specified key from the flag map.
|
|
3
|
+
*
|
|
4
|
+
* @param {string} keyString - The key to retrieve the value for.
|
|
5
|
+
* @return {*} - The value associated with the specified key.
|
|
6
|
+
*/
|
|
7
|
+
export function GetFlag(keyString: string): any;
|
package/types/index.d.ts
ADDED
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
export namespace Events {
|
|
2
|
+
export { On };
|
|
3
|
+
export { Off };
|
|
4
|
+
export { OnMultiple };
|
|
5
|
+
export { WailsEvent };
|
|
6
|
+
export { OffAll };
|
|
7
|
+
export { Emit };
|
|
8
|
+
export { Once };
|
|
9
|
+
}
|
|
10
|
+
export namespace Call {
|
|
11
|
+
export { Plugin };
|
|
12
|
+
export { ByID };
|
|
13
|
+
export { ByName };
|
|
14
|
+
}
|
|
15
|
+
export namespace Dialogs {
|
|
16
|
+
export { Info };
|
|
17
|
+
export { Error };
|
|
18
|
+
export { OpenFile };
|
|
19
|
+
export { Question };
|
|
20
|
+
export { Warning };
|
|
21
|
+
export { SaveFile };
|
|
22
|
+
}
|
|
23
|
+
import * as Application from "./application";
|
|
24
|
+
import * as Browser from "./browser";
|
|
25
|
+
import * as Clipboard from "./clipboard";
|
|
26
|
+
import * as ContextMenu from "./contextmenu";
|
|
27
|
+
import * as Flags from "./flags";
|
|
28
|
+
import * as Runtime from "./runtime";
|
|
29
|
+
import * as Screens from "./screens";
|
|
30
|
+
import * as System from "./system";
|
|
31
|
+
import * as Window from "./window";
|
|
32
|
+
import { On } from './events';
|
|
33
|
+
import { Off } from './events';
|
|
34
|
+
import { OnMultiple } from './events';
|
|
35
|
+
import { WailsEvent } from './events';
|
|
36
|
+
import { OffAll } from './events';
|
|
37
|
+
import { Emit } from './events';
|
|
38
|
+
import { Once } from './events';
|
|
39
|
+
import { Plugin } from "./calls";
|
|
40
|
+
import { ByID } from "./calls";
|
|
41
|
+
import { ByName } from "./calls";
|
|
42
|
+
import { Info } from "./dialogs";
|
|
43
|
+
import { Error } from "./dialogs";
|
|
44
|
+
import { OpenFile } from "./dialogs";
|
|
45
|
+
import { Question } from "./dialogs";
|
|
46
|
+
import { Warning } from "./dialogs";
|
|
47
|
+
import { SaveFile } from "./dialogs";
|
|
48
|
+
export { Application, Browser, Clipboard, ContextMenu, Flags, Runtime, Screens, System, Window };
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Creates a runtime caller function that invokes a specified method on a given object within a specified window context.
|
|
3
|
+
*
|
|
4
|
+
* @param {Object} object - The object on which the method is to be invoked.
|
|
5
|
+
* @param {string} windowName - The name of the window context in which the method should be called.
|
|
6
|
+
* @returns {Function} A runtime caller function that takes the method name and optionally arguments and invokes the method within the specified window context.
|
|
7
|
+
*/
|
|
8
|
+
export function newRuntimeCaller(object: any, windowName: string): Function;
|
|
9
|
+
/**
|
|
10
|
+
* Creates a new runtime caller with specified ID.
|
|
11
|
+
*
|
|
12
|
+
* @param {object} object - The object to invoke the method on.
|
|
13
|
+
* @param {string} windowName - The name of the window.
|
|
14
|
+
* @return {Function} - The new runtime caller function.
|
|
15
|
+
*/
|
|
16
|
+
export function newRuntimeCallerWithID(object: object, windowName: string): Function;
|
|
17
|
+
export namespace objectNames {
|
|
18
|
+
let Call: number;
|
|
19
|
+
let Clipboard: number;
|
|
20
|
+
let Application: number;
|
|
21
|
+
let Events: number;
|
|
22
|
+
let ContextMenu: number;
|
|
23
|
+
let Dialog: number;
|
|
24
|
+
let Window: number;
|
|
25
|
+
let Screens: number;
|
|
26
|
+
let System: number;
|
|
27
|
+
let Browser: number;
|
|
28
|
+
}
|
|
29
|
+
export let clientId: string;
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Gets all screens.
|
|
3
|
+
* @returns {Promise<Screen[]>} A promise that resolves to an array of Screen objects.
|
|
4
|
+
*/
|
|
5
|
+
export function GetAll(): Promise<Screen[]>;
|
|
6
|
+
/**
|
|
7
|
+
* Gets the primary screen.
|
|
8
|
+
* @returns {Promise<Screen>} A promise that resolves to the primary screen.
|
|
9
|
+
*/
|
|
10
|
+
export function GetPrimary(): Promise<Screen>;
|
|
11
|
+
/**
|
|
12
|
+
* Gets the current active screen.
|
|
13
|
+
*
|
|
14
|
+
* @returns {Promise<Screen>} A promise that resolves with the current active screen.
|
|
15
|
+
*/
|
|
16
|
+
export function GetCurrent(): Promise<Screen>;
|
|
17
|
+
export type Screen = any;
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @function
|
|
3
|
+
* Retrieves the system dark mode status.
|
|
4
|
+
* @returns {Promise<boolean>} - A promise that resolves to a boolean value indicating if the system is in dark mode.
|
|
5
|
+
*/
|
|
6
|
+
export function IsDarkMode(): Promise<boolean>;
|
|
7
|
+
/**
|
|
8
|
+
* Fetches the capabilities of the application from the server.
|
|
9
|
+
*
|
|
10
|
+
* @async
|
|
11
|
+
* @function Capabilities
|
|
12
|
+
* @returns {Promise<Object>} A promise that resolves to an object containing the capabilities.
|
|
13
|
+
*/
|
|
14
|
+
export function Capabilities(): Promise<any>;
|
|
15
|
+
/**
|
|
16
|
+
* @typedef {object} EnvironmentInfo
|
|
17
|
+
* @property {string} OS - The operating system in use.
|
|
18
|
+
* @property {string} Arch - The architecture of the system.
|
|
19
|
+
*/
|
|
20
|
+
/**
|
|
21
|
+
* @function
|
|
22
|
+
* Retrieves environment details.
|
|
23
|
+
* @returns {Promise<EnvironmentInfo>} - A promise that resolves to an object containing OS and system architecture.
|
|
24
|
+
*/
|
|
25
|
+
export function Environment(): Promise<EnvironmentInfo>;
|
|
26
|
+
/**
|
|
27
|
+
* Checks if the current operating system is Windows.
|
|
28
|
+
*
|
|
29
|
+
* @return {boolean} True if the operating system is Windows, otherwise false.
|
|
30
|
+
*/
|
|
31
|
+
export function IsWindows(): boolean;
|
|
32
|
+
/**
|
|
33
|
+
* Checks if the current operating system is Linux.
|
|
34
|
+
*
|
|
35
|
+
* @returns {boolean} Returns true if the current operating system is Linux, false otherwise.
|
|
36
|
+
*/
|
|
37
|
+
export function IsLinux(): boolean;
|
|
38
|
+
/**
|
|
39
|
+
* Checks if the current environment is a macOS operating system.
|
|
40
|
+
*
|
|
41
|
+
* @returns {boolean} True if the environment is macOS, false otherwise.
|
|
42
|
+
*/
|
|
43
|
+
export function IsMac(): boolean;
|
|
44
|
+
/**
|
|
45
|
+
* Checks if the current environment architecture is AMD64.
|
|
46
|
+
* @returns {boolean} True if the current environment architecture is AMD64, false otherwise.
|
|
47
|
+
*/
|
|
48
|
+
export function IsAMD64(): boolean;
|
|
49
|
+
/**
|
|
50
|
+
* Checks if the current architecture is ARM.
|
|
51
|
+
*
|
|
52
|
+
* @returns {boolean} True if the current architecture is ARM, false otherwise.
|
|
53
|
+
*/
|
|
54
|
+
export function IsARM(): boolean;
|
|
55
|
+
/**
|
|
56
|
+
* Checks if the current environment is ARM64 architecture.
|
|
57
|
+
*
|
|
58
|
+
* @returns {boolean} - Returns true if the environment is ARM64 architecture, otherwise returns false.
|
|
59
|
+
*/
|
|
60
|
+
export function IsARM64(): boolean;
|
|
61
|
+
export function IsDebug(): boolean;
|
|
62
|
+
export let invoke: any;
|
|
63
|
+
export type EnvironmentInfo = {
|
|
64
|
+
/**
|
|
65
|
+
* - The operating system in use.
|
|
66
|
+
*/
|
|
67
|
+
OS: string;
|
|
68
|
+
/**
|
|
69
|
+
* - The architecture of the system.
|
|
70
|
+
*/
|
|
71
|
+
Arch: string;
|
|
72
|
+
};
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Gets the specified window.
|
|
3
|
+
*
|
|
4
|
+
* @param {string} windowName - The name of the window to get.
|
|
5
|
+
* @return {Object} - The specified window object.
|
|
6
|
+
*/
|
|
7
|
+
export function Get(windowName: string): any;
|
|
8
|
+
/**
|
|
9
|
+
* Returns a map of all methods in the current window.
|
|
10
|
+
* @returns {Map} - A map of window methods.
|
|
11
|
+
*/
|
|
12
|
+
export function WindowMethods(targetWindow: any): Map<any, any>;
|
|
13
|
+
declare const _default: any;
|
|
14
|
+
export default _default;
|
|
15
|
+
export type Size = any;
|
|
16
|
+
export type Position = any;
|
|
17
|
+
export type Screen = any;
|
package/types/wml.d.ts
ADDED
package/types.d.ts
DELETED
|
@@ -1,130 +0,0 @@
|
|
|
1
|
-
|
|
2
|
-
export interface Button {
|
|
3
|
-
// The label of the button
|
|
4
|
-
Label?: string;
|
|
5
|
-
// True if this button is the cancel button (selected when pressing escape)
|
|
6
|
-
IsCancel?: boolean;
|
|
7
|
-
// True if this button is the default button (selected when pressing enter)
|
|
8
|
-
IsDefault?: boolean;
|
|
9
|
-
}
|
|
10
|
-
|
|
11
|
-
interface MessageDialogOptions {
|
|
12
|
-
// The title for the dialog
|
|
13
|
-
Title?: string;
|
|
14
|
-
// The message to display
|
|
15
|
-
Message?: string;
|
|
16
|
-
// The buttons to use on the dialog
|
|
17
|
-
Buttons?: Button[];
|
|
18
|
-
// Whether the dialog is detached from the current window
|
|
19
|
-
Detached?: boolean;
|
|
20
|
-
}
|
|
21
|
-
|
|
22
|
-
export interface OpenFileDialogOptions {
|
|
23
|
-
// Allows the user to be able to select directories
|
|
24
|
-
CanChooseDirectories?: boolean;
|
|
25
|
-
// Allows the user to be able to select files
|
|
26
|
-
CanChooseFiles?: boolean;
|
|
27
|
-
// Provide an option to create directories in the dialog
|
|
28
|
-
CanCreateDirectories?: boolean;
|
|
29
|
-
// Makes the dialog show hidden files
|
|
30
|
-
ShowHiddenFiles?: boolean;
|
|
31
|
-
// Whether the dialog should follow filesystem aliases
|
|
32
|
-
ResolvesAliases?: boolean;
|
|
33
|
-
// Allow the user to select multiple files or directories
|
|
34
|
-
AllowsMultipleSelection?: boolean;
|
|
35
|
-
// Hide the extension when showing the filename
|
|
36
|
-
HideExtension?: boolean;
|
|
37
|
-
// Allow the user to select files where the system hides their extensions
|
|
38
|
-
CanSelectHiddenExtension?: boolean;
|
|
39
|
-
// Treats file packages as directories, e.g. .app on macOS
|
|
40
|
-
TreatsFilePackagesAsDirectories?: boolean;
|
|
41
|
-
// Allows selection of filetypes not specified in the filters
|
|
42
|
-
AllowsOtherFiletypes?: boolean;
|
|
43
|
-
// The file filters to use in the dialog
|
|
44
|
-
Filters?: FileFilter[];
|
|
45
|
-
// The title of the dialog
|
|
46
|
-
Title?: string;
|
|
47
|
-
// The message to display
|
|
48
|
-
Message?: string;
|
|
49
|
-
// The label for the select button
|
|
50
|
-
ButtonText?: string;
|
|
51
|
-
// The default directory to open the dialog in
|
|
52
|
-
Directory?: string;
|
|
53
|
-
// Whether the dialog is detached from the current window
|
|
54
|
-
Detached?: boolean;
|
|
55
|
-
}
|
|
56
|
-
export interface FileFilter {
|
|
57
|
-
// The display name for the filter, e.g. "Text Files"
|
|
58
|
-
DisplayName?: string;
|
|
59
|
-
// The pattern to use for the filter, e.g. "*.txt;*.md"
|
|
60
|
-
Pattern?: string;
|
|
61
|
-
}
|
|
62
|
-
export interface SaveFileDialogOptions {
|
|
63
|
-
// Provide an option to create directories in the dialog
|
|
64
|
-
CanCreateDirectories?: boolean;
|
|
65
|
-
// Makes the dialog show hidden files
|
|
66
|
-
ShowHiddenFiles?: boolean;
|
|
67
|
-
// Allow the user to select files where the system hides their extensions
|
|
68
|
-
CanSelectHiddenExtension?: boolean;
|
|
69
|
-
// Allows selection of filetypes not specified in the filters
|
|
70
|
-
AllowOtherFiletypes?: boolean;
|
|
71
|
-
// Hide the extension when showing the filename
|
|
72
|
-
HideExtension?: boolean;
|
|
73
|
-
// Treats file packages as directories, e.g. .app on macOS
|
|
74
|
-
TreatsFilePackagesAsDirectories?: boolean;
|
|
75
|
-
// The message to show in the dialog
|
|
76
|
-
Message?: string;
|
|
77
|
-
// The default directory to open the dialog in
|
|
78
|
-
Directory?: string;
|
|
79
|
-
// The default filename to use in the dialog
|
|
80
|
-
Filename?: string;
|
|
81
|
-
// The label for the select button
|
|
82
|
-
ButtonText?: string;
|
|
83
|
-
// Whether the dialog is detached from the current window
|
|
84
|
-
Detached?: boolean;
|
|
85
|
-
}
|
|
86
|
-
|
|
87
|
-
export interface Screen {
|
|
88
|
-
// The screen ID
|
|
89
|
-
Id: string;
|
|
90
|
-
// The screen name
|
|
91
|
-
Name: string;
|
|
92
|
-
// The screen scale. 1 = standard resolution, 2: 2x retina, etc.
|
|
93
|
-
Scale: number;
|
|
94
|
-
// The X position of the screen
|
|
95
|
-
X: number;
|
|
96
|
-
// The Y position of the screen
|
|
97
|
-
Y: number;
|
|
98
|
-
// The width and height of the screen
|
|
99
|
-
Size: Size;
|
|
100
|
-
// The bounds of the screen
|
|
101
|
-
Bounds: Rect;
|
|
102
|
-
// The work area of the screen
|
|
103
|
-
WorkArea: Rect;
|
|
104
|
-
// True if this is the primary screen
|
|
105
|
-
IsPrimary: boolean;
|
|
106
|
-
// The rotation of the screen
|
|
107
|
-
Rotation: number;
|
|
108
|
-
}
|
|
109
|
-
export interface Rect {
|
|
110
|
-
X: number;
|
|
111
|
-
Y: number;
|
|
112
|
-
Width: number;
|
|
113
|
-
Height: number;
|
|
114
|
-
}
|
|
115
|
-
|
|
116
|
-
export interface WailsEvent {
|
|
117
|
-
// The name of the event
|
|
118
|
-
Name: string;
|
|
119
|
-
// The data associated with the event
|
|
120
|
-
Data?: any;
|
|
121
|
-
}
|
|
122
|
-
|
|
123
|
-
export interface Size {
|
|
124
|
-
Width: number;
|
|
125
|
-
Height: number;
|
|
126
|
-
}
|
|
127
|
-
export interface Position {
|
|
128
|
-
X: number;
|
|
129
|
-
Y: number;
|
|
130
|
-
}
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
/package/{drag.js → src/drag.js}
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|