feat(workspace): focus mode — recession, hover reveal, soft caret centering (#87)

Map #21 build child. Toggle via View menu / ⌘⇧F; panes and toolbar
recede, overlay hover reveal (left: rail+library, right: mentor),
soft caret centering while typing, loud save failure, ⌘S armed in
focus. Full suite green; calibration gate #88 judges calm.
This commit is contained in:
AlexKucera committed 2026-10-09 11:11:36 +02:00
1 parent 99aa3d2faf
commit b0ab800d3d
12 files changed
+550 -98

No files matched your search

+25
View File
@@ -28,6 +28,11 @@ final class AppGateState {
/// asked via Edit ▸ Check Spelling While Typing. Per-launch only, no
/// persistence; markdown on disk already carries the spelling.
var spellChecking = false
/// #21 (map #21): focus mode — transient like reading (#68), per-launch
/// only, no persistence; a fresh open lands unfocused. Recesses the
/// rail/library/mentor and the editor toolbar; overlay panes return on
/// edge hover.
var isFocused = false
/// #17: the Museion Home — repoint-only (ADR-0004). Defaults to
/// `~/Documents/Museion`; UserDefaults is the persistence floor: a Home is
/// a plain folder, nothing app-owned to put in a database. Non-file URLs
@@ -90,6 +95,10 @@ struct MuseionApp: App {
NotificationCenter.default.post(name: .toggleReadingMode, object: nil)
}
.keyboardShortcut("r", modifiers: .command)
// #21: focus mode — beside reading, same posture (system View
// menu + shortcut). Transient like reading: no persistence, no
// Esc exit (rejected at charting) — the toggle is the only way.
FocusModeToggle(gate: gate)
}
// #50: reveal the snapshots folder in Finder (restore = manual
// copy-back, documented in the bundled help doc).
@@ -123,6 +132,22 @@ private struct EditSpellingToggle: View {
}
}
/// #21: the focus-mode toggle — plain property (commands views don't inherit
/// the window environment; observation tracking still invalidates the item).
/// Disabled with nothing open (no session, no draft) — a no-op guard.
private struct FocusModeToggle: View {
let gate: AppGateState
var body: some View {
// Entry guard: nothing open = nothing to focus on. Exit stays armed
// even then (trashing the open post while focused must not trap).
let canFocus = gate.isFocused || gate.posts.session != nil || gate.posts.draft != nil
Button("Toggle Focus Mode") { gate.isFocused.toggle() }
.keyboardShortcut("f", modifiers: [.command, .shift])
.disabled(!canFocus)
}
}
/// #50: reveals `~/Library/Application Support/Museion/Backups` in Finder —
/// restore is manual Finder copy-back in v1 (help doc describes it).
private struct OpenBackupFolderButton: View {