svelte-parse
Version:
An increidbly relaxed svelte-parser
710 lines (709 loc) • 13.6 kB
JSON
{
"type": "root",
"children": [
{
"type": "svelteScript",
"tagName": "script",
"properties": [],
"selfClosing": false,
"children": [
{
"type": "text",
"value": "\n\timport { fly } from 'svelte/transition';\n\n\tlet visible = true;\n\tlet status = 'waiting...';\n",
"position": {
"start": {
"line": 1,
"column": 9,
"offset": 8
},
"end": {
"line": 6,
"column": 1,
"offset": 101
}
}
}
],
"position": {
"start": {
"line": 1,
"column": 1,
"offset": 0
},
"end": {
"line": 6,
"column": 10,
"offset": 110
}
}
},
{
"type": "text",
"value": "\n\n",
"position": {
"start": {
"line": 6,
"column": 10,
"offset": 110
},
"end": {
"line": 8,
"column": 1,
"offset": 112
}
}
},
{
"type": "svelteElement",
"tagName": "p",
"properties": [],
"selfClosing": false,
"children": [
{
"type": "text",
"value": "status: ",
"position": {
"start": {
"line": 8,
"column": 4,
"offset": 115
},
"end": {
"line": 8,
"column": 12,
"offset": 123
}
}
},
{
"type": "svelteDynamicContent",
"position": {
"start": {
"line": 8,
"column": 12,
"offset": 123
},
"end": {
"line": 8,
"column": 20,
"offset": 131
}
},
"expression": {
"type": "svelteExpression",
"value": "status",
"position": {
"start": {
"line": 8,
"column": 13,
"offset": 124
},
"end": {
"line": 8,
"column": 19,
"offset": 130
}
}
}
}
],
"position": {
"start": {
"line": 8,
"column": 1,
"offset": 112
},
"end": {
"line": 8,
"column": 24,
"offset": 135
}
}
},
{
"type": "text",
"value": "\n\n",
"position": {
"start": {
"line": 8,
"column": 24,
"offset": 135
},
"end": {
"line": 10,
"column": 1,
"offset": 137
}
}
},
{
"type": "svelteElement",
"tagName": "label",
"properties": [],
"selfClosing": false,
"children": [
{
"type": "text",
"value": "\n\t",
"position": {
"start": {
"line": 10,
"column": 8,
"offset": 144
},
"end": {
"line": 11,
"column": 2,
"offset": 146
}
}
},
{
"type": "svelteElement",
"tagName": "input",
"properties": [
{
"type": "svelteProperty",
"name": "type",
"value": [
{
"type": "text",
"value": "checkbox",
"position": {
"start": {
"line": 11,
"column": 15,
"offset": 159
},
"end": {
"line": 11,
"column": 24,
"offset": 168
}
}
}
],
"modifiers": [],
"shorthand": "none",
"position": {
"start": {
"line": 11,
"column": 9,
"offset": 153
},
"end": {
"line": 11,
"column": 24,
"offset": 168
}
}
},
{
"type": "svelteDirective",
"name": "bind",
"value": [
{
"type": "svelteDynamicContent",
"position": {
"start": {
"line": 11,
"column": 38,
"offset": 182
},
"end": {
"line": 11,
"column": 47,
"offset": 191
}
},
"expression": {
"type": "svelteExpression",
"value": "visible",
"position": {
"start": {
"line": 11,
"column": 39,
"offset": 183
},
"end": {
"line": 11,
"column": 46,
"offset": 190
}
}
}
}
],
"modifiers": [],
"shorthand": "none",
"position": {
"start": {
"line": 11,
"column": 25,
"offset": 169
},
"end": {
"line": 11,
"column": 47,
"offset": 191
}
},
"specifier": "checked"
}
],
"selfClosing": true,
"children": [],
"position": {
"start": {
"line": 11,
"column": 2,
"offset": 146
},
"end": {
"line": 11,
"column": 48,
"offset": 192
}
}
},
{
"type": "text",
"value": "\n\tvisible\n",
"position": {
"start": {
"line": 11,
"column": 48,
"offset": 192
},
"end": {
"line": 13,
"column": 1,
"offset": 202
}
}
}
],
"position": {
"start": {
"line": 10,
"column": 1,
"offset": 137
},
"end": {
"line": 13,
"column": 9,
"offset": 210
}
}
},
{
"type": "text",
"value": "\n\n",
"position": {
"start": {
"line": 13,
"column": 9,
"offset": 210
},
"end": {
"line": 15,
"column": 1,
"offset": 212
}
}
},
{
"type": "svelteBranchingBlock",
"name": "if",
"branches": [
{
"type": "svelteBranch",
"name": "if",
"expression": {
"type": "svelteExpression",
"value": "visible",
"position": {
"start": {
"line": 15,
"column": 6,
"offset": 217
},
"end": {
"line": 15,
"column": 13,
"offset": 224
}
}
},
"children": [
{
"type": "text",
"value": "\n\t",
"position": {
"start": {
"line": 15,
"column": 14,
"offset": 225
},
"end": {
"line": 16,
"column": 2,
"offset": 227
}
}
},
{
"type": "svelteElement",
"tagName": "p",
"properties": [
{
"type": "svelteDirective",
"name": "transition",
"value": [
{
"type": "svelteDynamicContent",
"position": {
"start": {
"line": 17,
"column": 19,
"offset": 248
},
"end": {
"line": 17,
"column": 47,
"offset": 276
}
},
"expression": {
"type": "svelteExpression",
"value": "{ y: 200, duration: 2000 }",
"position": {
"start": {
"line": 17,
"column": 20,
"offset": 249
},
"end": {
"line": 17,
"column": 46,
"offset": 275
}
}
}
}
],
"modifiers": [],
"shorthand": "none",
"position": {
"start": {
"line": 17,
"column": 3,
"offset": 232
},
"end": {
"line": 17,
"column": 48,
"offset": 277
}
},
"specifier": "fly"
},
{
"type": "svelteDirective",
"name": "on",
"value": [
{
"type": "svelteDynamicContent",
"position": {
"start": {
"line": 18,
"column": 18,
"offset": 295
},
"end": {
"line": 18,
"column": 50,
"offset": 327
}
},
"expression": {
"type": "svelteExpression",
"value": "() => status = 'intro started'",
"position": {
"start": {
"line": 18,
"column": 19,
"offset": 296
},
"end": {
"line": 18,
"column": 49,
"offset": 326
}
}
}
}
],
"modifiers": [],
"shorthand": "none",
"position": {
"start": {
"line": 18,
"column": 3,
"offset": 280
},
"end": {
"line": 18,
"column": 51,
"offset": 328
}
},
"specifier": "introstart"
},
{
"type": "svelteDirective",
"name": "on",
"value": [
{
"type": "svelteDynamicContent",
"position": {
"start": {
"line": 19,
"column": 18,
"offset": 346
},
"end": {
"line": 19,
"column": 50,
"offset": 378
}
},
"expression": {
"type": "svelteExpression",
"value": "() => status = 'outro started'",
"position": {
"start": {
"line": 19,
"column": 19,
"offset": 347
},
"end": {
"line": 19,
"column": 49,
"offset": 377
}
}
}
}
],
"modifiers": [],
"shorthand": "none",
"position": {
"start": {
"line": 19,
"column": 3,
"offset": 331
},
"end": {
"line": 19,
"column": 51,
"offset": 379
}
},
"specifier": "outrostart"
},
{
"type": "svelteDirective",
"name": "on",
"value": [
{
"type": "svelteDynamicContent",
"position": {
"start": {
"line": 20,
"column": 16,
"offset": 395
},
"end": {
"line": 20,
"column": 46,
"offset": 425
}
},
"expression": {
"type": "svelteExpression",
"value": "() => status = 'intro ended'",
"position": {
"start": {
"line": 20,
"column": 17,
"offset": 396
},
"end": {
"line": 20,
"column": 45,
"offset": 424
}
}
}
}
],
"modifiers": [],
"shorthand": "none",
"position": {
"start": {
"line": 20,
"column": 3,
"offset": 382
},
"end": {
"line": 20,
"column": 47,
"offset": 426
}
},
"specifier": "introend"
},
{
"type": "svelteDirective",
"name": "on",
"value": [
{
"type": "svelteDynamicContent",
"position": {
"start": {
"line": 21,
"column": 16,
"offset": 442
},
"end": {
"line": 21,
"column": 46,
"offset": 472
}
},
"expression": {
"type": "svelteExpression",
"value": "() => status = 'outro ended'",
"position": {
"start": {
"line": 21,
"column": 17,
"offset": 443
},
"end": {
"line": 21,
"column": 45,
"offset": 471
}
}
}
}
],
"modifiers": [],
"shorthand": "none",
"position": {
"start": {
"line": 21,
"column": 3,
"offset": 429
},
"end": {
"line": 21,
"column": 47,
"offset": 473
}
},
"specifier": "outroend"
}
],
"selfClosing": false,
"children": [
{
"type": "text",
"value": "\n\t\tFlies in and out\n\t",
"position": {
"start": {
"line": 22,
"column": 3,
"offset": 476
},
"end": {
"line": 24,
"column": 2,
"offset": 497
}
}
}
],
"position": {
"start": {
"line": 16,
"column": 2,
"offset": 227
},
"end": {
"line": 24,
"column": 6,
"offset": 501
}
}
},
{
"type": "text",
"value": "\n",
"position": {
"start": {
"line": 24,
"column": 6,
"offset": 501
},
"end": {
"line": 25,
"column": 1,
"offset": 502
}
}
}
],
"position": {
"start": {
"line": 15,
"column": 1,
"offset": 212
},
"end": {
"line": 25,
"column": 1,
"offset": 502
}
}
}
],
"position": {
"start": {
"line": 15,
"column": 1,
"offset": 212
},
"end": {
"line": 25,
"column": 6,
"offset": 507
}
}
}
],
"position": {
"start": {
"column": 1,
"line": 1,
"offset": 0
},
"end": {
"line": 25,
"column": 6,
"offset": 507
}
}
}