feat(ui): context-sensitive z key (focus mode)

- Nothing selected: z toggles zen (hide both panels)
- Item selected: z expands peek to full width (focus mode)
- z again or Esc exits focus mode and deselects
- j/k still cycle items while in focus mode
This commit is contained in:
2026-05-16 20:46:23 -04:00
parent 0316076bf8
commit ff190e395b
2 changed files with 28 additions and 0 deletions
+23
View File
@@ -1451,6 +1451,14 @@
return;
}
if (ev.key === 'Escape' && $('main').classList.contains('focus-peek')) {
exitFocusPeek();
state.selectedIndex = -1;
renderEntityList();
renderDetailPane();
return;
}
const sel = state.entities[state.selectedIndex];
switch (ev.key) {
@@ -1534,6 +1542,17 @@
function toggleZen() {
const m = $('main');
if (m.classList.contains('focus-peek')) {
exitFocusPeek();
return;
}
if (state.selectedIndex >= 0) {
m.classList.add('focus-peek');
return;
}
const isZen = m.classList.contains('hide-rail') && m.classList.contains('hide-peek');
if (isZen) {
m.classList.remove('hide-rail', 'hide-peek');
@@ -1546,6 +1565,10 @@
}
}
function exitFocusPeek() {
$('main').classList.remove('focus-peek');
}
(function restorePanels() {
const m = $('main');
if (localStorage.getItem('nib:hide-rail')) m.classList.add('hide-rail');