feat(phase1): architecture skeleton
- Electron 33 main process with frameless window, IPC, win-state persistence - Preload with contextBridge typed API (window, theme, dialog) - Vue 3 + Pinia + Element Plus + Vue Router renderer - Dark/light dual theme via CSS custom properties - TitleBar with window controls + theme toggle - StatusBar placeholder - Design spec document
This commit is contained in:
@@ -0,0 +1,23 @@
|
||||
// src/preload/index.ts
|
||||
import { contextBridge, ipcRenderer } from 'electron'
|
||||
|
||||
const electronAPI = {
|
||||
window: {
|
||||
minimize: () => ipcRenderer.send('window:minimize'),
|
||||
maximize: () => ipcRenderer.send('window:maximize'),
|
||||
close: () => ipcRenderer.send('window:close'),
|
||||
},
|
||||
theme: {
|
||||
get: (): Promise<boolean> => ipcRenderer.invoke('theme:get'),
|
||||
set: (theme: 'system' | 'dark' | 'light') => ipcRenderer.send('theme:set', theme),
|
||||
onOsUpdated: (callback: (isDark: boolean) => void) => {
|
||||
ipcRenderer.on('theme:os-updated', (_event, isDark: boolean) => callback(isDark))
|
||||
},
|
||||
},
|
||||
dialog: {
|
||||
openFile: (options: { title?: string; filters?: { name: string; extensions: string[] }[] }) =>
|
||||
ipcRenderer.invoke('dialog:openFile', options),
|
||||
},
|
||||
}
|
||||
|
||||
contextBridge.exposeInMainWorld('electronAPI', electronAPI)
|
||||
Reference in New Issue
Block a user