Files
simtrace-analyser/frontend/sw.js
T
catarrh 4a03f83459 APDU list + detail: hover and the detail header follow the theme tints
- the detail header used --bg-input in dark mode (plus a light-only #dbeafe
  override), so it only matched the list selection in the light theme; it now
  uses var(--selected-bg) — the same variable as the selected row — so the two
  are in sync in both themes (light unchanged)
- .apdu-entry:hover used --bg-panel (a grey in the same family as the GET
  RESPONSE pair rows); both themes now set --hover-bg — the accent at 16%
  (dark) / 10% (light), a translucent tint that stacks with whatever the row's
  background is — and a single hover rule uses it: hovering tints the row
  blue, lighter than the selection and a different hue from the pair rows.
  The rules stay ordered .apdu-pair → :hover → .selected, so hovering the
  selected row keeps its selection colour
- Node tests pin the hover variable per theme, the hover rule (and that the
  old grey rule is gone) and the detail header's variable; 540 Python +
  80 Node tests
- SW cache simtrace-analyser-v91 (cosmetic, no version bump)
2026-10-18 11:38:02 +03:00

49 lines
1.4 KiB
JavaScript

const CACHE = 'simtrace-analyser-v91';
const PRECACHE = [
'index.html',
'manifest.json',
'icon-192.png',
'icon-512.png',
'favicon.png',
'sim-analyser.svg',
'sim-analyser-light.svg',
];
self.addEventListener('install', e => {
self.skipWaiting();
e.waitUntil(
caches.open(CACHE)
.then(cache => cache.addAll(PRECACHE))
.then(() => console.log('SW: precache done'))
.catch(err => console.error('SW: precache failed', err))
);
});
self.addEventListener('activate', e => {
e.waitUntil(
caches.keys()
.then(keys => Promise.all(
keys.filter(k => k !== CACHE).map(k => caches.delete(k))
))
.then(() => self.clients.claim())
.then(() => console.log('SW: activated, controlling clients'))
);
});
self.addEventListener('fetch', e => {
// Network-first: the local server is always up, so always serve fresh
// content and fall back to cache only when offline.
if (!e.request.url.startsWith('http')) return;
if (e.request.method !== 'GET') return;
e.respondWith(
fetch(e.request)
.then(r => {
const clone = r.clone();
caches.open(CACHE).then(c => c.put(e.request, clone)).catch(() => {});
return r;
})
.catch(() => caches.match(e.request))
);
});