web-player: unify primitive link/button rendering, add onEscape action and self-contained AccountMenu

This commit is contained in:
2026-09-24 05:27:25 +02:00
parent 5cda7cb4c1
commit 8cb9386447
12 changed files with 103 additions and 128 deletions
+17
View File
@@ -0,0 +1,17 @@
import type { Action } from 'svelte/action';
export const onEscape: Action<HTMLElement, (() => void) | undefined> = (_node, handler) => {
function onKeydown(event: KeyboardEvent) {
if (event.key === 'Escape') handler?.();
}
window.addEventListener('keydown', onKeydown);
return {
update(next) {
handler = next;
},
destroy() {
window.removeEventListener('keydown', onKeydown);
}
};
};