mirror of
https://github.com/ksyasuda/SubMiner.git
synced 2026-04-28 04:19:27 -07:00
Windows update (#49)
This commit is contained in:
@@ -89,6 +89,10 @@ export interface ShortcutsConfig {
|
||||
markAudioCard?: string | null;
|
||||
openRuntimeOptions?: string | null;
|
||||
openJimaku?: string | null;
|
||||
openSessionHelp?: string | null;
|
||||
openControllerSelect?: string | null;
|
||||
openControllerDebug?: string | null;
|
||||
toggleSubtitleSidebar?: string | null;
|
||||
}
|
||||
|
||||
export interface Config {
|
||||
|
||||
@@ -5,6 +5,12 @@ import type {
|
||||
KikuMergePreviewResponse,
|
||||
} from './anki';
|
||||
import type { ResolvedConfig, ShortcutsConfig } from './config';
|
||||
import type {
|
||||
CompiledSessionBinding,
|
||||
SessionActionId,
|
||||
SessionActionPayload,
|
||||
SessionBindingWarning,
|
||||
} from './session-bindings';
|
||||
import type {
|
||||
JimakuApiResponse,
|
||||
JimakuDownloadQuery,
|
||||
@@ -321,11 +327,18 @@ export interface ClipboardAppendResult {
|
||||
|
||||
export interface ConfigHotReloadPayload {
|
||||
keybindings: Keybinding[];
|
||||
sessionBindings: CompiledSessionBinding[];
|
||||
sessionBindingWarnings: SessionBindingWarning[];
|
||||
subtitleStyle: SubtitleStyleConfig | null;
|
||||
subtitleSidebar: Required<SubtitleSidebarConfig>;
|
||||
secondarySubMode: SecondarySubMode;
|
||||
}
|
||||
|
||||
export interface SessionActionDispatchRequest {
|
||||
actionId: SessionActionId;
|
||||
payload?: SessionActionPayload;
|
||||
}
|
||||
|
||||
export type ResolvedControllerConfig = ResolvedConfig['controller'];
|
||||
|
||||
export interface ElectronAPI {
|
||||
@@ -349,7 +362,9 @@ export interface ElectronAPI {
|
||||
setMecabEnabled: (enabled: boolean) => void;
|
||||
sendMpvCommand: (command: (string | number)[]) => void;
|
||||
getKeybindings: () => Promise<Keybinding[]>;
|
||||
getSessionBindings: () => Promise<CompiledSessionBinding[]>;
|
||||
getConfiguredShortcuts: () => Promise<Required<ShortcutsConfig>>;
|
||||
dispatchSessionAction: (actionId: SessionActionId, payload?: SessionActionPayload) => Promise<void>;
|
||||
getStatsToggleKey: () => Promise<string>;
|
||||
getMarkWatchedKey: () => Promise<string>;
|
||||
markActiveVideoWatched: () => Promise<boolean>;
|
||||
@@ -386,9 +401,13 @@ export interface ElectronAPI {
|
||||
cycleRuntimeOption: (id: RuntimeOptionId, direction: 1 | -1) => Promise<RuntimeOptionApplyResult>;
|
||||
onRuntimeOptionsChanged: (callback: (options: RuntimeOptionState[]) => void) => void;
|
||||
onOpenRuntimeOptions: (callback: () => void) => void;
|
||||
onOpenSessionHelp: (callback: () => void) => void;
|
||||
onOpenControllerSelect: (callback: () => void) => void;
|
||||
onOpenControllerDebug: (callback: () => void) => void;
|
||||
onOpenJimaku: (callback: () => void) => void;
|
||||
onOpenYoutubeTrackPicker: (callback: (payload: YoutubePickerOpenPayload) => void) => void;
|
||||
onOpenPlaylistBrowser: (callback: () => void) => void;
|
||||
onSubtitleSidebarToggle: (callback: () => void) => void;
|
||||
onCancelYoutubeTrackPicker: (callback: () => void) => void;
|
||||
onKeyboardModeToggleRequested: (callback: () => void) => void;
|
||||
onLookupWindowToggleRequested: (callback: () => void) => void;
|
||||
@@ -414,7 +433,8 @@ export interface ElectronAPI {
|
||||
| 'kiku'
|
||||
| 'controller-select'
|
||||
| 'controller-debug'
|
||||
| 'subtitle-sidebar',
|
||||
| 'subtitle-sidebar'
|
||||
| 'session-help',
|
||||
) => void;
|
||||
notifyOverlayModalOpened: (
|
||||
modal:
|
||||
@@ -426,7 +446,8 @@ export interface ElectronAPI {
|
||||
| 'kiku'
|
||||
| 'controller-select'
|
||||
| 'controller-debug'
|
||||
| 'subtitle-sidebar',
|
||||
| 'subtitle-sidebar'
|
||||
| 'session-help',
|
||||
) => void;
|
||||
reportOverlayContentBounds: (measurement: OverlayContentMeasurement) => void;
|
||||
onConfigHotReload: (callback: (payload: ConfigHotReloadPayload) => void) => void;
|
||||
|
||||
75
src/types/session-bindings.ts
Normal file
75
src/types/session-bindings.ts
Normal file
@@ -0,0 +1,75 @@
|
||||
export type SessionKeyModifier = 'ctrl' | 'alt' | 'shift' | 'meta';
|
||||
|
||||
export type SessionActionId =
|
||||
| 'toggleStatsOverlay'
|
||||
| 'toggleVisibleOverlay'
|
||||
| 'copySubtitle'
|
||||
| 'copySubtitleMultiple'
|
||||
| 'updateLastCardFromClipboard'
|
||||
| 'triggerFieldGrouping'
|
||||
| 'triggerSubsync'
|
||||
| 'mineSentence'
|
||||
| 'mineSentenceMultiple'
|
||||
| 'toggleSecondarySub'
|
||||
| 'toggleSubtitleSidebar'
|
||||
| 'markAudioCard'
|
||||
| 'openRuntimeOptions'
|
||||
| 'openSessionHelp'
|
||||
| 'openControllerSelect'
|
||||
| 'openControllerDebug'
|
||||
| 'openJimaku'
|
||||
| 'openYoutubePicker'
|
||||
| 'openPlaylistBrowser'
|
||||
| 'replayCurrentSubtitle'
|
||||
| 'playNextSubtitle'
|
||||
| 'shiftSubDelayPrevLine'
|
||||
| 'shiftSubDelayNextLine'
|
||||
| 'cycleRuntimeOption';
|
||||
|
||||
export interface SessionKeySpec {
|
||||
code: string;
|
||||
modifiers: SessionKeyModifier[];
|
||||
}
|
||||
|
||||
export interface SessionBindingWarning {
|
||||
kind: 'unsupported' | 'conflict' | 'deprecated-config';
|
||||
path: string;
|
||||
message: string;
|
||||
value: unknown;
|
||||
conflictingPaths?: string[];
|
||||
}
|
||||
|
||||
export interface SessionActionPayload {
|
||||
count?: number;
|
||||
runtimeOptionId?: string;
|
||||
direction?: 1 | -1;
|
||||
}
|
||||
|
||||
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 PluginSessionBindingsArtifact {
|
||||
version: 1;
|
||||
generatedAt: string;
|
||||
numericSelectionTimeoutMs: number;
|
||||
bindings: CompiledSessionBinding[];
|
||||
warnings: SessionBindingWarning[];
|
||||
}
|
||||
Reference in New Issue
Block a user