Files
suwayomi-material-you-webui/src/typings.d.ts

334 lines
6.7 KiB
TypeScript
Raw Normal View History

/*
* Copyright (C) Contributors to the Suwayomi project
*
* This Source Code Form is subject to the terms of the Mozilla Public
2021-01-26 23:32:12 +03:30
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at https://mozilla.org/MPL/2.0/. */
2020-12-24 16:50:50 +01:00
interface IExtension {
name: string
pkgName: string
2020-12-24 16:50:50 +01:00
versionName: string
versionCode: number
lang: string
isNsfw: boolean
2020-12-25 03:08:08 +03:30
apkName: string
iconUrl: string
2021-03-29 02:47:51 +04:30
installed: boolean
hasUpdate: boolean
2021-03-29 02:47:51 +04:30
obsolete: boolean
2020-12-24 16:50:50 +01:00
}
2020-12-25 06:36:34 +03:30
interface ISource {
2020-12-25 22:14:54 +03:30
id: string
2020-12-25 06:36:34 +03:30
name: string
lang: string
iconUrl: string
supportsLatest: boolean
2021-07-31 05:06:46 +04:30
isConfigurable: boolean
2021-09-03 04:47:02 +04:30
isNsfw: boolean
2021-09-18 00:03:42 +04:30
displayName: string
2020-12-25 06:36:34 +03:30
}
2020-12-25 17:42:22 +01:00
interface ISourceFilters {
type: string
filter: ISourceFilter
}
interface ISourceFilter {
name: string
state: number | string | boolean | ISourceFilters[] | IState
values?: string[]
2022-06-24 21:06:12 +01:00
displayValues?: string[]
selected?: ISelected
}
interface ISelected {
displayname: string
value: string
_value: string
}
interface IState {
ascending: boolean
index: number
}
interface IMetadataMigration {
appKeyPrefix?: { oldPrefix: string, newPrefix: string }
keys?: { oldKey: string, newKey: string }[]
}
Save reader settings per manga in Meta (#216) * [#213] Add missing "meta" property - IManga - IMangaCard (optional) - IChapter - ICategory * [#213] Add util functions for handling metadata - global server - manga - chapter - category * [#213] Use "ReaderSettings" from the manga metadata - get ReaderSettings from manga metadata - remove unnecessary check "make sure settings has all the keys" in case the stored settings in the metadata are outdated they will be filled with default values * [#213] Reload manga only in case "mangaId" changed In case the chapter is still from the same manga, a reload is unnecessary * [#213] Only update the changed reader setting Otherwise the app has to send patch requests to the server for every setting even if it didn't change * [#213] Hide "openButton" on first render in case "navBar" is shown The "openButton" was always set to be visible event in case the navBar was shown on the first render * [#213] Open the "ReaderNavBar" if needed after receiving new settings Otherwise, the drawer won't open in case the "navBar" was hidden on the first render since the default state in that case was set to false * [#213] Update "ReaderSettings" after receiving the manga response Otherwise, the default settings aren't getting removed * [#213] Hide/Show "OpenButton" when opening/closing the drawer Otherwise, the button stays hidden until it gets updated due to scrolling * [#213] Keep "ReaderNavBar" state when opening prev/next chapter In case the navBar wasn't sticky but opened, it got closed when the prev/next chapter got opened * [#213] Prevent "ReaderNavBar" from closing when changing "staticNav" setting
2023-01-06 17:15:29 +01:00
interface IMetadata<VALUES extends AllowedMetadataValueTypes = string> {
[key: string]: VALUES;
}
interface IMetadataHolder<VALUES extends AllowedMetadataValueTypes = string> {
meta?: IMetadata<VALUES>
}
type AllowedMetadataValueTypes = string | boolean | number | undefined;
type MangaMetadataKeys = keyof IReaderSettings;
type AppMetadataKeys = MangaMetadataKeys;
type MetadataKeyValuePair = [AppMetadataKeys, AllowedMetadataValueTypes];
interface IMangaCard {
id: number
title: string
thumbnailUrl: string
unreadCount?: number
downloadCount?: number
inLibrary?: boolean
Save reader settings per manga in Meta (#216) * [#213] Add missing "meta" property - IManga - IMangaCard (optional) - IChapter - ICategory * [#213] Add util functions for handling metadata - global server - manga - chapter - category * [#213] Use "ReaderSettings" from the manga metadata - get ReaderSettings from manga metadata - remove unnecessary check "make sure settings has all the keys" in case the stored settings in the metadata are outdated they will be filled with default values * [#213] Reload manga only in case "mangaId" changed In case the chapter is still from the same manga, a reload is unnecessary * [#213] Only update the changed reader setting Otherwise the app has to send patch requests to the server for every setting even if it didn't change * [#213] Hide "openButton" on first render in case "navBar" is shown The "openButton" was always set to be visible event in case the navBar was shown on the first render * [#213] Open the "ReaderNavBar" if needed after receiving new settings Otherwise, the drawer won't open in case the "navBar" was hidden on the first render since the default state in that case was set to false * [#213] Update "ReaderSettings" after receiving the manga response Otherwise, the default settings aren't getting removed * [#213] Hide/Show "OpenButton" when opening/closing the drawer Otherwise, the button stays hidden until it gets updated due to scrolling * [#213] Keep "ReaderNavBar" state when opening prev/next chapter In case the navBar wasn't sticky but opened, it got closed when the prev/next chapter got opened * [#213] Prevent "ReaderNavBar" from closing when changing "staticNav" setting
2023-01-06 17:15:29 +01:00
meta?: IMetadata
}
2020-12-25 17:42:22 +01:00
interface IManga {
2021-01-19 20:20:28 +03:30
id: number
sourceId: string
url: string
2020-12-25 22:14:54 +03:30
title: string
thumbnailUrl: string
2021-09-05 01:11:25 +04:30
artist: string
author: string
description: string
genre: string[]
status: string
inLibrary: boolean
source: ISource
Save reader settings per manga in Meta (#216) * [#213] Add missing "meta" property - IManga - IMangaCard (optional) - IChapter - ICategory * [#213] Add util functions for handling metadata - global server - manga - chapter - category * [#213] Use "ReaderSettings" from the manga metadata - get ReaderSettings from manga metadata - remove unnecessary check "make sure settings has all the keys" in case the stored settings in the metadata are outdated they will be filled with default values * [#213] Reload manga only in case "mangaId" changed In case the chapter is still from the same manga, a reload is unnecessary * [#213] Only update the changed reader setting Otherwise the app has to send patch requests to the server for every setting even if it didn't change * [#213] Hide "openButton" on first render in case "navBar" is shown The "openButton" was always set to be visible event in case the navBar was shown on the first render * [#213] Open the "ReaderNavBar" if needed after receiving new settings Otherwise, the drawer won't open in case the "navBar" was hidden on the first render since the default state in that case was set to false * [#213] Update "ReaderSettings" after receiving the manga response Otherwise, the default settings aren't getting removed * [#213] Hide/Show "OpenButton" when opening/closing the drawer Otherwise, the button stays hidden until it gets updated due to scrolling * [#213] Keep "ReaderNavBar" state when opening prev/next chapter In case the navBar wasn't sticky but opened, it got closed when the prev/next chapter got opened * [#213] Prevent "ReaderNavBar" from closing when changing "staticNav" setting
2023-01-06 17:15:29 +01:00
meta: IMetadata
2021-09-05 01:11:25 +04:30
Save reader settings per manga in Meta (#216) * [#213] Add missing "meta" property - IManga - IMangaCard (optional) - IChapter - ICategory * [#213] Add util functions for handling metadata - global server - manga - chapter - category * [#213] Use "ReaderSettings" from the manga metadata - get ReaderSettings from manga metadata - remove unnecessary check "make sure settings has all the keys" in case the stored settings in the metadata are outdated they will be filled with default values * [#213] Reload manga only in case "mangaId" changed In case the chapter is still from the same manga, a reload is unnecessary * [#213] Only update the changed reader setting Otherwise the app has to send patch requests to the server for every setting even if it didn't change * [#213] Hide "openButton" on first render in case "navBar" is shown The "openButton" was always set to be visible event in case the navBar was shown on the first render * [#213] Open the "ReaderNavBar" if needed after receiving new settings Otherwise, the drawer won't open in case the "navBar" was hidden on the first render since the default state in that case was set to false * [#213] Update "ReaderSettings" after receiving the manga response Otherwise, the default settings aren't getting removed * [#213] Hide/Show "OpenButton" when opening/closing the drawer Otherwise, the button stays hidden until it gets updated due to scrolling * [#213] Keep "ReaderNavBar" state when opening prev/next chapter In case the navBar wasn't sticky but opened, it got closed when the prev/next chapter got opened * [#213] Prevent "ReaderNavBar" from closing when changing "staticNav" setting
2023-01-06 17:15:29 +01:00
realUrl: string
2021-09-05 01:11:25 +04:30
freshData: boolean
unreadCount?: number
downloadCount?: number
age: number
chaptersAge: number
2021-09-05 01:11:25 +04:30
}
2021-01-19 21:02:57 +03:30
interface IChapter {
id: number
2021-01-19 21:02:57 +03:30
url: string
name: string
2021-05-11 18:45:53 +04:30
uploadDate: number
chapterNumber: number
2021-08-10 09:40:43 +04:30
scanlator: string
2021-01-20 00:04:12 +03:30
mangaId: number
2021-05-11 18:45:53 +04:30
read: boolean
bookmarked: boolean
lastPageRead: number
lastReadAt: number
2021-05-14 17:31:07 +04:30
index: number
2021-09-28 00:41:12 +03:30
fetchedAt: number
2021-03-23 03:50:55 +04:30
chapterCount: number
2021-02-04 03:42:30 +03:30
pageCount: number
2021-05-30 04:01:49 +04:30
downloaded: boolean
Save reader settings per manga in Meta (#216) * [#213] Add missing "meta" property - IManga - IMangaCard (optional) - IChapter - ICategory * [#213] Add util functions for handling metadata - global server - manga - chapter - category * [#213] Use "ReaderSettings" from the manga metadata - get ReaderSettings from manga metadata - remove unnecessary check "make sure settings has all the keys" in case the stored settings in the metadata are outdated they will be filled with default values * [#213] Reload manga only in case "mangaId" changed In case the chapter is still from the same manga, a reload is unnecessary * [#213] Only update the changed reader setting Otherwise the app has to send patch requests to the server for every setting even if it didn't change * [#213] Hide "openButton" on first render in case "navBar" is shown The "openButton" was always set to be visible event in case the navBar was shown on the first render * [#213] Open the "ReaderNavBar" if needed after receiving new settings Otherwise, the drawer won't open in case the "navBar" was hidden on the first render since the default state in that case was set to false * [#213] Update "ReaderSettings" after receiving the manga response Otherwise, the default settings aren't getting removed * [#213] Hide/Show "OpenButton" when opening/closing the drawer Otherwise, the button stays hidden until it gets updated due to scrolling * [#213] Keep "ReaderNavBar" state when opening prev/next chapter In case the navBar wasn't sticky but opened, it got closed when the prev/next chapter got opened * [#213] Prevent "ReaderNavBar" from closing when changing "staticNav" setting
2023-01-06 17:15:29 +01:00
meta: IAppMetadata
2021-01-19 21:02:57 +03:30
}
2021-02-20 01:23:52 +03:30
2021-09-28 00:41:12 +03:30
interface IMangaChapter {
manga: IManga
chapter: IChapter
}
interface IPartialChapter {
2021-03-23 03:50:55 +04:30
pageCount: number
2021-05-14 17:31:07 +04:30
index: number
2021-03-23 03:50:55 +04:30
chapterCount: number
lastPageRead: number
2021-03-23 03:50:55 +04:30
}
2021-02-20 01:23:52 +03:30
interface ICategory {
id: number
order: number
2021-05-30 04:01:49 +04:30
name: string
default: boolean
Save reader settings per manga in Meta (#216) * [#213] Add missing "meta" property - IManga - IMangaCard (optional) - IChapter - ICategory * [#213] Add util functions for handling metadata - global server - manga - chapter - category * [#213] Use "ReaderSettings" from the manga metadata - get ReaderSettings from manga metadata - remove unnecessary check "make sure settings has all the keys" in case the stored settings in the metadata are outdated they will be filled with default values * [#213] Reload manga only in case "mangaId" changed In case the chapter is still from the same manga, a reload is unnecessary * [#213] Only update the changed reader setting Otherwise the app has to send patch requests to the server for every setting even if it didn't change * [#213] Hide "openButton" on first render in case "navBar" is shown The "openButton" was always set to be visible event in case the navBar was shown on the first render * [#213] Open the "ReaderNavBar" if needed after receiving new settings Otherwise, the drawer won't open in case the "navBar" was hidden on the first render since the default state in that case was set to false * [#213] Update "ReaderSettings" after receiving the manga response Otherwise, the default settings aren't getting removed * [#213] Hide/Show "OpenButton" when opening/closing the drawer Otherwise, the button stays hidden until it gets updated due to scrolling * [#213] Keep "ReaderNavBar" state when opening prev/next chapter In case the navBar wasn't sticky but opened, it got closed when the prev/next chapter got opened * [#213] Prevent "ReaderNavBar" from closing when changing "staticNav" setting
2023-01-06 17:15:29 +01:00
meta: IAppMetadata
2021-02-20 01:23:52 +03:30
}
2021-03-18 21:46:24 +03:30
interface INavbarOverride {
status: boolean
value: any
2021-03-29 02:47:51 +04:30
}
2021-05-15 17:18:57 +04:30
2021-05-15 23:22:37 +04:30
type ReaderType =
2021-09-13 19:18:21 +04:30
'ContinuesVertical' |
2021-05-15 23:22:37 +04:30
'Webtoon' |
'SingleVertical' |
'SingleRTL' |
'SingleLTR' |
'DoubleVertical' |
'DoubleRTL' |
'DoubleLTR' |
2021-09-13 19:18:21 +04:30
'ContinuesHorizontalLTR' |
'ContinuesHorizontalRTL';
2021-05-15 23:22:37 +04:30
2021-05-15 17:18:57 +04:30
interface IReaderSettings{
staticNav: boolean
showPageNumber: boolean
loadNextOnEnding: boolean
2021-05-15 23:22:37 +04:30
readerType: ReaderType
2021-05-15 17:18:57 +04:30
}
interface IReaderPage {
index: number
src: string
}
2021-05-15 23:22:37 +04:30
interface IReaderProps {
pages: Array<IReaderPage>
pageCount: number
setCurPage: React.Dispatch<React.SetStateAction<number>>
curPage: number
initialPage: number
2021-05-15 23:22:37 +04:30
settings: IReaderSettings
manga: IMangaCard | IManga
chapter: IChapter | IPartialChapter
nextChapter: () => void
prevChapter: () => void
2021-05-15 23:22:37 +04:30
}
2021-05-25 21:06:27 +04:30
interface IAbout {
name: string
version: string
revision: string
buildType: 'Stable' | 'Preview'
buildTime: number
github: string
discord: string
}
2021-05-30 04:01:49 +04:30
interface IDownloadChapter{
chapterIndex: number
mangaId: number
state: 'Queued' | 'Downloading' | 'Finished' | 'Error'
progress: number
chapter: IChapter
manga: IManga
2021-05-30 04:01:49 +04:30
}
interface IQueue {
status: 'Stopped' | 'Started'
queue: IDownloadChapter[]
}
interface IUpdateStatus {
running: boolean
statusMap: {
COMPLETE?: IManga[],
RUNNING?: IManga[],
PENDING?: IManga[]
}
}
interface PreferenceProps {
key: string
title: string
summary: string
defaultValue: any
currentValue: any
defaultValueType: string
2021-09-13 19:18:21 +04:30
// intetnal props
updateValue: any
}
2021-09-13 19:18:21 +04:30
interface TwoStatePreferenceProps extends PreferenceProps {
2021-09-13 19:18:21 +04:30
// intetnal props
type: 'Switch' | 'Checkbox'
}
interface CheckBoxPreferenceProps extends PreferenceProps {}
2021-09-13 19:18:21 +04:30
interface SwitchPreferenceCompatProps extends PreferenceProps {}
2021-09-13 19:18:21 +04:30
interface ListPreferenceProps extends PreferenceProps {
entries: string[]
entryValues: string[]
}
interface MultiSelectListPreferenceProps extends PreferenceProps {
entries: string[]
entryValues: string[]
}
2021-09-13 19:18:21 +04:30
interface EditTextPreferenceProps extends PreferenceProps {
dialogTitle: string
dialogMessage: string
text: string
}
interface SourcePreferences {
type: string
props: any
}
2021-10-30 17:29:27 +03:30
interface NavbarItem {
path: string,
title:string,
2021-10-30 17:29:27 +03:30
SelectedIconComponent: OverridableComponent<SvgIconTypeMap<{}, 'svg'>>,
IconComponent: OverridableComponent<SvgIconTypeMap<{}, 'svg'>>,
show: 'mobile' | 'desktop' | 'both'
}
interface PaginatedList<T> {
page: T[],
hasNextPage: boolean
}
2021-12-13 19:52:56 +05:30
type NullAndUndefined<T> = T | null | undefined;
type ChapterSortMode = 'fetchedAt' | 'source';
2021-12-13 19:52:56 +05:30
interface ChapterListOptions {
active: boolean
unread: NullAndUndefined<boolean>
downloaded: NullAndUndefined<boolean>
bookmarked: NullAndUndefined<boolean>
reverse: boolean
sortBy: ChapterSortMode
2021-12-13 19:52:56 +05:30
showChapterNumber: boolean
}
type ChapterOptionsReducerAction =
{ type: 'filter', filterType:string, filterValue: NullAndUndefined<boolean> }
| { type: 'sortBy', sortBy: ChapterSortMode }
| { type: 'sortReverse' }
| { type: 'showChapterNumber' };
2022-03-03 18:19:01 +05:30
type LibrarySortMode = 'sortToRead' | 'sortAlph' | 'sortID';
enum GridLayout {
Compact = 0,
Comfortable = 1,
List = 2,
}
interface LibraryOptions {
// display options
2022-03-03 18:19:01 +05:30
showDownloadBadge: boolean
showUnreadBadge: boolean
gridLayout: GridLayout
SourcegridLayout: GridLayout
// filter options
downloaded: NullAndUndefined<boolean>
unread: NullAndUndefined<boolean>
sorts: NullAndUndefined<LibrarySortMode>
sortDesc: NullAndUndefined<boolean>
2022-03-03 18:19:01 +05:30
}
interface BatchChaptersChange {
delete?: boolean
isRead?: boolean
isBookmarked?: boolean
lastPageRead?: number
}