@markuplint/selector 4.6.13 → 4.7.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/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.0](https://github.com/markuplint/markuplint/compare/@markuplint/selector@4.6.14...@markuplint/selector@4.7.0) (2025-02-04)
7
+
8
+ ### Features
9
+
10
+ - **selector:** `matchSelector` use `createSelector` ([ba8795a](https://github.com/markuplint/markuplint/commit/ba8795a7fb03e46546415e29c73d3b460780d7c9))
11
+ - **selector:** expose the `SelectorMatches` type ([64b3731](https://github.com/markuplint/markuplint/commit/64b373118da33f81cc4e043eeec3f2eea889677c))
12
+
13
+ ## [4.6.14](https://github.com/markuplint/markuplint/compare/@markuplint/selector@4.6.13...@markuplint/selector@4.6.14) (2024-12-04)
14
+
15
+ **Note:** Version bump only for package @markuplint/selector
16
+
6
17
  ## [4.6.13](https://github.com/markuplint/markuplint/compare/@markuplint/selector@4.6.12...@markuplint/selector@4.6.13) (2024-11-17)
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';
@@ -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 {};
@@ -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 { Selector } from './selector.js';
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 = new Selector(selector);
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.6.13",
3
+ "version": "4.7.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>",
@@ -25,15 +25,15 @@
25
25
  "clean": "tsc --build --clean"
26
26
  },
27
27
  "dependencies": {
28
- "@markuplint/ml-spec": "4.9.0",
28
+ "@markuplint/ml-spec": "4.9.2",
29
29
  "@types/debug": "4.1.12",
30
- "debug": "4.3.7",
30
+ "debug": "4.4.0",
31
31
  "postcss-selector-parser": "7.0.0",
32
- "type-fest": "4.27.0"
32
+ "type-fest": "4.33.0"
33
33
  },
34
34
  "devDependencies": {
35
35
  "@types/jsdom": "21.1.7",
36
- "jsdom": "25.0.1"
36
+ "jsdom": "26.0.0"
37
37
  },
38
- "gitHead": "b2154ecf1e67559a3791991752f45c9c0283801a"
38
+ "gitHead": "687a84e00546b8f1f2ed88125fe507239723c8d8"
39
39
  }