UNPKG

3.09 kBTypeScriptView Raw
1import postcss from 'postcss';
2import { ClassSymbol, ElementSymbol } from './stylable-meta';
3import { CSSResolve } from './stylable-resolver';
4export interface SelectorAstNode {
5 type: string;
6 name: string;
7 nodes: SelectorAstNode[];
8 content?: string;
9 before?: string;
10 value?: string;
11 operator?: string;
12}
13export interface PseudoSelectorAstNode extends SelectorAstNode {
14 type: 'pseudo-class';
15 content: string;
16}
17export declare type Visitor = (node: SelectorAstNode, index: number, nodes: SelectorAstNode[]) => boolean | void;
18export declare function parseSelector(selector: string): SelectorAstNode;
19export declare function stringifySelector(ast: SelectorAstNode): string;
20export declare function traverseNode(node: SelectorAstNode, visitor: Visitor, index?: number, nodes?: SelectorAstNode[]): boolean | void;
21export declare function createChecker(types: Array<string | string[]>): () => (node: SelectorAstNode) => boolean;
22export declare function isGlobal(node: SelectorAstNode): boolean;
23export declare function isRootValid(ast: SelectorAstNode, rootName: string): boolean;
24export declare const createSimpleSelectorChecker: () => (node: SelectorAstNode) => boolean;
25export declare function isSimpleSelector(selectorAst: SelectorAstNode): boolean | void;
26export declare function isImport(ast: SelectorAstNode): boolean;
27export declare function matchAtKeyframes(selector: string): RegExpMatchArray | null;
28export declare function matchAtMedia(selector: string): RegExpMatchArray | null;
29export declare function isNodeMatch(nodeA: Partial<SelectorAstNode>, nodeB: Partial<SelectorAstNode>): boolean;
30export interface SelectorChunk {
31 type: string;
32 operator?: string;
33 value?: string;
34 nodes: Array<Partial<SelectorAstNode>>;
35}
36export interface SelectorChunk2 {
37 type: string;
38 operator?: string;
39 value?: string;
40 nodes: SelectorAstNode[];
41 before?: string;
42}
43export declare function mergeChunks(chunks: SelectorChunk2[][]): any;
44export declare function separateChunks2(selectorNode: SelectorAstNode): SelectorChunk2[][];
45export declare function getOriginDefinition(resolved: Array<CSSResolve<ClassSymbol | ElementSymbol>>): CSSResolve<ClassSymbol | ElementSymbol>;
46export declare function separateChunks(selectorNode: SelectorAstNode): SelectorChunk[][];
47export declare function filterChunkNodesByType(chunk: SelectorChunk, typeOptions: string[]): Array<Partial<SelectorAstNode>>;
48export declare function matchSelectorTarget(sourceSelector: string, targetSelector: string): boolean;
49export declare function fixChunkOrdering(selectorNode: SelectorAstNode, prefixType: SelectorAstNode): void;
50export declare function isChildOfAtRule(rule: postcss.Container, atRuleName: string): boolean;
51export declare function isCompRoot(name: string): RegExpMatchArray | null;
52export declare function createWarningRule(extendedNode: string, scopedExtendedNode: string, extendedFile: string, extendingNode: string, scopedExtendingNode: string, extendingFile: string, useScoped?: boolean): postcss.Rule;
53//# sourceMappingURL=selector-utils.d.ts.map
\No newline at end of file