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
25 lines
950 B
TypeScript
25 lines
950 B
TypeScript
import { mount } from 'svelte';
|
|
import App from './App.svelte';
|
|
import './app.css';
|
|
import { kvSet } from './lib/idb.ts';
|
|
import { settings } from './lib/settings.svelte.ts';
|
|
import { ui } from './lib/ui.svelte.ts';
|
|
|
|
settings.applyTheme();
|
|
document.documentElement.lang = settings.lang;
|
|
void kvSet('lang', settings.lang).catch(() => {});
|
|
matchMedia('(prefers-color-scheme: dark)').addEventListener('change', () => settings.applyTheme());
|
|
|
|
if ('serviceWorker' in navigator && import.meta.env.PROD) {
|
|
void navigator.serviceWorker.register('/sw.js').then((reg) => {
|
|
reg.addEventListener('updatefound', () => {
|
|
const sw = reg.installing;
|
|
sw?.addEventListener('statechange', () => {
|
|
// A new version installed while an old one controls the page.
|
|
if (sw.state === 'installed' && navigator.serviceWorker.controller) ui.updateReady = true;
|
|
});
|
|
});
|
|
});
|
|
}
|
|
|
|
mount(App, { target: document.getElementById('app')! });
|