@markuplint/selector 5.0.0-rc.0 → 5.0.0-rc.2
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 +8 -0
- package/docs/matching.ja.md +5 -2
- package/docs/matching.md +5 -2
- package/lib/invalid-selector-error.d.ts +1 -13
- package/lib/invalid-selector-error.js +2 -16
- package/package.json +13 -8
package/CHANGELOG.md
CHANGED
|
@@ -3,6 +3,14 @@
|
|
|
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
|
+
# [5.0.0-rc.2](https://github.com/markuplint/markuplint/compare/v5.0.0-rc.1...v5.0.0-rc.2) (2026-04-15)
|
|
7
|
+
|
|
8
|
+
**Note:** Version bump only for package @markuplint/selector
|
|
9
|
+
|
|
10
|
+
# [5.0.0-rc.1](https://github.com/markuplint/markuplint/compare/v5.0.0-rc.0...v5.0.0-rc.1) (2026-03-27)
|
|
11
|
+
|
|
12
|
+
**Note:** Version bump only for package @markuplint/selector
|
|
13
|
+
|
|
6
14
|
# [5.0.0-rc.0](https://github.com/markuplint/markuplint/compare/v5.0.0-alpha.3...v5.0.0-rc.0) (2026-03-12)
|
|
7
15
|
|
|
8
16
|
**Note:** Version bump only for package @markuplint/selector
|
package/docs/matching.ja.md
CHANGED
|
@@ -77,7 +77,10 @@ div > .class:not(.other) span
|
|
|
77
77
|
| `:scope` | スコープ要素にマッチ(スコープなしの場合はルート)。詳細度 `[0, 1, 0]`。 |
|
|
78
78
|
| `:root` | `<html>` 要素にマッチ。詳細度 `[0, 1, 0]`。 |
|
|
79
79
|
|
|
80
|
-
### カスタム: `:closest(selector)
|
|
80
|
+
### カスタム: `:closest(selector)`(非推奨)
|
|
81
|
+
|
|
82
|
+
> **v5 で非推奨。v6 で削除予定。** 代わりに `:is(selector *)` を使用してください。
|
|
83
|
+
> 例: `:closest(nav)` → `:is(nav *)`
|
|
81
84
|
|
|
82
85
|
祖先チェーンをたどり、いずれかの祖先が内部セレクタにマッチすればマッチします。これは W3C 仕様にない markuplint の拡張です。
|
|
83
86
|
|
|
@@ -192,7 +195,7 @@ Regex セレクタの詳細度はターゲットごとに計算されます:
|
|
|
192
195
|
- コンビネータ: 子孫(` `)、子(`>`)、隣接兄弟(`+`)、一般兄弟(`~`)
|
|
193
196
|
- 複数セレクタ(`,`)
|
|
194
197
|
- `:not()`、`:is()`、`:where()`、`:has()`、`:scope`、`:root`
|
|
195
|
-
- `:closest()`(markuplint
|
|
198
|
+
- `:closest()`(markuplint 拡張、**非推奨**)
|
|
196
199
|
- 拡張: `:aria()`、`:role()`、`:model()`
|
|
197
200
|
- 名前空間セレクタ(`svg|text`、`*|div`)。注: `svg` と `*` の名前空間のみサポート。他の名前空間(例: `html`)は `InvalidSelectorError` をスローします。
|
|
198
201
|
|
package/docs/matching.md
CHANGED
|
@@ -77,7 +77,10 @@ When a `SelectorTarget` matches, the `StructuredSelector` follows the combinator
|
|
|
77
77
|
| `:scope` | Matches the scope element (or root if no scope). Specificity `[0, 1, 0]`. |
|
|
78
78
|
| `:root` | Matches the `<html>` element. Specificity `[0, 1, 0]`. |
|
|
79
79
|
|
|
80
|
-
### Custom: `:closest(selector)`
|
|
80
|
+
### Custom: `:closest(selector)` (Deprecated)
|
|
81
|
+
|
|
82
|
+
> **Deprecated in v5. Will be removed in v6.** Use `:is(selector *)` instead.
|
|
83
|
+
> For example, `:closest(nav)` → `:is(nav *)`.
|
|
81
84
|
|
|
82
85
|
Walks up the ancestor chain and matches if any ancestor matches the inner selector. This is a markuplint extension not in the W3C specification.
|
|
83
86
|
|
|
@@ -192,7 +195,7 @@ Regex selector specificity is calculated per target:
|
|
|
192
195
|
- Combinators: descendant (` `), child (`>`), next-sibling (`+`), subsequent-sibling (`~`)
|
|
193
196
|
- Multiple selectors (`,`)
|
|
194
197
|
- `:not()`, `:is()`, `:where()`, `:has()`, `:scope`, `:root`
|
|
195
|
-
- `:closest()` (markuplint extension)
|
|
198
|
+
- `:closest()` (markuplint extension, **deprecated**)
|
|
196
199
|
- Extended: `:aria()`, `:role()`, `:model()`
|
|
197
200
|
- Namespace selectors (`svg|text`, `*|div`). Note: only `svg` and `*` namespaces are supported; other namespaces (e.g., `html`) throw `InvalidSelectorError`.
|
|
198
201
|
|
|
@@ -1,13 +1 @@
|
|
|
1
|
-
|
|
2
|
-
* Error thrown when a CSS selector string cannot be parsed.
|
|
3
|
-
*/
|
|
4
|
-
export declare class InvalidSelectorError extends Error {
|
|
5
|
-
name: string;
|
|
6
|
-
/** The invalid selector string that caused this error */
|
|
7
|
-
selector: string;
|
|
8
|
-
/**
|
|
9
|
-
* @param selector - The invalid selector string
|
|
10
|
-
* @param message - An optional custom error message
|
|
11
|
-
*/
|
|
12
|
-
constructor(selector: string, message?: string);
|
|
13
|
-
}
|
|
1
|
+
export { InvalidSelectorError } from '@markuplint/shared';
|
|
@@ -1,16 +1,2 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
*/
|
|
4
|
-
export class InvalidSelectorError extends Error {
|
|
5
|
-
name = 'InvalidSelectorError';
|
|
6
|
-
/** The invalid selector string that caused this error */
|
|
7
|
-
selector;
|
|
8
|
-
/**
|
|
9
|
-
* @param selector - The invalid selector string
|
|
10
|
-
* @param message - An optional custom error message
|
|
11
|
-
*/
|
|
12
|
-
constructor(selector, message) {
|
|
13
|
-
super(message ?? `Invalid selector: "${selector}"`);
|
|
14
|
-
this.selector = selector;
|
|
15
|
-
}
|
|
16
|
-
}
|
|
1
|
+
// Re-export from @markuplint/shared — this class is now defined there.
|
|
2
|
+
export { InvalidSelectorError } from '@markuplint/shared';
|
package/package.json
CHANGED
|
@@ -1,8 +1,12 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@markuplint/selector",
|
|
3
|
-
"version": "5.0.0-rc.
|
|
3
|
+
"version": "5.0.0-rc.2",
|
|
4
4
|
"description": "Extended W3C Selectors matcher",
|
|
5
|
-
"repository":
|
|
5
|
+
"repository": {
|
|
6
|
+
"type": "git",
|
|
7
|
+
"url": "https://github.com/markuplint/markuplint.git",
|
|
8
|
+
"directory": "packages/@markuplint/selector"
|
|
9
|
+
},
|
|
6
10
|
"author": "Yusuke Hirao <yusukehirao@me.com>",
|
|
7
11
|
"license": "MIT",
|
|
8
12
|
"engines": {
|
|
@@ -27,15 +31,16 @@
|
|
|
27
31
|
"clean": "tsc --build --clean tsconfig.build.json"
|
|
28
32
|
},
|
|
29
33
|
"dependencies": {
|
|
30
|
-
"@markuplint/ml-spec": "5.0.0-rc.
|
|
31
|
-
"@
|
|
34
|
+
"@markuplint/ml-spec": "5.0.0-rc.2",
|
|
35
|
+
"@markuplint/shared": "5.0.0-rc.2",
|
|
36
|
+
"@types/debug": "4.1.13",
|
|
32
37
|
"debug": "4.4.3",
|
|
33
38
|
"postcss-selector-parser": "7.1.1",
|
|
34
|
-
"type-fest": "5.
|
|
39
|
+
"type-fest": "5.5.0"
|
|
35
40
|
},
|
|
36
41
|
"devDependencies": {
|
|
37
|
-
"@types/jsdom": "28.0.
|
|
38
|
-
"jsdom": "
|
|
42
|
+
"@types/jsdom": "28.0.1",
|
|
43
|
+
"jsdom": "29.0.2"
|
|
39
44
|
},
|
|
40
|
-
"gitHead": "
|
|
45
|
+
"gitHead": "e43763858d9234c417053becc73dbd088c1e7ea6"
|
|
41
46
|
}
|