/** * A selector, cut at its last top-level combinator. * * One scan asked from both ends: `lastCompound` returns what a rule demands of * the node itself, `ancestorPortion` what it demands of everything above it. * They live together because they are the same walk over the same string — * combinators found at depth zero, brackets and parentheses skipped — and a * change to how that walk works has to land in both or the two answers stop * being complementary halves of one selector. * * They live apart from their callers because both halves of the pruning need * them: the index derives a bucket key from the last compound, and the matcher * asks for the ancestor portion to decide whether a non-matching rule is a * latent coupling. Neither function touches a DOM, so neither can be wrong about * whether a selector *matches* — only about where the string breaks. */ /** Everything before the final combinator, or `null` when the selector is simple. */ export declare function ancestorPortion(selector: string): string | null; /** Split off the last compound selector, respecting combinators and nesting. */ export declare function lastCompound(selector: string): string; /** * A compound with what its arguments and attribute selectors hold taken out: * `a:not(.plain)` is `a:not()`, `:where(.docs-content h2)` is `:where()`, and * `a[href="#top"]` is `a[]`. * * What is left is what the compound demands of the node by name. A class inside * `:where()` belongs to an ancestor or to an alternative, and a `#` inside an * attribute value is text, so neither names the node, and a key read from them * files the rule where the node never looks. */ export declare function outsideArguments(compound: string): string; /** * Where the escape starting at `at` ends. A hex escape is up to six hex digits * and the one whitespace that may close it (`\\32 ` is `2`); any other escape is * the one character after the backslash. */ export declare function escapeEnd(text: string, at: number): number; /** A name with its escapes resolved: `\\32 xl\\:p-4` is `2xl:p-4`. */ export declare function unescapeName(name: string): string; /** A selector that styles a pseudo-element, cut into the element it hangs from and the pseudo-element. */ export interface PseudoElementSelector { /** What the originating element must match. `*` when the selector names only the pseudo-element. */ readonly host: string; /** The pseudo-element, always in its double-colon form: `::before`, never `:before`. */ readonly pseudo: string; } /** * The four pseudo-elements CSS 2 wrote with one colon, which a CSSOM may hand * back as written. Every other pseudo-element is invalid with one colon, so no * engine hands one back that way. */ export declare const LEGACY_PSEUDO_ELEMENTS: ReadonlySet; /** * Split a trailing pseudo-element off a selector, or `null` when it styles an element. * * `Element.matches('.badge::before')` is `false` in every engine — a pseudo-element * is not an element — so a rule written for one never reached the box it paints. * Matching the host and keeping the pseudo-element beside it is what lets the * rule be attributed to the box it styles. * * Only an argument-less pseudo-element at the very end is split. `::part()` and * `::slotted()` select elements and match as written; a pseudo-element followed * by anything else is left whole, so it matches what it matched before. */ export declare function splitPseudoElement(selector: string): PseudoElementSelector | null; //# sourceMappingURL=selector-parts.d.ts.map