Build: land focus mode (pane recession, hover reveal, soft caret centering) #87

Closed
opened 2026-10-09 10:15:21 +02:00 by AlexKucera · 4 comments
Owner

Part of #21 (map: Wayfinder map: M1 focus mode & typographic calm).

(Asset upload failed server-side at charting — spec baked into this body.)

What to build

The execution child of the map "Wayfinder map: M1 focus mode & typographic calm" (#21). Focus mode per the charting contract: panes and editor toolbar recede, centered measure on the workspace background, hover-summoned overlay panes, soft caret centering. The build IS the prototype — the calibration gate judges calm.

Acceptance criteria

  • View ▸ Toggle Focus Mode (system View menu, beside Toggle Reading Mode per #84) + ⌘⇧F toggles; no Esc exit; transient — fresh open lands unfocused
  • Focus hides rail, library, mentor, and the editor toolbar row; the surface + centered measure remains on the workspace background; native title bar untouched
  • Left-edge hover slides rail+library in as overlay (the text never moves); right-edge hover slides the mentor in; both slide out on hover end; panes hidden by width collapse are not summoned
  • Soft caret centering while typing: the caret stays within a comfort band around the vertical center via smooth scroll — no jump when it reaches the bottom; scrollback and drag-selection never fight the reader (recenter only on typing)
  • Focus × reading orthogonal (⌘R works in focus, ⌘⇧F works while reading)
  • Save failure loud in focus: the full SaveStateDot + "Save failed" text is visible; the #67 conflict alert is unchanged; autosave runs underneath
  • The toggle is disabled when no post is open and no draft exists
  • No regression to #17's width-driven pane collapse (old AC2 verify)
  • swiftformat + swiftlint clean; build + tests green

[Generated by AI]

Part of #21 (map: Wayfinder map: M1 focus mode & typographic calm). *(Asset upload failed server-side at charting — spec baked into this body.)* ## What to build The execution child of the map "Wayfinder map: M1 focus mode & typographic calm" (#21). Focus mode per the charting contract: panes and editor toolbar recede, centered measure on the workspace background, hover-summoned overlay panes, soft caret centering. The build IS the prototype — the calibration gate judges calm. ## Acceptance criteria - [ ] View ▸ Toggle Focus Mode (system View menu, beside Toggle Reading Mode per #84) + ⌘⇧F toggles; no Esc exit; transient — fresh open lands unfocused - [ ] Focus hides rail, library, mentor, and the editor toolbar row; the surface + centered measure remains on the workspace background; native title bar untouched - [ ] Left-edge hover slides rail+library in as overlay (the text never moves); right-edge hover slides the mentor in; both slide out on hover end; panes hidden by width collapse are not summoned - [ ] Soft caret centering while typing: the caret stays within a comfort band around the vertical center via smooth scroll — no jump when it reaches the bottom; scrollback and drag-selection never fight the reader (recenter only on typing) - [ ] Focus × reading orthogonal (⌘R works in focus, ⌘⇧F works while reading) - [ ] Save failure loud in focus: the full SaveStateDot + "Save failed" text is visible; the #67 conflict alert is unchanged; autosave runs underneath - [ ] The toggle is disabled when no post is open and no draft exists - [ ] No regression to #17's width-driven pane collapse (old AC2 verify) - [ ] swiftformat + swiftlint clean; build + tests green [Generated by AI]
AlexKucera added the wayfinder:task label 2026-10-09 10:15:21 +02:00
AlexKucera self-assigned this 2026-10-09 10:15:21 +02:00
AlexKucera added a new dependency 2026-10-09 10:15:35 +02:00
AlexKucera removed their assignment 2026-10-09 10:18:08 +02:00
AlexKucera added the ready-for-agent label 2026-10-09 10:19:01 +02:00
AlexKucera self-assigned this 2026-10-09 10:23:34 +02:00
Author
Owner

Resolution

Landed on wayfinder/87-focus-mode @ b0ab800 (local, unpushed — push awaits authorization; a local branch in the shared checkout serves the calibration session on this machine).

What landed

  • Toggle: View ▸ Toggle Focus Mode (system View menu, beside Toggle Reading Mode per #84) + ⌘⇧F. Transient like reading (#68): fresh open lands unfocused, no persistence. No Esc exit (charting verdict). Disabled when no post open and no draft — exit stays armed while focused, so trashing the open post from the library overlay can't trap.
  • Recession: rail + library + mentor columns and the editor toolbar row recede; the surface + centered measure on the workspace background is all that remains. Native title bar untouched. Editor ground swaps surface → workspace background (DesignTokens.workspaceBackground NSColor twin — SwiftUI Color can't cross into NSTextView).
  • Hover reveal, overlay not push: FocusChrome.swift — left-edge hover slides rail+library in (library only when window ≥1100px — #17's width collapse is NOT overridden, per the map contract); right-edge hover slides the mentor in. Panels float OVER the measure — the measure never moves. 14pt edge sensor strips (HoverZone, tracking-area, hitTest → nil — hover never steals clicks); 140 ms hide grace covers the zone→panel transit. easeOut 0.2 s in / easeIn 0.15 s out.
  • Soft caret centering (CaretCentering): ±60pt comfort band around the visible center; fires from textDidChange ONLY — scrollback and drag-selection are never fought; animated scroll (0.18 s); document clamp parks at the bottom and follows line by line — no jump at the document end. Band math pinned by FocusModeTests.swift (5 tests).
  • Save honesty in focus: failure is LOUD — the full dot + "Save failed" widget reappears as a floating top overlay when saveState == .failed; #67 conflict alert unchanged; autosave runs underneath. ⌘S moved to the body level so it stays armed with the toolbar hidden (drafts have no autosave — ⌘S is their only save path).
  • Focus × reading orthogonal: independent state axes; ⌘R works in focus, ⌘⇧F works while reading.
  • PostsLibraryColumn extracted from PostsPaneView — one library implementation for the unfocused layout and the focus overlay (rename sheet + context menu travel with it).

Verification

  • Build green, full test suite green (FocusModeTests 5/5; UI tests included).
  • swiftformat + swiftlint clean on all touched files (PostEditorView file-length + tv identifier warnings pre-exist on main).
  • Old AC2: width-collapse logic untouched — focus overlay respects it (a collapsed pane is not summoned).

Calibration knobs (the fog's polish ticket dials these)

FocusChrome.swift constants: comfort band 60pt, hover zone 14pt, reveal/hide animation curves + durations, 140 ms hide grace.

Session-log

docs/devlog/20261009-issue87-focus-mode_log.md — DOX pass done (app + tests AGENTS.md, devlog + INDEX).

Note for the calibration gate (#88)

Checkout wayfinder/87-focus-mode (verify git branch --show-current, clean tree) before build-and-run — the gate must calibrate THIS build. The pinned corpus piece: "The expected value of showing" in spike/prose/.

[Generated by AI]

## Resolution **Landed on `wayfinder/87-focus-mode` @ b0ab800** (local, unpushed — push awaits authorization; a local branch in the shared checkout serves the calibration session on this machine). ### What landed - **Toggle**: View ▸ Toggle Focus Mode (system View menu, beside Toggle Reading Mode per #84) + ⌘⇧F. Transient like reading (#68): fresh open lands unfocused, no persistence. No Esc exit (charting verdict). Disabled when no post open and no draft — exit stays armed while focused, so trashing the open post from the library overlay can't trap. - **Recession**: rail + library + mentor columns and the editor toolbar row recede; the surface + centered measure on the workspace background is all that remains. Native title bar untouched. Editor ground swaps surface → workspace background (`DesignTokens.workspaceBackground` NSColor twin — SwiftUI Color can't cross into NSTextView). - **Hover reveal, overlay not push**: `FocusChrome.swift` — left-edge hover slides rail+library in (library only when window ≥1100px — #17's width collapse is NOT overridden, per the map contract); right-edge hover slides the mentor in. Panels float OVER the measure — the measure never moves. 14pt edge sensor strips (`HoverZone`, tracking-area, `hitTest → nil` — hover never steals clicks); 140 ms hide grace covers the zone→panel transit. easeOut 0.2 s in / easeIn 0.15 s out. - **Soft caret centering** (`CaretCentering`): ±60pt comfort band around the visible center; fires from `textDidChange` ONLY — scrollback and drag-selection are never fought; animated scroll (0.18 s); document clamp parks at the bottom and follows line by line — no jump at the document end. Band math pinned by `FocusModeTests.swift` (5 tests). - **Save honesty in focus**: failure is LOUD — the full dot + "Save failed" widget reappears as a floating top overlay when `saveState == .failed`; #67 conflict alert unchanged; autosave runs underneath. ⌘S moved to the body level so it stays armed with the toolbar hidden (drafts have no autosave — ⌘S is their only save path). - **Focus × reading orthogonal**: independent state axes; ⌘R works in focus, ⌘⇧F works while reading. - `PostsLibraryColumn` extracted from PostsPaneView — one library implementation for the unfocused layout and the focus overlay (rename sheet + context menu travel with it). ### Verification - Build green, full test suite green (FocusModeTests 5/5; UI tests included). - swiftformat + swiftlint clean on all touched files (PostEditorView file-length + `tv` identifier warnings pre-exist on main). - Old AC2: width-collapse logic untouched — focus overlay respects it (a collapsed pane is not summoned). ### Calibration knobs (the fog's polish ticket dials these) `FocusChrome.swift` constants: comfort band 60pt, hover zone 14pt, reveal/hide animation curves + durations, 140 ms hide grace. ### Session-log `docs/devlog/20261009-issue87-focus-mode_log.md` — DOX pass done (app + tests AGENTS.md, devlog + INDEX). ### Note for the calibration gate (#88) Checkout `wayfinder/87-focus-mode` (verify `git branch --show-current`, clean tree) before build-and-run — the gate must calibrate THIS build. The pinned corpus piece: "The expected value of showing" in `spike/prose/`. [Generated by AI]
Author
Owner

Follow-up (live report from Alexander): ⇧⌘F is taken by a system-wide shortcut on his machine — the charting probe only checked NSUserKeyEquivalents and in-app collisions, not global hotkeys. Shortcut is now ⌃F (commit 9c2926f on wayfinder/87-focus-mode). The greyed-out item was the entry guard firing correctly with no file loaded — disregard.

The map Notes' '⌘⇧F is free' pin is now stale — treat ⌃F as the shortcut.

[Generated by AI]

Follow-up (live report from Alexander): ⇧⌘F is taken by a system-wide shortcut on his machine — the charting probe only checked NSUserKeyEquivalents and in-app collisions, not global hotkeys. Shortcut is now **⌃F** (commit 9c2926f on `wayfinder/87-focus-mode`). The greyed-out item was the entry guard firing correctly with no file loaded — disregard. The map Notes' '⌘⇧F is free' pin is now stale — treat ⌃F as the shortcut. [Generated by AI]
Author
Owner

Audit follow-up (d07d418 on wayfinder/87-focus-mode, all tests green): reviewer fan-out synthesized — one failure surface in focus (floating chip; toolbar stays recessed), dirty-draft '⌘S saves' cue in focus, mentor reveal honors the #17 width verdict, hidden panels leave the a11y tree, NSColor(Color) bridge replaces the twin constant, dead HoverZone width plumbing deleted + zoneWidth hoisted as the calibration knob.

Open (needs Alexander): ⌃F shadows NSTextView's Emacs-style caret-forward binding (menu key equivalents beat the responder chain) — pressing ⌃F in the editor will toggle focus instead of moving the caret one character. If that bites while writing, ⌥⌘F is the suggested free combo; say the word and it's a one-line change.

Known accepted trade-off: toggling focus remounts the mentor pane and library column (half-typed mentor prompt / open rename sheet would be lost) — recorded here for the calibration pass to feel for.

[Generated by AI]

Audit follow-up (d07d418 on `wayfinder/87-focus-mode`, all tests green): reviewer fan-out synthesized — one failure surface in focus (floating chip; toolbar stays recessed), dirty-draft '⌘S saves' cue in focus, mentor reveal honors the #17 width verdict, hidden panels leave the a11y tree, NSColor(Color) bridge replaces the twin constant, dead HoverZone width plumbing deleted + zoneWidth hoisted as the calibration knob. **Open (needs Alexander):** ⌃F shadows NSTextView's Emacs-style caret-forward binding (menu key equivalents beat the responder chain) — pressing ⌃F in the editor will toggle focus instead of moving the caret one character. If that bites while writing, ⌥⌘F is the suggested free combo; say the word and it's a one-line change. Known accepted trade-off: toggling focus remounts the mentor pane and library column (half-typed mentor prompt / open rename sheet would be lost) — recorded here for the calibration pass to feel for. [Generated by AI]
Author
Owner

Shortcut settled: ⌥⌘F (commit 1bb3b45) — Alexander's call. ⌃F would have shadowed the editor's Emacs caret-forward binding. Records updated.

[Generated by AI]

Shortcut settled: **⌥⌘F** (commit 1bb3b45) — Alexander's call. ⌃F would have shadowed the editor's Emacs caret-forward binding. Records updated. [Generated by AI]
Sign in to join this conversation.