swc/css/parser/tests/fixture/rome/values/output.json
강동윤 0d63470eba
feat(css): Groundwork for css processor (#2105)
swc_css_ast:
 - Rename `Values` to `SpaceValues`.

swc_css_parser:
 - Add `parse_str`.
 - Make `ErrorKind` `#[non_exhaustive]`.
 - Fix span.

swc_css_visit:
 - Create visitors.
2021-08-20 07:48:08 +00:00

540 lines
12 KiB
JSON

{
"type": "Stylesheet",
"span": {
"start": 0,
"end": 183,
"ctxt": 0
},
"rules": [
{
"type": "StyleRule",
"span": {
"start": 0,
"end": 36,
"ctxt": 0
},
"selectors": [
{
"type": "ComplexSelector",
"span": {
"start": 0,
"end": 9,
"ctxt": 0
},
"selectors": [
{
"type": "CompoundSelector",
"span": {
"start": 0,
"end": 9,
"ctxt": 0
},
"hasNestPrefix": false,
"combinator": null,
"typeSelector": {
"type": "NamespacedName",
"span": {
"start": 0,
"end": 1,
"ctxt": 0
},
"prefix": null,
"name": {
"type": "Text",
"span": {
"start": 0,
"end": 1,
"ctxt": 0
},
"value": "p"
}
},
"subclassSelectors": [
{
"type": "PseudoSelector",
"span": {
"start": 1,
"end": 9,
"ctxt": 0
},
"isElement": true,
"name": {
"type": "Text",
"span": {
"start": 3,
"end": 9,
"ctxt": 0
},
"value": ""
},
"args": {
"type": "Tokens",
"span": {
"start": 0,
"end": 0,
"ctxt": 0
},
"tokens": []
}
}
]
}
]
}
],
"block": {
"type": "DeclBlock",
"span": {
"start": 10,
"end": 36,
"ctxt": 0
},
"properties": [
{
"type": "Property",
"span": {
"start": 13,
"end": 33,
"ctxt": 0
},
"name": {
"type": "Text",
"span": {
"start": 13,
"end": 20,
"ctxt": 0
},
"value": "content"
},
"values": [
{
"type": "String",
"span": {
"start": 22,
"end": 33,
"ctxt": 0
},
"value": " content "
}
],
"important": null
}
]
}
},
{
"type": "StyleRule",
"span": {
"start": 38,
"end": 115,
"ctxt": 0
},
"selectors": [
{
"type": "ComplexSelector",
"span": {
"start": 38,
"end": 45,
"ctxt": 0
},
"selectors": [
{
"type": "CompoundSelector",
"span": {
"start": 38,
"end": 45,
"ctxt": 0
},
"hasNestPrefix": false,
"combinator": null,
"typeSelector": null,
"subclassSelectors": [
{
"type": "ClassSelector",
"span": {
"start": 38,
"end": 45,
"ctxt": 0
},
"text": {
"type": "Text",
"span": {
"start": 39,
"end": 45,
"ctxt": 0
},
"value": "number"
}
}
]
}
]
}
],
"block": {
"type": "DeclBlock",
"span": {
"start": 46,
"end": 115,
"ctxt": 0
},
"properties": [
{
"type": "Property",
"span": {
"start": 49,
"end": 62,
"ctxt": 0
},
"name": {
"type": "Text",
"span": {
"start": 49,
"end": 56,
"ctxt": 0
},
"value": "opacity"
},
"values": [
{
"type": "UnitValue",
"span": {
"start": 58,
"end": 62,
"ctxt": 0
},
"value": {
"type": "Number",
"span": {
"start": 58,
"end": 59,
"ctxt": 0
},
"value": 1.0
},
"unit": {
"span": {
"start": 59,
"end": 62,
"ctxt": 0
},
"kind": "e-3"
}
}
],
"important": null
},
{
"type": "Property",
"span": {
"start": 65,
"end": 81,
"ctxt": 0
},
"name": {
"type": "Text",
"span": {
"start": 65,
"end": 76,
"ctxt": 0
},
"value": "line-height"
},
"values": [
{
"type": "Number",
"span": {
"start": 78,
"end": 81,
"ctxt": 0
},
"value": 0.2
}
],
"important": null
},
{
"type": "Property",
"span": {
"start": 84,
"end": 94,
"ctxt": 0
},
"name": {
"type": "Text",
"span": {
"start": 84,
"end": 89,
"ctxt": 0
},
"value": "width"
},
"values": [
{
"type": "PercentValue",
"span": {
"start": 91,
"end": 94,
"ctxt": 0
},
"value": {
"type": "Number",
"span": {
"start": 91,
"end": 93,
"ctxt": 0
},
"value": 20.0
}
}
],
"important": null
},
{
"type": "Property",
"span": {
"start": 97,
"end": 112,
"ctxt": 0
},
"name": {
"type": "Text",
"span": {
"start": 97,
"end": 107,
"ctxt": 0
},
"value": "margin-top"
},
"values": [
{
"type": "PercentValue",
"span": {
"start": 109,
"end": 112,
"ctxt": 0
},
"value": {
"type": "Number",
"span": {
"start": 109,
"end": 111,
"ctxt": 0
},
"value": -5.0
}
}
],
"important": null
}
]
}
},
{
"type": "StyleRule",
"span": {
"start": 117,
"end": 139,
"ctxt": 0
},
"selectors": [
{
"type": "ComplexSelector",
"span": {
"start": 117,
"end": 120,
"ctxt": 0
},
"selectors": [
{
"type": "CompoundSelector",
"span": {
"start": 117,
"end": 120,
"ctxt": 0
},
"hasNestPrefix": false,
"combinator": null,
"typeSelector": {
"type": "NamespacedName",
"span": {
"start": 117,
"end": 120,
"ctxt": 0
},
"prefix": null,
"name": {
"type": "Text",
"span": {
"start": 117,
"end": 120,
"ctxt": 0
},
"value": "foo"
}
},
"subclassSelectors": []
}
]
}
],
"block": {
"type": "DeclBlock",
"span": {
"start": 121,
"end": 139,
"ctxt": 0
},
"properties": [
{
"type": "Property",
"span": {
"start": 124,
"end": 137,
"ctxt": 0
},
"name": {
"type": "Text",
"span": {
"start": 124,
"end": 129,
"ctxt": 0
},
"value": "color"
},
"values": [
{
"type": "Text",
"span": {
"start": 131,
"end": 137,
"ctxt": 0
},
"value": "yellow"
}
],
"important": null
}
]
}
},
{
"type": "StyleRule",
"span": {
"start": 141,
"end": 182,
"ctxt": 0
},
"selectors": [
{
"type": "ComplexSelector",
"span": {
"start": 141,
"end": 144,
"ctxt": 0
},
"selectors": [
{
"type": "CompoundSelector",
"span": {
"start": 141,
"end": 144,
"ctxt": 0
},
"hasNestPrefix": false,
"combinator": null,
"typeSelector": {
"type": "NamespacedName",
"span": {
"start": 141,
"end": 144,
"ctxt": 0
},
"prefix": null,
"name": {
"type": "Text",
"span": {
"start": 141,
"end": 144,
"ctxt": 0
},
"value": "bar"
}
},
"subclassSelectors": []
}
]
}
],
"block": {
"type": "DeclBlock",
"span": {
"start": 145,
"end": 182,
"ctxt": 0
},
"properties": [
{
"type": "Property",
"span": {
"start": 148,
"end": 161,
"ctxt": 0
},
"name": {
"type": "Text",
"span": {
"start": 148,
"end": 153,
"ctxt": 0
},
"value": "color"
},
"values": [
{
"type": "Text",
"span": {
"start": 155,
"end": 161,
"ctxt": 0
},
"value": "yellow"
}
],
"important": null
},
{
"type": "Property",
"span": {
"start": 164,
"end": 180,
"ctxt": 0
},
"name": {
"type": "Text",
"span": {
"start": 164,
"end": 174,
"ctxt": 0
},
"value": "background"
},
"values": [
{
"type": "Text",
"span": {
"start": 176,
"end": 180,
"ctxt": 0
},
"value": "none"
}
],
"important": null
}
]
}
}
]
}