@bobfrankston/msgapidefs 0.1.4 → 0.1.6
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/package.json +5 -2
- 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.6",
|
|
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/.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 {};
|