@bobfrankston/rmfmail 1.1.36 → 1.1.38

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.
@@ -0,0 +1,81 @@
1
+ # Multi-view: tabs, tear-off, separate windows
2
+
3
+ Goal: multiple **views** over one backend — like Thunderbird/Outlook — so the
4
+ user can keep a message open while working the list, compare two folders, etc.
5
+ NOT multiple daemon instances (`--another` already exists for that, and a
6
+ second daemon means a second DB connection — contention, not what's wanted).
7
+
8
+ ## Key fact: reminders already spawn separate native windows
9
+
10
+ `MailxService.showReminderPopup` → injected `popupFn` → msger
11
+ `showMessageBoxEx` opens a **real OS WebView window** fed a self-contained HTML
12
+ document (`rawHtml: true`: the caller ships a full HTML doc with its own button
13
+ row + an inline script that posts results back over the wry bridge). It returns
14
+ a handle with `pid` + `close()`.
15
+
16
+ Consequence: msger spawning extra native windows is **not** the blocker. The
17
+ "popups don't inherit the custom protocol" limitation only blocks a window that
18
+ must load the *multi-file app* (index.html + app.bundle.js + CSS + importmap
19
+ deps, all served from `msger.localhost`). A **single rendered view** is
20
+ self-contained content — the reminder shape.
21
+
22
+ So:
23
+ - **Torn-off READ-ONLY message reader** = the reminder mechanism. The daemon
24
+ already has rendered `bodyHtml` from `getMessage`; wrap header + sanitized
25
+ body as a standalone HTML doc, hand to `showMessageBoxEx`. No custom
26
+ protocol, no second IPC channel. Cheap.
27
+ - **Torn-off INTERACTIVE view** (reply / navigate / delete / live sync
28
+ updates) needs a real IPC channel back to the daemon → msger multi-channel
29
+ work. Expensive. Deferred.
30
+
31
+ ## Three view modes, one backend
32
+
33
+ 1. **Tabs** inside the main window — one WebView, one IPC channel, a tab strip;
34
+ each tab is an independent three-pane (or a single-message view). Pure
35
+ client work.
36
+ 2. **Tear-off** — detach a tab into its own OS window.
37
+ - Read-only message tab → `showMessageBoxEx` + `rawHtml` (reminder path).
38
+ - Interactive tab → needs msger multi-channel IPC (later).
39
+ 3. **Re-dock** — drag a torn-off window's content back in as a tab. For the
40
+ read-only reader this is just: close the popup, re-open the message as an
41
+ in-window tab. For interactive, follows whatever (2) settles on.
42
+
43
+ ## Tabs architecture (the real work)
44
+
45
+ Today the list view is module-level global state in `client/components/
46
+ message-list.ts` — `currentAccountId`, `currentFolderId`, `searchMode`,
47
+ `currentSearchQuery`, `positionMemory`, `listCache` — and `message-state.ts` is
48
+ a single global "source of truth" for the list+viewer. One window = one view.
49
+
50
+ Tabs require that view-state to become **per-tab**:
51
+
52
+ - **Per-tab:** selected account+folder (or search), selected message, list
53
+ scroll position, the `message-state` instance, sort order, flagged-only
54
+ toggle.
55
+ - **Shared (stays global):** the IPC connection + sync event stream, folder
56
+ counts, the contacts cache, settings, the parsed-body LRU on the daemon.
57
+ Sync/new-mail events broadcast to every tab; each tab decides if the event
58
+ touches its folder.
59
+
60
+ Shape: a `TabManager` owning an array of `ViewTab`, each `ViewTab` holding its
61
+ own `MessageListState` + the DOM subtree for its three-pane. Only the active
62
+ tab's subtree is in layout; inactive tabs keep their DOM detached (cheap) or
63
+ their state and rebuild on activate. `message-list.ts` functions take a
64
+ `ViewTab` (or read `TabManager.active`) instead of the module globals.
65
+
66
+ ## Staging
67
+
68
+ 1. **Tab strip + per-tab three-pane.** Extract the message-list globals into a
69
+ `ViewTab`/`TabManager`; render a tab strip; New Tab opens another inbox
70
+ view. The bulk of the work and the architectural commit.
71
+ 2. **Open-in-new-tab** for a message (and a folder). Exercises per-tab state on
72
+ the simplest views.
73
+ 3. **Tear-off a read-only message tab** → `showMessageBoxEx` standalone window
74
+ (reminder mechanism). Re-dock = reopen as a tab.
75
+ 4. **Interactive tear-off / true second app window.** Needs msger to let a
76
+ spawned window inherit the custom protocol AND carry its own IPC channel,
77
+ plus the daemon multiplexing IPC and broadcasting events to N channels.
78
+ Separate, cross-component project — do last, only if the read-only
79
+ tear-off proves insufficient.
80
+
81
+ Start at stage 1. Each stage is independently shippable.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@bobfrankston/rmfmail",
3
- "version": "1.1.36",
3
+ "version": "1.1.38",
4
4
  "description": "Local-first email client with IMAP sync and standalone native app",
5
5
  "type": "module",
6
6
  "main": "bin/mailx.js",
@@ -77,7 +77,8 @@
77
77
  "author": "Bob Frankston",
78
78
  "license": "MIT",
79
79
  "publishConfig": {
80
- "access": "public"
80
+ "access": "public",
81
+ "tag": "dev"
81
82
  },
82
83
  "repository": {
83
84
  "type": "git",