/
return.d.ts
52 lines (43 loc) · 1.18 KB
/
return.d.ts
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
import { MbBook, MbBookNote } from "@alx-plugins/marginnote";
export type Selection = { sel: string; book?: MbBook };
export type inHistory = Data | null;
export type time = number | null;
export type item = {
data: Exclude<inHistory, null>;
addTime: Exclude<time, null>;
} | null;
export type Data = Selection | MbBookNote | Toc;
export type DataType = "sel" | "note" | "toc";
export type MNMark = "<!--MN-->\n";
type ReturnBody_Basic = {
type: DataType;
sendTime: ReturnType<typeof Date.now>;
data: Data;
last: item | null;
};
export type ReturnBody = ReturnBody_Note | ReturnBody_Sel | ReturnBody_Toc;
export interface ReturnBody_Sel extends ReturnBody_Basic {
type: "sel";
data: Selection;
book?: MbBook;
}
export interface ReturnBody_Note extends ReturnBody_Basic {
type: "note";
data: MbBookNote;
/** id - base64(png) pair */
mediaMap: Record<string, string>;
bookMap: Record<string, MbBook>;
}
export interface ReturnBody_Toc extends ReturnBody_Basic {
type: "toc";
data: Toc;
bookMap: Record<string, MbBook>;
}
export interface Toc {
noteTitle: string;
noteId: string;
docMd5?: string;
startPage?: number;
endPage?: number;
childNotes: Toc[];
}