@markuplint/selector 3.8.0 → 3.9.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/lib/match-selector.d.ts
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
import type { Specificity, RegexSelector } from './types';
|
|
2
2
|
export type SelectorMatches = SelectorMatched | SelectorUnmatched;
|
|
3
3
|
type SelectorMatched = {
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
4
|
+
readonly matched: true;
|
|
5
|
+
readonly selector: string;
|
|
6
|
+
readonly specificity: Specificity;
|
|
7
|
+
readonly data?: Readonly<Record<string, string>>;
|
|
8
8
|
};
|
|
9
9
|
type SelectorUnmatched = {
|
|
10
|
-
|
|
10
|
+
readonly matched: false;
|
|
11
11
|
};
|
|
12
12
|
export declare function matchSelector(el: Node, selector: string | RegexSelector | undefined): SelectorMatches;
|
|
13
13
|
export {};
|
package/lib/selector.d.ts
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import type { SelectorResult, Specificity } from './types';
|
|
2
2
|
type ExtendedPseudoClass = Readonly<Record<string, (content: string) => (el: Element) => SelectorResult>>;
|
|
3
3
|
export declare class Selector {
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
4
|
+
#private;
|
|
5
|
+
constructor(selector: string, extended?: ExtendedPseudoClass);
|
|
6
|
+
match(el: Node, scope?: ParentNode | null): Specificity | false;
|
|
7
|
+
search(el: Node, scope?: ParentNode | null): SelectorResult[];
|
|
8
8
|
}
|
|
9
9
|
export {};
|
package/lib/types.d.ts
CHANGED
|
@@ -1,24 +1,24 @@
|
|
|
1
1
|
export type Specificity = readonly [number, number, number];
|
|
2
2
|
export type SelectorResult = SelectorMatchedResult | SelectorUnmatchedResult;
|
|
3
3
|
export type SelectorMatchedResult = {
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
4
|
+
readonly specificity: Specificity;
|
|
5
|
+
readonly matched: true;
|
|
6
|
+
readonly nodes: readonly (Element | Text)[];
|
|
7
|
+
readonly has: readonly SelectorMatchedResult[];
|
|
8
8
|
};
|
|
9
9
|
export type SelectorUnmatchedResult = {
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
10
|
+
readonly specificity: Specificity;
|
|
11
|
+
readonly matched: false;
|
|
12
|
+
readonly not?: readonly SelectorMatchedResult[];
|
|
13
13
|
};
|
|
14
14
|
export type RegexSelector = RegexSelectorWithoutCombination & {
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
15
|
+
readonly combination?: {
|
|
16
|
+
readonly combinator: RegexSelectorCombinator;
|
|
17
|
+
} & RegexSelector;
|
|
18
18
|
};
|
|
19
19
|
export type RegexSelectorCombinator = ' ' | '>' | '+' | '~' | ':has(+)' | ':has(~)';
|
|
20
20
|
export type RegexSelectorWithoutCombination = {
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
21
|
+
readonly nodeName?: string;
|
|
22
|
+
readonly attrName?: string;
|
|
23
|
+
readonly attrValue?: string;
|
|
24
24
|
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@markuplint/selector",
|
|
3
|
-
"version": "3.
|
|
3
|
+
"version": "3.9.0",
|
|
4
4
|
"description": "Extended W3C Selectors matcher",
|
|
5
5
|
"repository": "git@github.com:markuplint/markuplint.git",
|
|
6
6
|
"author": "Yusuke Hirao <yusukehirao@me.com>",
|
|
@@ -20,16 +20,16 @@
|
|
|
20
20
|
"clean": "tsc --build --clean"
|
|
21
21
|
},
|
|
22
22
|
"dependencies": {
|
|
23
|
-
"@markuplint/ml-spec": "3.
|
|
23
|
+
"@markuplint/ml-spec": "3.9.0",
|
|
24
24
|
"@types/debug": "^4.1.7",
|
|
25
25
|
"debug": "^4.3.4",
|
|
26
|
-
"postcss-selector-parser": "^6.0.
|
|
27
|
-
"tslib": "^2.
|
|
28
|
-
"type-fest": "^3.
|
|
26
|
+
"postcss-selector-parser": "^6.0.12",
|
|
27
|
+
"tslib": "^2.5.0",
|
|
28
|
+
"type-fest": "^3.10.0"
|
|
29
29
|
},
|
|
30
30
|
"devDependencies": {
|
|
31
31
|
"@types/jsdom": "21.1.1",
|
|
32
|
-
"jsdom": "
|
|
32
|
+
"jsdom": "22.0.0"
|
|
33
33
|
},
|
|
34
|
-
"gitHead": "
|
|
34
|
+
"gitHead": "af370797bfc887e5a5a2ff57fbaa8392ac98ead2"
|
|
35
35
|
}
|