svelte-parse
Version:
An increidbly relaxed svelte-parser
747 lines (746 loc) • 17.8 kB
JSON
{
"type": "root",
"children": [
{
"type": "svelteScript",
"tagName": "script",
"properties": [],
"selfClosing": false,
"children": [
{
"type": "text",
"value": "\n import Card from '@sveltekit/ui/Card';\n import * as Icons from '@sveltekit/ui/Icons';\n",
"position": {
"start": {
"line": 1,
"column": 9,
"offset": 8
},
"end": {
"line": 4,
"column": 1,
"offset": 98
}
}
}
],
"position": {
"start": {
"line": 1,
"column": 1,
"offset": 0
},
"end": {
"line": 4,
"column": 10,
"offset": 107
}
}
},
{
"type": "text",
"value": "\n\n",
"position": {
"start": {
"line": 4,
"column": 10,
"offset": 107
},
"end": {
"line": 6,
"column": 1,
"offset": 109
}
}
},
{
"type": "svelteStyle",
"tagName": "style",
"properties": [],
"selfClosing": false,
"children": [
{
"type": "text",
"value": "\n .container {\n display: flex;\n width: 100%;\n flex-wrap: wrap;\n }\n\n .option {\n flex-grow: 1;\n text-align: center;\n margin: 0 20px 20px 0;\n align-items: center;\n display: flex;\n flex-direction: column;\n }\n\n .icon {\n padding: 20px;\n height: 100px;\n width: 100%;\n margin: 0 0 20px;\n }\n\n .icon p {\n margin: 0;\n\n }\n\n @media (min-width: 890px) {\n .option {\n flex-grow: 0;\n width: 150px;\n }\n }\n",
"position": {
"start": {
"line": 6,
"column": 8,
"offset": 116
},
"end": {
"line": 40,
"column": 1,
"offset": 571
}
}
}
],
"position": {
"start": {
"line": 6,
"column": 1,
"offset": 109
},
"end": {
"line": 40,
"column": 9,
"offset": 579
}
}
},
{
"type": "text",
"value": "\n\n",
"position": {
"start": {
"line": 40,
"column": 9,
"offset": 579
},
"end": {
"line": 42,
"column": 1,
"offset": 581
}
}
},
{
"type": "svelteElement",
"tagName": "div",
"properties": [
{
"type": "svelteProperty",
"name": "class",
"value": [
{
"type": "text",
"value": "container",
"position": {
"start": {
"line": 42,
"column": 13,
"offset": 593
},
"end": {
"line": 42,
"column": 23,
"offset": 603
}
}
}
],
"modifiers": [],
"shorthand": "none",
"position": {
"start": {
"line": 42,
"column": 6,
"offset": 586
},
"end": {
"line": 42,
"column": 23,
"offset": 603
}
}
}
],
"selfClosing": false,
"children": [
{
"type": "text",
"value": "\n ",
"position": {
"start": {
"line": 42,
"column": 24,
"offset": 604
},
"end": {
"line": 43,
"column": 3,
"offset": 607
}
}
},
{
"type": "svelteBranchingBlock",
"name": "each",
"branches": [
{
"type": "svelteBranch",
"name": "each",
"expression": {
"type": "svelteExpression",
"value": "Object.keys(Icons) as iconKey",
"position": {
"start": {
"line": 43,
"column": 10,
"offset": 614
},
"end": {
"line": 43,
"column": 39,
"offset": 643
}
}
},
"children": [
{
"type": "text",
"value": "\n ",
"position": {
"start": {
"line": 43,
"column": 40,
"offset": 644
},
"end": {
"line": 44,
"column": 5,
"offset": 649
}
}
},
{
"type": "svelteElement",
"tagName": "div",
"properties": [
{
"type": "svelteProperty",
"name": "class",
"value": [
{
"type": "text",
"value": "option",
"position": {
"start": {
"line": 44,
"column": 17,
"offset": 661
},
"end": {
"line": 44,
"column": 24,
"offset": 668
}
}
}
],
"modifiers": [],
"shorthand": "none",
"position": {
"start": {
"line": 44,
"column": 10,
"offset": 654
},
"end": {
"line": 44,
"column": 24,
"offset": 668
}
}
}
],
"selfClosing": false,
"children": [
{
"type": "text",
"value": "\n ",
"position": {
"start": {
"line": 44,
"column": 25,
"offset": 669
},
"end": {
"line": 45,
"column": 7,
"offset": 676
}
}
},
{
"type": "svelteComponent",
"tagName": "Card",
"properties": [],
"selfClosing": false,
"children": [
{
"type": "text",
"value": "\n ",
"position": {
"start": {
"line": 45,
"column": 13,
"offset": 682
},
"end": {
"line": 46,
"column": 9,
"offset": 691
}
}
},
{
"type": "svelteElement",
"tagName": "div",
"properties": [
{
"type": "svelteProperty",
"name": "class",
"value": [
{
"type": "text",
"value": "icon",
"position": {
"start": {
"line": 46,
"column": 21,
"offset": 703
},
"end": {
"line": 46,
"column": 26,
"offset": 708
}
}
}
],
"modifiers": [],
"shorthand": "none",
"position": {
"start": {
"line": 46,
"column": 14,
"offset": 696
},
"end": {
"line": 46,
"column": 26,
"offset": 708
}
}
}
],
"selfClosing": false,
"children": [
{
"type": "text",
"value": "\n ",
"position": {
"start": {
"line": 46,
"column": 27,
"offset": 709
},
"end": {
"line": 47,
"column": 11,
"offset": 720
}
}
},
{
"type": "svelteBranchingBlock",
"name": "if",
"branches": [
{
"type": "svelteBranch",
"name": "if",
"expression": {
"type": "svelteExpression",
"value": "iconKey !== 'default' ",
"position": {
"start": {
"line": 47,
"column": 17,
"offset": 726
},
"end": {
"line": 47,
"column": 39,
"offset": 748
}
}
},
"children": [
{
"type": "text",
"value": "\n ",
"position": {
"start": {
"line": 47,
"column": 40,
"offset": 749
},
"end": {
"line": 48,
"column": 11,
"offset": 760
}
}
},
{
"type": "svelteMeta",
"tagName": "component",
"properties": [
{
"type": "svelteProperty",
"name": "this",
"value": [
{
"type": "svelteDynamicContent",
"position": {
"start": {
"line": 48,
"column": 35,
"offset": 784
},
"end": {
"line": 48,
"column": 53,
"offset": 802
}
},
"expression": {
"type": "svelteExpression",
"value": " Icons[iconKey] ",
"position": {
"start": {
"line": 48,
"column": 36,
"offset": 785
},
"end": {
"line": 48,
"column": 52,
"offset": 801
}
}
}
}
],
"modifiers": [],
"shorthand": "none",
"position": {
"start": {
"line": 48,
"column": 29,
"offset": 778
},
"end": {
"line": 48,
"column": 54,
"offset": 803
}
}
}
],
"selfClosing": true,
"children": [],
"position": {
"start": {
"line": 48,
"column": 11,
"offset": 760
},
"end": {
"line": 48,
"column": 57,
"offset": 806
}
}
},
{
"type": "text",
"value": "\n ",
"position": {
"start": {
"line": 48,
"column": 57,
"offset": 806
},
"end": {
"line": 49,
"column": 11,
"offset": 817
}
}
},
{
"type": "svelteElement",
"tagName": "p",
"properties": [],
"selfClosing": false,
"children": [
{
"type": "svelteDynamicContent",
"position": {
"start": {
"line": 49,
"column": 14,
"offset": 820
},
"end": {
"line": 49,
"column": 23,
"offset": 829
}
},
"expression": {
"type": "svelteExpression",
"value": "iconKey",
"position": {
"start": {
"line": 49,
"column": 15,
"offset": 821
},
"end": {
"line": 49,
"column": 22,
"offset": 828
}
}
}
}
],
"position": {
"start": {
"line": 49,
"column": 11,
"offset": 817
},
"end": {
"line": 49,
"column": 27,
"offset": 833
}
}
},
{
"type": "text",
"value": "\n ",
"position": {
"start": {
"line": 49,
"column": 27,
"offset": 833
},
"end": {
"line": 50,
"column": 11,
"offset": 844
}
}
}
],
"position": {
"start": {
"line": 47,
"column": 11,
"offset": 720
},
"end": {
"line": 50,
"column": 11,
"offset": 844
}
}
}
],
"position": {
"start": {
"line": 47,
"column": 11,
"offset": 720
},
"end": {
"line": 50,
"column": 18,
"offset": 851
}
}
},
{
"type": "text",
"value": "\n ",
"position": {
"start": {
"line": 50,
"column": 18,
"offset": 851
},
"end": {
"line": 51,
"column": 9,
"offset": 860
}
}
}
],
"position": {
"start": {
"line": 46,
"column": 9,
"offset": 691
},
"end": {
"line": 51,
"column": 15,
"offset": 866
}
}
},
{
"type": "text",
"value": "\n ",
"position": {
"start": {
"line": 51,
"column": 15,
"offset": 866
},
"end": {
"line": 52,
"column": 7,
"offset": 873
}
}
}
],
"position": {
"start": {
"line": 45,
"column": 7,
"offset": 676
},
"end": {
"line": 52,
"column": 14,
"offset": 880
}
}
},
{
"type": "text",
"value": "\n ",
"position": {
"start": {
"line": 52,
"column": 14,
"offset": 880
},
"end": {
"line": 53,
"column": 5,
"offset": 885
}
}
}
],
"position": {
"start": {
"line": 44,
"column": 5,
"offset": 649
},
"end": {
"line": 53,
"column": 11,
"offset": 891
}
}
},
{
"type": "text",
"value": "\n ",
"position": {
"start": {
"line": 53,
"column": 11,
"offset": 891
},
"end": {
"line": 54,
"column": 3,
"offset": 894
}
}
}
],
"position": {
"start": {
"line": 43,
"column": 3,
"offset": 607
},
"end": {
"line": 54,
"column": 3,
"offset": 894
}
}
}
],
"position": {
"start": {
"line": 43,
"column": 3,
"offset": 607
},
"end": {
"line": 54,
"column": 10,
"offset": 901
}
}
},
{
"type": "text",
"value": "\n",
"position": {
"start": {
"line": 54,
"column": 10,
"offset": 901
},
"end": {
"line": 55,
"column": 1,
"offset": 902
}
}
}
],
"position": {
"start": {
"line": 42,
"column": 1,
"offset": 581
},
"end": {
"line": 55,
"column": 7,
"offset": 908
}
}
}
],
"position": {
"start": {
"column": 1,
"line": 1,
"offset": 0
},
"end": {
"line": 55,
"column": 7,
"offset": 908
}
}
}