feat: 实现笔临 P0/P1 Electron 桌面应用 v0.1.0
交付写作核心(TipTap、自动保存、分卷分章)、Onboarding、7 主题与双语 i18n、快捷键设置;主进程使用 node:sqlite;补全 Vitest 与 Playwright E2E;统一 design/ 目录并移除 desigin 拼写错误路径。 Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
Vendored
+61
@@ -0,0 +1,61 @@
|
||||
import type {
|
||||
ActionId,
|
||||
BookMeta,
|
||||
BookOpenResult,
|
||||
Chapter,
|
||||
CreateBookParams,
|
||||
GlobalSettings,
|
||||
IpcResult,
|
||||
UpdateChapterParams,
|
||||
Volume
|
||||
} from './types'
|
||||
|
||||
export interface ElectronAPI {
|
||||
window: {
|
||||
minimize: () => Promise<void>
|
||||
maximize: () => Promise<void>
|
||||
close: () => Promise<void>
|
||||
}
|
||||
settings: {
|
||||
get: () => Promise<IpcResult<GlobalSettings>>
|
||||
update: (partial: Partial<GlobalSettings>) => Promise<IpcResult<GlobalSettings>>
|
||||
}
|
||||
book: {
|
||||
list: () => Promise<IpcResult<BookMeta[]>>
|
||||
create: (params: CreateBookParams) => Promise<IpcResult<BookMeta>>
|
||||
delete: (bookId: string) => Promise<IpcResult<void>>
|
||||
open: (bookId: string) => Promise<IpcResult<BookOpenResult>>
|
||||
updateMeta: (
|
||||
bookId: string,
|
||||
patch: { lastChapterId?: string | null; status?: BookMeta['status'] }
|
||||
) => Promise<IpcResult<BookMeta>>
|
||||
}
|
||||
volume: {
|
||||
create: (bookId: string, name: string) => Promise<IpcResult<Volume>>
|
||||
update: (
|
||||
bookId: string,
|
||||
volumeId: string,
|
||||
patch: { name?: string; description?: string }
|
||||
) => Promise<IpcResult<Volume>>
|
||||
delete: (bookId: string, volumeId: string) => Promise<IpcResult<void>>
|
||||
}
|
||||
chapter: {
|
||||
create: (bookId: string, volumeId: string, title: string) => Promise<IpcResult<Chapter>>
|
||||
get: (bookId: string, chapterId: string) => Promise<IpcResult<Chapter>>
|
||||
update: (params: UpdateChapterParams) => Promise<IpcResult<Chapter>>
|
||||
delete: (bookId: string, chapterId: string) => Promise<IpcResult<void>>
|
||||
}
|
||||
shortcut: {
|
||||
getAll: () => Promise<IpcResult<Record<ActionId, string>>>
|
||||
register: (action: ActionId, accelerator: string) => Promise<IpcResult<void>>
|
||||
}
|
||||
onShortcutTriggered: (callback: (action: ActionId) => void) => () => void
|
||||
}
|
||||
|
||||
declare global {
|
||||
interface Window {
|
||||
electronAPI: ElectronAPI
|
||||
}
|
||||
}
|
||||
|
||||
export {}
|
||||
Reference in New Issue
Block a user