import { type ChildModel, type ModelData } from '@derbyjs/racer'; import { Controller } from './Controller'; import { PageBase } from './Page'; import derbyTemplates = require('./templates'); import { Context } from './templates/contexts'; import { Expression } from './templates/expressions'; import { Attribute, Binding } from './templates/templates'; export interface DataConstructor extends Record { new (): Record; } type AnyVoidFunction = (...args: any[]) => void; export interface ComponentConstructor { new (context: Context, data: ModelData): Component; DataConstructor?: DataConstructor; singleton?: boolean; view?: { dependencies?: any[]; file?: string; is: string; source?: string; viewPartialDependencies?: string[]; }; } export interface SingletonComponentConstructor { new (): Component; singleton: true; view?: { is: string; dependencies?: ComponentConstructor[]; source?: string; file?: string; }; } export declare abstract class Component extends Controller { context: Context; id: string; isDestroyed: boolean; page: PageBase; parent: Controller; singleton?: true; _scope: string[]; view?: { dependencies: ComponentConstructor[]; file: string; is: string; source: string; }; static DataConstructor?: DataConstructor; constructor(context: Context, data: ComponentModelData); init(_model: ChildModel): void; destroy(): void; bind(callback: (...args: unknown[]) => void): (...args: any[]) => any; throttle(callback: (...args: unknown[]) => void, delayArg?: number | ((fn: () => void) => void)): (...args: any[]) => void; requestAnimationFrame(callback: () => void): void; nextTick(callback: () => void): void; debounce(callback: (...args: Parameters) => void, delay?: number): (...args: Parameters) => void; debounceAsync(callback: (...args: Parameters) => void, delay?: number): (...args: Parameters) => void; get(viewName: string, unescaped: boolean): any; getFragment(viewName: string, _ns?: string): any; getView(viewName: string, _ns?: string): any; getAttribute(key: string): T; setAttribute(key: string, value: Attribute): void; setNullAttribute(key: string, value: Attribute): void; } export declare class ComponentAttribute { expression: Expression; model: ChildModel; key: string; constructor(expression: Expression, model: ChildModel, key: string); update(context: Context, binding: Binding): void; } export declare class ComponentAttributeBinding extends Binding { template: any; context: Context; condition: any; constructor(expression: Expression, model: any, key: any, context: Context); } export declare function createFactory(constructor: ComponentConstructor): SingletonComponentFactory | ComponentFactory; export declare class ComponentModelData { id: string; $controller: any; $element: any; $event: any; } export declare class ComponentFactory { constructorFn: ComponentConstructor; constructor(constructorFn: ComponentConstructor); init(context: Context): derbyTemplates.contexts.Context; create(context: any): void; } declare class SingletonComponentFactory { constructorFn: SingletonComponentConstructor; isSingleton: true; component: Component; constructor(constructorFn: any); init(context: any): any; create(): void; } export declare function extendComponent(constructor: SingletonComponentConstructor | ComponentConstructor): void; export {};