@bobfrankston/mailx 1.0.210 → 1.0.212

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/bin/mailx.js CHANGED
@@ -32,21 +32,13 @@ const isDaemon = hasFlag("daemon"); // internal: re-spawned detached process
32
32
  // Skip for: --verbose (want console), --daemon (already detached),
33
33
  // and any command flags (setup, kill, test, etc.)
34
34
  if (!verbose && !isDaemon && !process.argv.slice(2).some(a => /^-/.test(a))) {
35
- const { execSync, spawn } = await import("node:child_process");
36
- if (process.platform === "win32") {
37
- // Use wscript to launch without any visible console window
38
- const args = [...process.argv.slice(1), "--daemon"].map(a => `"${a}"`).join(" ");
39
- const vbs = `CreateObject("Wscript.Shell").Run """${process.execPath}"" ${args}", 0, False`;
40
- const tmpVbs = path.join(os.tmpdir(), "mailx-launch.vbs");
41
- fs.writeFileSync(tmpVbs, vbs);
42
- execSync(`wscript "${tmpVbs}"`, { stdio: "ignore" });
43
- }
44
- else {
45
- const child = spawn(process.execPath, [...process.argv.slice(1), "--daemon"], {
46
- detached: true, stdio: "ignore",
47
- });
48
- child.unref();
49
- }
35
+ const { spawn } = await import("node:child_process");
36
+ const child = spawn(process.execPath, [...process.argv.slice(1), "--daemon"], {
37
+ detached: true,
38
+ stdio: "ignore",
39
+ windowsHide: true,
40
+ });
41
+ child.unref();
50
42
  process.exit(0);
51
43
  }
52
44
  const setupMode = hasFlag("setup");
@@ -503,8 +495,7 @@ async function runTest() {
503
495
  console.log("\nmailx — connection test\n");
504
496
  // Start server in-process to access settings
505
497
  console.log("Loading settings...");
506
- const { loadSettings, getSharedDir } = await import("../packages/mailx-settings/index.js");
507
- const { initLocalConfig } = await import("../packages/mailx-settings/index.js");
498
+ const { loadSettings, getSharedDir, initLocalConfig } = await import("@bobfrankston/mailx-settings");
508
499
  initLocalConfig();
509
500
  const settings = loadSettings();
510
501
  if (settings.accounts.length === 0) {
@@ -37,6 +37,29 @@ export function initViewer() {
37
37
  // "messages" change (sync reload) — don't touch the viewer
38
38
  });
39
39
  }
40
+ /** Re-dispatch keydown events from iframe contentDocument onto the parent document
41
+ * so global shortcuts (Delete, Ctrl+D, Ctrl+R, etc.) fire while the preview has focus. */
42
+ function forwardKeysToParent(iframe) {
43
+ const attach = () => {
44
+ const doc = iframe.contentDocument;
45
+ if (!doc)
46
+ return;
47
+ doc.addEventListener("keydown", (e) => {
48
+ const target = e.target;
49
+ if (target && (target.isContentEditable || /^(INPUT|TEXTAREA|SELECT)$/.test(target.tagName)))
50
+ return;
51
+ document.dispatchEvent(new KeyboardEvent("keydown", {
52
+ key: e.key, code: e.code,
53
+ ctrlKey: e.ctrlKey, shiftKey: e.shiftKey, altKey: e.altKey, metaKey: e.metaKey,
54
+ bubbles: true, cancelable: true,
55
+ }));
56
+ });
57
+ };
58
+ if (iframe.contentDocument?.readyState === "complete")
59
+ attach();
60
+ else
61
+ iframe.addEventListener("load", attach, { once: true });
62
+ }
40
63
  function clearViewer() {
41
64
  currentMessage = null;
42
65
  currentAccountId = "";
@@ -251,6 +274,7 @@ export async function showMessage(accountId, uid, folderId, specialUse, isRetry
251
274
  const iframe = document.createElement("iframe");
252
275
  iframe.srcdoc = wrapHtmlBody(full.bodyHtml, true);
253
276
  bodyEl.appendChild(iframe);
277
+ forwardKeysToParent(iframe);
254
278
  }
255
279
  };
256
280
  banner.querySelector("#btn-load-remote").addEventListener("click", loadRemote);
@@ -279,6 +303,7 @@ export async function showMessage(accountId, uid, folderId, specialUse, isRetry
279
303
  iframe.sandbox.add("allow-top-navigation-by-user-activation");
280
304
  iframe.srcdoc = wrapHtmlBody(msg.bodyHtml, msg.remoteAllowed);
281
305
  bodyEl.appendChild(iframe);
306
+ forwardKeysToParent(iframe);
282
307
  }
283
308
  else if (msg.bodyText) {
284
309
  const pre = document.createElement("pre");
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@bobfrankston/mailx",
3
- "version": "1.0.210",
3
+ "version": "1.0.212",
4
4
  "description": "Local-first email client with IMAP sync and standalone native app",
5
5
  "type": "module",
6
6
  "main": "bin/mailx.js",
@@ -12,7 +12,7 @@
12
12
  "client"
13
13
  ],
14
14
  "scripts": {
15
- "build": "npm run build --workspaces --if-present",
15
+ "build": "npm run build --workspaces --if-present && tsc -p bin",
16
16
  "watch": "tsc -w",
17
17
  "start": "node --watch packages/mailx-server/index.js",
18
18
  "start:prod": "node packages/mailx-server/index.js",
@@ -24,7 +24,7 @@
24
24
  "@bobfrankston/iflow-node": "^0.1.2",
25
25
  "@bobfrankston/miscinfo": "^1.0.8",
26
26
  "@bobfrankston/oauthsupport": "^1.0.22",
27
- "@bobfrankston/msger": "^0.1.272",
27
+ "@bobfrankston/msger": "^0.1.274",
28
28
  "@capacitor/android": "^8.3.0",
29
29
  "@capacitor/cli": "^8.3.0",
30
30
  "@capacitor/core": "^8.3.0",
@@ -71,5 +71,24 @@
71
71
  "quill": "^2.0.3",
72
72
  "ws": "^8.18.0",
73
73
  "sql.js": "^1.14.1"
74
+ },
75
+ ".transformedSnapshot": {
76
+ "dependencies": {
77
+ "@bobfrankston/iflow-direct": "^0.1.6",
78
+ "@bobfrankston/iflow-node": "^0.1.2",
79
+ "@bobfrankston/miscinfo": "^1.0.8",
80
+ "@bobfrankston/oauthsupport": "^1.0.22",
81
+ "@bobfrankston/msger": "^0.1.274",
82
+ "@capacitor/android": "^8.3.0",
83
+ "@capacitor/cli": "^8.3.0",
84
+ "@capacitor/core": "^8.3.0",
85
+ "express": "^4.21.0",
86
+ "jsonc-parser": "^3.3.1",
87
+ "mailparser": "^3.7.2",
88
+ "nodemailer": "^7.0.0",
89
+ "quill": "^2.0.3",
90
+ "ws": "^8.18.0",
91
+ "sql.js": "^1.14.1"
92
+ }
74
93
  }
75
94
  }