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
This commit is contained in:
parent
f67add3660
commit
8fbbb4933e
53 changed files with 4558 additions and 37 deletions
25
apps/web/src/main.ts
Normal file
25
apps/web/src/main.ts
Normal file
|
|
@ -0,0 +1,25 @@
|
|||
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')! });
|
||||
Loading…
Add table
Add a link
Reference in a new issue