export type Theme = 'light' | 'dark'; export interface WidgetHost { readonly element: HTMLElement; readonly instanceId: string; } export interface ConfigApi { get(): T; set(value: Partial): Promise; onChange(handler: (value: T) => void): () => void; } export interface SystemApi { getTheme(): Theme; onThemeChange(handler: (theme: Theme) => void): () => void; } export interface LifecycleApi { onMount(handler: () => void): void; onUnmount(handler: () => void): void; onVisibilityChange(handler: (visible: boolean) => void): () => void; } export interface ShellApi { call(method: string, args?: unknown): Promise; } export interface WidgetContext { config: ConfigApi; system: SystemApi; lifecycle: LifecycleApi; shell: ShellApi; } export interface WidgetDefinition { id: string; defaultConfig: T; mount(host: WidgetHost, ctx: WidgetContext): void; configUI?(host: WidgetHost, ctx: WidgetContext): void; }