import { ComputableSelector, InferSelectorValue } from "../data/computable"; import { Component } from "../util/Component"; import { RenderingContext } from "./RenderingContext"; import { View, ViewMethods } from "../data/View"; import { Widget } from "./Widget"; import { Instance } from "./Instance"; import { AccessorChain } from "../data/createAccessorModelProxy"; interface ComputableEntry { name: string; selector: any; type: "computable" | "trigger"; } export interface ControllerMethods { store: View; instance: Instance; widget?: Widget; invokeParentMethod(method: string, ...args: any[]): any; getParentControllerByType(type: new (...args: any[]) => T): T; addTrigger(name: string, args: [...Selectors], callback: (...values: { [K in keyof Selectors]: InferSelectorValue; }) => any, autoRun?: boolean): void; addComputable(name: AccessorChain, args: [...Selectors], callback: (...values: { [K in keyof Selectors]: InferSelectorValue; }) => T): void; addComputable(name: string, args: [...Selectors], callback: (...values: { [K in keyof Selectors]: InferSelectorValue; }) => any): void; } export interface BaseControllerConfig { store?: View; instance?: Instance; widget?: Widget; onInit?: (context: RenderingContext) => void; onExplore?: (context: RenderingContext) => void; onPrepare?: (context: RenderingContext) => void; onCleanup?: (context: RenderingContext) => void; onDestroy?: () => void; } export type ControllerConfig = T & ThisType; /** Controller factory function type */ export type ControllerFactory = (config: ViewMethods) => ControllerConfig; export declare class Controller extends Component implements ControllerMethods { initialized?: boolean; onInit?(context: RenderingContext): void; onExplore?(context: RenderingContext): void; onPrepare?(context: RenderingContext): void; onCleanup?(context: RenderingContext): void; onDestroy?(): void; instance: Instance; store: View; widget?: Widget; computables?: Record; constructor(config?: BaseControllerConfig); init(context?: RenderingContext): void; explore(context: RenderingContext): void; prepare(context: RenderingContext): void; cleanup(context: RenderingContext): void; addComputable(name: AccessorChain, args: [...Selectors], callback: (...values: { [K in keyof Selectors]: InferSelectorValue; }) => T): void; addComputable(name: string, args: [...Selectors], callback: (...values: { [K in keyof Selectors]: InferSelectorValue; }) => any): void; addTrigger(name: string, args: [...Selectors], callback: (...values: { [K in keyof Selectors]: InferSelectorValue; }) => any, autoRun?: boolean): void; removeTrigger(name: string): void; removeComputable(name: string): void; invokeParentMethod(methodName: string, ...args: any[]): any; invokeMethod(methodName: string, ...args: any[]): any; getParentControllerByType(type: new (...args: any[]) => T): T; } export {}; //# sourceMappingURL=Controller.d.ts.map