UNPKG

svelte-parse

Version:

An increidbly relaxed svelte-parser

814 lines (813 loc) 19.2 kB
{ "type": "root", "children": [ { "type": "svelteScript", "tagName": "script", "properties": [], "selfClosing": false, "children": [ { "type": "text", "value": "\n\timport File from './File.svelte';\n\n\texport let expanded = false;\n\texport let name;\n\texport let files;\n\n\tfunction toggle() {\n\t\texpanded = !expanded;\n\t}\n", "position": { "start": { "line": 1, "column": 9, "offset": 8 }, "end": { "line": 11, "column": 1, "offset": 161 } } } ], "position": { "start": { "line": 1, "column": 1, "offset": 0 }, "end": { "line": 11, "column": 10, "offset": 170 } } }, { "type": "text", "value": "\n\n", "position": { "start": { "line": 11, "column": 10, "offset": 170 }, "end": { "line": 13, "column": 1, "offset": 172 } } }, { "type": "svelteStyle", "tagName": "style", "properties": [], "selfClosing": false, "children": [ { "type": "text", "value": "\n\tspan {\n\t\tpadding: 0 0 0 1.5em;\n\t\tbackground: url(tutorial/icons/folder.svg) 0 0.1em no-repeat;\n\t\tbackground-size: 1em 1em;\n\t\tfont-weight: bold;\n\t\tcursor: pointer;\n\t}\n\n\t.expanded {\n\t\tbackground-image: url(tutorial/icons/folder-open.svg);\n\t}\n\n\tul {\n\t\tpadding: 0.2em 0 0 0.5em;\n\t\tmargin: 0 0 0 0.5em;\n\t\tlist-style: none;\n\t\tborder-left: 1px solid #eee;\n\t}\n\n\tli {\n\t\tpadding: 0.2em 0;\n\t}\n", "position": { "start": { "line": 13, "column": 8, "offset": 179 }, "end": { "line": 36, "column": 1, "offset": 563 } } } ], "position": { "start": { "line": 13, "column": 1, "offset": 172 }, "end": { "line": 36, "column": 9, "offset": 571 } } }, { "type": "text", "value": "\n\n", "position": { "start": { "line": 36, "column": 9, "offset": 571 }, "end": { "line": 38, "column": 1, "offset": 573 } } }, { "type": "svelteElement", "tagName": "span", "properties": [ { "type": "svelteDirective", "name": "class", "value": [], "modifiers": [], "shorthand": "none", "position": { "start": { "line": 38, "column": 7, "offset": 579 }, "end": { "line": 38, "column": 21, "offset": 593 } }, "specifier": "expanded" }, { "type": "svelteDirective", "name": "on", "value": [ { "type": "svelteDynamicContent", "position": { "start": { "line": 38, "column": 31, "offset": 603 }, "end": { "line": 38, "column": 39, "offset": 611 } }, "expression": { "type": "svelteExpression", "value": "toggle", "position": { "start": { "line": 38, "column": 32, "offset": 604 }, "end": { "line": 38, "column": 38, "offset": 610 } } } } ], "modifiers": [], "shorthand": "none", "position": { "start": { "line": 38, "column": 22, "offset": 594 }, "end": { "line": 38, "column": 39, "offset": 611 } }, "specifier": "click" } ], "selfClosing": false, "children": [ { "type": "svelteDynamicContent", "position": { "start": { "line": 38, "column": 40, "offset": 612 }, "end": { "line": 38, "column": 46, "offset": 618 } }, "expression": { "type": "svelteExpression", "value": "name", "position": { "start": { "line": 38, "column": 41, "offset": 613 }, "end": { "line": 38, "column": 45, "offset": 617 } } } } ], "position": { "start": { "line": 38, "column": 1, "offset": 573 }, "end": { "line": 38, "column": 53, "offset": 625 } } }, { "type": "text", "value": "\n\n", "position": { "start": { "line": 38, "column": 53, "offset": 625 }, "end": { "line": 40, "column": 1, "offset": 627 } } }, { "type": "svelteBranchingBlock", "name": "if", "branches": [ { "type": "svelteBranch", "name": "if", "expression": { "type": "svelteExpression", "value": "expanded", "position": { "start": { "line": 40, "column": 6, "offset": 632 }, "end": { "line": 40, "column": 14, "offset": 640 } } }, "children": [ { "type": "text", "value": "\n\t", "position": { "start": { "line": 40, "column": 15, "offset": 641 }, "end": { "line": 41, "column": 2, "offset": 643 } } }, { "type": "svelteElement", "tagName": "ul", "properties": [], "selfClosing": false, "children": [ { "type": "text", "value": "\n\t\t", "position": { "start": { "line": 41, "column": 6, "offset": 647 }, "end": { "line": 42, "column": 3, "offset": 650 } } }, { "type": "svelteBranchingBlock", "name": "each", "branches": [ { "type": "svelteBranch", "name": "each", "expression": { "type": "svelteExpression", "value": "files as file", "position": { "start": { "line": 42, "column": 10, "offset": 657 }, "end": { "line": 42, "column": 23, "offset": 670 } } }, "children": [ { "type": "text", "value": "\n\t\t\t", "position": { "start": { "line": 42, "column": 24, "offset": 671 }, "end": { "line": 43, "column": 4, "offset": 675 } } }, { "type": "svelteElement", "tagName": "li", "properties": [], "selfClosing": false, "children": [ { "type": "text", "value": "\n\t\t\t\t", "position": { "start": { "line": 43, "column": 8, "offset": 679 }, "end": { "line": 44, "column": 5, "offset": 684 } } }, { "type": "svelteBranchingBlock", "name": "if", "branches": [ { "type": "svelteBranch", "name": "if", "expression": { "type": "svelteExpression", "value": "file.type === 'folder'", "position": { "start": { "line": 44, "column": 10, "offset": 689 }, "end": { "line": 44, "column": 32, "offset": 711 } } }, "children": [ { "type": "text", "value": "\n\t\t\t\t\t", "position": { "start": { "line": 44, "column": 33, "offset": 712 }, "end": { "line": 45, "column": 6, "offset": 718 } } }, { "type": "svelteMeta", "tagName": "self", "properties": [ { "type": "svelteProperty", "name": "...file", "value": [ { "type": "svelteDynamicContent", "expression": { "type": "svelteExpression", "value": "...file", "position": { "start": { "line": 45, "column": 20, "offset": 732 }, "end": { "line": 45, "column": 27, "offset": 739 } } }, "position": { "start": { "line": 45, "column": 19, "offset": 731 }, "end": { "line": 45, "column": 27, "offset": 739 } } } ], "modifiers": [], "shorthand": "expression", "position": { "start": { "line": 45, "column": 19, "offset": 731 }, "end": { "line": 45, "column": 27, "offset": 739 } } } ], "selfClosing": true, "children": [], "position": { "start": { "line": 45, "column": 6, "offset": 718 }, "end": { "line": 45, "column": 30, "offset": 742 } } }, { "type": "text", "value": "\n\t\t\t\t", "position": { "start": { "line": 45, "column": 30, "offset": 742 }, "end": { "line": 46, "column": 5, "offset": 747 } } } ], "position": { "start": { "line": 44, "column": 5, "offset": 684 }, "end": { "line": 46, "column": 5, "offset": 747 } } }, { "type": "svelteBranch", "name": "else", "expression": { "type": "svelteExpression", "value": "" }, "children": [ { "type": "text", "value": "\n\t\t\t\t\t", "position": { "start": { "line": 46, "column": 12, "offset": 754 }, "end": { "line": 47, "column": 6, "offset": 760 } } }, { "type": "svelteComponent", "tagName": "File", "properties": [ { "type": "svelteProperty", "name": "...file", "value": [ { "type": "svelteDynamicContent", "expression": { "type": "svelteExpression", "value": "...file", "position": { "start": { "line": 47, "column": 13, "offset": 767 }, "end": { "line": 47, "column": 20, "offset": 774 } } }, "position": { "start": { "line": 47, "column": 12, "offset": 766 }, "end": { "line": 47, "column": 20, "offset": 774 } } } ], "modifiers": [], "shorthand": "expression", "position": { "start": { "line": 47, "column": 12, "offset": 766 }, "end": { "line": 47, "column": 20, "offset": 774 } } } ], "selfClosing": true, "children": [], "position": { "start": { "line": 47, "column": 6, "offset": 760 }, "end": { "line": 47, "column": 23, "offset": 777 } } }, { "type": "text", "value": "\n\t\t\t\t", "position": { "start": { "line": 47, "column": 23, "offset": 777 }, "end": { "line": 48, "column": 5, "offset": 782 } } } ], "position": { "start": { "line": 46, "column": 5, "offset": 747 }, "end": { "line": 48, "column": 5, "offset": 782 } } } ], "position": { "start": { "line": 44, "column": 5, "offset": 684 }, "end": { "line": 48, "column": 10, "offset": 787 } } }, { "type": "text", "value": "\n\t\t\t", "position": { "start": { "line": 48, "column": 10, "offset": 787 }, "end": { "line": 49, "column": 4, "offset": 791 } } } ], "position": { "start": { "line": 43, "column": 4, "offset": 675 }, "end": { "line": 49, "column": 9, "offset": 796 } } }, { "type": "text", "value": "\n\t\t", "position": { "start": { "line": 49, "column": 9, "offset": 796 }, "end": { "line": 50, "column": 3, "offset": 799 } } } ], "position": { "start": { "line": 42, "column": 3, "offset": 650 }, "end": { "line": 50, "column": 3, "offset": 799 } } } ], "position": { "start": { "line": 42, "column": 3, "offset": 650 }, "end": { "line": 50, "column": 10, "offset": 806 } } }, { "type": "text", "value": "\n\t", "position": { "start": { "line": 50, "column": 10, "offset": 806 }, "end": { "line": 51, "column": 2, "offset": 808 } } } ], "position": { "start": { "line": 41, "column": 2, "offset": 643 }, "end": { "line": 51, "column": 7, "offset": 813 } } }, { "type": "text", "value": "\n", "position": { "start": { "line": 51, "column": 7, "offset": 813 }, "end": { "line": 52, "column": 1, "offset": 814 } } } ], "position": { "start": { "line": 40, "column": 1, "offset": 627 }, "end": { "line": 52, "column": 1, "offset": 814 } } } ], "position": { "start": { "line": 40, "column": 1, "offset": 627 }, "end": { "line": 52, "column": 6, "offset": 819 } } } ], "position": { "start": { "column": 1, "line": 1, "offset": 0 }, "end": { "line": 52, "column": 6, "offset": 819 } } }