import { CssSelector, CssSelectorData, CssSelectorGenerated, CssSelectorGeneratorOptions, CssSelectorType, CssSelectorTypes, IdentifiableParent, PatternMatcher } from "./types.js"; export declare const ESCAPED_COLON: string; export declare const SPECIAL_CHARACTERS_RE: RegExp; /** * Escapes special characters used by CSS selector items. */ export declare function sanitizeSelectorItem(input?: string): string; /** * Legacy version of escaping utility, originally used for IE11-. Should * probably be replaced by a polyfill: * https://github.com/mathiasbynens/CSS.escape */ export declare function legacySanitizeSelectorItem(input?: string): string; export declare const SELECTOR_TYPE_GETTERS: Record CssSelector[]>; export declare const ELEMENT_SELECTOR_TYPE_GETTERS: Record CssSelectorGenerated[]>; /** * Creates selector of given type for single element. */ export declare function getElementSelectorsByType(element: Element, selectorType: CssSelectorType, options?: CssSelectorGeneratorOptions): CssSelectorGenerated[]; /** * Returns list of selectors of given type for the element. */ export declare function getSelectorsByType(elements: Element[], selector_type: CssSelectorType, options?: CssSelectorGeneratorOptions): CssSelector[]; /** * Remove blacklisted selectors from list. */ export declare function filterSelectors(list: CssSelector[] | undefined, matchBlacklist: PatternMatcher, matchWhitelist: PatternMatcher): CssSelector[]; /** * Prioritise whitelisted selectors in list. */ export declare function orderSelectors(list: CssSelector[] | undefined, matchWhitelist: PatternMatcher): CssSelector[]; /** * Yields list of unique selectors applicable to given element. */ export declare function allSelectorsGenerator(elements: Element[], options: CssSelectorGeneratorOptions): IterableIterator; /** * Creates object containing all selector types and their potential values. */ export declare function getSelectorsList(elements: Element[], options: CssSelectorGeneratorOptions): CssSelectorData; /** * Creates list of selector types that we will need to generate the selector. */ export declare function getSelectorsToGet(options: CssSelectorGeneratorOptions): CssSelectorTypes; /** * Generates list of possible selector type combinations. */ export declare function combineSelectorTypes(options: CssSelectorGeneratorOptions): CssSelectorTypes[]; /** * Generates list of combined CSS selectors. */ export declare function selectorTypeCombinationsGenerator(selectors_list: CssSelectorData, options: CssSelectorGeneratorOptions): IterableIterator; /** * Generates all variations of possible selectors from provided data. */ export declare function constructedSelectorsGenerator(selector_types: CssSelectorTypes, selectors_by_type: CssSelectorData): IterableIterator; /** * Creates selector for given selector type. Combines several parts if needed. */ export declare function constructSelectorType(selector_type: CssSelectorType, selectors_data: CssSelectorData): CssSelector; /** * Converts selector data object to a selector. */ export declare function constructSelector(selectorData?: CssSelectorData): CssSelector; /** * Tries to find unique CSS selectors for element within given parent. */ export declare function selectorWithinRootGenerator(elements: Element[], root: ParentNode, rootSelector: CssSelector | undefined, options: CssSelectorGeneratorOptions): IterableIterator; /** * Climbs through parents of the element and finds the ones that are identifiable by unique CSS selector. */ export declare function closestIdentifiableParentGenerator(elements: Element[], root: ParentNode, rootSelector: CssSelector | undefined, options: CssSelectorGeneratorOptions): IterableIterator; interface SelectorGeneratorProps { elements: Element[]; root: ParentNode; rootSelector?: CssSelector; options: CssSelectorGeneratorOptions; } /** * Recursively travels through parents, finds the ones that are identifiable and then tries to find a unique selector within that context. */ export declare function selectorGenerator({ elements, root, rootSelector, options, }: SelectorGeneratorProps): IterableIterator; /** * Converts input into list of elements, removing duplicates and non-elements. */ export declare function sanitizeSelectorNeedle(needle: unknown): Element[]; export {};