@wailsio/runtime 3.0.0-alpha.20 → 3.0.0-alpha.22

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.
Files changed (132) hide show
  1. package/docs/{functions/Window.Size.html → assets/icons.js} +15 -2
  2. package/docs/assets/icons.svg +1 -0
  3. package/docs/assets/main.js +4 -4
  4. package/docs/assets/navigation.js +1 -1
  5. package/docs/assets/search.js +1 -1
  6. package/docs/assets/style.css +2 -1
  7. package/docs/classes/Events.WailsEvent.html +4 -4
  8. package/docs/functions/Application.Hide.html +2 -2
  9. package/docs/functions/Application.Quit.html +2 -2
  10. package/docs/functions/Application.Show.html +2 -2
  11. package/docs/functions/Browser.OpenURL.html +3 -3
  12. package/docs/functions/Call.ByID.html +4 -4
  13. package/docs/functions/Call.ByName.html +4 -4
  14. package/docs/functions/Call.Call.html +3 -3
  15. package/docs/functions/Call.Plugin.html +5 -5
  16. package/docs/functions/Clipboard.SetText.html +3 -3
  17. package/docs/functions/Clipboard.Text.html +2 -2
  18. package/docs/functions/Dialogs.Error.html +2 -2
  19. package/docs/functions/Dialogs.Info.html +2 -2
  20. package/docs/functions/Dialogs.OpenFile.html +2 -2
  21. package/docs/functions/Dialogs.Question.html +2 -2
  22. package/docs/functions/Dialogs.SaveFile.html +2 -2
  23. package/docs/functions/Dialogs.Warning.html +2 -2
  24. package/docs/functions/Events.Emit.html +3 -3
  25. package/docs/functions/Events.Off.html +4 -4
  26. package/docs/functions/Events.OffAll.html +2 -2
  27. package/docs/functions/Events.On.html +4 -4
  28. package/docs/functions/Events.OnMultiple.html +5 -5
  29. package/docs/functions/Events.Once.html +4 -4
  30. package/docs/functions/Events.setup.html +1 -1
  31. package/docs/functions/Flags.GetFlag.html +3 -3
  32. package/docs/functions/Screens.GetAll.html +3 -3
  33. package/docs/functions/Screens.GetCurrent.html +3 -3
  34. package/docs/functions/Screens.GetPrimary.html +3 -3
  35. package/docs/functions/System.Capabilities.html +2 -2
  36. package/docs/functions/System.Environment.html +2 -2
  37. package/docs/functions/System.IsAMD64.html +2 -2
  38. package/docs/functions/System.IsARM.html +2 -2
  39. package/docs/functions/System.IsARM64.html +2 -2
  40. package/docs/functions/System.IsDarkMode.html +2 -2
  41. package/docs/functions/System.IsDebug.html +1 -1
  42. package/docs/functions/System.IsLinux.html +2 -2
  43. package/docs/functions/System.IsMac.html +2 -2
  44. package/docs/functions/System.IsWindows.html +2 -2
  45. package/docs/functions/System.invoke.html +1 -1
  46. package/docs/functions/WML.Enable.html +2 -0
  47. package/docs/functions/WML.Reload.html +2 -2
  48. package/docs/index.html +2 -2
  49. package/docs/interfaces/Dialogs.Button.html +7 -7
  50. package/docs/interfaces/Dialogs.FileFilter.html +5 -5
  51. package/docs/interfaces/Dialogs.MessageDialogOptions.html +9 -9
  52. package/docs/interfaces/Dialogs.OpenFileDialogOptions.html +33 -33
  53. package/docs/interfaces/Dialogs.SaveFileDialogOptions.html +35 -35
  54. package/docs/interfaces/Screens.Position.html +5 -5
  55. package/docs/interfaces/Screens.Rect.html +9 -9
  56. package/docs/interfaces/Screens.Screen.html +19 -19
  57. package/docs/interfaces/Screens.Size.html +5 -5
  58. package/docs/interfaces/System.EnvironmentInfo.html +11 -5
  59. package/docs/interfaces/System.OSInfo.html +9 -0
  60. package/docs/modules/Application.html +4 -4
  61. package/docs/modules/Browser.html +2 -2
  62. package/docs/modules/Call.html +5 -5
  63. package/docs/modules/Clipboard.html +3 -3
  64. package/docs/modules/Dialogs.html +12 -12
  65. package/docs/modules/Events.html +10 -10
  66. package/docs/modules/Flags.html +2 -2
  67. package/docs/modules/Screens.html +8 -9
  68. package/docs/modules/System.html +14 -13
  69. package/docs/modules/WML.html +3 -2
  70. package/docs/modules.html +12 -12
  71. package/docs/variables/Events.Types.html +1 -1
  72. package/docs/variables/Window.html +2 -0
  73. package/package.json +34 -31
  74. package/src/application.js +46 -46
  75. package/src/browser.js +24 -24
  76. package/src/calls.js +180 -161
  77. package/src/clipboard.js +35 -35
  78. package/src/contextmenu.js +97 -97
  79. package/src/dialogs.js +200 -200
  80. package/src/drag.js +119 -125
  81. package/src/event_types.js +5 -0
  82. package/src/events.js +140 -140
  83. package/src/flags.js +25 -25
  84. package/src/index.js +46 -95
  85. package/src/runtime.js +123 -122
  86. package/src/screens.js +77 -83
  87. package/src/system.js +128 -117
  88. package/src/utils.js +86 -0
  89. package/src/window.js +638 -316
  90. package/src/wml.js +250 -171
  91. package/tsconfig.json +19 -19
  92. package/types/event_types.d.ts +5 -0
  93. package/types/events.d.ts +5 -0
  94. package/types/index.d.ts +2 -2
  95. package/types/runtime.d.ts +1 -0
  96. package/types/screens.d.ts +1 -5
  97. package/types/system.d.ts +44 -4
  98. package/types/utils.d.ts +14 -0
  99. package/types/window.d.ts +400 -133
  100. package/types/wml.d.ts +6 -0
  101. package/docs/functions/Window.Center.html +0 -2
  102. package/docs/functions/Window.Close.html +0 -2
  103. package/docs/functions/Window.Fullscreen.html +0 -2
  104. package/docs/functions/Window.Get.html +0 -6
  105. package/docs/functions/Window.GetZoomLevel.html +0 -2
  106. package/docs/functions/Window.Height.html +0 -2
  107. package/docs/functions/Window.Hide.html +0 -2
  108. package/docs/functions/Window.Maximise.html +0 -2
  109. package/docs/functions/Window.Minimise.html +0 -2
  110. package/docs/functions/Window.RelativePosition.html +0 -2
  111. package/docs/functions/Window.Restore.html +0 -2
  112. package/docs/functions/Window.Screen-1.html +0 -2
  113. package/docs/functions/Window.SetAlwaysOnTop.html +0 -3
  114. package/docs/functions/Window.SetBackgroundColour.html +0 -6
  115. package/docs/functions/Window.SetMaxSize.html +0 -4
  116. package/docs/functions/Window.SetMinSize.html +0 -4
  117. package/docs/functions/Window.SetRelativePosition.html +0 -4
  118. package/docs/functions/Window.SetResizable.html +0 -3
  119. package/docs/functions/Window.SetSize.html +0 -4
  120. package/docs/functions/Window.SetTitle.html +0 -3
  121. package/docs/functions/Window.SetZoomLevel.html +0 -3
  122. package/docs/functions/Window.Show.html +0 -2
  123. package/docs/functions/Window.ToggleMaximise.html +0 -2
  124. package/docs/functions/Window.UnMaximise.html +0 -2
  125. package/docs/functions/Window.UnMinimise.html +0 -2
  126. package/docs/functions/Window.Width.html +0 -2
  127. package/docs/functions/Window.ZoomIn.html +0 -2
  128. package/docs/functions/Window.ZoomOut.html +0 -2
  129. package/docs/functions/Window.ZoomReset.html +0 -2
  130. package/docs/modules/Window.html +0 -32
  131. package/docs/types/Screens.Rotation.html +0 -2
  132. package/src/log.js +0 -13
package/src/wml.js CHANGED
@@ -1,171 +1,250 @@
1
-
2
- import {Emit, WailsEvent} from "./events";
3
- import {Question} from "./dialogs";
4
- import {Get} from "./window";
5
- import {OpenURL} from "./browser";
6
-
7
- /**
8
- * Sends an event with the given name and optional data.
9
- *
10
- * @param {string} eventName - The name of the event to send.
11
- * @param {any} [data=null] - Optional data to send along with the event.
12
- *
13
- * @return {void}
14
- */
15
- function sendEvent(eventName, data=null) {
16
- let event = new WailsEvent(eventName, data);
17
- Emit(event);
18
- }
19
-
20
- /**
21
- * Adds event listeners to elements with `wml-event` attribute.
22
- *
23
- * @return {void}
24
- */
25
- function addWMLEventListeners() {
26
- const elements = document.querySelectorAll('[wml-event]');
27
- elements.forEach(function (element) {
28
- const eventType = element.getAttribute('wml-event');
29
- const confirm = element.getAttribute('wml-confirm');
30
- const trigger = element.getAttribute('wml-trigger') || "click";
31
-
32
- let callback = function () {
33
- if (confirm) {
34
- Question({Title: "Confirm", Message:confirm, Detached: false, Buttons:[{Label:"Yes"},{Label:"No", IsDefault:true}]}).then(function (result) {
35
- if (result !== "No") {
36
- sendEvent(eventType);
37
- }
38
- });
39
- return;
40
- }
41
- sendEvent(eventType);
42
- };
43
-
44
- // Remove existing listeners
45
- element.removeEventListener(trigger, callback);
46
-
47
- // Add new listener
48
- element.addEventListener(trigger, callback);
49
- });
50
- }
51
-
52
-
53
- /**
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.
57
- */
58
- function callWindowMethod(windowName, method) {
59
- let targetWindow = Get(windowName);
60
- let methodMap = WindowMethods(targetWindow);
61
- if (!methodMap.has(method)) {
62
- console.log("Window method " + method + " not found");
63
- }
64
- try {
65
- methodMap.get(method)();
66
- } catch (e) {
67
- console.error("Error calling window method '" + method + "': " + e);
68
- }
69
- }
70
-
71
- /**
72
- * Adds window listeners for elements with the 'wml-window' attribute.
73
- * Removes any existing listeners before adding new ones.
74
- *
75
- * @return {void}
76
- */
77
- function addWMLWindowListeners() {
78
- const elements = document.querySelectorAll('[wml-window]');
79
- elements.forEach(function (element) {
80
- const windowMethod = element.getAttribute('wml-window');
81
- const confirm = element.getAttribute('wml-confirm');
82
- const trigger = element.getAttribute('wml-trigger') || 'click';
83
- const targetWindow = element.getAttribute('wml-target-window') || '';
84
-
85
- let callback = function () {
86
- if (confirm) {
87
- Question({Title: "Confirm", Message:confirm, Buttons:[{Label:"Yes"},{Label:"No", IsDefault:true}]}).then(function (result) {
88
- if (result !== "No") {
89
- callWindowMethod(targetWindow, windowMethod);
90
- }
91
- });
92
- return;
93
- }
94
- callWindowMethod(targetWindow, windowMethod);
95
- };
96
-
97
- // Remove existing listeners
98
- element.removeEventListener(trigger, callback);
99
-
100
- // Add new listener
101
- element.addEventListener(trigger, callback);
102
- });
103
- }
104
-
105
- /**
106
- * Adds a listener to elements with the 'wml-openurl' attribute.
107
- * When the specified trigger event is fired on any of these elements,
108
- * the listener will open the URL specified by the 'wml-openurl' attribute.
109
- * If a 'wml-confirm' attribute is provided, a confirmation dialog will be displayed,
110
- * and the URL will only be opened if the user confirms.
111
- *
112
- * @return {void}
113
- */
114
- function addWMLOpenBrowserListener() {
115
- const elements = document.querySelectorAll('[wml-openurl]');
116
- elements.forEach(function (element) {
117
- const url = element.getAttribute('wml-openurl');
118
- const confirm = element.getAttribute('wml-confirm');
119
- const trigger = element.getAttribute('wml-trigger') || "click";
120
-
121
- let callback = function () {
122
- if (confirm) {
123
- Question({Title: "Confirm", Message:confirm, Buttons:[{Label:"Yes"},{Label:"No", IsDefault:true}]}).then(function (result) {
124
- if (result !== "No") {
125
- void OpenURL(url);
126
- }
127
- });
128
- return;
129
- }
130
- void OpenURL(url);
131
- };
132
-
133
- // Remove existing listeners
134
- element.removeEventListener(trigger, callback);
135
-
136
- // Add new listener
137
- element.addEventListener(trigger, callback);
138
- });
139
- }
140
-
141
- /**
142
- * Reloads the WML page by adding necessary event listeners and browser listeners.
143
- *
144
- * @return {void}
145
- */
146
- export function Reload() {
147
- addWMLEventListeners();
148
- addWMLWindowListeners();
149
- addWMLOpenBrowserListener();
150
- }
151
-
152
- /**
153
- * Returns a map of all methods in the current window.
154
- * @returns {Map} - A map of window methods.
155
- */
156
- function WindowMethods(targetWindow) {
157
- // Create a new map to store methods
158
- let result = new Map();
159
-
160
- // Iterate over all properties of the window object
161
- for (let method in targetWindow) {
162
- // Check if the property is indeed a method (function)
163
- if(typeof targetWindow[method] === 'function') {
164
- // Add the method to the map
165
- result.set(method, targetWindow[method]);
166
- }
167
-
168
- }
169
- // Return the map of window methods
170
- return result;
171
- }
1
+ /*
2
+ _ __ _ __
3
+ | | / /___ _(_) /____
4
+ | | /| / / __ `/ / / ___/
5
+ | |/ |/ / /_/ / / (__ )
6
+ |__/|__/\__,_/_/_/____/
7
+ The electron alternative for Go
8
+ (c) Lea Anthony 2019-present
9
+ */
10
+
11
+ import {OpenURL} from "./browser";
12
+ import {Question} from "./dialogs";
13
+ import {Emit, WailsEvent} from "./events";
14
+ import {canAbortListeners, whenReady} from "./utils";
15
+ import Window from "./window";
16
+
17
+ /**
18
+ * Sends an event with the given name and optional data.
19
+ *
20
+ * @param {string} eventName - The name of the event to send.
21
+ * @param {any} [data=null] - Optional data to send along with the event.
22
+ *
23
+ * @return {void}
24
+ */
25
+ function sendEvent(eventName, data=null) {
26
+ Emit(new WailsEvent(eventName, data));
27
+ }
28
+
29
+ /**
30
+ * Calls a method on a specified window.
31
+ * @param {string} windowName - The name of the window to call the method on.
32
+ * @param {string} methodName - The name of the method to call.
33
+ */
34
+ function callWindowMethod(windowName, methodName) {
35
+ const targetWindow = Window.Get(windowName);
36
+ const method = targetWindow[methodName];
37
+
38
+ if (typeof method !== "function") {
39
+ console.error(`Window method '${methodName}' not found`);
40
+ return;
41
+ }
42
+
43
+ try {
44
+ method.call(targetWindow);
45
+ } catch (e) {
46
+ console.error(`Error calling window method '${methodName}': `, e);
47
+ }
48
+ }
49
+
50
+ /**
51
+ * Responds to a triggering event by running appropriate WML actions for the current target
52
+ *
53
+ * @param {Event} ev
54
+ * @return {void}
55
+ */
56
+ function onWMLTriggered(ev) {
57
+ const element = ev.currentTarget;
58
+
59
+ function runEffect(choice = "Yes") {
60
+ if (choice !== "Yes")
61
+ return;
62
+
63
+ const eventType = element.getAttribute('wml-event');
64
+ const targetWindow = element.getAttribute('wml-target-window') || "";
65
+ const windowMethod = element.getAttribute('wml-window');
66
+ const url = element.getAttribute('wml-openurl');
67
+
68
+ if (eventType !== null)
69
+ sendEvent(eventType);
70
+ if (windowMethod !== null)
71
+ callWindowMethod(targetWindow, windowMethod);
72
+ if (url !== null)
73
+ void OpenURL(url);
74
+ }
75
+
76
+ const confirm = element.getAttribute('wml-confirm');
77
+
78
+ if (confirm) {
79
+ Question({
80
+ Title: "Confirm",
81
+ Message: confirm,
82
+ Detached: false,
83
+ Buttons: [
84
+ { Label: "Yes" },
85
+ { Label: "No", IsDefault: true }
86
+ ]
87
+ }).then(runEffect);
88
+ } else {
89
+ runEffect();
90
+ }
91
+ }
92
+
93
+ /**
94
+ * @type {symbol}
95
+ */
96
+ const controller = Symbol();
97
+
98
+ /**
99
+ * AbortControllerRegistry does not actually remember active event listeners: instead
100
+ * it ties them to an AbortSignal and uses an AbortController to remove them all at once.
101
+ */
102
+ class AbortControllerRegistry {
103
+ constructor() {
104
+ /**
105
+ * Stores the AbortController that can be used to remove all currently active listeners.
106
+ *
107
+ * @private
108
+ * @name {@link controller}
109
+ * @member {AbortController}
110
+ */
111
+ this[controller] = new AbortController();
112
+ }
113
+
114
+ /**
115
+ * Returns an options object for addEventListener that ties the listener
116
+ * to the AbortSignal from the current AbortController.
117
+ *
118
+ * @param {HTMLElement} element An HTML element
119
+ * @param {string[]} triggers The list of active WML trigger events for the specified elements
120
+ * @returns {AddEventListenerOptions}
121
+ */
122
+ set(element, triggers) {
123
+ return { signal: this[controller].signal };
124
+ }
125
+
126
+ /**
127
+ * Removes all registered event listeners.
128
+ *
129
+ * @returns {void}
130
+ */
131
+ reset() {
132
+ this[controller].abort();
133
+ this[controller] = new AbortController();
134
+ }
135
+ }
136
+
137
+ /**
138
+ * @type {symbol}
139
+ */
140
+ const triggerMap = Symbol();
141
+
142
+ /**
143
+ * @type {symbol}
144
+ */
145
+ const elementCount = Symbol();
146
+
147
+ /**
148
+ * WeakMapRegistry maps active trigger events to each DOM element through a WeakMap.
149
+ * This ensures that the mapping remains private to this module, while still allowing garbage
150
+ * collection of the involved elements.
151
+ */
152
+ class WeakMapRegistry {
153
+ constructor() {
154
+ /**
155
+ * Stores the current element-to-trigger mapping.
156
+ *
157
+ * @private
158
+ * @name {@link triggerMap}
159
+ * @member {WeakMap<HTMLElement, string[]>}
160
+ */
161
+ this[triggerMap] = new WeakMap();
162
+
163
+ /**
164
+ * Counts the number of elements with active WML triggers.
165
+ *
166
+ * @private
167
+ * @name {@link elementCount}
168
+ * @member {number}
169
+ */
170
+ this[elementCount] = 0;
171
+ }
172
+
173
+ /**
174
+ * Sets the active triggers for the specified element.
175
+ *
176
+ * @param {HTMLElement} element An HTML element
177
+ * @param {string[]} triggers The list of active WML trigger events for the specified element
178
+ * @returns {AddEventListenerOptions}
179
+ */
180
+ set(element, triggers) {
181
+ this[elementCount] += !this[triggerMap].has(element);
182
+ this[triggerMap].set(element, triggers);
183
+ return {};
184
+ }
185
+
186
+ /**
187
+ * Removes all registered event listeners.
188
+ *
189
+ * @returns {void}
190
+ */
191
+ reset() {
192
+ if (this[elementCount] <= 0)
193
+ return;
194
+
195
+ for (const element of document.body.querySelectorAll('*')) {
196
+ if (this[elementCount] <= 0)
197
+ break;
198
+
199
+ const triggers = this[triggerMap].get(element);
200
+ this[elementCount] -= (typeof triggers !== "undefined");
201
+
202
+ for (const trigger of triggers || [])
203
+ element.removeEventListener(trigger, onWMLTriggered);
204
+ }
205
+
206
+ this[triggerMap] = new WeakMap();
207
+ this[elementCount] = 0;
208
+ }
209
+ }
210
+
211
+ const triggerRegistry = canAbortListeners() ? new AbortControllerRegistry() : new WeakMapRegistry();
212
+
213
+ /**
214
+ * Adds event listeners to the specified element.
215
+ *
216
+ * @param {HTMLElement} element
217
+ * @return {void}
218
+ */
219
+ function addWMLListeners(element) {
220
+ const triggerRegExp = /\S+/g;
221
+ const triggerAttr = (element.getAttribute('wml-trigger') || "click");
222
+ const triggers = [];
223
+
224
+ let match;
225
+ while ((match = triggerRegExp.exec(triggerAttr)) !== null)
226
+ triggers.push(match[0]);
227
+
228
+ const options = triggerRegistry.set(element, triggers);
229
+ for (const trigger of triggers)
230
+ element.addEventListener(trigger, onWMLTriggered, options);
231
+ }
232
+
233
+ /**
234
+ * Schedules an automatic reload of WML to be performed as soon as the document is fully loaded.
235
+ *
236
+ * @return {void}
237
+ */
238
+ export function Enable() {
239
+ whenReady(Reload);
240
+ }
241
+
242
+ /**
243
+ * Reloads the WML page by adding necessary event listeners and browser listeners.
244
+ *
245
+ * @return {void}
246
+ */
247
+ export function Reload() {
248
+ triggerRegistry.reset();
249
+ document.body.querySelectorAll('[wml-event], [wml-window], [wml-openurl]').forEach(addWMLListeners);
250
+ }
package/tsconfig.json CHANGED
@@ -1,20 +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
- }
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": "bundler",
16
+ "outDir": "dist",
17
+ "strict": true,
18
+ "target": "es6",
19
+ }
20
20
  }
@@ -155,6 +155,11 @@ export declare const EventTypes: {
155
155
  },
156
156
  Linux: {
157
157
  SystemThemeChanged: string,
158
+ WindowLoadChanged: string,
159
+ WindowDeleteEvent: string,
160
+ WindowFocusIn: string,
161
+ WindowFocusOut: string,
162
+ ApplicationStartup: string,
158
163
  },
159
164
  Common: {
160
165
  ApplicationStarted: string,
package/types/events.d.ts CHANGED
@@ -202,6 +202,11 @@ export const Types: {
202
202
  };
203
203
  Linux: {
204
204
  SystemThemeChanged: string;
205
+ WindowLoadChanged: string;
206
+ WindowDeleteEvent: string;
207
+ WindowFocusIn: string;
208
+ WindowFocusOut: string;
209
+ ApplicationStartup: string;
205
210
  };
206
211
  Common: {
207
212
  ApplicationStarted: string;
package/types/index.d.ts CHANGED
@@ -7,6 +7,6 @@ import * as Events from "./events";
7
7
  import * as Flags from "./flags";
8
8
  import * as Screens from "./screens";
9
9
  import * as System from "./system";
10
- import * as Window from "./window";
11
- import * as WML from './wml';
10
+ import Window from "./window";
11
+ import * as WML from "./wml";
12
12
  export { Application, Browser, Call, Clipboard, Dialogs, Events, Flags, Screens, System, Window, WML };
@@ -25,5 +25,6 @@ export namespace objectNames {
25
25
  let Screens: number;
26
26
  let System: number;
27
27
  let Browser: number;
28
+ let CancelCall: number;
28
29
  }
29
30
  export let clientId: string;
@@ -52,10 +52,6 @@ export type Rect = {
52
52
  */
53
53
  Height: number;
54
54
  };
55
- /**
56
- * The rotation of the screen. Can be one of 'Zero', 'Ninety', 'OneEighty', 'TwoSeventy'.
57
- */
58
- export type Rotation = ('Zero' | 'Ninety' | 'OneEighty' | 'TwoSeventy');
59
55
  export type Screen = {
60
56
  /**
61
57
  * - Unique identifier for the screen.
@@ -92,5 +88,5 @@ export type Screen = {
92
88
  /**
93
89
  * - The rotation of the screen.
94
90
  */
95
- Rotation: Rotation;
91
+ Rotation: number;
96
92
  };
package/types/system.d.ts CHANGED
@@ -14,9 +14,19 @@ export function IsDarkMode(): Promise<boolean>;
14
14
  */
15
15
  export function Capabilities(): Promise<any>;
16
16
  /**
17
- * @typedef {object} EnvironmentInfo
18
- * @property {string} OS - The operating system in use.
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
19
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.
20
30
  */
21
31
  /**
22
32
  * @function
@@ -60,13 +70,43 @@ export function IsARM(): boolean;
60
70
  */
61
71
  export function IsARM64(): boolean;
62
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
+ };
63
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;
64
100
  /**
65
101
  * - The operating system in use.
66
102
  */
67
103
  OS: string;
68
104
  /**
69
- * - The architecture of the system.
105
+ * - Details of the operating system.
70
106
  */
71
- Arch: string;
107
+ OSInfo: OSInfo;
108
+ /**
109
+ * - Additional platform information.
110
+ */
111
+ PlatformInfo: any;
72
112
  };
@@ -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;