oweme/apps/web/src/components/Sheet.svelte
agent 8fbbb4933e Add Svelte web client and service worker
Mobile-first PWA: groups via key-in-fragment links, encrypted outbox and
sync over SSE, all split modes, currencies with ECB rate prefill, photos,
comments, history and rewind, stats, recurring expenses, CSV and backup,
EN/CS, dark/light theme, Web Push decrypted in the service worker.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_013FYo6JSV1fDU1fm3LU77iF
2026-10-09 19:59:16 +00:00

32 lines
976 B
Svelte

<script lang="ts">
// Modal sheet: full screen on phones, a centered dialog on desktop.
// Uses <dialog> for focus trapping and Escape handling.
import type { Snippet } from 'svelte';
import Icon from './Icon.svelte';
import { t } from '../lib/settings.svelte.ts';
let { title, onclose, children, actions }: { title: string; onclose: () => void; children: Snippet; actions?: Snippet } = $props();
let dialog: HTMLDialogElement;
$effect(() => {
dialog.showModal();
return () => dialog.close();
});
</script>
<dialog
class="sheet"
bind:this={dialog}
aria-label={title}
oncancel={(e) => { e.preventDefault(); onclose(); }}
onclick={(e) => { if (e.target === dialog) onclose(); }}
>
<header class="topbar">
<button class="icon-btn" onclick={onclose} aria-label={t('close')}><Icon name="close" /></button>
<h1>{title}</h1>
{@render actions?.()}
</header>
<div class="sheet-body">
{@render children()}
</div>
</dialog>