inboxer 0.3.1 → 0.4.0

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/dist/ui/routes.js CHANGED
@@ -1,6 +1,6 @@
1
1
  import { deleteCookie, getCookie, getSignedCookie, setCookie, setSignedCookie } from "hono/cookie";
2
2
  import { bareAddress, domainOf, splitAddresses } from "../core/address.js";
3
- import { ConflictError, InvalidRequestError } from "../core/mail.js";
3
+ import { ConflictError, InvalidRequestError, toView } from "../core/mail.js";
4
4
  import { CATCHALL } from "../types.js";
5
5
  import { S } from "./strings.js";
6
6
  import * as V from "./views.js";
@@ -17,11 +17,6 @@ function clientInfo(c) {
17
17
  const forwarded = c.req.header("x-forwarded-for")?.split(",")[0]?.trim();
18
18
  return { ip: forwarded || c.req.header("x-real-ip") || null, userAgent: c.req.header("user-agent") ?? null };
19
19
  }
20
- /** htmx sends the page URL; draft cards on a thread page leave out the thread around them. */
21
- function onThreadPage(c) {
22
- const current = c.req.header("hx-current-url");
23
- return !!current && new URL(current).pathname.startsWith("/threads/");
24
- }
25
20
  function uiActor(session) {
26
21
  return { kind: "ui", name: session.label ?? session.id.slice(0, 12), scope: session.scope };
27
22
  }
@@ -41,7 +36,7 @@ export function registerUi(app, mail, access, cfg) {
41
36
  const page = async (c, title, body, current, status = 200, fullScreen = false) => {
42
37
  const session = c.get("session");
43
38
  const shell = session
44
- ? { draftCount: (await mail.listDrafts(undefined, session.scope)).length, domains: domainsOf(session), senders: senders(session) }
39
+ ? { draftCount: (await mail.listDrafts(undefined, session.scope)).length, senders: senders(session) }
45
40
  : {};
46
41
  return c.html(V.layout(title, body, { theme: theme(c), page: current, signedIn: !!session, fullScreen, ...shell }), status);
47
42
  };
@@ -91,36 +86,35 @@ export function registerUi(app, mail, access, cfg) {
91
86
  await next();
92
87
  });
93
88
  }
94
- /** The sent and received messages around a draft, newest first, and the context of its thread. */
95
- const draftExtras = async (draft, session) => {
96
- const { messages, context, contacts } = await mail.getThread(draft.thread_id, session.scope);
97
- const history = messages.filter(m => m.id !== draft.id && m.status !== "draft").reverse().map(shown);
98
- return { history, ctx: { context, contacts } };
99
- };
100
- /** The card for a draft in whatever state it is now. */
89
+ /** The card for a draft in whatever state it is now; once sent, its message in the thread. */
101
90
  const draftView = async (c, id) => {
102
- const session = c.get("session");
103
- const draft = await mail.requireMessage(id, session.scope);
91
+ const draft = await mail.requireMessage(id, c.get("session").scope);
104
92
  if (draft.status === "discarded")
105
93
  return V.draftDone(id, S.discarded);
106
94
  if (draft.status !== "draft")
107
- return V.draftDone(id, `${S.sentTo} ${draft.to.join(", ")}`);
108
- if (onThreadPage(c))
109
- return V.draftCard(draft, [], null);
110
- const { history, ctx } = await draftExtras(draft, session);
111
- return V.draftCard(draft, history, ctx);
95
+ return V.messageBubble(shown(toView(draft)), false);
96
+ return V.draftCard(draft);
112
97
  };
113
98
  app.get("/", async (c) => {
99
+ const drafts = await mail.listDrafts(undefined, c.get("session").scope);
100
+ return page(c, S.navDrafts, V.inboxPage(V.draftList(drafts, null), null), "drafts");
101
+ });
102
+ app.get("/drafts/:id", async (c) => {
114
103
  const session = c.get("session");
104
+ const draft = await mail.requireMessage(c.req.param("id"), session.scope);
105
+ if (draft.status !== "draft")
106
+ return c.redirect(`/threads/${draft.thread_id}?status=all`, 303);
107
+ const { thread, view } = await threadPane(c, draft.thread_id, "/");
115
108
  const drafts = await mail.listDrafts(undefined, session.scope);
116
- const items = await Promise.all(drafts.map(async (draft) => ({ draft, ...(await draftExtras(draft, session)) })));
117
- return page(c, S.navDrafts, V.draftsPage(items), "drafts");
109
+ return page(c, thread.subject || S.navDrafts, V.inboxPage(V.draftList(drafts, draft.id), view), "drafts", 200, true);
118
110
  });
119
111
  app.get("/drafts/:id/card", async (c) => c.html(await draftView(c, c.req.param("id"))));
120
112
  app.get("/drafts/:id/edit", async (c) => {
121
113
  const draft = await mail.requireMessage(c.req.param("id"), c.get("session").scope);
122
- if (draft.status !== "draft" || draft.pending)
123
- return c.html(await draftView(c, draft.id));
114
+ if (draft.status !== "draft" || draft.pending) {
115
+ c.header("HX-Refresh", "true");
116
+ return c.body(null, 204);
117
+ }
124
118
  const form = { to: draft.to.join(", "), cc: draft.cc.join(", "), subject: draft.subject, text: draft.text };
125
119
  return c.html(V.draftEditor(draft, form, null));
126
120
  });
@@ -138,6 +132,7 @@ export function registerUi(app, mail, access, cfg) {
138
132
  }, actor);
139
133
  if (body.send === "1")
140
134
  await mail.schedule(id, "send", actor);
135
+ c.header("HX-Refresh", "true");
141
136
  return c.html(await draftView(c, id));
142
137
  }
143
138
  catch (err) {
@@ -148,20 +143,23 @@ export function registerUi(app, mail, access, cfg) {
148
143
  throw err;
149
144
  }
150
145
  });
151
- app.post("/drafts/:id/attachments", async (c) => {
152
- const id = c.req.param("id");
153
- const actor = uiActor(c.get("session"));
154
- const body = await c.req.parseBody({ all: true });
155
- const files = [].concat(body.files ?? []).filter((f) => f instanceof File);
146
+ /** Uploaded files within the size limit, and a message naming the last one over it. */
147
+ const uploads = (body) => {
148
+ const all = [].concat(body.files ?? []).filter((f) => f instanceof File && f.name !== "");
156
149
  const limit = cfg.ui.maxUploadMb * 1024 * 1024;
157
- let error = null;
150
+ const over = all.filter(f => f.size > limit).at(-1);
151
+ return { files: all.filter(f => f.size <= limit), error: over ? `${over.name} ${S.tooLarge} ${cfg.ui.maxUploadMb} MB` : null };
152
+ };
153
+ const attachAll = async (draftId, files, actor) => {
158
154
  for (const file of files) {
159
- if (file.size > limit) {
160
- error = `${file.name} ${S.tooLarge} ${cfg.ui.maxUploadMb} MB`;
161
- continue;
162
- }
163
- await mail.attach(id, { filename: file.name, contentType: file.type, body: new Uint8Array(await file.arrayBuffer()) }, actor);
155
+ await mail.attach(draftId, { filename: file.name, contentType: file.type, body: new Uint8Array(await file.arrayBuffer()) }, actor);
164
156
  }
157
+ };
158
+ app.post("/drafts/:id/attachments", async (c) => {
159
+ const id = c.req.param("id");
160
+ const actor = uiActor(c.get("session"));
161
+ const { files, error } = uploads(await c.req.parseBody({ all: true }));
162
+ await attachAll(id, files, actor);
165
163
  return c.html(V.draftFiles(await mail.requireMessage(id, actor.scope), error));
166
164
  });
167
165
  app.post("/drafts/:id/attachments/:attachmentId/remove", async (c) => {
@@ -200,8 +198,8 @@ export function registerUi(app, mail, access, cfg) {
200
198
  return V.threadList(threads, { mailboxes, domains: domainsOf(session), filter, own, current });
201
199
  };
202
200
  app.get("/inbox", async (c) => page(c, S.navInbox, V.inboxPage(await threadList(c, null), null), "inbox"));
203
- app.get("/threads/:id", async (c) => {
204
- const id = c.req.param("id");
201
+ /** A thread with its drafts in place; opening it marks it read. */
202
+ const threadPane = async (c, id, back) => {
205
203
  const session = c.get("session");
206
204
  let thread = await mail.requireThread(id, session.scope);
207
205
  if (thread.unread) {
@@ -212,13 +210,28 @@ export function registerUi(app, mail, access, cfg) {
212
210
  const people = thread.participants.filter(p => !own.has(p));
213
211
  const entries = await Promise.all(messages.map(async (m) => ({
214
212
  at: m.date,
215
- view: m.status === "draft" ? V.draftCard(await mail.store.requireMessage(m.id), [], null) : V.messageBubble(shown(m), people.length > 1),
213
+ view: m.status === "draft" ? V.draftCard(await mail.store.requireMessage(m.id)) : V.messageBubble(shown(m), people.length > 1),
216
214
  })));
217
215
  const reply = { allowed: senders(session).some(m => m.id === thread.mailbox), replyAll: people.length > 1 };
218
- const view = V.threadView(thread, entries, { context, contacts }, { filter: inboxFilter(c), own, reply });
216
+ return { thread, view: V.threadView(thread, entries, { context, contacts }, { back, filter: inboxFilter(c), own, reply }) };
217
+ };
218
+ app.get("/threads/:id", async (c) => {
219
+ const id = c.req.param("id");
220
+ const { thread, view } = await threadPane(c, id, `/inbox?${V.inboxQuery(inboxFilter(c))}`);
219
221
  return page(c, thread.subject || S.navInbox, V.inboxPage(await threadList(c, id), view), "inbox", 200, true);
220
222
  });
221
223
  /** Replies to the latest message; a reply sent from here gets the same undo window as a draft. */
224
+ /** Opens a reply to the latest message in the edit sheet, for Cc, subject and attachments. */
225
+ app.post("/threads/:id/reply/full", async (c) => {
226
+ const actor = uiActor(c.get("session"));
227
+ const body = await c.req.parseBody();
228
+ const { messages } = await mail.getThread(c.req.param("id"), actor.scope);
229
+ const latest = messages.filter(m => m.status !== "draft").at(-1);
230
+ if (!latest)
231
+ throw new InvalidRequestError("nothing to reply to");
232
+ const draft = await mail.createDraft({ replyToId: latest.id, replyAll: body.reply_all === "1", text: String(body.text ?? "") }, actor);
233
+ return c.html(V.newReplyEditor(draft));
234
+ });
222
235
  app.post("/threads/:id/reply", async (c) => {
223
236
  const id = c.req.param("id");
224
237
  const actor = uiActor(c.get("session"));
@@ -243,7 +256,10 @@ export function registerUi(app, mail, access, cfg) {
243
256
  });
244
257
  app.post("/compose", async (c) => {
245
258
  const actor = uiActor(c.get("session"));
246
- const body = await c.req.parseBody();
259
+ const body = await c.req.parseBody({ all: true });
260
+ const { files, error } = uploads(body);
261
+ if (error)
262
+ return page(c, S.newMail, V.message([error]), null, 400);
247
263
  try {
248
264
  const draft = await mail.createDraft({
249
265
  mailbox: String(body.mailbox ?? ""),
@@ -252,6 +268,7 @@ export function registerUi(app, mail, access, cfg) {
252
268
  subject: String(body.subject ?? ""),
253
269
  text: String(body.text ?? ""),
254
270
  }, actor);
271
+ await attachAll(draft.id, files, actor);
255
272
  if (body.action === "send")
256
273
  await mail.schedule(draft.id, "send", actor);
257
274
  return c.redirect(`/threads/${draft.thread_id}?status=all`, 303);
@@ -15,6 +15,25 @@ document.addEventListener("click", event => {
15
15
  }
16
16
  });
17
17
 
18
+ // A draft's editor opens in the edit sheet; one draft is edited at a time.
19
+ document.addEventListener("htmx:afterSwap", event => {
20
+ const sheet = event.detail.target;
21
+ if (sheet.id !== "edit-sheet") return;
22
+ if (!sheet.open) sheet.showModal();
23
+ sheet.querySelector("textarea")?.focus();
24
+ });
25
+
26
+ // Closing the sheet on a reply started from the reply box shows its new draft in the thread.
27
+ document.addEventListener("close", event => {
28
+ if (event.target.id === "edit-sheet" && event.target.querySelector("[data-reload-on-close]")) location.reload();
29
+ }, true);
30
+
31
+ document.addEventListener("change", event => {
32
+ if (event.target.id === "compose-files") {
33
+ document.getElementById("compose-file-names").textContent = [...event.target.files].map(f => f.name).join(", ");
34
+ }
35
+ });
36
+
18
37
  document.addEventListener("keydown", event => {
19
38
  if (event.key === "Escape") document.body.classList.remove("context-open");
20
39
  });
@@ -77,7 +77,6 @@ body.full .tabbar { display: none; }
77
77
  }
78
78
  .brand { font-size: 20px; font-weight: 700; letter-spacing: -0.03em; padding: 0 12px; }
79
79
  .brand span { color: var(--accent); }
80
- .sidebar .domain { font-family: var(--mono); font-size: 11px; color: var(--muted); padding: 2px 12px 0; overflow-wrap: anywhere; }
81
80
  .new-mail { display: flex; align-items: center; justify-content: center; gap: 8px; height: 44px; border-radius: 12px; margin: 16px 0 14px; }
82
81
  .side-nav { display: flex; flex-direction: column; gap: 2px; }
83
82
  .side-nav a {
@@ -92,9 +91,11 @@ body.full .tabbar { display: none; }
92
91
  }
93
92
 
94
93
  /* Inbox: the list, and the open thread beside it on a wide screen */
95
- .split .pane { display: none; }
96
- .split.has-thread .list { display: none; }
97
- .split.has-thread .pane { display: block; }
94
+ @media (max-width: 899px) {
95
+ .split .pane { display: none; }
96
+ .split.has-thread .list { display: none; }
97
+ .split.has-thread .pane { display: block; }
98
+ }
98
99
  @media (min-width: 900px) {
99
100
  .split { display: flex; height: 100dvh; }
100
101
  .split .list { display: block; width: 380px; flex: none; overflow-y: auto; border-right: 1px solid var(--line); }
@@ -104,10 +105,12 @@ body.full .tabbar { display: none; }
104
105
 
105
106
  .list-head { padding: 18px 16px 12px; }
106
107
  .list-head h1 { font-size: 21px; line-height: 1.2; letter-spacing: -0.02em; margin: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
107
- .filters { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-top: 12px; }
108
- .chips { display: flex; gap: 8px; }
108
+ .filters { display: flex; align-items: center; gap: 8px; margin-top: 12px; }
109
+ .chips { display: flex; flex: none; gap: 8px; }
110
+ .filters .select { min-width: 0; }
111
+ .filters select { width: 100%; text-overflow: ellipsis; }
109
112
  .chip {
110
- display: inline-flex; align-items: center; height: 36px; padding: 0 14px; border-radius: 999px;
113
+ display: inline-flex; align-items: center; height: 36px; padding: 0 12px; border-radius: 999px;
111
114
  border: 1px solid var(--line); font-size: 13px; font-weight: 500; white-space: nowrap;
112
115
  }
113
116
  .chip:hover { border-color: var(--focus); }
@@ -129,7 +132,9 @@ body.full .tabbar { display: none; }
129
132
  .row.unread .who { font-weight: 600; }
130
133
  .row.unread .row-subject { color: var(--fg); font-weight: 500; }
131
134
  .row.unread time { color: var(--accent-text); }
132
- .row-tags { display: flex; align-items: center; gap: 6px; margin-top: 4px; }
135
+ .row-tags { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; margin-top: 4px; }
136
+ .row-snippet { display: block; font-size: 13px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
137
+ .row-by { font-family: var(--mono); font-size: 11px; color: var(--muted); }
133
138
  .list .empty { border-top: 1px solid var(--line); }
134
139
 
135
140
  /* Thread */
@@ -179,7 +184,6 @@ button.thread-title:hover { background: var(--soft); border: none; }
179
184
  align-self: flex-end; max-width: 86%; padding: 12px 14px;
180
185
  background: var(--surface); border: 1.5px dashed var(--accent); border-radius: 18px; border-bottom-right-radius: 6px;
181
186
  }
182
- .messages .card.editing { width: 100%; max-width: 100%; }
183
187
  .messages .card.pending, .messages .card.notice { border-style: solid; border-color: var(--line); }
184
188
  .messages .card .mailbox, .messages .draft-head .subject { display: none; }
185
189
  .messages .card .body { margin-top: 10px; }
@@ -257,10 +261,15 @@ dialog.sheet .field.compact { padding-right: 60px; }
257
261
  dialog.sheet .field output { font-family: var(--mono); font-size: .8rem; padding: 10px 0; }
258
262
  dialog.sheet textarea { flex: 1; min-height: 0; margin: 0; padding: 12px 16px; resize: none; }
259
263
  .sheet-actions {
260
- display: flex; justify-content: flex-end; gap: 8px;
264
+ display: flex; gap: 8px;
261
265
  padding: 8px 12px calc(8px + env(safe-area-inset-bottom)); border-top: 1px solid var(--line);
262
266
  }
263
267
  .sheet-actions button { height: 44px; display: inline-flex; align-items: center; gap: 8px; }
268
+ .sheet-actions .icon-btn { cursor: pointer; color: var(--muted); }
269
+ .sheet-actions .icon-btn:hover { color: var(--fg); }
270
+ .sheet-head { display: flex; align-items: center; gap: 8px; min-height: 60px; padding: 0 60px 0 16px; flex: none; }
271
+ dialog.sheet .note { margin: 0 16px 8px; flex: none; }
272
+ .sheet-files { flex: 1; min-width: 0; align-self: center; font-family: var(--mono); font-size: .75rem; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
264
273
  @media (min-width: 900px) {
265
274
  dialog.sheet { margin: auto; width: 640px; height: min(640px, 80dvh); border-radius: 18px; }
266
275
  dialog.sheet[open] { animation: none; }
@@ -275,7 +284,7 @@ dialog.sheet textarea { flex: 1; min-height: 0; margin: 0; padding: 12px 16px; r
275
284
  .meta strong { color: var(--fg); font-weight: 500; }
276
285
  .badge {
277
286
  font-family: var(--mono); font-size: .66rem; font-weight: 500; text-transform: uppercase; letter-spacing: .08em;
278
- padding: 2px 7px; border: 1px solid var(--line); border-radius: 4px; color: var(--fg);
287
+ padding: 2px 7px; border: 1px solid var(--line); border-radius: 4px; color: var(--fg); white-space: nowrap;
279
288
  }
280
289
  .badge.draft { border-color: var(--accent); color: var(--accent-text); }
281
290
  .dot { width: 8px; height: 8px; border-radius: 50%; background: var(--accent); display: inline-block; margin-left: auto; }
@@ -300,11 +309,9 @@ dialog.sheet textarea { flex: 1; min-height: 0; margin: 0; padding: 12px 16px; r
300
309
  .file:hover { border-color: var(--focus); }
301
310
  .file span:first-child { min-width: 0; overflow: hidden; text-overflow: ellipsis; }
302
311
  .file .size { color: var(--muted); flex: none; }
303
- .draft-files { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-top: 16px; }
304
- .draft-files .warn { flex-basis: 100%; margin: 0; color: var(--danger); font-family: var(--mono); font-size: .72rem; }
312
+ .draft-files { flex: 1; min-width: 0; display: flex; align-items: center; gap: 8px; overflow-x: auto; }
313
+ .draft-files .warn { flex: none; margin: 0; color: var(--danger); font-family: var(--mono); font-size: .72rem; }
305
314
  .draft-files .link { font-size: 1rem; line-height: 1; }
306
- .attach { cursor: pointer; color: var(--muted); }
307
- .attach:hover { color: var(--fg); }
308
315
  [data-drop] { position: relative; }
309
316
  .drop-hint {
310
317
  display: none; position: absolute; inset: 8px 0; z-index: 1;
@@ -322,8 +329,9 @@ dialog.sheet textarea { flex: 1; min-height: 0; margin: 0; padding: 12px 16px; r
322
329
  .countdown { position: absolute; left: 0; top: -1px; height: 1px; width: 100%; background: var(--accent); transform-origin: left; animation: countdown linear forwards; }
323
330
  .messages .countdown { left: 14px; right: 14px; width: auto; top: auto; bottom: 6px; }
324
331
  @keyframes countdown { from { transform: scaleX(1); } to { transform: scaleX(0); } }
325
- .conflict { border-top: 2px solid var(--danger); }
326
- .conflict .warn { color: var(--danger); font-weight: 600; margin: 14px 0 4px; }
332
+ .sheet-conflict { padding: 0 16px 8px; max-height: 40%; overflow-y: auto; flex: none; }
333
+ .sheet-conflict .warn { color: var(--danger); font-weight: 600; margin: 0; }
334
+ .sheet-conflict details summary { margin-top: 8px; }
327
335
 
328
336
  details summary {
329
337
  cursor: pointer; list-style: none; margin-top: 18px;
@@ -379,12 +387,16 @@ textarea {
379
387
  display: block; width: 100%; min-height: 16rem; margin-top: 16px; padding: 0; resize: vertical;
380
388
  border: none; background: none; font: inherit; color: var(--fg); outline: none;
381
389
  }
382
- .messages .editing textarea { min-height: 10rem; }
383
390
 
384
391
  /* Settings */
385
392
  .setting { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 16px 0; border-top: 1px solid var(--line); }
386
393
  .setting label { font-weight: 500; }
387
- .setting .danger { padding: 0; }
394
+ .row.device:hover { background: none; }
395
+ .row.device .avatar { color: var(--muted); }
396
+ .row.device .danger { align-self: center; padding: 0; height: auto; border: none; background: none; }
397
+ .row.device .danger:hover { text-decoration: underline; }
398
+ .setting .danger, .setting .danger:hover { padding: 0; height: auto; border: none; background: none; }
399
+ .setting .danger:hover { text-decoration: underline; }
388
400
 
389
401
  /* States */
390
402
  .centered { max-width: 360px; margin: 20vh auto 0; padding: 0 16px; text-align: center; }
@@ -25,7 +25,6 @@ export declare const S: {
25
25
  readonly discard: "Discard";
26
26
  readonly save: "Save";
27
27
  readonly saveAndSend: "Save & Send";
28
- readonly cancel: "Cancel";
29
28
  readonly attach: "Attach";
30
29
  readonly remove: "Remove";
31
30
  readonly dropFiles: "Drop files to attach";
@@ -33,7 +32,6 @@ export declare const S: {
33
32
  readonly sending: "Sending to";
34
33
  readonly discarding: "Discarding draft";
35
34
  readonly undo: "Undo";
36
- readonly sentTo: "Sent to";
37
35
  readonly discarded: "Draft discarded.";
38
36
  readonly editedByHuman: "Edited by you";
39
37
  readonly byAgent: "By agent";
@@ -43,12 +41,10 @@ export declare const S: {
43
41
  readonly replyAll: "Reply all";
44
42
  readonly today: "Today";
45
43
  readonly yesterday: "Yesterday";
46
- readonly thread: "Thread";
47
44
  readonly thisThread: "This thread";
48
45
  readonly context: "Context";
49
46
  readonly draft: "Draft";
50
47
  readonly conflictTitle: "This draft changed while you were editing.";
51
- readonly yourVersion: "Your version";
52
48
  readonly currentVersion: "Current version";
53
49
  readonly filterPending: "Pending";
54
50
  readonly filterAll: "All";
@@ -25,7 +25,6 @@ export const S = {
25
25
  discard: "Discard",
26
26
  save: "Save",
27
27
  saveAndSend: "Save & Send",
28
- cancel: "Cancel",
29
28
  attach: "Attach",
30
29
  remove: "Remove",
31
30
  dropFiles: "Drop files to attach",
@@ -33,7 +32,6 @@ export const S = {
33
32
  sending: "Sending to",
34
33
  discarding: "Discarding draft",
35
34
  undo: "Undo",
36
- sentTo: "Sent to",
37
35
  discarded: "Draft discarded.",
38
36
  editedByHuman: "Edited by you",
39
37
  byAgent: "By agent",
@@ -43,12 +41,10 @@ export const S = {
43
41
  replyAll: "Reply all",
44
42
  today: "Today",
45
43
  yesterday: "Yesterday",
46
- thread: "Thread",
47
44
  thisThread: "This thread",
48
45
  context: "Context",
49
46
  draft: "Draft",
50
47
  conflictTitle: "This draft changed while you were editing.",
51
- yourVersion: "Your version",
52
48
  currentVersion: "Current version",
53
49
  filterPending: "Pending",
54
50
  filterAll: "All",
@@ -13,7 +13,6 @@ export interface LayoutOptions {
13
13
  page: Page;
14
14
  signedIn: boolean;
15
15
  draftCount?: number;
16
- domains?: string[];
17
16
  /** Mailboxes the session can send from; New mail shows only when there is one. */
18
17
  senders?: Mailbox[];
19
18
  /** Thread pages fill the screen on a phone, so the tab bar gives way to the reply box. */
@@ -24,31 +23,29 @@ export declare function message(lines: string[]): View;
24
23
  export declare function signIn(token: string, valid: boolean): View;
25
24
  /** Image types a browser renders without running code; SVG is left out on purpose. */
26
25
  export declare function isPreviewable(contentType: string): boolean;
27
- /** A message in a draft's history on the Drafts page. */
28
- export declare function messageCard(m: MessageView): View;
29
26
  /** A message in a thread: received ones on the left, ours on the right. */
30
27
  export declare function messageBubble(m: MessageView, showSender: boolean): View;
31
28
  export interface ContextView {
32
29
  context: Context | null;
33
30
  contacts: Contact[];
34
31
  }
35
- /** A draft for review: a card on the Drafts page, a bubble on our side of a thread. */
36
- export declare function draftCard(d: Message, history: MessageView[], ctx: ContextView | null): View;
32
+ /** A draft for review, on our side of its thread. */
33
+ export declare function draftCard(d: Message): View;
37
34
  export interface DraftForm {
38
35
  to: string;
39
36
  cc: string;
40
37
  subject: string;
41
38
  text: string;
42
39
  }
40
+ /** The edit sheet's content; one draft is edited at a time. */
43
41
  export declare function draftEditor(d: Message, form: DraftForm, conflict: Message | null): View;
42
+ /** A reply opened in the edit sheet from the reply box; the thread reloads when the sheet closes, to show the new draft. */
43
+ export declare function newReplyEditor(d: Message): View;
44
44
  /** The editor's attachment list with remove buttons, and the picker that drag and drop also feeds. */
45
45
  export declare function draftFiles(d: Message, error: string | null): View;
46
46
  export declare function draftDone(id: string, text: string): View;
47
- export declare function draftsPage(drafts: {
48
- draft: Message;
49
- history: MessageView[];
50
- ctx: ContextView;
51
- }[]): View;
47
+ /** Drafts waiting for review, listed like the inbox; each opens its thread. */
48
+ export declare function draftList(drafts: Message[], current: string | null): View;
52
49
  export interface InboxFilter {
53
50
  mailbox: string;
54
51
  status: string;
@@ -70,6 +67,7 @@ export interface ThreadEntry {
70
67
  }
71
68
  /** The conversation, oldest first, with day separators, a reply box and the context panel. */
72
69
  export declare function threadView(thread: Thread, entries: ThreadEntry[], ctx: ContextView, opts: {
70
+ back: string;
73
71
  filter: InboxFilter;
74
72
  own: Set<string>;
75
73
  reply: {