import { SyncHook, SyncWaterfallHook } from "tapable-ts"; import type { View, NavigationFlowViewState } from "@player-ui/types"; import type { Resolve } from "../../view"; import { ViewInstance } from "../../view"; import type { Logger } from "../../logger"; import type { FlowController } from "../flow"; import type { DataController } from "../data/controller"; import type { TransformRegistry } from "./types"; import type { Node } from "../../view"; export interface ViewControllerOptions { /** Where to get data from */ model: DataController; /** Where to log data */ logger?: Logger; /** A flow-controller instance to listen for view changes */ flowController: FlowController; } export type ViewControllerHooks = { /** Do any processing before the `View` instance is created */ resolveView: SyncWaterfallHook<[ View | undefined, string, NavigationFlowViewState ]>; /** The hook right before the View starts resolving. Attach anything custom here */ view: SyncHook<[ViewInstance]>; }; /** A controller to manage updating/switching views */ export declare class ViewController { readonly hooks: ViewControllerHooks; private readonly viewMap; private readonly viewOptions; private pendingUpdate?; private readonly viewPlugins; currentView?: ViewInstance; transformRegistry: TransformRegistry; optimizeUpdates: boolean; constructor(initialViews: View[], options: Resolve.ResolverOptions & ViewControllerOptions); private queueUpdate; private getViewForRef; onView(state: NavigationFlowViewState): void; private applyViewPlugins; private createViewPlugins; /** Marks all AST nodes in `nodes` as changed, triggering the view to update and re-resolve these nodes. View updates are triggered asynchronously and many calls to this in a short time will batch into a single update. * * NOTE: In most cases view updates are handled automatically by changes to data or any other built-in functionality that would require a view update. Only call this function if absolutely necessary. */ updateViewAST(nodes: Set): void; } //# sourceMappingURL=controller.d.ts.map