diff options
Diffstat (limited to 'types')
-rw-r--r-- | types/ext/api.d.ts | 2 | ||||
-rw-r--r-- | types/ext/audio-downloader.d.ts | 10 | ||||
-rw-r--r-- | types/ext/cross-frame-api.d.ts | 13 | ||||
-rw-r--r-- | types/test/dom-text-scanner.d.ts | 32 | ||||
-rw-r--r-- | types/test/translator.d.ts (renamed from types/test/anki-note-builder.d.ts) | 25 |
5 files changed, 81 insertions, 1 deletions
diff --git a/types/ext/api.d.ts b/types/ext/api.d.ts index 6b7b4b19..2d78cc06 100644 --- a/types/ext/api.d.ts +++ b/types/ext/api.d.ts @@ -467,6 +467,6 @@ export type RequestBackendReadySignalResult = boolean; export type CreateActionPortDetails = Record<string, never>; export type CreateActionPortResult = { - name: string; + name: 'action-port'; id: string; }; diff --git a/types/ext/audio-downloader.d.ts b/types/ext/audio-downloader.d.ts index b8e812f8..dfda8cb9 100644 --- a/types/ext/audio-downloader.d.ts +++ b/types/ext/audio-downloader.d.ts @@ -42,3 +42,13 @@ export type AudioBinaryBase64 = { data: string; contentType: string | null; }; + +export type CustomAudioList = { + type: 'audioSourceList'; + audioSources: CustomAudioListSource[]; +}; + +export type CustomAudioListSource = { + url: string; + name?: string; +}; diff --git a/types/ext/cross-frame-api.d.ts b/types/ext/cross-frame-api.d.ts index 88ce59a7..e31079b7 100644 --- a/types/ext/cross-frame-api.d.ts +++ b/types/ext/cross-frame-api.d.ts @@ -52,3 +52,16 @@ export type Invocation = { ack: boolean; timer: Core.Timeout | null; }; + +export type PortDetails = CrossFrameCommunicationPortDetails | ActionPortDetails; + +export type CrossFrameCommunicationPortDetails = { + name: 'cross-frame-communication-port'; + otherTabId: number; + otherFrameId: number; +}; + +export type ActionPortDetails = { + name: 'action-port'; + id: string; +}; diff --git a/types/test/dom-text-scanner.d.ts b/types/test/dom-text-scanner.d.ts new file mode 100644 index 00000000..362a7eb5 --- /dev/null +++ b/types/test/dom-text-scanner.d.ts @@ -0,0 +1,32 @@ +/* + * Copyright (C) 2023 Yomitan Authors + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see <https://www.gnu.org/licenses/>. + */ + +export type TestData = { + node: string; + offset: number; + length: number; + forcePreserveWhitespace?: boolean; + generateLayoutContent?: boolean; + reversible?: boolean; + expected: { + node: string; + offset: number; + content: string; + remainder?: number; + }; +}; + diff --git a/types/test/anki-note-builder.d.ts b/types/test/translator.d.ts index 0ccb25e9..3e4c8b9d 100644 --- a/types/test/anki-note-builder.d.ts +++ b/types/test/translator.d.ts @@ -17,6 +17,9 @@ import type {OptionsPresetObject} from 'dev/vm'; import type {FindTermsMode} from 'translator'; +import type {DictionaryEntry} from 'dictionary'; +import type {NoteData} from 'anki-templates'; +import type {NoteFields} from 'anki'; export type TranslatorTestInputs = { optionsPresets: OptionsPresetObject; @@ -39,3 +42,25 @@ export type TestInputFindTerm = { text: string; options: string; }; + +export type TranslatorTestResults = TranslatorTestResult[]; + +export type TranslatorTestResult = { + name: string; + originalTextLength?: number; + dictionaryEntries: DictionaryEntry[]; +}; + +export type TranslatorTestNoteDataResults = TranslatorTestNoteDataResult[]; + +export type TranslatorTestNoteDataResult = { + name: string; + noteDataList: NoteData[]; +}; + +export type AnkiNoteBuilderTestResults = AnkiNoteBuilderTestResult[]; + +export type AnkiNoteBuilderTestResult = { + name: string; + results: NoteFields[] | null; +}; |