feat(reading): polish typography, externalize CSS

Critique-directed polish of the reading surface (#72 ruling: pipeline
calm, surface not-calm) plus the single-user typography rework:

- Flow: leading 1.5, paragraph gap tightened; heading ladder rescaled
  (h1 1.15x / h2 0.85x / h3 body-face semibold) with cling margins,
  hN+hN suppression, no title dead space
- Constructs: confident blockquote (near-ink text, 3px rail, nesting
  degrades), booktabs tables, tinted code panels, relative inline code
- Fonts hardcoded for Alexander's faces: Valkyrie OT B 17 body,
  Concourse OT Semibold headings, UbuntuMono 14 code; 66ch measure
- Stylesheet moved to Museion/Resources/reading.css, read fresh per
  page build — Debug builds load the repo copy (#filePath), so CSS
  edits hot-reload on the next reading toggle
- Settings Typography/Text Flow sections and all flow-key plumbing
  deleted (56 insertions, 417 deletions)

Refs #72, #78. Detector: 192 findings -> 0. Build + 93 tests green.

[Generated by AI]
This commit is contained in:
AlexKucera committed 2026-10-07 17:02:10 +02:00
1 parent eae86dd2ef
commit 4cb753d17f
9 files changed
+134 -417

No files matched your search

+1 -33
View File
@@ -69,7 +69,6 @@ struct ReadingSurface: NSViewRepresentable {
// Paint the page bg while loading instead of AppKit white (flash fix, #74).
wv.underPageBackgroundColor = NSColor(red: 0.984, green: 0.984, blue: 0.992, alpha: 1)
context.coordinator.webView = wv
context.coordinator.watchDefaults()
return wv
}
@@ -78,7 +77,7 @@ struct ReadingSurface: NSViewRepresentable {
coordinator.onEditIntent = onEditIntent
coordinator.stateBox = stateBox
coordinator.postFolder = postFolder
let key = "\(generation):\(text.hashValue):\(ProseTypography.flowKey)"
let key = "\(generation):\(text.hashValue)"
guard coordinator.loadedKey != key else { return }
coordinator.load(text: text, generation: generation, entryCaret: entryCaretLocation, key: key)
}
@@ -140,8 +139,6 @@ struct ReadingSurface: NSViewRepresentable {
var pendingEntryScrollLine: Int?
var painted = false
private var lastText = ""
private var defaultsObserver: NSObjectProtocol?
private var appliedFlowKey = ""
/// Build + load the page for `text`. All render paths land here
/// (updateNSView, typography-change reload).
@@ -165,35 +162,6 @@ struct ReadingSurface: NSViewRepresentable {
return blocks.first { $0.sourceRange.location >= caret }?.sourceLine
}
/// Typography/flow knob moves reload the page (CSS vars are injected
/// at load; SwiftUI doesn't re-call updateNSView on UserDefaults
/// writes).
func watchDefaults() {
guard defaultsObserver == nil else { return }
appliedFlowKey = ProseTypography.flowKey
defaultsObserver = NotificationCenter.default.addObserver(
forName: UserDefaults.didChangeNotification,
object: nil,
queue: .main,
) { [weak self] _ in
Task { @MainActor [weak self] in
guard let self else { return }
let key = ProseTypography.flowKey
guard key != appliedFlowKey else { return }
appliedFlowKey = key
load(
text: lastText,
generation: 0,
entryCaret: nil,
key: "\(loadedKey)|flow",
)
}
}
}
// ponytail: observer registration lives for the coordinator's
// lifetime (app-scoped defaults notifications, same as ProseTextView's
// coordinator — no removal, matching the codebase convention).
// MARK: WKNavigationDelegate