svelte-parse
Version:
An increidbly relaxed svelte-parser
313 lines (312 loc) • 5.37 kB
JSON
{
"type": "root",
"children": [
{
"type": "svelteScript",
"tagName": "script",
"properties": [],
"selfClosing": false,
"children": [
{
"type": "text",
"value": "\n import Button from '@sveltekit/ui/Button';\n import Dropdown from '@sveltekit/ui/Dropdown';\n\n export let items = [\n {\n label: 'Menu Item 1',\n id: 1\n },\n {\n label: 'Menu Item 2',\n id: 2\n },\n {\n label: 'Menu Item 3',\n id: 3\n }\n ];\n\n export let selectedItem = items[0];\n",
"position": {
"start": {
"line": 1,
"column": 9,
"offset": 8
},
"end": {
"line": 21,
"column": 1,
"offset": 329
}
}
}
],
"position": {
"start": {
"line": 1,
"column": 1,
"offset": 0
},
"end": {
"line": 21,
"column": 10,
"offset": 338
}
}
},
{
"type": "text",
"value": "\n\n",
"position": {
"start": {
"line": 21,
"column": 10,
"offset": 338
},
"end": {
"line": 23,
"column": 1,
"offset": 340
}
}
},
{
"type": "svelteComponent",
"tagName": "Dropdown",
"properties": [
{
"type": "svelteProperty",
"name": "items",
"value": [
{
"type": "svelteDynamicContent",
"expression": {
"type": "svelteExpression",
"value": "items",
"position": {
"start": {
"line": 23,
"column": 12,
"offset": 351
},
"end": {
"line": 23,
"column": 17,
"offset": 356
}
}
},
"position": {
"start": {
"line": 23,
"column": 11,
"offset": 350
},
"end": {
"line": 23,
"column": 17,
"offset": 356
}
}
}
],
"modifiers": [],
"shorthand": "expression",
"position": {
"start": {
"line": 23,
"column": 11,
"offset": 350
},
"end": {
"line": 23,
"column": 17,
"offset": 356
}
}
},
{
"type": "svelteDirective",
"name": "bind",
"value": [],
"modifiers": [],
"shorthand": "none",
"position": {
"start": {
"line": 23,
"column": 19,
"offset": 358
},
"end": {
"line": 23,
"column": 36,
"offset": 375
}
},
"specifier": "selectedItem"
}
],
"selfClosing": false,
"children": [
{
"type": "text",
"value": "\n ",
"position": {
"start": {
"line": 23,
"column": 37,
"offset": 376
},
"end": {
"line": 24,
"column": 3,
"offset": 379
}
}
},
{
"type": "svelteComponent",
"tagName": "Button",
"properties": [],
"selfClosing": false,
"children": [
{
"type": "text",
"value": "Click me",
"position": {
"start": {
"line": 24,
"column": 11,
"offset": 387
},
"end": {
"line": 24,
"column": 19,
"offset": 395
}
}
}
],
"position": {
"start": {
"line": 24,
"column": 3,
"offset": 379
},
"end": {
"line": 24,
"column": 28,
"offset": 404
}
}
},
{
"type": "text",
"value": "\n",
"position": {
"start": {
"line": 24,
"column": 28,
"offset": 404
},
"end": {
"line": 25,
"column": 1,
"offset": 405
}
}
}
],
"position": {
"start": {
"line": 23,
"column": 1,
"offset": 340
},
"end": {
"line": 25,
"column": 12,
"offset": 416
}
}
},
{
"type": "text",
"value": "\n\n",
"position": {
"start": {
"line": 25,
"column": 12,
"offset": 416
},
"end": {
"line": 27,
"column": 1,
"offset": 418
}
}
},
{
"type": "svelteElement",
"tagName": "p",
"properties": [],
"selfClosing": false,
"children": [
{
"type": "text",
"value": "selectedItem: ",
"position": {
"start": {
"line": 27,
"column": 4,
"offset": 421
},
"end": {
"line": 27,
"column": 18,
"offset": 435
}
}
},
{
"type": "svelteDynamicContent",
"position": {
"start": {
"line": 27,
"column": 18,
"offset": 435
},
"end": {
"line": 27,
"column": 38,
"offset": 455
}
},
"expression": {
"type": "svelteExpression",
"value": "selectedItem.label",
"position": {
"start": {
"line": 27,
"column": 19,
"offset": 436
},
"end": {
"line": 27,
"column": 37,
"offset": 454
}
}
}
}
],
"position": {
"start": {
"line": 27,
"column": 1,
"offset": 418
},
"end": {
"line": 27,
"column": 42,
"offset": 459
}
}
}
],
"position": {
"start": {
"column": 1,
"line": 1,
"offset": 0
},
"end": {
"line": 27,
"column": 42,
"offset": 459
}
}
}