[🔨] Organize types
This commit is contained in:
parent
1d29a9a607
commit
3b2e130ef5
1 changed files with 51 additions and 40 deletions
91
src/types.ts
91
src/types.ts
|
|
@ -1,7 +1,11 @@
|
|||
import { FlowWindow } from './wm'
|
||||
|
||||
export interface PackageJSON {
|
||||
version: string
|
||||
/* EVENTS */
|
||||
|
||||
export interface AppClosedEvent extends CustomEvent {
|
||||
detail: {
|
||||
win: FlowWindow
|
||||
}
|
||||
}
|
||||
|
||||
export interface AppOpenedEvent extends CustomEvent {
|
||||
|
|
@ -11,6 +15,47 @@ export interface AppOpenedEvent extends CustomEvent {
|
|||
}
|
||||
}
|
||||
|
||||
/* METADATA */
|
||||
|
||||
export interface BaseMeta {
|
||||
name: string
|
||||
description: string
|
||||
pkg: string
|
||||
version: string
|
||||
}
|
||||
|
||||
export interface AppMeta extends BaseMeta {
|
||||
icon: string
|
||||
}
|
||||
|
||||
export interface PluginMeta extends BaseMeta {
|
||||
icon?: string
|
||||
}
|
||||
|
||||
/* OBJECTS */
|
||||
|
||||
export interface Apps {
|
||||
[key: string]: App
|
||||
}
|
||||
|
||||
export interface Plugins {
|
||||
[key: string]: Plugin
|
||||
}
|
||||
|
||||
/* MAIN INTERFACES */
|
||||
|
||||
export interface App {
|
||||
meta: AppMeta
|
||||
open: (data: any) => Promise<FlowWindow>
|
||||
}
|
||||
|
||||
export interface Plugin {
|
||||
meta: PluginMeta
|
||||
run: (element: HTMLDivElement) => void | Promise<void>
|
||||
}
|
||||
|
||||
/* MISC */
|
||||
|
||||
export interface FlowPlugin {
|
||||
name: string
|
||||
pkg: string
|
||||
|
|
@ -23,12 +68,6 @@ export interface FlowPlugin {
|
|||
loadTheme: (data: any) => void | Promise<void>
|
||||
}
|
||||
|
||||
export interface AppClosedEvent extends CustomEvent {
|
||||
detail: {
|
||||
win: FlowWindow
|
||||
}
|
||||
}
|
||||
|
||||
export interface FlowWindowConfig {
|
||||
title: string
|
||||
icon: string
|
||||
|
|
@ -42,38 +81,6 @@ export interface FlowWindowConfig {
|
|||
minHeight?: number
|
||||
}
|
||||
|
||||
export interface App {
|
||||
meta: {
|
||||
name: string
|
||||
description: string
|
||||
pkg: string
|
||||
version: string
|
||||
icon: string
|
||||
}
|
||||
|
||||
open: (data: any) => Promise<FlowWindow>
|
||||
}
|
||||
|
||||
export interface Plugin {
|
||||
meta: {
|
||||
name: string
|
||||
description: string
|
||||
pkg: string
|
||||
version: string
|
||||
icon?: string
|
||||
}
|
||||
|
||||
run: (element: HTMLDivElement) => void | Promise<void>
|
||||
}
|
||||
|
||||
export interface Apps {
|
||||
[key: string]: App
|
||||
}
|
||||
|
||||
export interface Plugins {
|
||||
[key: string]: Plugin
|
||||
}
|
||||
|
||||
export interface LoadedApp extends App {
|
||||
builtin: boolean
|
||||
}
|
||||
|
|
@ -81,3 +88,7 @@ export interface LoadedApp extends App {
|
|||
export interface LoadedPlugin extends Plugin {
|
||||
builtin: boolean
|
||||
}
|
||||
|
||||
export interface PackageJSON {
|
||||
version: string
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue