mirror of
https://github.com/ksyasuda/SubMiner.git
synced 2026-05-26 00:55:16 -07:00
0354a0e74b
- subtitleStyle.css / subtitleStyle.secondary.css replace flat style fields in the settings window - ankiConnect.nPlusOne.enabled gates known-word cache independently of knownWords.highlightEnabled - Settings search now covers all categories, narrows on multi-word terms, and hides editor-owned fields - Default note-type picker to Kiku then Lapis; rename isLapis.sentenceCardModel default to "Lapis"
105 lines
2.5 KiB
TypeScript
105 lines
2.5 KiB
TypeScript
import type { ConfigValidationWarning } from './config';
|
|
|
|
export type ConfigSettingsCategory =
|
|
| 'appearance'
|
|
| 'behavior'
|
|
| 'mining-anki'
|
|
| 'playback-sources'
|
|
| 'input'
|
|
| 'integrations'
|
|
| 'tracking-app'
|
|
| 'advanced';
|
|
|
|
export type ConfigSettingsControl =
|
|
| 'boolean'
|
|
| 'number'
|
|
| 'text'
|
|
| 'textarea'
|
|
| 'select'
|
|
| 'color'
|
|
| 'string-list'
|
|
| 'json'
|
|
| 'secret'
|
|
| 'keyboard-shortcut'
|
|
| 'key-code'
|
|
| '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;
|
|
}
|