Spike C: SwiftUI block editor (live preview) #54

Closed
opened 2026-09-26 11:38:57 +02:00 by AlexKucera · 2 comments
Owner

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-presentation in spike/blocks/, editing the calibration piece: each block (paragraph, heading, quote, hr) rendered, source syntax visible only in the focused block.

  • Block model: parse the markdown into blocks; edit per block; blocks re-render live (this IS the reading view — no toggle needed).
  • Typography is the strength case: variable heading sizes, true paragraph rhythm, centered measure should come naturally.
  • Editing feel is the risk case: IME, undo across blocks, selection across blocks, raw-markdown paste behavior — probe each honestly.
  • Performance: block-ify PERF-3k.md, scroll and edit, note any hitching.
  • No anchor proof required here; note feasibility of mapping a quote anchor to a block+range in a sentence.
  • Resolution comment: the verdict criteria as a checklist with findings; screenshots linked as assets.

[Generated by AI]

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-presentation` in `spike/blocks/`, editing the calibration piece: each block (paragraph, heading, quote, hr) rendered, source syntax visible only in the focused block. - Block model: parse the markdown into blocks; edit per block; blocks re-render live (this IS the reading view — no toggle needed). - Typography is the strength case: variable heading sizes, true paragraph rhythm, centered measure should come naturally. - Editing feel is the risk case: IME, undo across blocks, selection across blocks, raw-markdown paste behavior — probe each honestly. - Performance: block-ify `PERF-3k.md`, scroll and edit, note any hitching. - No anchor proof required here; note feasibility of mapping a quote anchor to a block+range in a sentence. - Resolution comment: the verdict criteria as a checklist with findings; screenshots linked as assets. [Generated by AI]
AlexKucera added the wayfinder:prototype label 2026-09-26 11:39:00 +02:00
AlexKucera added a new dependency 2026-09-26 11:39:03 +02:00
AlexKucera added a new dependency 2026-09-26 11:39:04 +02:00
Author
Owner

Corpus is pinned (#51): spike/prose/ on spike/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]

Corpus is pinned (#51): `spike/prose/` on `spike/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](https://git.babylondreams.de/AlexKucera/Museion/issues/51#issuecomment-22188). [Generated by AI]
AlexKucera self-assigned this 2026-09-30 18:15:03 +02:00
Author
Owner

Resolution — verdict criteria checklist

Code: spike/blocks/ on spike/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-check swift 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:

  • IME — PASS. Dead-key compose (⌥U + a → ä) lands correctly; it's a real NSTextView per block. Screenshot: spikeC-ime.png.
  • Typing — PASS. Live edit into focused block, re-render on blur is instant. spikeC-typed.png.
  • Undo — PARTIAL. Within-block ⌘Z is clean (native, verified twice, no garbling). But each block carries its own undo stack: no cross-block undo, and structural ops (split/merge) are not in ANY undo stack — ⌘Z after a split edits text, never un-splits. Uniting this needs a custom undo manager over block ops — real product lift Spike B never pays. spikeC-split.png.
  • Selection across blocks — FAIL (inherent). ⇧↓ at block end stops at the block boundary; selection cannot span blocks. Select-across-blocks, drag-select across, and column ops are architecturally absent in per-block text views. spikeC-selection.png.
  • Raw-markdown paste — PASS with quirk. Multi-paragraph paste explodes into blocks and they render immediately (bold shown, no asterisks). Quirk: the FIRST pasted chunk merges into the focused block's existing text ("compose test: ä" + "pasted one" became one block). 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]

## Resolution — verdict criteria checklist Code: `spike/blocks/` on `spike/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-check `swift 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: - **IME — PASS.** Dead-key compose (⌥U + a → ä) lands correctly; it's a real NSTextView per block. Screenshot: `spikeC-ime.png`. - **Typing — PASS.** Live edit into focused block, re-render on blur is instant. `spikeC-typed.png`. - **Undo — PARTIAL.** Within-block ⌘Z is clean (native, verified twice, no garbling). But each block carries its own undo stack: **no cross-block undo**, and structural ops (split/merge) are not in ANY undo stack — ⌘Z after a split edits text, never un-splits. Uniting this needs a custom undo manager over block ops — real product lift Spike B never pays. `spikeC-split.png`. - **Selection across blocks — FAIL (inherent).** ⇧↓ at block end stops at the block boundary; selection cannot span blocks. Select-across-blocks, drag-select across, and column ops are architecturally absent in per-block text views. `spikeC-selection.png`. - **Raw-markdown paste — PASS with quirk.** Multi-paragraph paste explodes into blocks and they render immediately (bold shown, no asterisks). Quirk: the FIRST pasted chunk merges into the focused block's existing text ("compose test: ä" + "pasted one" became one block). `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]
Sign in to join this conversation.