xref: /MusicFree/src/types/common.d.ts (revision 6613e77203923e5b1742a49281bfa5de03fc1440)
1declare namespace ICommon {
2    /** 支持搜索的媒体类型 */
3    export type SupportMediaType =
4        | 'music'
5        | 'album'
6        | 'artist'
7        | 'sheet'
8        | 'lyric';
9
10    /** 媒体定义 */
11    export type SupportMediaItemBase = {
12        music: IMusic.IMusicItemBase;
13        album: IAlbum.IAlbumItemBase;
14        artist: IArtist.IArtistItemBase;
15        sheet: IMusic.IMusicSheetItemBase;
16        lyric: ILyric.ILyricItem;
17    };
18
19    export type IUnique = {
20        id: string;
21        [k: string | symbol]: any;
22    };
23
24    export type IMediaBase = {
25        id: string;
26        platform: string;
27        $?: any;
28        [k: symbol]: any;
29        [k: string]: any;
30    };
31
32    /** 一些额外信息 */
33    export type IMediaMeta = {
34        /** 关联歌词信息 */
35        associatedLrc?: IMediaBase;
36        /** 是否下载过 TODO: 删去 */
37        downloaded?: boolean;
38        /** 本地下载路径 */
39        localPath?: string;
40        /** 补充的音乐信息 */
41        mediaItem?: Partial<IMediaBase>;
42        /** 歌词偏移 */
43        lyricOffset?: number;
44
45        lrc?: string;
46        headers?: Record<string, any>;
47        url?: string;
48        id?: string;
49        platform?: string;
50        qualities?: IMusic.IQuality;
51        $?: {
52            local?: {
53                localLrc?: string;
54                [k: string]: any;
55            };
56            [k: string]: any;
57        };
58        [k: string]: any;
59        [k: symbol]: any;
60    };
61
62    export type WithMusicList<T> = T & {
63        musicList?: IMusic.IMusicItem[];
64    };
65
66    export type PaginationResponse<T> = {
67        isEnd?: boolean;
68        data?: T[];
69    };
70
71    export interface IPoint {
72        x: number;
73        y: number;
74    }
75}
76