mirror of
https://github.com/ksyasuda/SubMiner.git
synced 2026-03-20 03:16:46 -07:00
- Add default `f` fullscreen overlay binding and switch default AniSkip skip key to `Tab` - Make character-dictionary auto-sync non-blocking at startup with tokenization gating for Yomitan mutations - Add ordered startup OSD progress (checking/generating/updating/importing), refresh current subtitle on sync completion, and extend regression tests
72 lines
2.4 KiB
TypeScript
72 lines
2.4 KiB
TypeScript
import {
|
|
AnkiConnectConfig,
|
|
ResolvedConfig,
|
|
RuntimeOptionId,
|
|
RuntimeOptionScope,
|
|
RuntimeOptionValue,
|
|
RuntimeOptionValueType,
|
|
} from '../../types';
|
|
|
|
export type ConfigValueKind = 'boolean' | 'number' | 'string' | 'enum' | 'array' | 'object';
|
|
|
|
export interface RuntimeOptionRegistryEntry {
|
|
id: RuntimeOptionId;
|
|
path: string;
|
|
label: string;
|
|
scope: RuntimeOptionScope;
|
|
valueType: RuntimeOptionValueType;
|
|
allowedValues: RuntimeOptionValue[];
|
|
defaultValue: RuntimeOptionValue;
|
|
requiresRestart: boolean;
|
|
formatValueForOsd: (value: RuntimeOptionValue) => string;
|
|
toAnkiPatch: (value: RuntimeOptionValue) => Partial<AnkiConnectConfig>;
|
|
}
|
|
|
|
export interface ConfigOptionRegistryEntry {
|
|
path: string;
|
|
kind: ConfigValueKind;
|
|
defaultValue: unknown;
|
|
description: string;
|
|
enumValues?: readonly string[];
|
|
runtime?: RuntimeOptionRegistryEntry;
|
|
}
|
|
|
|
export interface ConfigTemplateSection {
|
|
title: string;
|
|
description: string[];
|
|
key: keyof ResolvedConfig;
|
|
notes?: string[];
|
|
}
|
|
|
|
export const SPECIAL_COMMANDS = {
|
|
SUBSYNC_TRIGGER: '__subsync-trigger',
|
|
RUNTIME_OPTIONS_OPEN: '__runtime-options-open',
|
|
RUNTIME_OPTION_CYCLE_PREFIX: '__runtime-option-cycle:',
|
|
REPLAY_SUBTITLE: '__replay-subtitle',
|
|
PLAY_NEXT_SUBTITLE: '__play-next-subtitle',
|
|
SHIFT_SUB_DELAY_TO_NEXT_SUBTITLE_START: '__sub-delay-next-line',
|
|
SHIFT_SUB_DELAY_TO_PREVIOUS_SUBTITLE_START: '__sub-delay-prev-line',
|
|
} as const;
|
|
|
|
export const DEFAULT_KEYBINDINGS: NonNullable<ResolvedConfig['keybindings']> = [
|
|
{ key: 'Space', command: ['cycle', 'pause'] },
|
|
{ key: 'KeyF', command: ['cycle', 'fullscreen'] },
|
|
{ key: 'KeyJ', command: ['cycle', 'sid'] },
|
|
{ key: 'Shift+KeyJ', command: ['cycle', 'secondary-sid'] },
|
|
{ key: 'ArrowRight', command: ['seek', 5] },
|
|
{ key: 'ArrowLeft', command: ['seek', -5] },
|
|
{ key: 'ArrowUp', command: ['seek', 60] },
|
|
{ key: 'ArrowDown', command: ['seek', -60] },
|
|
{ key: 'Shift+KeyH', command: ['sub-seek', -1] },
|
|
{ key: 'Shift+KeyL', command: ['sub-seek', 1] },
|
|
{ key: 'Shift+BracketRight', command: [SPECIAL_COMMANDS.SHIFT_SUB_DELAY_TO_NEXT_SUBTITLE_START] },
|
|
{
|
|
key: 'Shift+BracketLeft',
|
|
command: [SPECIAL_COMMANDS.SHIFT_SUB_DELAY_TO_PREVIOUS_SUBTITLE_START],
|
|
},
|
|
{ key: 'Ctrl+Shift+KeyH', command: [SPECIAL_COMMANDS.REPLAY_SUBTITLE] },
|
|
{ key: 'Ctrl+Shift+KeyL', command: [SPECIAL_COMMANDS.PLAY_NEXT_SUBTITLE] },
|
|
{ key: 'KeyQ', command: ['quit'] },
|
|
{ key: 'Ctrl+KeyW', command: ['quit'] },
|
|
];
|