@bobfrankston/msger 0.1.55 → 0.1.56
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/README.md +162 -33
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -50,20 +50,39 @@ if (result.value) {
|
|
|
50
50
|
|
|
51
51
|
```bash
|
|
52
52
|
# Simple message
|
|
53
|
-
msger -
|
|
53
|
+
msger -message "Hello, World!"
|
|
54
|
+
msger Hello World # shorthand - words become message
|
|
54
55
|
|
|
55
56
|
# With HTML content
|
|
56
|
-
msger -
|
|
57
|
+
msger -html "<h1>Welcome!</h1><p>This is <strong>HTML</strong></p>"
|
|
58
|
+
|
|
59
|
+
# Colored text with inline styles
|
|
60
|
+
msger -html "<span style='color:red;background-color:yellow'>Alert!</span>"
|
|
57
61
|
|
|
58
62
|
# Load a URL (web page or local file)
|
|
59
63
|
msger -url "https://example.com"
|
|
60
64
|
msger -url "file:///path/to/page.html"
|
|
61
65
|
|
|
62
|
-
# With
|
|
63
|
-
msger -
|
|
66
|
+
# With input field and placeholder
|
|
67
|
+
msger -message "Enter your name:" -input "Your name here" -default "John"
|
|
68
|
+
|
|
69
|
+
# Custom buttons
|
|
70
|
+
msger -message "Save changes?" -buttons Yes No Cancel
|
|
71
|
+
|
|
72
|
+
# With custom size and position
|
|
73
|
+
msger -message "Hello" -size 800,600 -pos 100,100
|
|
74
|
+
|
|
75
|
+
# Always on top with zoom
|
|
76
|
+
msger -message "Important!" -ontop -zoom 150
|
|
77
|
+
|
|
78
|
+
# Detached URL browser (stays open after script exits)
|
|
79
|
+
msger -url "https://example.com" -detach
|
|
80
|
+
|
|
81
|
+
# Multi-monitor (Windows only - show on second screen)
|
|
82
|
+
msger -message "Second screen" -pos 0,100 -screen 1
|
|
64
83
|
|
|
65
|
-
#
|
|
66
|
-
msger -
|
|
84
|
+
# Auto-close timeout
|
|
85
|
+
msger -message "Closing in 5 seconds..." -timeout 5
|
|
67
86
|
|
|
68
87
|
# See all options
|
|
69
88
|
msger --help
|
|
@@ -84,20 +103,23 @@ interface MessageBoxOptions {
|
|
|
84
103
|
html?: string; // HTML content to display
|
|
85
104
|
url?: string; // URL to load (web URL or file:// path)
|
|
86
105
|
size?: { // Window size in pixels
|
|
87
|
-
width: number; // Window width (default: 600)
|
|
88
|
-
height: number; // Window height (default: 400)
|
|
106
|
+
width: number; // Window width (default: 600, or 1024 for URLs)
|
|
107
|
+
height: number; // Window height (default: 400, or 768 for URLs)
|
|
108
|
+
};
|
|
109
|
+
pos?: { // Window position
|
|
110
|
+
x: number; // X coordinate in pixels
|
|
111
|
+
y: number; // Y coordinate in pixels
|
|
112
|
+
screen?: number; // [Windows only] Screen index (0=primary, 1=second, etc.)
|
|
89
113
|
};
|
|
90
114
|
buttons?: string[]; // Button labels (default: ["OK"])
|
|
91
115
|
defaultValue?: string; // Default input value
|
|
116
|
+
inputPlaceholder?: string; // Placeholder text (gray hint) for input field
|
|
92
117
|
allowInput?: boolean; // Show input field (default: false)
|
|
118
|
+
autoSize?: boolean; // Auto-resize window to fit content (default: true when no size specified)
|
|
119
|
+
alwaysOnTop?: boolean; // Keep window on top of other windows (default: false)
|
|
120
|
+
zoomPercent?: number; // Initial zoom level (100=100%, 150=150%, 50=50%)
|
|
93
121
|
timeout?: number; // Auto-close after N seconds
|
|
94
122
|
detach?: boolean; // Launch detached from parent process
|
|
95
|
-
|
|
96
|
-
// Not yet implemented:
|
|
97
|
-
// fullPage?: boolean; // Display HTML as complete page without wrapping
|
|
98
|
-
// pos?: { x: number; y: number; screen?: number }; // Window position
|
|
99
|
-
// zoomPercent?: number; // Initial zoom level (100=100%, 150=150%)
|
|
100
|
-
// devTools?: boolean; // Open DevTools for debugging
|
|
101
123
|
}
|
|
102
124
|
```
|
|
103
125
|
|
|
@@ -137,6 +159,7 @@ const result = await showMessageBox({
|
|
|
137
159
|
title: 'Enter Name',
|
|
138
160
|
message: 'Please enter your name:',
|
|
139
161
|
allowInput: true,
|
|
162
|
+
inputPlaceholder: 'Your name here',
|
|
140
163
|
defaultValue: 'John Doe',
|
|
141
164
|
buttons: ['Cancel', 'OK']
|
|
142
165
|
});
|
|
@@ -201,6 +224,79 @@ if (result.timeout) {
|
|
|
201
224
|
}
|
|
202
225
|
```
|
|
203
226
|
|
|
227
|
+
### HTML Forms
|
|
228
|
+
|
|
229
|
+
```typescript
|
|
230
|
+
const result = await showMessageBox({
|
|
231
|
+
title: 'User Registration',
|
|
232
|
+
html: `
|
|
233
|
+
<form>
|
|
234
|
+
<label>Name: <input name="name" required /></label><br>
|
|
235
|
+
<label>Email: <input name="email" type="email" required /></label><br>
|
|
236
|
+
<label>Age: <input name="age" type="number" /></label>
|
|
237
|
+
</form>
|
|
238
|
+
`,
|
|
239
|
+
buttons: ['Cancel', 'Submit']
|
|
240
|
+
});
|
|
241
|
+
|
|
242
|
+
if (result.button === 'Submit' && result.form) {
|
|
243
|
+
console.log('Name:', result.form.name);
|
|
244
|
+
console.log('Email:', result.form.email);
|
|
245
|
+
console.log('Age:', result.form.age);
|
|
246
|
+
}
|
|
247
|
+
```
|
|
248
|
+
|
|
249
|
+
### Window Positioning
|
|
250
|
+
|
|
251
|
+
```typescript
|
|
252
|
+
// Position at specific coordinates
|
|
253
|
+
await showMessageBox({
|
|
254
|
+
message: 'Positioned window',
|
|
255
|
+
pos: { x: 100, y: 100 }
|
|
256
|
+
});
|
|
257
|
+
|
|
258
|
+
// Position on second monitor (Windows only)
|
|
259
|
+
await showMessageBox({
|
|
260
|
+
message: 'On second screen',
|
|
261
|
+
pos: { x: 0, y: 100, screen: 1 }
|
|
262
|
+
});
|
|
263
|
+
```
|
|
264
|
+
|
|
265
|
+
### Always On Top & Zoom
|
|
266
|
+
|
|
267
|
+
```typescript
|
|
268
|
+
// Keep window on top with 150% zoom
|
|
269
|
+
await showMessageBox({
|
|
270
|
+
title: 'Important Alert',
|
|
271
|
+
message: 'This window stays on top!',
|
|
272
|
+
alwaysOnTop: true,
|
|
273
|
+
zoomPercent: 150
|
|
274
|
+
});
|
|
275
|
+
```
|
|
276
|
+
|
|
277
|
+
### Auto-Sizing Window
|
|
278
|
+
|
|
279
|
+
```typescript
|
|
280
|
+
// Window automatically sizes to fit content
|
|
281
|
+
await showMessageBox({
|
|
282
|
+
message: 'Short message',
|
|
283
|
+
autoSize: true // default when size not specified
|
|
284
|
+
});
|
|
285
|
+
```
|
|
286
|
+
|
|
287
|
+
### Detached URL Browser
|
|
288
|
+
|
|
289
|
+
```typescript
|
|
290
|
+
// Launch URL window that stays open after script exits
|
|
291
|
+
await showMessageBox({
|
|
292
|
+
url: 'https://example.com',
|
|
293
|
+
size: { width: 1200, height: 800 },
|
|
294
|
+
detach: true,
|
|
295
|
+
alwaysOnTop: true
|
|
296
|
+
});
|
|
297
|
+
// Script continues/exits immediately, window stays open
|
|
298
|
+
```
|
|
299
|
+
|
|
204
300
|
## Architecture
|
|
205
301
|
|
|
206
302
|
```
|
|
@@ -276,18 +372,24 @@ All binaries are bundled with the npm package, and the correct one is selected a
|
|
|
276
372
|
## Features
|
|
277
373
|
|
|
278
374
|
- ✅ Cross-platform native webview (Windows, Linux x64, Linux ARM64)
|
|
279
|
-
- ✅ Full HTML/CSS support
|
|
375
|
+
- ✅ Full HTML/CSS support with inline styles
|
|
280
376
|
- ✅ Load external URLs or local files
|
|
281
|
-
- ✅ Customizable buttons
|
|
282
|
-
- ✅ Input field support
|
|
377
|
+
- ✅ Customizable buttons (OK button is green by default)
|
|
378
|
+
- ✅ Input field support with placeholder text
|
|
379
|
+
- ✅ HTML forms with automatic data collection
|
|
283
380
|
- ✅ Auto-close with timeout
|
|
381
|
+
- ✅ Window positioning (x, y coordinates)
|
|
382
|
+
- ✅ Multi-monitor support (Windows only - screen index)
|
|
383
|
+
- ✅ Always on top mode
|
|
384
|
+
- ✅ Zoom control (initial percent + runtime Ctrl+Wheel/+/-)
|
|
385
|
+
- ✅ Auto-sizing windows (fit content when size not specified)
|
|
284
386
|
- ✅ Keyboard shortcuts (Enter, Escape)
|
|
285
387
|
- ✅ Window close detection
|
|
388
|
+
- ✅ Detached process mode (independent window)
|
|
286
389
|
- ✅ TypeScript type definitions
|
|
287
|
-
- ✅ Small binary size (~
|
|
390
|
+
- ✅ Small binary size (~2-5MB per platform)
|
|
288
391
|
- ✅ Fast startup (~50-200ms)
|
|
289
|
-
- ✅
|
|
290
|
-
- ⏳ Coming soon: Window positioning, zoom control, DevTools
|
|
392
|
+
- ✅ Low memory usage (~20-50MB)
|
|
291
393
|
|
|
292
394
|
## Performance Comparison
|
|
293
395
|
|
|
@@ -303,21 +405,48 @@ All binaries are bundled with the npm package, and the correct one is selected a
|
|
|
303
405
|
## CLI Options
|
|
304
406
|
|
|
305
407
|
```
|
|
306
|
-
Usage: msger [options]
|
|
408
|
+
Usage: msger [options] [message words...]
|
|
307
409
|
|
|
308
410
|
Options:
|
|
309
|
-
-
|
|
310
|
-
-
|
|
311
|
-
-html, --html <html>
|
|
312
|
-
-url, --url <url>
|
|
313
|
-
-
|
|
314
|
-
-
|
|
315
|
-
-
|
|
316
|
-
-
|
|
317
|
-
-
|
|
318
|
-
-
|
|
319
|
-
--
|
|
320
|
-
--
|
|
411
|
+
-message, --message <text> Plain text message
|
|
412
|
+
-title, --title <text> Window title
|
|
413
|
+
-html, --html <html> HTML content
|
|
414
|
+
-url, --url <url> URL to load (web or file://)
|
|
415
|
+
-buttons, --buttons <labels> Button labels (e.g., -buttons Yes No Cancel)
|
|
416
|
+
-ok, --ok Add OK button
|
|
417
|
+
-cancel, --cancel Add Cancel button
|
|
418
|
+
-input, --input [placeholder] Include input field with optional placeholder text
|
|
419
|
+
-default, --default <text> Default value for input field
|
|
420
|
+
-size, --size <width,height> Window size (e.g., -size 800,600)
|
|
421
|
+
-pos, --pos <x,y> Window position (e.g., -pos 100,200)
|
|
422
|
+
-screen, --screen <number> [Windows only] Screen index (0=primary, 1=second, etc.)
|
|
423
|
+
-zoom, --zoom <percent> Zoom level as percentage (e.g., -zoom 150 for 150%)
|
|
424
|
+
-timeout, --timeout <seconds> Auto-close after specified seconds
|
|
425
|
+
-ontop, --ontop Keep window always on top
|
|
426
|
+
-detach, --detach Launch window independently (parent returns immediately)
|
|
427
|
+
-v, -version, --version Show version number
|
|
428
|
+
-help, -?, --help Show help message
|
|
429
|
+
|
|
430
|
+
Examples:
|
|
431
|
+
msger Hello World
|
|
432
|
+
msger -message "Save changes?" -buttons Yes No Cancel
|
|
433
|
+
msger -message "Enter your name:" -input "Your name" -default "John Doe"
|
|
434
|
+
msger -html "<h1>Title</h1><p>Formatted <b>content</b></p>"
|
|
435
|
+
msger -html "<span style='color:red;background-color:yellow'>Colored text</span>"
|
|
436
|
+
msger -url "https://example.com"
|
|
437
|
+
msger -url "https://example.com" -detach
|
|
438
|
+
msger -title "Alert" -message "Operation complete"
|
|
439
|
+
msger -message "Positioned" -pos 100,100 -screen 1
|
|
440
|
+
msger -message "Large text" -zoom 150 -ontop
|
|
441
|
+
|
|
442
|
+
Notes:
|
|
443
|
+
- If no options provided, all non-option arguments are concatenated as message
|
|
444
|
+
- Press ESC to dismiss (returns button: "dismissed")
|
|
445
|
+
- Press Enter to click last (default) button
|
|
446
|
+
- OK button is green by default
|
|
447
|
+
- URLs default to 1024x768 window size
|
|
448
|
+
- Windows auto-size to fit content when size not specified
|
|
449
|
+
- Runtime zoom: Ctrl+Wheel, Ctrl+Plus, Ctrl+Minus
|
|
321
450
|
```
|
|
322
451
|
|
|
323
452
|
## License
|