Skip to content

Refactor: collapse OrbitPauseReasons to a named-flag set / Set<PauseReason> #48

Description

@khurchla

Surfaced by the clarity-review pass on the v0.1.0 release branch (B1). Do NOT apply for v0.1.0 — captured for post-launch.

src/lib/scrambler/pause.ts:20-38 defines six independent booleans on OrbitPauseReasons and isOrbitPaused() ORs them. The shape is fine, but the call site in src/components/ScramblerCluster.svelte:124-133 (the $derived(isOrbitPaused({ ... })) block introduced by #43) has to rename every field at the boundary: hoverPaused → hover, focusPaused → focus, isDraggingCard → dragging. That rename layer is friction every time the file is read.

Two cleaner shapes worth considering:

  1. Rename the local cluster $state variables to match the struct field-for-field (so the object literal collapses to shorthand: { hover, focus, tap, anyCardOpen, dragging, recentlyCollapsed }).
  2. Change OrbitPauseReasons to a Set<PauseReason> (or a bitmask), so the cluster can pauseReasons.add('hover') / pauseReasons.delete('hover') directly without re-aliasing.

Either choice removes the rename layer and makes the contract single-sourced.

Files

  • src/lib/scrambler/pause.ts
  • src/components/ScramblerCluster.svelte
  • tests/scrambler/orbit-pause.test.ts (test data shape updates accordingly)

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions