@wailsio/runtime 3.0.0-alpha.77 → 3.0.0-alpha.79

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.
@@ -254,6 +254,5 @@ export const Types = Object.freeze({
254
254
  WindowZoomIn: "common:WindowZoomIn",
255
255
  WindowZoomOut: "common:WindowZoomOut",
256
256
  WindowZoomReset: "common:WindowZoomReset",
257
- WindowDropZoneFilesDropped: "common:WindowDropZoneFilesDropped",
258
257
  }),
259
258
  });
package/dist/index.js CHANGED
@@ -23,7 +23,7 @@ import * as Flags from "./flags.js";
23
23
  import * as Screens from "./screens.js";
24
24
  import * as System from "./system.js";
25
25
  import * as IOS from "./ios.js";
26
- import Window from "./window.js";
26
+ import Window, { handleDragEnter, handleDragLeave, handleDragOver } from "./window.js";
27
27
  import * as WML from "./wml.js";
28
28
  export { Application, Browser, Call, Clipboard, Dialogs, Events, Flags, Screens, System, IOS, Window, WML };
29
29
  /**
@@ -35,10 +35,34 @@ export { Create };
35
35
  export * from "./cancellable.js";
36
36
  // Export transport interfaces and utilities
37
37
  export { setTransport, getTransport, objectNames, clientId, } from "./runtime.js";
38
+ import { clientId } from "./runtime.js";
38
39
  // Notify backend
39
40
  window._wails.invoke = System.invoke;
41
+ window._wails.clientId = clientId;
40
42
  // Register platform handlers (internal API)
41
43
  // Note: Window is the thisWindow instance (default export from window.ts)
42
44
  // Binding ensures 'this' correctly refers to the current window instance
43
45
  window._wails.handlePlatformFileDrop = Window.HandlePlatformFileDrop.bind(Window);
46
+ // Linux-specific drag handlers (GTK intercepts DOM drag events)
47
+ window._wails.handleDragEnter = handleDragEnter;
48
+ window._wails.handleDragLeave = handleDragLeave;
49
+ window._wails.handleDragOver = handleDragOver;
44
50
  System.invoke("wails:runtime:ready");
51
+ /**
52
+ * Loads a script from the given URL if it exists.
53
+ * Uses HEAD request to check existence, then injects a script tag.
54
+ * Silently ignores if the script doesn't exist.
55
+ */
56
+ export function loadOptionalScript(url) {
57
+ return fetch(url, { method: 'HEAD' })
58
+ .then(response => {
59
+ if (response.ok) {
60
+ const script = document.createElement('script');
61
+ script.src = url;
62
+ document.head.appendChild(script);
63
+ }
64
+ })
65
+ .catch(() => { }); // Silently ignore - script is optional
66
+ }
67
+ // Load custom.js if available (used by server mode for WebSocket events, etc.)
68
+ loadOptionalScript('/wails/custom.js');
package/dist/system.js CHANGED
@@ -12,7 +12,6 @@ const call = newRuntimeCaller(objectNames.System);
12
12
  const SystemIsDarkMode = 0;
13
13
  const SystemEnvironment = 1;
14
14
  const SystemCapabilities = 2;
15
- const ApplicationFilesDroppedWithContext = 100; // New method ID for enriched drop event
16
15
  const _invoke = (function () {
17
16
  var _a, _b, _c, _d, _e, _f;
18
17
  try {
@@ -123,32 +122,3 @@ export function IsDebug() {
123
122
  var _a, _b;
124
123
  return Boolean((_b = (_a = window._wails) === null || _a === void 0 ? void 0 : _a.environment) === null || _b === void 0 ? void 0 : _b.Debug);
125
124
  }
126
- /**
127
- * Handles file drops originating from platform-specific code (e.g., macOS native drag-and-drop).
128
- * Gathers information about the drop target element and sends it back to the Go backend.
129
- *
130
- * @param filenames - An array of file paths (strings) that were dropped.
131
- * @param x - The x-coordinate of the drop event.
132
- * @param y - The y-coordinate of the drop event.
133
- */
134
- export function HandlePlatformFileDrop(filenames, x, y) {
135
- const element = document.elementFromPoint(x, y);
136
- const elementId = element ? element.id : '';
137
- const classList = element ? Array.from(element.classList) : [];
138
- const payload = {
139
- filenames,
140
- x,
141
- y,
142
- elementId,
143
- classList,
144
- };
145
- call(ApplicationFilesDroppedWithContext, payload)
146
- .then(() => {
147
- // Optional: Log success or handle if needed
148
- console.log("Platform file drop processed and sent to Go.");
149
- })
150
- .catch(err => {
151
- // Optional: Log error
152
- console.error("Error sending platform file drop to Go:", err);
153
- });
154
- }
package/dist/window.js CHANGED
@@ -8,10 +8,10 @@ The electron alternative for Go
8
8
  (c) Lea Anthony 2019-present
9
9
  */
10
10
  import { newRuntimeCaller, objectNames } from "./runtime.js";
11
- // NEW: Dropzone constants
12
- const DROPZONE_ATTRIBUTE = 'data-wails-dropzone';
13
- const DROPZONE_HOVER_CLASS = 'wails-dropzone-hover'; // User can style this class
14
- let currentHoveredDropzone = null;
11
+ // Drop target constants
12
+ const DROP_TARGET_ATTRIBUTE = 'data-file-drop-target';
13
+ const DROP_TARGET_ACTIVE_CLASS = 'file-drop-target-active';
14
+ let currentDropTarget = null;
15
15
  const PositionMethod = 0;
16
16
  const CenterMethod = 1;
17
17
  const CloseMethod = 2;
@@ -62,15 +62,98 @@ const ZoomInMethod = 46;
62
62
  const ZoomOutMethod = 47;
63
63
  const ZoomResetMethod = 48;
64
64
  const SnapAssistMethod = 49;
65
- const WindowDropZoneDropped = 50;
65
+ const FilesDropped = 50;
66
66
  const PrintMethod = 51;
67
- function getDropzoneElement(element) {
67
+ /**
68
+ * Finds the nearest drop target element by walking up the DOM tree.
69
+ */
70
+ function getDropTargetElement(element) {
68
71
  if (!element) {
69
72
  return null;
70
73
  }
71
- // Allow dropzone attribute to be on the element itself or any parent
72
- return element.closest(`[${DROPZONE_ATTRIBUTE}]`);
74
+ return element.closest(`[${DROP_TARGET_ATTRIBUTE}]`);
75
+ }
76
+ /**
77
+ * Check if we can use WebView2's postMessageWithAdditionalObjects (Windows)
78
+ * Also checks that EnableFileDrop is true for this window.
79
+ */
80
+ function canResolveFilePaths() {
81
+ var _a, _b, _c, _d;
82
+ // Must have WebView2's postMessageWithAdditionalObjects API (Windows only)
83
+ if (((_b = (_a = window.chrome) === null || _a === void 0 ? void 0 : _a.webview) === null || _b === void 0 ? void 0 : _b.postMessageWithAdditionalObjects) == null) {
84
+ return false;
85
+ }
86
+ // Must have EnableFileDrop set to true for this window
87
+ // This flag is set by the Go backend during runtime initialization
88
+ return ((_d = (_c = window._wails) === null || _c === void 0 ? void 0 : _c.flags) === null || _d === void 0 ? void 0 : _d.enableFileDrop) === true;
89
+ }
90
+ /**
91
+ * Send file drop to backend via WebView2 (Windows only)
92
+ */
93
+ function resolveFilePaths(x, y, files) {
94
+ var _a, _b;
95
+ if ((_b = (_a = window.chrome) === null || _a === void 0 ? void 0 : _a.webview) === null || _b === void 0 ? void 0 : _b.postMessageWithAdditionalObjects) {
96
+ window.chrome.webview.postMessageWithAdditionalObjects(`file:drop:${x}:${y}`, files);
97
+ }
98
+ }
99
+ // Native drag state (Linux/macOS intercept DOM drag events)
100
+ let nativeDragActive = false;
101
+ /**
102
+ * Cleans up native drag state and hover effects.
103
+ * Called on drop or when drag leaves the window.
104
+ */
105
+ function cleanupNativeDrag() {
106
+ nativeDragActive = false;
107
+ if (currentDropTarget) {
108
+ currentDropTarget.classList.remove(DROP_TARGET_ACTIVE_CLASS);
109
+ currentDropTarget = null;
110
+ }
111
+ }
112
+ /**
113
+ * Called from Go when a file drag enters the window on Linux/macOS.
114
+ */
115
+ function handleDragEnter() {
116
+ var _a, _b;
117
+ // Check if file drops are enabled for this window
118
+ if (((_b = (_a = window._wails) === null || _a === void 0 ? void 0 : _a.flags) === null || _b === void 0 ? void 0 : _b.enableFileDrop) === false) {
119
+ return; // File drops disabled, don't activate drag state
120
+ }
121
+ nativeDragActive = true;
122
+ }
123
+ /**
124
+ * Called from Go when a file drag leaves the window on Linux/macOS.
125
+ */
126
+ function handleDragLeave() {
127
+ cleanupNativeDrag();
128
+ }
129
+ /**
130
+ * Called from Go during file drag to update hover state on Linux/macOS.
131
+ * @param x - X coordinate in CSS pixels
132
+ * @param y - Y coordinate in CSS pixels
133
+ */
134
+ function handleDragOver(x, y) {
135
+ var _a, _b;
136
+ if (!nativeDragActive)
137
+ return;
138
+ // Check if file drops are enabled for this window
139
+ if (((_b = (_a = window._wails) === null || _a === void 0 ? void 0 : _a.flags) === null || _b === void 0 ? void 0 : _b.enableFileDrop) === false) {
140
+ return; // File drops disabled, don't show hover effects
141
+ }
142
+ const targetElement = document.elementFromPoint(x, y);
143
+ const dropTarget = getDropTargetElement(targetElement);
144
+ if (currentDropTarget && currentDropTarget !== dropTarget) {
145
+ currentDropTarget.classList.remove(DROP_TARGET_ACTIVE_CLASS);
146
+ }
147
+ if (dropTarget) {
148
+ dropTarget.classList.add(DROP_TARGET_ACTIVE_CLASS);
149
+ currentDropTarget = dropTarget;
150
+ }
151
+ else {
152
+ currentDropTarget = null;
153
+ }
73
154
  }
155
+ // Export the handlers for use by Go via index.ts
156
+ export { handleDragEnter, handleDragLeave, handleDragOver };
74
157
  // Private field names.
75
158
  const callerSym = Symbol("caller");
76
159
  class Window {
@@ -452,30 +535,32 @@ class Window {
452
535
  return this[callerSym](ZoomResetMethod);
453
536
  }
454
537
  /**
455
- * Handles file drops originating from platform-specific code (e.g., macOS native drag-and-drop).
538
+ * Handles file drops originating from platform-specific code (e.g., macOS/Linux native drag-and-drop).
456
539
  * Gathers information about the drop target element and sends it back to the Go backend.
457
540
  *
458
541
  * @param filenames - An array of file paths (strings) that were dropped.
459
- * @param x - The x-coordinate of the drop event.
460
- * @param y - The y-coordinate of the drop event.
542
+ * @param x - The x-coordinate of the drop event (CSS pixels).
543
+ * @param y - The y-coordinate of the drop event (CSS pixels).
461
544
  */
462
545
  HandlePlatformFileDrop(filenames, x, y) {
546
+ var _a, _b;
547
+ // Check if file drops are enabled for this window
548
+ if (((_b = (_a = window._wails) === null || _a === void 0 ? void 0 : _a.flags) === null || _b === void 0 ? void 0 : _b.enableFileDrop) === false) {
549
+ return; // File drops disabled, ignore the drop
550
+ }
463
551
  const element = document.elementFromPoint(x, y);
464
- // NEW: Check if the drop target is a valid dropzone
465
- const dropzoneTarget = getDropzoneElement(element);
466
- if (!dropzoneTarget) {
467
- console.log(`Wails Runtime: Drop on element (or no element) at ${x},${y} which is not a designated dropzone. Ignoring. Element:`, element);
468
- // No need to call backend if not a valid dropzone target
552
+ const dropTarget = getDropTargetElement(element);
553
+ if (!dropTarget) {
554
+ // Drop was not on a designated drop target - ignore
469
555
  return;
470
556
  }
471
- console.log(`Wails Runtime: Drop on designated dropzone. Element at (${x}, ${y}):`, element, 'Effective dropzone:', dropzoneTarget);
472
557
  const elementDetails = {
473
- id: dropzoneTarget.id,
474
- classList: Array.from(dropzoneTarget.classList),
558
+ id: dropTarget.id,
559
+ classList: Array.from(dropTarget.classList),
475
560
  attributes: {},
476
561
  };
477
- for (let i = 0; i < dropzoneTarget.attributes.length; i++) {
478
- const attr = dropzoneTarget.attributes[i];
562
+ for (let i = 0; i < dropTarget.attributes.length; i++) {
563
+ const attr = dropTarget.attributes[i];
479
564
  elementDetails.attributes[attr.name] = attr.value;
480
565
  }
481
566
  const payload = {
@@ -484,7 +569,9 @@ class Window {
484
569
  y,
485
570
  elementDetails,
486
571
  };
487
- this[callerSym](WindowDropZoneDropped, payload);
572
+ this[callerSym](FilesDropped, payload);
573
+ // Clean up native drag state after drop
574
+ cleanupNativeDrag();
488
575
  }
489
576
  /* Triggers Windows 11 Snap Assist feature (Windows only).
490
577
  * This is equivalent to pressing Win+Z and shows snap layout options.
@@ -503,75 +590,136 @@ class Window {
503
590
  * The window within which the script is running.
504
591
  */
505
592
  const thisWindow = new Window('');
506
- // NEW: Global Drag Event Listeners
507
- function setupGlobalDropzoneListeners() {
593
+ /**
594
+ * Sets up global drag and drop event listeners for file drops.
595
+ * Handles visual feedback (hover state) and file drop processing.
596
+ */
597
+ function setupDropTargetListeners() {
508
598
  const docElement = document.documentElement;
509
- let dragEnterCounter = 0; // To handle dragenter/dragleave on child elements
599
+ let dragEnterCounter = 0;
510
600
  docElement.addEventListener('dragenter', (event) => {
511
- event.preventDefault();
512
- if (event.dataTransfer && event.dataTransfer.types.includes('Files')) {
513
- dragEnterCounter++;
514
- const targetElement = document.elementFromPoint(event.clientX, event.clientY);
515
- const dropzone = getDropzoneElement(targetElement);
516
- // Clear previous hover regardless, then apply new if valid
517
- if (currentHoveredDropzone && currentHoveredDropzone !== dropzone) {
518
- currentHoveredDropzone.classList.remove(DROPZONE_HOVER_CLASS);
519
- }
520
- if (dropzone) {
521
- dropzone.classList.add(DROPZONE_HOVER_CLASS);
522
- event.dataTransfer.dropEffect = 'copy';
523
- currentHoveredDropzone = dropzone;
524
- }
525
- else {
526
- event.dataTransfer.dropEffect = 'none';
527
- currentHoveredDropzone = null; // Ensure it's cleared if no dropzone found
528
- }
601
+ var _a, _b, _c;
602
+ if (!((_a = event.dataTransfer) === null || _a === void 0 ? void 0 : _a.types.includes('Files'))) {
603
+ return; // Only handle file drags, let other drags pass through
604
+ }
605
+ event.preventDefault(); // Always prevent default to stop browser navigation
606
+ // On Windows, check if file drops are enabled for this window
607
+ if (((_c = (_b = window._wails) === null || _b === void 0 ? void 0 : _b.flags) === null || _c === void 0 ? void 0 : _c.enableFileDrop) === false) {
608
+ event.dataTransfer.dropEffect = 'none'; // Show "no drop" cursor
609
+ return; // File drops disabled, don't show hover effects
610
+ }
611
+ dragEnterCounter++;
612
+ const targetElement = document.elementFromPoint(event.clientX, event.clientY);
613
+ const dropTarget = getDropTargetElement(targetElement);
614
+ // Update hover state
615
+ if (currentDropTarget && currentDropTarget !== dropTarget) {
616
+ currentDropTarget.classList.remove(DROP_TARGET_ACTIVE_CLASS);
617
+ }
618
+ if (dropTarget) {
619
+ dropTarget.classList.add(DROP_TARGET_ACTIVE_CLASS);
620
+ event.dataTransfer.dropEffect = 'copy';
621
+ currentDropTarget = dropTarget;
622
+ }
623
+ else {
624
+ event.dataTransfer.dropEffect = 'none';
625
+ currentDropTarget = null;
529
626
  }
530
627
  }, false);
531
628
  docElement.addEventListener('dragover', (event) => {
532
- event.preventDefault(); // Necessary to allow drop
533
- if (event.dataTransfer && event.dataTransfer.types.includes('Files')) {
534
- // No need to query elementFromPoint again if already handled by dragenter correctly
535
- // Just ensure dropEffect is continuously set based on currentHoveredDropzone
536
- if (currentHoveredDropzone) {
537
- // Re-apply class just in case it was removed by some other JS
538
- if (!currentHoveredDropzone.classList.contains(DROPZONE_HOVER_CLASS)) {
539
- currentHoveredDropzone.classList.add(DROPZONE_HOVER_CLASS);
540
- }
541
- event.dataTransfer.dropEffect = 'copy';
542
- }
543
- else {
544
- event.dataTransfer.dropEffect = 'none';
629
+ var _a, _b, _c;
630
+ if (!((_a = event.dataTransfer) === null || _a === void 0 ? void 0 : _a.types.includes('Files'))) {
631
+ return; // Only handle file drags
632
+ }
633
+ event.preventDefault(); // Always prevent default to stop browser navigation
634
+ // On Windows, check if file drops are enabled for this window
635
+ if (((_c = (_b = window._wails) === null || _b === void 0 ? void 0 : _b.flags) === null || _c === void 0 ? void 0 : _c.enableFileDrop) === false) {
636
+ event.dataTransfer.dropEffect = 'none'; // Show "no drop" cursor
637
+ return; // File drops disabled, don't show hover effects
638
+ }
639
+ // Update drop target as cursor moves
640
+ const targetElement = document.elementFromPoint(event.clientX, event.clientY);
641
+ const dropTarget = getDropTargetElement(targetElement);
642
+ if (currentDropTarget && currentDropTarget !== dropTarget) {
643
+ currentDropTarget.classList.remove(DROP_TARGET_ACTIVE_CLASS);
644
+ }
645
+ if (dropTarget) {
646
+ if (!dropTarget.classList.contains(DROP_TARGET_ACTIVE_CLASS)) {
647
+ dropTarget.classList.add(DROP_TARGET_ACTIVE_CLASS);
545
648
  }
649
+ event.dataTransfer.dropEffect = 'copy';
650
+ currentDropTarget = dropTarget;
651
+ }
652
+ else {
653
+ event.dataTransfer.dropEffect = 'none';
654
+ currentDropTarget = null;
546
655
  }
547
656
  }, false);
548
657
  docElement.addEventListener('dragleave', (event) => {
549
- event.preventDefault();
550
- if (event.dataTransfer && event.dataTransfer.types.includes('Files')) {
551
- dragEnterCounter--;
552
- // Only remove hover if drag truly left the window or the last dropzone
553
- if (dragEnterCounter === 0 || event.relatedTarget === null || (currentHoveredDropzone && !currentHoveredDropzone.contains(event.relatedTarget))) {
554
- if (currentHoveredDropzone) {
555
- currentHoveredDropzone.classList.remove(DROPZONE_HOVER_CLASS);
556
- currentHoveredDropzone = null;
557
- }
558
- dragEnterCounter = 0; // Reset counter if it went negative or left window
658
+ var _a, _b, _c;
659
+ if (!((_a = event.dataTransfer) === null || _a === void 0 ? void 0 : _a.types.includes('Files'))) {
660
+ return;
661
+ }
662
+ event.preventDefault(); // Always prevent default to stop browser navigation
663
+ // On Windows, check if file drops are enabled for this window
664
+ if (((_c = (_b = window._wails) === null || _b === void 0 ? void 0 : _b.flags) === null || _c === void 0 ? void 0 : _c.enableFileDrop) === false) {
665
+ return;
666
+ }
667
+ // On Linux/WebKitGTK and macOS, dragleave fires immediately with relatedTarget=null when native
668
+ // drag handling is involved. Ignore these spurious events - we'll clean up on drop instead.
669
+ if (event.relatedTarget === null) {
670
+ return;
671
+ }
672
+ dragEnterCounter--;
673
+ if (dragEnterCounter === 0 ||
674
+ (currentDropTarget && !currentDropTarget.contains(event.relatedTarget))) {
675
+ if (currentDropTarget) {
676
+ currentDropTarget.classList.remove(DROP_TARGET_ACTIVE_CLASS);
677
+ currentDropTarget = null;
559
678
  }
679
+ dragEnterCounter = 0;
560
680
  }
561
681
  }, false);
562
682
  docElement.addEventListener('drop', (event) => {
563
- event.preventDefault(); // Prevent default browser file handling
564
- dragEnterCounter = 0; // Reset counter
565
- if (currentHoveredDropzone) {
566
- currentHoveredDropzone.classList.remove(DROPZONE_HOVER_CLASS);
567
- currentHoveredDropzone = null;
683
+ var _a, _b, _c;
684
+ if (!((_a = event.dataTransfer) === null || _a === void 0 ? void 0 : _a.types.includes('Files'))) {
685
+ return; // Only handle file drops
686
+ }
687
+ event.preventDefault(); // Always prevent default to stop browser navigation
688
+ // On Windows, check if file drops are enabled for this window
689
+ if (((_c = (_b = window._wails) === null || _b === void 0 ? void 0 : _b.flags) === null || _c === void 0 ? void 0 : _c.enableFileDrop) === false) {
690
+ return;
691
+ }
692
+ dragEnterCounter = 0;
693
+ if (currentDropTarget) {
694
+ currentDropTarget.classList.remove(DROP_TARGET_ACTIVE_CLASS);
695
+ currentDropTarget = null;
696
+ }
697
+ // On Windows, handle file drops via JavaScript
698
+ // On macOS/Linux, native code will call HandlePlatformFileDrop
699
+ if (canResolveFilePaths()) {
700
+ const files = [];
701
+ if (event.dataTransfer.items) {
702
+ for (const item of event.dataTransfer.items) {
703
+ if (item.kind === 'file') {
704
+ const file = item.getAsFile();
705
+ if (file)
706
+ files.push(file);
707
+ }
708
+ }
709
+ }
710
+ else if (event.dataTransfer.files) {
711
+ for (const file of event.dataTransfer.files) {
712
+ files.push(file);
713
+ }
714
+ }
715
+ if (files.length > 0) {
716
+ resolveFilePaths(event.clientX, event.clientY, files);
717
+ }
568
718
  }
569
- // The actual drop processing is initiated by the native side calling HandlePlatformFileDrop
570
- // HandlePlatformFileDrop will then check if the drop was on a valid zone.
571
719
  }, false);
572
720
  }
573
721
  // Initialize listeners when the script loads
574
722
  if (typeof window !== "undefined" && typeof document !== "undefined") {
575
- setupGlobalDropzoneListeners();
723
+ setupDropTargetListeners();
576
724
  }
577
725
  export default thisWindow;
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.77",
4
+ "version": "3.0.0-alpha.79",
5
5
  "description": "Wails Runtime",
6
6
  "types": "types/index.d.ts",
7
7
  "exports": {
@@ -243,6 +243,5 @@ export declare const Types: Readonly<{
243
243
  WindowZoomIn: "common:WindowZoomIn";
244
244
  WindowZoomOut: "common:WindowZoomOut";
245
245
  WindowZoomReset: "common:WindowZoomReset";
246
- WindowDropZoneFilesDropped: "common:WindowDropZoneFilesDropped";
247
246
  }>;
248
247
  }>;
package/types/index.d.ts CHANGED
@@ -22,3 +22,9 @@ export { Application, Browser, Call, Clipboard, Dialogs, Events, Flags, Screens,
22
22
  export { Create };
23
23
  export * from "./cancellable.js";
24
24
  export { setTransport, getTransport, type RuntimeTransport, objectNames, clientId, } from "./runtime.js";
25
+ /**
26
+ * Loads a script from the given URL if it exists.
27
+ * Uses HEAD request to check existence, then injects a script tag.
28
+ * Silently ignores if the script doesn't exist.
29
+ */
30
+ export declare function loadOptionalScript(url: string): Promise<void>;
package/types/system.d.ts CHANGED
@@ -81,12 +81,3 @@ export declare function IsARM64(): boolean;
81
81
  * @returns True if the app is being run in debug mode.
82
82
  */
83
83
  export declare function IsDebug(): boolean;
84
- /**
85
- * Handles file drops originating from platform-specific code (e.g., macOS native drag-and-drop).
86
- * Gathers information about the drop target element and sends it back to the Go backend.
87
- *
88
- * @param filenames - An array of file paths (strings) that were dropped.
89
- * @param x - The x-coordinate of the drop event.
90
- * @param y - The y-coordinate of the drop event.
91
- */
92
- export declare function HandlePlatformFileDrop(filenames: string[], x: number, y: number): void;
package/types/window.d.ts CHANGED
@@ -1,4 +1,19 @@
1
1
  import type { Screen } from "./screens.js";
2
+ /**
3
+ * Called from Go when a file drag enters the window on Linux/macOS.
4
+ */
5
+ declare function handleDragEnter(): void;
6
+ /**
7
+ * Called from Go when a file drag leaves the window on Linux/macOS.
8
+ */
9
+ declare function handleDragLeave(): void;
10
+ /**
11
+ * Called from Go during file drag to update hover state on Linux/macOS.
12
+ * @param x - X coordinate in CSS pixels
13
+ * @param y - Y coordinate in CSS pixels
14
+ */
15
+ declare function handleDragOver(x: number, y: number): void;
16
+ export { handleDragEnter, handleDragLeave, handleDragOver };
2
17
  /**
3
18
  * A record describing the position of a window.
4
19
  */
@@ -289,12 +304,12 @@ declare class Window {
289
304
  */
290
305
  ZoomReset(): Promise<void>;
291
306
  /**
292
- * Handles file drops originating from platform-specific code (e.g., macOS native drag-and-drop).
307
+ * Handles file drops originating from platform-specific code (e.g., macOS/Linux native drag-and-drop).
293
308
  * Gathers information about the drop target element and sends it back to the Go backend.
294
309
  *
295
310
  * @param filenames - An array of file paths (strings) that were dropped.
296
- * @param x - The x-coordinate of the drop event.
297
- * @param y - The y-coordinate of the drop event.
311
+ * @param x - The x-coordinate of the drop event (CSS pixels).
312
+ * @param y - The y-coordinate of the drop event (CSS pixels).
298
313
  */
299
314
  HandlePlatformFileDrop(filenames: string[], x: number, y: number): void;
300
315
  SnapAssist(): Promise<void>;