UNPKG

@player-ui/player

Version:

40 lines 1.69 kB
import { SyncHook } from "tapable-ts"; import type { View as ViewType } from "@player-ui/types"; import type { BindingInstance } from "../binding"; import type { ValidationProvider, ValidationObject } from "../validator"; import type { Resolve } from "./resolver"; import { Resolver } from "./resolver"; import { Parser } from "./parser"; import { TemplatePlugin } from "./plugins"; export type ViewHooks = { /** Hook every time there is an update to this view instance */ onUpdate: SyncHook<[ViewType]>; /** Hook to retrieve the parser used for this view */ parser: SyncHook<[Parser]>; /** Hook to retrieve the resolver used for this view */ resolver: SyncHook<[Resolver]>; /** Hook to retrieve the template plugin used for this view */ templatePlugin: SyncHook<[TemplatePlugin]>; }; /** A stateful view instance from an content */ export declare class ViewInstance implements ValidationProvider { hooks: ViewHooks; private resolver?; readonly initialView: ViewType; readonly resolverOptions: Resolve.ResolverOptions; private rootNode?; private validationProvider?; private templatePlugin; lastUpdate: Record<string, any> | undefined; constructor(initialView: ViewType, resolverOptions: Resolve.ResolverOptions); updateAsync(asyncNode: string): void; update(changes?: Set<BindingInstance>): any; getValidationsForBinding(binding: BindingInstance): Array<ValidationObject> | undefined; setTemplatePlugin(plugin: TemplatePlugin): void; } /** A plugin for a view */ export interface ViewPlugin { /** Called with a view instance */ apply(view: ViewInstance): void; } //# sourceMappingURL=view.d.ts.map