@bobfrankston/msger 0.1.73 → 0.1.75
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.
- package/KNOWN-BUGS.md +121 -0
- package/MSGER-API-SUMMARY.md +162 -0
- package/MSGER-API.md +376 -0
- package/README.md +93 -0
- package/SESSION-2025-11-06.md +191 -0
- package/SESSION-NOTES.md +678 -0
- package/clihandler.d.ts.map +1 -1
- package/clihandler.js +62 -2
- package/clihandler.js.map +1 -1
- package/clihandler.ts +60 -2
- package/icon.png +0 -0
- package/icon1.png +0 -0
- package/msger-native/Cargo.toml +1 -0
- package/msger-native/bin/msgernative.exe +0 -0
- package/msger-native/bin/msgernative.exe.WebView2/EBWebView/Breadcrumbs +12 -118
- package/msger-native/bin/msgernative.exe.WebView2/EBWebView/BrowserMetrics/{BrowserMetrics-690552AF-DCD4.pma → BrowserMetrics-690B9AD3-657C.pma} +0 -0
- package/msger-native/bin/msgernative.exe.WebView2/EBWebView/BrowserMetrics/{BrowserMetrics-69055373-F88C.pma → BrowserMetrics-690BA05A-501C.pma} +0 -0
- package/msger-native/bin/msgernative.exe.WebView2/EBWebView/Crashpad/settings.dat +0 -0
- package/msger-native/bin/msgernative.exe.WebView2/EBWebView/Default/BrowsingTopicsState +1 -1
- package/msger-native/bin/msgernative.exe.WebView2/EBWebView/Default/Cache/Cache_Data/data_0 +0 -0
- package/msger-native/bin/msgernative.exe.WebView2/EBWebView/Default/Cache/Cache_Data/data_1 +0 -0
- package/msger-native/bin/msgernative.exe.WebView2/EBWebView/{BrowserMetrics/BrowserMetrics-69055587-A65C.pma → Default/Cache/Cache_Data/data_2} +0 -0
- package/msger-native/bin/msgernative.exe.WebView2/EBWebView/Default/Cache/Cache_Data/data_3 +0 -0
- package/msger-native/bin/msgernative.exe.WebView2/EBWebView/Default/Cache/Cache_Data/f_000001 +383 -0
- package/msger-native/bin/msgernative.exe.WebView2/EBWebView/Default/Cache/Cache_Data/f_000002 +1091 -0
- package/msger-native/bin/msgernative.exe.WebView2/EBWebView/Default/Cache/Cache_Data/f_000003 +2153 -0
- package/msger-native/bin/msgernative.exe.WebView2/EBWebView/Default/Cache/Cache_Data/f_000004 +0 -0
- package/msger-native/bin/msgernative.exe.WebView2/EBWebView/Default/Cache/Cache_Data/f_000005 +626 -0
- package/msger-native/bin/msgernative.exe.WebView2/EBWebView/Default/Cache/Cache_Data/f_000006 +393 -0
- package/msger-native/bin/msgernative.exe.WebView2/EBWebView/Default/Cache/Cache_Data/index +0 -0
- package/msger-native/bin/msgernative.exe.WebView2/EBWebView/Default/Code Cache/js/01241693cfdc32b9_0 +0 -0
- package/msger-native/bin/msgernative.exe.WebView2/EBWebView/Default/Code Cache/js/0ba1eea781f3552c_0 +0 -0
- package/msger-native/bin/msgernative.exe.WebView2/EBWebView/Default/Code Cache/js/323aa210eebefe2c_0 +0 -0
- package/msger-native/bin/msgernative.exe.WebView2/EBWebView/Default/Code Cache/js/4608446ac118e77a_0 +0 -0
- package/msger-native/bin/msgernative.exe.WebView2/EBWebView/Default/Code Cache/js/6938205dc2f77841_0 +0 -0
- package/msger-native/bin/msgernative.exe.WebView2/EBWebView/Default/Code Cache/js/6de12299dc89e5f3_0 +0 -0
- package/msger-native/bin/msgernative.exe.WebView2/EBWebView/Default/Code Cache/js/8f403c112eaa455b_0 +0 -0
- package/msger-native/bin/msgernative.exe.WebView2/EBWebView/Default/Code Cache/js/9a3aceb491137f07_0 +0 -0
- package/msger-native/bin/msgernative.exe.WebView2/EBWebView/Default/Code Cache/js/aedb266cbaf9c28f_0 +0 -0
- package/msger-native/bin/msgernative.exe.WebView2/EBWebView/Default/Code Cache/js/ca526fdda86d0b9d_0 +0 -0
- package/msger-native/bin/msgernative.exe.WebView2/EBWebView/Default/Code Cache/js/f5d11d783c9fdf69_0 +0 -0
- package/msger-native/bin/msgernative.exe.WebView2/EBWebView/Default/Code Cache/js/index-dir/the-real-index +0 -0
- package/msger-native/bin/msgernative.exe.WebView2/EBWebView/Default/Collections/collectionsSQLite +0 -0
- package/msger-native/bin/msgernative.exe.WebView2/EBWebView/Default/Collections/collectionsSQLite-journal +0 -0
- package/msger-native/bin/msgernative.exe.WebView2/EBWebView/Default/DIPS +0 -0
- package/msger-native/bin/msgernative.exe.WebView2/EBWebView/Default/DawnGraphiteCache/data_1 +0 -0
- package/msger-native/bin/msgernative.exe.WebView2/EBWebView/Default/DawnGraphiteCache/index +0 -0
- package/msger-native/bin/msgernative.exe.WebView2/EBWebView/Default/DawnWebGPUCache/data_1 +0 -0
- package/msger-native/bin/msgernative.exe.WebView2/EBWebView/Default/DawnWebGPUCache/index +0 -0
- package/msger-native/bin/msgernative.exe.WebView2/EBWebView/Default/Extension State/LOG +3 -3
- package/msger-native/bin/msgernative.exe.WebView2/EBWebView/Default/Extension State/LOG.old +3 -3
- package/msger-native/bin/msgernative.exe.WebView2/EBWebView/Default/Favicons +0 -0
- package/msger-native/bin/msgernative.exe.WebView2/EBWebView/Default/GPUCache/data_0 +0 -0
- package/msger-native/bin/msgernative.exe.WebView2/EBWebView/Default/GPUCache/data_1 +0 -0
- package/msger-native/bin/msgernative.exe.WebView2/EBWebView/Default/GPUCache/data_2 +0 -0
- package/msger-native/bin/msgernative.exe.WebView2/EBWebView/Default/GPUCache/index +0 -0
- package/msger-native/bin/msgernative.exe.WebView2/EBWebView/Default/History +0 -0
- package/msger-native/bin/msgernative.exe.WebView2/EBWebView/Default/Local Storage/leveldb/000003.log +0 -0
- package/msger-native/bin/msgernative.exe.WebView2/EBWebView/Default/Local Storage/leveldb/LOG +3 -3
- package/msger-native/bin/msgernative.exe.WebView2/EBWebView/Default/Local Storage/leveldb/LOG.old +3 -3
- package/msger-native/bin/msgernative.exe.WebView2/EBWebView/Default/MediaDeviceSalts +0 -0
- package/msger-native/bin/msgernative.exe.WebView2/EBWebView/Default/MediaDeviceSalts-journal +0 -0
- package/msger-native/bin/msgernative.exe.WebView2/EBWebView/Default/Network/Network Persistent State +1 -1
- package/msger-native/bin/msgernative.exe.WebView2/EBWebView/Default/Network/TransportSecurity +1 -0
- package/msger-native/bin/msgernative.exe.WebView2/EBWebView/Default/Preferences +1 -1
- package/msger-native/bin/msgernative.exe.WebView2/EBWebView/Default/Service Worker/CacheStorage/14e849fa8522d406112ea607cf7fd6342b71b987/249ee9af-c3df-4a86-89a8-2c51f3370ee0/index +0 -0
- package/msger-native/bin/msgernative.exe.WebView2/EBWebView/Default/Service Worker/CacheStorage/14e849fa8522d406112ea607cf7fd6342b71b987/249ee9af-c3df-4a86-89a8-2c51f3370ee0/index-dir/the-real-index +0 -0
- package/msger-native/bin/msgernative.exe.WebView2/EBWebView/Default/Service Worker/CacheStorage/14e849fa8522d406112ea607cf7fd6342b71b987/index.txt +0 -0
- package/msger-native/bin/msgernative.exe.WebView2/EBWebView/Default/Service Worker/Database/000003.log +0 -0
- package/msger-native/bin/msgernative.exe.WebView2/EBWebView/Default/Service Worker/Database/CURRENT +1 -0
- package/msger-native/bin/msgernative.exe.WebView2/EBWebView/Default/Service Worker/Database/LOCK +0 -0
- package/msger-native/bin/msgernative.exe.WebView2/EBWebView/Default/Service Worker/Database/LOG +3 -0
- package/msger-native/bin/msgernative.exe.WebView2/EBWebView/Default/Service Worker/Database/LOG.old +3 -0
- package/msger-native/bin/msgernative.exe.WebView2/EBWebView/Default/Service Worker/Database/MANIFEST-000001 +0 -0
- package/msger-native/bin/msgernative.exe.WebView2/EBWebView/Default/Service Worker/ScriptCache/2cc80dabc69f58b6_0 +0 -0
- package/msger-native/bin/msgernative.exe.WebView2/EBWebView/Default/Service Worker/ScriptCache/2cc80dabc69f58b6_1 +0 -0
- package/msger-native/bin/msgernative.exe.WebView2/EBWebView/Default/Service Worker/ScriptCache/index +0 -0
- package/msger-native/bin/msgernative.exe.WebView2/EBWebView/Default/Service Worker/ScriptCache/index-dir/the-real-index +0 -0
- package/msger-native/bin/msgernative.exe.WebView2/EBWebView/Default/Session Storage/000003.log +0 -0
- package/msger-native/bin/msgernative.exe.WebView2/EBWebView/Default/Session Storage/LOG +3 -3
- package/msger-native/bin/msgernative.exe.WebView2/EBWebView/Default/Session Storage/LOG.old +3 -3
- package/msger-native/bin/msgernative.exe.WebView2/EBWebView/Default/Site Characteristics Database/000003.log +0 -0
- package/msger-native/bin/msgernative.exe.WebView2/EBWebView/Default/Site Characteristics Database/LOG +3 -3
- package/msger-native/bin/msgernative.exe.WebView2/EBWebView/Default/Site Characteristics Database/LOG.old +3 -3
- package/msger-native/bin/msgernative.exe.WebView2/EBWebView/Default/Sync Data/LevelDB/LOG +3 -3
- package/msger-native/bin/msgernative.exe.WebView2/EBWebView/Default/Sync Data/LevelDB/LOG.old +3 -3
- package/msger-native/bin/msgernative.exe.WebView2/EBWebView/Default/WebStorage/QuotaManager +0 -0
- package/msger-native/bin/msgernative.exe.WebView2/EBWebView/Default/WebStorage/QuotaManager-journal +0 -0
- package/msger-native/bin/msgernative.exe.WebView2/EBWebView/Default/favorites_diagnostic.log +27 -0
- package/msger-native/bin/msgernative.exe.WebView2/EBWebView/Default/shared_proto_db/000003.log +0 -0
- package/msger-native/bin/msgernative.exe.WebView2/EBWebView/Default/shared_proto_db/LOG +3 -3
- package/msger-native/bin/msgernative.exe.WebView2/EBWebView/Default/shared_proto_db/LOG.old +3 -3
- package/msger-native/bin/msgernative.exe.WebView2/EBWebView/Default/shared_proto_db/metadata/000003.log +0 -0
- package/msger-native/bin/msgernative.exe.WebView2/EBWebView/Default/shared_proto_db/metadata/LOG +3 -3
- package/msger-native/bin/msgernative.exe.WebView2/EBWebView/Default/shared_proto_db/metadata/LOG.old +3 -3
- package/msger-native/bin/msgernative.exe.WebView2/EBWebView/GrShaderCache/data_0 +0 -0
- package/msger-native/bin/msgernative.exe.WebView2/EBWebView/GrShaderCache/data_1 +0 -0
- package/msger-native/bin/msgernative.exe.WebView2/EBWebView/GrShaderCache/data_3 +0 -0
- package/msger-native/bin/msgernative.exe.WebView2/EBWebView/GrShaderCache/f_000003 +0 -0
- package/msger-native/bin/msgernative.exe.WebView2/EBWebView/GrShaderCache/f_000004 +0 -0
- package/msger-native/bin/msgernative.exe.WebView2/EBWebView/GrShaderCache/index +0 -0
- package/msger-native/bin/msgernative.exe.WebView2/EBWebView/GraphiteDawnCache/data_1 +0 -0
- package/msger-native/bin/msgernative.exe.WebView2/EBWebView/GraphiteDawnCache/index +0 -0
- package/msger-native/bin/msgernative.exe.WebView2/EBWebView/Local State +1 -1
- package/msger-native/bin/msgernative.exe.WebView2/EBWebView/RevisitationBloomfilter +0 -0
- package/msger-native/bin/msgernative.exe.WebView2/EBWebView/ShaderCache/data_1 +0 -0
- package/msger-native/bin/msgernative.exe.WebView2/EBWebView/ShaderCache/index +0 -0
- package/msger-native/src/main.rs +343 -37
- package/msger-native/src/template.html +103 -28
- package/msger-storage-demo.html +290 -0
- package/msger.code-workspace +3 -0
- package/msgerdefs/README.md +122 -0
- package/msgerdefs/msgerdefs.d.ts +322 -0
- package/msgerdefs/msgerdefs.d.ts.map +1 -0
- package/msgerdefs/msgerdefs.js +110 -0
- package/msgerdefs/msgerdefs.js.map +1 -0
- package/msgerdefs/msgerdefs.ts +427 -0
- package/msgerdefs/package.json +38 -0
- package/msgerdefs/samples.html +431 -0
- package/msgerdefs/test1.cmd +1 -0
- package/msgerdefs/tsconfig.json +17 -0
- package/msgernative-linux-x64 +0 -0
- package/package.json +5 -1
- package/shower.d.ts +2 -0
- package/shower.d.ts.map +1 -1
- package/shower.js +17 -0
- package/shower.js.map +1 -1
- package/shower.ts +24 -0
- package/test-data-persistence.html +315 -0
- package/test-htmlfrom.html +29 -0
- package/test-ipc-reach.html +113 -0
- package/test-msger-api.html +120 -0
- package/test-msger-functions.html +325 -0
- package/msger-native/bin/msgernative.exe.WebView2/EBWebView/BrowserMetrics/BrowserMetrics-69055419-C8A0.pma +0 -0
|
@@ -0,0 +1,322 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* TypeScript definitions for the msger JavaScript API
|
|
3
|
+
*
|
|
4
|
+
* This module provides type-safe access to msger's window control,
|
|
5
|
+
* data persistence, and file system features.
|
|
6
|
+
*
|
|
7
|
+
* Usage:
|
|
8
|
+
* ```typescript
|
|
9
|
+
* import type { MsgerAPI } from '@bobfrankston/msgerdefs';
|
|
10
|
+
*
|
|
11
|
+
* declare global {
|
|
12
|
+
* interface Window {
|
|
13
|
+
* msger?: MsgerAPI;
|
|
14
|
+
* }
|
|
15
|
+
* }
|
|
16
|
+
*
|
|
17
|
+
* // Check if running in msger
|
|
18
|
+
* if (window.msger) {
|
|
19
|
+
* window.msger.setTitle('My App');
|
|
20
|
+
* }
|
|
21
|
+
* ```
|
|
22
|
+
*/
|
|
23
|
+
/**
|
|
24
|
+
* Result object returned when the window closes
|
|
25
|
+
*/
|
|
26
|
+
export interface MsgerResult {
|
|
27
|
+
/** Button that was clicked */
|
|
28
|
+
button: string;
|
|
29
|
+
/** Optional input field value */
|
|
30
|
+
value?: string;
|
|
31
|
+
/** Optional form data */
|
|
32
|
+
form?: Record<string, any>;
|
|
33
|
+
/** True if window was closed via close button */
|
|
34
|
+
closed?: boolean;
|
|
35
|
+
/** True if window was dismissed via Escape key */
|
|
36
|
+
dismissed?: boolean;
|
|
37
|
+
/** True if window was closed due to timeout */
|
|
38
|
+
timeout?: boolean;
|
|
39
|
+
}
|
|
40
|
+
/**
|
|
41
|
+
* File information returned by file system operations
|
|
42
|
+
*/
|
|
43
|
+
export interface FileInfo {
|
|
44
|
+
/** File name */
|
|
45
|
+
name: string;
|
|
46
|
+
/** Full file path */
|
|
47
|
+
path: string;
|
|
48
|
+
/** True if this is a directory */
|
|
49
|
+
isDir: boolean;
|
|
50
|
+
/** File size in bytes (0 for directories) */
|
|
51
|
+
size: number;
|
|
52
|
+
/** Last modified timestamp (ISO 8601 string) */
|
|
53
|
+
modified?: string;
|
|
54
|
+
}
|
|
55
|
+
/**
|
|
56
|
+
* Options for file selection dialogs
|
|
57
|
+
*/
|
|
58
|
+
export interface FileDialogOptions {
|
|
59
|
+
/** Dialog title */
|
|
60
|
+
title?: string;
|
|
61
|
+
/** Default filename for save dialogs */
|
|
62
|
+
defaultFilename?: string;
|
|
63
|
+
/** File filters (e.g., [{name: "Text", extensions: ["txt", "md"]}]) */
|
|
64
|
+
filters?: Array<{
|
|
65
|
+
name: string;
|
|
66
|
+
extensions: string[];
|
|
67
|
+
}>;
|
|
68
|
+
/** Default directory to open */
|
|
69
|
+
defaultPath?: string;
|
|
70
|
+
}
|
|
71
|
+
/**
|
|
72
|
+
* Selected file with content
|
|
73
|
+
*/
|
|
74
|
+
export interface SelectedFile {
|
|
75
|
+
/** File name */
|
|
76
|
+
name: string;
|
|
77
|
+
/** Full file path */
|
|
78
|
+
path: string;
|
|
79
|
+
/** File content as string */
|
|
80
|
+
content: string;
|
|
81
|
+
}
|
|
82
|
+
/**
|
|
83
|
+
* msger JavaScript API
|
|
84
|
+
*
|
|
85
|
+
* Available when running inside msger via window.msger
|
|
86
|
+
*/
|
|
87
|
+
export interface MsgerAPI {
|
|
88
|
+
/**
|
|
89
|
+
* Toggle fullscreen mode on/off
|
|
90
|
+
* @example
|
|
91
|
+
* msger.toggleFullscreen();
|
|
92
|
+
*/
|
|
93
|
+
toggleFullscreen(): void;
|
|
94
|
+
/**
|
|
95
|
+
* Set fullscreen mode
|
|
96
|
+
* @param enabled - true to enter fullscreen, false to exit
|
|
97
|
+
* @example
|
|
98
|
+
* msger.setFullscreen(true);
|
|
99
|
+
*/
|
|
100
|
+
setFullscreen(enabled: boolean): void;
|
|
101
|
+
/**
|
|
102
|
+
* Minimize the window
|
|
103
|
+
* @example
|
|
104
|
+
* msger.minimize();
|
|
105
|
+
*/
|
|
106
|
+
minimize(): void;
|
|
107
|
+
/**
|
|
108
|
+
* Toggle maximize/restore window
|
|
109
|
+
* @example
|
|
110
|
+
* msger.maximize();
|
|
111
|
+
*/
|
|
112
|
+
maximize(): void;
|
|
113
|
+
/**
|
|
114
|
+
* Set window size
|
|
115
|
+
* @param width - Window width in pixels
|
|
116
|
+
* @param height - Window height in pixels
|
|
117
|
+
* @example
|
|
118
|
+
* msger.setSize(800, 600);
|
|
119
|
+
*/
|
|
120
|
+
setSize(width: number, height: number): void;
|
|
121
|
+
/**
|
|
122
|
+
* Set window position
|
|
123
|
+
* @param x - X coordinate in pixels
|
|
124
|
+
* @param y - Y coordinate in pixels
|
|
125
|
+
* @example
|
|
126
|
+
* msger.setPosition(100, 100);
|
|
127
|
+
*/
|
|
128
|
+
setPosition(x: number, y: number): void;
|
|
129
|
+
/**
|
|
130
|
+
* Set always-on-top behavior
|
|
131
|
+
* @param enabled - true to keep window on top
|
|
132
|
+
* @example
|
|
133
|
+
* msger.setAlwaysOnTop(true);
|
|
134
|
+
*/
|
|
135
|
+
setAlwaysOnTop(enabled: boolean): void;
|
|
136
|
+
/**
|
|
137
|
+
* Set window title
|
|
138
|
+
* @param title - New window title
|
|
139
|
+
* @example
|
|
140
|
+
* msger.setTitle("My Application");
|
|
141
|
+
*/
|
|
142
|
+
setTitle(title: string): void;
|
|
143
|
+
/**
|
|
144
|
+
* Close the window
|
|
145
|
+
* @param result - Optional result to return to parent process
|
|
146
|
+
* @example
|
|
147
|
+
* // Close with default dismissed result
|
|
148
|
+
* msger.close();
|
|
149
|
+
*
|
|
150
|
+
* // Close with custom result
|
|
151
|
+
* msger.close({button: 'OK', value: 'user data'});
|
|
152
|
+
*/
|
|
153
|
+
close(result?: Partial<MsgerResult>): void;
|
|
154
|
+
/**
|
|
155
|
+
* Send result and close window (legacy compatibility)
|
|
156
|
+
* @param result - Result to return to parent process
|
|
157
|
+
* @example
|
|
158
|
+
* msger.sendResult({button: 'Submit', value: 'form data'});
|
|
159
|
+
*/
|
|
160
|
+
sendResult(result: Partial<MsgerResult>): void;
|
|
161
|
+
/**
|
|
162
|
+
* Save data to persistent storage
|
|
163
|
+
* Data is stored with 'msger_' prefix in localStorage
|
|
164
|
+
* @param key - Storage key
|
|
165
|
+
* @param value - Value to store (will be JSON.stringify'd)
|
|
166
|
+
* @returns true on success, false on failure
|
|
167
|
+
* @example
|
|
168
|
+
* msger.saveData('userPrefs', {theme: 'dark', fontSize: 14});
|
|
169
|
+
*/
|
|
170
|
+
saveData(key: string, value: any): boolean;
|
|
171
|
+
/**
|
|
172
|
+
* Load data from persistent storage
|
|
173
|
+
* @param key - Storage key
|
|
174
|
+
* @param defaultValue - Default value if key not found
|
|
175
|
+
* @returns Stored value or defaultValue
|
|
176
|
+
* @example
|
|
177
|
+
* const prefs = msger.loadData('userPrefs', {theme: 'light'});
|
|
178
|
+
*/
|
|
179
|
+
loadData<T = any>(key: string, defaultValue?: T): T;
|
|
180
|
+
/**
|
|
181
|
+
* Remove data from persistent storage
|
|
182
|
+
* @param key - Storage key to remove
|
|
183
|
+
* @returns true on success, false on failure
|
|
184
|
+
* @example
|
|
185
|
+
* msger.removeData('tempData');
|
|
186
|
+
*/
|
|
187
|
+
removeData(key: string): boolean;
|
|
188
|
+
/**
|
|
189
|
+
* Clear all msger data from persistent storage
|
|
190
|
+
* Only removes items with 'msger_' prefix
|
|
191
|
+
* @returns true on success, false on failure
|
|
192
|
+
* @example
|
|
193
|
+
* msger.clearData();
|
|
194
|
+
*/
|
|
195
|
+
clearData(): boolean;
|
|
196
|
+
/**
|
|
197
|
+
* File system operations namespace
|
|
198
|
+
*/
|
|
199
|
+
fs?: {
|
|
200
|
+
/**
|
|
201
|
+
* Select a file using native file picker
|
|
202
|
+
* @param options - File dialog options
|
|
203
|
+
* @returns Selected file with content, or null if cancelled
|
|
204
|
+
* @example
|
|
205
|
+
* const file = await msger.fs.selectFile({
|
|
206
|
+
* title: 'Open File',
|
|
207
|
+
* filters: [{name: 'Text', extensions: ['txt', 'md']}]
|
|
208
|
+
* });
|
|
209
|
+
* if (file) {
|
|
210
|
+
* console.log(file.content);
|
|
211
|
+
* }
|
|
212
|
+
*/
|
|
213
|
+
selectFile(options?: FileDialogOptions): Promise<SelectedFile | null>;
|
|
214
|
+
/**
|
|
215
|
+
* Select multiple files using native file picker
|
|
216
|
+
* @param options - File dialog options
|
|
217
|
+
* @returns Array of selected files with content
|
|
218
|
+
* @example
|
|
219
|
+
* const files = await msger.fs.selectFiles({
|
|
220
|
+
* title: 'Open Files'
|
|
221
|
+
* });
|
|
222
|
+
*/
|
|
223
|
+
selectFiles(options?: FileDialogOptions): Promise<SelectedFile[]>;
|
|
224
|
+
/**
|
|
225
|
+
* Save file using native save dialog
|
|
226
|
+
* @param content - File content to save
|
|
227
|
+
* @param defaultFilename - Default filename
|
|
228
|
+
* @param options - Additional dialog options
|
|
229
|
+
* @returns Path where file was saved, or null if cancelled
|
|
230
|
+
* @example
|
|
231
|
+
* const path = await msger.fs.saveFileAs('Hello World', 'greeting.txt');
|
|
232
|
+
*/
|
|
233
|
+
saveFileAs(content: string, defaultFilename?: string, options?: FileDialogOptions): Promise<string | null>;
|
|
234
|
+
/**
|
|
235
|
+
* Select a directory using native folder picker
|
|
236
|
+
* @param options - Dialog options
|
|
237
|
+
* @returns Selected directory path, or null if cancelled
|
|
238
|
+
* @example
|
|
239
|
+
* const dir = await msger.fs.selectFolder({
|
|
240
|
+
* title: 'Select Output Folder'
|
|
241
|
+
* });
|
|
242
|
+
*/
|
|
243
|
+
selectFolder(options?: FileDialogOptions): Promise<string | null>;
|
|
244
|
+
/**
|
|
245
|
+
* Read file contents
|
|
246
|
+
* Note: Requires allowFs: true flag when launching msger
|
|
247
|
+
* @param path - File path to read
|
|
248
|
+
* @returns File content as string
|
|
249
|
+
* @example
|
|
250
|
+
* const content = await msger.fs.read('/path/to/file.txt');
|
|
251
|
+
*/
|
|
252
|
+
read(path: string): Promise<string>;
|
|
253
|
+
/**
|
|
254
|
+
* Write file contents
|
|
255
|
+
* Note: Requires allowFs: true flag when launching msger
|
|
256
|
+
* @param path - File path to write
|
|
257
|
+
* @param content - Content to write
|
|
258
|
+
* @example
|
|
259
|
+
* await msger.fs.write('/path/to/file.txt', 'Hello World');
|
|
260
|
+
*/
|
|
261
|
+
write(path: string, content: string): Promise<void>;
|
|
262
|
+
/**
|
|
263
|
+
* List directory contents
|
|
264
|
+
* Note: Requires allowFs: true flag when launching msger
|
|
265
|
+
* @param path - Directory path to list
|
|
266
|
+
* @returns Array of file information
|
|
267
|
+
* @example
|
|
268
|
+
* const files = await msger.fs.list('/path/to/dir');
|
|
269
|
+
*/
|
|
270
|
+
list(path: string): Promise<FileInfo[]>;
|
|
271
|
+
/**
|
|
272
|
+
* Check if file or directory exists
|
|
273
|
+
* Note: Requires allowFs: true flag when launching msger
|
|
274
|
+
* @param path - Path to check
|
|
275
|
+
* @returns true if exists
|
|
276
|
+
* @example
|
|
277
|
+
* const exists = await msger.fs.exists('/path/to/file.txt');
|
|
278
|
+
*/
|
|
279
|
+
exists(path: string): Promise<boolean>;
|
|
280
|
+
/**
|
|
281
|
+
* Delete file or directory
|
|
282
|
+
* Note: Requires allowFs: true flag when launching msger
|
|
283
|
+
* @param path - Path to delete
|
|
284
|
+
* @example
|
|
285
|
+
* await msger.fs.delete('/path/to/file.txt');
|
|
286
|
+
*/
|
|
287
|
+
delete(path: string): Promise<void>;
|
|
288
|
+
};
|
|
289
|
+
}
|
|
290
|
+
/**
|
|
291
|
+
* Helper to check if code is running in msger
|
|
292
|
+
* @returns true if running in msger environment
|
|
293
|
+
* @example
|
|
294
|
+
* if (isMsger()) {
|
|
295
|
+
* msger.setTitle('Running in msger!');
|
|
296
|
+
* } else {
|
|
297
|
+
* console.log('Running in browser');
|
|
298
|
+
* }
|
|
299
|
+
*/
|
|
300
|
+
export declare function isMsger(): boolean;
|
|
301
|
+
/**
|
|
302
|
+
* Get msger API with fallback for browser compatibility
|
|
303
|
+
* @returns msger API if available, or stub implementation for browser
|
|
304
|
+
* @example
|
|
305
|
+
* const api = getMsgerAPI();
|
|
306
|
+
* api.saveData('key', 'value'); // Works in both msger and browser
|
|
307
|
+
*/
|
|
308
|
+
export declare function getMsgerAPI(): MsgerAPI;
|
|
309
|
+
/**
|
|
310
|
+
* Declare global window.msger
|
|
311
|
+
*/
|
|
312
|
+
declare global {
|
|
313
|
+
interface Window {
|
|
314
|
+
msger?: MsgerAPI;
|
|
315
|
+
}
|
|
316
|
+
}
|
|
317
|
+
declare const _default: {
|
|
318
|
+
isMsger: typeof isMsger;
|
|
319
|
+
getMsgerAPI: typeof getMsgerAPI;
|
|
320
|
+
};
|
|
321
|
+
export default _default;
|
|
322
|
+
//# sourceMappingURL=msgerdefs.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"msgerdefs.d.ts","sourceRoot":"","sources":["msgerdefs.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;GAqBG;AAEH;;GAEG;AACH,MAAM,WAAW,WAAW;IACxB,8BAA8B;IAC9B,MAAM,EAAE,MAAM,CAAC;IACf,iCAAiC;IACjC,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,yBAAyB;IACzB,IAAI,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC;IAC3B,iDAAiD;IACjD,MAAM,CAAC,EAAE,OAAO,CAAC;IACjB,kDAAkD;IAClD,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB,+CAA+C;IAC/C,OAAO,CAAC,EAAE,OAAO,CAAC;CACrB;AAED;;GAEG;AACH,MAAM,WAAW,QAAQ;IACrB,gBAAgB;IAChB,IAAI,EAAE,MAAM,CAAC;IACb,qBAAqB;IACrB,IAAI,EAAE,MAAM,CAAC;IACb,kCAAkC;IAClC,KAAK,EAAE,OAAO,CAAC;IACf,6CAA6C;IAC7C,IAAI,EAAE,MAAM,CAAC;IACb,gDAAgD;IAChD,QAAQ,CAAC,EAAE,MAAM,CAAC;CACrB;AAED;;GAEG;AACH,MAAM,WAAW,iBAAiB;IAC9B,mBAAmB;IACnB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,wCAAwC;IACxC,eAAe,CAAC,EAAE,MAAM,CAAC;IACzB,uEAAuE;IACvE,OAAO,CAAC,EAAE,KAAK,CAAC;QAAC,IAAI,EAAE,MAA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;;;;GASG;AACH,wBAAgB,OAAO,IAAI,OAAO,CAEjC;AAED;;;;;;GAMG;AACH,wBAAgB,WAAW,IAAI,QAAQ,CA6DtC;AAED;;GAEG;AACH,OAAO,CAAC,MAAM,CAAC;IACX,UAAU,MAAM;QACZ,KAAK,CAAC,EAAE,QAAQ,CAAC;KACpB;CACJ;;;;;AAED,wBAGE"}
|
|
@@ -0,0 +1,110 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* TypeScript definitions for the msger JavaScript API
|
|
3
|
+
*
|
|
4
|
+
* This module provides type-safe access to msger's window control,
|
|
5
|
+
* data persistence, and file system features.
|
|
6
|
+
*
|
|
7
|
+
* Usage:
|
|
8
|
+
* ```typescript
|
|
9
|
+
* import type { MsgerAPI } from '@bobfrankston/msgerdefs';
|
|
10
|
+
*
|
|
11
|
+
* declare global {
|
|
12
|
+
* interface Window {
|
|
13
|
+
* msger?: MsgerAPI;
|
|
14
|
+
* }
|
|
15
|
+
* }
|
|
16
|
+
*
|
|
17
|
+
* // Check if running in msger
|
|
18
|
+
* if (window.msger) {
|
|
19
|
+
* window.msger.setTitle('My App');
|
|
20
|
+
* }
|
|
21
|
+
* ```
|
|
22
|
+
*/
|
|
23
|
+
/**
|
|
24
|
+
* Helper to check if code is running in msger
|
|
25
|
+
* @returns true if running in msger environment
|
|
26
|
+
* @example
|
|
27
|
+
* if (isMsger()) {
|
|
28
|
+
* msger.setTitle('Running in msger!');
|
|
29
|
+
* } else {
|
|
30
|
+
* console.log('Running in browser');
|
|
31
|
+
* }
|
|
32
|
+
*/
|
|
33
|
+
export function isMsger() {
|
|
34
|
+
return typeof window !== 'undefined' && typeof window.msger !== 'undefined';
|
|
35
|
+
}
|
|
36
|
+
/**
|
|
37
|
+
* Get msger API with fallback for browser compatibility
|
|
38
|
+
* @returns msger API if available, or stub implementation for browser
|
|
39
|
+
* @example
|
|
40
|
+
* const api = getMsgerAPI();
|
|
41
|
+
* api.saveData('key', 'value'); // Works in both msger and browser
|
|
42
|
+
*/
|
|
43
|
+
export function getMsgerAPI() {
|
|
44
|
+
if (isMsger()) {
|
|
45
|
+
return window.msger;
|
|
46
|
+
}
|
|
47
|
+
// Return browser-compatible stub
|
|
48
|
+
return {
|
|
49
|
+
// Window control - no-op in browser
|
|
50
|
+
toggleFullscreen: () => { },
|
|
51
|
+
setFullscreen: () => { },
|
|
52
|
+
minimize: () => { },
|
|
53
|
+
maximize: () => { },
|
|
54
|
+
setSize: () => { },
|
|
55
|
+
setPosition: () => { },
|
|
56
|
+
setAlwaysOnTop: () => { },
|
|
57
|
+
setTitle: (title) => { document.title = title; },
|
|
58
|
+
close: () => { window.close(); },
|
|
59
|
+
sendResult: () => { window.close(); },
|
|
60
|
+
// Data persistence - use localStorage in browser
|
|
61
|
+
saveData: (key, value) => {
|
|
62
|
+
try {
|
|
63
|
+
localStorage.setItem('msger_' + key, JSON.stringify(value));
|
|
64
|
+
return true;
|
|
65
|
+
}
|
|
66
|
+
catch {
|
|
67
|
+
return false;
|
|
68
|
+
}
|
|
69
|
+
},
|
|
70
|
+
loadData: (key, defaultValue) => {
|
|
71
|
+
try {
|
|
72
|
+
const item = localStorage.getItem('msger_' + key);
|
|
73
|
+
return item ? JSON.parse(item) : defaultValue;
|
|
74
|
+
}
|
|
75
|
+
catch {
|
|
76
|
+
return defaultValue;
|
|
77
|
+
}
|
|
78
|
+
},
|
|
79
|
+
removeData: (key) => {
|
|
80
|
+
try {
|
|
81
|
+
localStorage.removeItem('msger_' + key);
|
|
82
|
+
return true;
|
|
83
|
+
}
|
|
84
|
+
catch {
|
|
85
|
+
return false;
|
|
86
|
+
}
|
|
87
|
+
},
|
|
88
|
+
clearData: () => {
|
|
89
|
+
try {
|
|
90
|
+
const keys = Object.keys(localStorage);
|
|
91
|
+
for (const key of keys) {
|
|
92
|
+
if (key.startsWith('msger_')) {
|
|
93
|
+
localStorage.removeItem(key);
|
|
94
|
+
}
|
|
95
|
+
}
|
|
96
|
+
return true;
|
|
97
|
+
}
|
|
98
|
+
catch {
|
|
99
|
+
return false;
|
|
100
|
+
}
|
|
101
|
+
},
|
|
102
|
+
// File system - not available in browser
|
|
103
|
+
fs: undefined
|
|
104
|
+
};
|
|
105
|
+
}
|
|
106
|
+
export default {
|
|
107
|
+
isMsger,
|
|
108
|
+
getMsgerAPI
|
|
109
|
+
};
|
|
110
|
+
//# sourceMappingURL=msgerdefs.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"msgerdefs.js","sourceRoot":"","sources":["msgerdefs.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;GAqBG;AAqTH;;;;;;;;;GASG;AACH,MAAM,UAAU,OAAO;IACnB,OAAO,OAAO,MAAM,KAAK,WAAW,IAAI,OAAO,MAAM,CAAC,KAAK,KAAK,WAAW,CAAC;AAChF,CAAC;AAED;;;;;;GAMG;AACH,MAAM,UAAU,WAAW;IACvB,IAAI,OAAO,EAAE,EAAE,CAAC;QACZ,OAAO,MAAM,CAAC,KAAM,CAAC;IACzB,CAAC;IAED,iCAAiC;IACjC,OAAO;QACH,oCAAoC;QACpC,gBAAgB,EAAE,GAAG,EAAE,GAAE,CAAC;QAC1B,aAAa,EAAE,GAAG,EAAE,GAAE,CAAC;QACvB,QAAQ,EAAE,GAAG,EAAE,GAAE,CAAC;QAClB,QAAQ,EAAE,GAAG,EAAE,GAAE,CAAC;QAClB,OAAO,EAAE,GAAG,EAAE,GAAE,CAAC;QACjB,WAAW,EAAE,GAAG,EAAE,GAAE,CAAC;QACrB,cAAc,EAAE,GAAG,EAAE,GAAE,CAAC;QACxB,QAAQ,EAAE,CAAC,KAAa,EAAE,EAAE,GAAG,QAAQ,CAAC,KAAK,GAAG,KAAK,CAAC,CAAC,CAAC;QACxD,KAAK,EAAE,GAAG,EAAE,GAAG,MAAM,CAAC,KAAK,EAAE,CAAC,CAAC,CAAC;QAChC,UAAU,EAAE,GAAG,EAAE,GAAG,MAAM,CAAC,KAAK,EAAE,CAAC,CAAC,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