perf: virtual windowing, markdown memoisation, and search debounce

- Terminal: virtual windowing renders max 150 lines, loads 50 older on
  scroll-up with scroll position compensation; auto-advances window
  forward during auto-scroll so old DOM nodes are unloaded continuously
- Markdown: two-stage derived rendering separates expensive parse step
  (marked + hljs + spoilers, runs on content change) from cheap search
  highlight step (runs on query change only)
- Achievements: fix double Object.keys() call in derived store
- Terminal: 150ms debounce on search query to reduce redundant updates
- Tests: add Markdown.test.ts for processSpoilers and highlightSearchMatches;
  extend Terminal.test.ts with virtual windowing helper coverage
This commit is contained in:
2026-03-06 18:03:42 -08:00
committed by Naomi Carrigan
parent 55d65fa244
commit 46339a040a
5 changed files with 349 additions and 17 deletions
+8 -5
View File
@@ -1471,11 +1471,14 @@ export const achievementsByRarity = derived(achievementsStore, ($store) => {
return byRarity;
});
export const achievementProgress = derived(achievementsStore, ($store) => ({
unlocked: $store.totalUnlocked,
total: Object.keys($store.achievements).length,
percentage: Math.round(($store.totalUnlocked / Object.keys($store.achievements).length) * 100),
}));
export const achievementProgress = derived(achievementsStore, ($store) => {
const total = Object.keys($store.achievements).length;
return {
unlocked: $store.totalUnlocked,
total,
percentage: Math.round(($store.totalUnlocked / total) * 100),
};
});
// Initialize achievement listener
export async function initAchievementsListener() {