overlay-toolkit 0.11.3 → 0.12.0

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.
@@ -0,0 +1,40 @@
1
+ import { IOverlayAPI, OverlayCallMessage } from './overlay';
2
+ interface CommonFilePickerOptions {
3
+ excludeAcceptAllOption?: boolean;
4
+ id?: string;
5
+ startIn?: "desktop" | "documents" | "downloads" | "music" | "pictures" | "videos" | string;
6
+ types: {
7
+ description?: string;
8
+ accept: Record<string, string[]>;
9
+ }[];
10
+ }
11
+ export interface SaveFilePickerOptions extends CommonFilePickerOptions {
12
+ suggestedName?: string;
13
+ }
14
+ export interface OpenFilePickerOptions extends CommonFilePickerOptions {
15
+ multiple?: boolean;
16
+ }
17
+ export declare const showSaveFilePicker: (options?: SaveFilePickerOptions) => OverlayCallMessage;
18
+ export declare const showOpenFilePicker: (options?: OpenFilePickerOptions) => OverlayCallMessage;
19
+ /**
20
+ * FileSystem class provides methods to interact with the file system through OverlayPlugin's API.
21
+ * It implements the File System Access API-like interface, allowing you to show file pickers,
22
+ * read files, and write files using the plugin's capabilities.
23
+ */
24
+ export declare class FileSystem {
25
+ api: IOverlayAPI;
26
+ constructor(api: IOverlayAPI);
27
+ /**
28
+ * Show the save file picker dialog.
29
+ * @param options SaveFilePickerOptions to configure the file picker
30
+ * @returns A promise that resolves to a FileSystemFileHandle for the selected file
31
+ */
32
+ showSaveFilePicker(options?: SaveFilePickerOptions): Promise<FileSystemFileHandle>;
33
+ /**
34
+ * Show the open file picker dialog.
35
+ * @param options OpenFilePickerOptions to configure the file picker
36
+ * @returns A promise that resolves to an array of FileSystemFileHandle for the selected files
37
+ */
38
+ showOpenFilePicker(options?: OpenFilePickerOptions): Promise<FileSystemFileHandle[]>;
39
+ }
40
+ export {};
package/dist/otk.d.ts CHANGED
@@ -1,5 +1,6 @@
1
1
  import { OverlayHID } from './hid';
2
2
  import { OverlayCallMessage, OverlayPluginAPI } from './overlay';
3
+ import { FileSystem } from './file_system';
3
4
  import { PacketFilter, PacketHandler } from './packet';
4
5
  export interface DispatchMessage {
5
6
  type: string;
@@ -13,15 +14,26 @@ export declare class OverlayToolkit {
13
14
  * HID interface
14
15
  */
15
16
  hid: OverlayHID;
17
+ fs: FileSystem;
16
18
  api: OverlayPluginAPI;
17
19
  constructor();
18
20
  /**
19
21
  * Fetch acts like window.fetch but without CORS restrictions
22
+ *
23
+ * This is old behavior for backward compatibility, new code should use fetch() instead which returns a valid Response object
20
24
  * @param url target URL
21
25
  * @param options options
22
26
  * @returns response
27
+ * @deprecated use fetch() instead which returns a valid Response object
23
28
  */
24
29
  Fetch(url: string, options?: RequestInit): Promise<Response>;
30
+ /**
31
+ * fetch acts like window.fetch but without CORS restrictions, returns response body as text.
32
+ * @param url
33
+ * @param options
34
+ * @returns
35
+ */
36
+ fetch(url: string, options?: RequestInit): Promise<Response>;
25
37
  /**
26
38
  * Subscribe to game packets
27
39
  * @param name subscription name
@@ -46,6 +58,11 @@ export declare class OverlayToolkit {
46
58
  * @returns get plugin version
47
59
  */
48
60
  GetPluginVersion(): Promise<string>;
61
+ /**
62
+ * Open URL in default browser
63
+ * @param url URL to open
64
+ */
65
+ OpenBrowser(url: string): Promise<void>;
49
66
  /**
50
67
  * Call start overlay events
51
68
  *
@@ -123,4 +140,8 @@ export declare class OverlayToolkit {
123
140
  * @returns
124
141
  */
125
142
  Connect(wsUrl?: string | null): void;
143
+ /**
144
+ * Check if connected to OverlayPlugin
145
+ */
146
+ get isConnected(): boolean;
126
147
  }