first commit
This commit is contained in:
3
build/node_modules/css-tree/docs/Lexer.md
generated
vendored
Normal file
3
build/node_modules/css-tree/docs/Lexer.md
generated
vendored
Normal file
@@ -0,0 +1,3 @@
|
||||
# Lexer
|
||||
|
||||
> To be done
|
||||
94
build/node_modules/css-tree/docs/List.md
generated
vendored
Normal file
94
build/node_modules/css-tree/docs/List.md
generated
vendored
Normal file
@@ -0,0 +1,94 @@
|
||||
# List
|
||||
|
||||
<!-- MarkdownTOC -->
|
||||
|
||||
- [Static methods](#static-methods)
|
||||
- [List.createItem](#listcreateitem)
|
||||
- [Properties](#properties)
|
||||
- [List#head](#listhead)
|
||||
- [List#tail](#listtail)
|
||||
- [List#cursor](#listcursor)
|
||||
- [Methods](#methods)
|
||||
- [List#createItem\(\)](#listcreateitem-1)
|
||||
- [List#getSize\(\)](#listgetsize)
|
||||
- [List#fromArray\(\)](#listfromarray)
|
||||
- [List#toArray\(\)](#listtoarray)
|
||||
- [List#toJSON\(\)](#listtojson)
|
||||
- [List#isEmpty\(\)](#listisempty)
|
||||
- [List#first\(\)](#listfirst)
|
||||
- [List#last\(\)](#listlast)
|
||||
- [List#each\(\)](#listeach)
|
||||
- [List#eachRight\(\)](#listeachright)
|
||||
- [List#nextUntil\(\)](#listnextuntil)
|
||||
- [List#prevUntil\(\)](#listprevuntil)
|
||||
- [List#some\(\)](#listsome)
|
||||
- [List#map\(\)](#listmap)
|
||||
- [List#clear\(\)](#listclear)
|
||||
- [List#copy\(\)](#listcopy)
|
||||
- [List#updateCursors\(\)](#listupdatecursors)
|
||||
- [List#append\(\)](#listappend)
|
||||
- [List#appendData\(\)](#listappenddata)
|
||||
- [List#insert\(\)](#listinsert)
|
||||
- [List#remove\(\)](#listremove)
|
||||
- [List#appendList\(\)](#listappendlist)
|
||||
|
||||
<!-- /MarkdownTOC -->
|
||||
|
||||
## Static methods
|
||||
|
||||
### List.createItem
|
||||
|
||||
## Properties
|
||||
|
||||
### List#head
|
||||
|
||||
### List#tail
|
||||
|
||||
### List#cursor
|
||||
|
||||
## Methods
|
||||
|
||||
### List#createItem()
|
||||
|
||||
### List#getSize()
|
||||
|
||||
### List#fromArray()
|
||||
|
||||
### List#toArray()
|
||||
|
||||
### List#toJSON()
|
||||
|
||||
### List#isEmpty()
|
||||
|
||||
### List#first()
|
||||
|
||||
### List#last()
|
||||
|
||||
### List#each()
|
||||
|
||||
### List#eachRight()
|
||||
|
||||
### List#nextUntil()
|
||||
|
||||
### List#prevUntil()
|
||||
|
||||
### List#some()
|
||||
|
||||
### List#map()
|
||||
|
||||
### List#clear()
|
||||
|
||||
### List#copy()
|
||||
|
||||
### List#updateCursors()
|
||||
|
||||
### List#append()
|
||||
|
||||
### List#appendData()
|
||||
|
||||
### List#insert()
|
||||
|
||||
### List#remove()
|
||||
|
||||
### List#appendList()
|
||||
|
||||
3
build/node_modules/css-tree/docs/Parser.md
generated
vendored
Normal file
3
build/node_modules/css-tree/docs/Parser.md
generated
vendored
Normal file
@@ -0,0 +1,3 @@
|
||||
# Parser
|
||||
|
||||
> To be done
|
||||
131
build/node_modules/css-tree/docs/Tokenizer.md
generated
vendored
Normal file
131
build/node_modules/css-tree/docs/Tokenizer.md
generated
vendored
Normal file
@@ -0,0 +1,131 @@
|
||||
# Tokenizer
|
||||
|
||||
<!-- MarkdownTOC -->
|
||||
|
||||
- [Static properties](#static-properties)
|
||||
- [CssSyntaxError](#csssyntaxerror)
|
||||
- [TYPE](#type)
|
||||
- [NAME](#name)
|
||||
- [SYMBOL_TYPE](#symboltype)
|
||||
- [PUNCTUATION](#punctuation)
|
||||
- [Static methods](#static-methods)
|
||||
- [firstCharOffset\(source\)](#firstcharoffsetsource)
|
||||
- [isHex\(code\)](#ishexcode)
|
||||
- [isNumber\(code\)](#isnumbercode)
|
||||
- [isNewline\(source, offset, code\)](#isnewlinesource-offset-code)
|
||||
- [cmpChar\(testStr, offset, referenceCode\)](#cmpcharteststr-offset-referencecode)
|
||||
- [cmpStr\(testStr, start, end, referenceStr\)](#cmpstrteststr-start-end-referencestr)
|
||||
- [endsWith\(testStr, referenceStr\)](#endswithteststr-referencestr)
|
||||
- [findLastNonSpaceLocation\(scanner\)](#findlastnonspacelocationscanner)
|
||||
- [findWhitespaceEnd\(source, offset\)](#findwhitespaceendsource-offset)
|
||||
- [findCommentEnd\(source, offset\)](#findcommentendsource-offset)
|
||||
- [findStringEnd\(source, offset, quote\)](#findstringendsource-offset-quote)
|
||||
- [findDecimalNumberEnd\(source, offset\)](#finddecimalnumberendsource-offset)
|
||||
- [findNumberEnd\(source, offset, allowFraction\)](#findnumberendsource-offset-allowfraction)
|
||||
- [findEscaseEnd\(source, offset\)](#findescaseendsource-offset)
|
||||
- [findIdentifierEnd\(source, offset\)](#findidentifierendsource-offset)
|
||||
- [Methods](#methods)
|
||||
- [setSource\(source, startOffset, startLine, startColumn\)](#setsourcesource-startoffset-startline-startcolumn)
|
||||
- [lookupType\(offset\)](#lookuptypeoffset)
|
||||
- [lookupNonWSType\(offset\)](#lookupnonwstypeoffset)
|
||||
- [lookupValue\(offset, referenceStr\)](#lookupvalueoffset-referencestr)
|
||||
- [getTokenValue\(\)](#gettokenvalue)
|
||||
- [substrToCursor\(start\)](#substrtocursorstart)
|
||||
- [skipWS\(\)](#skipws)
|
||||
- [skip\(tokenCount\)](#skiptokencount)
|
||||
- [next\(\)](#next)
|
||||
- [eat\(tokenType\)](#eattokentype)
|
||||
- [eatNonWS\(tokenType\)](#eatnonwstokentype)
|
||||
- [consume\(tokenType\)](#consumetokentype)
|
||||
- [consumeNonWS\(tokenType\)](#consumenonwstokentype)
|
||||
- [expectIdentifier\(name\)](#expectidentifiername)
|
||||
- [getLocation\(offset, filename\)](#getlocationoffset-filename)
|
||||
- [getLocationRange\(start, end, filename\)](#getlocationrangestart-end-filename)
|
||||
- [error\(message, offset\)](#errormessage-offset)
|
||||
- [getTypes\(\)](#gettypes)
|
||||
|
||||
<!-- /MarkdownTOC -->
|
||||
|
||||
## Static properties
|
||||
|
||||
### CssSyntaxError
|
||||
|
||||
### TYPE
|
||||
|
||||
### NAME
|
||||
|
||||
### SYMBOL_TYPE
|
||||
|
||||
### PUNCTUATION
|
||||
|
||||
|
||||
## Static methods
|
||||
|
||||
### firstCharOffset(source)
|
||||
|
||||
### isHex(code)
|
||||
|
||||
### isNumber(code)
|
||||
|
||||
### isNewline(source, offset, code)
|
||||
|
||||
### cmpChar(testStr, offset, referenceCode)
|
||||
|
||||
### cmpStr(testStr, start, end, referenceStr)
|
||||
|
||||
### endsWith(testStr, referenceStr)
|
||||
|
||||
### findLastNonSpaceLocation(scanner)
|
||||
|
||||
### findWhitespaceEnd(source, offset)
|
||||
|
||||
### findCommentEnd(source, offset)
|
||||
|
||||
### findStringEnd(source, offset, quote)
|
||||
|
||||
### findDecimalNumberEnd(source, offset)
|
||||
|
||||
### findNumberEnd(source, offset, allowFraction)
|
||||
|
||||
### findEscaseEnd(source, offset)
|
||||
|
||||
### findIdentifierEnd(source, offset)
|
||||
|
||||
|
||||
## Methods
|
||||
|
||||
### setSource(source, startOffset, startLine, startColumn)
|
||||
|
||||
### lookupType(offset)
|
||||
|
||||
### lookupNonWSType(offset)
|
||||
|
||||
### lookupValue(offset, referenceStr)
|
||||
|
||||
### getTokenValue()
|
||||
|
||||
### substrToCursor(start)
|
||||
|
||||
### skipWS()
|
||||
|
||||
### skip(tokenCount)
|
||||
|
||||
### next()
|
||||
|
||||
### eat(tokenType)
|
||||
|
||||
### eatNonWS(tokenType)
|
||||
|
||||
### consume(tokenType)
|
||||
|
||||
### consumeNonWS(tokenType)
|
||||
|
||||
### expectIdentifier(name)
|
||||
|
||||
### getLocation(offset, filename)
|
||||
|
||||
### getLocationRange(start, end, filename)
|
||||
|
||||
### error(message, offset)
|
||||
|
||||
### getTypes()
|
||||
2
build/node_modules/css-tree/docs/api-map.svg
generated
vendored
Normal file
2
build/node_modules/css-tree/docs/api-map.svg
generated
vendored
Normal file
File diff suppressed because one or more lines are too long
|
After Width: | Height: | Size: 43 KiB |
434
build/node_modules/css-tree/docs/ast.md
generated
vendored
Normal file
434
build/node_modules/css-tree/docs/ast.md
generated
vendored
Normal file
@@ -0,0 +1,434 @@
|
||||
# AST format
|
||||
|
||||
CSSTree's AST is an object tree. Each node is object with `type` property that indicates its type. Other property set depends on node type.
|
||||
|
||||
Each node have a `loc` property, but not included in descriptions to avoid noise. Its value contains an object with node content positions in source string or null depending on parsing settings.
|
||||
|
||||
> Details on each node to be done
|
||||
|
||||
Other node types are stable enough.
|
||||
|
||||
Node types:
|
||||
|
||||
<!-- MarkdownTOC -->
|
||||
|
||||
- [AnPlusB](#anplusb)
|
||||
- [Atrule](#atrule)
|
||||
- [AtrulePrelude](#atruleprelude)
|
||||
- [AttributeSelector](#attributeselector)
|
||||
- [Block](#block)
|
||||
- [Brackets](#brackets)
|
||||
- [CDC](#cdc)
|
||||
- [CDO](#cdo)
|
||||
- [ClassSelector](#classselector)
|
||||
- [Combinator](#combinator)
|
||||
- [Comment](#comment)
|
||||
- [Declaration](#declaration)
|
||||
- [DeclarationList](#declarationlist)
|
||||
- [Dimension](#dimension)
|
||||
- [Function](#function)
|
||||
- [HexColor](#hexcolor)
|
||||
- [IdSelector](#idselector)
|
||||
- [Identifier](#identifier)
|
||||
- [MediaFeature](#mediafeature)
|
||||
- [MediaQuery](#mediaquery)
|
||||
- [MediaQueryList](#mediaquerylist)
|
||||
- [Nth](#nth)
|
||||
- [Number](#number)
|
||||
- [Operator](#operator)
|
||||
- [Parentheses](#parentheses)
|
||||
- [Percentage](#percentage)
|
||||
- [PseudoClassSelector](#pseudoclassselector)
|
||||
- [PseudoElementSelector](#pseudoelementselector)
|
||||
- [Ratio](#ratio)
|
||||
- [Raw](#raw)
|
||||
- [Rule](#rule)
|
||||
- [Selector](#selector)
|
||||
- [SelectorList](#selectorlist)
|
||||
- [String](#string)
|
||||
- [StyleSheet](#stylesheet)
|
||||
- [TypeSelector](#typeselector)
|
||||
- [UnicodeRange](#unicoderange)
|
||||
- [Url](#url)
|
||||
- [Value](#value)
|
||||
- [WhiteSpace](#whitespace)
|
||||
|
||||
<!-- /MarkdownTOC -->
|
||||
|
||||
## AnPlusB
|
||||
|
||||
Used to represent [the An+B microsyntax](https://drafts.csswg.org/css-syntax/#anb-microsyntax).
|
||||
|
||||
```
|
||||
{
|
||||
"type": "AnPlusB",
|
||||
"a": String | null,
|
||||
"b": String | null
|
||||
}
|
||||
```
|
||||
|
||||
`a` and `b` may have no value (to be equals to `null`) but not both at the same time. Parser normalizes `a` value to store a valid interger, i.e. for `-n` it will contains `-1` and for `n` it will contains `1`.
|
||||
|
||||
## Atrule
|
||||
|
||||
```
|
||||
{
|
||||
"type": "Atrule",
|
||||
"name": String,
|
||||
"prelude": <AtrulePrelude> | <Raw> | null,
|
||||
"block": <Block> | null
|
||||
}
|
||||
```
|
||||
|
||||
## AtrulePrelude
|
||||
|
||||
```
|
||||
{
|
||||
"type": "AtrulePrelude",
|
||||
"children": List
|
||||
}
|
||||
```
|
||||
|
||||
## AttributeSelector
|
||||
|
||||
```
|
||||
{
|
||||
"type": "AttributeSelector",
|
||||
"name": <Identifier>,
|
||||
"matcher": String | null,
|
||||
"value": <String> | <Identifier> | null,
|
||||
"flags": String | null
|
||||
}
|
||||
```
|
||||
|
||||
## Block
|
||||
|
||||
```
|
||||
{
|
||||
"type": "Block",
|
||||
"children": List
|
||||
}
|
||||
```
|
||||
|
||||
## Brackets
|
||||
|
||||
```
|
||||
{
|
||||
"type": "Brackets",
|
||||
"children": List
|
||||
}
|
||||
```
|
||||
|
||||
## CDC
|
||||
|
||||
```
|
||||
{
|
||||
"type": "CDC"
|
||||
}
|
||||
```
|
||||
|
||||
## CDO
|
||||
|
||||
```
|
||||
{
|
||||
"type": "CDO"
|
||||
}
|
||||
```
|
||||
|
||||
## ClassSelector
|
||||
|
||||
```
|
||||
{
|
||||
"type": "ClassSelector",
|
||||
"name": String
|
||||
}
|
||||
```
|
||||
|
||||
## Combinator
|
||||
|
||||
```
|
||||
{
|
||||
"type": "Combinator",
|
||||
"name": String
|
||||
}
|
||||
```
|
||||
|
||||
## Comment
|
||||
|
||||
```
|
||||
{
|
||||
"type": "Comment",
|
||||
"value": String
|
||||
}
|
||||
```
|
||||
|
||||
## Declaration
|
||||
|
||||
```
|
||||
{
|
||||
"type": "Declaration",
|
||||
"important": Boolean | String,
|
||||
"property": String,
|
||||
"value": <Value> | <Raw>
|
||||
}
|
||||
```
|
||||
|
||||
## DeclarationList
|
||||
|
||||
```
|
||||
{
|
||||
"type": "DeclarationList",
|
||||
"children": List
|
||||
}
|
||||
```
|
||||
|
||||
## Dimension
|
||||
|
||||
```
|
||||
{
|
||||
"type": "Dimension",
|
||||
"value": String,
|
||||
"unit": String
|
||||
}
|
||||
```
|
||||
|
||||
## Function
|
||||
|
||||
```
|
||||
{
|
||||
"type": "Function",
|
||||
"name": String,
|
||||
"children": List
|
||||
}
|
||||
```
|
||||
|
||||
## HexColor
|
||||
|
||||
```
|
||||
{
|
||||
"type": "HexColor",
|
||||
"value": String
|
||||
}
|
||||
```
|
||||
|
||||
## IdSelector
|
||||
|
||||
```
|
||||
{
|
||||
"type": "IdSelector",
|
||||
"name": String
|
||||
}
|
||||
```
|
||||
|
||||
## Identifier
|
||||
|
||||
```
|
||||
{
|
||||
"type": "Identifier",
|
||||
"name": String
|
||||
}
|
||||
```
|
||||
|
||||
## MediaFeature
|
||||
|
||||
```
|
||||
{
|
||||
"type": "MediaFeature",
|
||||
"name": String,
|
||||
"value": <Identifier> | <Number> | <Dimension> | <Ratio> | null
|
||||
}
|
||||
```
|
||||
|
||||
## MediaQuery
|
||||
|
||||
```
|
||||
{
|
||||
"type": "MediaQuery",
|
||||
"children": List
|
||||
}
|
||||
```
|
||||
|
||||
## MediaQueryList
|
||||
|
||||
```
|
||||
{
|
||||
"type": "MediaQueryList",
|
||||
"children": List
|
||||
}
|
||||
```
|
||||
|
||||
## Nth
|
||||
|
||||
```
|
||||
{
|
||||
"type": "Nth",
|
||||
"nth": <AnPlusB> | <Identifier>,
|
||||
"selector": <SelectorList> | null
|
||||
}
|
||||
```
|
||||
|
||||
## Number
|
||||
|
||||
```
|
||||
{
|
||||
"type": "Number",
|
||||
"value": String
|
||||
}
|
||||
```
|
||||
|
||||
## Operator
|
||||
|
||||
```
|
||||
{
|
||||
"type": "Operator",
|
||||
"value": String
|
||||
}
|
||||
```
|
||||
|
||||
## Parentheses
|
||||
|
||||
```
|
||||
{
|
||||
"type": "Parentheses",
|
||||
"children": List
|
||||
}
|
||||
```
|
||||
|
||||
## Percentage
|
||||
|
||||
```
|
||||
{
|
||||
"type": "Percentage",
|
||||
"value": String
|
||||
}
|
||||
```
|
||||
|
||||
## PseudoClassSelector
|
||||
|
||||
```
|
||||
{
|
||||
"type": "PseudoClassSelector",
|
||||
"name": String,
|
||||
"children": List | null
|
||||
}
|
||||
```
|
||||
|
||||
## PseudoElementSelector
|
||||
|
||||
```
|
||||
{
|
||||
"type": "PseudoElementSelector",
|
||||
"name": String,
|
||||
"children": List | null
|
||||
}
|
||||
```
|
||||
|
||||
## Ratio
|
||||
|
||||
```
|
||||
{
|
||||
"type": "Ratio",
|
||||
"left": String,
|
||||
"right": String
|
||||
}
|
||||
```
|
||||
|
||||
## Raw
|
||||
|
||||
```
|
||||
{
|
||||
"type": "Raw",
|
||||
"value": String
|
||||
}
|
||||
```
|
||||
|
||||
## Rule
|
||||
|
||||
```
|
||||
{
|
||||
"type": "Rule",
|
||||
"prelude": <SelectorList> | <Raw>,
|
||||
"block": <Block>
|
||||
}
|
||||
```
|
||||
|
||||
## Selector
|
||||
|
||||
```
|
||||
{
|
||||
"type": "Selector",
|
||||
"children": List
|
||||
}
|
||||
```
|
||||
|
||||
## SelectorList
|
||||
|
||||
```
|
||||
{
|
||||
"type": "SelectorList",
|
||||
"children": List
|
||||
}
|
||||
```
|
||||
|
||||
## String
|
||||
|
||||
```
|
||||
{
|
||||
"type": "String",
|
||||
"value": String
|
||||
}
|
||||
```
|
||||
|
||||
## StyleSheet
|
||||
|
||||
```
|
||||
{
|
||||
"type": "StyleSheet",
|
||||
"children": List
|
||||
}
|
||||
```
|
||||
|
||||
## TypeSelector
|
||||
|
||||
```
|
||||
{
|
||||
"type": "TypeSelector",
|
||||
"name": String
|
||||
}
|
||||
```
|
||||
|
||||
## UnicodeRange
|
||||
|
||||
```
|
||||
{
|
||||
"type": "UnicodeRange",
|
||||
"value": String
|
||||
}
|
||||
```
|
||||
|
||||
## Url
|
||||
|
||||
```
|
||||
{
|
||||
"type": "Url",
|
||||
"value": <String> | <Raw>
|
||||
}
|
||||
```
|
||||
|
||||
## Value
|
||||
|
||||
```
|
||||
{
|
||||
"type": "Value",
|
||||
"children": List
|
||||
}
|
||||
```
|
||||
|
||||
## WhiteSpace
|
||||
|
||||
```
|
||||
{
|
||||
"type": "WhiteSpace",
|
||||
"value": String
|
||||
}
|
||||
```
|
||||
298
build/node_modules/css-tree/docs/parsing.md
generated
vendored
Normal file
298
build/node_modules/css-tree/docs/parsing.md
generated
vendored
Normal file
@@ -0,0 +1,298 @@
|
||||
# Parsing CSS into AST
|
||||
|
||||
> NOTE: Currenly parser omits redundant separators, spaces and comments (except exclamation comments, i.e. `/*! comment */`) on AST build.
|
||||
|
||||
## parse(source[, options])
|
||||
|
||||
Parses CSS into AST.
|
||||
|
||||
```js
|
||||
// simple parsing with no options
|
||||
var ast = csstree.parse('.example { color: red }');
|
||||
|
||||
// parse with options
|
||||
var ast = csstree.parse('.foo.bar', {
|
||||
context: 'selector',
|
||||
positions: true
|
||||
});
|
||||
```
|
||||
|
||||
Options (optional):
|
||||
|
||||
<!-- MarkdownTOC -->
|
||||
|
||||
- [context](#context)
|
||||
- [atrule](#atrule)
|
||||
- [property](#property)
|
||||
- [positions](#positions)
|
||||
- [tolerant](#tolerant)
|
||||
- [onParseError](#onparseerror)
|
||||
- [filename](#filename)
|
||||
- [offset](#offset)
|
||||
- [line](#line)
|
||||
- [column](#column)
|
||||
- [parseAtrulePrelude](#parseatruleprelude)
|
||||
- [parseRulePrelude](#parseruleprelude)
|
||||
- [parseValue](#parsevalue)
|
||||
- [parseCustomProperty](#parsecustomproperty)
|
||||
|
||||
<!-- /MarkdownTOC -->
|
||||
|
||||
### context
|
||||
|
||||
Type: `string`
|
||||
Default: `'stylesheet'`
|
||||
|
||||
Defines what part of CSS is parsing.
|
||||
|
||||
Contexts:
|
||||
|
||||
- `stylesheet` (default) – regular stylesheet, should be suitable in most cases
|
||||
- `atrule` – at-rule (e.g. `@media screen, print { ... }`)
|
||||
- `atrulePrelude` – at-rule prelude (`screen, print` for example above)
|
||||
- `mediaQueryList` – used to parse comma separated media query list
|
||||
- `mediaQuery` – used to parse media query
|
||||
- `rule` – rule (e.g. `.foo, .bar:hover { color: red; border: 1px solid black; }`)
|
||||
- `selectorList` – selector group (`.foo, .bar:hover` for rule example)
|
||||
- `selector` – selector (`.foo` or `.bar:hover` for rule example)
|
||||
- `block` – block with curly braces (`{ color: red; border: 1px solid black; }` for rule example)
|
||||
- `declarationList` – block content w/o curly braces (`color: red; border: 1px solid black;` for rule example), useful for parsing HTML `style` attribute value
|
||||
- `declaration` – declaration (`color: red` or `border: 1px solid black` for rule example)
|
||||
- `value` – declaration value (`red` or `1px solid black` for rule example)
|
||||
|
||||
### atrule
|
||||
|
||||
Type: `string` or `null`
|
||||
Default: `null`
|
||||
|
||||
Using for `atrulePrelude` context to apply atrule specific parse rules.
|
||||
|
||||
### property
|
||||
|
||||
Type: `string` or `null`
|
||||
Default: `null`
|
||||
|
||||
Using for `value` context to apply property specific parse rules.
|
||||
|
||||
### positions
|
||||
|
||||
Type: `boolean`
|
||||
Default: `false`
|
||||
|
||||
Specify to store locations of node content in original source. Location is storing as `loc` field of nodes. `loc` property is always `null` when option is `false`. The structure of `loc`:
|
||||
|
||||
```
|
||||
loc: {
|
||||
source: 'value of `filename` option or `<unknown>`',
|
||||
start: {
|
||||
offset: <number>,
|
||||
line: <number>,
|
||||
column: <number>
|
||||
},
|
||||
end: {
|
||||
offset: <number>,
|
||||
line: <number>,
|
||||
column: <number>
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
### tolerant
|
||||
|
||||
Type: `boolean`
|
||||
Default: `false`
|
||||
|
||||
Enables tolerant mode, when parser does fail on invalid parts of input, but turns those parts into `Raw` nodes. `onParseError` option can be used to set a function to process errors.
|
||||
|
||||
### onParseError
|
||||
|
||||
Type: `function` or `null`
|
||||
Default: `null`
|
||||
|
||||
Function to process errors that occur on parsing. Make sense in tolerant mode only.
|
||||
|
||||
```js
|
||||
csstree.parse('example { foo; bar: 1! }', {
|
||||
tolerant: true,
|
||||
onParseError: function(error) {
|
||||
console.log(error.message);
|
||||
}
|
||||
});
|
||||
// Colon is expected
|
||||
// Identifier is expected
|
||||
```
|
||||
|
||||
### filename
|
||||
|
||||
Type: `string`
|
||||
Default: `'<unknown>'`
|
||||
|
||||
Filename of source. This value adds to `loc` as `source` property when `positions` option is `true`. Using for source map generation.
|
||||
|
||||
### offset
|
||||
|
||||
Type: `number`
|
||||
Default: `0`
|
||||
|
||||
Start offset. Useful when parsing a fragment of CSS to store a correct positions for node's `loc` property.
|
||||
|
||||
### line
|
||||
|
||||
Type: `number`
|
||||
Default: `1`
|
||||
|
||||
Start line number. Useful when parsing fragment of CSS to store correct positions in node's `loc` property.
|
||||
|
||||
### column
|
||||
|
||||
Type: `number`
|
||||
Default: `1`
|
||||
|
||||
Start column number. Useful when parsing fragment of CSS to store correct positions in node's `loc` property.
|
||||
|
||||
### parseAtrulePrelude
|
||||
|
||||
Type: `boolean`
|
||||
Default: `true`
|
||||
|
||||
Defines to parse a at-rule prelude in details (represents as `AtruleExpresion`, `MediaQueryList` or `SelectorList` if any). Otherwise represents prelude as `Raw` node.
|
||||
|
||||
```js
|
||||
csstree.parse('@example 1 2;');
|
||||
// {
|
||||
// "type": "Atrule",
|
||||
// "prelude": {
|
||||
// "type": "AtrulePrelude",
|
||||
// "children": [
|
||||
// { "type": "Number", "value": "1" },
|
||||
// { "type": "WhiteSpace", "value": " " },
|
||||
// { "type": "Number", "value": "2" }
|
||||
// ]
|
||||
// },
|
||||
// "block": null
|
||||
// }
|
||||
|
||||
csstree.parse('@example 1 2;', { parseAtrulePrelude: false });
|
||||
// {
|
||||
// "type": "Atrule",
|
||||
// "prelude": {
|
||||
// "type": "Raw",
|
||||
// "value": "1 2"
|
||||
// },
|
||||
// "block": null
|
||||
// }
|
||||
```
|
||||
|
||||
### parseRulePrelude
|
||||
|
||||
Type: `boolean`
|
||||
Default: `true`
|
||||
|
||||
Defines to parse a rule prelude in details or left unparsed (represents as `Raw` node).
|
||||
|
||||
```js
|
||||
csstree.parse('.foo {}');
|
||||
// {
|
||||
// "type": "Rule",
|
||||
// "selector": {
|
||||
// "type": "SelectorList",
|
||||
// "children": [
|
||||
// {
|
||||
// "type": "Selector",
|
||||
// "children": [
|
||||
// { "type": "ClassSelector", "name": "foo" }
|
||||
// ]
|
||||
// }
|
||||
// ]
|
||||
// },
|
||||
// "block": {
|
||||
// "type": "Block",
|
||||
// "children": []
|
||||
// }
|
||||
// }
|
||||
|
||||
csstree.parse('.foo {}', { parseRulePrelude: false });
|
||||
// {
|
||||
// "type": "Rule",
|
||||
// "selector": {
|
||||
// "type": "Raw",
|
||||
// "value": ".foo"
|
||||
// },
|
||||
// "block": {
|
||||
// "type": "Block",
|
||||
// "children": []
|
||||
// }
|
||||
// }
|
||||
```
|
||||
|
||||
### parseValue
|
||||
|
||||
Type: `boolean`
|
||||
Default: `true`
|
||||
|
||||
Defines to parse a declaration value in details (represents as `Value`). Otherwise represents value as `Raw` node.
|
||||
|
||||
```js
|
||||
csstree.parse('color: #aabbcc', { context: 'declaration' });
|
||||
// {
|
||||
// "type": "Declaration",
|
||||
// "important": false,
|
||||
// "property": "color",
|
||||
// "value": {
|
||||
// "type": "Value",
|
||||
// "children": [
|
||||
// {
|
||||
// "type": "HexColor",
|
||||
// "value": "aabbcc"
|
||||
// }
|
||||
// ]
|
||||
// }
|
||||
// }
|
||||
|
||||
csstree.parse('color: #aabbcc', { context: 'declaration', parseValue: false });
|
||||
// {
|
||||
// "type": "Declaration",
|
||||
// "important": false,
|
||||
// "property": "color",
|
||||
// "value": {
|
||||
// "type": "Raw",
|
||||
// "value": " #aabbcc"
|
||||
// }
|
||||
// }
|
||||
```
|
||||
|
||||
### parseCustomProperty
|
||||
|
||||
Type: `boolean`
|
||||
Default: `false`
|
||||
|
||||
Defines to parse a custom property value and a `var()` fallback in details (represents as `Value`). Otherwise represents value as `Raw` node.
|
||||
|
||||
```js
|
||||
csstree.parse('--custom: #aabbcc', { context: 'declaration' });
|
||||
// {
|
||||
// "type": "Declaration",
|
||||
// "important": false,
|
||||
// "property": "--custom",
|
||||
// "value": {
|
||||
// "type": "Raw",
|
||||
// "value": " #aabbcc"
|
||||
// }
|
||||
// }
|
||||
|
||||
csstree.parse('--custom: #aabbcc', { context: 'declaration', parseCustomProperty: true });
|
||||
// {
|
||||
// "type": "Declaration",
|
||||
// "important": false,
|
||||
// "property": "--custom",
|
||||
// "value": {
|
||||
// "type": "Value",
|
||||
// "children": [
|
||||
// {
|
||||
// "type": "HexColor",
|
||||
// "value": "aabbcc"
|
||||
// }
|
||||
// ]
|
||||
// }
|
||||
// }
|
||||
```
|
||||
16
build/node_modules/css-tree/docs/readme.md
generated
vendored
Normal file
16
build/node_modules/css-tree/docs/readme.md
generated
vendored
Normal file
@@ -0,0 +1,16 @@
|
||||
# API
|
||||
|
||||
## General
|
||||
|
||||
- [Parsing CSS into AST](parsing.md)
|
||||
- [AST format](ast.md)
|
||||
- [Translate AST to string](translate.md)
|
||||
- [AST traversal](traversal.md)
|
||||
- [Utils to work with AST](utils.md)
|
||||
- [Working with syntax](syntax.md)
|
||||
|
||||
## Classes
|
||||
|
||||
- [Tokenizer](Tokenizer.md)
|
||||
- [Lexer](Lexer.md)
|
||||
- [List](List.md)
|
||||
502
build/node_modules/css-tree/docs/supported.md
generated
vendored
Normal file
502
build/node_modules/css-tree/docs/supported.md
generated
vendored
Normal file
@@ -0,0 +1,502 @@
|
||||
# Supported syntaxes
|
||||
|
||||
> ⚠️ This is a basic implementation of support reference. Further improvements are pending. See comments on each section for details.
|
||||
|
||||
> ⚠️ This page is auto-generated. Please, don't update any content between special comments.
|
||||
|
||||
<!-- MarkdownTOC -->
|
||||
|
||||
- [Atrules](#atrules)
|
||||
- [Functional pseudos](#functional-pseudos)
|
||||
- [Properties](#properties)
|
||||
|
||||
<!-- /MarkdownTOC -->
|
||||
|
||||
## Atrules
|
||||
|
||||
At-rules with a custom parsing rules. In fact, any at-rule is supported but prelude and block are parsing with default rules. Validation support isn't supported for at-rules at the moment.
|
||||
|
||||
<!-- gen:atrule -->
|
||||
|
||||
- `@font-face`
|
||||
- `@import`
|
||||
- `@media`
|
||||
- `@page`
|
||||
- `@supports`
|
||||
|
||||
<!-- /gen:atrule -->
|
||||
|
||||
## Functional pseudos
|
||||
|
||||
Functional pseudos with a custom parsing rule. Non-listed functional pseudos don't parse a content inside parentheses and represent it as a `Raw` node if any. There is no difference between pseudo class and pseudo element on parsing, like no validation for functional pseudos is supported at the moment.
|
||||
|
||||
<!-- gen:pseudo -->
|
||||
|
||||
- `:dir()`
|
||||
- `:has()`
|
||||
- `:lang()`
|
||||
- `:matches()`
|
||||
- `:not()`
|
||||
- `:nth-child()`
|
||||
- `:nth-last-child()`
|
||||
- `:nth-last-of-type()`
|
||||
- `:nth-of-type()`
|
||||
- `:slotted()`
|
||||
|
||||
<!-- /gen:pseudo -->
|
||||
|
||||
## Properties
|
||||
|
||||
Support for a property means CSSTree has a grammar for such property, so its value can be checked (validated) for complience to spec or browser inplementations (for non-standart properties). The validation doesn't perform on parsing stage and should be done as a separate step using Lexer API. In other words any property value can be parsed with default parsing rules, but validation is possible for listed properties only.
|
||||
|
||||
<!-- gen:properties -->
|
||||
|
||||
- `-moz-appearance`
|
||||
- `-moz-background-clip`
|
||||
- `-moz-binding`
|
||||
- `-moz-border-bottom-colors`
|
||||
- `-moz-border-left-colors`
|
||||
- `-moz-border-radius-bottomleft`
|
||||
- `-moz-border-radius-bottomright`
|
||||
- `-moz-border-radius-topleft`
|
||||
- `-moz-border-radius-topright`
|
||||
- `-moz-border-right-colors`
|
||||
- `-moz-border-top-colors`
|
||||
- `-moz-context-properties`
|
||||
- `-moz-float-edge`
|
||||
- `-moz-force-broken-image-icon`
|
||||
- `-moz-image-region`
|
||||
- `-moz-orient`
|
||||
- `-moz-osx-font-smoothing`
|
||||
- `-moz-outline-radius`
|
||||
- `-moz-outline-radius-bottomleft`
|
||||
- `-moz-outline-radius-bottomright`
|
||||
- `-moz-outline-radius-topleft`
|
||||
- `-moz-outline-radius-topright`
|
||||
- `-moz-stack-sizing`
|
||||
- `-moz-text-blink`
|
||||
- `-moz-user-focus`
|
||||
- `-moz-user-input`
|
||||
- `-moz-user-modify`
|
||||
- `-moz-user-select`
|
||||
- `-moz-window-shadow`
|
||||
- `-ms-filter`
|
||||
- `-ms-flex-align`
|
||||
- `-ms-flex-item-align`
|
||||
- `-ms-flex-line-pack`
|
||||
- `-ms-flex-negative`
|
||||
- `-ms-flex-order`
|
||||
- `-ms-flex-pack`
|
||||
- `-ms-flex-positive`
|
||||
- `-ms-flex-preferred-size`
|
||||
- `-ms-grid-column-align`
|
||||
- `-ms-grid-row-align`
|
||||
- `-ms-high-contrast-adjust`
|
||||
- `-ms-interpolation-mode`
|
||||
- `-ms-overflow-style`
|
||||
- `-ms-user-select`
|
||||
- `-webkit-appearance`
|
||||
- `-webkit-background-clip`
|
||||
- `-webkit-border-before`
|
||||
- `-webkit-border-before-color`
|
||||
- `-webkit-border-before-style`
|
||||
- `-webkit-border-before-width`
|
||||
- `-webkit-box-reflect`
|
||||
- `-webkit-column-break-after`
|
||||
- `-webkit-column-break-before`
|
||||
- `-webkit-column-break-inside`
|
||||
- `-webkit-font-smoothing`
|
||||
- `-webkit-line-clamp`
|
||||
- `-webkit-mask`
|
||||
- `-webkit-mask-attachment`
|
||||
- `-webkit-mask-box-image`
|
||||
- `-webkit-mask-clip`
|
||||
- `-webkit-mask-composite`
|
||||
- `-webkit-mask-image`
|
||||
- `-webkit-mask-origin`
|
||||
- `-webkit-mask-position`
|
||||
- `-webkit-mask-position-x`
|
||||
- `-webkit-mask-position-y`
|
||||
- `-webkit-mask-repeat`
|
||||
- `-webkit-mask-repeat-x`
|
||||
- `-webkit-mask-repeat-y`
|
||||
- `-webkit-overflow-scrolling`
|
||||
- `-webkit-print-color-adjust`
|
||||
- `-webkit-tap-highlight-color`
|
||||
- `-webkit-text-fill-color`
|
||||
- `-webkit-text-security`
|
||||
- `-webkit-text-stroke`
|
||||
- `-webkit-text-stroke-color`
|
||||
- `-webkit-text-stroke-width`
|
||||
- `-webkit-touch-callout`
|
||||
- `-webkit-user-drag`
|
||||
- `-webkit-user-select`
|
||||
- `align-content`
|
||||
- `align-items`
|
||||
- `align-self`
|
||||
- `alignment-baseline`
|
||||
- `all`
|
||||
- `animation`
|
||||
- `animation-delay`
|
||||
- `animation-direction`
|
||||
- `animation-duration`
|
||||
- `animation-fill-mode`
|
||||
- `animation-iteration-count`
|
||||
- `animation-name`
|
||||
- `animation-play-state`
|
||||
- `animation-timing-function`
|
||||
- `appearance`
|
||||
- `azimuth`
|
||||
- `backdrop-filter`
|
||||
- `backface-visibility`
|
||||
- `background`
|
||||
- `background-attachment`
|
||||
- `background-blend-mode`
|
||||
- `background-clip`
|
||||
- `background-color`
|
||||
- `background-image`
|
||||
- `background-origin`
|
||||
- `background-position`
|
||||
- `background-position-x`
|
||||
- `background-position-y`
|
||||
- `background-repeat`
|
||||
- `background-size`
|
||||
- `baseline-shift`
|
||||
- `behavior`
|
||||
- `block-size`
|
||||
- `border`
|
||||
- `border-block-end`
|
||||
- `border-block-end-color`
|
||||
- `border-block-end-style`
|
||||
- `border-block-end-width`
|
||||
- `border-block-start`
|
||||
- `border-block-start-color`
|
||||
- `border-block-start-style`
|
||||
- `border-block-start-width`
|
||||
- `border-bottom`
|
||||
- `border-bottom-color`
|
||||
- `border-bottom-left-radius`
|
||||
- `border-bottom-right-radius`
|
||||
- `border-bottom-style`
|
||||
- `border-bottom-width`
|
||||
- `border-collapse`
|
||||
- `border-color`
|
||||
- `border-image`
|
||||
- `border-image-outset`
|
||||
- `border-image-repeat`
|
||||
- `border-image-slice`
|
||||
- `border-image-source`
|
||||
- `border-image-width`
|
||||
- `border-inline-end`
|
||||
- `border-inline-end-color`
|
||||
- `border-inline-end-style`
|
||||
- `border-inline-end-width`
|
||||
- `border-inline-start`
|
||||
- `border-inline-start-color`
|
||||
- `border-inline-start-style`
|
||||
- `border-inline-start-width`
|
||||
- `border-left`
|
||||
- `border-left-color`
|
||||
- `border-left-style`
|
||||
- `border-left-width`
|
||||
- `border-radius`
|
||||
- `border-right`
|
||||
- `border-right-color`
|
||||
- `border-right-style`
|
||||
- `border-right-width`
|
||||
- `border-spacing`
|
||||
- `border-style`
|
||||
- `border-top`
|
||||
- `border-top-color`
|
||||
- `border-top-left-radius`
|
||||
- `border-top-right-radius`
|
||||
- `border-top-style`
|
||||
- `border-top-width`
|
||||
- `border-width`
|
||||
- `bottom`
|
||||
- `box-align`
|
||||
- `box-decoration-break`
|
||||
- `box-direction`
|
||||
- `box-flex`
|
||||
- `box-flex-group`
|
||||
- `box-lines`
|
||||
- `box-ordinal-group`
|
||||
- `box-orient`
|
||||
- `box-pack`
|
||||
- `box-shadow`
|
||||
- `box-sizing`
|
||||
- `break-after`
|
||||
- `break-before`
|
||||
- `break-inside`
|
||||
- `caption-side`
|
||||
- `caret-color`
|
||||
- `clear`
|
||||
- `clip`
|
||||
- `clip-path`
|
||||
- `clip-rule`
|
||||
- `color`
|
||||
- `column-count`
|
||||
- `column-fill`
|
||||
- `column-gap`
|
||||
- `column-rule`
|
||||
- `column-rule-color`
|
||||
- `column-rule-style`
|
||||
- `column-rule-width`
|
||||
- `column-span`
|
||||
- `column-width`
|
||||
- `columns`
|
||||
- `contain`
|
||||
- `content`
|
||||
- `counter-increment`
|
||||
- `counter-reset`
|
||||
- `cue`
|
||||
- `cue-after`
|
||||
- `cue-before`
|
||||
- `cursor`
|
||||
- `direction`
|
||||
- `display`
|
||||
- `display-inside`
|
||||
- `display-list`
|
||||
- `display-outside`
|
||||
- `dominant-baseline`
|
||||
- `empty-cells`
|
||||
- `fill`
|
||||
- `fill-opacity`
|
||||
- `fill-rule`
|
||||
- `filter`
|
||||
- `flex`
|
||||
- `flex-basis`
|
||||
- `flex-direction`
|
||||
- `flex-flow`
|
||||
- `flex-grow`
|
||||
- `flex-shrink`
|
||||
- `flex-wrap`
|
||||
- `float`
|
||||
- `font`
|
||||
- `font-family`
|
||||
- `font-feature-settings`
|
||||
- `font-kerning`
|
||||
- `font-language-override`
|
||||
- `font-size`
|
||||
- `font-size-adjust`
|
||||
- `font-stretch`
|
||||
- `font-style`
|
||||
- `font-synthesis`
|
||||
- `font-variant`
|
||||
- `font-variant-alternates`
|
||||
- `font-variant-caps`
|
||||
- `font-variant-east-asian`
|
||||
- `font-variant-ligatures`
|
||||
- `font-variant-numeric`
|
||||
- `font-variant-position`
|
||||
- `font-variation-settings`
|
||||
- `font-weight`
|
||||
- `glyph-orientation-horizontal`
|
||||
- `glyph-orientation-vertical`
|
||||
- `grid`
|
||||
- `grid-area`
|
||||
- `grid-auto-columns`
|
||||
- `grid-auto-flow`
|
||||
- `grid-auto-rows`
|
||||
- `grid-column`
|
||||
- `grid-column-end`
|
||||
- `grid-column-gap`
|
||||
- `grid-column-start`
|
||||
- `grid-gap`
|
||||
- `grid-row`
|
||||
- `grid-row-end`
|
||||
- `grid-row-gap`
|
||||
- `grid-row-start`
|
||||
- `grid-template`
|
||||
- `grid-template-areas`
|
||||
- `grid-template-columns`
|
||||
- `grid-template-rows`
|
||||
- `height`
|
||||
- `hyphens`
|
||||
- `image-orientation`
|
||||
- `image-rendering`
|
||||
- `image-resolution`
|
||||
- `ime-mode`
|
||||
- `initial-letter`
|
||||
- `initial-letter-align`
|
||||
- `inline-size`
|
||||
- `isolation`
|
||||
- `justify-content`
|
||||
- `kerning`
|
||||
- `left`
|
||||
- `letter-spacing`
|
||||
- `line-break`
|
||||
- `line-height`
|
||||
- `list-style`
|
||||
- `list-style-image`
|
||||
- `list-style-position`
|
||||
- `list-style-type`
|
||||
- `margin`
|
||||
- `margin-block-end`
|
||||
- `margin-block-start`
|
||||
- `margin-bottom`
|
||||
- `margin-inline-end`
|
||||
- `margin-inline-start`
|
||||
- `margin-left`
|
||||
- `margin-right`
|
||||
- `margin-top`
|
||||
- `marker`
|
||||
- `marker-end`
|
||||
- `marker-mid`
|
||||
- `marker-offset`
|
||||
- `marker-start`
|
||||
- `mask`
|
||||
- `mask-clip`
|
||||
- `mask-composite`
|
||||
- `mask-image`
|
||||
- `mask-mode`
|
||||
- `mask-origin`
|
||||
- `mask-position`
|
||||
- `mask-repeat`
|
||||
- `mask-size`
|
||||
- `mask-type`
|
||||
- `max-block-size`
|
||||
- `max-height`
|
||||
- `max-inline-size`
|
||||
- `max-width`
|
||||
- `min-block-size`
|
||||
- `min-height`
|
||||
- `min-inline-size`
|
||||
- `min-width`
|
||||
- `mix-blend-mode`
|
||||
- `object-fit`
|
||||
- `object-position`
|
||||
- `offset`
|
||||
- `offset-anchor`
|
||||
- `offset-block-end`
|
||||
- `offset-block-start`
|
||||
- `offset-distance`
|
||||
- `offset-inline-end`
|
||||
- `offset-inline-start`
|
||||
- `offset-path`
|
||||
- `offset-position`
|
||||
- `offset-rotate`
|
||||
- `opacity`
|
||||
- `order`
|
||||
- `orphans`
|
||||
- `outline`
|
||||
- `outline-color`
|
||||
- `outline-offset`
|
||||
- `outline-style`
|
||||
- `outline-width`
|
||||
- `overflow`
|
||||
- `overflow-clip-box`
|
||||
- `overflow-wrap`
|
||||
- `overflow-x`
|
||||
- `overflow-y`
|
||||
- `padding`
|
||||
- `padding-block-end`
|
||||
- `padding-block-start`
|
||||
- `padding-bottom`
|
||||
- `padding-inline-end`
|
||||
- `padding-inline-start`
|
||||
- `padding-left`
|
||||
- `padding-right`
|
||||
- `padding-top`
|
||||
- `page-break-after`
|
||||
- `page-break-before`
|
||||
- `page-break-inside`
|
||||
- `pause`
|
||||
- `pause-after`
|
||||
- `pause-before`
|
||||
- `perspective`
|
||||
- `perspective-origin`
|
||||
- `pointer-events`
|
||||
- `position`
|
||||
- `quotes`
|
||||
- `resize`
|
||||
- `rest`
|
||||
- `rest-after`
|
||||
- `rest-before`
|
||||
- `right`
|
||||
- `ruby-align`
|
||||
- `ruby-merge`
|
||||
- `ruby-position`
|
||||
- `scroll-behavior`
|
||||
- `scroll-snap-coordinate`
|
||||
- `scroll-snap-destination`
|
||||
- `scroll-snap-points-x`
|
||||
- `scroll-snap-points-y`
|
||||
- `scroll-snap-type`
|
||||
- `scroll-snap-type-x`
|
||||
- `scroll-snap-type-y`
|
||||
- `shape-image-threshold`
|
||||
- `shape-margin`
|
||||
- `shape-outside`
|
||||
- `shape-rendering`
|
||||
- `speak`
|
||||
- `speak-as`
|
||||
- `src`
|
||||
- `stroke`
|
||||
- `stroke-dasharray`
|
||||
- `stroke-dashoffset`
|
||||
- `stroke-linecap`
|
||||
- `stroke-linejoin`
|
||||
- `stroke-miterlimit`
|
||||
- `stroke-opacity`
|
||||
- `stroke-width`
|
||||
- `tab-size`
|
||||
- `table-layout`
|
||||
- `text-align`
|
||||
- `text-align-last`
|
||||
- `text-anchor`
|
||||
- `text-combine-upright`
|
||||
- `text-decoration`
|
||||
- `text-decoration-color`
|
||||
- `text-decoration-line`
|
||||
- `text-decoration-skip`
|
||||
- `text-decoration-style`
|
||||
- `text-emphasis`
|
||||
- `text-emphasis-color`
|
||||
- `text-emphasis-position`
|
||||
- `text-emphasis-style`
|
||||
- `text-indent`
|
||||
- `text-justify`
|
||||
- `text-orientation`
|
||||
- `text-overflow`
|
||||
- `text-rendering`
|
||||
- `text-shadow`
|
||||
- `text-size-adjust`
|
||||
- `text-transform`
|
||||
- `text-underline-position`
|
||||
- `top`
|
||||
- `touch-action`
|
||||
- `transform`
|
||||
- `transform-box`
|
||||
- `transform-origin`
|
||||
- `transform-style`
|
||||
- `transition`
|
||||
- `transition-delay`
|
||||
- `transition-duration`
|
||||
- `transition-property`
|
||||
- `transition-timing-function`
|
||||
- `unicode-bidi`
|
||||
- `unicode-range`
|
||||
- `user-select`
|
||||
- `vertical-align`
|
||||
- `visibility`
|
||||
- `voice-balance`
|
||||
- `voice-duration`
|
||||
- `voice-family`
|
||||
- `voice-pitch`
|
||||
- `voice-range`
|
||||
- `voice-rate`
|
||||
- `voice-stress`
|
||||
- `voice-volume`
|
||||
- `white-space`
|
||||
- `widows`
|
||||
- `width`
|
||||
- `will-change`
|
||||
- `word-break`
|
||||
- `word-spacing`
|
||||
- `word-wrap`
|
||||
- `writing-mode`
|
||||
- `z-index`
|
||||
- `zoom`
|
||||
|
||||
<!-- /gen:properties -->
|
||||
3
build/node_modules/css-tree/docs/syntax.md
generated
vendored
Normal file
3
build/node_modules/css-tree/docs/syntax.md
generated
vendored
Normal file
@@ -0,0 +1,3 @@
|
||||
# Working with syntax
|
||||
|
||||
> To be done...
|
||||
31
build/node_modules/css-tree/docs/translate.md
generated
vendored
Normal file
31
build/node_modules/css-tree/docs/translate.md
generated
vendored
Normal file
@@ -0,0 +1,31 @@
|
||||
# Translate AST to string
|
||||
|
||||
<!-- MarkdownTOC -->
|
||||
|
||||
- [translate\(ast\)](#translateast)
|
||||
- [translateWithSourceMap\(ast\)](#translatewithsourcemapast)
|
||||
|
||||
<!-- /MarkdownTOC -->
|
||||
|
||||
## translate(ast)
|
||||
|
||||
Converts AST to string.
|
||||
|
||||
```js
|
||||
var ast = csstree.parse('.test { color: red }');
|
||||
console.log(csstree.translate(ast));
|
||||
// > .test{color:red}
|
||||
```
|
||||
|
||||
## translateWithSourceMap(ast)
|
||||
|
||||
The same as `translate()` but also generates source map (nodes should contain positions in `loc` property).
|
||||
|
||||
```js
|
||||
var ast = csstree.parse('.test { color: red }', {
|
||||
filename: 'my.css',
|
||||
positions: true
|
||||
});
|
||||
console.log(csstree.translateWithSourceMap(ast));
|
||||
// { css: '.test{color:red}', map: SourceMapGenerator {} }
|
||||
```
|
||||
123
build/node_modules/css-tree/docs/traversal.md
generated
vendored
Normal file
123
build/node_modules/css-tree/docs/traversal.md
generated
vendored
Normal file
@@ -0,0 +1,123 @@
|
||||
# AST traversal
|
||||
|
||||
<!-- MarkdownTOC -->
|
||||
|
||||
- [Basic example](#basic-example)
|
||||
- [walk\(ast, handler\)](#walkast-handler)
|
||||
- [walkUp\(ast, handler\)](#walkupast-handler)
|
||||
- [walkRules\(ast, handler\)](#walkrulesast-handler)
|
||||
- [walkRulesRight\(ast, handler\)](#walkrulesrightast-handler)
|
||||
- [walkDeclarations\(ast, handler\)](#walkdeclarationsast-handler)
|
||||
|
||||
<!-- /MarkdownTOC -->
|
||||
|
||||
## Basic example
|
||||
|
||||
```js
|
||||
var csstree = require('css-tree');
|
||||
|
||||
csstree.walk(csstree.parse('.a { color: red; }'), function(node) {
|
||||
console.log(node.type);
|
||||
});
|
||||
// StyleSheet
|
||||
// Rule
|
||||
// SelectorList
|
||||
// Selector
|
||||
// ClassSelector
|
||||
// Block
|
||||
// Declaration
|
||||
// Value
|
||||
// Identifier
|
||||
```
|
||||
|
||||
## walk(ast, handler)
|
||||
|
||||
Visits each node of AST in natural way and calls handler for each one. `handler` receives three arguments:
|
||||
|
||||
- `node` – current AST node
|
||||
- `item` – node wrapper when node is a list member; this wrapper contains references to `prev` and `next` nodes in list
|
||||
- `list` – reference to list when node is a list member; it's useful for operations on list like `remove()` or `insert()`
|
||||
|
||||
Context for handler an object, that contains references to some parent nodes:
|
||||
|
||||
- `root` – refers to `ast` root node (actually it's a node passed to walker function)
|
||||
- `stylesheet` – refers to `StyleSheet` node, usually it's a root node
|
||||
- `atrulePrelude` – refers to `AtrulePrelude` node if any
|
||||
- `rule` – refers to closest `Rule` node if any
|
||||
- `selector` – refers to `SelectorList` node if any
|
||||
- `block` - refers to closest `Block` node if any
|
||||
- `declaration` – refers to `Declaration` node if any
|
||||
- `function` – refers to closest `Function`, `PseudoClassSelector` or `PseudoElementSelector` node if current node inside one of them
|
||||
|
||||
```js
|
||||
// collect all urls in declarations
|
||||
var csstree = require('./lib/index.js');
|
||||
var urls = [];
|
||||
var ast = csstree.parse(`
|
||||
@import url(import.css);
|
||||
.foo { background: url('foo.jpg'); }
|
||||
.bar { background-image: url(bar.png); }
|
||||
`);
|
||||
|
||||
csstree.walk(ast, function(node) {
|
||||
if (this.declaration !== null && node.type === 'Url') {
|
||||
var value = node.value;
|
||||
|
||||
if (value.type === 'Raw') {
|
||||
urls.push(value.value);
|
||||
} else {
|
||||
urls.push(value.value.substr(1, value.value.length - 2));
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
console.log(urls);
|
||||
// [ 'foo.jpg', 'bar.png' ]
|
||||
```
|
||||
|
||||
## walkUp(ast, handler)
|
||||
|
||||
Same as `walk()` but visits nodes in down-to-top order. Useful to process deepest nodes and then their parents.
|
||||
|
||||
```js
|
||||
var csstree = require('css-tree');
|
||||
var ast = csstree.parse('.a { color: red; }');
|
||||
|
||||
csstree.walk(ast, function(node) {
|
||||
console.log(node.type);
|
||||
});
|
||||
// StyleSheet
|
||||
// Rule
|
||||
// SelectorList
|
||||
// Selector
|
||||
// ClassSelector
|
||||
// Block
|
||||
// Declaration
|
||||
// Value
|
||||
// Identifier
|
||||
|
||||
csstree.walkUp(ast, function(node) {
|
||||
console.log(node.type);
|
||||
});
|
||||
// ClassSelector
|
||||
// Selector
|
||||
// SelectorList
|
||||
// Identifier
|
||||
// Value
|
||||
// Declaration
|
||||
// Block
|
||||
// Rule
|
||||
// StyleSheet
|
||||
```
|
||||
|
||||
## walkRules(ast, handler)
|
||||
|
||||
Same as `walk()` but visits `Rule` and `Atrule` nodes only.
|
||||
|
||||
## walkRulesRight(ast, handler)
|
||||
|
||||
Same as `walkRules()` but visits nodes in reverse order (from last to first).
|
||||
|
||||
## walkDeclarations(ast, handler)
|
||||
|
||||
Visit all declarations.
|
||||
147
build/node_modules/css-tree/docs/utils.md
generated
vendored
Normal file
147
build/node_modules/css-tree/docs/utils.md
generated
vendored
Normal file
@@ -0,0 +1,147 @@
|
||||
# Utils to work with AST
|
||||
|
||||
<!-- MarkdownTOC -->
|
||||
|
||||
- [property\(name\)](#propertyname)
|
||||
- [keyword\(name\)](#keywordname)
|
||||
- [clone\(ast\)](#cloneast)
|
||||
- [fromPlainObject\(object\)](#fromplainobjectobject)
|
||||
- [toPlainObject\(ast\)](#toplainobjectast)
|
||||
|
||||
<!-- /MarkdownTOC -->
|
||||
|
||||
## property(name)
|
||||
|
||||
Returns a details about property name, i.e. vendor prefix, used hack etc. Can be used for safe test of declaration property name.
|
||||
|
||||
```js
|
||||
var csstree = require('css-tree');
|
||||
|
||||
csstree.property('*-vendor-property');
|
||||
// {
|
||||
// name: 'property',
|
||||
// variable: false,
|
||||
// prefix: '*-vendor-',
|
||||
// vendor: '-vendor-',
|
||||
// hack: '*'
|
||||
// };
|
||||
csstree.property('--test-var');
|
||||
// {
|
||||
// name: '--test-var',
|
||||
// variable: true,
|
||||
// prefix: '',
|
||||
// vendor: '',
|
||||
// hack: ''
|
||||
// };
|
||||
```
|
||||
|
||||
`property()` function normalize name to lower case, but not custom property names (since custom property names are case sensitive). It returns the same immutable (freezed) object for the same input name when normalized.
|
||||
|
||||
```js
|
||||
csstree.property('name') === csstree.property('NAME') // true
|
||||
csstree.property('NAME').name === 'name' // true
|
||||
csstree.property('--custom') === csstree.property('--Custom') // false
|
||||
|
||||
var info = csstree.property('NAME');
|
||||
info.name === 'name'; //
|
||||
info.name = 'foo'; // have no effect
|
||||
info.name === 'name'; // true
|
||||
```
|
||||
|
||||
Supported hacks:
|
||||
|
||||
- `_` in the beginning
|
||||
- `*` in the beginning
|
||||
- `$` in the beginning
|
||||
- `//` in the beginning
|
||||
|
||||
## keyword(name)
|
||||
|
||||
The same as `property()` function, but without hack and custom property name detection.
|
||||
|
||||
```js
|
||||
var csstree = require('css-tree');
|
||||
|
||||
csstree.keyword('-vendor-keyword');
|
||||
// {
|
||||
// name: 'keyword',
|
||||
// prefix: '-vendor-',
|
||||
// vendor: '-vendor-'
|
||||
// };
|
||||
```
|
||||
|
||||
## clone(ast)
|
||||
|
||||
Make an AST node deep copy.
|
||||
|
||||
```js
|
||||
var orig = csstree.parse('.test { color: red }');
|
||||
var copy = csstree.clone(orig);
|
||||
|
||||
csstree.walk(copy, function(node) {
|
||||
if (node.type === 'Class') {
|
||||
node.name = 'replaced';
|
||||
}
|
||||
});
|
||||
|
||||
console.log(csstree.translate(orig));
|
||||
// .test{color:red}
|
||||
console.log(csstree.translate(copy));
|
||||
// .replaced{color:red}
|
||||
```
|
||||
|
||||
## fromPlainObject(object)
|
||||
|
||||
`fromPlainObject()` recursively walks through tree and coverts each `children` value into a List instance if value is an array.
|
||||
|
||||
```js
|
||||
var csstree = require('css-tree');
|
||||
var ast = {
|
||||
"type": "SelectorList",
|
||||
"children": []
|
||||
};
|
||||
|
||||
console.log(Array.isArray(ast.children)); // true
|
||||
console.log(ast.children instanceof csstree.List); // false
|
||||
|
||||
ast = csstree.fromPlainObject(ast);
|
||||
|
||||
console.log(Array.isArray(ast.children)); // false
|
||||
console.log(ast.children instanceof csstree.List); // true
|
||||
```
|
||||
|
||||
It recursively walk through tree and converts `children` value to List instance if it's an array. Implementation have no protection from cycles in tree, therefore object tree should be acyclic.
|
||||
|
||||
Function mutates the passed object tree. If you want to avoid it use `clone()` function before passing object to `fromPlainObject()`.
|
||||
|
||||
```js
|
||||
ast = csstree.fromPlainObject(csstree.clone(ast));
|
||||
```
|
||||
|
||||
## toPlainObject(ast)
|
||||
|
||||
`fromPlainObject()` recursively walks through tree and coverts each `children` value to regular array if value is a List instance.
|
||||
|
||||
```js
|
||||
var csstree = require('css-tree');
|
||||
var ast = {
|
||||
"type": "SelectorList",
|
||||
"children": new List()
|
||||
};
|
||||
|
||||
console.log(Array.isArray(ast.children)); // false
|
||||
console.log(ast.children instanceof csstree.List); // true
|
||||
|
||||
ast = csstree.toPlainObject(ast);
|
||||
|
||||
console.log(Array.isArray(ast.children)); // true
|
||||
console.log(ast.children instanceof csstree.List); // false
|
||||
```
|
||||
|
||||
Implementation have no protection from cycles in tree, therefore object tree should be acyclic.
|
||||
|
||||
Function mutates the passed object tree. If you want to avoid it use `clone()` function before passing object to `toPlainObject()`.
|
||||
|
||||
```js
|
||||
ast = csstree.toPlainObject(csstree.clone(ast));
|
||||
```
|
||||
Reference in New Issue
Block a user