import { Element, TextNode } from './parser-wrapper'; import { UtamSelector, UtamElement, UtamPageObject, GeneratorConfigOptions, ElementsOptions } from '@utam/types'; /** * check if given value matches the rule * @param rule can be string or regular expression * @param value value to check against a rule * @returns true if it's a match */ export declare const isStringMatchPredicate: (rule: string, value?: string) => boolean; /** * check if given value matches the rule * @param rule can be string or regular expression * @param value value to check against a rule * @returns true if it's a match */ export declare const isOneOfStringsMatchesPredicate: (rule: string, values: string[]) => boolean; /** * check if a value matches at least one of the rules * @param rule can be string or regular expression * @param value value to check against a rule * @returns true if it's a match */ export declare const isStringArrayMatchPredicate: (rules: string[] | undefined, value: string) => boolean; /** * check if one of the values matches one of the rules * @param rule can be string or regular expression * @param value value to check against a rule * @returns true if it's a match */ export declare const isOneOfStringsMatchesOneOfRules: (rules: string[], values: string[] | undefined) => boolean; /** * check if HTML element is a custom tag with "-" * @param element HTML element * @returns true if custom */ export declare const isCustomTag: (element: Element) => boolean; interface ElementDetails { elementNode: Element; isRoot: boolean; } /** * Check if element has shadow root * If root or custom HTML element is marked as lwc:render-mode="light", do not add shadow boundary * Otherwise template HTML element at the root or any custom HTML element is considered a shadow boundary. * @param element node and isRoot if true, we're checking root * @param config generator configuration * @returns boolean */ export declare function hasShadowRoot(element: ElementDetails, config: GeneratorConfigOptions): boolean; /** * Build generated element name based on attributes * @param element HTML element * @returns string with name */ export declare function getElementNameFromAttributes(element: Element): string; /** * Name of the element should be unique, so use map * @param elementName previously generated name * @param elementNames map for names tracking * @param isList boolean for list * @returns unique name */ export declare function buildUniqueName(elementName: string, elementNames: Map, isList: boolean): string; export declare function isElementMatches(element: Element, options?: ElementsOptions): boolean; export declare function isExcludeElement(element: Element, config: GeneratorConfigOptions): boolean; /** * Build generated selector based on attributes * @param element HTML element * @returns CSS selector */ export declare function getSelectorFromAttributes(element: Element): string; /** * Add index to selector or return self if it's already indexed * @param selector JSON selector object * @param nestedLevel indexed element can have more nested elements * @returns JSON indexed selector */ export declare function buildSelectorWithIndex(selector: UtamSelector, nestedLevel: number): { json: UtamSelector; nestedLevel: number; }; /** * Add child elements to the parent * @param parent element or page object * @param isShadowRoot if true, add elements inside shadow * @param children elements to add */ export declare function attachChildElements(parent: UtamElement | UtamPageObject, isShadowRoot: boolean, children?: UtamElement[]): void; /** * Check if element is repeated multiple times and should be a list * @param childElements elements * @returns true if list */ export declare function isRepeatable(childElements: Array): boolean; /** * utility method to transform string with '-' to camel case * @param value tag or attribute value */ export declare function kebabCaseToCamelCase(value: string): string; /** * if content of the text node contains {variableName}, it will be used as the name of the parent element * @param textNode HTML element * @returns internal string or undefined */ export declare function getTextNodeAsVariable(textNode: TextNode): string | undefined; /** * is element a loop * @param element HTML element * @param config generator options * @returns true is it is */ export declare function isElementLoop(element: Element, config: GeneratorConfigOptions): boolean; /** * add kamel case * @param str initial string * @returns kamel string */ export declare function toUpperCase(str: string): string; export {}; //# sourceMappingURL=parser-utils.d.ts.map