[6a3a178] | 1 | export interface Options {
|
---|
| 2 | /**
|
---|
| 3 | * When false, tag names will not be lowercased.
|
---|
| 4 | * @default true
|
---|
| 5 | */
|
---|
| 6 | lowerCaseAttributeNames?: boolean;
|
---|
| 7 | /**
|
---|
| 8 | * When false, attribute names will not be lowercased.
|
---|
| 9 | * @default true
|
---|
| 10 | */
|
---|
| 11 | lowerCaseTags?: boolean;
|
---|
| 12 | /**
|
---|
| 13 | * When `true`, `xmlMode` implies both `lowerCaseTags` and `lowerCaseAttributeNames` are set to `false`.
|
---|
| 14 | * Also, `ignoreCase` on attributes will not be inferred based on HTML rules anymore.
|
---|
| 15 | * @default false
|
---|
| 16 | */
|
---|
| 17 | xmlMode?: boolean;
|
---|
| 18 | }
|
---|
| 19 | export declare type Selector = PseudoSelector | PseudoElement | AttributeSelector | TagSelector | UniversalSelector | Traversal;
|
---|
| 20 | export interface AttributeSelector {
|
---|
| 21 | type: "attribute";
|
---|
| 22 | name: string;
|
---|
| 23 | action: AttributeAction;
|
---|
| 24 | value: string;
|
---|
| 25 | ignoreCase: boolean | null;
|
---|
| 26 | namespace: string | null;
|
---|
| 27 | }
|
---|
| 28 | declare type DataType = Selector[][] | null | string;
|
---|
| 29 | export interface PseudoSelector {
|
---|
| 30 | type: "pseudo";
|
---|
| 31 | name: string;
|
---|
| 32 | data: DataType;
|
---|
| 33 | }
|
---|
| 34 | export interface PseudoElement {
|
---|
| 35 | type: "pseudo-element";
|
---|
| 36 | name: string;
|
---|
| 37 | }
|
---|
| 38 | export interface TagSelector {
|
---|
| 39 | type: "tag";
|
---|
| 40 | name: string;
|
---|
| 41 | namespace: string | null;
|
---|
| 42 | }
|
---|
| 43 | export interface UniversalSelector {
|
---|
| 44 | type: "universal";
|
---|
| 45 | namespace: string | null;
|
---|
| 46 | }
|
---|
| 47 | export interface Traversal {
|
---|
| 48 | type: TraversalType;
|
---|
| 49 | }
|
---|
| 50 | export declare type AttributeAction = "any" | "element" | "end" | "equals" | "exists" | "hyphen" | "not" | "start";
|
---|
| 51 | export declare type TraversalType = "adjacent" | "child" | "descendant" | "parent" | "sibling";
|
---|
| 52 | /**
|
---|
| 53 | * Checks whether a specific selector is a traversal.
|
---|
| 54 | * This is useful eg. in swapping the order of elements that
|
---|
| 55 | * are not traversals.
|
---|
| 56 | *
|
---|
| 57 | * @param selector Selector to check.
|
---|
| 58 | */
|
---|
| 59 | export declare function isTraversal(selector: Selector): selector is Traversal;
|
---|
| 60 | /**
|
---|
| 61 | * Parses `selector`, optionally with the passed `options`.
|
---|
| 62 | *
|
---|
| 63 | * @param selector Selector to parse.
|
---|
| 64 | * @param options Options for parsing.
|
---|
| 65 | * @returns Returns a two-dimensional array.
|
---|
| 66 | * The first dimension represents selectors separated by commas (eg. `sub1, sub2`),
|
---|
| 67 | * the second contains the relevant tokens for that selector.
|
---|
| 68 | */
|
---|
| 69 | export default function parse(selector: string, options?: Options): Selector[][];
|
---|
| 70 | export {};
|
---|
| 71 | //# sourceMappingURL=parse.d.ts.map |
---|