UNPKG

@player-ui/player

Version:

33 lines 1.41 kB
import { SyncWaterfallHook } from "tapable-ts"; import type { Parser } from "../parser"; import { ViewInstance, ViewPlugin } from "../view"; import type { Options } from "./options"; import type { Resolver } from "../resolver"; export interface TemplateItemInfo { /** The index of the data for the current iteration of the template */ index: number; /** The data for the current iteration of the template */ data: any; /** The depth of the template node */ depth: number; } export interface TemplateSubstitution { /** Regular expression to find and replace. The global flag will be always be added to this expression. */ expression: string | RegExp; /** The value to replace matches with. */ value: string; } export type TemplateSubstitutionsFunc = (baseSubstitutions: TemplateSubstitution[], templateItemInfo: TemplateItemInfo) => TemplateSubstitution[]; /** A view plugin to resolve/manage templates */ export default class TemplatePlugin implements ViewPlugin { private readonly options; hooks: { resolveTemplateSubstitutions: SyncWaterfallHook<[TemplateSubstitution[], TemplateItemInfo], Record<string, any>>; }; constructor(options: Options); private parseTemplate; applyParser(parser: Parser): void; applyResolverHooks(resolver: Resolver): void; apply(view: ViewInstance): void; } //# sourceMappingURL=template.d.ts.map