@wailsio/runtime 3.0.0-alpha.95 → 3.0.0-alpha.97
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/dist/calls.js +4 -15
- package/dist/create.js +7 -0
- package/dist/event_types.js +1 -0
- package/dist/runtime.js +34 -0
- package/dist/window.js +2 -2
- package/package.json +2 -1
- package/types/calls.d.ts +1 -12
- package/types/create.d.ts +5 -0
- package/types/event_types.d.ts +1 -0
- package/types/runtime.d.ts +12 -0
- package/types/window.d.ts +2 -2
package/dist/calls.js
CHANGED
|
@@ -20,21 +20,10 @@ const cancelCall = newRuntimeCaller(objectNames.CancelCall);
|
|
|
20
20
|
const callResponses = new Map();
|
|
21
21
|
const CallBinding = 0;
|
|
22
22
|
const CancelMethod = 0;
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
export class RuntimeError extends Error {
|
|
28
|
-
/**
|
|
29
|
-
* Constructs a new RuntimeError instance.
|
|
30
|
-
* @param message - The error message.
|
|
31
|
-
* @param options - Options to be forwarded to the Error constructor.
|
|
32
|
-
*/
|
|
33
|
-
constructor(message, options) {
|
|
34
|
-
super(message, options);
|
|
35
|
-
this.name = "RuntimeError";
|
|
36
|
-
}
|
|
37
|
-
}
|
|
23
|
+
// runtime.js needs to use RuntimeError internally to properly parse and return
|
|
24
|
+
// errors for binding calls, so it had to move there. Exporting here again to
|
|
25
|
+
// keep from breaking the public Call interface.
|
|
26
|
+
export { RuntimeError } from "./runtime.js";
|
|
38
27
|
/**
|
|
39
28
|
* Generates a unique ID using the nanoid library.
|
|
40
29
|
*
|
package/dist/create.js
CHANGED
|
@@ -92,6 +92,13 @@ export function Struct(createField) {
|
|
|
92
92
|
return source;
|
|
93
93
|
};
|
|
94
94
|
}
|
|
95
|
+
/**
|
|
96
|
+
* DateFromTime is a creation function that converts RFC3339 strings
|
|
97
|
+
* (from Go's time.Time JSON marshaling) to JavaScript Date objects.
|
|
98
|
+
*/
|
|
99
|
+
export function DateFromTime(source) {
|
|
100
|
+
return new Date(source);
|
|
101
|
+
}
|
|
95
102
|
/**
|
|
96
103
|
* Maps known event names to creation functions for their data types.
|
|
97
104
|
* Will be monkey-patched by the binding generator.
|
package/dist/event_types.js
CHANGED
|
@@ -193,6 +193,7 @@ export const Types = Object.freeze({
|
|
|
193
193
|
WindowZoomIn: "mac:WindowZoomIn",
|
|
194
194
|
WindowZoomOut: "mac:WindowZoomOut",
|
|
195
195
|
WindowZoomReset: "mac:WindowZoomReset",
|
|
196
|
+
WebViewWebContentProcessDidTerminate: "mac:WebViewWebContentProcessDidTerminate",
|
|
196
197
|
}),
|
|
197
198
|
Linux: Object.freeze({
|
|
198
199
|
ApplicationStartup: "linux:ApplicationStartup",
|
package/dist/runtime.js
CHANGED
|
@@ -19,6 +19,21 @@ function runtimeURL() {
|
|
|
19
19
|
const CHUNK_THRESHOLD = 512 * 1024;
|
|
20
20
|
// Re-export nanoid for custom transport implementations
|
|
21
21
|
export { nanoid };
|
|
22
|
+
/**
|
|
23
|
+
* Exception class that will be thrown in case the bound method returns an error.
|
|
24
|
+
* The value of the {@link RuntimeError#name} property is "RuntimeError".
|
|
25
|
+
*/
|
|
26
|
+
export class RuntimeError extends Error {
|
|
27
|
+
/**
|
|
28
|
+
* Constructs a new RuntimeError instance.
|
|
29
|
+
* @param message - The error message.
|
|
30
|
+
* @param options - Options to be forwarded to the Error constructor.
|
|
31
|
+
*/
|
|
32
|
+
constructor(message, options) {
|
|
33
|
+
super(message, options);
|
|
34
|
+
this.name = "RuntimeError";
|
|
35
|
+
}
|
|
36
|
+
}
|
|
22
37
|
// Object Names
|
|
23
38
|
export const objectNames = Object.freeze({
|
|
24
39
|
Call: 0,
|
|
@@ -112,6 +127,25 @@ async function runtimeCallWithID(objectID, method, windowName, args) {
|
|
|
112
127
|
response = await fetch(url, { method: 'POST', headers, body: bodyStr });
|
|
113
128
|
}
|
|
114
129
|
if (!response.ok) {
|
|
130
|
+
const ct = response.headers.get("Content-Type");
|
|
131
|
+
if (ct === null || ct === void 0 ? void 0 : ct.includes("application/json")) {
|
|
132
|
+
const json = await response.json();
|
|
133
|
+
let err;
|
|
134
|
+
switch (json.kind) {
|
|
135
|
+
case "ReferenceError":
|
|
136
|
+
err = new ReferenceError(json.message);
|
|
137
|
+
break;
|
|
138
|
+
case "TypeError":
|
|
139
|
+
err = new TypeError(json.message);
|
|
140
|
+
break;
|
|
141
|
+
case "RuntimeError":
|
|
142
|
+
err = new RuntimeError(json.message);
|
|
143
|
+
break;
|
|
144
|
+
default: err = new Error(json.message);
|
|
145
|
+
}
|
|
146
|
+
err.cause = json.cause;
|
|
147
|
+
throw err;
|
|
148
|
+
}
|
|
115
149
|
throw new Error(await response.text());
|
|
116
150
|
}
|
|
117
151
|
if (((_b = (_a = response.headers.get("Content-Type")) === null || _a === void 0 ? void 0 : _a.indexOf("application/json")) !== null && _b !== void 0 ? _b : -1) !== -1) {
|
package/dist/window.js
CHANGED
|
@@ -540,8 +540,8 @@ class Window {
|
|
|
540
540
|
* Gathers information about the drop target element and sends it back to the Go backend.
|
|
541
541
|
*
|
|
542
542
|
* @param filenames - An array of file paths (strings) that were dropped.
|
|
543
|
-
* @param x - The x-coordinate of the drop event (CSS pixels
|
|
544
|
-
* @param y - The y-coordinate of the drop event (CSS pixels
|
|
543
|
+
* @param x - The x-coordinate of the drop event, in logical (CSS) pixels relative to the webview.
|
|
544
|
+
* @param y - The y-coordinate of the drop event, in logical (CSS) pixels relative to the webview.
|
|
545
545
|
*/
|
|
546
546
|
HandlePlatformFileDrop(filenames, x, y) {
|
|
547
547
|
var _a, _b;
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@wailsio/runtime",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "3.0.0-alpha.
|
|
4
|
+
"version": "3.0.0-alpha.97",
|
|
5
5
|
"description": "Wails Runtime",
|
|
6
6
|
"types": "types/index.d.ts",
|
|
7
7
|
"exports": {
|
|
@@ -48,6 +48,7 @@
|
|
|
48
48
|
"prepack": "npm run build"
|
|
49
49
|
},
|
|
50
50
|
"devDependencies": {
|
|
51
|
+
"esbuild": "0.28.1",
|
|
51
52
|
"happy-dom": "^20.9.0",
|
|
52
53
|
"promises-aplus-tests": "2.1.2",
|
|
53
54
|
"rimraf": "^6.0.1",
|
package/types/calls.d.ts
CHANGED
|
@@ -18,18 +18,7 @@ export type CallOptions = {
|
|
|
18
18
|
/** Arguments to be passed into the bound method. */
|
|
19
19
|
args: any[];
|
|
20
20
|
};
|
|
21
|
-
|
|
22
|
-
* Exception class that will be thrown in case the bound method returns an error.
|
|
23
|
-
* The value of the {@link RuntimeError#name} property is "RuntimeError".
|
|
24
|
-
*/
|
|
25
|
-
export declare class RuntimeError extends Error {
|
|
26
|
-
/**
|
|
27
|
-
* Constructs a new RuntimeError instance.
|
|
28
|
-
* @param message - The error message.
|
|
29
|
-
* @param options - Options to be forwarded to the Error constructor.
|
|
30
|
-
*/
|
|
31
|
-
constructor(message?: string, options?: ErrorOptions);
|
|
32
|
-
}
|
|
21
|
+
export { RuntimeError } from "./runtime.js";
|
|
33
22
|
/**
|
|
34
23
|
* Call a bound method according to the given call options.
|
|
35
24
|
*
|
package/types/create.d.ts
CHANGED
|
@@ -29,6 +29,11 @@ export declare function Nullable<T = any>(element: (source: any) => T): (source:
|
|
|
29
29
|
* and returns an in-place creation function for a struct.
|
|
30
30
|
*/
|
|
31
31
|
export declare function Struct(createField: Record<string, (source: any) => any>): <U extends Record<string, any> = any>(source: any) => U;
|
|
32
|
+
/**
|
|
33
|
+
* DateFromTime is a creation function that converts RFC3339 strings
|
|
34
|
+
* (from Go's time.Time JSON marshaling) to JavaScript Date objects.
|
|
35
|
+
*/
|
|
36
|
+
export declare function DateFromTime(source: any): Date;
|
|
32
37
|
/**
|
|
33
38
|
* Maps known event names to creation functions for their data types.
|
|
34
39
|
* Will be monkey-patched by the binding generator.
|
package/types/event_types.d.ts
CHANGED
|
@@ -182,6 +182,7 @@ export declare const Types: Readonly<{
|
|
|
182
182
|
WindowZoomIn: "mac:WindowZoomIn";
|
|
183
183
|
WindowZoomOut: "mac:WindowZoomOut";
|
|
184
184
|
WindowZoomReset: "mac:WindowZoomReset";
|
|
185
|
+
WebViewWebContentProcessDidTerminate: "mac:WebViewWebContentProcessDidTerminate";
|
|
185
186
|
}>;
|
|
186
187
|
Linux: Readonly<{
|
|
187
188
|
ApplicationStartup: "linux:ApplicationStartup";
|
package/types/runtime.d.ts
CHANGED
|
@@ -1,5 +1,17 @@
|
|
|
1
1
|
import { nanoid } from "./nanoid.js";
|
|
2
2
|
export { nanoid };
|
|
3
|
+
/**
|
|
4
|
+
* Exception class that will be thrown in case the bound method returns an error.
|
|
5
|
+
* The value of the {@link RuntimeError#name} property is "RuntimeError".
|
|
6
|
+
*/
|
|
7
|
+
export declare class RuntimeError extends Error {
|
|
8
|
+
/**
|
|
9
|
+
* Constructs a new RuntimeError instance.
|
|
10
|
+
* @param message - The error message.
|
|
11
|
+
* @param options - Options to be forwarded to the Error constructor.
|
|
12
|
+
*/
|
|
13
|
+
constructor(message?: string, options?: ErrorOptions);
|
|
14
|
+
}
|
|
3
15
|
export declare const objectNames: Readonly<{
|
|
4
16
|
Call: 0;
|
|
5
17
|
Clipboard: 1;
|
package/types/window.d.ts
CHANGED
|
@@ -308,8 +308,8 @@ declare class Window {
|
|
|
308
308
|
* Gathers information about the drop target element and sends it back to the Go backend.
|
|
309
309
|
*
|
|
310
310
|
* @param filenames - An array of file paths (strings) that were dropped.
|
|
311
|
-
* @param x - The x-coordinate of the drop event (CSS pixels
|
|
312
|
-
* @param y - The y-coordinate of the drop event (CSS pixels
|
|
311
|
+
* @param x - The x-coordinate of the drop event, in logical (CSS) pixels relative to the webview.
|
|
312
|
+
* @param y - The y-coordinate of the drop event, in logical (CSS) pixels relative to the webview.
|
|
313
313
|
*/
|
|
314
314
|
HandlePlatformFileDrop(filenames: string[], x: number, y: number): void;
|
|
315
315
|
/**
|