import { IParam, TUserSelectableTypes } from './param-types'; import { ParamSerializer, ITokenizedParam } from './param-serializers'; export type IParamTransformer = (param: ITokenizedParam) => string; export type IParamReplacer = (text: string, oldParam: string, newParam: string) => string; export declare class ParamParser { private readonly serializer; constructor(serializer: ParamSerializer); static TYPES: TUserSelectableTypes[]; static AUTO_PARAMS: string[]; /** * Iterates over params in text * By default, doesn't interate over more than one instance of param */ each(text: string, all?: boolean): Iterable; /** * Iterates over all params in text */ private all; /** * Iterates over params in text and replaces them */ private replace; /** * Indexes params by key */ private paramsByKey; /********************************************** * PUBLIC **********************************************/ getSerializer(): ParamSerializer; /** * Checks for differences between the params encoded in the text and the array of params */ isSynced(params: IParam[], text: string): boolean; /** * Embeds params into text */ embed(text: any, params: IParam[], replacer?: IParamReplacer): string; /** * Creates an array of params encoded in the text */ params(text: string, { customParamsEnabled }?: { customParamsEnabled: boolean; }, params?: IParam[]): IParam[]; /** * Updates params encoded in the text with values in the params array * Returns lock ranges */ sync(text: string, params: IParam[], { customParamsEnabled }?: { customParamsEnabled: boolean; }, replacer?: IParamReplacer): [number, number][]; /** * Replaces params in text with their respective values */ format(text: string, params: IParam[], options?: { customParamsEnabled: boolean; keepEmbed: boolean; }): string; createParam(key: string, type: TUserSelectableTypes, value: any, options?: string[]): IParam; }