Pop-up dictionary browser extension for language learning. Successor to Yomichan. (PERSONAL FORK)
at lambda-fork/main 90 lines 2.1 kB view raw
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 Core from './core'; 19import type * as Settings from './settings'; 20 21export type NoteId = number; 22 23export type CardId = number; 24 25export type NoteWithId = Note & {id: NoteId}; 26 27export type Note = { 28 fields: NoteFields; 29 tags: string[]; 30 deckName: string; 31 modelName: string; 32 options: { 33 allowDuplicate: boolean; 34 duplicateScope: Settings.AnkiDuplicateScope; 35 duplicateScopeOptions: { 36 deckName: string | null; 37 checkChildren: boolean; 38 checkAllModels: boolean; 39 }; 40 }; 41}; 42 43export type NoteFields = { 44 [field: string]: string; 45}; 46 47export type NoteInfoWrapper = { 48 canAdd: boolean; 49 valid: boolean; 50 noteIds: NoteId[] | null; 51 noteInfos?: (NoteInfo | null)[]; 52}; 53 54export type NoteInfo = { 55 noteId: NoteId; 56 tags: string[]; 57 fields: {[key: string]: NoteFieldInfo}; 58 modelName: string; 59 cards: CardId[]; 60 cardsInfo: CardInfo[]; 61}; 62 63export type NoteFieldInfo = { 64 value: string; 65 order: number; 66}; 67 68export type CardInfo = { 69 noteId: NoteId; 70 cardId: CardId; 71 flags: number; 72 cardState: number; 73}; 74 75export type ApiReflectResult = { 76 scopes: string[]; 77 actions: string[]; 78}; 79 80export type MessageBody = { 81 action: string; 82 params: Core.SerializableObject; 83 version: number; 84 key?: string; 85}; 86 87export type CanAddNotesDetail = { 88 canAdd: boolean; 89 error: string | null; 90};