@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.
@@ -1,3 +1,3 @@
1
1
  export declare class InvalidSelectorError extends Error {
2
- name: string;
2
+ name: string;
3
3
  }
@@ -1,13 +1,13 @@
1
1
  import type { Specificity, RegexSelector } from './types';
2
2
  export type SelectorMatches = SelectorMatched | SelectorUnmatched;
3
3
  type SelectorMatched = {
4
- readonly matched: true;
5
- readonly selector: string;
6
- readonly specificity: Specificity;
7
- readonly data?: Readonly<Record<string, string>>;
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
- readonly matched: false;
10
+ readonly matched: false;
11
11
  };
12
12
  export declare function matchSelector(el: Node, selector: string | RegexSelector | undefined): SelectorMatches;
13
13
  export {};
@@ -1,7 +1,3 @@
1
- export declare function regexSelectorMatches(
2
- reg: string,
3
- raw: string,
4
- ignoreCase: boolean,
5
- ): {
6
- [x: string]: string;
1
+ export declare function regexSelectorMatches(reg: string, raw: string, ignoreCase: boolean): {
2
+ [x: string]: string;
7
3
  } | null;
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
- #private;
5
- constructor(selector: string, extended?: ExtendedPseudoClass);
6
- match(el: Node, scope?: ParentNode | null): Specificity | false;
7
- search(el: Node, scope?: ParentNode | null): SelectorResult[];
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
- readonly specificity: Specificity;
5
- readonly matched: true;
6
- readonly nodes: readonly (Element | Text)[];
7
- readonly has: readonly SelectorMatchedResult[];
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
- readonly specificity: Specificity;
11
- readonly matched: false;
12
- readonly not?: readonly SelectorMatchedResult[];
10
+ readonly specificity: Specificity;
11
+ readonly matched: false;
12
+ readonly not?: readonly SelectorMatchedResult[];
13
13
  };
14
14
  export type RegexSelector = RegexSelectorWithoutCombination & {
15
- readonly combination?: {
16
- readonly combinator: RegexSelectorCombinator;
17
- } & RegexSelector;
15
+ readonly combination?: {
16
+ readonly combinator: RegexSelectorCombinator;
17
+ } & RegexSelector;
18
18
  };
19
19
  export type RegexSelectorCombinator = ' ' | '>' | '+' | '~' | ':has(+)' | ':has(~)';
20
20
  export type RegexSelectorWithoutCombination = {
21
- readonly nodeName?: string;
22
- readonly attrName?: string;
23
- readonly attrValue?: string;
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.8.0",
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.8.0",
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.11",
27
- "tslib": "^2.4.1",
28
- "type-fest": "^3.8.0"
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": "21.1.1"
32
+ "jsdom": "22.0.0"
33
33
  },
34
- "gitHead": "adc6e432cccba7cfad0dc8bf9f92e5aaf1107359"
34
+ "gitHead": "af370797bfc887e5a5a2ff57fbaa8392ac98ead2"
35
35
  }