AST namespace
Methods
-
static findAtRuleBySelector(selector, rules) → {AtRule}
-
Find at rule object in list of at rules by given selector.
Parameters:
Name Type Description selector
string String selector (multiple selectors are joined by comma).
rules
Array.<AtRule> List of rules.
Returns:
AtRule -
static findDeclarationByKey(selector, declarations) → {Declaration}
-
Find declaration object in list of declarations by given key.
Parameters:
Name Type Description selector
string Declaration key.
declarations
Array.<Declaration> List of declarations.
Returns:
Declaration -
static findRuleBySelector(selector, rules) → {Rule}
-
Find rule object in list of rules by given selector.
Parameters:
Name Type Description selector
string String selector (multiple selectors are joined by comma).
rules
Array.<Rule> List of rules.
Returns:
Rule -
static getAtRulesSelectors(rules) → {Array.<string>}
-
Get all selectors from a rules set.
Parameters:
Name Type Description rules
Array.<AtRule> List of rules.
Returns:
Array.<string> -Selectors.
-
static getNodeType(el) → nullable {string}
-
Get node type.
Parameters:
Name Type Description el
ASTNode | Array.<ASTNode> Element.
Returns:
string -Node transformer name.
-
static getRulesSelectors(rules) → {Array.<string>}
-
Get all selectors from a rules set.
Parameters:
Name Type Description rules
Array.<Rule> List of rules.
Returns:
Array.<string> -Selectors.
-
static normalize(ast)
-
Sort declarations and merge equal rules in order they appear.
Parameters:
Name Type Description ast
Array.<stylis.Element>
Type Definitions
-
ASTNode
-
AST Node common interface.
Properties:
Name Type Description value
string CSS value.
type
string Node type.
props
string | Array.<string> Node properties.
children
Array.<ASTNode> | string Node children.
root
ASTNode Node's root node.
parent
ASTNode Node's parent node.
line
number Node line in CSS file.
column
number Node column in CSS file.
-
AtRule
-
At (
@
) rule set. -
AtRuleBase
-
Properties:
Name Type Description type
string Rule node type.
props
Array.<string> Rule parts (e.g. keyframes name or media queries).
-
Comment
-
Comment.
-
CommentBase
-
Properties:
Name Type Description type
"comm" Comment node type.
props
"n" | "/" Comment type:
'\n'
- double slash comment.'/'
- Multiline comment.children
string Comment value.
-
Declaration
-
Declaration.
-
DeclarationBase
-
Properties:
Name Type Description type
"decl" Declaration node type.
props
string Declaration key.
children
string Declaration value.
-
Rule
-
Rule set.
-
RuleBase
-
Properties:
Name Type Description type
"rule" Rule node type.
props
Array.<string> Rule selectors.