inboxer 0.5.0 → 0.5.1
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/static/app.js +19 -3
- package/dist/ui/static/style.css +21 -5
- package/dist/ui/views.js +21 -7
- package/package.json +1 -1
- package/src/ui/static/app.js +19 -3
- package/src/ui/static/style.css +21 -5
- package/src/ui/views.ts +21 -7
package/dist/ui/static/app.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
// New mail opens as a modal sheet; a
|
|
1
|
+
// New mail opens as a modal sheet; a [data-close] button closes it, and so does a click outside it (closedby="any").
|
|
2
2
|
document.addEventListener("click", event => {
|
|
3
3
|
const target = event.target instanceof Element ? event.target : null;
|
|
4
4
|
if (!target) return;
|
|
@@ -8,13 +8,29 @@ document.addEventListener("click", event => {
|
|
|
8
8
|
dialog.querySelector("#compose-to").focus();
|
|
9
9
|
} else if (target.closest("[data-close]")) {
|
|
10
10
|
target.closest("dialog").close();
|
|
11
|
-
} else if (target instanceof HTMLDialogElement && target.open) {
|
|
12
|
-
target.close();
|
|
13
11
|
} else if (target.closest("[data-context-toggle]")) {
|
|
14
12
|
document.body.classList.toggle("context-open");
|
|
15
13
|
}
|
|
16
14
|
});
|
|
17
15
|
|
|
16
|
+
// Where closedby is missing, a press and a release that are both outside the sheet close it,
|
|
17
|
+
// so a text selection dragged onto the backdrop does not.
|
|
18
|
+
if (!("closedBy" in HTMLDialogElement.prototype)) {
|
|
19
|
+
const outside = (event, dialog) => {
|
|
20
|
+
const box = dialog.getBoundingClientRect();
|
|
21
|
+
return event.clientX < box.left || event.clientX > box.right || event.clientY < box.top || event.clientY > box.bottom;
|
|
22
|
+
};
|
|
23
|
+
let pressed = null;
|
|
24
|
+
document.addEventListener("pointerdown", event => {
|
|
25
|
+
const dialog = event.target instanceof Element ? event.target.closest('dialog[closedby="any"]') : null;
|
|
26
|
+
pressed = dialog && outside(event, dialog) ? dialog : null;
|
|
27
|
+
});
|
|
28
|
+
document.addEventListener("pointerup", event => {
|
|
29
|
+
if (pressed?.open && outside(event, pressed)) pressed.close();
|
|
30
|
+
pressed = null;
|
|
31
|
+
});
|
|
32
|
+
}
|
|
33
|
+
|
|
18
34
|
// A draft's editor opens in the edit sheet; one draft is edited at a time.
|
|
19
35
|
document.addEventListener("htmx:afterSwap", event => {
|
|
20
36
|
const sheet = event.detail.target;
|
package/dist/ui/static/style.css
CHANGED
|
@@ -29,6 +29,7 @@
|
|
|
29
29
|
|
|
30
30
|
* { box-sizing: border-box; }
|
|
31
31
|
[hidden] { display: none !important; }
|
|
32
|
+
.visually-hidden { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
|
|
32
33
|
body { margin: 0; background: var(--bg); color: var(--fg); }
|
|
33
34
|
a { color: inherit; text-decoration: none; }
|
|
34
35
|
h1 { font-size: 2rem; line-height: 1.1; letter-spacing: -0.04em; font-weight: 700; margin: 0 0 24px; }
|
|
@@ -155,6 +156,9 @@ body.full .tabbar { display: none; }
|
|
|
155
156
|
display: inline-flex; align-items: center; justify-content: center; background: none; color: var(--fg);
|
|
156
157
|
}
|
|
157
158
|
.icon-btn:hover { background: var(--soft); border: none; }
|
|
159
|
+
/* A file picker's label carries the focus ring of the input hidden inside it. */
|
|
160
|
+
label.icon-btn { position: relative; }
|
|
161
|
+
label.icon-btn:has(:focus-visible) { outline: 2px solid var(--focus); outline-offset: 2px; }
|
|
158
162
|
.thread-head form { margin: 0; }
|
|
159
163
|
.thread-title {
|
|
160
164
|
flex: 1; min-width: 0; height: auto; padding: 4px 6px; border: none; border-radius: 12px;
|
|
@@ -219,7 +223,7 @@ body.context-open .context-panel { display: flex; flex-direction: column; }
|
|
|
219
223
|
body.context-open .context-panel {
|
|
220
224
|
position: fixed; left: 0; right: 0; bottom: 0; z-index: 21; height: 70dvh;
|
|
221
225
|
border-radius: 22px 22px 0 0; box-shadow: 0 -8px 30px rgb(0 0 0 / .25);
|
|
222
|
-
padding-bottom: env(safe-area-inset-bottom);
|
|
226
|
+
padding-bottom: env(safe-area-inset-bottom);
|
|
223
227
|
}
|
|
224
228
|
.context-panel::before {
|
|
225
229
|
content: ""; position: absolute; top: 8px; left: 50%; width: 40px; height: 5px; margin-left: -20px;
|
|
@@ -237,6 +241,9 @@ body.context-open .context-panel { display: flex; flex-direction: column; }
|
|
|
237
241
|
body.context-open .context-panel { grid-column: 2; grid-row: 1 / -1; border-left: 1px solid var(--line); min-height: 0; }
|
|
238
242
|
.composer { padding: 0 24px 20px; background: none; border: none; }
|
|
239
243
|
}
|
|
244
|
+
@media (max-width: 899px) and (prefers-reduced-motion: no-preference) {
|
|
245
|
+
body.context-open .context-panel, dialog.sheet[open] { animation: rise .2s ease-out; }
|
|
246
|
+
}
|
|
240
247
|
@keyframes rise { from { transform: translateY(100%); } to { transform: translateY(0); } }
|
|
241
248
|
|
|
242
249
|
/* Context rows, shared by the panel and the folded block on a draft */
|
|
@@ -254,8 +261,9 @@ dialog.sheet {
|
|
|
254
261
|
border: none; border-radius: 22px 22px 0 0; background: var(--bg); color: var(--fg);
|
|
255
262
|
box-shadow: 0 -8px 30px rgb(0 0 0 / .25);
|
|
256
263
|
}
|
|
257
|
-
|
|
258
|
-
dialog.sheet
|
|
264
|
+
/* Scrolling inside the sheet or over its backdrop stays off the page behind. */
|
|
265
|
+
dialog.sheet:modal { overscroll-behavior: contain; }
|
|
266
|
+
dialog.sheet::backdrop { background: var(--backdrop); overflow: hidden; overscroll-behavior: contain; }
|
|
259
267
|
dialog.sheet form { position: relative; height: 100%; display: flex; flex-direction: column; }
|
|
260
268
|
.grabber { width: 40px; height: 5px; border-radius: 999px; background: var(--line); margin: 8px auto 9px; flex: none; }
|
|
261
269
|
.sheet-close { position: absolute; top: 8px; right: 8px; color: var(--muted); z-index: 1; }
|
|
@@ -263,6 +271,7 @@ dialog.sheet .field { padding: 0 16px; }
|
|
|
263
271
|
dialog.sheet .field.compact { padding-right: 60px; margin-top: 12px; }
|
|
264
272
|
dialog.sheet .field output { font-family: var(--mono); font-size: .8rem; padding: 10px 0; }
|
|
265
273
|
dialog.sheet textarea { flex: 1; min-height: 0; margin: 0; padding: 12px 16px; resize: none; }
|
|
274
|
+
dialog.sheet textarea:focus + .sheet-actions { border-top-color: var(--focus); }
|
|
266
275
|
.sheet-actions {
|
|
267
276
|
display: flex; gap: 8px;
|
|
268
277
|
padding: 8px 12px calc(8px + env(safe-area-inset-bottom)); border-top: 1px solid var(--line);
|
|
@@ -275,7 +284,6 @@ dialog.sheet .note { margin: 0 16px 8px; flex: none; }
|
|
|
275
284
|
.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; }
|
|
276
285
|
@media (min-width: 900px) {
|
|
277
286
|
dialog.sheet { margin: auto; width: 640px; height: min(640px, 80dvh); border-radius: 18px; }
|
|
278
|
-
dialog.sheet[open] { animation: none; }
|
|
279
287
|
.grabber { visibility: hidden; }
|
|
280
288
|
}
|
|
281
289
|
|
|
@@ -299,6 +307,7 @@ dialog.sheet .note { margin: 0 16px 8px; flex: none; }
|
|
|
299
307
|
.note { background: var(--soft); border-radius: 10px; padding: 6px 10px; margin: 12px 0; white-space: pre-wrap; font-size: .8125rem; color: var(--muted); }
|
|
300
308
|
.messages .note { background: var(--chip); }
|
|
301
309
|
.body { white-space: pre-wrap; overflow-wrap: anywhere; margin: 14px 0 0; font: inherit; }
|
|
310
|
+
.body a { text-decoration: underline; text-underline-offset: 2px; }
|
|
302
311
|
.images { display: grid; grid-template-columns: repeat(auto-fill, minmax(120px, 1fr)); gap: 8px; margin-top: 12px; }
|
|
303
312
|
.images a { display: block; aspect-ratio: 1; border: 1px solid var(--line); border-radius: 10px; overflow: hidden; background: var(--soft); }
|
|
304
313
|
.images img { width: 100%; height: 100%; object-fit: cover; display: block; transition: opacity .15s; }
|
|
@@ -330,8 +339,15 @@ dialog.sheet .note { margin: 0 16px 8px; flex: none; }
|
|
|
330
339
|
.pending-row span { min-width: 0; overflow-wrap: anywhere; color: var(--muted); }
|
|
331
340
|
.pending-row strong { color: var(--fg); font-weight: 500; }
|
|
332
341
|
.countdown { position: absolute; left: 0; top: -1px; height: 1px; width: 100%; background: var(--accent); transform-origin: left; animation: countdown linear forwards; }
|
|
333
|
-
.messages .countdown {
|
|
342
|
+
.messages .countdown {
|
|
343
|
+
inset: -1.5px; width: auto; height: auto; padding: 1.5px; border-radius: inherit; pointer-events: none;
|
|
344
|
+
background: conic-gradient(var(--accent) var(--countdown-angle), transparent 0);
|
|
345
|
+
mask: linear-gradient(#000 0 0) content-box exclude, linear-gradient(#000 0 0);
|
|
346
|
+
animation-name: countdown-ring;
|
|
347
|
+
}
|
|
348
|
+
@property --countdown-angle { syntax: "<angle>"; inherits: false; initial-value: 360deg; }
|
|
334
349
|
@keyframes countdown { from { transform: scaleX(1); } to { transform: scaleX(0); } }
|
|
350
|
+
@keyframes countdown-ring { from { --countdown-angle: 360deg; } to { --countdown-angle: 0deg; } }
|
|
335
351
|
.sheet-conflict { padding: 0 16px 8px; max-height: 40%; overflow-y: auto; flex: none; }
|
|
336
352
|
.sheet-conflict .warn { color: var(--danger); font-weight: 600; margin: 0; }
|
|
337
353
|
.sheet-conflict details summary { margin-top: 8px; }
|
package/dist/ui/views.js
CHANGED
|
@@ -105,7 +105,7 @@ ${when(opts.signedIn, () => h `<nav class="tabbar" id="tabbar" data-live aria-la
|
|
|
105
105
|
${link("settings", "/settings", S.navSettings, "settings")}
|
|
106
106
|
</nav>`)}
|
|
107
107
|
${when(opts.signedIn && canSend, () => composeDialog(opts.senders))}
|
|
108
|
-
${when(opts.signedIn, () => h `<dialog class="sheet" id="edit-sheet" aria-label="${S.edit}"></dialog>`)}
|
|
108
|
+
${when(opts.signedIn, () => h `<dialog class="sheet" id="edit-sheet" closedby="any" aria-label="${S.edit}"></dialog>`)}
|
|
109
109
|
</body>
|
|
110
110
|
</html>`;
|
|
111
111
|
}
|
|
@@ -114,7 +114,7 @@ function composeDialog(senders) {
|
|
|
114
114
|
const from = senders.length > 1
|
|
115
115
|
? h `<span class="select"><select id="compose-from" name="mailbox">${join(senders.map(m => h `<option value="${m.id}">${m.address}</option>`))}</select></span>`
|
|
116
116
|
: h `<input type="hidden" name="mailbox" value="${senders[0].id}"><output id="compose-from">${senders[0].address}</output>`;
|
|
117
|
-
return h `<dialog class="sheet" id="compose" aria-label="${S.newMail}">${mailForm("compose", "/compose", {
|
|
117
|
+
return h `<dialog class="sheet" id="compose" closedby="any" aria-label="${S.newMail}">${mailForm("compose", "/compose", {
|
|
118
118
|
head: h `<div class="field compact"><label for="compose-from">${S.from}</label>${from}</div>`, headIsRow: true, to: "", cc: "", subject: "", text: "",
|
|
119
119
|
})}</dialog>`;
|
|
120
120
|
}
|
|
@@ -146,7 +146,7 @@ function mailForm(id, action, f) {
|
|
|
146
146
|
</div>
|
|
147
147
|
<textarea name="text" aria-label="${S.body}" required>${f.text}</textarea>
|
|
148
148
|
<div class="sheet-actions">
|
|
149
|
-
<label class="icon-btn"
|
|
149
|
+
<label class="icon-btn">${icon("attach")}<input type="file" name="files" multiple class="visually-hidden" aria-label="${S.attach}" data-file-names></label>
|
|
150
150
|
<output class="sheet-files"></output>
|
|
151
151
|
<button type="submit" name="action" value="save">${S.saveDraft}</button>
|
|
152
152
|
<button type="submit" name="action" value="send" class="primary">${S.send}${icon("send")}</button>
|
|
@@ -207,6 +207,20 @@ function withoutImagePlaceholders(m) {
|
|
|
207
207
|
}
|
|
208
208
|
return text.replace(/\n{3,}/g, "\n\n").trim();
|
|
209
209
|
}
|
|
210
|
+
/** Plain text with its web addresses turned into links; the punctuation that closes a sentence stays outside them. */
|
|
211
|
+
function linked(text) {
|
|
212
|
+
const parts = [];
|
|
213
|
+
let last = 0;
|
|
214
|
+
for (const match of text.matchAll(/https?:\/\/[^\s<>"]+/g)) {
|
|
215
|
+
let url = match[0];
|
|
216
|
+
while (/[.,;:!?'*]$/.test(url) || (url.endsWith(")") && url.split(")").length > url.split("(").length))
|
|
217
|
+
url = url.slice(0, -1);
|
|
218
|
+
parts.push(h `${text.slice(last, match.index)}<a href="${url}" target="_blank" rel="noopener noreferrer">${url}</a>`);
|
|
219
|
+
last = match.index + url.length;
|
|
220
|
+
}
|
|
221
|
+
parts.push(h `${text.slice(last)}`);
|
|
222
|
+
return join(parts);
|
|
223
|
+
}
|
|
210
224
|
function recipients(m) {
|
|
211
225
|
if (!m.to.length && !m.cc.length)
|
|
212
226
|
return "";
|
|
@@ -219,7 +233,7 @@ export function messageBubble(m, showSender) {
|
|
|
219
233
|
return h `<article class="msg ${mine ? "mine" : "theirs"}" id="m-${m.id}">
|
|
220
234
|
${when(showSender && !mine, () => h `<div class="msg-from">${displayName(m.from)}</div>`)}
|
|
221
235
|
${extra ? recipients(m) : ""}
|
|
222
|
-
<pre class="body">${withoutImagePlaceholders(m)}</pre>
|
|
236
|
+
<pre class="body">${linked(withoutImagePlaceholders(m))}</pre>
|
|
223
237
|
${attachments(m)}
|
|
224
238
|
<span class="msg-time">${formatTime(m.date)}${mine ? ` · ${m.status}` : ""}</span>
|
|
225
239
|
</article>`;
|
|
@@ -263,7 +277,7 @@ export function draftCard(d, canAct) {
|
|
|
263
277
|
${when(d.subject, () => h `<div class="subject">${d.subject}</div>`)}
|
|
264
278
|
</div>
|
|
265
279
|
${when(d.note, () => h `<div class="note">${d.note}</div>`)}
|
|
266
|
-
<pre class="body">${d.text}</pre>
|
|
280
|
+
<pre class="body">${linked(d.text)}</pre>
|
|
267
281
|
${attachments(d)}
|
|
268
282
|
${when(canAct, () => h `<div class="actions">
|
|
269
283
|
<button class="danger" hx-post="/drafts/${d.id}/discard" hx-target="#draft-${d.id}" hx-swap="outerHTML">${S.discard}</button>
|
|
@@ -287,7 +301,7 @@ export function draftEditor(d, form, conflict, chat) {
|
|
|
287
301
|
<summary>${S.currentVersion}</summary>
|
|
288
302
|
<div class="meta"><span>${S.to}: ${conflict.to.join(", ")}</span>${when(conflict.cc.length, () => h `<span>${S.cc}: ${conflict.cc.join(", ")}</span>`)}</div>
|
|
289
303
|
<div class="subject">${conflict.subject}</div>
|
|
290
|
-
<pre class="body">${conflict.text}</pre>
|
|
304
|
+
<pre class="body">${linked(conflict.text)}</pre>
|
|
291
305
|
</details>
|
|
292
306
|
</div>`)}
|
|
293
307
|
<input type="hidden" name="version" value="${version}">
|
|
@@ -315,7 +329,7 @@ export function draftEditor(d, form, conflict, chat) {
|
|
|
315
329
|
/** The editor's attachment list with remove buttons, and the picker that drag and drop also feeds. */
|
|
316
330
|
export function draftFiles(d, error) {
|
|
317
331
|
return h `<div class="draft-files" id="files-${d.id}">
|
|
318
|
-
<label class="icon-btn"
|
|
332
|
+
<label class="icon-btn">${icon("attach")}<input type="file" name="files" multiple class="visually-hidden" aria-label="${S.attach}" hx-post="/drafts/${d.id}/attachments" hx-encoding="multipart/form-data" hx-trigger="change" hx-target="#files-${d.id}" hx-swap="outerHTML" hx-include="this"></label>
|
|
319
333
|
${join(d.attachments.map(a => h `<span class="file"><span>${a.filename}</span><span class="size">${formatSize(a.size)}</span><button type="button" class="link" aria-label="${S.remove} ${a.filename}" hx-post="/drafts/${d.id}/attachments/${a.id}/remove" hx-target="#files-${d.id}" hx-swap="outerHTML">×</button></span>`))}
|
|
320
334
|
${when(error, () => h `<p class="warn">${error}</p>`)}
|
|
321
335
|
</div>`;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "inboxer",
|
|
3
|
-
"version": "0.5.
|
|
3
|
+
"version": "0.5.1",
|
|
4
4
|
"description": "A self-hosted mail layer for agents: persists every inbound and outbound email, exposes an MCP server, and ships a minimal UI to review drafts.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./dist/index.js",
|
package/src/ui/static/app.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
// New mail opens as a modal sheet; a
|
|
1
|
+
// New mail opens as a modal sheet; a [data-close] button closes it, and so does a click outside it (closedby="any").
|
|
2
2
|
document.addEventListener("click", event => {
|
|
3
3
|
const target = event.target instanceof Element ? event.target : null;
|
|
4
4
|
if (!target) return;
|
|
@@ -8,13 +8,29 @@ document.addEventListener("click", event => {
|
|
|
8
8
|
dialog.querySelector("#compose-to").focus();
|
|
9
9
|
} else if (target.closest("[data-close]")) {
|
|
10
10
|
target.closest("dialog").close();
|
|
11
|
-
} else if (target instanceof HTMLDialogElement && target.open) {
|
|
12
|
-
target.close();
|
|
13
11
|
} else if (target.closest("[data-context-toggle]")) {
|
|
14
12
|
document.body.classList.toggle("context-open");
|
|
15
13
|
}
|
|
16
14
|
});
|
|
17
15
|
|
|
16
|
+
// Where closedby is missing, a press and a release that are both outside the sheet close it,
|
|
17
|
+
// so a text selection dragged onto the backdrop does not.
|
|
18
|
+
if (!("closedBy" in HTMLDialogElement.prototype)) {
|
|
19
|
+
const outside = (event, dialog) => {
|
|
20
|
+
const box = dialog.getBoundingClientRect();
|
|
21
|
+
return event.clientX < box.left || event.clientX > box.right || event.clientY < box.top || event.clientY > box.bottom;
|
|
22
|
+
};
|
|
23
|
+
let pressed = null;
|
|
24
|
+
document.addEventListener("pointerdown", event => {
|
|
25
|
+
const dialog = event.target instanceof Element ? event.target.closest('dialog[closedby="any"]') : null;
|
|
26
|
+
pressed = dialog && outside(event, dialog) ? dialog : null;
|
|
27
|
+
});
|
|
28
|
+
document.addEventListener("pointerup", event => {
|
|
29
|
+
if (pressed?.open && outside(event, pressed)) pressed.close();
|
|
30
|
+
pressed = null;
|
|
31
|
+
});
|
|
32
|
+
}
|
|
33
|
+
|
|
18
34
|
// A draft's editor opens in the edit sheet; one draft is edited at a time.
|
|
19
35
|
document.addEventListener("htmx:afterSwap", event => {
|
|
20
36
|
const sheet = event.detail.target;
|
package/src/ui/static/style.css
CHANGED
|
@@ -29,6 +29,7 @@
|
|
|
29
29
|
|
|
30
30
|
* { box-sizing: border-box; }
|
|
31
31
|
[hidden] { display: none !important; }
|
|
32
|
+
.visually-hidden { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
|
|
32
33
|
body { margin: 0; background: var(--bg); color: var(--fg); }
|
|
33
34
|
a { color: inherit; text-decoration: none; }
|
|
34
35
|
h1 { font-size: 2rem; line-height: 1.1; letter-spacing: -0.04em; font-weight: 700; margin: 0 0 24px; }
|
|
@@ -155,6 +156,9 @@ body.full .tabbar { display: none; }
|
|
|
155
156
|
display: inline-flex; align-items: center; justify-content: center; background: none; color: var(--fg);
|
|
156
157
|
}
|
|
157
158
|
.icon-btn:hover { background: var(--soft); border: none; }
|
|
159
|
+
/* A file picker's label carries the focus ring of the input hidden inside it. */
|
|
160
|
+
label.icon-btn { position: relative; }
|
|
161
|
+
label.icon-btn:has(:focus-visible) { outline: 2px solid var(--focus); outline-offset: 2px; }
|
|
158
162
|
.thread-head form { margin: 0; }
|
|
159
163
|
.thread-title {
|
|
160
164
|
flex: 1; min-width: 0; height: auto; padding: 4px 6px; border: none; border-radius: 12px;
|
|
@@ -219,7 +223,7 @@ body.context-open .context-panel { display: flex; flex-direction: column; }
|
|
|
219
223
|
body.context-open .context-panel {
|
|
220
224
|
position: fixed; left: 0; right: 0; bottom: 0; z-index: 21; height: 70dvh;
|
|
221
225
|
border-radius: 22px 22px 0 0; box-shadow: 0 -8px 30px rgb(0 0 0 / .25);
|
|
222
|
-
padding-bottom: env(safe-area-inset-bottom);
|
|
226
|
+
padding-bottom: env(safe-area-inset-bottom);
|
|
223
227
|
}
|
|
224
228
|
.context-panel::before {
|
|
225
229
|
content: ""; position: absolute; top: 8px; left: 50%; width: 40px; height: 5px; margin-left: -20px;
|
|
@@ -237,6 +241,9 @@ body.context-open .context-panel { display: flex; flex-direction: column; }
|
|
|
237
241
|
body.context-open .context-panel { grid-column: 2; grid-row: 1 / -1; border-left: 1px solid var(--line); min-height: 0; }
|
|
238
242
|
.composer { padding: 0 24px 20px; background: none; border: none; }
|
|
239
243
|
}
|
|
244
|
+
@media (max-width: 899px) and (prefers-reduced-motion: no-preference) {
|
|
245
|
+
body.context-open .context-panel, dialog.sheet[open] { animation: rise .2s ease-out; }
|
|
246
|
+
}
|
|
240
247
|
@keyframes rise { from { transform: translateY(100%); } to { transform: translateY(0); } }
|
|
241
248
|
|
|
242
249
|
/* Context rows, shared by the panel and the folded block on a draft */
|
|
@@ -254,8 +261,9 @@ dialog.sheet {
|
|
|
254
261
|
border: none; border-radius: 22px 22px 0 0; background: var(--bg); color: var(--fg);
|
|
255
262
|
box-shadow: 0 -8px 30px rgb(0 0 0 / .25);
|
|
256
263
|
}
|
|
257
|
-
|
|
258
|
-
dialog.sheet
|
|
264
|
+
/* Scrolling inside the sheet or over its backdrop stays off the page behind. */
|
|
265
|
+
dialog.sheet:modal { overscroll-behavior: contain; }
|
|
266
|
+
dialog.sheet::backdrop { background: var(--backdrop); overflow: hidden; overscroll-behavior: contain; }
|
|
259
267
|
dialog.sheet form { position: relative; height: 100%; display: flex; flex-direction: column; }
|
|
260
268
|
.grabber { width: 40px; height: 5px; border-radius: 999px; background: var(--line); margin: 8px auto 9px; flex: none; }
|
|
261
269
|
.sheet-close { position: absolute; top: 8px; right: 8px; color: var(--muted); z-index: 1; }
|
|
@@ -263,6 +271,7 @@ dialog.sheet .field { padding: 0 16px; }
|
|
|
263
271
|
dialog.sheet .field.compact { padding-right: 60px; margin-top: 12px; }
|
|
264
272
|
dialog.sheet .field output { font-family: var(--mono); font-size: .8rem; padding: 10px 0; }
|
|
265
273
|
dialog.sheet textarea { flex: 1; min-height: 0; margin: 0; padding: 12px 16px; resize: none; }
|
|
274
|
+
dialog.sheet textarea:focus + .sheet-actions { border-top-color: var(--focus); }
|
|
266
275
|
.sheet-actions {
|
|
267
276
|
display: flex; gap: 8px;
|
|
268
277
|
padding: 8px 12px calc(8px + env(safe-area-inset-bottom)); border-top: 1px solid var(--line);
|
|
@@ -275,7 +284,6 @@ dialog.sheet .note { margin: 0 16px 8px; flex: none; }
|
|
|
275
284
|
.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; }
|
|
276
285
|
@media (min-width: 900px) {
|
|
277
286
|
dialog.sheet { margin: auto; width: 640px; height: min(640px, 80dvh); border-radius: 18px; }
|
|
278
|
-
dialog.sheet[open] { animation: none; }
|
|
279
287
|
.grabber { visibility: hidden; }
|
|
280
288
|
}
|
|
281
289
|
|
|
@@ -299,6 +307,7 @@ dialog.sheet .note { margin: 0 16px 8px; flex: none; }
|
|
|
299
307
|
.note { background: var(--soft); border-radius: 10px; padding: 6px 10px; margin: 12px 0; white-space: pre-wrap; font-size: .8125rem; color: var(--muted); }
|
|
300
308
|
.messages .note { background: var(--chip); }
|
|
301
309
|
.body { white-space: pre-wrap; overflow-wrap: anywhere; margin: 14px 0 0; font: inherit; }
|
|
310
|
+
.body a { text-decoration: underline; text-underline-offset: 2px; }
|
|
302
311
|
.images { display: grid; grid-template-columns: repeat(auto-fill, minmax(120px, 1fr)); gap: 8px; margin-top: 12px; }
|
|
303
312
|
.images a { display: block; aspect-ratio: 1; border: 1px solid var(--line); border-radius: 10px; overflow: hidden; background: var(--soft); }
|
|
304
313
|
.images img { width: 100%; height: 100%; object-fit: cover; display: block; transition: opacity .15s; }
|
|
@@ -330,8 +339,15 @@ dialog.sheet .note { margin: 0 16px 8px; flex: none; }
|
|
|
330
339
|
.pending-row span { min-width: 0; overflow-wrap: anywhere; color: var(--muted); }
|
|
331
340
|
.pending-row strong { color: var(--fg); font-weight: 500; }
|
|
332
341
|
.countdown { position: absolute; left: 0; top: -1px; height: 1px; width: 100%; background: var(--accent); transform-origin: left; animation: countdown linear forwards; }
|
|
333
|
-
.messages .countdown {
|
|
342
|
+
.messages .countdown {
|
|
343
|
+
inset: -1.5px; width: auto; height: auto; padding: 1.5px; border-radius: inherit; pointer-events: none;
|
|
344
|
+
background: conic-gradient(var(--accent) var(--countdown-angle), transparent 0);
|
|
345
|
+
mask: linear-gradient(#000 0 0) content-box exclude, linear-gradient(#000 0 0);
|
|
346
|
+
animation-name: countdown-ring;
|
|
347
|
+
}
|
|
348
|
+
@property --countdown-angle { syntax: "<angle>"; inherits: false; initial-value: 360deg; }
|
|
334
349
|
@keyframes countdown { from { transform: scaleX(1); } to { transform: scaleX(0); } }
|
|
350
|
+
@keyframes countdown-ring { from { --countdown-angle: 360deg; } to { --countdown-angle: 0deg; } }
|
|
335
351
|
.sheet-conflict { padding: 0 16px 8px; max-height: 40%; overflow-y: auto; flex: none; }
|
|
336
352
|
.sheet-conflict .warn { color: var(--danger); font-weight: 600; margin: 0; }
|
|
337
353
|
.sheet-conflict details summary { margin-top: 8px; }
|
package/src/ui/views.ts
CHANGED
|
@@ -143,7 +143,7 @@ ${when(opts.signedIn, () => h`<nav class="tabbar" id="tabbar" data-live aria-lab
|
|
|
143
143
|
${link("settings", "/settings", S.navSettings, "settings")}
|
|
144
144
|
</nav>`)}
|
|
145
145
|
${when(opts.signedIn && canSend, () => composeDialog(opts.senders!))}
|
|
146
|
-
${when(opts.signedIn, () => h`<dialog class="sheet" id="edit-sheet" aria-label="${S.edit}"></dialog>`)}
|
|
146
|
+
${when(opts.signedIn, () => h`<dialog class="sheet" id="edit-sheet" closedby="any" aria-label="${S.edit}"></dialog>`)}
|
|
147
147
|
</body>
|
|
148
148
|
</html>`;
|
|
149
149
|
}
|
|
@@ -153,7 +153,7 @@ function composeDialog(senders: Mailbox[]): View {
|
|
|
153
153
|
const from = senders.length > 1
|
|
154
154
|
? h`<span class="select"><select id="compose-from" name="mailbox">${join(senders.map(m => h`<option value="${m.id}">${m.address}</option>`))}</select></span>`
|
|
155
155
|
: h`<input type="hidden" name="mailbox" value="${senders[0]!.id}"><output id="compose-from">${senders[0]!.address}</output>`;
|
|
156
|
-
return h`<dialog class="sheet" id="compose" aria-label="${S.newMail}">${mailForm("compose", "/compose", {
|
|
156
|
+
return h`<dialog class="sheet" id="compose" closedby="any" aria-label="${S.newMail}">${mailForm("compose", "/compose", {
|
|
157
157
|
head: h`<div class="field compact"><label for="compose-from">${S.from}</label>${from}</div>`, headIsRow: true, to: "", cc: "", subject: "", text: "",
|
|
158
158
|
})}</dialog>`;
|
|
159
159
|
}
|
|
@@ -187,7 +187,7 @@ function mailForm(id: string, action: string, f: { head: View; headIsRow?: boole
|
|
|
187
187
|
</div>
|
|
188
188
|
<textarea name="text" aria-label="${S.body}" required>${f.text}</textarea>
|
|
189
189
|
<div class="sheet-actions">
|
|
190
|
-
<label class="icon-btn"
|
|
190
|
+
<label class="icon-btn">${icon("attach")}<input type="file" name="files" multiple class="visually-hidden" aria-label="${S.attach}" data-file-names></label>
|
|
191
191
|
<output class="sheet-files"></output>
|
|
192
192
|
<button type="submit" name="action" value="save">${S.saveDraft}</button>
|
|
193
193
|
<button type="submit" name="action" value="send" class="primary">${S.send}${icon("send")}</button>
|
|
@@ -255,6 +255,20 @@ function withoutImagePlaceholders(m: MessageView): string {
|
|
|
255
255
|
return text.replace(/\n{3,}/g, "\n\n").trim();
|
|
256
256
|
}
|
|
257
257
|
|
|
258
|
+
/** Plain text with its web addresses turned into links; the punctuation that closes a sentence stays outside them. */
|
|
259
|
+
function linked(text: string): View {
|
|
260
|
+
const parts: View[] = [];
|
|
261
|
+
let last = 0;
|
|
262
|
+
for (const match of text.matchAll(/https?:\/\/[^\s<>"]+/g)) {
|
|
263
|
+
let url = match[0];
|
|
264
|
+
while (/[.,;:!?'*]$/.test(url) || (url.endsWith(")") && url.split(")").length > url.split("(").length)) url = url.slice(0, -1);
|
|
265
|
+
parts.push(h`${text.slice(last, match.index)}<a href="${url}" target="_blank" rel="noopener noreferrer">${url}</a>`);
|
|
266
|
+
last = match.index + url.length;
|
|
267
|
+
}
|
|
268
|
+
parts.push(h`${text.slice(last)}`);
|
|
269
|
+
return join(parts);
|
|
270
|
+
}
|
|
271
|
+
|
|
258
272
|
function recipients(m: MessageView): View | "" {
|
|
259
273
|
if (!m.to.length && !m.cc.length) return "";
|
|
260
274
|
return h`<div class="meta">${when(m.to.length, () => h`<span>${S.to}: ${m.to.join(", ")}</span>`)}${when(m.cc.length, () => h`<span>${S.cc}: ${m.cc.join(", ")}</span>`)}</div>`;
|
|
@@ -267,7 +281,7 @@ export function messageBubble(m: MessageView, showSender: boolean): View {
|
|
|
267
281
|
return h`<article class="msg ${mine ? "mine" : "theirs"}" id="m-${m.id}">
|
|
268
282
|
${when(showSender && !mine, () => h`<div class="msg-from">${displayName(m.from)}</div>`)}
|
|
269
283
|
${extra ? recipients(m) : ""}
|
|
270
|
-
<pre class="body">${withoutImagePlaceholders(m)}</pre>
|
|
284
|
+
<pre class="body">${linked(withoutImagePlaceholders(m))}</pre>
|
|
271
285
|
${attachments(m)}
|
|
272
286
|
<span class="msg-time">${formatTime(m.date)}${mine ? ` · ${m.status}` : ""}</span>
|
|
273
287
|
</article>`;
|
|
@@ -319,7 +333,7 @@ export function draftCard(d: Message, canAct: boolean): View {
|
|
|
319
333
|
${when(d.subject, () => h`<div class="subject">${d.subject}</div>`)}
|
|
320
334
|
</div>
|
|
321
335
|
${when(d.note, () => h`<div class="note">${d.note}</div>`)}
|
|
322
|
-
<pre class="body">${d.text}</pre>
|
|
336
|
+
<pre class="body">${linked(d.text)}</pre>
|
|
323
337
|
${attachments(d)}
|
|
324
338
|
${when(canAct, () => h`<div class="actions">
|
|
325
339
|
<button class="danger" hx-post="/drafts/${d.id}/discard" hx-target="#draft-${d.id}" hx-swap="outerHTML">${S.discard}</button>
|
|
@@ -351,7 +365,7 @@ export function draftEditor(d: Message, form: DraftForm, conflict: Message | nul
|
|
|
351
365
|
<summary>${S.currentVersion}</summary>
|
|
352
366
|
<div class="meta"><span>${S.to}: ${conflict!.to.join(", ")}</span>${when(conflict!.cc.length, () => h`<span>${S.cc}: ${conflict!.cc.join(", ")}</span>`)}</div>
|
|
353
367
|
<div class="subject">${conflict!.subject}</div>
|
|
354
|
-
<pre class="body">${conflict!.text}</pre>
|
|
368
|
+
<pre class="body">${linked(conflict!.text)}</pre>
|
|
355
369
|
</details>
|
|
356
370
|
</div>`)}
|
|
357
371
|
<input type="hidden" name="version" value="${version}">
|
|
@@ -380,7 +394,7 @@ export function draftEditor(d: Message, form: DraftForm, conflict: Message | nul
|
|
|
380
394
|
/** The editor's attachment list with remove buttons, and the picker that drag and drop also feeds. */
|
|
381
395
|
export function draftFiles(d: Message, error: string | null): View {
|
|
382
396
|
return h`<div class="draft-files" id="files-${d.id}">
|
|
383
|
-
<label class="icon-btn"
|
|
397
|
+
<label class="icon-btn">${icon("attach")}<input type="file" name="files" multiple class="visually-hidden" aria-label="${S.attach}" hx-post="/drafts/${d.id}/attachments" hx-encoding="multipart/form-data" hx-trigger="change" hx-target="#files-${d.id}" hx-swap="outerHTML" hx-include="this"></label>
|
|
384
398
|
${join(d.attachments.map(a => h`<span class="file"><span>${a.filename}</span><span class="size">${formatSize(a.size)}</span><button type="button" class="link" aria-label="${S.remove} ${a.filename}" hx-post="/drafts/${d.id}/attachments/${a.id}/remove" hx-target="#files-${d.id}" hx-swap="outerHTML">×</button></span>`))}
|
|
385
399
|
${when(error, () => h`<p class="warn">${error}</p>`)}
|
|
386
400
|
</div>`;
|