@bobfrankston/rmfmail 1.1.42 → 1.1.44

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.
@@ -5076,6 +5076,135 @@ var init_alarms = __esm({
5076
5076
  // client/components/folder-tree.js
5077
5077
  init_api_client();
5078
5078
  init_context_menu();
5079
+
5080
+ // client/components/tabs.js
5081
+ var STORAGE_KEY = "mailx-view-tabs";
5082
+ var tabs = [];
5083
+ var activeId = "";
5084
+ var stripEl = null;
5085
+ var applyView = () => {
5086
+ };
5087
+ var _nextId = 1;
5088
+ function newId() {
5089
+ return `t${_nextId++}`;
5090
+ }
5091
+ function persist() {
5092
+ try {
5093
+ sessionStorage.setItem(STORAGE_KEY, JSON.stringify({ tabs, activeId }));
5094
+ } catch {
5095
+ }
5096
+ }
5097
+ function render() {
5098
+ if (!stripEl)
5099
+ return;
5100
+ stripEl.innerHTML = "";
5101
+ for (const tab of tabs) {
5102
+ const chip = document.createElement("div");
5103
+ chip.className = "view-tab" + (tab.id === activeId ? " active" : "");
5104
+ chip.dataset.tabId = tab.id;
5105
+ const label = document.createElement("span");
5106
+ label.className = "view-tab-label";
5107
+ label.textContent = tab.title || "(view)";
5108
+ chip.appendChild(label);
5109
+ if (tabs.length > 1) {
5110
+ const close = document.createElement("button");
5111
+ close.className = "view-tab-close";
5112
+ close.textContent = "\xD7";
5113
+ close.title = "Close tab";
5114
+ close.addEventListener("click", (e) => {
5115
+ e.stopPropagation();
5116
+ closeTab(tab.id);
5117
+ });
5118
+ chip.appendChild(close);
5119
+ }
5120
+ chip.addEventListener("click", () => activate(tab.id));
5121
+ stripEl.appendChild(chip);
5122
+ }
5123
+ const plus = document.createElement("button");
5124
+ plus.className = "view-tab-new";
5125
+ plus.textContent = "+";
5126
+ plus.title = "New tab (All Inboxes)";
5127
+ plus.addEventListener("click", () => openTab({ kind: "unified" }, "All Inboxes", true));
5128
+ stripEl.appendChild(plus);
5129
+ stripEl.hidden = tabs.length < 2;
5130
+ }
5131
+ function initTabs(strip, apply) {
5132
+ stripEl = strip;
5133
+ applyView = apply;
5134
+ try {
5135
+ const raw = sessionStorage.getItem(STORAGE_KEY);
5136
+ if (raw) {
5137
+ const parsed = JSON.parse(raw);
5138
+ if (Array.isArray(parsed?.tabs) && parsed.tabs.length) {
5139
+ tabs = parsed.tabs;
5140
+ activeId = parsed.activeId || tabs[0].id;
5141
+ for (const t of tabs) {
5142
+ const n = Number(String(t.id).replace(/^t/, ""));
5143
+ if (Number.isFinite(n) && n >= _nextId)
5144
+ _nextId = n + 1;
5145
+ }
5146
+ }
5147
+ }
5148
+ } catch {
5149
+ }
5150
+ render();
5151
+ }
5152
+ function activeTab() {
5153
+ return tabs.find((t) => t.id === activeId) || null;
5154
+ }
5155
+ function openTab(view, title, activateIt = true) {
5156
+ const tab = { id: newId(), title, view };
5157
+ tabs.push(tab);
5158
+ if (activateIt)
5159
+ activeId = tab.id;
5160
+ persist();
5161
+ render();
5162
+ if (activateIt)
5163
+ applyView(tab);
5164
+ }
5165
+ function activate(id) {
5166
+ const tab = tabs.find((t) => t.id === id);
5167
+ if (!tab || id === activeId)
5168
+ return;
5169
+ activeId = id;
5170
+ persist();
5171
+ render();
5172
+ applyView(tab);
5173
+ }
5174
+ function closeTab(id) {
5175
+ if (tabs.length < 2)
5176
+ return;
5177
+ const idx = tabs.findIndex((t) => t.id === id);
5178
+ if (idx < 0)
5179
+ return;
5180
+ const wasActive = id === activeId;
5181
+ tabs.splice(idx, 1);
5182
+ if (wasActive) {
5183
+ const next = tabs[Math.max(0, idx - 1)];
5184
+ activeId = next.id;
5185
+ persist();
5186
+ render();
5187
+ applyView(next);
5188
+ } else {
5189
+ persist();
5190
+ render();
5191
+ }
5192
+ }
5193
+ function setActiveView(view, title) {
5194
+ let tab = activeTab();
5195
+ if (!tab) {
5196
+ tab = { id: newId(), title, view };
5197
+ tabs.push(tab);
5198
+ activeId = tab.id;
5199
+ } else {
5200
+ tab.view = view;
5201
+ tab.title = title;
5202
+ }
5203
+ persist();
5204
+ render();
5205
+ }
5206
+
5207
+ // client/components/folder-tree.js
5079
5208
  var onFolderSelect;
5080
5209
  var onUnifiedInbox = null;
5081
5210
  var selectedElement;
@@ -5293,6 +5422,11 @@ function renderNode(node, container, depth) {
5293
5422
  const isTrash = node.specialUse === "trash" || node.path.toLowerCase().includes("trash");
5294
5423
  const isJunk = node.specialUse === "junk" || node.path.toLowerCase().includes("spam") || node.path.toLowerCase().includes("junk");
5295
5424
  const items = [
5425
+ { label: "Open in new tab", action: () => {
5426
+ openTab({ kind: "folder", accountId: node.accountId, folderId: node.id, specialUse: node.specialUse || "" }, node.name, true);
5427
+ } },
5428
+ { label: "", action: () => {
5429
+ }, separator: true },
5296
5430
  { label: "Mark all read", action: async () => {
5297
5431
  try {
5298
5432
  await markFolderRead(node.accountId, node.id);
@@ -6099,135 +6233,6 @@ async function updateFolderCounts() {
6099
6233
  // client/app.ts
6100
6234
  init_message_list();
6101
6235
  init_mailx_types();
6102
-
6103
- // client/components/tabs.js
6104
- var STORAGE_KEY = "mailx-view-tabs";
6105
- var tabs = [];
6106
- var activeId = "";
6107
- var stripEl = null;
6108
- var applyView = () => {
6109
- };
6110
- var _nextId = 1;
6111
- function newId() {
6112
- return `t${_nextId++}`;
6113
- }
6114
- function persist() {
6115
- try {
6116
- sessionStorage.setItem(STORAGE_KEY, JSON.stringify({ tabs, activeId }));
6117
- } catch {
6118
- }
6119
- }
6120
- function render() {
6121
- if (!stripEl)
6122
- return;
6123
- stripEl.innerHTML = "";
6124
- for (const tab of tabs) {
6125
- const chip = document.createElement("div");
6126
- chip.className = "view-tab" + (tab.id === activeId ? " active" : "");
6127
- chip.dataset.tabId = tab.id;
6128
- const label = document.createElement("span");
6129
- label.className = "view-tab-label";
6130
- label.textContent = tab.title || "(view)";
6131
- chip.appendChild(label);
6132
- if (tabs.length > 1) {
6133
- const close = document.createElement("button");
6134
- close.className = "view-tab-close";
6135
- close.textContent = "\xD7";
6136
- close.title = "Close tab";
6137
- close.addEventListener("click", (e) => {
6138
- e.stopPropagation();
6139
- closeTab(tab.id);
6140
- });
6141
- chip.appendChild(close);
6142
- }
6143
- chip.addEventListener("click", () => activate(tab.id));
6144
- stripEl.appendChild(chip);
6145
- }
6146
- const plus = document.createElement("button");
6147
- plus.className = "view-tab-new";
6148
- plus.textContent = "+";
6149
- plus.title = "New tab (All Inboxes)";
6150
- plus.addEventListener("click", () => openTab({ kind: "unified" }, "All Inboxes", true));
6151
- stripEl.appendChild(plus);
6152
- stripEl.hidden = tabs.length < 1;
6153
- }
6154
- function initTabs(strip, apply) {
6155
- stripEl = strip;
6156
- applyView = apply;
6157
- try {
6158
- const raw = sessionStorage.getItem(STORAGE_KEY);
6159
- if (raw) {
6160
- const parsed = JSON.parse(raw);
6161
- if (Array.isArray(parsed?.tabs) && parsed.tabs.length) {
6162
- tabs = parsed.tabs;
6163
- activeId = parsed.activeId || tabs[0].id;
6164
- for (const t of tabs) {
6165
- const n = Number(String(t.id).replace(/^t/, ""));
6166
- if (Number.isFinite(n) && n >= _nextId)
6167
- _nextId = n + 1;
6168
- }
6169
- }
6170
- }
6171
- } catch {
6172
- }
6173
- render();
6174
- }
6175
- function activeTab() {
6176
- return tabs.find((t) => t.id === activeId) || null;
6177
- }
6178
- function openTab(view, title, activateIt = true) {
6179
- const tab = { id: newId(), title, view };
6180
- tabs.push(tab);
6181
- if (activateIt)
6182
- activeId = tab.id;
6183
- persist();
6184
- render();
6185
- if (activateIt)
6186
- applyView(tab);
6187
- }
6188
- function activate(id) {
6189
- const tab = tabs.find((t) => t.id === id);
6190
- if (!tab || id === activeId)
6191
- return;
6192
- activeId = id;
6193
- persist();
6194
- render();
6195
- applyView(tab);
6196
- }
6197
- function closeTab(id) {
6198
- if (tabs.length < 2)
6199
- return;
6200
- const idx = tabs.findIndex((t) => t.id === id);
6201
- if (idx < 0)
6202
- return;
6203
- const wasActive = id === activeId;
6204
- tabs.splice(idx, 1);
6205
- if (wasActive) {
6206
- const next = tabs[Math.max(0, idx - 1)];
6207
- activeId = next.id;
6208
- persist();
6209
- render();
6210
- applyView(next);
6211
- } else {
6212
- persist();
6213
- render();
6214
- }
6215
- }
6216
- function setActiveView(view, title) {
6217
- let tab = activeTab();
6218
- if (!tab) {
6219
- tab = { id: newId(), title, view };
6220
- tabs.push(tab);
6221
- activeId = tab.id;
6222
- } else {
6223
- tab.view = view;
6224
- tab.title = title;
6225
- }
6226
- persist();
6227
- render();
6228
- }
6229
-
6230
- // client/app.ts
6231
6236
  init_message_viewer();
6232
6237
  init_api_client();
6233
6238
  init_message_state();
@@ -8257,6 +8262,10 @@ document.addEventListener("keydown", (e) => {
8257
8262
  e.preventDefault();
8258
8263
  openCompose("new");
8259
8264
  }
8265
+ if (e.ctrlKey && (e.key === "t" || e.key === "T") && !e.shiftKey && !e.altKey) {
8266
+ e.preventDefault();
8267
+ openTab({ kind: "unified" }, "All Inboxes", true);
8268
+ }
8260
8269
  if (e.ctrlKey && e.key === "r" && !e.shiftKey && !e.altKey && !e.metaKey) {
8261
8270
  e.preventDefault();
8262
8271
  openCompose("reply");