@wailsio/runtime 3.0.0-alpha.5 → 3.0.0-alpha.56

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 (129) hide show
  1. package/docs/.nojekyll +1 -0
  2. package/docs/assets/highlight.css +22 -0
  3. package/docs/assets/icons.js +15 -0
  4. package/docs/assets/icons.svg +1 -0
  5. package/docs/assets/main.js +59 -0
  6. package/docs/assets/navigation.js +1 -0
  7. package/docs/assets/search.js +1 -0
  8. package/docs/assets/style.css +1415 -0
  9. package/docs/classes/Call.RuntimeError.html +11 -0
  10. package/docs/classes/Events.WailsEvent.html +4 -0
  11. package/docs/functions/Application.Hide.html +2 -0
  12. package/docs/functions/Application.Quit.html +2 -0
  13. package/docs/functions/Application.Show.html +2 -0
  14. package/docs/functions/Browser.OpenURL.html +3 -0
  15. package/docs/functions/Call.ByID.html +8 -0
  16. package/docs/functions/Call.ByName.html +6 -0
  17. package/docs/functions/Call.Call.html +11 -0
  18. package/docs/functions/Clipboard.SetText.html +6 -0
  19. package/docs/functions/Clipboard.Text.html +3 -0
  20. package/docs/functions/Create.Any.html +2 -0
  21. package/docs/functions/Create.Array.html +4 -0
  22. package/docs/functions/Create.ByteSlice.html +3 -0
  23. package/docs/functions/Create.Map.html +4 -0
  24. package/docs/functions/Create.Nullable.html +3 -0
  25. package/docs/functions/Create.Struct.html +3 -0
  26. package/docs/functions/Dialogs.Error.html +5 -0
  27. package/docs/functions/Dialogs.Info.html +5 -0
  28. package/docs/functions/Dialogs.OpenFile.html +3 -0
  29. package/docs/functions/Dialogs.Question.html +5 -0
  30. package/docs/functions/Dialogs.SaveFile.html +3 -0
  31. package/docs/functions/Dialogs.Warning.html +5 -0
  32. package/docs/functions/Events.Emit.html +6 -0
  33. package/docs/functions/Events.Off.html +4 -0
  34. package/docs/functions/Events.OffAll.html +3 -0
  35. package/docs/functions/Events.On.html +7 -0
  36. package/docs/functions/Events.OnMultiple.html +8 -0
  37. package/docs/functions/Events.Once.html +7 -0
  38. package/docs/functions/Events.setup.html +1 -0
  39. package/docs/functions/Flags.GetFlag.html +6 -0
  40. package/docs/functions/Screens.GetAll.html +3 -0
  41. package/docs/functions/Screens.GetCurrent.html +3 -0
  42. package/docs/functions/Screens.GetPrimary.html +3 -0
  43. package/docs/functions/System.Capabilities.html +4 -0
  44. package/docs/functions/System.Environment.html +5 -0
  45. package/docs/functions/System.IsAMD64.html +3 -0
  46. package/docs/functions/System.IsARM.html +3 -0
  47. package/docs/functions/System.IsARM64.html +5 -0
  48. package/docs/functions/System.IsDarkMode.html +5 -0
  49. package/docs/functions/System.IsDebug.html +1 -0
  50. package/docs/functions/System.IsLinux.html +3 -0
  51. package/docs/functions/System.IsMac.html +3 -0
  52. package/docs/functions/System.IsWindows.html +3 -0
  53. package/docs/functions/System.invoke.html +1 -0
  54. package/docs/functions/WML.Enable.html +2 -0
  55. package/docs/functions/WML.Reload.html +2 -0
  56. package/docs/functions/init.html +1 -0
  57. package/docs/index.html +5 -0
  58. package/docs/interfaces/Call.CallOptions.html +7 -0
  59. package/docs/interfaces/Dialogs.Button.html +7 -0
  60. package/docs/interfaces/Dialogs.FileFilter.html +5 -0
  61. package/docs/interfaces/Dialogs.MessageDialogOptions.html +9 -0
  62. package/docs/interfaces/Dialogs.OpenFileDialogOptions.html +33 -0
  63. package/docs/interfaces/Dialogs.SaveFileDialogOptions.html +35 -0
  64. package/docs/interfaces/Screens.Rect.html +9 -0
  65. package/docs/interfaces/Screens.Screen.html +25 -0
  66. package/docs/interfaces/Screens.Size.html +5 -0
  67. package/docs/interfaces/System.EnvironmentInfo.html +11 -0
  68. package/docs/interfaces/System.OSInfo.html +9 -0
  69. package/docs/modules/Application.html +4 -0
  70. package/docs/modules/Browser.html +2 -0
  71. package/docs/modules/Call.html +6 -0
  72. package/docs/modules/Clipboard.html +3 -0
  73. package/docs/modules/Create.html +7 -0
  74. package/docs/modules/Dialogs.html +12 -0
  75. package/docs/modules/Events.html +10 -0
  76. package/docs/modules/Flags.html +2 -0
  77. package/docs/modules/Screens.html +7 -0
  78. package/docs/modules/System.html +14 -0
  79. package/docs/modules/WML.html +3 -0
  80. package/docs/modules.html +14 -0
  81. package/docs/variables/Events.Types.html +1 -0
  82. package/docs/variables/Window.html +2 -0
  83. package/package.json +38 -17
  84. package/{application.js → src/application.js} +46 -46
  85. package/{browser.js → src/browser.js} +24 -24
  86. package/src/calls.js +221 -0
  87. package/{clipboard.js → src/clipboard.js} +35 -35
  88. package/{contextmenu.js → src/contextmenu.js} +97 -98
  89. package/src/create.js +125 -0
  90. package/src/dialogs.js +200 -0
  91. package/{drag.js → src/drag.js} +119 -125
  92. package/src/event_types.js +219 -0
  93. package/{events.js → src/events.js} +140 -134
  94. package/src/flags.js +25 -0
  95. package/src/index.js +60 -0
  96. package/src/nanoid.js +42 -0
  97. package/src/runtime.js +92 -0
  98. package/src/screens.js +71 -0
  99. package/{system.js → src/system.js} +143 -122
  100. package/src/utils.js +86 -0
  101. package/src/window.js +638 -0
  102. package/src/wml.js +250 -0
  103. package/tsconfig.json +20 -0
  104. package/types/application.d.ts +19 -0
  105. package/types/browser.d.ts +6 -0
  106. package/types/calls.d.ts +69 -0
  107. package/types/clipboard.d.ts +12 -0
  108. package/types/create.d.ts +52 -0
  109. package/types/dialogs.d.ts +184 -0
  110. package/types/event_types.d.ts +219 -0
  111. package/types/events.d.ts +271 -0
  112. package/types/flags.d.ts +7 -0
  113. package/types/index.d.ts +14 -0
  114. package/types/nanoid.d.ts +1 -0
  115. package/types/runtime.d.ts +30 -0
  116. package/types/screens.d.ts +94 -0
  117. package/types/system.d.ts +112 -0
  118. package/types/utils.d.ts +14 -0
  119. package/types/window.d.ts +407 -0
  120. package/types/wml.d.ts +12 -0
  121. package/calls.js +0 -123
  122. package/dialogs.js +0 -138
  123. package/flags.js +0 -63
  124. package/index.js +0 -56
  125. package/runtime.js +0 -122
  126. package/screens.js +0 -45
  127. package/types.d.ts +0 -130
  128. package/window.js +0 -122
  129. package/wml.js +0 -148
package/wml.js DELETED
@@ -1,148 +0,0 @@
1
-
2
- import {Emit, WailsEvent} from "./events";
3
- import {Question} from "./dialogs";
4
- import {WindowMethods, Get} from "./window";
5
-
6
- /**
7
- * Sends an event with the given name and optional data.
8
- *
9
- * @param {string} eventName - The name of the event to send.
10
- * @param {any} [data=null] - Optional data to send along with the event.
11
- *
12
- * @return {void}
13
- */
14
- function sendEvent(eventName, data=null) {
15
- let event = new WailsEvent(eventName, data);
16
- Emit(event);
17
- }
18
-
19
- /**
20
- * Adds event listeners to elements with `wml-event` attribute.
21
- *
22
- * @return {void}
23
- */
24
- function addWMLEventListeners() {
25
- const elements = document.querySelectorAll('[wml-event]');
26
- elements.forEach(function (element) {
27
- const eventType = element.getAttribute('wml-event');
28
- const confirm = element.getAttribute('wml-confirm');
29
- const trigger = element.getAttribute('wml-trigger') || "click";
30
-
31
- let callback = function () {
32
- if (confirm) {
33
- Question({Title: "Confirm", Message:confirm, Detached: false, Buttons:[{Label:"Yes"},{Label:"No", IsDefault:true}]}).then(function (result) {
34
- if (result !== "No") {
35
- sendEvent(eventType);
36
- }
37
- });
38
- return;
39
- }
40
- sendEvent(eventType);
41
- };
42
-
43
- // Remove existing listeners
44
- element.removeEventListener(trigger, callback);
45
-
46
- // Add new listener
47
- element.addEventListener(trigger, callback);
48
- });
49
- }
50
-
51
- /**
52
- * Calls a method on the window object.
53
- *
54
- * @param {string} method - The name of the method to call on the window object.
55
- *
56
- * @return {void}
57
- */
58
- function callWindowMethod(method) {
59
- // TODO: Make this a parameter!
60
- let windowName = '';
61
- let targetWindow = Get('');
62
- let methodMap = WindowMethods(targetWindow);
63
- if (!methodMap.has(method)) {
64
- console.log("Window method " + method + " not found");
65
- }
66
- methodMap.get(method)();
67
- }
68
-
69
- /**
70
- * Adds window listeners for elements with the 'wml-window' attribute.
71
- * Removes any existing listeners before adding new ones.
72
- *
73
- * @return {void}
74
- */
75
- function addWMLWindowListeners() {
76
- const elements = document.querySelectorAll('[wml-window]');
77
- elements.forEach(function (element) {
78
- const windowMethod = element.getAttribute('wml-window');
79
- const confirm = element.getAttribute('wml-confirm');
80
- const trigger = element.getAttribute('wml-trigger') || "click";
81
-
82
- let callback = function () {
83
- if (confirm) {
84
- Question({Title: "Confirm", Message:confirm, Buttons:[{Label:"Yes"},{Label:"No", IsDefault:true}]}).then(function (result) {
85
- if (result !== "No") {
86
- callWindowMethod(windowMethod);
87
- }
88
- });
89
- return;
90
- }
91
- callWindowMethod(windowMethod);
92
- };
93
-
94
- // Remove existing listeners
95
- element.removeEventListener(trigger, callback);
96
-
97
- // Add new listener
98
- element.addEventListener(trigger, callback);
99
- });
100
- }
101
-
102
- /**
103
- * Adds a listener to elements with the 'wml-openurl' attribute.
104
- * When the specified trigger event is fired on any of these elements,
105
- * the listener will open the URL specified by the 'wml-openurl' attribute.
106
- * If a 'wml-confirm' attribute is provided, a confirmation dialog will be displayed,
107
- * and the URL will only be opened if the user confirms.
108
- *
109
- * @return {void}
110
- */
111
- function addWMLOpenBrowserListener() {
112
- const elements = document.querySelectorAll('[wml-openurl]');
113
- elements.forEach(function (element) {
114
- const url = element.getAttribute('wml-openurl');
115
- const confirm = element.getAttribute('wml-confirm');
116
- const trigger = element.getAttribute('wml-trigger') || "click";
117
-
118
- let callback = function () {
119
- if (confirm) {
120
- Question({Title: "Confirm", Message:confirm, Buttons:[{Label:"Yes"},{Label:"No", IsDefault:true}]}).then(function (result) {
121
- if (result !== "No") {
122
- void wails.Browser.OpenURL(url);
123
- }
124
- });
125
- return;
126
- }
127
- void wails.Browser.OpenURL(url);
128
- };
129
-
130
- // Remove existing listeners
131
- element.removeEventListener(trigger, callback);
132
-
133
- // Add new listener
134
- element.addEventListener(trigger, callback);
135
- });
136
- }
137
-
138
- /**
139
- * Reloads the WML page by adding necessary event listeners and browser listeners.
140
- *
141
- * @return {void}
142
- */
143
- export function reloadWML() {
144
- console.log("Reloading WML");
145
- addWMLEventListeners();
146
- addWMLWindowListeners();
147
- addWMLOpenBrowserListener();
148
- }