@bobfrankston/msger 0.1.345 → 0.1.347
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 +7 -2
- package/index.d.ts +1 -1
- package/index.js +1 -1
- package/msger-native/bin/msgernative.exe +0 -0
- package/package.json +1 -1
- package/shower.d.ts +1 -0
- package/shower.js +1 -16
package/README.md
CHANGED
|
@@ -51,8 +51,11 @@ msger -html "<span style='color:red;background-color:yellow'>Alert!</span>"
|
|
|
51
51
|
msger -url "https://example.com"
|
|
52
52
|
msger -url "file:///path/to/page.html"
|
|
53
53
|
|
|
54
|
-
# Render a local markdown file (
|
|
55
|
-
|
|
54
|
+
# Render a local markdown file — use the mdview wrapper (msger doesn't auto-render .md)
|
|
55
|
+
mdview todo.md
|
|
56
|
+
|
|
57
|
+
# Display arbitrary HTML as a complete page (no template, no buttons) — used by mdview
|
|
58
|
+
msger -raw -html "<!doctype html><html>...</html>"
|
|
56
59
|
|
|
57
60
|
# Load URL with hash fragment
|
|
58
61
|
msger -url "https://example.com" -hash section1
|
|
@@ -258,6 +261,7 @@ Options:
|
|
|
258
261
|
-ontop, --ontop Keep window always on top
|
|
259
262
|
-detach, --detach Launch window independently (parent returns immediately)
|
|
260
263
|
-fullscreen, --fullscreen Start window in fullscreen mode (F11 to toggle, Escape to exit)
|
|
264
|
+
-raw, --raw With -html: load HTML as-is, no msger template/buttons (alias: -full)
|
|
261
265
|
-debug, --debug Return debug info (HTML, size, autoSize) in result
|
|
262
266
|
-v, -version, --version Show version number
|
|
263
267
|
-help, -?, --help Show help message
|
|
@@ -390,6 +394,7 @@ interface MessageBoxOptions {
|
|
|
390
394
|
timeout?: number; // Auto-close after N seconds
|
|
391
395
|
detach?: boolean; // Launch detached from parent process
|
|
392
396
|
fullscreen?: boolean; // Start window in fullscreen mode (F11 to toggle)
|
|
397
|
+
rawHtml?: boolean; // With html: load HTML as-is, no msger template/buttons (used by mdview). CLI: -raw
|
|
393
398
|
debug?: boolean; // Return debug info (HTML, size, autoSize) in result
|
|
394
399
|
}
|
|
395
400
|
```
|
package/index.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export { showMessageBox, showService, ServiceHandle, MessageBoxOptions, MessageBoxResult, setAppName, setAppIcon } from "./shower.js";
|
|
1
|
+
export { showMessageBox, showMessageBoxEx, MessageBoxHandle, closeMessageBox, showService, ServiceHandle, MessageBoxOptions, MessageBoxResult, setAppName, setAppIcon } from "./shower.js";
|
package/index.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
// Export showMessageBox and types for use as a library
|
|
2
|
-
export { showMessageBox, showService, ServiceHandle, setAppName, setAppIcon } from "./shower.js";
|
|
2
|
+
export { showMessageBox, showMessageBoxEx, MessageBoxHandle, closeMessageBox, showService, ServiceHandle, setAppName, setAppIcon } from "./shower.js";
|
|
3
3
|
// If run directly (e.g., `node .` or `node index.js`), run the CLI
|
|
4
4
|
// @ts-ignore - import.meta.main is available in Node.js 20+
|
|
5
5
|
if (import.meta.main) {
|
|
Binary file
|
package/package.json
CHANGED
package/shower.d.ts
CHANGED
|
@@ -15,6 +15,7 @@ export interface MessageBoxOptions {
|
|
|
15
15
|
html?: string; /** HTML content to display in the message box */
|
|
16
16
|
url?: string; /** URL to load external content (web URL or file path) */
|
|
17
17
|
hash?: string; /** Hash fragment to append to URL (requires url to be set). Leading # is optional. */
|
|
18
|
+
rawHtml?: boolean; /** When true with html, load HTML as-is (no msger template wrapper, no buttons). Used by mdview. */
|
|
18
19
|
size?: {
|
|
19
20
|
width: number; /** Window width */
|
|
20
21
|
height: number; /** Window height */
|
package/shower.js
CHANGED
|
@@ -1,10 +1,9 @@
|
|
|
1
1
|
import { spawn } from 'child_process';
|
|
2
2
|
import { platform } from 'os';
|
|
3
3
|
import path from 'path';
|
|
4
|
-
import { pathToFileURL
|
|
4
|
+
import { pathToFileURL } from 'url';
|
|
5
5
|
import fs from 'fs';
|
|
6
6
|
import AnsiToHtml from 'ansi-to-html';
|
|
7
|
-
import { renderMarkdown, looksLikeMarkdown } from '@bobfrankston/msgcommon/markdown';
|
|
8
7
|
// Load package.json for version
|
|
9
8
|
import packageJson from './package.json' with { type: 'json' };
|
|
10
9
|
export class MessageBoxHandle {
|
|
@@ -381,20 +380,6 @@ function createMessageBoxHandle(options) {
|
|
|
381
380
|
// Debug logging (uncomment if needed)
|
|
382
381
|
// console.error(`[DEBUG] Path conversion: ${optionsToSend.url} → ${absolutePath} → ${fileUrl}`);
|
|
383
382
|
}
|
|
384
|
-
// Native markdown rendering: if URL is a local .md/.markdown file, render to a
|
|
385
|
-
// self-contained HTML document and rewrite the URL as a data: URL. wry's navigation
|
|
386
|
-
// handler explicitly allows data: URLs (see msger-native/src/main.rs).
|
|
387
|
-
if (optionsToSend.url && optionsToSend.url.startsWith('file:') && looksLikeMarkdown(optionsToSend.url)) {
|
|
388
|
-
try {
|
|
389
|
-
const localPath = fileURLToPath(optionsToSend.url);
|
|
390
|
-
const md = fs.readFileSync(localPath, 'utf-8');
|
|
391
|
-
const renderedHtml = renderMarkdown(md, path.basename(localPath));
|
|
392
|
-
optionsToSend.url = 'data:text/html;charset=utf-8;base64,' + Buffer.from(renderedHtml, 'utf-8').toString('base64');
|
|
393
|
-
}
|
|
394
|
-
catch (e) {
|
|
395
|
-
console.warn(`msger: markdown render failed for ${optionsToSend.url}: ${e.message} — falling back to raw load`);
|
|
396
|
-
}
|
|
397
|
-
}
|
|
398
383
|
// Append hash to URL if specified
|
|
399
384
|
if (optionsToSend.hash && optionsToSend.url) {
|
|
400
385
|
// Strip any existing hash from the base URL
|