@xcons/widget
Version:
XCon Studio widget utilities with advanced template rendering, reactive binding system and registry pattern support
94 lines (93 loc) • 2.91 kB
TypeScript
export interface ReactiveModel {
reactiveUpdate?: (propertyKey?: string, oldValue?: any, newValue?: any) => void;
safeLog?(level: 'trace' | 'debug' | 'info' | 'warn' | 'error', message: string, ...data: any[]): void;
constructor?: any;
[key: string]: any;
}
export interface ReactiveManagerOptions {
logContext?: string;
autoDetectProperties?: boolean;
enablePropertyWatching?: boolean;
enableComputedProperties?: boolean;
}
export declare class ReactiveCore {
private model;
private propertyManager;
private computedManager;
private options;
private autoReactiveEnabled;
private readonly updateCallback;
constructor(model: ReactiveModel, updateCallback: (changedProperty?: string) => void, options?: ReactiveManagerOptions);
/**
* Detect reactive capabilities using both managers
*/
private detectReactiveCapabilities;
/**
* Setup reactive property integration
*/
setupReactiveIntegration(): void;
/**
* Get computed value (delegate to computed manager)
*/
getComputedValue(propertyKey: string, originalGetter: Function, context: any): any;
/**
* Invalidate computed value (delegate to computed manager)
*/
invalidateComputedValue(propertyKey: string): void;
/**
* Check if has reactive capabilities
*/
hasReactiveCapabilities(): boolean;
/**
* Get reactive properties (delegate to property manager)
*/
getReactiveProperties(): Set<string>;
/**
* Get computed properties (delegate to computed manager)
*/
getComputedProperties(): Map<string, string[]>;
/**
* Get computed properties info (delegate to computed manager)
*/
getComputedPropertiesInfo(): Map<string, any>;
/**
* Add reactive property (delegate to property manager)
*/
addReactiveProperty(propertyName: string): boolean;
/**
* Add computed property (delegate to computed manager)
*/
addComputedProperty(propertyName: string, dependencies: string[]): boolean;
/**
* Remove reactive property (delegate to property manager)
*/
removeReactiveProperty(propertyName: string): boolean;
/**
* Remove computed property (delegate to computed manager)
*/
removeComputedProperty(propertyName: string): boolean;
/**
* Force trigger update for specific property
*/
triggerPropertyUpdate(propertyName: string, oldValue?: any, newValue?: any): void;
/**
* Force trigger update for all properties
*/
triggerFullUpdate(): void;
/**
* Update options
*/
updateOptions(newOptions: Partial<ReactiveManagerOptions>): void;
/**
* Get current options
*/
getOptions(): ReactiveManagerOptions;
/**
* Generic logging method
*/
private log;
/**
* Cleanup all managers
*/
cleanup(): void;
}