pwa / offline mode

- @vite-pwa/sveltekit: workbox precache (incl. pdfjs worker), generated manifest, prompt-style updates via PwaUpdatePrompt toast
- prerendered routes for offline navigation, PWA icons, theme-color + apple-touch-icon
- pwa offline/update e2e suite (pnpm test:pwa, playwright.pwa.config.ts)
- datenschutz: offline/install section; prettier cleanup of shadcn components
This commit is contained in:
rehlert committed 2026-10-04 12:55:46 +02:00
1 parent b7969b4c9e
commit f09384d2e6
37 files changed
+4130 -273

No files matched your search

+46
View File
@@ -1,5 +1,6 @@
import tailwindcss from '@tailwindcss/vite';
import adapter from '@sveltejs/adapter-node';
import { SvelteKitPWA } from '@vite-pwa/sveltekit';
import { sveltekit } from '@sveltejs/kit/vite';
import { defineConfig } from 'vite';
@@ -14,6 +15,51 @@ export default defineConfig({
},
adapter: adapter()
}),
SvelteKitPWA({
registerType: 'prompt',
injectRegister: false,
manifest: {
name: 'beA-Edit',
short_name: 'beA-Edit',
description:
'PDF-Werkzeuge für die beA-Kanzlei – PDFs werden vollständig lokal im Browser verarbeitet.',
display: 'standalone',
orientation: 'any',
lang: 'de',
dir: 'ltr',
start_url: '/',
scope: '/',
categories: ['productivity', 'utilities'],
background_color: '#eef4f6',
theme_color: '#122f62',
icons: [
{ src: '/icons/icon-192.png', sizes: '192x192', type: 'image/png' },
{ src: '/icons/icon-512.png', sizes: '512x512', type: 'image/png' },
{
src: '/icons/icon-maskable-512.png',
sizes: '512x512',
type: 'image/png',
purpose: 'maskable'
}
]
},
workbox: {
// The plugin prepends `client/` and `prerendered/` paths itself; extending the
// default list only adds the local font files and the pdfjs worker chunk (`*.mjs`,
// 2.1 MB, required to render PDFs offline). `client/Nunito/**` is the unused font
// drop from `static/` and would add 2.6 MB to the precache.
globPatterns: ['client/**/*.{js,mjs,css,ico,png,svg,webp,webmanifest,woff2,ttf}'],
globIgnores: ['client/Nunito/**'],
// Prerendered route documents (see src/routes/+layout.ts) are precached, so an
// offline navigation to any visited route — and any unknown path via the
// fallback — is served from the cache.
navigateFallback: '/',
maximumFileSizeToCacheInBytes: 8 * 1024 * 1024
},
// The service worker is only produced for production builds; `pnpm dev` never
// registers one, which keeps development caches clean.
devOptions: { enabled: false }
})
]
});