about summary refs log tree commit diff stats
path: root/src/index.d.ts
blob: 002b1797c069a61c34272613e4932a7efb076f82 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
declare interface EpubeApp {
    setPage(page: 'PAGE_LIBRARY' | 'PAGE_FAVORITES' | 'PAGE_READER' | 'PAGE_OFFLINE' | 'PAGE_LOGIN'): void;
    setTitle(title: string): void;
    showActionBar(visible: boolean): void;
    toggleActionBar(): void;
    isNightMode(): boolean;
    isOnline(): boolean;
    setStatusBarColor(r: number, g: number, b: number): void;
    setAccentColor(r: number, g: number, b: number): void;
    setOffline(offline: boolean): void;
}

declare interface DownloadFormat {
    format: string;
    id: number;
}

declare interface BookInfo {
    id: number;
    title: string;
    author_sort: string;
    series_name: string;
    series_index: number;
    cover_link: string;
    in_progress: boolean;
    is_read: boolean;
    is_fav: boolean;
    epub_id: number;
    download_formats: DownloadFormat[];
    comment: string;
    has_cover: boolean;
}

declare interface BookList {
    books: BookInfo[];
    total: number;
    offset: number;
    limit: number;
}

declare interface LastRead {
    cfi: string;
    page: number;
    total: number;
}

declare var EpubeApp: EpubeApp;

declare var localforage: LocalForage;

declare const BUILD_CACHE_VERSION: string;
declare const BUILD_MANIFEST_ASSETS: [];

declare const BUILD_VERSION: string;

/** Pattern definition as produced by the hyphen library's build process. */
interface HyphenPatternDefinition {
    patterns: string[];
    exceptions?: string[];
}

/** Optional configuration for createHyphenator. */
interface CreateHyphenatorOptions {
    async?: boolean;
    debug?: boolean;
    html?: boolean;
    hyphenChar?: string;
    minWordLength?: number;
}

/** A hyphenation function: takes text, returns hyphenated HTML, technically this could also return a promise in async mode but we don't use it */
interface HyphenatorFunction {
    (text: string, options?: { debug?: boolean; hyphenChar?: string; minWordLength?: number }): string | Promise<string>
}

/** Language-code -> hyphenator function map. */
type HyphenateMap = Record<string, HyphenatorFunction>;

declare var hyphenationPatternsEnUs: HyphenPatternDefinition;
declare var hyphenationPatternsRu: HyphenPatternDefinition;
declare var createHyphenator: {
    (patternsDefinition: HyphenPatternDefinition, options?: CreateHyphenatorOptions): HyphenatorFunction;
};