Système de thèmes : theme.json validé, protocole orbe-theme://, variables CSS, changement et rechargement à chaud
This commit is contained in:
parent
835f8cbbbb
commit
acd9870890
14 changed files with 598 additions and 7 deletions
|
|
@ -1,5 +1,13 @@
|
|||
/* Contrat IPC : une seule source de vérité pour le preload (window.orbe) et les handlers du processus principal. */
|
||||
import type { AppInfo, Collection, Game, Settings } from './types'
|
||||
import type { ThemeManifest } from './theme'
|
||||
|
||||
export interface ThemeEntry {
|
||||
manifest: ThemeManifest
|
||||
base: string // URL de base des fichiers du thème (orbe-theme://<id>/)
|
||||
builtin: boolean
|
||||
warnings: string[]
|
||||
}
|
||||
|
||||
export interface Api {
|
||||
'app:info': () => Promise<AppInfo>
|
||||
|
|
@ -11,12 +19,14 @@ export interface Api {
|
|||
'collections:delete': (id: string) => Promise<void>
|
||||
'settings:get': () => Promise<Settings>
|
||||
'settings:set': (patch: Partial<Settings>) => Promise<Settings>
|
||||
'themes:list': () => Promise<ThemeEntry[]>
|
||||
}
|
||||
|
||||
/* Événements poussés par le processus principal vers l'interface */
|
||||
export interface Events {
|
||||
'library:changed': Game[]
|
||||
'settings:changed': Settings
|
||||
'themes:changed': { id: string; themes: ThemeEntry[] }
|
||||
}
|
||||
|
||||
export type Channel = keyof Api
|
||||
|
|
@ -31,10 +41,11 @@ export const CHANNELS = [
|
|||
'collections:rename',
|
||||
'collections:delete',
|
||||
'settings:get',
|
||||
'settings:set'
|
||||
'settings:set',
|
||||
'themes:list'
|
||||
] as const satisfies readonly Channel[]
|
||||
|
||||
export const EVENTS = ['library:changed', 'settings:changed'] as const satisfies readonly EventName[]
|
||||
export const EVENTS = ['library:changed', 'settings:changed', 'themes:changed'] as const satisfies readonly EventName[]
|
||||
|
||||
/* Ce que l'interface voit dans window.orbe */
|
||||
export type OrbeApi = Api & {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue