@bobfrankston/msgapidefs 0.1.3 → 0.1.5
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/.claude/settings.local.json +5 -1
- package/package.json +5 -2
- package/samples.html +30 -10
- package/.vscode/settings.json +0 -22
- package/.vscode/tasks.json +0 -20
- package/msgapidefs.d.ts +0 -234
- package/msgapidefs.js +0 -9
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@bobfrankston/msgapidefs",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.5",
|
|
4
4
|
"description": "TypeScript definitions for msgapi JavaScript API (msgview/msger)",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./msgapidefs.js",
|
|
@@ -30,6 +30,9 @@
|
|
|
30
30
|
"access": "public"
|
|
31
31
|
},
|
|
32
32
|
"scripts": {
|
|
33
|
-
"
|
|
33
|
+
"prerelease:local": "git add -A && (git diff-index --quiet HEAD || git commit -m \"Pre-release commit\")",
|
|
34
|
+
"preversion": "git add -A",
|
|
35
|
+
"postversion": "git push && git push --tags",
|
|
36
|
+
"release": "npm run prerelease:local && npm version patch && npm publish --quiet"
|
|
34
37
|
}
|
|
35
38
|
}
|
package/samples.html
CHANGED
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
<!DOCTYPE html>
|
|
2
1
|
<html>
|
|
3
2
|
<head>
|
|
4
3
|
<meta charset="UTF-8">
|
|
@@ -72,6 +71,27 @@
|
|
|
72
71
|
border-radius: 3px;
|
|
73
72
|
font-family: 'Courier New', monospace;
|
|
74
73
|
}
|
|
74
|
+
button.danger {
|
|
75
|
+
background: #dc3545;
|
|
76
|
+
}
|
|
77
|
+
button.danger:hover {
|
|
78
|
+
background: #c82333;
|
|
79
|
+
}
|
|
80
|
+
.small-text {
|
|
81
|
+
font-size: 12px;
|
|
82
|
+
color: #666;
|
|
83
|
+
margin-top: 10px;
|
|
84
|
+
}
|
|
85
|
+
.medium-text {
|
|
86
|
+
margin-top: 10px;
|
|
87
|
+
font-size: 13px;
|
|
88
|
+
}
|
|
89
|
+
h3.spaced {
|
|
90
|
+
margin-top: 20px;
|
|
91
|
+
}
|
|
92
|
+
ul.feature-list {
|
|
93
|
+
font-size: 13px;
|
|
94
|
+
}
|
|
75
95
|
</style>
|
|
76
96
|
</head>
|
|
77
97
|
<body>
|
|
@@ -118,11 +138,11 @@
|
|
|
118
138
|
<div class="section">
|
|
119
139
|
<h2>Window Controls (⚠️ Currently Broken)</h2>
|
|
120
140
|
<p>These buttons demonstrate the broken IPC window controls. They will log errors but not crash.</p>
|
|
121
|
-
<button onclick="tryOK()"
|
|
122
|
-
<button onclick="tryCancel()"
|
|
123
|
-
<button onclick="tryClose()"
|
|
141
|
+
<button onclick="tryOK()" class="danger">Try OK (Logs Error)</button>
|
|
142
|
+
<button onclick="tryCancel()" class="danger secondary">Try Cancel (Logs Error)</button>
|
|
143
|
+
<button onclick="tryClose()" class="danger secondary">Try Close (Logs Error)</button>
|
|
124
144
|
<div id="outputControls" class="output">Click any button to see why window controls don't work</div>
|
|
125
|
-
<p
|
|
145
|
+
<p class="small-text">
|
|
126
146
|
<strong>Why broken:</strong> wry 0.47.2 has a bug where window.ipc.postMessage() crashes with "InvalidUri" error.<br>
|
|
127
147
|
<strong>Workarounds:</strong> Use CLI flags (-size, -title), F11 for fullscreen, X button to close, or Alt+F4.
|
|
128
148
|
</p>
|
|
@@ -145,18 +165,18 @@
|
|
|
145
165
|
<h2>Storage Location & PWA Support</h2>
|
|
146
166
|
<p><strong>localStorage is saved to:</strong></p>
|
|
147
167
|
<code>%LOCALAPPDATA%\Microsoft\Edge\User Data\WebView2\Default\Local Storage\leveldb\</code>
|
|
148
|
-
<p
|
|
168
|
+
<p class="medium-text">
|
|
149
169
|
Data persists across sessions and survives app restarts.
|
|
150
170
|
Each URL origin has its own storage partition.
|
|
151
171
|
</p>
|
|
152
172
|
<button onclick="showStorageInfo()">Show Storage Info</button>
|
|
153
173
|
<div id="output5" class="output">Click to see current storage info</div>
|
|
154
174
|
|
|
155
|
-
<h3
|
|
156
|
-
<p
|
|
175
|
+
<h3 class="spaced">PWA Support ✅</h3>
|
|
176
|
+
<p class="medium-text">
|
|
157
177
|
msger supports Progressive Web Apps loaded via <code>-url</code>:
|
|
158
178
|
</p>
|
|
159
|
-
<ul
|
|
179
|
+
<ul class="feature-list">
|
|
160
180
|
<li>✅ <strong>Service Workers</strong> - Background sync, offline support</li>
|
|
161
181
|
<li>✅ <strong>IndexedDB</strong> - Large data storage (GBs)</li>
|
|
162
182
|
<li>✅ <strong>Cache API</strong> - Offline assets</li>
|
|
@@ -165,7 +185,7 @@
|
|
|
165
185
|
<li>❌ <strong>Push Notifications</strong> - Platform dependent</li>
|
|
166
186
|
<li>❌ <strong>"Install" UI</strong> - Already native window</li>
|
|
167
187
|
</ul>
|
|
168
|
-
<p
|
|
188
|
+
<p class="small-text">
|
|
169
189
|
Example: <code>node cli.js -url https://your-pwa.app -detach</code>
|
|
170
190
|
</p>
|
|
171
191
|
</div>
|
package/.vscode/settings.json
DELETED
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"workbench.colorCustomizations": {
|
|
3
|
-
"activityBar.activeBackground": "#c3b9ff",
|
|
4
|
-
"activityBar.background": "#c3b9ff",
|
|
5
|
-
"activityBar.foreground": "#15202b",
|
|
6
|
-
"activityBar.inactiveForeground": "#15202b99",
|
|
7
|
-
"activityBarBadge.background": "#ff2400",
|
|
8
|
-
"activityBarBadge.foreground": "#e7e7e7",
|
|
9
|
-
"commandCenter.border": "#15202b99",
|
|
10
|
-
"sash.hoverBorder": "#c3b9ff",
|
|
11
|
-
"statusBar.background": "#9786ff",
|
|
12
|
-
"statusBar.foreground": "#15202b",
|
|
13
|
-
"statusBarItem.hoverBackground": "#6b53ff",
|
|
14
|
-
"statusBarItem.remoteBackground": "#9786ff",
|
|
15
|
-
"statusBarItem.remoteForeground": "#15202b",
|
|
16
|
-
"titleBar.activeBackground": "#9786ff",
|
|
17
|
-
"titleBar.activeForeground": "#15202b",
|
|
18
|
-
"titleBar.inactiveBackground": "#9786ff99",
|
|
19
|
-
"titleBar.inactiveForeground": "#15202b99"
|
|
20
|
-
},
|
|
21
|
-
"peacock.color": "#9786ff"
|
|
22
|
-
}
|
package/.vscode/tasks.json
DELETED
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"version": "2.0.0",
|
|
3
|
-
"tasks": [
|
|
4
|
-
{
|
|
5
|
-
"label": "tsc: watch",
|
|
6
|
-
"type": "shell",
|
|
7
|
-
"command": "tsc",
|
|
8
|
-
"args": ["--watch"],
|
|
9
|
-
"runOptions": {
|
|
10
|
-
"runOn": "folderOpen"
|
|
11
|
-
},
|
|
12
|
-
"problemMatcher": "$tsc-watch",
|
|
13
|
-
"isBackground": true,
|
|
14
|
-
"group": {
|
|
15
|
-
"kind": "build",
|
|
16
|
-
"isDefault": true
|
|
17
|
-
}
|
|
18
|
-
}
|
|
19
|
-
]
|
|
20
|
-
}
|
package/msgapidefs.d.ts
DELETED
|
@@ -1,234 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* TypeScript definitions for the msgapi JavaScript API
|
|
3
|
-
*
|
|
4
|
-
* This module provides type-safe access to msgapi's window control,
|
|
5
|
-
* data persistence, and file system features (used by msgview and msger).
|
|
6
|
-
*
|
|
7
|
-
* See README.md for complete usage documentation and examples.
|
|
8
|
-
*/
|
|
9
|
-
/**
|
|
10
|
-
* Result object returned when the window closes
|
|
11
|
-
*/
|
|
12
|
-
export interface MsgResult {
|
|
13
|
-
/** Button that was clicked */
|
|
14
|
-
button: string;
|
|
15
|
-
/** Optional input field value */
|
|
16
|
-
value?: string;
|
|
17
|
-
/** Optional form data */
|
|
18
|
-
form?: Record<string, any>;
|
|
19
|
-
/** True if window was closed via close button */
|
|
20
|
-
closed?: boolean;
|
|
21
|
-
/** True if window was dismissed via Escape key */
|
|
22
|
-
dismissed?: boolean;
|
|
23
|
-
/** True if window was closed due to timeout */
|
|
24
|
-
timeout?: boolean;
|
|
25
|
-
}
|
|
26
|
-
/**
|
|
27
|
-
* File information returned by file system operations
|
|
28
|
-
*/
|
|
29
|
-
export interface FileInfo {
|
|
30
|
-
/** File name */
|
|
31
|
-
name: string;
|
|
32
|
-
/** Full file path */
|
|
33
|
-
path: string;
|
|
34
|
-
/** True if this is a directory */
|
|
35
|
-
isDir: boolean;
|
|
36
|
-
/** File size in bytes (0 for directories) */
|
|
37
|
-
size: number;
|
|
38
|
-
/** Last modified timestamp (ISO 8601 string) */
|
|
39
|
-
modified?: string;
|
|
40
|
-
}
|
|
41
|
-
/**
|
|
42
|
-
* Options for file selection dialogs
|
|
43
|
-
*/
|
|
44
|
-
export interface FileDialogOptions {
|
|
45
|
-
/** Dialog title */
|
|
46
|
-
title?: string;
|
|
47
|
-
/** Default filename for save dialogs */
|
|
48
|
-
defaultFilename?: string;
|
|
49
|
-
/** File filters (e.g., [{name: "Text", extensions: ["txt", "md"]}]) */
|
|
50
|
-
filters?: Array<{
|
|
51
|
-
name: string;
|
|
52
|
-
extensions: string[];
|
|
53
|
-
}>;
|
|
54
|
-
/** Default directory to open */
|
|
55
|
-
defaultPath?: string;
|
|
56
|
-
}
|
|
57
|
-
/**
|
|
58
|
-
* Selected file with content
|
|
59
|
-
*/
|
|
60
|
-
export interface SelectedFile {
|
|
61
|
-
/** File name */
|
|
62
|
-
name: string;
|
|
63
|
-
/** Full file path */
|
|
64
|
-
path: string;
|
|
65
|
-
/** File content as string */
|
|
66
|
-
content: string;
|
|
67
|
-
}
|
|
68
|
-
/**
|
|
69
|
-
* msgapi JavaScript API
|
|
70
|
-
*
|
|
71
|
-
* Available when running inside msgview/msger via window.msgapi
|
|
72
|
-
*/
|
|
73
|
-
export interface MsgAPI {
|
|
74
|
-
/**
|
|
75
|
-
* Toggle fullscreen mode on/off
|
|
76
|
-
* @example
|
|
77
|
-
* msgapi.toggleFullscreen();
|
|
78
|
-
*/
|
|
79
|
-
toggleFullscreen(): void;
|
|
80
|
-
/**
|
|
81
|
-
* Set fullscreen mode
|
|
82
|
-
* @param enabled - true to enter fullscreen, false to exit
|
|
83
|
-
* @example
|
|
84
|
-
* msgapi.setFullscreen(true);
|
|
85
|
-
*/
|
|
86
|
-
setFullscreen(enabled: boolean): void;
|
|
87
|
-
/**
|
|
88
|
-
* Minimize the window
|
|
89
|
-
* @example
|
|
90
|
-
* msgapi.minimize();
|
|
91
|
-
*/
|
|
92
|
-
minimize(): void;
|
|
93
|
-
/**
|
|
94
|
-
* Toggle maximize/restore window
|
|
95
|
-
* @example
|
|
96
|
-
* msgapi.maximize();
|
|
97
|
-
*/
|
|
98
|
-
maximize(): void;
|
|
99
|
-
/**
|
|
100
|
-
* Set window size
|
|
101
|
-
* @param width - Window width in pixels
|
|
102
|
-
* @param height - Window height in pixels
|
|
103
|
-
* @example
|
|
104
|
-
* msgapi.setSize(800, 600);
|
|
105
|
-
*/
|
|
106
|
-
setSize(width: number, height: number): void;
|
|
107
|
-
/**
|
|
108
|
-
* Set window position
|
|
109
|
-
* @param x - X coordinate in pixels
|
|
110
|
-
* @param y - Y coordinate in pixels
|
|
111
|
-
* @example
|
|
112
|
-
* msgapi.setPosition(100, 100);
|
|
113
|
-
*/
|
|
114
|
-
setPosition(x: number, y: number): void;
|
|
115
|
-
/**
|
|
116
|
-
* Set always-on-top behavior
|
|
117
|
-
* @param enabled - true to keep window on top
|
|
118
|
-
* @example
|
|
119
|
-
* msgapi.setAlwaysOnTop(true);
|
|
120
|
-
*/
|
|
121
|
-
setAlwaysOnTop(enabled: boolean): void;
|
|
122
|
-
/**
|
|
123
|
-
* Close the window and return result to parent process
|
|
124
|
-
* @param result - Optional result to return to parent process
|
|
125
|
-
* @example
|
|
126
|
-
* // Close with default dismissed result
|
|
127
|
-
* msgapi.close();
|
|
128
|
-
*
|
|
129
|
-
* // Close with custom result
|
|
130
|
-
* msgapi.close({button: 'OK', value: 'user data'});
|
|
131
|
-
*/
|
|
132
|
-
close(result?: Partial<MsgResult>): void;
|
|
133
|
-
/**
|
|
134
|
-
* File system operations namespace
|
|
135
|
-
*/
|
|
136
|
-
fs?: {
|
|
137
|
-
/**
|
|
138
|
-
* Select a file using native file picker
|
|
139
|
-
* @param options - File dialog options
|
|
140
|
-
* @returns Selected file with content, or null if cancelled
|
|
141
|
-
* @example
|
|
142
|
-
* const file = await msgapi.fs.selectFile({
|
|
143
|
-
* title: 'Open File',
|
|
144
|
-
* filters: [{name: 'Text', extensions: ['txt', 'md']}]
|
|
145
|
-
* });
|
|
146
|
-
* if (file) {
|
|
147
|
-
* console.log(file.content);
|
|
148
|
-
* }
|
|
149
|
-
*/
|
|
150
|
-
selectFile(options?: FileDialogOptions): Promise<SelectedFile | null>;
|
|
151
|
-
/**
|
|
152
|
-
* Select multiple files using native file picker
|
|
153
|
-
* @param options - File dialog options
|
|
154
|
-
* @returns Array of selected files with content
|
|
155
|
-
* @example
|
|
156
|
-
* const files = await msgapi.fs.selectFiles({
|
|
157
|
-
* title: 'Open Files'
|
|
158
|
-
* });
|
|
159
|
-
*/
|
|
160
|
-
selectFiles(options?: FileDialogOptions): Promise<SelectedFile[]>;
|
|
161
|
-
/**
|
|
162
|
-
* Save file using native save dialog
|
|
163
|
-
* @param content - File content to save
|
|
164
|
-
* @param defaultFilename - Default filename
|
|
165
|
-
* @param options - Additional dialog options
|
|
166
|
-
* @returns Path where file was saved, or null if cancelled
|
|
167
|
-
* @example
|
|
168
|
-
* const path = await msgapi.fs.saveFileAs('Hello World', 'greeting.txt');
|
|
169
|
-
*/
|
|
170
|
-
saveFileAs(content: string, defaultFilename?: string, options?: FileDialogOptions): Promise<string | null>;
|
|
171
|
-
/**
|
|
172
|
-
* Select a directory using native folder picker
|
|
173
|
-
* @param options - Dialog options
|
|
174
|
-
* @returns Selected directory path, or null if cancelled
|
|
175
|
-
* @example
|
|
176
|
-
* const dir = await msgapi.fs.selectFolder({
|
|
177
|
-
* title: 'Select Output Folder'
|
|
178
|
-
* });
|
|
179
|
-
*/
|
|
180
|
-
selectFolder(options?: FileDialogOptions): Promise<string | null>;
|
|
181
|
-
/**
|
|
182
|
-
* Read file contents
|
|
183
|
-
* Note: Requires allowFs: true flag when launching msgview/msger
|
|
184
|
-
* @param path - File path to read
|
|
185
|
-
* @returns File content as string
|
|
186
|
-
* @example
|
|
187
|
-
* const content = await msgapi.fs.read('/path/to/file.txt');
|
|
188
|
-
*/
|
|
189
|
-
read(path: string): Promise<string>;
|
|
190
|
-
/**
|
|
191
|
-
* Write file contents
|
|
192
|
-
* Note: Requires allowFs: true flag when launching msgview/msger
|
|
193
|
-
* @param path - File path to write
|
|
194
|
-
* @param content - Content to write
|
|
195
|
-
* @example
|
|
196
|
-
* await msgapi.fs.write('/path/to/file.txt', 'Hello World');
|
|
197
|
-
*/
|
|
198
|
-
write(path: string, content: string): Promise<void>;
|
|
199
|
-
/**
|
|
200
|
-
* List directory contents
|
|
201
|
-
* Note: Requires allowFs: true flag when launching msgview/msger
|
|
202
|
-
* @param path - Directory path to list
|
|
203
|
-
* @returns Array of file information
|
|
204
|
-
* @example
|
|
205
|
-
* const files = await msgapi.fs.list('/path/to/dir');
|
|
206
|
-
*/
|
|
207
|
-
list(path: string): Promise<FileInfo[]>;
|
|
208
|
-
/**
|
|
209
|
-
* Check if file or directory exists
|
|
210
|
-
* Note: Requires allowFs: true flag when launching msgview/msger
|
|
211
|
-
* @param path - Path to check
|
|
212
|
-
* @returns true if exists
|
|
213
|
-
* @example
|
|
214
|
-
* const exists = await msgapi.fs.exists('/path/to/file.txt');
|
|
215
|
-
*/
|
|
216
|
-
exists(path: string): Promise<boolean>;
|
|
217
|
-
/**
|
|
218
|
-
* Delete file or directory
|
|
219
|
-
* Note: Requires allowFs: true flag when launching msgview/msger
|
|
220
|
-
* @param path - Path to delete
|
|
221
|
-
* @example
|
|
222
|
-
* await msgapi.fs.delete('/path/to/file.txt');
|
|
223
|
-
*/
|
|
224
|
-
delete(path: string): Promise<void>;
|
|
225
|
-
};
|
|
226
|
-
}
|
|
227
|
-
/**
|
|
228
|
-
* Declare global window.msgapi
|
|
229
|
-
*/
|
|
230
|
-
declare global {
|
|
231
|
-
interface Window {
|
|
232
|
-
msgapi?: MsgAPI;
|
|
233
|
-
}
|
|
234
|
-
}
|
package/msgapidefs.js
DELETED
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* TypeScript definitions for the msgapi JavaScript API
|
|
3
|
-
*
|
|
4
|
-
* This module provides type-safe access to msgapi's window control,
|
|
5
|
-
* data persistence, and file system features (used by msgview and msger).
|
|
6
|
-
*
|
|
7
|
-
* See README.md for complete usage documentation and examples.
|
|
8
|
-
*/
|
|
9
|
-
export {};
|