mirror of
https://github.com/ksyasuda/SubMiner.git
synced 2026-11-20 16:46:07 -08:00
Decide whether the Yomitan popup is open from the popup host in the DOM instead of the cached yomitanPopupVisible flag, which can lag a close and kept input.conf keys from reaching mpv. Keep the imported mpv key list in place while a refresh is in flight, so a key pressed right after the overlay regains focus is not dropped. A failed reload still clears the list. At --log-level debug, log why the overlay kept an mpv-bound key (config-loading, modal, lookup-popup, interactive-target or no-imported-bindings) over a validated IPC channel. Refs #331
70 lines
1.9 KiB
TypeScript
70 lines
1.9 KiB
TypeScript
import type { SessionActionId, SessionActionPayload } from '../plugin-api';
|
|
export type { SessionActionId, SessionActionPayload } from '../plugin-api';
|
|
|
|
export type SessionKeyModifier = 'ctrl' | 'alt' | 'shift' | 'meta';
|
|
|
|
export interface SessionKeySpec {
|
|
code: string;
|
|
modifiers: SessionKeyModifier[];
|
|
}
|
|
|
|
export interface MpvInputBindingsSnapshot {
|
|
keys: string[];
|
|
blockedKeys: SessionKeySpec[];
|
|
}
|
|
|
|
/** Why the overlay kept a key that mpv binds instead of forwarding it. */
|
|
export type MpvKeyForwardBlock =
|
|
| 'config-loading'
|
|
| 'modal'
|
|
| 'lookup-popup'
|
|
| 'interactive-target'
|
|
| 'no-imported-bindings';
|
|
|
|
/** Debug report the overlay sends when it does not forward an mpv-bound key. */
|
|
export interface UnforwardedMpvKeyReport {
|
|
key: string;
|
|
reason: MpvKeyForwardBlock;
|
|
}
|
|
|
|
export interface SessionBindingWarning {
|
|
kind: 'unsupported' | 'conflict' | 'deprecated-config';
|
|
path: string;
|
|
message: string;
|
|
value: unknown;
|
|
conflictingPaths?: string[];
|
|
}
|
|
|
|
type CompiledSessionBindingBase = {
|
|
sourcePath: string;
|
|
originalKey: string;
|
|
key: SessionKeySpec;
|
|
};
|
|
|
|
export interface CompiledMpvCommandBinding extends CompiledSessionBindingBase {
|
|
actionType: 'mpv-command';
|
|
command: (string | number)[];
|
|
}
|
|
|
|
export interface CompiledSessionActionBinding extends CompiledSessionBindingBase {
|
|
actionType: 'session-action';
|
|
actionId: SessionActionId;
|
|
payload?: SessionActionPayload;
|
|
}
|
|
|
|
export type CompiledSessionBinding = CompiledMpvCommandBinding | CompiledSessionActionBinding;
|
|
|
|
export interface PluginSessionActionBinding extends CompiledSessionActionBinding {
|
|
cliArgs?: string[];
|
|
}
|
|
|
|
export type PluginSessionBinding = CompiledMpvCommandBinding | PluginSessionActionBinding;
|
|
|
|
export interface PluginSessionBindingsArtifact {
|
|
version: 1;
|
|
generatedAt: string;
|
|
numericSelectionTimeoutMs: number;
|
|
bindings: PluginSessionBinding[];
|
|
warnings: SessionBindingWarning[];
|
|
}
|