feat(subtitles): improve mpv hovered-token highlighting flow

- add subtitleStyle.hoverTokenColor config default + validation

- normalize hover color payloads and propagate configured color to mpv runtime

- refresh invisible overlay tokenization with current subtitle text and tighten hover overlay cleanup hooks

- record TASK-98 and subagent coordination updates
This commit is contained in:
2026-02-21 22:20:56 -08:00
parent 430c4e7120
commit 01f01f18e3
17 changed files with 244 additions and 15 deletions

View File

@@ -99,3 +99,16 @@ test('subtitle processing can refresh current subtitle without text change', asy
{ text: 'same', tokens: [] },
]);
});
test('subtitle processing refresh can use explicit text override', async () => {
const emitted: SubtitleData[] = [];
const controller = createSubtitleProcessingController({
tokenizeSubtitle: async (text) => ({ text, tokens: [] }),
emitSubtitle: (payload) => emitted.push(payload),
});
controller.refreshCurrentSubtitle('initial');
await flushMicrotasks();
assert.deepEqual(emitted, [{ text: 'initial', tokens: [] }]);
});

View File

@@ -9,7 +9,7 @@ export interface SubtitleProcessingControllerDeps {
export interface SubtitleProcessingController {
onSubtitleChange: (text: string) => void;
refreshCurrentSubtitle: () => void;
refreshCurrentSubtitle: (textOverride?: string) => void;
}
export function createSubtitleProcessingController(
@@ -87,7 +87,10 @@ export function createSubtitleProcessingController(
latestText = text;
processLatest();
},
refreshCurrentSubtitle: () => {
refreshCurrentSubtitle: (textOverride?: string) => {
if (typeof textOverride === 'string') {
latestText = textOverride;
}
if (!latestText.trim()) {
return;
}