@wailsio/runtime 3.0.0-alpha.8 → 3.0.0-alpha.94

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 (71) hide show
  1. package/dist/android.js +39 -0
  2. package/{src → dist}/application.js +32 -46
  3. package/dist/browser.js +20 -0
  4. package/dist/callable.js +144 -0
  5. package/dist/calls.js +114 -0
  6. package/dist/cancellable.js +792 -0
  7. package/dist/clipboard.js +30 -0
  8. package/dist/contextmenu.js +83 -0
  9. package/dist/create.js +99 -0
  10. package/dist/dialogs.js +69 -0
  11. package/dist/drag.js +268 -0
  12. package/dist/environment.js +17 -0
  13. package/dist/event_types.js +292 -0
  14. package/dist/events.js +119 -0
  15. package/dist/flags.js +23 -0
  16. package/dist/index.js +88 -0
  17. package/dist/ios.js +28 -0
  18. package/dist/listener.js +44 -0
  19. package/dist/nanoid.js +38 -0
  20. package/dist/plugins/vite.js +64 -0
  21. package/dist/runtime.js +198 -0
  22. package/dist/screens.js +58 -0
  23. package/dist/system.js +158 -0
  24. package/dist/updater.js +74 -0
  25. package/dist/utils.js +98 -0
  26. package/dist/window.js +734 -0
  27. package/dist/wml.js +179 -0
  28. package/package.json +71 -26
  29. package/types/android.d.ts +21 -0
  30. package/types/application.d.ts +3 -10
  31. package/types/browser.d.ts +4 -4
  32. package/types/callable.d.ts +3 -0
  33. package/types/calls.d.ts +52 -24
  34. package/types/cancellable.d.ts +433 -0
  35. package/types/clipboard.d.ts +6 -5
  36. package/types/contextmenu.d.ts +1 -1
  37. package/types/create.d.ts +36 -0
  38. package/types/dialogs.d.ts +132 -20
  39. package/types/drag.d.ts +1 -4
  40. package/types/environment.d.ts +8 -0
  41. package/types/event_types.d.ts +281 -0
  42. package/types/events.d.ts +70 -33
  43. package/types/flags.d.ts +3 -3
  44. package/types/index.d.ts +32 -48
  45. package/types/ios.d.ts +13 -0
  46. package/types/listener.d.ts +9 -0
  47. package/types/nanoid.d.ts +1 -0
  48. package/types/plugins/vite.d.ts +10 -0
  49. package/types/runtime.d.ts +61 -22
  50. package/types/screens.d.ts +64 -7
  51. package/types/system.d.ts +74 -39
  52. package/types/updater.d.ts +65 -0
  53. package/types/utils.d.ts +21 -0
  54. package/types/window.d.ts +327 -13
  55. package/types/wml.d.ts +5 -3
  56. package/src/browser.js +0 -24
  57. package/src/calls.js +0 -123
  58. package/src/clipboard.js +0 -35
  59. package/src/contextmenu.js +0 -98
  60. package/src/dialogs.js +0 -138
  61. package/src/drag.js +0 -125
  62. package/src/events.js +0 -134
  63. package/src/flags.js +0 -63
  64. package/src/index.d.ts +0 -136
  65. package/src/index.js +0 -58
  66. package/src/runtime.js +0 -122
  67. package/src/screens.js +0 -45
  68. package/src/system.js +0 -122
  69. package/src/window.js +0 -122
  70. package/src/wml.js +0 -151
  71. package/tsconfig.json +0 -20
@@ -0,0 +1,30 @@
1
+ /*
2
+ _ __ _ __
3
+ | | / /___ _(_) /____
4
+ | | /| / / __ `/ / / ___/
5
+ | |/ |/ / /_/ / / (__ )
6
+ |__/|__/\__,_/_/_/____/
7
+ The electron alternative for Go
8
+ (c) Lea Anthony 2019-present
9
+ */
10
+ import { newRuntimeCaller, objectNames } from "./runtime.js";
11
+ const call = newRuntimeCaller(objectNames.Clipboard);
12
+ const ClipboardSetText = 0;
13
+ const ClipboardText = 1;
14
+ /**
15
+ * Sets the text to the Clipboard.
16
+ *
17
+ * @param text - The text to be set to the Clipboard.
18
+ * @return A Promise that resolves when the operation is successful.
19
+ */
20
+ export function SetText(text) {
21
+ return call(ClipboardSetText, { text });
22
+ }
23
+ /**
24
+ * Get the Clipboard text
25
+ *
26
+ * @returns A promise that resolves with the text from the Clipboard.
27
+ */
28
+ export function Text() {
29
+ return call(ClipboardText);
30
+ }
@@ -0,0 +1,83 @@
1
+ /*
2
+ _ __ _ __
3
+ | | / /___ _(_) /____
4
+ | | /| / / __ `/ / / ___/
5
+ | |/ |/ / /_/ / / (__ )
6
+ |__/|__/\__,_/_/_/____/
7
+ The electron alternative for Go
8
+ (c) Lea Anthony 2019-present
9
+ */
10
+ import { newRuntimeCaller, objectNames } from "./runtime.js";
11
+ import { IsDebug } from "./system.js";
12
+ import { eventTarget } from "./utils.js";
13
+ // setup
14
+ import { hasDOM } from "./environment.js";
15
+ if (hasDOM) {
16
+ window.addEventListener('contextmenu', contextMenuHandler);
17
+ }
18
+ const call = newRuntimeCaller(objectNames.ContextMenu);
19
+ const ContextMenuOpen = 0;
20
+ function openContextMenu(id, x, y, data) {
21
+ void call(ContextMenuOpen, { id, x, y, data });
22
+ }
23
+ function contextMenuHandler(event) {
24
+ const target = eventTarget(event);
25
+ // Check for custom context menu
26
+ const customContextMenu = window.getComputedStyle(target).getPropertyValue("--custom-contextmenu").trim();
27
+ if (customContextMenu) {
28
+ event.preventDefault();
29
+ const data = window.getComputedStyle(target).getPropertyValue("--custom-contextmenu-data");
30
+ openContextMenu(customContextMenu, event.clientX, event.clientY, data);
31
+ }
32
+ else {
33
+ processDefaultContextMenu(event, target);
34
+ }
35
+ }
36
+ /*
37
+ --default-contextmenu: auto; (default) will show the default context menu if contentEditable is true OR text has been selected OR element is input or textarea
38
+ --default-contextmenu: show; will always show the default context menu
39
+ --default-contextmenu: hide; will always hide the default context menu
40
+
41
+ This rule is inherited like normal CSS rules, so nesting works as expected
42
+ */
43
+ function processDefaultContextMenu(event, target) {
44
+ // Debug builds always show the menu
45
+ if (IsDebug()) {
46
+ return;
47
+ }
48
+ // Process default context menu
49
+ switch (window.getComputedStyle(target).getPropertyValue("--default-contextmenu").trim()) {
50
+ case 'show':
51
+ return;
52
+ case 'hide':
53
+ event.preventDefault();
54
+ return;
55
+ }
56
+ // Check if contentEditable is true
57
+ if (target.isContentEditable) {
58
+ return;
59
+ }
60
+ // Check if text has been selected
61
+ const selection = window.getSelection();
62
+ const hasSelection = selection && selection.toString().length > 0;
63
+ if (hasSelection) {
64
+ for (let i = 0; i < selection.rangeCount; i++) {
65
+ const range = selection.getRangeAt(i);
66
+ const rects = range.getClientRects();
67
+ for (let j = 0; j < rects.length; j++) {
68
+ const rect = rects[j];
69
+ if (document.elementFromPoint(rect.left, rect.top) === target) {
70
+ return;
71
+ }
72
+ }
73
+ }
74
+ }
75
+ // Check if tag is input or textarea.
76
+ if (target instanceof HTMLInputElement || target instanceof HTMLTextAreaElement) {
77
+ if (hasSelection || (!target.readOnly && !target.disabled)) {
78
+ return;
79
+ }
80
+ }
81
+ // hide default context menu
82
+ event.preventDefault();
83
+ }
package/dist/create.js ADDED
@@ -0,0 +1,99 @@
1
+ /*
2
+ _ __ _ __
3
+ | | / /___ _(_) /____
4
+ | | /| / / __ `/ / / ___/
5
+ | |/ |/ / /_/ / / (__ )
6
+ |__/|__/\__,_/_/_/____/
7
+ The electron alternative for Go
8
+ (c) Lea Anthony 2019-present
9
+ */
10
+ /**
11
+ * Any is a dummy creation function for simple or unknown types.
12
+ */
13
+ export function Any(source) {
14
+ return source;
15
+ }
16
+ /**
17
+ * ByteSlice is a creation function that replaces
18
+ * null strings with empty strings.
19
+ */
20
+ export function ByteSlice(source) {
21
+ return ((source == null) ? "" : source);
22
+ }
23
+ /**
24
+ * Array takes a creation function for an arbitrary type
25
+ * and returns an in-place creation function for an array
26
+ * whose elements are of that type.
27
+ */
28
+ export function Array(element) {
29
+ if (element === Any) {
30
+ return (source) => (source === null ? [] : source);
31
+ }
32
+ return (source) => {
33
+ if (source === null) {
34
+ return [];
35
+ }
36
+ for (let i = 0; i < source.length; i++) {
37
+ source[i] = element(source[i]);
38
+ }
39
+ return source;
40
+ };
41
+ }
42
+ /**
43
+ * Map takes creation functions for two arbitrary types
44
+ * and returns an in-place creation function for an object
45
+ * whose keys and values are of those types.
46
+ */
47
+ export function Map(key, value) {
48
+ if (value === Any) {
49
+ return (source) => (source === null ? {} : source);
50
+ }
51
+ return (source) => {
52
+ if (source === null) {
53
+ return {};
54
+ }
55
+ for (const key in source) {
56
+ source[key] = value(source[key]);
57
+ }
58
+ return source;
59
+ };
60
+ }
61
+ /**
62
+ * Nullable takes a creation function for an arbitrary type
63
+ * and returns a creation function for a nullable value of that type.
64
+ */
65
+ export function Nullable(element) {
66
+ if (element === Any) {
67
+ return Any;
68
+ }
69
+ return (source) => (source === null ? null : element(source));
70
+ }
71
+ /**
72
+ * Struct takes an object mapping field names to creation functions
73
+ * and returns an in-place creation function for a struct.
74
+ */
75
+ export function Struct(createField) {
76
+ let allAny = true;
77
+ for (const name in createField) {
78
+ if (createField[name] !== Any) {
79
+ allAny = false;
80
+ break;
81
+ }
82
+ }
83
+ if (allAny) {
84
+ return Any;
85
+ }
86
+ return (source) => {
87
+ for (const name in createField) {
88
+ if (name in source) {
89
+ source[name] = createField[name](source[name]);
90
+ }
91
+ }
92
+ return source;
93
+ };
94
+ }
95
+ /**
96
+ * Maps known event names to creation functions for their data types.
97
+ * Will be monkey-patched by the binding generator.
98
+ */
99
+ export const Events = {};
@@ -0,0 +1,69 @@
1
+ /*
2
+ _ __ _ __
3
+ | | / /___ _(_) /____
4
+ | | /| / / __ `/ / / ___/
5
+ | |/ |/ / /_/ / / (__ )
6
+ |__/|__/\__,_/_/_/____/
7
+ The electron alternative for Go
8
+ (c) Lea Anthony 2019-present
9
+ */
10
+ import { newRuntimeCaller, objectNames } from "./runtime.js";
11
+ // setup
12
+ import { hasDOM } from "./environment.js";
13
+ if (hasDOM) {
14
+ window._wails = window._wails || {};
15
+ }
16
+ const call = newRuntimeCaller(objectNames.Dialog);
17
+ // Define constants from the `methods` object in Title Case
18
+ const DialogInfo = 0;
19
+ const DialogWarning = 1;
20
+ const DialogError = 2;
21
+ const DialogQuestion = 3;
22
+ const DialogOpenFile = 4;
23
+ const DialogSaveFile = 5;
24
+ /**
25
+ * Presents a dialog of specified type with the given options.
26
+ *
27
+ * @param type - Dialog type.
28
+ * @param options - Options for the dialog.
29
+ * @returns A promise that resolves with result of dialog.
30
+ */
31
+ function dialog(type, options = {}) {
32
+ return call(type, options);
33
+ }
34
+ /**
35
+ * Presents an info dialog.
36
+ *
37
+ * @param options - Dialog options
38
+ * @returns A promise that resolves with the label of the chosen button.
39
+ */
40
+ export function Info(options) { return dialog(DialogInfo, options); }
41
+ /**
42
+ * Presents a warning dialog.
43
+ *
44
+ * @param options - Dialog options.
45
+ * @returns A promise that resolves with the label of the chosen button.
46
+ */
47
+ export function Warning(options) { return dialog(DialogWarning, options); }
48
+ /**
49
+ * Presents an error dialog.
50
+ *
51
+ * @param options - Dialog options.
52
+ * @returns A promise that resolves with the label of the chosen button.
53
+ */
54
+ export function Error(options) { return dialog(DialogError, options); }
55
+ /**
56
+ * Presents a question dialog.
57
+ *
58
+ * @param options - Dialog options.
59
+ * @returns A promise that resolves with the label of the chosen button.
60
+ */
61
+ export function Question(options) { return dialog(DialogQuestion, options); }
62
+ export function OpenFile(options) { var _a; return (_a = dialog(DialogOpenFile, options)) !== null && _a !== void 0 ? _a : []; }
63
+ /**
64
+ * Presents a file selection dialog to pick a file to save.
65
+ *
66
+ * @param options - Dialog options.
67
+ * @returns Selected file, or a blank string if no file has been selected.
68
+ */
69
+ export function SaveFile(options) { return dialog(DialogSaveFile, options); }
package/dist/drag.js ADDED
@@ -0,0 +1,268 @@
1
+ /*
2
+ _ __ _ __
3
+ | | / /___ _(_) /____
4
+ | | /| / / __ `/ / / ___/
5
+ | |/ |/ / /_/ / / (__ )
6
+ |__/|__/\__,_/_/_/____/
7
+ The electron alternative for Go
8
+ (c) Lea Anthony 2019-present
9
+ */
10
+ import { invoke, IsWindows, IsLinux } from "./system.js";
11
+ import { GetFlag } from "./flags.js";
12
+ import { canTrackButtons, eventTarget } from "./utils.js";
13
+ // Setup
14
+ let canDrag = false;
15
+ let dragging = false;
16
+ let resizable = false;
17
+ let canResize = false;
18
+ let resizing = false;
19
+ let resizeEdge = "";
20
+ let defaultCursor = "auto";
21
+ let buttons = 0;
22
+ import { hasDOM } from "./environment.js";
23
+ let buttonsTracked = false;
24
+ if (hasDOM) {
25
+ buttonsTracked = canTrackButtons();
26
+ window._wails = window._wails || {};
27
+ window._wails.setResizable = (value) => {
28
+ resizable = value;
29
+ if (!resizable) {
30
+ // Stop resizing if in progress.
31
+ canResize = resizing = false;
32
+ setResize();
33
+ }
34
+ };
35
+ }
36
+ // Defer attaching mouse listeners until we know we're not on mobile.
37
+ let dragInitDone = false;
38
+ function isMobile() {
39
+ var _a, _b;
40
+ const os = (_b = (_a = window._wails) === null || _a === void 0 ? void 0 : _a.environment) === null || _b === void 0 ? void 0 : _b.OS;
41
+ if (os === "ios" || os === "android")
42
+ return true;
43
+ // Fallback heuristic if environment not yet set
44
+ const ua = navigator.userAgent || navigator.vendor || window.opera || "";
45
+ return /android|iphone|ipad|ipod|iemobile|wpdesktop/i.test(ua);
46
+ }
47
+ function tryInitDragHandlers() {
48
+ if (dragInitDone)
49
+ return;
50
+ if (isMobile())
51
+ return;
52
+ window.addEventListener('mousedown', update, { capture: true });
53
+ window.addEventListener('mousemove', update, { capture: true });
54
+ window.addEventListener('mouseup', update, { capture: true });
55
+ for (const ev of ['click', 'contextmenu', 'dblclick']) {
56
+ window.addEventListener(ev, suppressEvent, { capture: true });
57
+ }
58
+ dragInitDone = true;
59
+ }
60
+ if (hasDOM) {
61
+ // Attempt immediate init (in case environment already present)
62
+ tryInitDragHandlers();
63
+ // Also attempt on DOM ready
64
+ document.addEventListener('DOMContentLoaded', tryInitDragHandlers, { once: true });
65
+ // As a last resort, poll for environment for a short period
66
+ let dragEnvPolls = 0;
67
+ const dragEnvPoll = window.setInterval(() => {
68
+ if (dragInitDone) {
69
+ window.clearInterval(dragEnvPoll);
70
+ return;
71
+ }
72
+ tryInitDragHandlers();
73
+ if (++dragEnvPolls > 100) {
74
+ window.clearInterval(dragEnvPoll);
75
+ }
76
+ }, 50);
77
+ }
78
+ function suppressEvent(event) {
79
+ // Suppress click events while resizing or dragging.
80
+ if (dragging || resizing) {
81
+ event.stopImmediatePropagation();
82
+ event.stopPropagation();
83
+ event.preventDefault();
84
+ }
85
+ }
86
+ // Use constants to avoid comparing strings multiple times.
87
+ const MouseDown = 0;
88
+ const MouseUp = 1;
89
+ const MouseMove = 2;
90
+ function update(event) {
91
+ // Windows suppresses mouse events at the end of dragging or resizing,
92
+ // so we need to be smart and synthesize button events.
93
+ let eventType, eventButtons = event.buttons;
94
+ switch (event.type) {
95
+ case 'mousedown':
96
+ eventType = MouseDown;
97
+ if (!buttonsTracked) {
98
+ eventButtons = buttons | (1 << event.button);
99
+ }
100
+ break;
101
+ case 'mouseup':
102
+ eventType = MouseUp;
103
+ if (!buttonsTracked) {
104
+ eventButtons = buttons & ~(1 << event.button);
105
+ }
106
+ break;
107
+ default:
108
+ eventType = MouseMove;
109
+ if (!buttonsTracked) {
110
+ eventButtons = buttons;
111
+ }
112
+ break;
113
+ }
114
+ let released = buttons & ~eventButtons;
115
+ let pressed = eventButtons & ~buttons;
116
+ buttons = eventButtons;
117
+ // Synthesize a release-press sequence if we detect a press of an already pressed button.
118
+ if (eventType === MouseDown && !(pressed & event.button)) {
119
+ released |= (1 << event.button);
120
+ pressed |= (1 << event.button);
121
+ }
122
+ // Suppress all button events during dragging and resizing,
123
+ // unless this is a mouseup event that is ending a drag action.
124
+ if (eventType !== MouseMove // Fast path for mousemove
125
+ && resizing
126
+ || (dragging
127
+ && (eventType === MouseDown
128
+ || event.button !== 0))) {
129
+ event.stopImmediatePropagation();
130
+ event.stopPropagation();
131
+ event.preventDefault();
132
+ }
133
+ // Handle releases
134
+ if (released & 1) {
135
+ primaryUp(event);
136
+ }
137
+ // Handle presses
138
+ if (pressed & 1) {
139
+ primaryDown(event);
140
+ }
141
+ // Handle mousemove
142
+ if (eventType === MouseMove) {
143
+ onMouseMove(event);
144
+ }
145
+ ;
146
+ }
147
+ function primaryDown(event) {
148
+ // Reset readiness state.
149
+ canDrag = false;
150
+ canResize = false;
151
+ // Ignore repeated clicks on macOS and Linux.
152
+ if (!IsWindows()) {
153
+ if (event.type === 'mousedown' && event.button === 0 && event.detail !== 1) {
154
+ return;
155
+ }
156
+ }
157
+ if (resizeEdge) {
158
+ // Ready to resize if the primary button was pressed for the first time.
159
+ canResize = true;
160
+ // Do not start drag operations when on resize edges.
161
+ return;
162
+ }
163
+ // Retrieve target element
164
+ const target = eventTarget(event);
165
+ // Ready to drag if the primary button was pressed for the first time on a draggable element.
166
+ // Ignore clicks on the scrollbar.
167
+ const style = window.getComputedStyle(target);
168
+ canDrag = (style.getPropertyValue("--wails-draggable").trim() === "drag"
169
+ && (event.offsetX - parseFloat(style.paddingLeft) < target.clientWidth
170
+ && event.offsetY - parseFloat(style.paddingTop) < target.clientHeight));
171
+ }
172
+ function primaryUp(event) {
173
+ // Stop dragging and resizing.
174
+ canDrag = false;
175
+ dragging = false;
176
+ canResize = false;
177
+ resizing = false;
178
+ }
179
+ const cursorForEdge = Object.freeze({
180
+ "se-resize": "nwse-resize",
181
+ "sw-resize": "nesw-resize",
182
+ "nw-resize": "nwse-resize",
183
+ "ne-resize": "nesw-resize",
184
+ "w-resize": "ew-resize",
185
+ "n-resize": "ns-resize",
186
+ "s-resize": "ns-resize",
187
+ "e-resize": "ew-resize",
188
+ });
189
+ function setResize(edge) {
190
+ if (edge) {
191
+ if (!resizeEdge) {
192
+ defaultCursor = document.body.style.cursor;
193
+ }
194
+ document.body.style.cursor = cursorForEdge[edge];
195
+ }
196
+ else if (!edge && resizeEdge) {
197
+ document.body.style.cursor = defaultCursor;
198
+ }
199
+ resizeEdge = edge || "";
200
+ }
201
+ function onMouseMove(event) {
202
+ if (canResize && resizeEdge) {
203
+ // Start resizing.
204
+ resizing = true;
205
+ invoke("wails:resize:" + resizeEdge);
206
+ }
207
+ else if (canDrag) {
208
+ // Start dragging.
209
+ dragging = true;
210
+ invoke("wails:drag");
211
+ }
212
+ if (dragging || resizing) {
213
+ // Either drag or resize is ongoing,
214
+ // reset readiness and stop processing.
215
+ canDrag = canResize = false;
216
+ return;
217
+ }
218
+ if (!resizable || (!IsWindows() && !(IsLinux() && GetFlag("frameless")))) {
219
+ if (resizeEdge) {
220
+ setResize();
221
+ }
222
+ return;
223
+ }
224
+ const resizeHandleHeight = GetFlag("system.resizeHandleHeight") || 5;
225
+ const resizeHandleWidth = GetFlag("system.resizeHandleWidth") || 5;
226
+ // Extra pixels for the corner areas.
227
+ const cornerExtra = GetFlag("resizeCornerExtra") || 10;
228
+ // When a scrollbar is present at the window edge it consumes mouse events in that strip.
229
+ // Shift the effective content edge inward so the resize zone sits just before the scrollbar.
230
+ const scrollbarWidth = Math.max(0, window.innerWidth - document.documentElement.clientWidth);
231
+ const scrollbarHeight = Math.max(0, window.innerHeight - document.documentElement.clientHeight);
232
+ const rightContentEdge = window.innerWidth - scrollbarWidth;
233
+ const bottomContentEdge = window.innerHeight - scrollbarHeight;
234
+ const rightBorder = event.clientX < rightContentEdge && (rightContentEdge - event.clientX) < resizeHandleWidth;
235
+ const leftBorder = event.clientX < resizeHandleWidth;
236
+ const topBorder = event.clientY < resizeHandleHeight;
237
+ const bottomBorder = event.clientY < bottomContentEdge && (bottomContentEdge - event.clientY) < resizeHandleHeight;
238
+ // Adjust for corner areas.
239
+ const rightCorner = event.clientX < rightContentEdge && (rightContentEdge - event.clientX) < (resizeHandleWidth + cornerExtra);
240
+ const leftCorner = event.clientX < (resizeHandleWidth + cornerExtra);
241
+ const topCorner = event.clientY < (resizeHandleHeight + cornerExtra);
242
+ const bottomCorner = event.clientY < bottomContentEdge && (bottomContentEdge - event.clientY) < (resizeHandleHeight + cornerExtra);
243
+ if (!leftCorner && !topCorner && !bottomCorner && !rightCorner) {
244
+ // Optimisation: out of all corner areas implies out of borders.
245
+ setResize();
246
+ }
247
+ // Detect corners.
248
+ else if (rightCorner && bottomCorner)
249
+ setResize("se-resize");
250
+ else if (leftCorner && bottomCorner)
251
+ setResize("sw-resize");
252
+ else if (leftCorner && topCorner)
253
+ setResize("nw-resize");
254
+ else if (topCorner && rightCorner)
255
+ setResize("ne-resize");
256
+ // Detect borders.
257
+ else if (leftBorder)
258
+ setResize("w-resize");
259
+ else if (topBorder)
260
+ setResize("n-resize");
261
+ else if (bottomBorder)
262
+ setResize("s-resize");
263
+ else if (rightBorder)
264
+ setResize("e-resize");
265
+ // Out of border area.
266
+ else
267
+ setResize();
268
+ }
@@ -0,0 +1,17 @@
1
+ /*
2
+ _ __ _ __
3
+ | | / /___ _(_) /____
4
+ | | /| / / __ `/ / / ___/
5
+ | |/ |/ / /_/ / / (__ )
6
+ |__/|__/\__,_/_/_/____/
7
+ The electron alternative for Go
8
+ (c) Lea Anthony 2019-present
9
+ */
10
+ /**
11
+ * True when running inside a browser/webview with a DOM available.
12
+ * False under server-side rendering (e.g. `next build` prerendering),
13
+ * where application code may import the runtime module even though no
14
+ * Wails APIs can actually be used (#4679). Modules must not touch
15
+ * `window`/`document` at import time except behind this guard.
16
+ */
17
+ export const hasDOM = typeof window !== "undefined" && typeof document !== "undefined";