Deduplicate Syllable and Line lyrics applyers into shared pipeline - #343
Open
zzleep wants to merge 1 commit into
Open
Deduplicate Syllable and Line lyrics applyers into shared pipeline#343zzleep wants to merge 1 commit into
zzleep wants to merge 1 commit into
Conversation
Contributor
Greptile SummaryThe PR consolidates the duplicated line-synced and syllable-synced rendering flows into a configurable shared pipeline while retaining each mode's word-building and timing behavior.
Confidence Score: 5/5The PR appears safe to merge, with no concrete regressions identified in the refactored synced-lyrics pipeline. The shared pipeline preserves metadata and DOM ordering, mode-specific end-time handling, current-line initialization, interlude timing, and virtualizer inputs across both synced lyric modes.
|
| Filename | Overview |
|---|---|
| src/utils/Lyrics/Applyer/Synced/Base.ts | Introduces the common synced-lyrics lifecycle and interlude pipeline while resolving target metadata arrays after state clearing. |
| src/utils/Lyrics/Applyer/Synced/Line.ts | Replaces the duplicated line renderer with a small mode configuration preserving line text, RTL, and end-time behavior. |
| src/utils/Lyrics/Applyer/Synced/Syllable.ts | Retains syllable-specific emphasis, grouping, background lines, and metadata registration through extracted synchronous builders. |
Flowchart
%%{init: {'theme': 'neutral'}}%%
flowchart TD
A[ApplyLineLyrics] --> C[ApplySyncedLyrics]
B[ApplySyllableLyrics] --> C
LM[Line mode configuration] --> C
SM[Syllable mode configuration] --> C
C --> D[Clear state and create container]
D --> E[Build regular lines]
E --> F[Mode-specific content builder]
E --> G[Create shared musical interludes]
F --> H[Line metadata and DOM elements]
G --> H
H --> I[Apply credits and provider]
I --> J[Mount SimpleBar and virtualizer]
J --> K[Emit applied event]
Reviews (1): Last reviewed commit: "Deduplicate Syllable and Line lyrics app..." | Re-trigger Greptile
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
ApplySyllableLyrics(Syllable.ts, 566 lines) andApplyLineLyrics(Line.ts, 334 lines) were ~80% structurally identical: container setup, RTL/duet detection, musical interlude dots, line-end-time computation, credits/provider application, SimpleBar/virtualizer wiring, and styling all existed twice with only minor differences (lines array,SetWordArray*hook, end-time store flag, word-building).This PR extracts the shared pipeline into a new
Synced/Base.tsand parameterizes the differences through a smallSyncedApplyModeconfig:Synced/Base.ts(new, ~290 lines) —ApplySyncedLyrics,CreateMusicalLine(unified leading + gap interlude builder),PushSyncedWord, shared typesSyllable.ts— 566 → ~260 lines; keeps all word-level logic: letter emphasis (Emphasize), word grouping, background linesLine.ts— 334 → ~46 lines; just its types, thetextContentbuilder, and mode configNet −591 lines (
+508/−807across 3 files).Behavior preserved (verified line-by-line)
$minimalLyricsMode(Syllable) vs$simpleLyricsMode(Line) end-time extension stays separateSetWordArrayInCurentLine/SetWordArrayInCurentLine_LINE_SYNCEDcalled at the exact same points — critical becauseEmphasizereads the globalCurrentLineLyricsObject; LINE_SYNCED regular lines still get no word arraylineStartTime = 0)bg-wordonly on non-letter background words),BGWord: truepushes intactClearLyricsContentArrays(which swaps in fresh arrays)Line.tsare now guarded — behaviorally identical sinceSyllables.Leadis always initialized before themApplySyllableLyrics,ApplyLineLyrics) unchanged; no other files touchedVerification
bun run build— 198 modules, success (production + dev watcher)bun run lint— no new warningsoxfmt --check— cleantsc --noEmit— identical set of pre-existing errors before/after, none in the touched files