svelte-parse
Version:
An increidbly relaxed svelte-parser
305 lines (304 loc) • 4.91 kB
JSON
{
"type": "root",
"children": [
{
"type": "svelteScript",
"tagName": "script",
"properties": [],
"selfClosing": false,
"children": [
{
"type": "text",
"value": "\n\tlet m = { x: 0, y: 0 };\n",
"position": {
"start": {
"line": 1,
"column": 9,
"offset": 8
},
"end": {
"line": 3,
"column": 1,
"offset": 34
}
}
}
],
"position": {
"start": {
"line": 1,
"column": 1,
"offset": 0
},
"end": {
"line": 3,
"column": 10,
"offset": 43
}
}
},
{
"type": "text",
"value": "\n\n",
"position": {
"start": {
"line": 3,
"column": 10,
"offset": 43
},
"end": {
"line": 5,
"column": 1,
"offset": 45
}
}
},
{
"type": "svelteStyle",
"tagName": "style",
"properties": [],
"selfClosing": false,
"children": [
{
"type": "text",
"value": "\n\tdiv { width: 100%; height: 100%; }\n",
"position": {
"start": {
"line": 5,
"column": 8,
"offset": 52
},
"end": {
"line": 7,
"column": 1,
"offset": 89
}
}
}
],
"position": {
"start": {
"line": 5,
"column": 1,
"offset": 45
},
"end": {
"line": 7,
"column": 9,
"offset": 97
}
}
},
{
"type": "text",
"value": "\n\n",
"position": {
"start": {
"line": 7,
"column": 9,
"offset": 97
},
"end": {
"line": 9,
"column": 1,
"offset": 99
}
}
},
{
"type": "svelteElement",
"tagName": "div",
"properties": [
{
"type": "svelteDirective",
"name": "on",
"value": [
{
"type": "svelteDynamicContent",
"position": {
"start": {
"line": 9,
"column": 20,
"offset": 118
},
"end": {
"line": 9,
"column": 61,
"offset": 159
}
},
"expression": {
"type": "svelteExpression",
"value": "e => m = { x: e.clientX, y: e.clientY }",
"position": {
"start": {
"line": 9,
"column": 21,
"offset": 119
},
"end": {
"line": 9,
"column": 60,
"offset": 158
}
}
}
}
],
"modifiers": [],
"shorthand": "none",
"position": {
"start": {
"line": 9,
"column": 6,
"offset": 104
},
"end": {
"line": 9,
"column": 62,
"offset": 160
}
},
"specifier": "mousemove"
}
],
"selfClosing": false,
"children": [
{
"type": "text",
"value": "\n\tThe mouse position is ",
"position": {
"start": {
"line": 9,
"column": 63,
"offset": 161
},
"end": {
"line": 10,
"column": 24,
"offset": 185
}
}
},
{
"type": "svelteDynamicContent",
"position": {
"start": {
"line": 10,
"column": 24,
"offset": 185
},
"end": {
"line": 10,
"column": 29,
"offset": 190
}
},
"expression": {
"type": "svelteExpression",
"value": "m.x",
"position": {
"start": {
"line": 10,
"column": 25,
"offset": 186
},
"end": {
"line": 10,
"column": 28,
"offset": 189
}
}
}
},
{
"type": "text",
"value": " x ",
"position": {
"start": {
"line": 10,
"column": 29,
"offset": 190
},
"end": {
"line": 10,
"column": 32,
"offset": 193
}
}
},
{
"type": "svelteDynamicContent",
"position": {
"start": {
"line": 10,
"column": 32,
"offset": 193
},
"end": {
"line": 10,
"column": 37,
"offset": 198
}
},
"expression": {
"type": "svelteExpression",
"value": "m.y",
"position": {
"start": {
"line": 10,
"column": 33,
"offset": 194
},
"end": {
"line": 10,
"column": 36,
"offset": 197
}
}
}
},
{
"type": "text",
"value": "\n",
"position": {
"start": {
"line": 10,
"column": 37,
"offset": 198
},
"end": {
"line": 11,
"column": 1,
"offset": 199
}
}
}
],
"position": {
"start": {
"line": 9,
"column": 1,
"offset": 99
},
"end": {
"line": 11,
"column": 7,
"offset": 205
}
}
}
],
"position": {
"start": {
"column": 1,
"line": 1,
"offset": 0
},
"end": {
"line": 11,
"column": 7,
"offset": 205
}
}
}