@markuplint/selector
Advanced tools
Comparing version 3.0.0-rc.1 to 3.0.0-rc.2
export declare class InvalidSelectorError extends Error { | ||
name: string; | ||
name: string; | ||
} |
import type { Specificity, RegexSelector } from './types'; | ||
export type SelectorMatches = SelectorMatched | SelectorUnmatched; | ||
type SelectorMatched = { | ||
matched: true; | ||
selector: string; | ||
specificity: Specificity; | ||
data?: Record<string, string>; | ||
matched: true; | ||
selector: string; | ||
specificity: Specificity; | ||
data?: Record<string, string>; | ||
}; | ||
type SelectorUnmatched = { | ||
matched: false; | ||
matched: false; | ||
}; | ||
export declare function matchSelector(el: Node, selector: string | RegexSelector | undefined): SelectorMatches; | ||
export {}; |
@@ -1,7 +0,3 @@ | ||
export declare function regexSelectorMatches( | ||
reg: string, | ||
raw: string, | ||
ignoreCase: boolean, | ||
): { | ||
[x: string]: string; | ||
export declare function regexSelectorMatches(reg: string, raw: string, ignoreCase: boolean): { | ||
[x: string]: string; | ||
} | null; |
import type { SelectorResult, Specificity } from './types'; | ||
type ExtendedPseudoClass = Record<string, (content: string) => (el: Element) => SelectorResult>; | ||
export declare class Selector { | ||
#private; | ||
constructor(selector: string, extended?: ExtendedPseudoClass); | ||
match(el: Node, scope?: ParentNode | null): Specificity | false; | ||
search(el: Node, scope?: ParentNode | null): SelectorResult[]; | ||
#private; | ||
constructor(selector: string, extended?: ExtendedPseudoClass); | ||
match(el: Node, scope?: ParentNode | null): Specificity | false; | ||
search(el: Node, scope?: ParentNode | null): SelectorResult[]; | ||
} | ||
export {}; |
export type Specificity = [number, number, number]; | ||
export type SelectorResult = SelectorMatchedResult | SelectorUnmatchedResult; | ||
export type SelectorMatchedResult = { | ||
specificity: Specificity; | ||
matched: true; | ||
nodes: (Element | Text)[]; | ||
has: SelectorMatchedResult[]; | ||
specificity: Specificity; | ||
matched: true; | ||
nodes: (Element | Text)[]; | ||
has: SelectorMatchedResult[]; | ||
}; | ||
export type SelectorUnmatchedResult = { | ||
specificity: Specificity; | ||
matched: false; | ||
not?: SelectorMatchedResult[]; | ||
specificity: Specificity; | ||
matched: false; | ||
not?: SelectorMatchedResult[]; | ||
}; | ||
export type RegexSelector = RegexSelectorWithoutCombination & { | ||
combination?: { | ||
combinator: RegexSelectorCombinator; | ||
} & RegexSelector; | ||
combination?: { | ||
combinator: RegexSelectorCombinator; | ||
} & RegexSelector; | ||
}; | ||
export type RegexSelectorCombinator = ' ' | '>' | '+' | '~' | ':has(+)' | ':has(~)'; | ||
export type RegexSelectorWithoutCombination = { | ||
nodeName?: string; | ||
attrName?: string; | ||
attrValue?: string; | ||
nodeName?: string; | ||
attrName?: string; | ||
attrValue?: string; | ||
}; |
{ | ||
"name": "@markuplint/selector", | ||
"version": "3.0.0-rc.1", | ||
"version": "3.0.0-rc.2", | ||
"description": "Extended W3C Selectors matcher", | ||
@@ -25,3 +25,3 @@ "repository": "git@github.com:markuplint/markuplint.git", | ||
"devDependencies": { | ||
"@markuplint/ml-spec": "3.0.0-rc.1", | ||
"@markuplint/ml-spec": "3.0.0-rc.2", | ||
"@types/debug": "^4.1.7", | ||
@@ -31,3 +31,3 @@ "@types/jsdom": "16", | ||
}, | ||
"gitHead": "f0d1cd3216c171949c6e6be0d4388a760bd5d37b" | ||
"gitHead": "27a5c8d136f4b0cf8452552cff529dd0a4db6bba" | ||
} |
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
128238
1384