@adguard/agtree
Version:
Tool set for working with adblock filter lists
41 lines (40 loc) • 1.71 kB
TypeScript
import { BaseConverter } from '../base-interfaces/base-converter.js';
import { type ConversionResult } from '../base-interfaces/conversion-result.js';
import { CssTokenStream } from '../../parser/css/css-token-stream.js';
export declare const ERROR_MESSAGES: {
INVALID_ATTRIBUTE_VALUE: string;
};
export declare const PseudoClasses: {
readonly AbpContains: "-abp-contains";
readonly AbpHas: "-abp-has";
readonly Contains: "contains";
readonly Has: "has";
readonly HasText: "has-text";
readonly MatchesCss: "matches-css";
readonly MatchesCssAfter: "matches-css-after";
readonly MatchesCssBefore: "matches-css-before";
readonly Not: "not";
};
export type PseudoClasses = typeof PseudoClasses[keyof typeof PseudoClasses];
export declare const PseudoElements: {
readonly After: "after";
readonly Before: "before";
};
export type PseudoElements = typeof PseudoElements[keyof typeof PseudoElements];
/**
* CSS selector converter
*
* @todo Implement `convertToUbo` and `convertToAbp`
*/
export declare class CssSelectorConverter extends BaseConverter {
/**
* Converts Extended CSS elements to AdGuard-compatible ones
*
* @param selectorList Selector list to convert
* @returns An object which follows the {@link ConversionResult} interface. Its `result` property contains
* the converted node, and its `isConverted` flag indicates whether the original node was converted.
* If the node was not converted, the result will contain the original node with the same object reference
* @throws If the rule is invalid or incompatible
*/
static convertToAdg(selectorList: string | CssTokenStream): ConversionResult<string>;
}