/** * Create a hast element from a simple CSS selector. * * @template {string} Selector * Type of selector. * @template {string} [DefaultTagName='div'] * Type of default tag name (default: `'div'`). * @param {Selector | null | undefined} [selector] * Simple CSS selector (optional). * * Can contain a tag name (`foo`), classes (`.bar`), and an ID (`#baz`). * Multiple classes are allowed. * Uses the last ID if multiple IDs are found. * @param {DefaultTagName | null | undefined} [defaultTagName='div'] * Tag name to use if `selector` does not specify one (default: `'div'`). * @returns {Element & {tagName: ExtractTagName}} * Built element. */ export function parseSelector(selector?: Selector | null | undefined, defaultTagName?: DefaultTagName | null | undefined): import("hast").Element & { tagName: ExtractTagName; }; export type Element = import('hast').Element; export type Properties = import('hast').Properties; /** * Extract tag name from a simple selector. */ export type ExtractTagName = SimpleSelector extends "" ? DefaultTagName : SimpleSelector extends `${infer TagName}.${infer Rest}` ? ExtractTagName : SimpleSelector extends `${infer TagName_1}#${infer Rest_1}` ? ExtractTagName : SimpleSelector extends string ? SimpleSelector : DefaultTagName;