flexacore-ui-dev
Version:
Universal UI Framework for CDN, React, Angular, Vue, Svelte with TypeScript support
57 lines (56 loc) • 1.99 kB
TypeScript
export type FlexaCorePlugin = {
init?: (engine: FlexaCoreEngine) => void;
};
export type FlexaCoreComponent = {
init?: (engine: FlexaCoreEngine) => void;
};
export type FlexaCoreTheme = {
apply?: (engine: FlexaCoreEngine) => void;
} & Record<string, any>;
export type FlexaCoreEventCallback = (data?: any) => void;
export interface FlexaCoreConfig {
autoInit?: boolean;
debug?: boolean;
theme?: string;
rtl?: boolean;
locale?: string;
breakpoints?: Record<string, number>;
colors?: Record<string, string>;
spacing?: Record<string, string>;
typography?: {
fontFamily?: Record<string, string[]>;
fontSize?: Record<string, string>;
};
[key: string]: any;
}
export declare class FlexaCoreEngine {
version: string;
plugins: Map<string, FlexaCorePlugin>;
components: Map<string, FlexaCoreComponent>;
themes: Map<string, FlexaCoreTheme>;
config: FlexaCoreConfig;
events: Map<string, FlexaCoreEventCallback[]>;
state: Map<string, any>;
initialized: boolean;
constructor(config?: FlexaCoreConfig);
getDefaultConfig(): FlexaCoreConfig;
init(options?: FlexaCoreConfig): this;
initPlugins(): void;
initComponents(): void;
initThemes(): void;
registerPlugin(name: string, plugin: FlexaCorePlugin): this;
registerComponent(name: string, component: FlexaCoreComponent): this;
registerTheme(name: string, theme: FlexaCoreTheme): this;
on(event: string, callback: FlexaCoreEventCallback): this;
off(event: string, callback: FlexaCoreEventCallback): this;
emit(event: string, data?: any): this;
getState<T = any>(key: string): T | undefined;
setState(key: string, value: any): this;
getConfig<T = any>(key?: string): T;
setConfig(key: string | object, value?: any): this;
deepMerge(target: any, source: any): any;
log(...args: any[]): void;
warn(...args: any[]): void;
error(...args: any[]): void;
getAPI(): any;
}