/** * Component Builder * * Cung cấp API dễ sử dụng để xây dựng component schema */ import { ComponentSchema, PropSchema, StyleSchema, EventSchema, MethodSchema, BuilderOptions, GeneratedCode } from './types'; /** * Builder class để xây dựng component schema */ export declare class GenComponentBuilder { private schema; private options; /** * Khởi tạo một component builder mới * * @param type Loại component * @param name Tên component * @param options Các tùy chọn cho builder */ constructor(type: string, name: string, options?: BuilderOptions); /** * Thêm một prop vào component * * @param name Tên prop * @param propSchema Schema của prop * @returns this */ addProp(name: string, propSchema: PropSchema): this; /** * Thêm nhiều props vào component * * @param props Object chứa các props * @returns this */ addProps(props: Record): this; /** * Thêm một component con vào component * * @param childSchema Schema của component con * @returns this */ addChild(childSchema: ComponentSchema): this; /** * Thêm nhiều component con vào component * * @param childrenSchemas Array các schema của component con * @returns this */ addChildren(childrenSchemas: ComponentSchema[]): this; /** * Thêm một style vào component * * @param styleKey Key của style * @param styleValue Giá trị của style * @returns this */ addStyle(styleKey: string, styleValue: string | number): this; /** * Thêm nhiều styles vào component * * @param styles Object chứa các styles * @returns this */ addStyles(styles: StyleSchema): this; /** * Thêm một event vào component * * @param event Event cần thêm * @returns this */ addEvent(event: EventSchema): this; /** * Thêm nhiều events vào component * * @param events Array các events * @returns this */ addEvents(events: EventSchema[]): this; /** * Expose một state của component * * @param stateName Tên state * @returns this */ exposeState(stateName: string): this; /** * Expose nhiều states của component * * @param stateNames Array các tên state * @returns this */ exposeStates(stateNames: string[]): this; /** * Expose một method của component * * @param method Method cần expose * @returns this */ exposeMethod(method: MethodSchema): this; /** * Expose nhiều methods của component * * @param methods Array các methods cần expose * @returns this */ exposeMethods(methods: MethodSchema[]): this; /** * Cập nhật tùy chọn cho builder * * @param options Các tùy chọn mới * @returns this */ setOptions(options: BuilderOptions): this; /** * Xây dựng và trả về component schema * * @returns T */ build(): T; /** * Tạo mã từ component schema * * @returns Promise */ generateCode(): Promise; /** * Tạo một component builder từ schema có sẵn * * @param schema Component schema * @param options Các tùy chọn cho builder * @returns GenComponentBuilder */ static fromSchema(schema: T, options?: BuilderOptions): GenComponentBuilder; } /** * Tạo một component builder mới * * @param type Loại component * @param name Tên component * @param options Các tùy chọn cho builder * @returns GenComponentBuilder */ export declare function createComponentBuilder(type: string, name: string, options?: BuilderOptions): GenComponentBuilder; /** * Tạo một prop schema * * @param type Kiểu của prop * @param options Các tùy chọn cho prop * @returns PropSchema */ export declare function createPropSchema(type: string, options?: { defaultValue?: any; required?: boolean; description?: string; }): PropSchema; /** * Tạo một event schema * * @param name Tên event * @param options Các tùy chọn cho event * @returns EventSchema */ export declare function createEventSchema(name: string, options?: { description?: string; params?: Array<{ name: string; type: string; description?: string; }>; }): EventSchema; /** * Tạo một method schema * * @param name Tên method * @param options Các tùy chọn cho method * @returns MethodSchema */ export declare function createMethodSchema(name: string, options?: { description?: string; params?: Array<{ name: string; type: string; defaultValue?: any; description?: string; }>; returnType?: string; }): MethodSchema;