swc/css/parser/tests/fixture/value/custom-property/output.json
Alexander Akait 0b76d29ae4
feat(css/ast): Add SelectorList (#2639)
swc_css_ast:
 - Add `SelectorLsit`.
 - Use `SelectorList` instead of `Vec<ComplexSelector>`.
2021-11-04 09:54:55 +00:00

1055 lines
29 KiB
JSON

{
"type": "Stylesheet",
"span": {
"start": 0,
"end": 433,
"ctxt": 0
},
"rules": [
{
"type": "StyleRule",
"span": {
"start": 0,
"end": 432,
"ctxt": 0
},
"selectors": {
"type": "SelectorList",
"span": {
"start": 0,
"end": 5,
"ctxt": 0
},
"children": [
{
"type": "ComplexSelector",
"span": {
"start": 0,
"end": 5,
"ctxt": 0
},
"selectors": [
{
"type": "CompoundSelector",
"span": {
"start": 0,
"end": 5,
"ctxt": 0
},
"hasNestPrefix": false,
"combinator": null,
"typeSelector": null,
"subclassSelectors": [
{
"type": "PseudoSelector",
"span": {
"start": 0,
"end": 5,
"ctxt": 0
},
"isElement": false,
"name": {
"type": "Text",
"span": {
"start": 1,
"end": 5,
"ctxt": 0
},
"value": "root",
"raw": "root"
},
"args": {
"type": "Tokens",
"span": {
"start": 0,
"end": 0,
"ctxt": 0
},
"tokens": []
}
}
]
}
]
}
]
},
"block": {
"type": "Block",
"span": {
"start": 6,
"end": 432,
"ctxt": 0
},
"items": [
{
"type": "Declaration",
"span": {
"start": 12,
"end": 23,
"ctxt": 0
},
"property": {
"type": "Text",
"span": {
"start": 12,
"end": 20,
"ctxt": 0
},
"value": "--number",
"raw": "--number"
},
"value": [
{
"type": "Number",
"span": {
"start": 22,
"end": 23,
"ctxt": 0
},
"value": 1.0,
"raw": "1"
}
],
"important": null
},
{
"type": "Declaration",
"span": {
"start": 29,
"end": 42,
"ctxt": 0
},
"property": {
"type": "Text",
"span": {
"start": 29,
"end": 35,
"ctxt": 0
},
"value": "--unit",
"raw": "--unit"
},
"value": [
{
"type": "UnitValue",
"span": {
"start": 37,
"end": 42,
"ctxt": 0
},
"value": {
"type": "Number",
"span": {
"start": 37,
"end": 40,
"ctxt": 0
},
"value": 100.0,
"raw": "100"
},
"unit": {
"span": {
"start": 40,
"end": 42,
"ctxt": 0
},
"value": "vw",
"raw": "vw"
}
}
],
"important": null
},
{
"type": "Declaration",
"span": {
"start": 48,
"end": 61,
"ctxt": 0
},
"property": {
"type": "Text",
"span": {
"start": 48,
"end": 55,
"ctxt": 0
},
"value": "--color",
"raw": "--color"
},
"value": [
{
"type": "HashValue",
"span": {
"start": 57,
"end": 61,
"ctxt": 0
},
"value": "06c",
"raw": "06c"
}
],
"important": null
},
{
"type": "Declaration",
"span": {
"start": 68,
"end": 91,
"ctxt": 0
},
"property": {
"type": "Text",
"span": {
"start": 68,
"end": 78,
"ctxt": 0
},
"value": "--function",
"raw": "--function"
},
"value": [
{
"type": "FnValue",
"span": {
"start": 80,
"end": 91,
"ctxt": 0
},
"name": {
"type": "Text",
"span": {
"start": 80,
"end": 84,
"ctxt": 0
},
"value": "calc",
"raw": "calc"
},
"args": [
{
"type": "BinValue",
"span": {
"start": 85,
"end": 90,
"ctxt": 0
},
"op": "+",
"left": {
"type": "Number",
"span": {
"start": 85,
"end": 86,
"ctxt": 0
},
"value": 1.0,
"raw": "1"
},
"right": {
"type": "Number",
"span": {
"start": 89,
"end": 90,
"ctxt": 0
},
"value": 1.0,
"raw": "1"
}
}
]
}
],
"important": null
},
{
"type": "Declaration",
"span": {
"start": 97,
"end": 120,
"ctxt": 0
},
"property": {
"type": "Text",
"span": {
"start": 97,
"end": 107,
"ctxt": 0
},
"value": "--variable",
"raw": "--variable"
},
"value": [
{
"type": "FnValue",
"span": {
"start": 109,
"end": 120,
"ctxt": 0
},
"name": {
"type": "Text",
"span": {
"start": 109,
"end": 112,
"ctxt": 0
},
"value": "var",
"raw": "var"
},
"args": [
{
"type": "Text",
"span": {
"start": 113,
"end": 119,
"ctxt": 0
},
"value": "--unit",
"raw": "--unit"
}
]
}
],
"important": null
},
{
"type": "Declaration",
"span": {
"start": 127,
"end": 159,
"ctxt": 0
},
"property": {
"type": "Text",
"span": {
"start": 127,
"end": 135,
"ctxt": 0
},
"value": "--string",
"raw": "--string"
},
"value": [
{
"type": "String",
"span": {
"start": 137,
"end": 159,
"ctxt": 0
},
"value": "single quoted string",
"raw": "'single quoted string'"
}
],
"important": null
},
{
"type": "Declaration",
"span": {
"start": 165,
"end": 197,
"ctxt": 0
},
"property": {
"type": "Text",
"span": {
"start": 165,
"end": 173,
"ctxt": 0
},
"value": "--string",
"raw": "--string"
},
"value": [
{
"type": "String",
"span": {
"start": 175,
"end": 197,
"ctxt": 0
},
"value": "double quoted string",
"raw": "\"double quoted string\""
}
],
"important": null
},
{
"type": "Declaration",
"span": {
"start": 204,
"end": 229,
"ctxt": 0
},
"property": {
"type": "Text",
"span": {
"start": 204,
"end": 218,
"ctxt": 0
},
"value": "--square-block",
"raw": "--square-block"
},
"value": [
{
"type": "SquareBracketBlock",
"span": {
"start": 220,
"end": 229,
"ctxt": 0
},
"children": [
{
"type": "CommaValues",
"span": {
"start": 221,
"end": 228,
"ctxt": 0
},
"values": [
{
"type": "Number",
"span": {
"start": 221,
"end": 222,
"ctxt": 0
},
"value": 1.0,
"raw": "1"
},
{
"type": "Number",
"span": {
"start": 224,
"end": 225,
"ctxt": 0
},
"value": 2.0,
"raw": "2"
},
{
"type": "Number",
"span": {
"start": 227,
"end": 228,
"ctxt": 0
},
"value": 3.0,
"raw": "3"
}
]
}
]
}
],
"important": null
},
{
"type": "Declaration",
"span": {
"start": 235,
"end": 259,
"ctxt": 0
},
"property": {
"type": "Text",
"span": {
"start": 235,
"end": 248,
"ctxt": 0
},
"value": "--round-block",
"raw": "--round-block"
},
"value": [
{
"type": "RoundBracketBlock",
"span": {
"start": 250,
"end": 259,
"ctxt": 0
},
"children": [
{
"type": "CommaValues",
"span": {
"start": 251,
"end": 258,
"ctxt": 0
},
"values": [
{
"type": "Number",
"span": {
"start": 251,
"end": 252,
"ctxt": 0
},
"value": 1.0,
"raw": "1"
},
{
"type": "Number",
"span": {
"start": 254,
"end": 255,
"ctxt": 0
},
"value": 2.0,
"raw": "2"
},
{
"type": "Number",
"span": {
"start": 257,
"end": 258,
"ctxt": 0
},
"value": 3.0,
"raw": "3"
}
]
}
]
}
],
"important": null
},
{
"type": "Declaration",
"span": {
"start": 266,
"end": 292,
"ctxt": 0
},
"property": {
"type": "Text",
"span": {
"start": 266,
"end": 281,
"ctxt": 0
},
"value": "--bracket-block",
"raw": "--bracket-block"
},
"value": [
{
"type": "BraceValue",
"span": {
"start": 283,
"end": 292,
"ctxt": 0
},
"value": {
"type": "Tokens",
"span": {
"start": 284,
"end": 291,
"ctxt": 0
},
"tokens": [
{
"span": {
"start": 284,
"end": 285,
"ctxt": 0
},
"token": {
"Num": {
"value": 1.0,
"raw": "1"
}
}
},
{
"span": {
"start": 285,
"end": 286,
"ctxt": 0
},
"token": "Comma"
},
{
"span": {
"start": 286,
"end": 287,
"ctxt": 0
},
"token": {
"WhiteSpace": {
"value": " "
}
}
},
{
"span": {
"start": 287,
"end": 288,
"ctxt": 0
},
"token": {
"Num": {
"value": 2.0,
"raw": "2"
}
}
},
{
"span": {
"start": 288,
"end": 289,
"ctxt": 0
},
"token": "Comma"
},
{
"span": {
"start": 289,
"end": 290,
"ctxt": 0
},
"token": {
"WhiteSpace": {
"value": " "
}
}
},
{
"span": {
"start": 290,
"end": 291,
"ctxt": 0
},
"token": {
"Num": {
"value": 3.0,
"raw": "3"
}
}
}
]
}
}
],
"important": null
},
{
"type": "Declaration",
"span": {
"start": 298,
"end": 339,
"ctxt": 0
},
"property": {
"type": "Text",
"span": {
"start": 298,
"end": 304,
"ctxt": 0
},
"value": "--JSON",
"raw": "--JSON"
},
"value": [
{
"type": "SquareBracketBlock",
"span": {
"start": 306,
"end": 339,
"ctxt": 0
},
"children": [
{
"type": "CommaValues",
"span": {
"start": 307,
"end": 338,
"ctxt": 0
},
"values": [
{
"type": "Number",
"span": {
"start": 307,
"end": 308,
"ctxt": 0
},
"value": 1.0,
"raw": "1"
},
{
"type": "String",
"span": {
"start": 310,
"end": 313,
"ctxt": 0
},
"value": "2",
"raw": "\"2\""
},
{
"type": "BraceValue",
"span": {
"start": 315,
"end": 333,
"ctxt": 0
},
"value": {
"type": "Tokens",
"span": {
"start": 316,
"end": 332,
"ctxt": 0
},
"tokens": [
{
"span": {
"start": 316,
"end": 323,
"ctxt": 0
},
"token": {
"Str": {
"value": "three",
"raw": "\"three\""
}
}
},
{
"span": {
"start": 323,
"end": 324,
"ctxt": 0
},
"token": "Colon"
},
{
"span": {
"start": 324,
"end": 325,
"ctxt": 0
},
"token": {
"WhiteSpace": {
"value": " "
}
}
},
{
"span": {
"start": 325,
"end": 326,
"ctxt": 0
},
"token": "LBrace"
},
{
"span": {
"start": 326,
"end": 329,
"ctxt": 0
},
"token": {
"Str": {
"value": "a",
"raw": "\"a\""
}
}
},
{
"span": {
"start": 329,
"end": 330,
"ctxt": 0
},
"token": "Colon"
},
{
"span": {
"start": 330,
"end": 331,
"ctxt": 0
},
"token": {
"Num": {
"value": 1.0,
"raw": "1"
}
}
},
{
"span": {
"start": 331,
"end": 332,
"ctxt": 0
},
"token": "RBrace"
}
]
}
},
{
"type": "SquareBracketBlock",
"span": {
"start": 335,
"end": 338,
"ctxt": 0
},
"children": [
{
"type": "Number",
"span": {
"start": 336,
"end": 337,
"ctxt": 0
},
"value": 4.0,
"raw": "4"
}
]
}
]
}
]
}
],
"important": null
},
{
"type": "Declaration",
"span": {
"start": 345,
"end": 395,
"ctxt": 0
},
"property": {
"type": "Text",
"span": {
"start": 345,
"end": 357,
"ctxt": 0
},
"value": "--javascript",
"raw": "--javascript"
},
"value": [
{
"type": "FnValue",
"span": {
"start": 359,
"end": 373,
"ctxt": 0
},
"name": {
"type": "Text",
"span": {
"start": 359,
"end": 367,
"ctxt": 0
},
"value": "function",
"raw": "function"
},
"args": [
{
"type": "Text",
"span": {
"start": 368,
"end": 372,
"ctxt": 0
},
"value": "rule",
"raw": "rule"
}
]
},
{
"type": "BraceValue",
"span": {
"start": 374,
"end": 395,
"ctxt": 0
},
"value": {
"type": "Tokens",
"span": {
"start": 375,
"end": 394,
"ctxt": 0
},
"tokens": [
{
"span": {
"start": 375,
"end": 376,
"ctxt": 0
},
"token": {
"WhiteSpace": {
"value": " "
}
}
},
{
"span": {
"start": 376,
"end": 383,
"ctxt": 0
},
"token": {
"Ident": {
"value": "console",
"raw": "console"
}
}
},
{
"span": {
"start": 383,
"end": 384,
"ctxt": 0
},
"token": {
"Delim": {
"value": "."
}
}
},
{
"span": {
"start": 384,
"end": 388,
"ctxt": 0
},
"token": {
"Function": {
"value": "log",
"raw": "log"
}
}
},
{
"span": {
"start": 388,
"end": 392,
"ctxt": 0
},
"token": {
"Ident": {
"value": "rule",
"raw": "rule"
}
}
},
{
"span": {
"start": 392,
"end": 393,
"ctxt": 0
},
"token": "RParen"
},
{
"span": {
"start": 393,
"end": 394,
"ctxt": 0
},
"token": {
"WhiteSpace": {
"value": " "
}
}
}
]
}
}
],
"important": null
},
{
"type": "Declaration",
"span": {
"start": 402,
"end": 413,
"ctxt": 0
},
"property": {
"type": "Text",
"span": {
"start": 402,
"end": 407,
"ctxt": 0
},
"value": "--CDO",
"raw": "--CDO"
},
"value": [
{
"type": "Tokens",
"span": {
"start": 409,
"end": 413,
"ctxt": 0
},
"tokens": [
{
"span": {
"start": 409,
"end": 413,
"ctxt": 0
},
"token": "CDO"
}
]
}
],
"important": null
},
{
"type": "Declaration",
"span": {
"start": 419,
"end": 429,
"ctxt": 0
},
"property": {
"type": "Text",
"span": {
"start": 419,
"end": 424,
"ctxt": 0
},
"value": "--CDC",
"raw": "--CDC"
},
"value": [
{
"type": "Tokens",
"span": {
"start": 426,
"end": 429,
"ctxt": 0
},
"tokens": [
{
"span": {
"start": 426,
"end": 429,
"ctxt": 0
},
"token": "CDC"
}
]
}
],
"important": null
}
]
}
}
]
}