svelte-parse
Version:
An increidbly relaxed svelte-parser
439 lines (438 loc) • 7.87 kB
JSON
{
"type": "root",
"children": [
{
"type": "svelteScript",
"tagName": "script",
"properties": [],
"selfClosing": false,
"children": [
{
"type": "text",
"value": "\n\timport { fade, fly } from 'svelte/transition';\n\tlet visible = true;\n",
"position": {
"start": {
"line": 1,
"column": 9,
"offset": 8
},
"end": {
"line": 4,
"column": 1,
"offset": 78
}
}
}
],
"position": {
"start": {
"line": 1,
"column": 1,
"offset": 0
},
"end": {
"line": 4,
"column": 10,
"offset": 87
}
}
},
{
"type": "text",
"value": "\n\n",
"position": {
"start": {
"line": 4,
"column": 10,
"offset": 87
},
"end": {
"line": 6,
"column": 1,
"offset": 89
}
}
},
{
"type": "svelteElement",
"tagName": "label",
"properties": [],
"selfClosing": false,
"children": [
{
"type": "text",
"value": "\n\t",
"position": {
"start": {
"line": 6,
"column": 8,
"offset": 96
},
"end": {
"line": 7,
"column": 2,
"offset": 98
}
}
},
{
"type": "svelteElement",
"tagName": "input",
"properties": [
{
"type": "svelteProperty",
"name": "type",
"value": [
{
"type": "text",
"value": "checkbox",
"position": {
"start": {
"line": 7,
"column": 15,
"offset": 111
},
"end": {
"line": 7,
"column": 24,
"offset": 120
}
}
}
],
"modifiers": [],
"shorthand": "none",
"position": {
"start": {
"line": 7,
"column": 9,
"offset": 105
},
"end": {
"line": 7,
"column": 24,
"offset": 120
}
}
},
{
"type": "svelteDirective",
"name": "bind",
"value": [
{
"type": "svelteDynamicContent",
"position": {
"start": {
"line": 7,
"column": 38,
"offset": 134
},
"end": {
"line": 7,
"column": 47,
"offset": 143
}
},
"expression": {
"type": "svelteExpression",
"value": "visible",
"position": {
"start": {
"line": 7,
"column": 39,
"offset": 135
},
"end": {
"line": 7,
"column": 46,
"offset": 142
}
}
}
}
],
"modifiers": [],
"shorthand": "none",
"position": {
"start": {
"line": 7,
"column": 25,
"offset": 121
},
"end": {
"line": 7,
"column": 47,
"offset": 143
}
},
"specifier": "checked"
}
],
"selfClosing": true,
"children": [],
"position": {
"start": {
"line": 7,
"column": 2,
"offset": 98
},
"end": {
"line": 7,
"column": 48,
"offset": 144
}
}
},
{
"type": "text",
"value": "\n\tvisible\n",
"position": {
"start": {
"line": 7,
"column": 48,
"offset": 144
},
"end": {
"line": 9,
"column": 1,
"offset": 154
}
}
}
],
"position": {
"start": {
"line": 6,
"column": 1,
"offset": 89
},
"end": {
"line": 9,
"column": 9,
"offset": 162
}
}
},
{
"type": "text",
"value": "\n\n",
"position": {
"start": {
"line": 9,
"column": 9,
"offset": 162
},
"end": {
"line": 11,
"column": 1,
"offset": 164
}
}
},
{
"type": "svelteBranchingBlock",
"name": "if",
"branches": [
{
"type": "svelteBranch",
"name": "if",
"expression": {
"type": "svelteExpression",
"value": "visible",
"position": {
"start": {
"line": 11,
"column": 6,
"offset": 169
},
"end": {
"line": 11,
"column": 13,
"offset": 176
}
}
},
"children": [
{
"type": "text",
"value": "\n\t",
"position": {
"start": {
"line": 11,
"column": 14,
"offset": 177
},
"end": {
"line": 12,
"column": 2,
"offset": 179
}
}
},
{
"type": "svelteElement",
"tagName": "p",
"properties": [
{
"type": "svelteDirective",
"name": "in",
"value": [
{
"type": "svelteDynamicContent",
"position": {
"start": {
"line": 12,
"column": 13,
"offset": 190
},
"end": {
"line": 12,
"column": 41,
"offset": 218
}
},
"expression": {
"type": "svelteExpression",
"value": "{ y: 200, duration: 2000 }",
"position": {
"start": {
"line": 12,
"column": 14,
"offset": 191
},
"end": {
"line": 12,
"column": 40,
"offset": 217
}
}
}
}
],
"modifiers": [],
"shorthand": "none",
"position": {
"start": {
"line": 12,
"column": 5,
"offset": 182
},
"end": {
"line": 12,
"column": 42,
"offset": 219
}
},
"specifier": "fly"
},
{
"type": "svelteDirective",
"name": "out",
"value": [],
"modifiers": [],
"shorthand": "none",
"position": {
"start": {
"line": 12,
"column": 43,
"offset": 220
},
"end": {
"line": 12,
"column": 51,
"offset": 228
}
},
"specifier": "fade"
}
],
"selfClosing": false,
"children": [
{
"type": "text",
"value": "\n\t\tFlies in, fades out\n\t",
"position": {
"start": {
"line": 12,
"column": 52,
"offset": 229
},
"end": {
"line": 14,
"column": 2,
"offset": 253
}
}
}
],
"position": {
"start": {
"line": 12,
"column": 2,
"offset": 179
},
"end": {
"line": 14,
"column": 6,
"offset": 257
}
}
},
{
"type": "text",
"value": "\n",
"position": {
"start": {
"line": 14,
"column": 6,
"offset": 257
},
"end": {
"line": 15,
"column": 1,
"offset": 258
}
}
}
],
"position": {
"start": {
"line": 11,
"column": 1,
"offset": 164
},
"end": {
"line": 15,
"column": 1,
"offset": 258
}
}
}
],
"position": {
"start": {
"line": 11,
"column": 1,
"offset": 164
},
"end": {
"line": 15,
"column": 6,
"offset": 263
}
}
}
],
"position": {
"start": {
"column": 1,
"line": 1,
"offset": 0
},
"end": {
"line": 15,
"column": 6,
"offset": 263
}
}
}