Surfaced by the clarity-review pass on the v0.1.0 release branch (B6). Do NOT apply for v0.1.0 — captured for post-launch.
src/components/Scrambler.svelte:39-54 derives anyCardOpen by mounting a MutationObserver that watches every descendant's class attribute for .scrambler-card.focused / .scrambler-card.expanded — an indirect, attribute-string-sniffing channel.
tapPaused (lines 34-37, added by #43) is a clean callback hoisted from each cluster.
Both signals do the same job — coordinate cross-cluster state in the parent — but use different mechanisms. The MutationObserver works only because the card writes those exact class names, which is a hidden coupling. The callback pattern is explicit and testable.
Proposed unification: hoist an onCardOpenChange(delta: 1 | -1) callback from ScramblerCard → ScramblerCluster → Scrambler. Maintain a cardOpenCount on the parent; anyCardOpen = cardOpenCount > 0. Drop the observer.
Files
src/components/Scrambler.svelte
src/components/ScramblerCluster.svelte
src/components/ScramblerCard.svelte
Surfaced by the clarity-review pass on the v0.1.0 release branch (B6). Do NOT apply for v0.1.0 — captured for post-launch.
src/components/Scrambler.svelte:39-54derivesanyCardOpenby mounting aMutationObserverthat watches every descendant'sclassattribute for.scrambler-card.focused/.scrambler-card.expanded— an indirect, attribute-string-sniffing channel.tapPaused(lines 34-37, added by #43) is a clean callback hoisted from each cluster.Both signals do the same job — coordinate cross-cluster state in the parent — but use different mechanisms. The MutationObserver works only because the card writes those exact class names, which is a hidden coupling. The callback pattern is explicit and testable.
Proposed unification: hoist an
onCardOpenChange(delta: 1 | -1)callback fromScramblerCard → ScramblerCluster → Scrambler. Maintain acardOpenCounton the parent;anyCardOpen = cardOpenCount > 0. Drop the observer.Files
src/components/Scrambler.sveltesrc/components/ScramblerCluster.sveltesrc/components/ScramblerCard.svelte