refactor: split startup lifecycle and Anki service architecture

This commit is contained in:
2026-02-14 22:31:21 -08:00
parent 41f7d754cd
commit 162223943d
30 changed files with 1603 additions and 312 deletions

View File

@@ -49,6 +49,7 @@ export interface MergedToken {
endPos: number;
partOfSpeech: PartOfSpeech;
isMerged: boolean;
isKnown: boolean;
}
export interface WindowGeometry {
@@ -150,7 +151,8 @@ export interface KikuMergePreviewResponse {
export type RuntimeOptionId =
| "anki.autoUpdateNewCards"
| "anki.kikuFieldGrouping";
| "anki.kikuFieldGrouping"
| "anki.nPlusOneMatchMode";
export type RuntimeOptionScope = "ankiConnect";
@@ -158,6 +160,8 @@ export type RuntimeOptionValueType = "boolean" | "enum";
export type RuntimeOptionValue = boolean | string;
export type NPlusOneMatchMode = "headword" | "surface";
export interface RuntimeOptionState {
id: RuntimeOptionId;
label: string;
@@ -221,14 +225,20 @@ export interface AnkiConnectConfig {
fallbackDuration?: number;
maxMediaDuration?: number;
};
behavior?: {
overwriteAudio?: boolean;
overwriteImage?: boolean;
mediaInsertMode?: "append" | "prepend";
highlightWord?: boolean;
notificationType?: "osd" | "system" | "both" | "none";
autoUpdateNewCards?: boolean;
nPlusOne?: {
highlightEnabled?: boolean;
refreshMinutes?: number;
matchMode?: NPlusOneMatchMode;
decks?: string[];
};
behavior?: {
overwriteAudio?: boolean;
overwriteImage?: boolean;
mediaInsertMode?: "append" | "prepend";
highlightWord?: boolean;
notificationType?: "osd" | "system" | "both" | "none";
autoUpdateNewCards?: boolean;
};
metadata?: {
pattern?: string;
};
@@ -363,6 +373,12 @@ export interface ResolvedConfig {
fallbackDuration: number;
maxMediaDuration: number;
};
nPlusOne: {
highlightEnabled: boolean;
refreshMinutes: number;
matchMode: NPlusOneMatchMode;
decks: string[];
};
behavior: {
overwriteAudio: boolean;
overwriteImage: boolean;