Skip to content

refactor(renderer): shared files/timeline-geometry libs + inspector/settings sub-modules#56

Merged
thisiscsim merged 1 commit into
mainfrom
refactor/renderer-components
Jul 20, 2026
Merged

refactor(renderer): shared files/timeline-geometry libs + inspector/settings sub-modules#56
thisiscsim merged 1 commit into
mainfrom
refactor/renderer-components

Conversation

@thisiscsim

Copy link
Copy Markdown
Owner

Summary

Audit roadmap Phase 6 (renderer decomposition). Splits the largest components into testable pure libs and self-contained sub-modules, and removes the duplication/smells the audit named:

  • lib/files.tspathsFrom(files): the FileList → disk paths snippet was copy-pasted verbatim in 5 components (LeftRail, Timeline, CritiquePanel, StylePanel, + a variant in SettingsModal). All now import the one helper.
  • lib/timeline-geometry.ts: the pure timeline math (computePreview/geomFor/commit/clamp/round), types, constants, placeAudioOnTrack, and ASSET_MIME, extracted from Timeline.tsx (704 → 552 lines). ASSET_MIME no longer crosses a component→component import (LeftRail imported it from Timeline). New timeline-geometry.test.ts covers computePreview (move/left/right + clamps), geomFor, and placeAudioOnTrack (role inference + music ducking).
  • components/inspector/fields.tsx: the Inspector's form primitives (Section, SegGroup, DraftTextArea, NumberChip, DraftSlider, ColorChip, InspSelect, PaddingChip + internal DraftNumberInput/normalizeHex), extracted from InspectorPanel.tsx (745 → 424 lines).
  • components/settings/controls.tsx: SettingRow / SettingSelect / Toggle / Divider / modelLabel, extracted from SettingsModal.tsx (605 → 525 lines).

Pure moves + import rewiring — no behavior change. Renderer-only, no dev-server restart needed.

Scope note: Home.tsx and SettingsModal's stateful VoicesTab weren't sub-split here — they're large and stateful, and this PR already delivers the testable-lib extractions and the cross-component dedup with lower risk. They can follow as their own moves.

Test plan

  • 9 new geometry tests; 123 total
  • typecheck / lint / format / build green
  • Extractions are move-only (no logic edits); imports rewired across the 6 touched components

Made with Cursor

…big components

Decomposes the largest components into testable pure libs and self-contained
sub-modules, and removes the duplication the audit named:

- lib/files.ts: pathsFrom(files) — the FileList->paths snippet was copy-
  pasted verbatim in 5 components (LeftRail/Timeline/CritiquePanel/
  StylePanel and a variant in Settings). All now import it.
- lib/timeline-geometry.ts: the pure timeline math + types + constants +
  placeAudioOnTrack + ASSET_MIME, out of Timeline.tsx (704->552 lines).
  ASSET_MIME no longer crosses a component->component import (LeftRail
  imported it from Timeline). timeline-geometry.test.ts covers
  computePreview/geomFor/placeAudioOnTrack.
- components/inspector/fields.tsx: the Inspector's form primitives
  (Section/SegGroup/DraftTextArea/NumberChip/DraftSlider/ColorChip/
  InspSelect/PaddingChip) (InspectorPanel 745->424 lines).
- components/settings/controls.tsx: SettingRow/SettingSelect/Toggle/
  Divider/modelLabel (SettingsModal 605->525 lines).

Pure moves + import rewiring; no behavior change. 123 tests (9 new).

Co-authored-by: Cursor <cursoragent@cursor.com>
@thisiscsim
thisiscsim merged commit 1f2f903 into main Jul 20, 2026
1 check passed
@thisiscsim
thisiscsim deleted the refactor/renderer-components branch July 20, 2026 00:45
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant