svelte-parse
Version:
An increidbly relaxed svelte-parser
491 lines (490 loc) • 8.66 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 ProgressBar from '@sveltekit/ui/ProgressBar';\n\n let isAnimated = true;\n let value = 30;\n",
"position": {
"start": {
"line": 1,
"column": 9,
"offset": 8
},
"end": {
"line": 7,
"column": 1,
"offset": 153
}
}
}
],
"position": {
"start": {
"line": 1,
"column": 1,
"offset": 0
},
"end": {
"line": 7,
"column": 10,
"offset": 162
}
}
},
{
"type": "text",
"value": "\n\n",
"position": {
"start": {
"line": 7,
"column": 10,
"offset": 162
},
"end": {
"line": 9,
"column": 1,
"offset": 164
}
}
},
{
"type": "svelteComponent",
"tagName": "ProgressBar",
"properties": [
{
"type": "svelteProperty",
"name": "isAnimated",
"value": [
{
"type": "svelteDynamicContent",
"expression": {
"type": "svelteExpression",
"value": "isAnimated",
"position": {
"start": {
"line": 9,
"column": 15,
"offset": 178
},
"end": {
"line": 9,
"column": 25,
"offset": 188
}
}
},
"position": {
"start": {
"line": 9,
"column": 14,
"offset": 177
},
"end": {
"line": 9,
"column": 25,
"offset": 188
}
}
}
],
"modifiers": [],
"shorthand": "expression",
"position": {
"start": {
"line": 9,
"column": 14,
"offset": 177
},
"end": {
"line": 9,
"column": 25,
"offset": 188
}
}
},
{
"type": "svelteProperty",
"name": "value",
"value": [
{
"type": "svelteDynamicContent",
"expression": {
"type": "svelteExpression",
"value": "value",
"position": {
"start": {
"line": 9,
"column": 28,
"offset": 191
},
"end": {
"line": 9,
"column": 33,
"offset": 196
}
}
},
"position": {
"start": {
"line": 9,
"column": 27,
"offset": 190
},
"end": {
"line": 9,
"column": 33,
"offset": 196
}
}
}
],
"modifiers": [],
"shorthand": "expression",
"position": {
"start": {
"line": 9,
"column": 27,
"offset": 190
},
"end": {
"line": 9,
"column": 33,
"offset": 196
}
}
}
],
"selfClosing": true,
"children": [],
"position": {
"start": {
"line": 9,
"column": 1,
"offset": 164
},
"end": {
"line": 9,
"column": 37,
"offset": 200
}
}
},
{
"type": "text",
"value": "\n\n",
"position": {
"start": {
"line": 9,
"column": 37,
"offset": 200
},
"end": {
"line": 11,
"column": 1,
"offset": 202
}
}
},
{
"type": "svelteElement",
"tagName": "div",
"properties": [
{
"type": "svelteProperty",
"name": "class",
"value": [
{
"type": "text",
"value": "row",
"position": {
"start": {
"line": 11,
"column": 13,
"offset": 214
},
"end": {
"line": 11,
"column": 17,
"offset": 218
}
}
}
],
"modifiers": [],
"shorthand": "none",
"position": {
"start": {
"line": 11,
"column": 6,
"offset": 207
},
"end": {
"line": 11,
"column": 17,
"offset": 218
}
}
}
],
"selfClosing": false,
"children": [
{
"type": "text",
"value": "\n ",
"position": {
"start": {
"line": 11,
"column": 18,
"offset": 219
},
"end": {
"line": 12,
"column": 3,
"offset": 222
}
}
},
{
"type": "svelteComponent",
"tagName": "Button",
"properties": [
{
"type": "svelteDirective",
"name": "on",
"value": [
{
"type": "svelteDynamicContent",
"position": {
"start": {
"line": 12,
"column": 20,
"offset": 239
},
"end": {
"line": 12,
"column": 64,
"offset": 283
}
},
"expression": {
"type": "svelteExpression",
"value": "() => (value <= 100 ? (value += 20) : 100)",
"position": {
"start": {
"line": 12,
"column": 21,
"offset": 240
},
"end": {
"line": 12,
"column": 63,
"offset": 282
}
}
}
}
],
"modifiers": [],
"shorthand": "none",
"position": {
"start": {
"line": 12,
"column": 11,
"offset": 230
},
"end": {
"line": 12,
"column": 64,
"offset": 283
}
},
"specifier": "click"
}
],
"selfClosing": false,
"children": [
{
"type": "text",
"value": "\n Increase\n ",
"position": {
"start": {
"line": 12,
"column": 65,
"offset": 284
},
"end": {
"line": 14,
"column": 3,
"offset": 300
}
}
}
],
"position": {
"start": {
"line": 12,
"column": 3,
"offset": 222
},
"end": {
"line": 14,
"column": 12,
"offset": 309
}
}
},
{
"type": "text",
"value": "\n ",
"position": {
"start": {
"line": 14,
"column": 12,
"offset": 309
},
"end": {
"line": 15,
"column": 3,
"offset": 312
}
}
},
{
"type": "svelteComponent",
"tagName": "Button",
"properties": [
{
"type": "svelteDirective",
"name": "on",
"value": [
{
"type": "svelteDynamicContent",
"position": {
"start": {
"line": 15,
"column": 20,
"offset": 329
},
"end": {
"line": 15,
"column": 60,
"offset": 369
}
},
"expression": {
"type": "svelteExpression",
"value": "() => (value >= 0 ? (value -= 20) : 0)",
"position": {
"start": {
"line": 15,
"column": 21,
"offset": 330
},
"end": {
"line": 15,
"column": 59,
"offset": 368
}
}
}
}
],
"modifiers": [],
"shorthand": "none",
"position": {
"start": {
"line": 15,
"column": 11,
"offset": 320
},
"end": {
"line": 15,
"column": 60,
"offset": 369
}
},
"specifier": "click"
}
],
"selfClosing": false,
"children": [
{
"type": "text",
"value": "Decrease",
"position": {
"start": {
"line": 15,
"column": 61,
"offset": 370
},
"end": {
"line": 15,
"column": 69,
"offset": 378
}
}
}
],
"position": {
"start": {
"line": 15,
"column": 3,
"offset": 312
},
"end": {
"line": 15,
"column": 78,
"offset": 387
}
}
},
{
"type": "text",
"value": "\n",
"position": {
"start": {
"line": 15,
"column": 78,
"offset": 387
},
"end": {
"line": 16,
"column": 1,
"offset": 388
}
}
}
],
"position": {
"start": {
"line": 11,
"column": 1,
"offset": 202
},
"end": {
"line": 16,
"column": 7,
"offset": 394
}
}
}
],
"position": {
"start": {
"column": 1,
"line": 1,
"offset": 0
},
"end": {
"line": 16,
"column": 7,
"offset": 394
}
}
}