@wailsio/runtime 3.0.0-alpha.27 → 3.0.0-alpha.29

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 CHANGED
@@ -1,12 +1,18 @@
1
1
  {
2
2
  "name": "@wailsio/runtime",
3
- "version": "3.0.0-alpha.27",
3
+ "type": "module",
4
+ "version": "3.0.0-alpha.29",
4
5
  "description": "Wails Runtime",
5
- "main": "src/index.js",
6
- "types": "types/index.d.ts",
6
+ "exports": {
7
+ ".": {
8
+ "types": "./types/index.d.ts",
9
+ "require": "./src/index.js",
10
+ "import": "./src/index.js"
11
+ }
12
+ },
7
13
  "repository": {
8
14
  "type": "git",
9
- "url": "https://github.com/wailsapp/wails.git"
15
+ "url": "git+https://github.com/wailsapp/wails.git"
10
16
  },
11
17
  "scripts": {
12
18
  "prebuild:types": "rimraf ./types",
package/src/screens.js CHANGED
@@ -16,7 +16,6 @@ The electron alternative for Go
16
16
  * @property {number} Height - The height.
17
17
  */
18
18
 
19
-
20
19
  /**
21
20
  * @typedef {Object} Rect
22
21
  * @property {number} X - The X coordinate of the origin.
@@ -25,10 +24,9 @@ The electron alternative for Go
25
24
  * @property {number} Height - The height of the rectangle.
26
25
  */
27
26
 
28
-
29
27
  /**
30
28
  * @typedef {Object} Screen
31
- * @property {string} Id - Unique identifier for the screen.
29
+ * @property {string} ID - Unique identifier for the screen.
32
30
  * @property {string} Name - Human readable name of the screen.
33
31
  * @property {number} ScaleFactor - The scale factor of the screen (DPI/96). 1 = standard DPI, 2 = HiDPI (Retina), etc.
34
32
  * @property {number} X - The X coordinate of the screen.
@@ -42,9 +40,8 @@ The electron alternative for Go
42
40
  * @property {number} Rotation - The rotation of the screen.
43
41
  */
44
42
 
45
-
46
- import {newRuntimeCallerWithID, objectNames} from "./runtime";
47
- const call = newRuntimeCallerWithID(objectNames.Screens, '');
43
+ import { newRuntimeCallerWithID, objectNames } from "./runtime";
44
+ const call = newRuntimeCallerWithID(objectNames.Screens, "");
48
45
 
49
46
  const getAll = 0;
50
47
  const getPrimary = 1;
package/src/system.js CHANGED
@@ -15,11 +15,26 @@ let call = newRuntimeCallerWithID(objectNames.System, '');
15
15
  const systemIsDarkMode = 0;
16
16
  const environment = 1;
17
17
 
18
- export function invoke(msg) {
19
- if(window.chrome) {
20
- return window.chrome.webview.postMessage(msg);
18
+ const _invoke = (() => {
19
+ try {
20
+ if(window?.chrome?.webview) {
21
+ return (msg) => window.chrome.webview.postMessage(msg);
22
+ }
23
+ if(window?.webkit?.messageHandlers?.external) {
24
+ return (msg) => window.webkit.messageHandlers.external.postMessage(msg);
25
+ }
26
+ } catch(e) {
27
+ 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://v3alpha.wails.io/learn/build/#using-a-browser-for-development\n',
28
+ 'background: #ffffff; color: #000000; font-weight: bold; padding: 4px 8px; border-radius: 4px; border: 2px solid #000000;',
29
+ 'background: transparent;',
30
+ 'color: #ffffff; font-style: italic; font-weight: bold;');
21
31
  }
22
- return window.webkit.messageHandlers.external.postMessage(msg);
32
+ return null;
33
+ })();
34
+
35
+ export function invoke(msg) {
36
+ if (!_invoke) return;
37
+ return _invoke(msg);
23
38
  }
24
39
 
25
40
  /**
@@ -46,7 +46,7 @@ export type Screen = {
46
46
  /**
47
47
  * - Unique identifier for the screen.
48
48
  */
49
- Id: string;
49
+ ID: string;
50
50
  /**
51
51
  * - Human readable name of the screen.
52
52
  */