import { type DevkitFileSystem } from 'ng-morph'; import { type Element } from 'parse5/dist/tree-adapters/default'; import { type TemplateResource } from '../../ng-update/interfaces/template-resource'; /** * Replace component input property by new value * ___ * Example: * 1. Before * ```html * * ``` * 2. Execute * ```ts * const wasModified = replaceInputProperty({ * templateResource, * fileSystem, * componentSelector: 'tui-input-slider', * from: 'secondary', * to: 'tuiTextfieldCustomContent', * }); * ``` * 3. After * ```html * * ``` * ___ * @return true if something was changed */ export declare function replaceInputProperty({ templateResource, fileSystem, componentSelector, from, to, newValue, filterFn, }: { componentSelector: string[] | string; fileSystem: DevkitFileSystem; filterFn?(element: Element): boolean; from: string; newValue?: string; templateResource: TemplateResource; to: string; }): boolean; /** * @example * // 10 symbols before property `size` and string `size="s"` has 8-symbols length * const template = ''; * * getInputPropertyOffsets(template, 'size', ['tui-card']) // [[10, 18]] */ export declare function getInputPropertyOffsets(html: string, attrName: string, tags: string[], filterFn?: (element: Element) => boolean): Array<[number, number]>; /** * @example * // `'; * * getInputPropertyValueOffsets(template, 'size', ['tui-card']) // [ [16, 18] ] */ export declare function getInputPropertyValueOffsets(template: string, attrName: string, tags: string[]): Array<[number, number]>; export declare function replaceInputPropertyByDirective({ templateResource, fileSystem, componentSelector, inputProperty, directive, directiveModule, filterFn, }: { componentSelector: string[] | string; directive: string; directiveModule?: { moduleSpecifier: string; name: string; }; fileSystem: DevkitFileSystem; filterFn?(element: Element): boolean; inputProperty: string; templateResource: TemplateResource; }): void; /** * After removing property from the tag (which uses multi lines inside template) it can leave redundant space. * It is not critical because html is valid even with this extra space. * TODO: Find a way to fix it */ export declare function removeInputProperty({ templateResource, fileSystem, componentSelector, inputProperty, filterFn, }: { componentSelector: string; fileSystem: DevkitFileSystem; filterFn?(element: Element): boolean; inputProperty: string; templateResource: TemplateResource; }): void;