Spike C: SwiftUI block editor (live preview) #54
Notifications
Due Date
No due date set.
Blocks
Depends on
#55 Verdict: substrate decision + ADR-0010
AlexKucera/museion
#51 Spike corpus: pin the eight posts as markdown
AlexKucera/museion
Reference: AlexKucera/museion#54
Reference in new issue
Block a user
Part of #16
Blocked by: 51
Question
Can a SwiftUI block editor reach live-preview mode C without becoming the project? Throwaway spike on
spike/editor-presentationinspike/blocks/, editing the calibration piece: each block (paragraph, heading, quote, hr) rendered, source syntax visible only in the focused block.PERF-3k.md, scroll and edit, note any hitching.[Generated by AI]
Corpus is pinned (#51):
spike/prose/onspike/editor-presentation@3b3544e. Note: the calibration piece has no blockquote/italics in the source — its epigraph is plain prose in curly quotes. Full inventory + word counts in the #51 resolution.[Generated by AI]
Resolution — verdict criteria checklist
Code:
spike/blocks/onspike/editor-presentation@986f435(Package.swift, run.sh wrapper, BlockModel, SpikeApp — ~470 lines incl. comments). Run:spike/blocks/run.sh [corpus.md]from repo root; self-checkswift run --package-path spike/blocks BlocksSpike --check→PASS: 28 blocks; anchor block found; PERF-3k block-ify 0.4 ms.Block model — PASS
Blank-line split into blocks (same strategy as Spike B's reading mode — the spikes differ by substrate, not parse). Focused block = raw source in a cream NSTextView; every other block = rendered live. This IS the reading view: no toggle, no separate renderer. Block ops: Enter splits at cursor (28→29 blocks, focus moves to tail — verified), ⌫ at position 0 merges up (verified, count back to 28, focus restored).
Typography (strength case) — PASS
Variable heading sizes (H1 26 / H2 20 bold Iowan), true paragraph rhythm (18pt spacing, per-kind), 720pt centered measure — all free because each block is its own SwiftUI
Text. No substrate fight: no font-size ceiling like Spike A, no attribute-map surgery like Spike B. Screenshot:spike/blocks/assets/spikeC-calibration.png.Editing feel (risk case) — MIXED, the honest ceilings:
spikeC-ime.png.spikeC-typed.png.spikeC-split.png.spikeC-selection.png.spikeC-paste.png.Performance — PASS
PERF-3k (3452 words) → 128 blocks, block-ify 0.4 ms, full load 0.5 ms. Typed mid-document + 16 fast page-scrolls: no hitching, no blank holes, no half-drawn rows, document coherent throughout. LazyVStack held up.
spikeC-perf.png.Anchor feasibility — FEASIBLE (block-granular, proven live)
"Anchor: DM quote" highlights the quote's block (beige) + scrolls to it; stale quote → exact web-proto alert wording ("Anchor not found / The Post changed after this Fix Card was issued; no text was selected or changed."). Within-block word-range search (same tokenizer as Spike B) exists for sentence-level precision. Coarser than Spike B's exact-range highlight — a range within the block must be re-derived from block text, which the helper already does.
spikeC-anchor.png,spikeC-stale.png.The ticket's question: can mode C be reached without becoming the project?
The demo, yes — the product, no. ~470 throwaway lines buy the full mode-C experience with best-in-class typography and zero substrate fight. But the risk case found the ceiling: cross-block selection doesn't exist, undo is per-block with structural ops outside it, and paste-merge semantics are a per-case decision. Each is solvable, none for free — this substrate pays in interaction-model decisions where Spike B pays in presentation code. That trade is exactly what the verdict session (#55) weighs.
[Generated by AI]