Files
museion/docs/devlog/20261005-issue71-reading-toggle_log.md

43 lines
4.4 KiB
Markdown
Raw Permalink Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
# Issue 71 — Task: land the reading toggle build (S1.2)
> **Date:** 2026-10-05
> **Type:** issue
> **Reference:** [Wayfinder map #20](https://git.babylondreams.de/AlexKucera/Museion/issues/20) · decisions [#68](https://git.babylondreams.de/AlexKucera/Museion/issues/68) · [#69](https://git.babylondreams.de/AlexKucera/Museion/issues/69) · [#70](https://git.babylondreams.de/AlexKucera/Museion/issues/70)
## What landed
Branch `wayfinder/71-reading-toggle`, commits `4c91733` (feature) + `c4555ed` (DOX).
**New files**
- `Museion/ReadingPresenter.swift` — block-aware reading renderer (ADR-0010 stance): blank-line split → one block per chunk; classification HR → list run → quote run → flow. Lists (bullets + ordered + nesting + auto-renumber) are one rendering path; headings h1/h2/`###`/floor per #69/#70; `QuoteTextBlock` hairline, `RuleTextBlock` HR, `NSTextTable` tables with delimiter-row alignment; images as hover-payload blocks; footnotes the one fallback. `document(for:resolvingImagesIn:)` builds the single storage with per-block `Bound{docRange, sourceRange, imageURL}`.
- `Museion/ReadingSurface.swift` — `ReadingCanvasView`: read-only selectable NSTextView. Tap-to-edit runs after `super.mouseDown` returns (NSTextView's tracking loop consumes the mouse-up — `mouseUp` overrides never fire); ⌘-click opens links; scroll tracking feeds the flip-back caret; image hover NSPopover loads off-main.
- `Museion/ProseTypography.swift` — the #70 three role slots (Body/Headings/Code, {face,size} each, UserDefaults six values, member-based font resolution, silent system fallback).
- `MuseionTests/ReadingPresenterTests.swift` — 15 renderer tests (inline fixtures).
- `spike/prose/kitchen-sink.md` + `assets/kitchen-sink.png` — the #69 calibration piece.
**Modified**
- `PostEditorView.swift` — Read⇄Edit toolbar button (far left), View menu + ⌘R via `.toggleReadingMode` notification; transient reading state; drafts included (draft mirror); flip-back caret hint (location + token) applied once per token.
- `ProsePresenter.swift` — headings/dimmed-syntax/body rewired through the shared slots (both prose surfaces read the same tokens, #70).
- `SettingsPaneView.swift` — Typography section: three `SlotRow`s (family picker + size field).
- `MuseionApp.swift` — View CommandMenu; `ProseTypography.registerDefaults()` in `AppGateState.init`.
- `EditorSession.swift` — `folderURL` for image resolution.
## Verification
- Build + full test suite green: 94 unit + UI smoke (`xcodebuild … test`).
- Runtime probe (temporary hosted test, deleted): kitchen-sink 24 blocks/11.3 ms; PERF-3k 128 blocks/17.2 ms, ×10 in 165.8 ms; zero marker leakage across all three corpus files.
- Live-app probe (System Events): post opens, Read renders (markers hidden, `1. 1. 1.` → 1/2/3 verified via AX value), ⌘R menu toggles back, click-on-paragraph flips to editing with caret in-document, file byte-identical (`cmp`) after the full round-trip.
- Typography pixel-verified on screenshot: heading ink 20px vs body 15-16px at 1× — the 26/20/17 ladder renders.
## Deviations from the decisions
- **Font resolution** (#70 said family+weight lookup): `font(withFamily:traits:weight:)` misresolves Concourse OT — Thin and Book both advertise weight 4 and the manager picks Thin. Faces resolve through the member list instead (prefer Book/Regular style, else closest to weight 5). The #70-pinned PS names (ConcourseOT3Book etc.) fall out of the same path.
- **Heading bold**: the first build lost heading weight (member resolution returns Book); `headingFont(size:)` now bolds — matching #19's weight 8/9 stance and #70's "Iowan Old Style bold".
- **Table alignment**: honored (not left-defaulted) — the delimiter row is parsed anyway; alignment was ~4 lines.
- **Click-to-edit discrimination**: implemented as single-click (`clickCount == 1`) + no selection + <4pt move, checked after `super.mouseDown` returns. The time-window check from the plan was dropped — the click is complete when the tracking loop exits, making it redundant.
## Notes for calibration (#72)
- The map's fog item "curated shortlist" now has a home: Settings → Typography lists all families with current faces prepended (Iowan Old Style is not in `availableFontFamilies` — the prepend is load-bearing).
- Mapping (entry scroll + flip-back caret) shipped in full; no jank fallback was needed at build time — #72 arbitrates.