.gitignore added
[dotfiles/.git] / .config / coc / extensions / node_modules / coc-prettier / node_modules / specificity / specificity.d.ts
1 declare module "specificity" {
2   export = specificity;
3   namespace specificity {
4     /**
5      * Specificity arrays always have 4 numbers (integers) for quick comparison
6      * comparing from left to right, the next number only has to be checked if
7      * two numbers of the same index are equal.
8      */
9     type SpecificityArray = [number, number, number, number];
10
11     /**
12      * A result of parsing a selector into an array of parts.
13      * Calculating a specificity array is a matter of summing
14      * over all the parts and adding the values to the right
15      * bucket in a specificity array.
16      * 
17      * @interface Part
18      */
19     interface Part {
20       selector: string;
21       type: "a" | "b" | "c";
22       index: number;
23       length: number;
24     }
25     /**
26      * Returned by the calculate function. Represents the results
27      * of parsing and calculating the specificity of a selector.
28      * 
29      * @interface Specificity
30      */
31     interface Specificity {
32       selector: string;
33       specificity: string;
34       specificityArray: SpecificityArray;
35       parts: Array<Part>;
36     }
37     /**
38      * Calculates the specificity for the given selector string.
39      * If the string contains a comma, each selector will be parsed
40      * separately.
41      * 
42      * @returns A list of specificity objects one for each selector in the
43      * selector string.
44      */
45     function calculate(selector: string): Array<Specificity>;
46
47     /**
48      * Compares two selectors. If a string, the string cannot contain a comma.
49      * 
50      * @returns A value less than 0 if selector a is less specific than selector b.
51      *   A value more than 0 if selector a is more specific than selector b.
52      *   0 if the two selectors have the same specificity.
53      */
54     function compare(a: string | SpecificityArray, b: string | SpecificityArray): -1 | 0 | 1;
55   }
56 }