UNPKG

@muban/muban

Version:

Writing components for server-rendered HTML

36 lines (35 loc) 1.24 kB
import type { ComponentApi, ComponentFactory, InternalComponentInstance, LazyComponent } from '../Component.types'; export interface AppConfig { } export interface App { version: string; config: AppConfig; component(...components: Array<ComponentFactory | LazyComponent>): void; mount<P extends Record<string, unknown>>(rootContainer: HTMLElement, template?: (props: P) => string | Array<string>, data?: P): void; unmount(rootContainer: HTMLElement | string): void; provide<T>(key: symbol | string, value: T): this; _uid: number; _component: ComponentFactory; _instance: InternalComponentInstance | null | undefined; _props: Record<string, unknown> | null; _container: HTMLElement | null; _context: AppContext; } export interface AppContext { app: App; config: AppConfig; components: Record<string, ComponentApi>; provides: Record<string | symbol, any>; /** * Flag for de-optimizing props normalization * @internal */ deopt?: boolean; /** * HMR only * @internal */ reload?: () => void; } export declare function createAppContext(): AppContext; export declare function createApp<C extends ComponentFactory>(rootComponent: C): App;