svelte-parse
Version:
An increidbly relaxed svelte-parser
494 lines (493 loc) • 8.59 kB
JSON
{
"type": "root",
"children": [
{
"type": "svelteScript",
"tagName": "script",
"properties": [],
"selfClosing": false,
"children": [
{
"type": "text",
"value": "\n export let name = '';\n export let value = '';\n export let selected = '';\n export let isDisabled = false;\n",
"position": {
"start": {
"line": 1,
"column": 9,
"offset": 8
},
"end": {
"line": 6,
"column": 1,
"offset": 119
}
}
}
],
"position": {
"start": {
"line": 1,
"column": 1,
"offset": 0
},
"end": {
"line": 6,
"column": 10,
"offset": 128
}
}
},
{
"type": "text",
"value": "\n\n",
"position": {
"start": {
"line": 6,
"column": 10,
"offset": 128
},
"end": {
"line": 8,
"column": 1,
"offset": 130
}
}
},
{
"type": "svelteStyle",
"tagName": "style",
"properties": [],
"selfClosing": false,
"children": [
{
"type": "text",
"value": "\ninput {\n margin: 0;\n}\n\n",
"position": {
"start": {
"line": 8,
"column": 8,
"offset": 137
},
"end": {
"line": 13,
"column": 1,
"offset": 162
}
}
}
],
"position": {
"start": {
"line": 8,
"column": 1,
"offset": 130
},
"end": {
"line": 13,
"column": 9,
"offset": 170
}
}
},
{
"type": "text",
"value": "\n\n",
"position": {
"start": {
"line": 13,
"column": 9,
"offset": 170
},
"end": {
"line": 15,
"column": 1,
"offset": 172
}
}
},
{
"type": "svelteElement",
"tagName": "input",
"properties": [
{
"type": "svelteProperty",
"name": " name ",
"value": [
{
"type": "svelteDynamicContent",
"expression": {
"type": "svelteExpression",
"value": " name ",
"position": {
"start": {
"line": 16,
"column": 4,
"offset": 182
},
"end": {
"line": 16,
"column": 10,
"offset": 188
}
}
},
"position": {
"start": {
"line": 16,
"column": 3,
"offset": 181
},
"end": {
"line": 16,
"column": 10,
"offset": 188
}
}
}
],
"modifiers": [],
"shorthand": "expression",
"position": {
"start": {
"line": 16,
"column": 3,
"offset": 181
},
"end": {
"line": 16,
"column": 10,
"offset": 188
}
}
},
{
"type": "svelteProperty",
"name": " value ",
"value": [
{
"type": "svelteDynamicContent",
"expression": {
"type": "svelteExpression",
"value": " value ",
"position": {
"start": {
"line": 17,
"column": 4,
"offset": 193
},
"end": {
"line": 17,
"column": 11,
"offset": 200
}
}
},
"position": {
"start": {
"line": 17,
"column": 3,
"offset": 192
},
"end": {
"line": 17,
"column": 11,
"offset": 200
}
}
}
],
"modifiers": [],
"shorthand": "expression",
"position": {
"start": {
"line": 17,
"column": 3,
"offset": 192
},
"end": {
"line": 17,
"column": 11,
"offset": 200
}
}
},
{
"type": "svelteDirective",
"name": "bind",
"value": [
{
"type": "svelteDynamicContent",
"position": {
"start": {
"line": 18,
"column": 15,
"offset": 216
},
"end": {
"line": 18,
"column": 27,
"offset": 228
}
},
"expression": {
"type": "svelteExpression",
"value": " selected ",
"position": {
"start": {
"line": 18,
"column": 16,
"offset": 217
},
"end": {
"line": 18,
"column": 26,
"offset": 227
}
}
}
}
],
"modifiers": [],
"shorthand": "none",
"position": {
"start": {
"line": 18,
"column": 3,
"offset": 204
},
"end": {
"line": 18,
"column": 28,
"offset": 229
}
},
"specifier": "group"
},
{
"type": "svelteProperty",
"name": "type",
"value": [
{
"type": "text",
"value": "radio",
"position": {
"start": {
"line": 19,
"column": 9,
"offset": 238
},
"end": {
"line": 19,
"column": 15,
"offset": 244
}
}
}
],
"modifiers": [],
"shorthand": "none",
"position": {
"start": {
"line": 19,
"column": 3,
"offset": 232
},
"end": {
"line": 19,
"column": 15,
"offset": 244
}
}
},
{
"type": "svelteProperty",
"name": "disabled",
"value": [
{
"type": "svelteDynamicContent",
"position": {
"start": {
"line": 20,
"column": 13,
"offset": 257
},
"end": {
"line": 20,
"column": 27,
"offset": 271
}
},
"expression": {
"type": "svelteExpression",
"value": " isDisabled ",
"position": {
"start": {
"line": 20,
"column": 14,
"offset": 258
},
"end": {
"line": 20,
"column": 26,
"offset": 270
}
}
}
}
],
"modifiers": [],
"shorthand": "none",
"position": {
"start": {
"line": 20,
"column": 3,
"offset": 247
},
"end": {
"line": 20,
"column": 28,
"offset": 272
}
}
},
{
"type": "svelteProperty",
"name": "checked",
"value": [
{
"type": "svelteDynamicContent",
"position": {
"start": {
"line": 21,
"column": 12,
"offset": 284
},
"end": {
"line": 21,
"column": 34,
"offset": 306
}
},
"expression": {
"type": "svelteExpression",
"value": " selected === value ",
"position": {
"start": {
"line": 21,
"column": 13,
"offset": 285
},
"end": {
"line": 21,
"column": 33,
"offset": 305
}
}
}
}
],
"modifiers": [],
"shorthand": "none",
"position": {
"start": {
"line": 21,
"column": 3,
"offset": 275
},
"end": {
"line": 21,
"column": 35,
"offset": 307
}
}
},
{
"type": "svelteDirective",
"name": "on",
"value": [],
"modifiers": [],
"shorthand": "none",
"position": {
"start": {
"line": 22,
"column": 3,
"offset": 310
},
"end": {
"line": 22,
"column": 11,
"offset": 318
}
},
"specifier": "click"
},
{
"type": "svelteDirective",
"name": "on",
"value": [],
"modifiers": [],
"shorthand": "none",
"position": {
"start": {
"line": 23,
"column": 3,
"offset": 321
},
"end": {
"line": 23,
"column": 11,
"offset": 329
}
},
"specifier": "input"
},
{
"type": "svelteDirective",
"name": "on",
"value": [],
"modifiers": [],
"shorthand": "none",
"position": {
"start": {
"line": 24,
"column": 3,
"offset": 332
},
"end": {
"line": 24,
"column": 12,
"offset": 341
}
},
"specifier": "change"
}
],
"selfClosing": true,
"children": [],
"position": {
"start": {
"line": 15,
"column": 1,
"offset": 172
},
"end": {
"line": 25,
"column": 3,
"offset": 344
}
}
}
],
"position": {
"start": {
"column": 1,
"line": 1,
"offset": 0
},
"end": {
"line": 25,
"column": 3,
"offset": 344
}
}
}