UNPKG

@stacksjs/stx

Version:

A performant UI Framework. Powered by Bun.

51 lines 1.81 kB
import type { CustomDirective } from './types'; /** * Create an stx application instance. * * ```ts * import { createApp } from '@stacksjs/stx' * * const app = createApp() * * app.use(myPlugin) * app.provide('theme', 'dark') * app.component('MyButton', MyButton) * app.mount('#app') * ``` * * @param rootComponent - Optional root component definition * @param rootProps - Optional props for the root component */ export declare function createApp(_rootComponent?: any, _rootProps?: Record<string, any>): StxApp; /** A Vue-compatible plugin with install method */ export declare interface StxAppPlugin { install: (app: StxApp, ...options: any[]) => void } /** The stx application instance */ export declare interface StxApp { use(plugin: StxPluginInput, ...options: any[]): StxApp provide(key: string | symbol, value: T): StxApp component(name: string, definition?: any): StxApp | any directive(name: string, definition?: CustomDirective | Record<string, any>): StxApp | any mount(rootContainer?: string | Element): StxApp unmount(): void config: StxAppConfig _components: Map<string, any> _directives: Map<string, any> _installedPlugins: Set<StxPluginInput> } /** Application configuration */ export declare interface StxAppConfig { errorHandler?: (error: Error, instance: any, info: string) => void warnHandler?: (msg: string, instance: any, trace: string) => void globalProperties: Record<string, any> performance: boolean compilerOptions: { /** Custom element tag pattern */ isCustomElement?: (tag: string) => boolean /** Whitespace handling */ whitespace?: 'condense' | 'preserve' } } /** Plugin can be an object with install() or a plain function */ export type StxPluginInput = StxAppPlugin | ((app: StxApp, ...options: any[]) => void)