commit
updates
diff --git a/index.html b/index.html
index d4e9e20..6896c4c 100644
--- a/index.html
+++ b/index.html
@@ -15,8 +15,135 @@
<link rel="icon" href="/icon.svg" type="image/svg+xml" />
<link rel="apple-touch-icon" href="/apple-touch-icon.png" />
<link rel="manifest" href="/manifest.webmanifest" />
+ <!-- Splash: inline so it paints before the bundle loads. Frame one is the
+ Android splash (the icon at 128px), so the hand-off doesn't jump. -->
+ <style>
+ #splash {
+ position: fixed;
+ inset: 0;
+ z-index: 100;
+ display: grid;
+ place-items: center;
+ background: #0b0a0d;
+ transition: opacity 0.35s ease 0.1s;
+ }
+
+ #splash svg {
+ width: 128px;
+ height: 128px;
+ overflow: visible;
+ }
+
+ #splash .icon {
+ transform-origin: 256px 256px;
+ animation: splash-breathe 0.6s ease-in-out 0.15s;
+ }
+
+ #splash .glow {
+ animation: splash-glow 0.9s ease-in-out 0.15s;
+ }
+
+ #splash .envelope {
+ transform-origin: 256px 372px;
+ animation: splash-hop 0.6s cubic-bezier(0.3, 0, 0.3, 1) 0.15s;
+ }
+
+ #splash .flap {
+ stroke-dasharray: 360;
+ animation: splash-seal 0.5s ease-in-out 0.3s both;
+ }
+
+ #splash.out {
+ opacity: 0;
+ pointer-events: none;
+ }
+
+ #splash.out .icon {
+ animation: splash-zoom 0.45s cubic-bezier(0.5, 0, 0.75, 0) forwards;
+ }
+
+ @keyframes splash-breathe {
+ 50% {
+ transform: scale(1.06);
+ }
+ }
+
+ @keyframes splash-glow {
+ 50% {
+ filter: brightness(1.6);
+ }
+ }
+
+ @keyframes splash-hop {
+ 35% {
+ transform: translateY(-34px) scale(0.97, 1.04);
+ }
+ 70% {
+ transform: translateY(0) scale(1.05, 0.94);
+ }
+ }
+
+ @keyframes splash-seal {
+ 0% {
+ stroke-dashoffset: 0;
+ }
+ 45% {
+ stroke-dashoffset: 360;
+ }
+ 100% {
+ stroke-dashoffset: 0;
+ }
+ }
+
+ @keyframes splash-zoom {
+ to {
+ transform: scale(1.35);
+ }
+ }
+
+ @media (prefers-reduced-motion: reduce) {
+ #splash *,
+ #splash.out .icon {
+ animation: none !important;
+ }
+ }
+ </style>
</head>
<body>
+ <div id="splash" aria-hidden="true">
+ <svg viewBox="0 0 512 512">
+ <defs>
+ <linearGradient id="splash-bg" x1="0" y1="0" x2="0" y2="1">
+ <stop offset="0" stop-color="#1c1721" />
+ <stop offset="1" stop-color="#0b0a0d" />
+ </linearGradient>
+ <radialGradient id="splash-glow" cx="0.15" cy="0.1" r="0.9">
+ <stop offset="0" stop-color="#eb459e" stop-opacity="0.35" />
+ <stop offset="1" stop-color="#eb459e" stop-opacity="0" />
+ </radialGradient>
+ <linearGradient id="splash-env" x1="0" y1="0" x2="0" y2="1">
+ <stop offset="0" stop-color="#f45fae" />
+ <stop offset="1" stop-color="#d42f86" />
+ </linearGradient>
+ </defs>
+ <g class="icon">
+ <rect width="512" height="512" rx="112" fill="url(#splash-bg)" />
+ <rect class="glow" width="512" height="512" rx="112" fill="url(#splash-glow)" />
+ <g class="envelope">
+ <rect x="88" y="140" width="336" height="232" rx="40" fill="url(#splash-env)" />
+ <path
+ class="flap"
+ d="M120 180 L256 284 L392 180"
+ fill="none"
+ stroke="#fff1f8"
+ stroke-width="30"
+ stroke-linecap="round"
+ stroke-linejoin="round"
+ />
+ </g>
+ </g>
+ </svg>
+ </div>
<div id="app"></div>
<script type="module" src="/src/web/main.ts"></script>
</body>
diff --git a/src/web/App.svelte b/src/web/App.svelte
index 9338883..10a03f7 100644
--- a/src/web/App.svelte
+++ b/src/web/App.svelte
@@ -10,6 +10,7 @@
import ThreadList from "./components/ThreadList.svelte";
import ThreadView from "./components/ThreadView.svelte";
import { startLive } from "./lib/live";
+ import { hideSplash } from "./lib/splash";
import { isDemo, router } from "./lib/router.svelte";
import { composeNew, composer, loadSession, session } from "./lib/state.svelte";
import Admin from "./pages/Admin.svelte";
@@ -32,6 +33,10 @@
.then(() => !isDemo && startLive())
.catch((e: Error) => (error = e.message));
});
+ $effect(() => {
+ if (session.me || error || legal) hideSplash();
+ });
+
const reading = $derived(route.name === "folder" && route.threadId !== null);
$effect(() => {
diff --git a/src/web/components/ActionMenu.svelte b/src/web/components/ActionMenu.svelte
new file mode 100644
index 0000000..e7c74b2
--- /dev/null
+++ b/src/web/components/ActionMenu.svelte
@@ -0,0 +1,203 @@
+<!-- mailbox/src/web/components/ActionMenu.svelte
+ Copyright (c) 2026 Clove Nytrix Doughmination Twilight
+ Licensed under the DASL-1.0 Licence.
+ See LICENCE.md in the project root for full licence information. -->
+<script lang="ts" module>
+ import type { Component } from "svelte";
+
+ export interface MenuItem {
+ label: string;
+ icon: Component<{ size?: number }>;
+ danger?: boolean;
+ // Asks for a second tap, showing this label, before running.
+ confirm?: string;
+ run: () => void;
+ }
+</script>
+
+<script lang="ts">
+ import { onMount } from "svelte";
+ import { fade, fly } from "svelte/transition";
+ import type { HoldPoint } from "./SwipeRow.svelte";
+
+ let {
+ title,
+ items,
+ at,
+ onclose,
+ }: {
+ title: string;
+ items: MenuItem[];
+ at: HoldPoint;
+ onclose: () => void;
+ } = $props();
+
+ let menu: HTMLDivElement;
+ let menuWidth = $state(0);
+ let menuHeight = $state(0);
+ let confirming = $state<MenuItem | null>(null);
+
+ // The finger that held the row lifts over the backdrop; don't close on it.
+ const openedAt = performance.now();
+
+ function onbackdrop() {
+ if (performance.now() - openedAt > 350) onclose();
+ }
+
+ // Keeps the popover on screen, flipping above the cursor if need be.
+ const left = $derived(Math.max(8, Math.min(at.x, innerWidth - menuWidth - 8)));
+ const top = $derived(at.y + menuHeight + 8 > innerHeight ? Math.max(8, at.y - menuHeight) : at.y);
+
+ onMount(() => {
+ menu.querySelector("button")?.focus();
+ });
+
+ function choose(item: MenuItem) {
+ if (item.confirm && confirming !== item) return void (confirming = item);
+ onclose();
+ item.run();
+ }
+
+ function onkeydown(event: KeyboardEvent) {
+ if (event.key === "Escape") return onclose();
+ if (event.key !== "ArrowDown" && event.key !== "ArrowUp") return;
+ event.preventDefault();
+ const buttons = [...menu.querySelectorAll("button")];
+ const current = buttons.indexOf(document.activeElement as HTMLButtonElement);
+ const step = event.key === "ArrowDown" ? 1 : -1;
+ buttons[(current + step + buttons.length) % buttons.length]?.focus();
+ }
+</script>
+
+<svelte:window {onkeydown} />
+
+<div
+ class="backdrop"
+ class:sheet-backdrop={!at.mouse}
+ role="presentation"
+ onclick={onbackdrop}
+ oncontextmenu={(event) => {
+ event.preventDefault();
+ onclose();
+ }}
+ transition:fade={{ duration: 120 }}
+></div>
+
+<div
+ class="menu"
+ class:sheet={!at.mouse}
+ role="menu"
+ aria-label={title}
+ tabindex="-1"
+ bind:this={menu}
+ bind:clientWidth={menuWidth}
+ bind:clientHeight={menuHeight}
+ style:left={at.mouse ? `${left}px` : undefined}
+ style:top={at.mouse ? `${top}px` : undefined}
+ transition:fly={{
+ y: at.mouse ? -6 : 40,
+ duration: 160,
+ }}
+>
+ {#if !at.mouse}
+ <span class="grip" aria-hidden="true"></span>
+ <p class="title">{title}</p>
+ {/if}
+
+ {#each items as item (item.label)}
+ {@const Icon = item.icon}
+ <button
+ role="menuitem"
+ class:danger={item.danger}
+ onclick={() => choose(item)}
+ >
+ <Icon size={18} />
+ {confirming === item ? item.confirm : item.label}
+ </button>
+ {/each}
+</div>
+
+<style>
+ .backdrop {
+ position: fixed;
+ inset: 0;
+ z-index: 30;
+ }
+
+ .sheet-backdrop {
+ background: rgb(0 0 0 / 45%);
+ }
+
+ .menu {
+ position: fixed;
+ z-index: 31;
+ display: flex;
+ flex-direction: column;
+ min-width: 13rem;
+ padding: 0.35rem;
+ border: 1px solid var(--line);
+ border-radius: var(--radius-sm);
+ background: rgb(22 19 26 / 96%);
+ backdrop-filter: blur(14px);
+ box-shadow: 0 10px 30px rgb(0 0 0 / 50%);
+ }
+
+ .menu:focus {
+ outline: none;
+ }
+
+ .sheet {
+ right: 0;
+ bottom: 0;
+ left: 0;
+ padding: 0.5rem 0.5rem calc(0.75rem + env(safe-area-inset-bottom));
+ border-width: 1px 0 0;
+ border-radius: 1.25rem 1.25rem 0 0;
+ }
+
+ .grip {
+ width: 2.5rem;
+ height: 0.25rem;
+ margin: 0.2rem auto 0.5rem;
+ border-radius: 999px;
+ background: var(--line);
+ }
+
+ .title {
+ overflow: hidden;
+ margin: 0 0.75rem 0.4rem;
+ color: var(--muted);
+ font-size: 0.85rem;
+ text-overflow: ellipsis;
+ white-space: nowrap;
+ }
+
+ button {
+ display: flex;
+ align-items: center;
+ gap: 0.75rem;
+ padding: 0.55rem 0.75rem;
+ border: none;
+ border-radius: var(--radius-sm);
+ background: none;
+ color: var(--text);
+ cursor: pointer;
+ font-size: 0.9rem;
+ text-align: left;
+ }
+
+ .sheet button {
+ padding: 0.85rem 1rem;
+ font-size: 1rem;
+ }
+
+ button:hover,
+ button:focus-visible {
+ background: var(--raised-hover);
+ box-shadow: none;
+ }
+
+ button.danger {
+ color: var(--danger);
+ }
+</style>
diff --git a/src/web/components/SwipeRow.svelte b/src/web/components/SwipeRow.svelte
new file mode 100644
index 0000000..cb65826
--- /dev/null
+++ b/src/web/components/SwipeRow.svelte
@@ -0,0 +1,275 @@
+<!-- mailbox/src/web/components/SwipeRow.svelte
+ Copyright (c) 2026 Clove Nytrix Doughmination Twilight
+ Licensed under the DASL-1.0 Licence.
+ See LICENCE.md in the project root for full licence information. -->
+<script lang="ts" module>
+ import type { Component } from "svelte";
+
+ export interface SwipeAction {
+ label: string;
+ icon: Component<{ size?: number }>;
+ tone: "accent" | "danger";
+ // Slides the row away; the list must then drop it.
+ dismiss: boolean;
+ run: () => void;
+ }
+
+ export interface HoldPoint {
+ x: number;
+ y: number;
+ // Mouse gets a popover at the cursor, touch gets a bottom sheet.
+ mouse: boolean;
+ }
+</script>
+
+<script lang="ts">
+ import type { Snippet } from "svelte";
+
+ let {
+ swipeRight,
+ swipeLeft,
+ onhold,
+ children,
+ }: {
+ swipeRight?: SwipeAction;
+ swipeLeft?: SwipeAction;
+ onhold: (point: HoldPoint) => void;
+ children: Snippet;
+ } = $props();
+
+ const holdMs = 450;
+ const slopPx = 10;
+ const commitFraction = 0.35;
+
+ let row: HTMLDivElement;
+ let offset = $state(0);
+ let dragging = $state(false);
+ let leaving = $state(false);
+ let armed = $state(false);
+
+ let gesture: {
+ pointerId: number;
+ startX: number;
+ startY: number;
+ axis: "x" | "y" | null;
+ held: boolean;
+ timer: ReturnType<typeof setTimeout>;
+ } | null = null;
+
+ // A drag or hold ends in a click on the link; this swallows it.
+ let swallowClick = false;
+
+ const revealed = $derived(offset > 0 ? swipeRight : offset < 0 ? swipeLeft : undefined);
+
+ function threshold() {
+ return row.clientWidth * commitFraction;
+ }
+
+ function onpointerdown(event: PointerEvent) {
+ swallowClick = false;
+ if (event.pointerType === "mouse" || leaving) return;
+ const startX = event.clientX;
+ const startY = event.clientY;
+ gesture = {
+ pointerId: event.pointerId,
+ startX,
+ startY,
+ axis: null,
+ held: false,
+ timer: setTimeout(() => {
+ if (!gesture) return;
+ gesture.held = true;
+ navigator.vibrate?.(12);
+ onhold({
+ x: startX,
+ y: startY,
+ mouse: false,
+ });
+ }, holdMs),
+ };
+ }
+
+ function onpointermove(event: PointerEvent) {
+ if (!gesture || event.pointerId !== gesture.pointerId || gesture.held) return;
+ const deltaX = event.clientX - gesture.startX;
+ const deltaY = event.clientY - gesture.startY;
+
+ if (!gesture.axis) {
+ if (Math.hypot(deltaX, deltaY) < slopPx) return;
+ clearTimeout(gesture.timer);
+ gesture.axis = Math.abs(deltaX) > Math.abs(deltaY) ? "x" : "y";
+ if (gesture.axis === "x") {
+ row.setPointerCapture(event.pointerId);
+ dragging = true;
+ }
+ }
+ if (gesture.axis !== "x") return;
+
+ // Rubber-band when there's nothing to do that way.
+ const action = deltaX > 0 ? swipeRight : swipeLeft;
+ offset = action ? deltaX : deltaX * 0.15;
+
+ const nowArmed = !!action && Math.abs(offset) > threshold();
+ if (nowArmed && !armed) navigator.vibrate?.(8);
+ armed = nowArmed;
+ }
+
+ function onpointerup(event: PointerEvent) {
+ if (!gesture || event.pointerId !== gesture.pointerId) return;
+ clearTimeout(gesture.timer);
+ const { axis, held } = gesture;
+ gesture = null;
+ dragging = false;
+ if (held || axis === "x") swallowClick = true;
+ if (axis !== "x") return;
+
+ const action = revealed;
+ const commit = armed && action;
+ armed = false;
+ if (!commit) return void (offset = 0);
+
+ if (action.dismiss) {
+ leaving = true;
+ offset = Math.sign(offset) * row.clientWidth;
+ setTimeout(action.run, 180);
+ } else {
+ offset = 0;
+ action.run();
+ }
+ }
+
+ function onpointercancel() {
+ if (gesture) clearTimeout(gesture.timer);
+ gesture = null;
+ dragging = false;
+ armed = false;
+ if (!leaving) offset = 0;
+ }
+
+ // Desktop right-click, the menu key, and Android's own long-press menu.
+ function oncontextmenu(event: MouseEvent) {
+ event.preventDefault();
+ if (gesture || swallowClick) return;
+ const fromKeyboard = event.clientX === 0 && event.clientY === 0;
+ const box = row.getBoundingClientRect();
+ onhold({
+ x: fromKeyboard ? box.left + 24 : event.clientX,
+ y: fromKeyboard ? box.bottom : event.clientY,
+ mouse: true,
+ });
+ }
+
+ function onclickcapture(event: MouseEvent) {
+ if (!swallowClick) return;
+ swallowClick = false;
+ event.preventDefault();
+ event.stopPropagation();
+ }
+</script>
+
+<div
+ class="swipe"
+ role="presentation"
+ bind:this={row}
+ {onpointerdown}
+ {onpointermove}
+ {onpointerup}
+ {onpointercancel}
+ {oncontextmenu}
+ {onclickcapture}
+>
+ {#if revealed}
+ {@const Icon = revealed.icon}
+ <div
+ class="under {revealed.tone}"
+ class:right={offset > 0}
+ class:armed
+ aria-hidden="true"
+ >
+ <Icon size={20} />
+ <span>{revealed.label}</span>
+ </div>
+ {/if}
+
+ <div
+ class="face"
+ class:dragging
+ class:moved={offset !== 0}
+ style:transform={offset ? `translateX(${offset}px)` : undefined}
+ >
+ {@render children()}
+ </div>
+</div>
+
+<style>
+ .swipe {
+ position: relative;
+ overflow: hidden;
+ touch-action: pan-y;
+ -webkit-touch-callout: none;
+ user-select: none;
+ }
+
+ .face {
+ position: relative;
+ transition: transform 0.18s ease-out;
+ }
+
+ .face.dragging {
+ transition: none;
+ }
+
+ /* Opaque only while moved, so the wallpaper shows through at rest. */
+ .face.moved {
+ background: var(--bg);
+ }
+
+ .under {
+ position: absolute;
+ inset: 0;
+ display: flex;
+ flex-direction: row-reverse;
+ align-items: center;
+ gap: 0.5rem;
+ padding: 0 1.4rem;
+ color: #fff;
+ font-size: 0.85rem;
+ font-weight: 600;
+ transition: filter 0.15s ease;
+ }
+
+ .under.right {
+ flex-direction: row;
+ }
+
+ .under.accent {
+ background: rgb(235 69 158 / 55%);
+ }
+
+ .under.danger {
+ background: rgb(255 92 122 / 55%);
+ }
+
+ .under.armed.accent {
+ background: var(--accent);
+ }
+
+ .under.armed.danger {
+ background: var(--danger);
+ }
+
+ .under :global(svg) {
+ transition: transform 0.15s ease;
+ }
+
+ .under.armed :global(svg) {
+ transform: scale(1.25);
+ }
+
+ /* Phones: rows are rounded cards, so the colour behind is too. */
+ @media (max-width: 800px) {
+ .swipe {
+ border-radius: var(--radius);
+ }
+ }
+</style>
diff --git a/src/web/components/ThreadList.svelte b/src/web/components/ThreadList.svelte
index 1024131..b7775be 100644
--- a/src/web/components/ThreadList.svelte
+++ b/src/web/components/ThreadList.svelte
@@ -3,12 +3,22 @@
Licensed under the DASL-1.0 Licence.
See LICENCE.md in the project root for full licence information. -->
<script lang="ts">
+ import ArchiveRestore from "@lucide/svelte/icons/archive-restore";
+ import CircleX from "@lucide/svelte/icons/circle-x";
+ import Eye from "@lucide/svelte/icons/eye";
+ import Mail from "@lucide/svelte/icons/mail";
+ import MailOpen from "@lucide/svelte/icons/mail-open";
import Paperclip from "@lucide/svelte/icons/paperclip";
+ import Trash2 from "@lucide/svelte/icons/trash-2";
+ import { flip } from "svelte/animate";
+ import { fly, slide } from "svelte/transition";
import type { ListFolder, ThreadSummary } from "../../shared/types";
import { api } from "../lib/api";
import { displayName, fmtTime } from "../lib/format";
import { router } from "../lib/router.svelte";
import { changed, session } from "../lib/state.svelte";
+ import ActionMenu, { type MenuItem } from "./ActionMenu.svelte";
+ import SwipeRow, { type HoldPoint, type SwipeAction } from "./SwipeRow.svelte";
let { folder, selected }: { folder: ListFolder; selected: string | null } = $props();
@@ -65,6 +75,163 @@
}
}
+ // Rows taken out by a swipe or the menu collapse; a reload just swaps them.
+ const collapsing = new Set<string>();
+
+ let menu = $state<{
+ thread: ThreadSummary;
+ at: HoldPoint;
+ } | null>(null);
+
+ let undo = $state<{
+ thread: ThreadSummary;
+ timer: ReturnType<typeof setTimeout>;
+ } | null>(null);
+
+ function fail(e: unknown) {
+ error = (e as Error).message;
+ changed();
+ }
+
+ async function toggleRead(thread: ThreadSummary) {
+ const read = thread.unread > 0;
+ thread.unread = read ? 0 : 1;
+ try {
+ changed((await api.markThread(thread.id, read)).unread);
+ } catch (e) {
+ fail(e);
+ }
+ }
+
+ function takeOut(thread: ThreadSummary) {
+ collapsing.add(thread.id);
+ items = items.filter((item) => item.id !== thread.id);
+ if (selected === thread.id) router.thread(null);
+ }
+
+ async function moveToBin(thread: ThreadSummary) {
+ takeOut(thread);
+ try {
+ await api.deleteThread(thread.id);
+ changed();
+ if (undo) clearTimeout(undo.timer);
+ undo = {
+ thread,
+ timer: setTimeout(() => (undo = null), 5000),
+ };
+ } catch (e) {
+ fail(e);
+ }
+ }
+
+ async function undoBin() {
+ if (!undo) return;
+ const { thread, timer } = undo;
+ clearTimeout(timer);
+ undo = null;
+ try {
+ await api.restoreThread(thread.id);
+ changed();
+ } catch (e) {
+ fail(e);
+ }
+ }
+
+ async function restore(thread: ThreadSummary) {
+ takeOut(thread);
+ try {
+ await api.restoreThread(thread.id);
+ changed();
+ } catch (e) {
+ fail(e);
+ }
+ }
+
+ async function deleteForever(thread: ThreadSummary) {
+ takeOut(thread);
+ try {
+ await api.deleteThread(thread.id, true);
+ changed();
+ } catch (e) {
+ fail(e);
+ }
+ }
+
+ function swipeRight(thread: ThreadSummary): SwipeAction | undefined {
+ if (folder === "bin") {
+ return {
+ label: "Restore",
+ icon: ArchiveRestore,
+ tone: "accent",
+ dismiss: true,
+ run: () => restore(thread),
+ };
+ }
+ if (folder !== "inbox") return undefined;
+ return {
+ label: thread.unread ? "Read" : "Unread",
+ icon: thread.unread ? MailOpen : Mail,
+ tone: "accent",
+ dismiss: false,
+ run: () => toggleRead(thread),
+ };
+ }
+
+ function swipeLeft(thread: ThreadSummary): SwipeAction | undefined {
+ if (folder === "bin") return undefined;
+ return {
+ label: "Bin",
+ icon: Trash2,
+ tone: "danger",
+ dismiss: true,
+ run: () => moveToBin(thread),
+ };
+ }
+
+ function menuItems(thread: ThreadSummary): MenuItem[] {
+ const open: MenuItem = {
+ label: "Open",
+ icon: Eye,
+ run: () => router.thread(thread.id),
+ };
+ if (folder === "bin") {
+ return [
+ open,
+ {
+ label: "Restore",
+ icon: ArchiveRestore,
+ run: () => restore(thread),
+ },
+ {
+ label: "Delete forever",
+ icon: CircleX,
+ danger: true,
+ confirm: "Tap again to delete forever",
+ run: () => deleteForever(thread),
+ },
+ ];
+ }
+ const readToggle: MenuItem[] = folder === "inbox"
+ ? [
+ {
+ label: thread.unread ? "Mark as read" : "Mark as unread",
+ icon: thread.unread ? MailOpen : Mail,
+ run: () => toggleRead(thread),
+ },
+ ]
+ : [];
+ return [
+ open,
+ ...readToggle,
+ {
+ label: "Move to Bin",
+ icon: Trash2,
+ danger: true,
+ run: () => moveToBin(thread),
+ },
+ ];
+ }
+
function who(t: ThreadSummary) {
// The Bin mixes folders; whoever it's from reads best there.
return folder === "inbox" || folder === "bin" ? displayName(t.from) : `To: ${t.to.map(displayName).join(", ") || "(nobody yet)"}`;
@@ -99,23 +266,33 @@
<ul>
{#each items as t (t.id)}
{@const a = avatar(t)}
- <li>
- <a
- href={router.href(`/${folder}/${t.id}${router.search}`)}
- class="row"
- class:selected={selected === t.id}
- class:unread={t.unread > 0}
+ <li
+ animate:flip={{ duration: 180 }}
+ out:slide={{ duration: collapsing.delete(t.id) ? 180 : 0 }}
+ >
+ <SwipeRow
+ swipeRight={swipeRight(t)}
+ swipeLeft={swipeLeft(t)}
+ onhold={(at) => (menu = { thread: t, at })}
>
- <span class="avatar" style:--hue={a.hue} aria-hidden="true">{a.letter}</span>
- <div class="top">
- <span class="who">{who(t)}</span>
- {#if t.count > 1}<span class="n">{t.count}</span>{/if}
- {#if t.hasAttachments}<Paperclip size={12} />{/if}
- <time>{fmtTime(t.lastAt)}</time>
- </div>
- <div class="subject">{t.subject || "(no subject)"}</div>
- <div class="snippet">{t.snippet}</div>
- </a>
+ <a
+ href={router.href(`/${folder}/${t.id}${router.search}`)}
+ class="row"
+ class:selected={selected === t.id}
+ class:unread={t.unread > 0}
+ draggable="false"
+ >
+ <span class="avatar" style:--hue={a.hue} aria-hidden="true">{a.letter}</span>
+ <div class="top">
+ <span class="who">{who(t)}</span>
+ {#if t.count > 1}<span class="n">{t.count}</span>{/if}
+ {#if t.hasAttachments}<Paperclip size={12} />{/if}
+ <time>{fmtTime(t.lastAt)}</time>
+ </div>
+ <div class="subject">{t.subject || "(no subject)"}</div>
+ <div class="snippet">{t.snippet}</div>
+ </a>
+ </SwipeRow>
</li>
{/each}
</ul>
@@ -125,6 +302,22 @@
{/if}
</section>
+{#if menu}
+ <ActionMenu
+ title={menu.thread.subject || "(no subject)"}
+ items={menuItems(menu.thread)}
+ at={menu.at}
+ onclose={() => (menu = null)}
+ />
+{/if}
+
+{#if undo}
+ <div class="toast" role="status" transition:fly={{ y: 16, duration: 160 }}>
+ <span>Moved to Bin</span>
+ <button class="undo" onclick={undoBin}>Undo</button>
+ </div>
+{/if}
+
<style>
.list {
overflow-y: auto;
@@ -247,11 +440,14 @@
padding-bottom: 6rem;
}
+ li {
+ margin: 0 0.5rem;
+ }
+
.row {
display: grid;
grid-template-columns: 2.5rem minmax(0, 1fr);
column-gap: 0.85rem;
- margin: 0 0.5rem;
padding: 0.65rem 0.6rem;
border-bottom: none;
border-radius: var(--radius);
@@ -301,6 +497,13 @@
font-size: 0.85rem;
}
+ .toast {
+ right: auto;
+ bottom: calc(5.5rem + env(safe-area-inset-bottom));
+ left: 0.75rem;
+ transform: none;
+ }
+
.bin-bar {
margin: 0 0.75rem 0.5rem;
border: 1px solid var(--line);
@@ -308,6 +511,37 @@
}
}
+ .toast {
+ position: fixed;
+ bottom: 1.25rem;
+ left: 50%;
+ z-index: 25;
+ display: flex;
+ align-items: center;
+ gap: 1rem;
+ padding: 0.5rem 0.5rem 0.5rem 1rem;
+ transform: translateX(-50%);
+ border: 1px solid var(--line);
+ border-radius: 999px;
+ background: rgb(22 19 26 / 96%);
+ box-shadow: 0 6px 20px rgb(0 0 0 / 45%);
+ font-size: 0.9rem;
+ }
+
+ .undo {
+ padding: 0.35rem 0.85rem;
+ border: none;
+ border-radius: 999px;
+ background: none;
+ color: var(--accent);
+ cursor: pointer;
+ font-weight: 700;
+ }
+
+ .undo:hover {
+ background: var(--accent-dim);
+ }
+
.bin-bar {
display: flex;
align-items: center;
diff --git a/src/web/lib/splash.ts b/src/web/lib/splash.ts
new file mode 100644
index 0000000..5cf36cd
--- /dev/null
+++ b/src/web/lib/splash.ts
@@ -0,0 +1,29 @@
+/* mailbox/src/web/lib/splash.ts
+ * Copyright (c) 2026 Clove Nytrix Doughmination Twilight
+ * Licensed under the DASL-1.0 Licence.
+ * See LICENCE.md in the project root for full licence information.
+ */
+
+// Long enough for the intro in index.html to play through once.
+const introMs = 1100;
+
+// The installed app (PWA or the Android TWA) always plays the intro.
+const installed =
+ matchMedia("(display-mode: standalone)").matches ||
+ document.referrer.startsWith("android-app://");
+
+let hidden = false;
+
+/** Fades the splash out once the app is ready. In a browser tab, right away. */
+export function hideSplash() {
+ if (hidden) return;
+ hidden = true;
+ const splash = document.getElementById("splash");
+ if (!splash) return;
+
+ const wait = installed ? Math.max(0, introMs - performance.now()) : 0;
+ setTimeout(() => {
+ splash.classList.add("out");
+ setTimeout(() => splash.remove(), 600);
+ }, wait);
+}