@markuplint/selector 4.6.14 → 4.7.1
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/CHANGELOG.md +11 -0
- package/lib/index.d.ts +1 -1
- package/lib/match-selector.d.ts +2 -1
- package/lib/match-selector.js +6 -4
- package/package.json +7 -7
package/CHANGELOG.md
CHANGED
|
@@ -3,6 +3,17 @@
|
|
|
3
3
|
All notable changes to this project will be documented in this file.
|
|
4
4
|
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
|
|
5
5
|
|
|
6
|
+
## [4.7.1](https://github.com/markuplint/markuplint/compare/@markuplint/selector@4.7.0...@markuplint/selector@4.7.1) (2025-02-11)
|
|
7
|
+
|
|
8
|
+
**Note:** Version bump only for package @markuplint/selector
|
|
9
|
+
|
|
10
|
+
# [4.7.0](https://github.com/markuplint/markuplint/compare/@markuplint/selector@4.6.14...@markuplint/selector@4.7.0) (2025-02-04)
|
|
11
|
+
|
|
12
|
+
### Features
|
|
13
|
+
|
|
14
|
+
- **selector:** `matchSelector` use `createSelector` ([ba8795a](https://github.com/markuplint/markuplint/commit/ba8795a7fb03e46546415e29c73d3b460780d7c9))
|
|
15
|
+
- **selector:** expose the `SelectorMatches` type ([64b3731](https://github.com/markuplint/markuplint/commit/64b373118da33f81cc4e043eeec3f2eea889677c))
|
|
16
|
+
|
|
6
17
|
## [4.6.14](https://github.com/markuplint/markuplint/compare/@markuplint/selector@4.6.13...@markuplint/selector@4.6.14) (2024-12-04)
|
|
7
18
|
|
|
8
19
|
**Note:** Version bump only for package @markuplint/selector
|
package/lib/index.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
export { compareSpecificity } from './compare-specificity.js';
|
|
2
|
-
export { matchSelector } from './match-selector.js';
|
|
2
|
+
export { matchSelector, SelectorMatches } from './match-selector.js';
|
|
3
3
|
export { createSelector } from './create-selector.js';
|
|
4
4
|
export { InvalidSelectorError } from './invalid-selector-error.js';
|
|
5
5
|
export * from './types.js';
|
package/lib/match-selector.d.ts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import type { Specificity, RegexSelector } from './types.js';
|
|
2
|
+
import type { MLMLSpec } from '@markuplint/ml-spec';
|
|
2
3
|
export type SelectorMatches = SelectorMatched | SelectorUnmatched;
|
|
3
4
|
type SelectorMatched = {
|
|
4
5
|
readonly matched: true;
|
|
@@ -9,5 +10,5 @@ type SelectorMatched = {
|
|
|
9
10
|
type SelectorUnmatched = {
|
|
10
11
|
readonly matched: false;
|
|
11
12
|
};
|
|
12
|
-
export declare function matchSelector(el: Node, selector: string | RegexSelector | undefined): SelectorMatches;
|
|
13
|
+
export declare function matchSelector(el: Node, selector: string | RegexSelector | undefined, scope?: ParentNode | null, specs?: MLMLSpec): SelectorMatches;
|
|
13
14
|
export {};
|
package/lib/match-selector.js
CHANGED
|
@@ -12,18 +12,20 @@ var __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (
|
|
|
12
12
|
var _SelectorTarget_combinedFrom, _SelectorTarget_selector;
|
|
13
13
|
import { isElement, isNonDocumentTypeChildNode, isPureHTMLElement } from './is.js';
|
|
14
14
|
import { regexSelectorMatches } from './regex-selector-matches.js';
|
|
15
|
-
import {
|
|
15
|
+
import { createSelector } from './create-selector.js';
|
|
16
16
|
export function matchSelector(
|
|
17
17
|
// eslint-disable-next-line @typescript-eslint/prefer-readonly-parameter-types
|
|
18
|
-
el, selector
|
|
18
|
+
el, selector,
|
|
19
|
+
// eslint-disable-next-line @typescript-eslint/prefer-readonly-parameter-types
|
|
20
|
+
scope, specs) {
|
|
19
21
|
if (selector == null || selector === '') {
|
|
20
22
|
return {
|
|
21
23
|
matched: false,
|
|
22
24
|
};
|
|
23
25
|
}
|
|
24
26
|
if (typeof selector === 'string') {
|
|
25
|
-
const sel =
|
|
26
|
-
const specificity = sel.match(el);
|
|
27
|
+
const sel = createSelector(selector, specs);
|
|
28
|
+
const specificity = sel.match(el, scope);
|
|
27
29
|
if (specificity !== false) {
|
|
28
30
|
return {
|
|
29
31
|
matched: true,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@markuplint/selector",
|
|
3
|
-
"version": "4.
|
|
3
|
+
"version": "4.7.1",
|
|
4
4
|
"description": "Extended W3C Selectors matcher",
|
|
5
5
|
"repository": "git@github.com:markuplint/markuplint.git",
|
|
6
6
|
"author": "Yusuke Hirao <yusukehirao@me.com>",
|
|
@@ -25,15 +25,15 @@
|
|
|
25
25
|
"clean": "tsc --build --clean"
|
|
26
26
|
},
|
|
27
27
|
"dependencies": {
|
|
28
|
-
"@markuplint/ml-spec": "4.9.
|
|
28
|
+
"@markuplint/ml-spec": "4.9.3",
|
|
29
29
|
"@types/debug": "4.1.12",
|
|
30
|
-
"debug": "4.
|
|
31
|
-
"postcss-selector-parser": "7.
|
|
32
|
-
"type-fest": "4.
|
|
30
|
+
"debug": "4.4.0",
|
|
31
|
+
"postcss-selector-parser": "7.1.0",
|
|
32
|
+
"type-fest": "4.34.1"
|
|
33
33
|
},
|
|
34
34
|
"devDependencies": {
|
|
35
35
|
"@types/jsdom": "21.1.7",
|
|
36
|
-
"jsdom": "
|
|
36
|
+
"jsdom": "26.0.0"
|
|
37
37
|
},
|
|
38
|
-
"gitHead": "
|
|
38
|
+
"gitHead": "f9f6c415b8a3a231aac56181892bb393aeb8ae1a"
|
|
39
39
|
}
|