refactor: Migrate the project functionality and optimize the code structure

This commit is contained in:
hayden
2024-10-12 17:31:11 +08:00
committed by hayden
parent d96aff80c2
commit c1747a79f3
71 changed files with 6741 additions and 1320 deletions

69
src/types/typings.d.ts vendored Normal file
View File

@@ -0,0 +1,69 @@
interface BaseModel {
id: number | string
fullname: string
basename: string
extension: string
sizeBytes: number
type: string
pathIndex: number
preview: string | string[]
description: string
metadata: Record<string, string>
}
interface Model extends BaseModel {
createdAt: number
updatedAt: number
}
interface VersionModel extends BaseModel {
shortname: string
downloadPlatform: string
downloadUrl: string
hashes?: Record<string, string>
}
type PassThrough<T = void> = T | object | undefined
interface SelectOptions {
label: string
value: any
icon?: string
command: () => void
}
interface SelectFile extends File {
objectURL: string
}
interface SelectEvent {
files: SelectFile[]
originalEvent: Event
}
interface DownloadTaskOptions {
taskId: string
type: string
fullname: string
preview: string
status: 'pause' | 'waiting' | 'doing'
progress: number
downloadedSize: number
totalSize: number
bps: number
error?: string
}
interface DownloadTask
extends Omit<
DownloadTaskOptions,
'downloadedSize' | 'totalSize' | 'bps' | 'error'
> {
downloadProgress: string
downloadSpeed: string
pauseTask: () => void
resumeTask: () => void
deleteTask: () => void
}
type CustomEventListener = (event: CustomEvent) => void