svelte-parse
Version:
An increidbly relaxed svelte-parser
159 lines (158 loc) • 2.94 kB
JSON
{
"type": "root",
"children": [
{
"type": "svelteScript",
"tagName": "script",
"properties": [],
"selfClosing": false,
"children": [
{
"type": "text",
"value": "\n import { onDestroy } from 'svelte';\n\n import Button from '@sveltekit/ui/Button';\n import Modal from '@sveltekit/ui/Modal';\n import modalService from '../modal';\n\n let modal = undefined;\n\n function showModal() {\n modal = modalService.open(Modal,\n {\n title: 'Modal title',\n maxWidth: '100%'\n },\n '<h3>Model content</h3>'\n );\n }\n\n onDestroy(() => {\n if (modal) modalService.remove();\n });\n\n",
"position": {
"start": {
"line": 1,
"column": 9,
"offset": 8
},
"end": {
"line": 24,
"column": 1,
"offset": 444
}
}
}
],
"position": {
"start": {
"line": 1,
"column": 1,
"offset": 0
},
"end": {
"line": 24,
"column": 10,
"offset": 453
}
}
},
{
"type": "text",
"value": "\n\n",
"position": {
"start": {
"line": 24,
"column": 10,
"offset": 453
},
"end": {
"line": 26,
"column": 1,
"offset": 455
}
}
},
{
"type": "svelteComponent",
"tagName": "Button",
"properties": [
{
"type": "svelteDirective",
"name": "on",
"value": [
{
"type": "svelteDynamicContent",
"position": {
"start": {
"line": 26,
"column": 19,
"offset": 473
},
"end": {
"line": 26,
"column": 30,
"offset": 484
}
},
"expression": {
"type": "svelteExpression",
"value": "showModal",
"position": {
"start": {
"line": 26,
"column": 20,
"offset": 474
},
"end": {
"line": 26,
"column": 29,
"offset": 483
}
}
}
}
],
"modifiers": [],
"shorthand": "none",
"position": {
"start": {
"line": 26,
"column": 9,
"offset": 463
},
"end": {
"line": 26,
"column": 31,
"offset": 485
}
},
"specifier": "click"
}
],
"selfClosing": false,
"children": [
{
"type": "text",
"value": "Show Modal",
"position": {
"start": {
"line": 26,
"column": 32,
"offset": 486
},
"end": {
"line": 26,
"column": 42,
"offset": 496
}
}
}
],
"position": {
"start": {
"line": 26,
"column": 1,
"offset": 455
},
"end": {
"line": 26,
"column": 51,
"offset": 505
}
}
}
],
"position": {
"start": {
"column": 1,
"line": 1,
"offset": 0
},
"end": {
"line": 26,
"column": 51,
"offset": 505
}
}
}