@bobfrankston/msger 0.1.49 → 0.1.50
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/msger-native/ARM64-SETUP.md +131 -0
- package/msger-native/setup-arm64-toolchain.sh +63 -0
- package/msger-native/src/main.rs +59 -0
- package/msgernative-linux-x64 +0 -0
- package/msgernative-win32-x64.exe +0 -0
- package/package.json +3 -1
- package/postinstall.js +39 -0
- package/shower.d.ts +1 -0
- package/shower.d.ts.map +1 -1
- package/shower.js +6 -1
- package/shower.js.map +1 -1
- package/shower.ts +8 -1
|
@@ -0,0 +1,131 @@
|
|
|
1
|
+
# ARM64 Cross-Compilation Setup
|
|
2
|
+
|
|
3
|
+
This guide explains how to set up ARM64 cross-compilation for building `msger` binaries that run on Raspberry Pi and other ARM64 Linux systems.
|
|
4
|
+
|
|
5
|
+
## Prerequisites
|
|
6
|
+
|
|
7
|
+
- WSL2 or Linux development environment
|
|
8
|
+
- Rust toolchain installed (`rustup`)
|
|
9
|
+
- Node.js and npm
|
|
10
|
+
|
|
11
|
+
## Quick Setup
|
|
12
|
+
|
|
13
|
+
Run this command to automatically install the ARM64 cross-compilation toolchain:
|
|
14
|
+
|
|
15
|
+
```bash
|
|
16
|
+
npm run setup:arm64
|
|
17
|
+
```
|
|
18
|
+
|
|
19
|
+
This will:
|
|
20
|
+
- Install GCC ARM64 cross-compiler
|
|
21
|
+
- Install required development libraries
|
|
22
|
+
- Add Rust ARM64 target (`aarch64-unknown-linux-gnu`)
|
|
23
|
+
|
|
24
|
+
## Manual Setup
|
|
25
|
+
|
|
26
|
+
If you prefer to install manually or the script doesn't work for your distribution:
|
|
27
|
+
|
|
28
|
+
### Ubuntu/Debian
|
|
29
|
+
|
|
30
|
+
```bash
|
|
31
|
+
sudo apt update
|
|
32
|
+
sudo apt install -y \
|
|
33
|
+
gcc-aarch64-linux-gnu \
|
|
34
|
+
g++-aarch64-linux-gnu \
|
|
35
|
+
libc6-dev-arm64-cross \
|
|
36
|
+
libwebkit2gtk-4.1-dev \
|
|
37
|
+
libgtk-3-dev \
|
|
38
|
+
pkg-config
|
|
39
|
+
|
|
40
|
+
rustup target add aarch64-unknown-linux-gnu
|
|
41
|
+
```
|
|
42
|
+
|
|
43
|
+
### Fedora/RHEL
|
|
44
|
+
|
|
45
|
+
```bash
|
|
46
|
+
sudo dnf install -y \
|
|
47
|
+
gcc-aarch64-linux-gnu \
|
|
48
|
+
gcc-c++-aarch64-linux-gnu \
|
|
49
|
+
webkit2gtk4.1-devel \
|
|
50
|
+
gtk3-devel \
|
|
51
|
+
pkg-config
|
|
52
|
+
|
|
53
|
+
rustup target add aarch64-unknown-linux-gnu
|
|
54
|
+
```
|
|
55
|
+
|
|
56
|
+
### Arch Linux
|
|
57
|
+
|
|
58
|
+
```bash
|
|
59
|
+
sudo pacman -S --needed \
|
|
60
|
+
aarch64-linux-gnu-gcc \
|
|
61
|
+
webkit2gtk \
|
|
62
|
+
gtk3 \
|
|
63
|
+
pkg-config
|
|
64
|
+
|
|
65
|
+
rustup target add aarch64-unknown-linux-gnu
|
|
66
|
+
```
|
|
67
|
+
|
|
68
|
+
## Building ARM64 Binaries
|
|
69
|
+
|
|
70
|
+
Once the toolchain is set up, build the ARM64 binary:
|
|
71
|
+
|
|
72
|
+
```bash
|
|
73
|
+
npm run build:native:arm64
|
|
74
|
+
```
|
|
75
|
+
|
|
76
|
+
This creates `msgernative-linux-arm64` which can be deployed to Raspberry Pi or other ARM64 Linux systems.
|
|
77
|
+
|
|
78
|
+
## Testing on ARM64
|
|
79
|
+
|
|
80
|
+
To test the binary on a Raspberry Pi:
|
|
81
|
+
|
|
82
|
+
1. Copy the binary to your Pi:
|
|
83
|
+
```bash
|
|
84
|
+
scp msgernative-linux-arm64 pi@raspberrypi.local:~/
|
|
85
|
+
```
|
|
86
|
+
|
|
87
|
+
2. SSH to the Pi and make it executable:
|
|
88
|
+
```bash
|
|
89
|
+
ssh pi@raspberrypi.local
|
|
90
|
+
chmod +x msgernative-linux-arm64
|
|
91
|
+
```
|
|
92
|
+
|
|
93
|
+
3. Install required libraries on the Pi:
|
|
94
|
+
```bash
|
|
95
|
+
sudo apt install libwebkit2gtk-4.1-0 libgtk-3-0
|
|
96
|
+
```
|
|
97
|
+
|
|
98
|
+
4. Test it:
|
|
99
|
+
```bash
|
|
100
|
+
echo '{"message":"Hello from ARM64!"}' | ./msgernative-linux-arm64
|
|
101
|
+
```
|
|
102
|
+
|
|
103
|
+
## Troubleshooting
|
|
104
|
+
|
|
105
|
+
### "linker 'aarch64-linux-gnu-gcc' not found"
|
|
106
|
+
|
|
107
|
+
The ARM64 cross-compiler is not installed. Run:
|
|
108
|
+
```bash
|
|
109
|
+
sudo apt install gcc-aarch64-linux-gnu g++-aarch64-linux-gnu
|
|
110
|
+
```
|
|
111
|
+
|
|
112
|
+
### "error: failed to run custom build command for `webkit2gtk-sys`"
|
|
113
|
+
|
|
114
|
+
WebKit development libraries are missing:
|
|
115
|
+
```bash
|
|
116
|
+
sudo apt install libwebkit2gtk-4.1-dev libgtk-3-dev pkg-config
|
|
117
|
+
```
|
|
118
|
+
|
|
119
|
+
### Binary works locally but fails on Raspberry Pi
|
|
120
|
+
|
|
121
|
+
The Pi may be missing runtime libraries:
|
|
122
|
+
```bash
|
|
123
|
+
# On the Raspberry Pi:
|
|
124
|
+
sudo apt update
|
|
125
|
+
sudo apt install libwebkit2gtk-4.1-0 libgtk-3-0
|
|
126
|
+
```
|
|
127
|
+
|
|
128
|
+
Check what's missing with:
|
|
129
|
+
```bash
|
|
130
|
+
ldd ./msgernative-linux-arm64
|
|
131
|
+
```
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
#!/bin/bash
|
|
2
|
+
# Setup ARM64 cross-compilation toolchain for building msger on WSL/Linux
|
|
3
|
+
|
|
4
|
+
echo "🔧 Setting up ARM64 cross-compilation toolchain..."
|
|
5
|
+
|
|
6
|
+
# Detect distro
|
|
7
|
+
if [ -f /etc/os-release ]; then
|
|
8
|
+
. /etc/os-release
|
|
9
|
+
DISTRO=$ID
|
|
10
|
+
else
|
|
11
|
+
echo "❌ Cannot detect Linux distribution"
|
|
12
|
+
exit 1
|
|
13
|
+
fi
|
|
14
|
+
|
|
15
|
+
echo "📍 Detected distribution: $DISTRO"
|
|
16
|
+
|
|
17
|
+
# Install cross-compilation tools based on distro
|
|
18
|
+
case "$DISTRO" in
|
|
19
|
+
ubuntu|debian)
|
|
20
|
+
echo "📦 Installing packages for Debian/Ubuntu..."
|
|
21
|
+
sudo apt update
|
|
22
|
+
sudo apt install -y \
|
|
23
|
+
gcc-aarch64-linux-gnu \
|
|
24
|
+
g++-aarch64-linux-gnu \
|
|
25
|
+
libc6-dev-arm64-cross \
|
|
26
|
+
libwebkit2gtk-4.1-dev \
|
|
27
|
+
libgtk-3-dev \
|
|
28
|
+
pkg-config
|
|
29
|
+
;;
|
|
30
|
+
fedora|rhel|centos)
|
|
31
|
+
echo "📦 Installing packages for Fedora/RHEL..."
|
|
32
|
+
sudo dnf install -y \
|
|
33
|
+
gcc-aarch64-linux-gnu \
|
|
34
|
+
gcc-c++-aarch64-linux-gnu \
|
|
35
|
+
webkit2gtk4.1-devel \
|
|
36
|
+
gtk3-devel \
|
|
37
|
+
pkg-config
|
|
38
|
+
;;
|
|
39
|
+
arch|manjaro)
|
|
40
|
+
echo "📦 Installing packages for Arch..."
|
|
41
|
+
sudo pacman -S --needed \
|
|
42
|
+
aarch64-linux-gnu-gcc \
|
|
43
|
+
webkit2gtk \
|
|
44
|
+
gtk3 \
|
|
45
|
+
pkg-config
|
|
46
|
+
;;
|
|
47
|
+
*)
|
|
48
|
+
echo "❌ Unsupported distribution: $DISTRO"
|
|
49
|
+
echo " Please install ARM64 cross-compilation tools manually"
|
|
50
|
+
exit 1
|
|
51
|
+
;;
|
|
52
|
+
esac
|
|
53
|
+
|
|
54
|
+
# Add Rust ARM64 target
|
|
55
|
+
echo "🦀 Adding Rust ARM64 target..."
|
|
56
|
+
rustup target add aarch64-unknown-linux-gnu
|
|
57
|
+
|
|
58
|
+
echo ""
|
|
59
|
+
echo "✅ ARM64 toolchain setup complete!"
|
|
60
|
+
echo ""
|
|
61
|
+
echo "You can now build ARM64 binaries with:"
|
|
62
|
+
echo " npm run build:native:arm64"
|
|
63
|
+
echo ""
|
package/msger-native/src/main.rs
CHANGED
|
@@ -30,6 +30,8 @@ struct MessageBoxOptions {
|
|
|
30
30
|
allow_input: bool,
|
|
31
31
|
#[serde(default)]
|
|
32
32
|
timeout: Option<u64>,
|
|
33
|
+
#[serde(default)]
|
|
34
|
+
auto_size: bool,
|
|
33
35
|
}
|
|
34
36
|
|
|
35
37
|
#[derive(Serialize, Deserialize, Debug)]
|
|
@@ -187,6 +189,44 @@ fn generate_html(options: &MessageBoxOptions) -> String {
|
|
|
187
189
|
window.ipc.postMessage(JSON.stringify(result));
|
|
188
190
|
}}
|
|
189
191
|
|
|
192
|
+
// Auto-size window to content
|
|
193
|
+
const autoSize = {};
|
|
194
|
+
if (autoSize) {{
|
|
195
|
+
window.addEventListener('DOMContentLoaded', function() {{
|
|
196
|
+
// Wait a tick for content to render
|
|
197
|
+
setTimeout(() => {{
|
|
198
|
+
const content = document.getElementById('content');
|
|
199
|
+
const buttons = document.getElementById('buttons');
|
|
200
|
+
const inputField = document.getElementById('inputField');
|
|
201
|
+
|
|
202
|
+
// Calculate required height
|
|
203
|
+
let contentHeight = content.scrollHeight;
|
|
204
|
+
let buttonsHeight = buttons.offsetHeight;
|
|
205
|
+
let inputHeight = inputField ? inputField.offsetHeight + 15 : 0;
|
|
206
|
+
let padding = 40; // body padding
|
|
207
|
+
|
|
208
|
+
let totalHeight = contentHeight + buttonsHeight + inputHeight + padding;
|
|
209
|
+
|
|
210
|
+
// Calculate required width (estimate based on content)
|
|
211
|
+
let contentWidth = Math.max(
|
|
212
|
+
content.scrollWidth,
|
|
213
|
+
buttons.offsetWidth
|
|
214
|
+
);
|
|
215
|
+
let totalWidth = Math.min(Math.max(contentWidth + 40, 400), 1200);
|
|
216
|
+
|
|
217
|
+
// Constrain to reasonable bounds
|
|
218
|
+
totalHeight = Math.min(Math.max(totalHeight, 150), 800);
|
|
219
|
+
|
|
220
|
+
// Send resize message
|
|
221
|
+
window.ipc.postMessage(JSON.stringify({{
|
|
222
|
+
_resize: true,
|
|
223
|
+
width: totalWidth,
|
|
224
|
+
height: totalHeight
|
|
225
|
+
}}));
|
|
226
|
+
}}, 50);
|
|
227
|
+
}});
|
|
228
|
+
}}
|
|
229
|
+
|
|
190
230
|
// Zoom support with mouse wheel
|
|
191
231
|
let zoomLevel = 1.0;
|
|
192
232
|
document.addEventListener('wheel', function(e) {{
|
|
@@ -237,6 +277,7 @@ fn generate_html(options: &MessageBoxOptions) -> String {
|
|
|
237
277
|
html_content,
|
|
238
278
|
input_html,
|
|
239
279
|
buttons_html,
|
|
280
|
+
if options.auto_size { "true" } else { "false" },
|
|
240
281
|
options.buttons.first().unwrap_or(&"Cancel".to_string())
|
|
241
282
|
)
|
|
242
283
|
}
|
|
@@ -292,6 +333,15 @@ fn main() {
|
|
|
292
333
|
.with_url(url)
|
|
293
334
|
.with_devtools(true)
|
|
294
335
|
.with_ipc_handler(move |msg| {
|
|
336
|
+
// Check for resize message first
|
|
337
|
+
if let Ok(resize_msg) = serde_json::from_str::<serde_json::Value>(msg.body()) {
|
|
338
|
+
if resize_msg.get("_resize").and_then(|v| v.as_bool()).unwrap_or(false) {
|
|
339
|
+
// This is a resize message - we'll handle it in the event loop
|
|
340
|
+
// For now, just ignore it (window resize from IPC is complex in wry/tao)
|
|
341
|
+
return;
|
|
342
|
+
}
|
|
343
|
+
}
|
|
344
|
+
|
|
295
345
|
// Parse the result from JavaScript (msg is now a Request<String>)
|
|
296
346
|
if let Ok(res) = serde_json::from_str::<MessageBoxResult>(msg.body()) {
|
|
297
347
|
let mut result_lock = result_clone.lock().unwrap();
|
|
@@ -306,6 +356,15 @@ fn main() {
|
|
|
306
356
|
.with_html(&html)
|
|
307
357
|
.with_devtools(true)
|
|
308
358
|
.with_ipc_handler(move |msg| {
|
|
359
|
+
// Check for resize message first
|
|
360
|
+
if let Ok(resize_msg) = serde_json::from_str::<serde_json::Value>(msg.body()) {
|
|
361
|
+
if resize_msg.get("_resize").and_then(|v| v.as_bool()).unwrap_or(false) {
|
|
362
|
+
// This is a resize message - we'll handle it in the event loop
|
|
363
|
+
// For now, just ignore it (window resize from IPC is complex in wry/tao)
|
|
364
|
+
return;
|
|
365
|
+
}
|
|
366
|
+
}
|
|
367
|
+
|
|
309
368
|
// Parse the result from JavaScript (msg is now a Request<String>)
|
|
310
369
|
if let Ok(res) = serde_json::from_str::<MessageBoxResult>(msg.body()) {
|
|
311
370
|
let mut result_lock = result_clone.lock().unwrap();
|
package/msgernative-linux-x64
CHANGED
|
Binary file
|
|
Binary file
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@bobfrankston/msger",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.50",
|
|
4
4
|
"description": "Fast, lightweight, cross-platform message box - Rust-powered alternative to msgview",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./index.js",
|
|
@@ -17,9 +17,11 @@
|
|
|
17
17
|
"build": "npm run build:ts && npm run build:native",
|
|
18
18
|
"build:native": "cd msger-native && npm run build",
|
|
19
19
|
"build:native:wsl": "cd msger-native && npm run build:wsl",
|
|
20
|
+
"build:native:arm64": "cd msger-native && npm run build:arm64",
|
|
20
21
|
"build:native:pi": "cd msger-native && npm run build:pi",
|
|
21
22
|
"build:native:all": "npm run build:native && npm run build:native:wsl",
|
|
22
23
|
"build:native:allpiignored": "npm run build:native:pi",
|
|
24
|
+
"setup:arm64": "wsl bash msger-native/setup-arm64-toolchain.sh",
|
|
23
25
|
"build:ts": "tsc",
|
|
24
26
|
"watch": "tsc -w",
|
|
25
27
|
"clean": "rm -rf *.js *.d.ts *.js.map bin && cd msger-native && cargo clean",
|
package/postinstall.js
CHANGED
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
import fs from 'fs';
|
|
3
3
|
import path from 'path';
|
|
4
4
|
import { fileURLToPath } from 'url';
|
|
5
|
+
import { execSync } from 'child_process';
|
|
5
6
|
|
|
6
7
|
const __filename = fileURLToPath(import.meta.url);
|
|
7
8
|
const __dirname = path.dirname(__filename);
|
|
@@ -21,7 +22,45 @@ if (!isWindows) {
|
|
|
21
22
|
console.warn(`⚠️ Could not set execute permission on ${binaryPath}: ${error.message}`);
|
|
22
23
|
console.warn(` You may need to run: sudo chmod +x ${binaryPath}`);
|
|
23
24
|
}
|
|
25
|
+
|
|
26
|
+
// Check for required system libraries
|
|
27
|
+
try {
|
|
28
|
+
const lddOutput = execSync(`ldd "${binaryPath}" 2>&1`, { encoding: 'utf8' });
|
|
29
|
+
if (lddOutput.includes('not found')) {
|
|
30
|
+
console.warn('\n⚠️ Missing system dependencies detected!');
|
|
31
|
+
console.warn(' Install required libraries with:\n');
|
|
32
|
+
|
|
33
|
+
// Detect distro and provide appropriate command
|
|
34
|
+
let distro = 'unknown';
|
|
35
|
+
try {
|
|
36
|
+
if (fs.existsSync('/etc/os-release')) {
|
|
37
|
+
const osRelease = fs.readFileSync('/etc/os-release', 'utf8');
|
|
38
|
+
if (osRelease.includes('ubuntu') || osRelease.includes('debian')) {
|
|
39
|
+
distro = 'debian';
|
|
40
|
+
} else if (osRelease.includes('fedora') || osRelease.includes('rhel') || osRelease.includes('centos')) {
|
|
41
|
+
distro = 'fedora';
|
|
42
|
+
} else if (osRelease.includes('arch')) {
|
|
43
|
+
distro = 'arch';
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
} catch (e) { /* ignore */ }
|
|
47
|
+
|
|
48
|
+
if (distro === 'debian') {
|
|
49
|
+
console.warn(' sudo apt update');
|
|
50
|
+
console.warn(' sudo apt install libwebkit2gtk-4.1-0 libgtk-3-0\n');
|
|
51
|
+
} else if (distro === 'fedora') {
|
|
52
|
+
console.warn(' sudo dnf install webkit2gtk4.1 gtk3\n');
|
|
53
|
+
} else if (distro === 'arch') {
|
|
54
|
+
console.warn(' sudo pacman -S webkit2gtk gtk3\n');
|
|
55
|
+
} else {
|
|
56
|
+
console.warn(' Install webkit2gtk and gtk3 for your distribution\n');
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
} catch (error) {
|
|
60
|
+
// ldd command failed, might not be installed
|
|
61
|
+
}
|
|
24
62
|
} else {
|
|
25
63
|
console.warn(`⚠️ Binary not found at ${binaryPath}`);
|
|
64
|
+
console.warn(` The msger package may not support your platform (${process.platform} ${arch})`);
|
|
26
65
|
}
|
|
27
66
|
}
|
package/shower.d.ts
CHANGED
|
@@ -7,6 +7,7 @@ export interface MessageBoxOptions {
|
|
|
7
7
|
width: number; /** Window width */
|
|
8
8
|
height: number; /** Window height */
|
|
9
9
|
};
|
|
10
|
+
autoSize?: boolean; /** Automatically resize window to fit content (default: false) */
|
|
10
11
|
buttons?: string[]; /** Array of button labels to display (default: ['OK']) */
|
|
11
12
|
defaultValue?: string; /** Default value for input field when allowInput is true */
|
|
12
13
|
allowInput?: boolean; /** Enable an input field in the message box (default: false) */
|
package/shower.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"shower.d.ts","sourceRoot":"","sources":["shower.ts"],"names":[],"mappings":"AAMA,MAAM,WAAW,iBAAiB;IAC9B,KAAK,CAAC,EAAE,MAAM,CAAC,CAAW,uDAAuD;IACjF,OAAO,CAAC,EAAE,MAAM,CAAC,CAAS,8EAA8E;IACxG,IAAI,CAAC,EAAE,MAAM,CAAC,CAAY,iDAAiD;IAC3E,GAAG,CAAC,EAAE,MAAM,CAAC,CAAa,0DAA0D;IAEpF,IAAI,CAAC,EAAE;QACH,KAAK,EAAE,MAAM,CAAC,CAAQ,mBAAmB;QACzC,MAAM,EAAE,MAAM,CAAC,CAAO,oBAAoB;KAC7C,CAAC;IAOF,OAAO,CAAC,EAAE,MAAM,EAAE,CAAC,CA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F,OAAO,CAAC,EAAE,MAAM,CAAC,CAAS,yDAAyD;IACnF,MAAM,CAAC,EAAE,OAAO,CAAC,CAAS,0DAA0D;CACvF;AAED,MAAM,WAAW,gBAAgB;IAC7B,MAAM,EAAE,MAAM,CAAC;IACf,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,IAAI,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC;IAC3B,MAAM,CAAC,EAAE,OAAO,CAAC;IACjB,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB,OAAO,CAAC,EAAE,OAAO,CAAC;CACrB;AAED;;;;GAIG;AACH,wBAAsB,cAAc,CAAC,OAAO,EAAE,iBAAiB,GAAG,OAAO,CAAC,gBAAgB,CAAC,CAkH1F"}
|
package/shower.js
CHANGED
|
@@ -91,7 +91,12 @@ export async function showMessageBox(options) {
|
|
|
91
91
|
});
|
|
92
92
|
// Send options to stdin
|
|
93
93
|
try {
|
|
94
|
-
|
|
94
|
+
// If autoSize is not explicitly set, enable it when no size is specified
|
|
95
|
+
const optionsToSend = { ...options };
|
|
96
|
+
if (optionsToSend.autoSize === undefined && !optionsToSend.size) {
|
|
97
|
+
optionsToSend.autoSize = true;
|
|
98
|
+
}
|
|
99
|
+
child.stdin.write(JSON.stringify(optionsToSend));
|
|
95
100
|
child.stdin.end();
|
|
96
101
|
// If detached, resolve immediately after sending options
|
|
97
102
|
if (options.detach) {
|
package/shower.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"shower.js","sourceRoot":"","sources":["shower.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,MAAM,eAAe,CAAC;AACtC,OAAO,EAAE,QAAQ,EAAE,MAAM,IAAI,CAAC;AAC9B,OAAO,IAAI,MAAM,MAAM,CAAC;AACxB,OAAO,EAAE,MAAM,IAAI,CAAC;
|
|
1
|
+
{"version":3,"file":"shower.js","sourceRoot":"","sources":["shower.ts"],"names":[],"mappings":"AA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AO,KAAU,EAAE,CAAC;YAClB,MAAM,CAAC,IAAI,KAAK,CAAC,6BAA6B,KAAK,CAAC,OAAO,EAAE,CAAC,CAAC,CAAC;QACpE,CAAC;IACL,CAAC,CAAC,CAAC;AACP,CAAC"}
|
package/shower.ts
CHANGED
|
@@ -20,6 +20,7 @@ export interface MessageBoxOptions {
|
|
|
20
20
|
// screen?: number; /** Optional screen index (0-based, Windows only) */
|
|
21
21
|
// };
|
|
22
22
|
// zoomPercent?: number; /** Initial zoom level as percentage (100=100%, 150=150%, 50=50%, etc.) */
|
|
23
|
+
autoSize?: boolean; /** Automatically resize window to fit content (default: false) */
|
|
23
24
|
buttons?: string[]; /** Array of button labels to display (default: ['OK']) */
|
|
24
25
|
defaultValue?: string; /** Default value for input field when allowInput is true */
|
|
25
26
|
allowInput?: boolean; /** Enable an input field in the message box (default: false) */
|
|
@@ -139,7 +140,13 @@ export async function showMessageBox(options: MessageBoxOptions): Promise<Messag
|
|
|
139
140
|
|
|
140
141
|
// Send options to stdin
|
|
141
142
|
try {
|
|
142
|
-
|
|
143
|
+
// If autoSize is not explicitly set, enable it when no size is specified
|
|
144
|
+
const optionsToSend = { ...options };
|
|
145
|
+
if (optionsToSend.autoSize === undefined && !optionsToSend.size) {
|
|
146
|
+
optionsToSend.autoSize = true;
|
|
147
|
+
}
|
|
148
|
+
|
|
149
|
+
child.stdin.write(JSON.stringify(optionsToSend));
|
|
143
150
|
child.stdin.end();
|
|
144
151
|
|
|
145
152
|
// If detached, resolve immediately after sending options
|