mirror of
https://github.com/ksyasuda/SubMiner.git
synced 2026-05-26 12:55:16 -07:00
d673de75f6
- Replace subminer.conf plugin config with mpv.* fields in config.jsonc - Add socketPath, backend, autoStartSubMiner, pauseUntilOverlayReady, aniskipEnabled/buttonKey, subminerBinaryPath to mpv config - Add subtitleSidebar.css field; migrate legacy sidebar appearance fields - Add paintOrder and WebkitTextStroke to subtitle style options - Update default subtitle/sidebar fontFamily to CJK-first stack - Fix overlay visible state surviving mpv y-r restart - Fix live config saves applying subtitle CSS immediately to open overlays - Migrate legacy primary/secondary subtitle appearance into subtitleStyle.css on load - Switch AniSkip button key setting to click-to-learn key capture
105 lines
2.5 KiB
TypeScript
105 lines
2.5 KiB
TypeScript
import type { ConfigValidationWarning } from './config';
|
|
|
|
export type ConfigSettingsCategory =
|
|
| 'appearance'
|
|
| 'behavior'
|
|
| 'mining-anki'
|
|
| 'input'
|
|
| 'integrations'
|
|
| 'tracking-app'
|
|
| 'advanced';
|
|
|
|
export type ConfigSettingsControl =
|
|
| 'boolean'
|
|
| 'number'
|
|
| 'text'
|
|
| 'textarea'
|
|
| 'select'
|
|
| 'color'
|
|
| 'string-list'
|
|
| 'json'
|
|
| 'secret'
|
|
| 'keyboard-shortcut'
|
|
| 'key-code'
|
|
| 'mpv-key'
|
|
| 'known-words-decks'
|
|
| 'anki-note-type'
|
|
| 'anki-field'
|
|
| 'mpv-keybindings'
|
|
| 'color-list'
|
|
| 'css-declarations';
|
|
|
|
export type ConfigSettingsRestartBehavior = 'hot-reload' | 'restart';
|
|
|
|
export interface ConfigSettingsField {
|
|
id: string;
|
|
label: string;
|
|
description: string;
|
|
configPath: string;
|
|
category: ConfigSettingsCategory;
|
|
section: string;
|
|
subsection?: string;
|
|
control: ConfigSettingsControl;
|
|
defaultValue: unknown;
|
|
enumValues?: readonly string[];
|
|
restartBehavior: ConfigSettingsRestartBehavior;
|
|
advanced?: boolean;
|
|
secret?: boolean;
|
|
legacyHidden?: boolean;
|
|
settingsHidden?: boolean;
|
|
}
|
|
|
|
export type ConfigSettingsSnapshotValue = unknown;
|
|
|
|
export interface ConfigSettingsSnapshot {
|
|
configPath: string;
|
|
fields: ConfigSettingsField[];
|
|
values: Record<string, ConfigSettingsSnapshotValue>;
|
|
warnings: ConfigValidationWarning[];
|
|
}
|
|
|
|
export type ConfigSettingsPatchOperation =
|
|
| {
|
|
op: 'set';
|
|
path: string;
|
|
value: unknown;
|
|
}
|
|
| {
|
|
op: 'reset';
|
|
path: string;
|
|
};
|
|
|
|
export interface ConfigSettingsPatch {
|
|
operations: ConfigSettingsPatchOperation[];
|
|
}
|
|
|
|
export interface ConfigSettingsSaveResult {
|
|
ok: boolean;
|
|
snapshot?: ConfigSettingsSnapshot;
|
|
warnings?: ConfigValidationWarning[];
|
|
error?: string;
|
|
hotReloadFields: string[];
|
|
restartRequiredFields: string[];
|
|
restartRequiredSections?: string[];
|
|
}
|
|
|
|
export interface ConfigSettingsAPI {
|
|
getSnapshot(): Promise<ConfigSettingsSnapshot>;
|
|
savePatch(patch: ConfigSettingsPatch): Promise<ConfigSettingsSaveResult>;
|
|
openSettingsFile(): Promise<boolean>;
|
|
openSettingsWindow(): Promise<boolean>;
|
|
getAnkiDeckNames(draftUrl?: string): Promise<ConfigSettingsAnkiListResult>;
|
|
getAnkiDeckFieldNames(deckName: string, draftUrl?: string): Promise<ConfigSettingsAnkiListResult>;
|
|
getAnkiModelNames(draftUrl?: string): Promise<ConfigSettingsAnkiListResult>;
|
|
getAnkiModelFieldNames(
|
|
modelName: string,
|
|
draftUrl?: string,
|
|
): Promise<ConfigSettingsAnkiListResult>;
|
|
}
|
|
|
|
export interface ConfigSettingsAnkiListResult {
|
|
ok: boolean;
|
|
values: string[];
|
|
error?: string;
|
|
}
|