@tbela99/css-parser
Version:
CSS parser, minifier and validator for node and the browser
2,684 lines (2,565 loc) • 119 kB
TypeScript
/**
* Literal token
*/
export declare interface LiteralToken extends BaseToken {
/**
* literal type
*/
typ: EnumToken.LiteralTokenType;
/**
* literal value
*/
val: string;
}
/**
* Class selector token
*/
export declare interface ClassSelectorToken extends BaseToken {
/**
* class selector type
*/
typ: EnumToken.ClassSelectorTokenType;
/**
* class name
*/
val: string;
}
/**
* Invalid class selector token
*/
export declare interface InvalidClassSelectorToken extends BaseToken {
/**
* invalid class selector type
*/
typ: EnumToken.InvalidClassSelectorTokenType;
/**
* invalid class name
*/
val: string;
}
/**
* Universal selector token
*/
export declare interface UniversalSelectorToken extends BaseToken {
/**
* universal selector type
*/
typ: EnumToken.UniversalSelectorTokenType;
}
/**
* Ident token
*/
export declare interface IdentToken extends BaseToken {
/**
* ident type
*/
typ: EnumToken.IdenTokenType;
/**
* ident value
*/
val: string;
}
/**
* Ident list token
*/
export declare interface IdentListToken extends BaseToken {
/**
* ident list type
*/
typ: EnumToken.IdenListTokenType;
/**
* ident list value
*/
val: string;
}
/**
* Dashed ident token
*/
export declare interface DashedIdentToken extends BaseToken {
/**
* ident type
*/
typ: EnumToken.DashedIdenTokenType;
/**
* ident value
*/
val: string;
}
/**
* Comma token
*/
export declare interface CommaToken extends BaseToken {
/**
* comma type
*/
typ: EnumToken.CommaTokenType;
}
/**
* Colon token
*/
export declare interface ColonToken extends BaseToken {
/**
* colon type ':'
*/
typ: EnumToken.ColonTokenType;
}
/**
* Double colon token
*/
export declare interface DoubleColonToken extends BaseToken {
/**
* double colon type '::'
*/
typ: EnumToken.DoubleColonTokenType;
}
/**
* Semicolon token
*/
export declare interface SemiColonToken extends BaseToken {
/**
* semicolon type
*/
typ: EnumToken.SemiColonTokenType;
}
/**
* Nesting selector token
*/
export declare interface NestingSelectorToken extends BaseToken {
/**
* nesting selector type
*/
typ: EnumToken.NestingSelectorTokenType;
}
/**
* Number token
*/
export declare interface NumberToken extends BaseToken {
/**
* number type
*/
typ: EnumToken.NumberTokenType;
/**
* number sign
*/
sign?: "-" | "+";
/**
* number value
*/
val: number | FractionToken;
}
/**
* At rule token
*/
export declare interface AtRuleToken extends BaseToken {
/**
* at rule type
*/
typ: EnumToken.AtRuleTokenType;
/**
* at rule name
*/
nam: string;
/**
* at rule value
*/
val?: string;
}
/**
* Percentage token
*/
export declare interface PercentageToken extends BaseToken {
/**
* percentage type
*/
typ: EnumToken.PercentageTokenType;
/**
* percentage value
*/
val: number | FractionToken;
}
/**
* Flex token
*/
export declare interface FlexToken extends BaseToken {
/**
* flex type
*/
typ: EnumToken.FlexTokenType;
/**
* flex value
*/
val: number | FractionToken;
}
/**
* Function token
*/
export declare interface FunctionToken extends BaseToken {
/**
* function type
*/
typ:
| EnumToken.FunctionTokenType
| EnumToken.UrlFunctionTokenType
| EnumToken.GridTemplateFuncTokenType
| EnumToken.ImageFunctionTokenType
| EnumToken.TimelineFunctionTokenType
| EnumToken.TimingFunctionTokenType
| EnumToken.ColorFunctionTokenType
| EnumToken.MathFunctionTokenType
| EnumToken.PseudoClassFunctionTokenType
| EnumToken.TransformFunctionTokenType;
/**
* function name
*/
val: string;
/**
* function children
*/
chi: Token$1[];
}
/**
* Grid template function token
*/
export declare interface GridTemplateFuncToken extends BaseToken {
/**
* function type
*/
typ: EnumToken.GridTemplateFuncTokenType;
/**
* function name
*/
val: string;
/**
* function children
*/
chi: Token$1[];
}
/**
* Function URL token
*/
export declare interface FunctionURLToken extends BaseToken {
/**
* function type
*/
typ: EnumToken.UrlFunctionTokenType;
/**
* function name
*/
val: "url";
/**
* function children
*/
chi: Array<UrlToken | StringToken | CommentToken>;
}
/**
* Function image token
*/
export declare interface FunctionImageToken extends BaseToken {
/**
* function type
*/
typ: EnumToken.ImageFunctionTokenType;
/**
* function name
*/
val:
| "linear-gradient"
| "radial-gradient"
| "repeating-linear-gradient"
| "repeating-radial-gradient"
| "conic-gradient"
| "image"
| "image-set"
| "element"
| "cross-fade";
/**
* function children
*/
chi: Array<UrlToken | CommentToken>;
}
/**
* Timing function token
*/
export declare interface TimingFunctionToken extends BaseToken {
/**
* timing function type
*/
typ: EnumToken.TimingFunctionTokenType;
/**
* timing function value
*/
val: string;
/**
* timing function children
*/
chi: Token$1[];
}
/**
* Timeline function token
*/
export declare interface TimelineFunctionToken extends BaseToken {
/**
* timeline function type
*/
typ: EnumToken.TimelineFunctionTokenType;
/**
* timeline function value
*/
val: string;
/**
* timeline function children
*/
chi: Token$1[];
}
/**
* String token
*/
export declare interface StringToken extends BaseToken {
/**
* string type
*/
typ: EnumToken.StringTokenType;
/**
* string value
*/
val: string;
}
/**
* Bad string token
*/
export declare interface BadStringToken extends BaseToken {
/**
* bad string type
*/
typ: EnumToken.BadStringTokenType;
/**
* bad string value
*/
val: string;
}
/**
* Unclosed string token
*/
export declare interface UnclosedStringToken extends BaseToken {
/**
* unclosed string type
*/
typ: EnumToken.UnclosedStringTokenType;
/**
* unclosed string value
*/
val: string;
}
/**
* Dimension token
*/
export declare interface DimensionToken extends BaseToken {
/**
* dimension type
*/
typ: EnumToken.DimensionTokenType;
/**
* dimension value
*/
val: number | FractionToken;
/**
* dimension unit
*/
unit: string;
}
/**
* Length token
*/
export declare interface LengthToken extends BaseToken {
/**
* length type
*/
typ: EnumToken.LengthTokenType;
/**
* length value
*/
val: number | FractionToken;
/**
* length unit
*/
unit: string;
}
/**
* Angle token
*/
export declare interface AngleToken extends BaseToken {
/**
* angle type
*/
typ: EnumToken.AngleTokenType;
/**
* angle value
*/
val: number | FractionToken;
/**
* angle unit
*/
unit: string;
}
/**
* Time token
*/
export declare interface TimeToken extends BaseToken {
/**
* time type
*/
typ: EnumToken.TimeTokenType;
/**
* time value
*/
val: number | FractionToken;
/**
* time unit
*/
unit: "ms" | "s";
}
/**
* Frequency token
*/
export declare interface FrequencyToken extends BaseToken {
/**
* frequency type
*/
typ: EnumToken.FrequencyTokenType;
/**
* frequency value
*/
val: number | FractionToken;
/**
* frequency unit
*/
unit: "Hz" | "Khz";
}
/**
* Resolution token
*/
export declare interface ResolutionToken extends BaseToken {
/**
* resolution type
*/
typ: EnumToken.ResolutionTokenType;
/**
* resolution value
*/
val: number | FractionToken;
/**
* resolution unit
*/
unit: "dpi" | "dpcm" | "dppx" | "x";
}
/**
* Hash token
*/
export declare interface HashToken extends BaseToken {
/**
* hash type
*/
typ: EnumToken.HashTokenType;
/**
* hash value
*/
val: string;
}
/**
* Block start token
*/
export declare interface BlockStartToken extends BaseToken {
/**
* block start type
*/
typ: EnumToken.BlockStartTokenType;
}
/**
* Block end token
*/
export declare interface BlockEndToken extends BaseToken {
/**
* block end type
*/
typ: EnumToken.BlockEndTokenType;
}
/**
* Attribute start token
*/
export declare interface AttrStartToken extends BaseToken {
/**
* attribute start type
*/
typ: EnumToken.AttrStartTokenType;
/**
* attribute start children
*/
chi?: Token$1[];
}
/**
* Attribute end token
*/
export declare interface AttrEndToken extends BaseToken {
/**
* attribute end type
*/
typ: EnumToken.AttrEndTokenType;
}
/**
* Parenthesis start token
*/
export declare interface ParensStartToken extends BaseToken {
/**
* parenthesis start type
*/
typ: EnumToken.StartParensTokenType;
}
/**
* Parenthesis end token
*/
export declare interface ParensEndToken extends BaseToken {
/**
* parenthesis end type
*/
typ: EnumToken.EndParensTokenType;
}
/**
* Parenthesis token
*/
export declare interface ParensToken extends BaseToken {
/**
* parenthesis type
*/
typ: EnumToken.ParensTokenType;
/**
* parenthesis children
*/
chi: Token$1[];
}
/**
* Whitespace token
*/
export declare interface WhitespaceToken extends BaseToken {
/**
* whitespace type
*/
typ: EnumToken.WhitespaceTokenType;
/**
* whitespace value
*/
val?: string;
}
/**
* Comment token
*/
export declare interface CommentToken extends BaseToken {
/**
* comment type
*/
typ: EnumToken.CommentTokenType;
/**
* comment value
*/
val: string;
}
/**
* Bad comment token
*/
export declare interface BadCommentToken extends BaseToken {
/**
* bad comment type
*/
typ: EnumToken.BadCommentTokenType;
/**
* bad comment value
*/
val: string;
}
/**
* CDO comment token
*/
export declare interface CDOCommentToken extends BaseToken {
typ: EnumToken.CDOCOMMTokenType;
val: string;
}
/**
* Bad CDO comment token
*/
export declare interface BadCDOCommentToken extends BaseToken {
/**
* bad CDO comment type
*/
typ: EnumToken.BadCdoTokenType;
/**
* bad CDO comment value
*/
val: string;
}
/**
* Include match token
*/
export declare interface IncludeMatchToken extends BaseToken {
/**
* include match type
*/
typ: EnumToken.IncludeMatchTokenType;
// val: '~=';
}
/**
* Dash match token
*/
export declare interface DashMatchToken extends BaseToken {
/**
* dash match type
*/
typ: EnumToken.DashMatchTokenType;
// val: '|=';
}
/**
* Equal match token
*/
export declare interface EqualMatchToken extends BaseToken {
/**
* equal match type
*/
typ: EnumToken.EqualMatchTokenType;
// val: '|=';
}
/**
* Start match token
*/
export declare interface StartMatchToken extends BaseToken {
/**
* start match type
*/
typ: EnumToken.StartMatchTokenType;
// val: '^=';
}
/**
* End match token
*/
export declare interface EndMatchToken extends BaseToken {
/**
* end match type
*/
typ: EnumToken.EndMatchTokenType;
// val: '|=';
}
/**
* Contain match token
*/
export declare interface ContainMatchToken extends BaseToken {
/**
* contain match type
*/
typ: EnumToken.ContainMatchTokenType;
// val: '|=';
}
/**
* Less than token
*/
export declare interface LessThanToken extends BaseToken {
/**
* less than type
*/
typ: EnumToken.LtTokenType;
}
/**
* Less than or equal token
*/
export declare interface LessThanOrEqualToken extends BaseToken {
/**
* less than or equal type
*/
typ: EnumToken.LteTokenType;
}
/**
* Greater than token
*/
export declare interface GreaterThanToken extends BaseToken {
/**
* greater than type
*/
typ: EnumToken.GtTokenType;
}
/**
* Greater than or equal token
*/
export declare interface GreaterThanOrEqualToken extends BaseToken {
/**
* greater than or equal type
*/
typ: EnumToken.GteTokenType;
}
/**
* Column combinator token
*/
export declare interface ColumnCombinatorToken extends BaseToken {
/**
* column combinator type
*/
typ: EnumToken.ColumnCombinatorTokenType;
}
/**
* Pseudo class token
*/
export declare interface PseudoClassToken extends BaseToken {
/**
* Pseudo class
*/
typ: EnumToken.PseudoClassTokenType;
/**
* Pseudo class
*/
val: string;
}
/**
* Pseudo element token
*/
export declare interface PseudoElementToken extends BaseToken {
/**
* Pseudo element
*/
typ: EnumToken.PseudoElementTokenType;
/**
* Pseudo element
*/
val: string;
}
/**
* Pseudo page token
*/
export declare interface PseudoPageToken extends BaseToken {
/**
* Pseudo page
*/
typ: EnumToken.PseudoPageTokenType;
/**
* Pseudo page
*/
val: string;
}
/**
* Pseudo class function token
*/
export declare interface PseudoClassFunctionToken extends BaseToken {
/**
* Pseudo class function
*/
typ: EnumToken.PseudoClassFuncTokenType;
/**
* Pseudo class function
*/
val: string;
/**
* Pseudo class function
*/
chi: Token$1[];
}
/**
* Delim token
*/
export declare interface DelimToken extends BaseToken {
/**
* Delimiter token type
*/
typ: EnumToken.DelimTokenType;
}
/**
* Bad URL token
*/
export declare interface BadUrlToken extends BaseToken {
/**
* Bad URL
*/
typ: EnumToken.BadUrlTokenType;
/**
* Bad URL
*/
val: string;
}
/**
* URL token
*/
export declare interface UrlToken extends BaseToken {
/**
* URL
*/
typ: EnumToken.UrlTokenTokenType;
/**
* URL token
*/
val: string;
}
/**
* EOF token
*/
export declare interface EOFToken extends BaseToken {
/**
* End of file
*/
typ: EnumToken.EOFTokenType;
}
/**
* Important token
*/
export declare interface ImportantToken extends BaseToken {
/**
* Important
*/
typ: EnumToken.ImportantTokenType;
}
/**
* Color token
*/
export declare interface ColorToken extends BaseToken {
/**
* Color type
*/
typ: EnumToken.ColorTokenType;
/**
* Color value or color function name
*/
val: string;
/**
* Color kind
*/
kin: ColorType$1;
/**
* Color components
*/
chi?: Token$1[];
/**
* Whether the color is relative, color-mix or color
* */
cal?: "rel" | "mix" | "col";
}
/**
* Attribute token
*/
export declare interface AttrToken extends BaseToken {
/**
* Attribute type
*/
typ: EnumToken.AttrTokenType;
/**
* Children
*/
chi: Token$1[];
}
/**
* Invalid attribute token
*/
export declare interface InvalidAttrToken extends BaseToken {
/**
* Attribute type
*/
typ: EnumToken.InvalidAttrTokenType;
/**
* Children
*/
chi: Token$1[];
}
/**
* Child combinator token
*/
export declare interface ChildCombinatorToken extends BaseToken {
typ: EnumToken.ChildCombinatorTokenType;
}
/**
* Media feature token
*/
export declare interface MediaFeatureToken extends BaseToken {
/**
* Media feature type
*/
typ: EnumToken.MediaFeatureTokenType;
/**
* Media feature
*/
val: string;
}
/**
* Media feature not token
*/
export declare interface NotToken extends BaseToken {
/**
* Media feature not type
*/
typ: EnumToken.NotTokenType;
/**
* Media feature
*/
val: Token$1;
}
/**
* Media feature only token
*/
export declare interface MediaFeatureOnlyToken extends BaseToken {
/**
* Media feature only type
*/
typ: EnumToken.OnlyTokenType;
/**
* Media feature
*/
val: Token$1;
}
/**
* Media feature and token
*/
export declare interface AndToken extends BaseToken {
/**
* Media feature and type
*/
typ: EnumToken.AndTokenType;
}
/**
* Media feature or token
*/
export declare interface OrToken extends BaseToken {
/**
* Media feature or type
*/
typ: EnumToken.OrTokenType;
}
/**
* Media query condition token
*/
export declare interface MediaQueryUnaryFeatureToken extends BaseToken {
/**
* Media query condition type
*/
typ: EnumToken.MediaQueryUnaryFeatureTokenType;
/**
* Media feature
*/
l: Token$1;
/**
* Media feature
*/
r: Token$1[];
}
export declare interface SupportsQueryUnaryConditionToken extends BaseToken {
/**
* Supports query condition type
*/
typ: EnumToken.SupportsQueryUnaryConditionTokenType;
/**
* Media feature
*/
l: Token$1;
/**
* Media feature
*/
r: Token$1[];
}
export declare interface SupportsQueryConditionToken extends BaseToken {
/**
* Supports query condition type
*/
typ: EnumToken.SupportsQueryConditionTokenType;
/**
* Media feature
*/
op: AndToken | OrToken;
/**
* Media feature
*/
l: Token$1[];
/**
* Media feature
*/
r: Token$1[];
}
export declare interface WhenElseQueryConditionToken extends BaseToken {
/**
* When else query condition type
*/
typ: EnumToken.WhenElseQueryConditionTokenType;
/**
* Media feature
*/
op: AndToken | OrToken;
/**
* Media feature
*/
l: Token$1[];
/**
* Media feature
*/
r: Token$1[];
}
export declare interface WhenElseUnaryConditionToken extends BaseToken {
/**
* When else query condition type
*/
typ: EnumToken.WhenElseUnaryConditionTokenType;
/**
* Media feature
*/
l: Token$1;
/**
* Media feature
*/
r: Token$1[];
}
export declare interface MediaQueryConditionToken extends BaseToken {
/**
* Media query condition type
*/
typ: EnumToken.MediaQueryConditionTokenType;
/**
* Media feature
*/
l: Token$1[];
/**
* Media feature
*/
op:
| ColonToken
| DelimToken
| GreaterThanToken
| LessThanToken
| GreaterThanOrEqualToken
| LessThanOrEqualToken
| AndToken
| OrToken;
/**
* Media feature
*/
r: Token$1[];
}
export declare interface IfConditionToken extends BaseToken {
/**
* If condition type
*/
typ: EnumToken.IfConditionTokenType;
/**
* condition left handle
*/
l: Token$1[];
/**
* condition value
*/
r: Token$1[];
}
export declare interface IfElseConditionToken extends BaseToken {
/**
* If else condition type
*/
typ: EnumToken.IfElseConditionTokenType;
/**
* condition left handle
*/
l: IfConditionToken;
/**
* condition value
*/
r: IfConditionToken;
}
export declare interface ContainerStyleRangeToken extends BaseToken {
typ: EnumToken.ContainerStyleRangeTokenType;
l: Token$1[];
op: Token$1[];
r: Token$1[];
}
export declare interface MediaRangeQueryToken extends BaseToken {
typ: EnumToken.MediaRangeQueryTokenType;
l: Token$1[];
val: Token$1[];
op1: LessThanToken | GreaterThanToken | LessThanOrEqualToken | GreaterThanOrEqualToken;
op2: LessThanToken | GreaterThanToken | LessThanOrEqualToken | GreaterThanOrEqualToken;
r: Token$1[];
}
export declare interface InvalidMediaQueryToken extends BaseToken {
typ: EnumToken.InvalidMediaQueryTokenType;
chi: Token$1[];
}
/**
* Descendant combinator token
*/
export declare interface DescendantCombinatorToken extends BaseToken {
typ: EnumToken.DescendantCombinatorTokenType;
}
/**
* Next sibling combinator token
*/
export declare interface NextSiblingCombinatorToken extends BaseToken {
typ: EnumToken.NextSiblingCombinatorTokenType;
}
/**
* Subsequent sibling combinator token
*/
export declare interface SubsequentCombinatorToken extends BaseToken {
typ: EnumToken.SubsequentSiblingCombinatorTokenType;
}
/**
* Add token
*/
export declare interface AddToken extends BaseToken {
typ: EnumToken.Add;
}
/**
* Sub token
*/
export declare interface SubToken extends BaseToken {
typ: EnumToken.Sub;
}
/**
* Div token
*/
export declare interface DivToken extends BaseToken {
typ: EnumToken.Div;
}
/**
* Mul token
*/
export declare interface MulToken extends BaseToken {
/**
* Type
*/
typ: EnumToken.Mul;
}
/**
* Wrapped values token like {Arial, Helvetica, sans-serif}
*/
export declare interface WrappedValuesToken extends BaseToken {
/**
* Type
*/
typ: EnumToken.WrappedValuesTokenType;
/**
* Children
*/
chi: Token$1[];
}
/**
* Unary expression token
*/
export declare interface UnaryExpression extends BaseToken {
/**
* Type
*/
typ: EnumToken.UnaryExpressionTokenType;
/**
* Sign
*/
sign: EnumToken.Add | EnumToken.Sub;
/**
* Value
*/
val: UnaryExpressionNode;
}
/**
* Fraction token
*/
export declare interface FractionToken extends BaseToken {
typ: EnumToken.FractionTokenType;
l: NumberToken;
r: NumberToken;
}
/**
* Binary expression token
*/
export declare interface BinaryExpressionToken extends BaseToken {
typ: EnumToken.BinaryExpressionTokenType;
op: EnumToken.Add | EnumToken.Sub | EnumToken.Div | EnumToken.Mul;
l: BinaryExpressionNode | Token$1;
r: BinaryExpressionNode | Token$1;
}
/**
* Match expression token
*/
export declare interface MatchExpressionToken extends BaseToken {
typ: EnumToken.MatchExpressionTokenType;
op: EqualMatchToken | DashMatchToken | StartMatchToken | ContainMatchToken | EndMatchToken | IncludeMatchToken;
l: Token$1;
r: Token$1;
attr?: "i" | "s";
}
/**
* Name space attribute token
*/
export declare interface NameSpaceAttributeToken extends BaseToken {
typ: EnumToken.NameSpaceAttributeTokenType;
l?: Token$1;
r: Token$1;
}
/**
* List token
*/
export declare interface ListToken extends BaseToken {
typ: EnumToken.ListToken;
chi: Token$1[];
}
/**
* Composes selector token
*/
export declare interface ComposesSelectorToken extends BaseToken {
typ: EnumToken.ComposesSelectorTokenType;
l: Token$1[];
r: Token$1 | null;
}
/**
* Css variable token
*/
export declare interface CssVariableToken$1 extends BaseToken {
typ: EnumToken.CssVariableTokenType;
nam: string;
val: Token$1[];
}
export declare interface CssVariableImportTokenType$1 extends BaseToken {
typ: EnumToken.CssVariableImportTokenType;
nam: string;
val: Token$1[];
}
export declare interface CssVariableMapTokenType extends BaseToken {
typ: EnumToken.CssVariableDeclarationMapTokenType;
vars: Token$1[];
from: Token$1[];
}
/**
* Function definition token
*/
export declare interface FunctionDefToken extends BaseToken {
typ:
| EnumToken.FunctionDefTokenType
| EnumToken.UrlFunctionTokenDefType
| EnumToken.GridTemplateFuncTokenDefType
| EnumToken.ImageFunctionTokenDefType
| EnumToken.TimelineFunctionTokenDefType
| EnumToken.TimingFunctionTokenDefType
| EnumToken.ColorFunctionTokenDefType
| EnumToken.MathFunctionTokenDefType
| EnumToken.PseudoClassFunctionTokenDefType
| EnumToken.TransformFunctionTokenDefType;
nam: string;
val: string;
}
/**
* Raw node token
*/
export declare interface RawNodeToken extends BaseToken, EnumAstNodeStatus$1 {
typ: EnumToken.RawNodeTokenType;
val: Token$1[];
}
/**
* Unary expression node
*/
export declare type UnaryExpressionNode =
| BinaryExpressionNode
| NumberToken
| DimensionToken
| TimeToken
| LengthToken
| AngleToken
| FrequencyToken;
/**
* Binary expression node
*/
export declare type BinaryExpressionNode =
| NumberToken
| DimensionToken
| PercentageToken
| FlexToken
| FractionToken
| AngleToken
| LengthToken
| FrequencyToken
| BinaryExpressionToken
| FunctionToken
| ParensToken;
/**
* Token
*/
export declare type Token$1 =
| InvalidClassSelectorToken
| InvalidAttrToken
| LiteralToken
| IdentToken
| IdentListToken
| DashedIdentToken
| WrappedValuesToken
| CommaToken
| ColonToken
| DoubleColonToken
| SemiColonToken
| ClassSelectorToken
| UniversalSelectorToken
| ChildCombinatorToken
| DescendantCombinatorToken
| NextSiblingCombinatorToken
| SubsequentCombinatorToken
| ColumnCombinatorToken
| NestingSelectorToken
| WhenElseUnaryConditionToken
| WhenElseQueryConditionToken
| SupportsQueryUnaryConditionToken
| SupportsQueryConditionToken
| MediaQueryConditionToken
| MediaFeatureToken
| MediaQueryUnaryFeatureToken
| IfConditionToken
| IfElseConditionToken
| NotToken
| MediaFeatureOnlyToken
| AndToken
| OrToken
| MediaRangeQueryToken
| ContainerStyleRangeToken
| AstDeclaration
| NumberToken
| AtRuleToken
| PercentageToken
| FlexToken
| FunctionURLToken
| FunctionImageToken
| TimingFunctionToken
| TimelineFunctionToken
| FunctionToken
| GridTemplateFuncToken
| DimensionToken
| LengthToken
| AngleToken
| StringToken
| TimeToken
| FrequencyToken
| ResolutionToken
| UnclosedStringToken
| HashToken
| BadStringToken
| BlockStartToken
| BlockEndToken
| AttrStartToken
| AttrEndToken
| ParensStartToken
| ParensEndToken
| ParensToken
| CDOCommentToken
| BadCDOCommentToken
| CommentToken
| BadCommentToken
| WhitespaceToken
| IncludeMatchToken
| StartMatchToken
| EndMatchToken
| ContainMatchToken
| MatchExpressionToken
| NameSpaceAttributeToken
| ComposesSelectorToken
| CssVariableToken$1
| DashMatchToken
| EqualMatchToken
| LessThanToken
| LessThanOrEqualToken
| GreaterThanToken
| GreaterThanOrEqualToken
| ListToken
| PseudoClassToken
| PseudoPageToken
| PseudoElementToken
| PseudoClassFunctionToken
| DelimToken
| BinaryExpressionToken
| UnaryExpression
| FractionToken
| AddToken
| SubToken
| DivToken
| MulToken
| BadUrlToken
| UrlToken
| ImportantToken
| ColorToken
| AttrToken
| FunctionDefToken
| RawNodeToken
| InvalidMediaQueryToken
| EOFToken;
/**
* Syntax validation enum
*/
declare enum SyntaxValidationResult {
/** valid syntax */
Valid = 0,
/** drop invalid syntax */
Drop = 1,
/** preserve unknown at-rules, declarations and pseudo-classes */
Lenient = 2
}
/**
* Enum of node statuses
*/
declare enum EnumAstNodeStatus$1 {
/**
* Node passed validation
*/
Validated = 0,
/**
* Node is invalid
*/
Invalid = 1,
/**
* node is not validated
*/
Unvalidated = 2,
/**
* Node did not pass validation, but is preserved.
*/
ValidationFailed = 3,
/**
* Parsing the node is not supported yet or the node syntax definition does not exist.
*/
Unknown = 4,
/**
* Failed to parse the node.
*/
Unparsed = 5,
/**
* Node is disallowed in the context
*/
Disallowed = 6,
/**
* Node is malformed
*/
Malformed = 7
}
/**
* Enum of validation levels
* @deprecated
*/
declare enum ValidationLevel {
/**
* disable validation
*/
None = 0,
/**
* validate selectors
*/
Selector = 1,
/**
* validate at-rules
*/
AtRule = 2,
/**
* validate declarations
*/
Declaration = 4,
/**
* validate selectors and at-rules
*/
Default = 3,// selectors + at-rules
/**
* validate selectors, at-rules and declarations
*/
All = 7,// selectors + at-rules + declarations
/**
* Report only. Apply validation and report nodes that are marked as invalid
*/
ReportOnly = 8
}
/**
* Enum of all token types
*/
declare enum EnumToken {
/**
* comment token
*/
CommentTokenType = 0,
/**
* cdata section token
*/
CDOCOMMTokenType = 1,
/**
* style sheet node type
*/
StyleSheetNodeType = 2,
/**
* at-rule node type
*/
AtRuleNodeType = 3,
/**
* rule node type
*/
RuleNodeType = 4,
/**
* declaration node type
*/
DeclarationNodeType = 5,
/**
* literal token type
*/
LiteralTokenType = 6,
/**
* identifier token type
*/
IdenTokenType = 7,
/**
* dashed identifier token type
*/
DashedIdenTokenType = 8,
/**
* comma token type
*/
CommaTokenType = 9,
/**
* colon token type
*/
ColonTokenType = 10,
/**
* semicolon token type
*/
SemiColonTokenType = 11,
/**
* number token type
*/
NumberTokenType = 12,
/**
* at-rule token type
*/
AtRuleTokenType = 13,
/**
* percentage token type
*/
PercentageTokenType = 14,
/**
* function token type
*/
FunctionTokenType = 15,
/**
* timeline function token type
*/
TimelineFunctionTokenType = 16,
/**
* timing function token type
*/
TimingFunctionTokenType = 17,
/**
* url function token type
*/
UrlFunctionTokenType = 18,
/**
* image function token type
*/
ImageFunctionTokenType = 19,
/**
* string token type
*/
StringTokenType = 20,
/**
* unclosed string token type
*/
UnclosedStringTokenType = 21,
/**
* dimension token type
*/
DimensionTokenType = 22,
/**
* length token type
*/
LengthTokenType = 23,
/**
* angle token type
*/
AngleTokenType = 24,
/**
* time token type
*/
TimeTokenType = 25,
/**
* frequency token type
*/
FrequencyTokenType = 26,
/**
* resolution token type
*/
ResolutionTokenType = 27,
/**
* hash token type
*/
HashTokenType = 28,
/**
* block start token type
*/
BlockStartTokenType = 29,
/**
* block end token type
*/
BlockEndTokenType = 30,
/**
* attribute start token type
*/
AttrStartTokenType = 31,
/**
* attribute end token type
*/
AttrEndTokenType = 32,
/**
* start parentheses token type
*/
StartParensTokenType = 33,
/**
* end parentheses token type
*/
EndParensTokenType = 34,
/**
* parentheses token type
*/
ParensTokenType = 35,
/**
* whitespace token type
*/
WhitespaceTokenType = 36,
/**
* include match token type
*/
IncludeMatchTokenType = 37,
/**
* dash match token type
*/
DashMatchTokenType = 38,
/**
* equal match token type
*/
EqualMatchTokenType = 39,
/**
* less than token type
*/
LtTokenType = 40,
/**
* less than or equal to token type
*/
LteTokenType = 41,
/**
* greater than token type
*/
GtTokenType = 42,
/**
* greater than or equal to token type
*/
GteTokenType = 43,
/**
* pseudo-class token type
*/
PseudoClassTokenType = 44,
/**
* pseudo-class function token type
*/
PseudoClassFuncTokenType = 45,
/**
* delimiter token type
*/
DelimTokenType = 46,
/**
* URL token type
*/
UrlTokenTokenType = 47,
/**
* end of file token type
*/
EOFTokenType = 48,
/**
* important token type
*/
ImportantTokenType = 49,
/**
* color token type
*/
ColorTokenType = 50,
/**
* attribute token type
*/
AttrTokenType = 51,
/**
* bad comment token type
*/
BadCommentTokenType = 52,
/**
* bad cdo token type
*/
BadCdoTokenType = 53,
/**
* bad URL token type
*/
BadUrlTokenType = 54,
/**
* bad string token type
*/
BadStringTokenType = 55,
/**
* binary expression token type
*/
BinaryExpressionTokenType = 56,
/**
* unary expression token type
*/
UnaryExpressionTokenType = 57,
/**
* flex token type
*/
FlexTokenType = 58,
/**
* token list token type
*/
ListToken = 59,
/**
* addition token type
*/
Add = 60,
/**
* multiplication token type
*/
Mul = 61,
/**
* division token type
*/
Div = 62,
/**
* subtraction token type
*/
Sub = 63,
/**
* column combinator token type
*/
ColumnCombinatorTokenType = 64,
/**
* contain match token type
*/
ContainMatchTokenType = 65,
/**
* start match token type
*/
StartMatchTokenType = 66,
/**
* end match token type
*/
EndMatchTokenType = 67,
/**
* match expression token type
*/
MatchExpressionTokenType = 68,
/**
* namespace attribute token type
*/
NameSpaceAttributeTokenType = 69,
/**
* fraction token type
*/
FractionTokenType = 70,
/**
* identifier list token type
*/
IdenListTokenType = 71,
/**
* grid template function token type
*/
GridTemplateFuncTokenType = 72,
/**
* keyframe rule node type
*/
KeyFramesRuleNodeType = 73,
/**
* class selector token type
*/
ClassSelectorTokenType = 74,
/**
* universal selector token type
*/
UniversalSelectorTokenType = 75,
/**
* child combinator token type
*/
ChildCombinatorTokenType = 76,// >
/**
* descendant combinator token type
*/
DescendantCombinatorTokenType = 77,// whitespace
/**
* next sibling combinator token type
*/
NextSiblingCombinatorTokenType = 78,// +
/**
* subsequent sibling combinator token type
*/
SubsequentSiblingCombinatorTokenType = 79,// ~
/**
* nesting selector token type
*/
NestingSelectorTokenType = 80,// &
/**
* Invalid rule token type
* @deprecated
*/
InvalidRuleNodeType = 81,
/**
* invalid class selector token type
*/
InvalidClassSelectorTokenType = 82,
/**
* invalid attribute token type
*/
InvalidAttrTokenType = 83,
/**
* Invalid at rule token type
* @deprecated
*/
InvalidAtRuleNodeType = 84,
/**
* media query condition token type
*/
MediaQueryConditionTokenType = 85,
/**
* media feature token type
*/
MediaFeatureTokenType = 86,
/**
* media feature only token type
*/
OnlyTokenType = 87,
/**
* media feature not token type
*/
NotTokenType = 88,
/**
* media feature and token type
*/
AndTokenType = 89,
/**
* media feature or token type
*/
OrTokenType = 90,
/**
* pseudo page token type
*/
PseudoPageTokenType = 91,
/**
* pseudo element token type
*/
PseudoElementTokenType = 92,
/**
* keyframe at rule node type
*/
KeyframesAtRuleNodeType = 93,
/**
* invalid declaration node type.
* @deprecated
*/
InvalidDeclarationNodeType = 94,
/**
* composes token node type
*/
ComposesSelectorNodeType = 95,
/**
* css variable token type
*/
CssVariableTokenType = 96,
/**
* css variable import token type
*/
CssVariableImportTokenType = 97,
/**
* css variable declaration map token type
*/
CssVariableDeclarationMapTokenType = 98,
/**
* media range query token type
*/
MediaRangeQueryTokenType = 99,
/**
* invalid media query token type
*/
InvalidMediaQueryTokenType = 100,
/**
* supports query condition token type
*/
SupportsQueryConditionTokenType = 101,
/**
* supports query unary condition token type
*/
SupportsQueryUnaryConditionTokenType = 102,
/**
* when else query condition token type
*/
WhenElseQueryConditionTokenType = 103,
/**
* when else query unary condition token type
*/
WhenElseUnaryConditionTokenType = 104,
/**
* container style range token type
*/
ContainerStyleRangeTokenType = 105,
/**
* '*'
*/
Star = 106,
/**
* '+'
*/
Plus = 107,
/**
* '~'
*/
Tilda = 108,
/**
* '|'
*/
Pipe = 109,
/**
* '::'
*/
DoubleColonTokenType = 110,
/**
* math function token type such as'calc(' etc.
*/
MathFunctionTokenType = 111,
/**
* transform function token type such as 'translate(' etc.
*/
TransformFunctionTokenType = 112,
/**
* when function token type such as 'supports(' etc.
*/
WhenElseFunctionTokenType = 113,
/**
* general enclosed function token type 'font-tech(' etc.
*/
GeneralEnclosedFunctionTokenType = 114,
/**
* supports function token type such as 'at-rule('
*/
SupportsFunctionTokenType = 115,
/**
* container function token type such as 'style(' or 'scroll-state('
*/
ContainerFunctionTokenType = 116,
/**
* unrecognized node token type
*/
RawNodeTokenType = 117,
/**
* media query boolean token type
* at-rule media not ()
* at-rule media only ()
*/
MediaQueryUnaryFeatureTokenType = 118,
/**
* grid template function token type such as 'minmax('
*/
GridTemplateFuncTokenDefType = 119,
/**
* image function token type such as 'image(' etc.
*/
ImageFunctionTokenDefType = 120,
/**
* function token type such as 'view(' etc.
*/
TimelineFunctionTokenDefType = 121,
/**
* function token type
*/
FunctionTokenDefType = 122,
/**
* timing function token type such as 'linear(' etc.
*/
TimingFunctionTokenDefType = 123,
/**
* color function token type such as 'rgb(' etc.
*/
ColorFunctionTokenDefType = 124,
/**
* math function token type such as 'calc(' etc.
*/
MathFunctionTokenDefType = 125,
/**
* container function token type such as 'style(' or 'scroll-state('
*/
ContainerFunctionTokenDefType = 126,
/**
* url function token type 'url('
*/
UrlFunctionTokenDefType = 127,
/**
* pseudo-class function token type
*/
PseudoClassFunctionTokenDefType = 128,
/**
* transform function token type such as 'translate(' etc.
*/
TransformFunctionTokenDefType = 129,
/**
* when function token type such as 'supports(' or 'media('
*/
WhenElseFunctionTokenDefType = 130,
/**
* general enclosed function token type 'font-tech(' etc.
*/
GeneralEnclosedFunctionTokenDefType = 131,
/**
* supports function token type 'font-tech('
*/
SupportsFunctionTokenDefType = 132,
/**
* CDOCOMMTokenType not allowed in this context
*/
InvalidCommentTokenType = 133,
/**
* custom function token type '--function-name('
*/
CustomFunctionTokenDefType = 134,
/**
* custom function token type
*/
CustomFunctionTokenType = 135,
/**
* function tokens such as 'var(', 'env(', 'if(')
*/
WildCardFunctionTokenDefType = 136,
/**
* function such as 'var()', 'env()', 'if()'
*/
WildCardFunctionTokenType = 137,
/**
* if condition token
*/
IfConditionTokenType = 138,
/**
* if-Else condition token
*/
IfElseConditionTokenType = 139,
/**
* wrapped values token type like {Arial, sans-serif}
*/
WrappedValuesTokenType = 140,
/**
* alias for time token type
*/
Time = 25,
/**
* alias for identifier token type
*/
Iden = 7,
/**
* alias for end of file token type
*/
EOF = 48,
/**
* alias for hash token type
*/
Hash = 28,
/**
* alias for flex token type
*/
Flex = 58,
/**
* alias for angle token type
*/
Angle = 24,
/**
* alias for color token type
*/
Color = 50,
/**
* alias for comma token type
*/
Comma = 9,
/**
* alias for string token type
*/
String = 20,
/**
* alias for length token type
*/
Length = 23,
/**
* alias for number token type
*/
Number = 12,
/**
* alias for percentage token type
*/
Perc = 14,
/**
* alias for literal token type
*/
Literal = 6,
/**
* alias for comment token type
*/
Comment = 0,
/**
* alias for url function token type
*/
UrlFunc = 18,
/**
* alias for dimension token type
*/
Dimension = 22,
/**
* alias for frequency token type
*/
Frequency = 26,
/**
* alias for resolution token type
*/
Resolution = 27,
/**
* alias for whitespace token type
*/
Whitespace = 36,
/**
* alias for identifier list token type
*/
IdenList = 71,
/**
* alias for dashed identifier token type
*/
DashedIden = 8,
/**
* alias for grid template function token type
*/
GridTemplateFunc = 72,
/**
* alias for image function token type
*/
ImageFunc = 19,
/**
* alias for comment node type
*/
CommentNodeType = 0,
/**
* alias for cdata section node type
*/
CDOCOMMNodeType = 1,
/**
* alias for timing function token type
*/
TimingFunction = 17,
/**
* alias for timeline function token type
*/
TimelineFunction = 16
}
/**
* Supported color types enum
*/
declare enum ColorType$1 {
/**
* deprecated system colors
*/
SYS = 0,
/**
* deprecated system colors
*/
DPSYS = 1,
/**
* named colors
*/
LIT = 2,
/**
* colors as hex values
*/
HEX = 3,
/**
* colors as rgb values
*/
RGBA = 4,
/**
* colors using rgb
*/
HSLA = 5,
/**
* colors using hwb
*/
HWB = 6,
/**
* colors using cmyk
*/
CMYK = 7,
/**
* colors using oklab
* */
OKLAB = 8,
/**
* colors using oklch
* */
OKLCH = 9,
/**
* colors using lab
*/
LAB = 10,
/**
* colors using lch
*/
LCH = 11,
/**
* colors using color() function
*/
COLOR = 12,
/**
* color using srgb
*/
SRGB = 13,
/**
* color using prophoto-rgb
*/
PROPHOTO_RGB = 14,
/**
* color using a98-rgb
*/
A98_RGB = 15,
/**
* color using rec2020
*/
REC2020 = 16,
/**
* color using display-p3
*/
DISPLAY_P3 = 17,
/**
* color using srgb-linear
*/
SRGB_LINEAR = 18,
/**
* color using xyz-d50
*/
XYZ_D50 = 19,
/**
* color using xyz-d65
*/
XYZ_D65 = 20,
/**
* light-dark() color function
*/
LIGHT_DARK = 21,
/**
* color-mix() color function
*/
COLOR_MIX = 22,
/**
* non-standard color
*/
NON_STD = 23,
/**
* custom color
*/
CUSTOM_COLOR = 24,
/**
* alpha() color function
*/
ALPHA = 25,
/**
* color using display-p3-linear
*/
DISPLAY_P3_LINEAR = 26,
/**
* alias for rgba
*/
RGB = 4,
/**
* alias for hsl
*/
HSL = 5,
/**
* alias for xyz-d65
*/
XYZ = 20,
/**
* alias for cmyk
*/
DEVICE_CMYK = 7
}
/**
* Supported module case transform
*/
declare enum ModuleCaseTransformEnum {
/**
* export class names as-is
*/
IgnoreCase = 1,
/**
* transform mapping key name to camel case
*/
CamelCase = 2,
/**
* transform class names and mapping key name to camel case
*/
CamelCaseOnly = 4,
/**
* transform mapping key name to dash case
*/
DashCase = 8,
/**
* transform class names and mapping key name to dash case
*/
DashCaseOnly = 16
}
/**
* Supported module scope
*/
declare enum ModuleScopeEnumOptions {
/**
* use the global scope
*/
Global = 32,
/**
* use the local scope
*/
Local = 64,
/**
* do not allow selector without an id or class
*/
Pure = 128,
/**
* export using ICSS module format
*/
ICSS = 256,
/**
* use the shortest name possible. pattern is ignored.
* it will produce names such as
*
* ```css
* .a {
* content: 'a';
* }
*
* .b {
* content: 'b';
* }
*
* .c {
* content: 'c';
* }
* ...
* ```
*/
Shortest = 512
}
declare const LOC: unique symbol;
declare const RAW: unique symbol;
declare const STATE: unique symbol;
declare const ROOT: unique symbol;
declare const ERRORS: unique symbol;
declare const TOKENS: unique symbol;
declare const PARENT: unique symbol;
declare const OPTIMIZED: unique symbol;
/**
* Position
*/
export declare interface Position$1 {
/**
* index in the source
*/
ind: number;
/**
* line number
*/
lin: number;
/**
* column number
*/
col: number;
}
/**
* token or node location
*/
export declare interface Location {
/**
* start position
*/
sta: Position$1;
/**
* end position
*/
end: Position$1;
/**
* source file
*/
src: string;
}
/**
* Common token interface
*/
export declare interface BaseToken {
/**
* token type
*/
typ: EnumToken;
/**
* location info
* @private
*/
[LOC]?: Location;
/**
* parent node
* @private
*/
[PARENT]?: AstNode$1;
/**
* root node
*/
[ROOT]?: AstStyleSheet;
/**
* prelude or selector tokens
* @private
*/
[TOKENS]?: Token$1[] | null;
/**
* node state
* @private
*/
[STATE]?: EnumAstNodeStatus;
/**
* node syntax errors
* @private
*/
[ERRORS]?: ErrorDescription[];
/**
* property name
* @private
*/
[PROPERTYNAME]?: string;
/**
* raw selector
* @private
*/
[RAW]?: string[][] | null;
/**
* optimized selector
* @private
*/
[OPTIMIZED]?: OptimizedSelector | null;
/**
* parent node
*/
parent?: AstAtRule | astRule | AstKeyframesAtRule | AstKeyFrameRule | AstInvalidRule | AstInvalidAtRule | null;
/**
* @private
*/
validSyntax?: boolean;
}
/**
* Ast node state
*/
export declare interface AstNodeStatus {
/**
* Node state
*/
state?: EnumAstNodeStatus;
/**
* Syntax errors
*/
errors?: ErrorDescription[];
}
/**
* comment node
*/
export declare interface AstComment extends BaseToken {
/**
* token type
*/
typ: EnumToken.CommentNodeType | EnumToken.CDOCOMMNodeType;
/**
* comment as string
*/
val: string;
}
/**
* declaration node
*/
export declare interface AstDeclaration extends BaseToken, AstNodeStatus {
/**
* token name
*/
nam: string;
/**
* token value
*/
val: Token$1[];
/**
* token type
*/
typ: EnumToken.DeclarationNodeType;
}
/**
* rule node
*/
export declare interface AstRule extends BaseToken, AstNodeStatus {
/**
* token type
*/
typ: EnumToken.RuleNodeType;
/**
* selector as string
*/
sel: string;
/**
* child nodes
*/
chi: Array<
AstDeclaration | AstComment | AstRule | AstAtRule | AstInvalidRule | AstInvalidDeclaration | AstInvalidAtRule
>;
/**
* optimized` selector
*/
optimized?: OptimizedSelector | null;
/**
* raw selector
*/
raw?: RawSelectorTokens | null;
}
/**
* Invalid rule node
* @deprecated
*/
export declare interface AstInvalidRule extends BaseToken, AstNodeStatus {
/**
* token type
*/
typ: EnumToken.InvalidRuleNodeType;
/**
* selector
*/
sel: string;
/**
* child nodes
*/
chi: Array<AstNode$1>;
}
/**
* invalid declaration node
* @deprecated
*/
export declare interface AstInvalidDeclaration extends BaseToken, AstNodeStatus {
/**
* token type
*/
typ: EnumToken.InvalidDeclarationNodeType;
/**
* tokens
*/
tokens?: null;
/**
* tokens
*/
val: Array<Token$1>;
}
/**
* invalid at rule node
* @deprecated
*/
export declare interface AstInvalidAtRule extends BaseToken, AstNodeStatus {
/**
* token type
*/
typ: EnumToken.InvalidAtRuleNodeType;
/**
* name
*/
nam: string;
/**
* value
*/
val: string;
/**