Pop-up dictionary browser extension for language learning. Successor to Yomichan. (PERSONAL FORK)
1/*
2 * Copyright (C) 2023-2025 Yomitan Authors
3 *
4 * This program is free software: you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License as published by
6 * the Free Software Foundation, either version 3 of the License, or
7 * (at your option) any later version.
8 *
9 * This program is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details.
13 *
14 * You should have received a copy of the GNU General Public License
15 * along with this program. If not, see <https://www.gnu.org/licenses/>.
16 */
17
18import type * as Anki from './anki';
19import type * as AnkiNoteBuilder from './anki-note-builder';
20import type * as AnkiTemplates from './anki-templates';
21import type * as Settings from './settings';
22
23export type LogData = {
24 ankiNoteData: AnkiTemplates.NoteData | undefined;
25 ankiNoteDataException: Error | undefined;
26 ankiNotes: AnkiNoteLogData[];
27};
28
29export type AnkiNoteLogData = {
30 cardFormatIndex: number;
31 note: Anki.Note | undefined;
32 errors?: Error[];
33 requirements?: AnkiNoteBuilder.Requirement[];
34};
35
36export type DictionaryEntryDetails = {
37 noteMap: Map<number, DictionaryEntryNoteDetails>;
38};
39
40export type DictionaryEntryNoteDetails = {
41 cardFormat: Settings.AnkiCardFormat;
42 note: Anki.Note;
43 errors: Error[];
44 requirements: AnkiNoteBuilder.Requirement[];
45 canAdd: boolean;
46 valid: boolean;
47 /**
48 * Anki IDs of duplicate notes. May contain INVALID_NOTE_ID for notes whose ID could not be found.
49 */
50 noteIds: Anki.NoteId[] | null;
51 noteInfos?: (Anki.NoteInfo | null)[];
52 ankiError: Error | null;
53};
54
55export type CreateNoteResult = {
56 note: Anki.Note;
57 errors: Error[];
58 requirements: AnkiNoteBuilder.Requirement[];
59};
60
61export type RGB = {
62 red: number;
63 green: number;
64 blue: number;
65};