Files
simtrace-analyser/frontend/sw.js
T
catarrh 119b1cd54a APDU list: the selected row gets a blue tint in dark mode too
- the selection used --bg-input (#334155, a neutral slate) in dark mode, which
  sat right next to the GET RESPONSE pair rows' grey tint
  (--pair-row = rgba(148,163,184,0.12)) and was easy to mistake for them; the
  light theme already had its own blue (#dbeafe) through a
  [data-theme="light"] override
- both themes now set a --selected-bg variable (dark #1e3a8a = blue-900 — the
  palette counterpart of the light blue-100 — light #dbeafe unchanged) and a
  single `.apdu-entry.selected` rule uses it, so the override is gone
- Node test pins the variable in both themes and the single rule
- SW cache simtrace-analyser-v90 (cosmetic, no version bump)
2026-10-18 11:16:56 +03:00

49 lines
1.4 KiB
JavaScript

const CACHE = 'simtrace-analyser-v90';
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))
);
});