@xcons/widget
Version:
XCon Studio widget utilities with advanced template rendering, reactive binding system and registry pattern support
80 lines (79 loc) • 2.48 kB
TypeScript
import type { ServiceConfig, ServiceConstructor, ServiceToken } from '../service';
import type { InitializationMode } from '../widget/interfaces';
export interface BootstrapConfig {
rootWidget?: any;
widgets?: BootstrapWidget[];
services?: BootstrapService[];
providers?: BootstrapProvider[];
}
export interface BootstrapWidget {
widget: any;
initMode?: InitializationMode;
}
export interface BootstrapService {
service: ServiceConstructor;
config?: ServiceConfig;
}
export interface BootstrapProvider {
token: ServiceToken;
useClass?: ServiceConstructor;
useValue?: unknown;
useFactory?: (...args: unknown[]) => unknown;
dependencies?: ServiceToken[];
}
export interface AdditionalBootstrapConfig {
widgets?: BootstrapWidget[];
services?: BootstrapService[];
providers?: BootstrapProvider[];
}
export type BootstrapConfigFunction = () => AdditionalBootstrapConfig;
export type BootstrapInput = AdditionalBootstrapConfig | BootstrapConfigFunction;
export declare class XConBootstrap {
private static isBootstrapped;
/**
* Bootstrap the application with widgets and services
* @param config - Bootstrap configuration object
* @param additionalConfigs - Optional array of configs (objects or functions)
*/
static run(config: BootstrapConfig, additionalConfigs?: BootstrapInput[]): Promise<void>;
/**
* Merge main config with additional configs
*/
private static mergeConfigs;
/**
* Advanced bootstrap with full configuration
*/
private static runAdvanced;
/**
* Register single widget WITHOUT triggering DOM scanning
*/
private static registerWidget;
/**
* Register multiple services
*/
private static registerServices;
/**
* Register single service
*/
private static registerService;
/**
* Register multiple providers
*/
private static registerProviders;
/**
* Register single provider
*/
private static registerProvider;
/**
* Initialize DOM management - Plugin already started auto-scan, we just trigger widget scanning
*/
static initializeDOMManagement(enableAutoScan?: boolean, initializeWidgets?: boolean): void;
/**
* Get widget instance from DOM element
*/
static getWidgetInstance(element: HTMLElement): any;
/**
* Destroy widget on element
*/
static destroyWidget(element: HTMLElement): boolean;
}