UNPKG

svelte-parse

Version:

An increidbly relaxed svelte-parser

713 lines (712 loc) 15.6 kB
{ "type": "root", "children": [ { "type": "svelteScript", "tagName": "script", "properties": [], "selfClosing": false, "children": [ { "type": "text", "value": "\n import { createEventDispatcher } from 'svelte';\n import Button from '@sveltekit/ui/Button';\n\n export let selectedItem;\n export let options = []; \n\n const dispatch = createEventDispatcher();\n\n function onOptionClick(option) {\n dispatch('select', option);\n }\n", "position": { "start": { "line": 1, "column": 9, "offset": 8 }, "end": { "line": 13, "column": 1, "offset": 277 } } } ], "position": { "start": { "line": 1, "column": 1, "offset": 0 }, "end": { "line": 13, "column": 10, "offset": 286 } } }, { "type": "text", "value": "\n\n", "position": { "start": { "line": 13, "column": 10, "offset": 286 }, "end": { "line": 15, "column": 1, "offset": 288 } } }, { "type": "svelteStyle", "tagName": "style", "properties": [], "selfClosing": false, "children": [ { "type": "text", "value": "\n .timeOptions {\n display: flex;\n flex-wrap: wrap;\n padding: 5px;\n max-width: 330px;\n }\n \n .option {\n width: 70px;\n margin: 5px;\n }\n", "position": { "start": { "line": 15, "column": 8, "offset": 295 }, "end": { "line": 27, "column": 1, "offset": 450 } } } ], "position": { "start": { "line": 15, "column": 1, "offset": 288 }, "end": { "line": 27, "column": 9, "offset": 458 } } }, { "type": "text", "value": "\n\n", "position": { "start": { "line": 27, "column": 9, "offset": 458 }, "end": { "line": 29, "column": 1, "offset": 460 } } }, { "type": "svelteElement", "tagName": "div", "properties": [ { "type": "svelteProperty", "name": "class", "value": [ { "type": "text", "value": "timeOptions", "position": { "start": { "line": 29, "column": 13, "offset": 472 }, "end": { "line": 29, "column": 25, "offset": 484 } } } ], "modifiers": [], "shorthand": "none", "position": { "start": { "line": 29, "column": 6, "offset": 465 }, "end": { "line": 29, "column": 25, "offset": 484 } } } ], "selfClosing": false, "children": [ { "type": "text", "value": "\n ", "position": { "start": { "line": 29, "column": 26, "offset": 485 }, "end": { "line": 30, "column": 3, "offset": 488 } } }, { "type": "svelteBranchingBlock", "name": "each", "branches": [ { "type": "svelteBranch", "name": "each", "expression": { "type": "svelteExpression", "value": "options as option ", "position": { "start": { "line": 30, "column": 11, "offset": 496 }, "end": { "line": 30, "column": 29, "offset": 514 } } }, "children": [ { "type": "text", "value": "\n ", "position": { "start": { "line": 30, "column": 30, "offset": 515 }, "end": { "line": 31, "column": 3, "offset": 518 } } }, { "type": "svelteElement", "tagName": "div", "properties": [ { "type": "svelteProperty", "name": "class", "value": [ { "type": "text", "value": "option", "position": { "start": { "line": 31, "column": 15, "offset": 530 }, "end": { "line": 31, "column": 22, "offset": 537 } } } ], "modifiers": [], "shorthand": "none", "position": { "start": { "line": 31, "column": 8, "offset": 523 }, "end": { "line": 31, "column": 22, "offset": 537 } } } ], "selfClosing": false, "children": [ { "type": "text", "value": "\n ", "position": { "start": { "line": 31, "column": 23, "offset": 538 }, "end": { "line": 32, "column": 5, "offset": 543 } } }, { "type": "svelteComponent", "tagName": "Button", "properties": [ { "type": "svelteProperty", "name": "type", "value": [ { "type": "text", "value": "link", "position": { "start": { "line": 33, "column": 13, "offset": 564 }, "end": { "line": 33, "column": 18, "offset": 569 } } } ], "modifiers": [], "shorthand": "none", "position": { "start": { "line": 33, "column": 7, "offset": 558 }, "end": { "line": 33, "column": 18, "offset": 569 } } }, { "type": "svelteProperty", "name": "size", "value": [ { "type": "text", "value": "compact", "position": { "start": { "line": 34, "column": 13, "offset": 583 }, "end": { "line": 34, "column": 21, "offset": 591 } } } ], "modifiers": [], "shorthand": "none", "position": { "start": { "line": 34, "column": 7, "offset": 577 }, "end": { "line": 34, "column": 21, "offset": 591 } } }, { "type": "svelteProperty", "name": "isBlock", "value": [], "modifiers": [], "shorthand": "boolean", "position": { "start": { "line": 35, "column": 7, "offset": 599 }, "end": { "line": 35, "column": 14, "offset": 606 } } }, { "type": "svelteProperty", "name": "isActive", "value": [ { "type": "svelteDynamicContent", "position": { "start": { "line": 36, "column": 17, "offset": 624 }, "end": { "line": 36, "column": 44, "offset": 651 } }, "expression": { "type": "svelteExpression", "value": " option === selectedItem ", "position": { "start": { "line": 36, "column": 18, "offset": 625 }, "end": { "line": 36, "column": 43, "offset": 650 } } } } ], "modifiers": [], "shorthand": "none", "position": { "start": { "line": 36, "column": 7, "offset": 614 }, "end": { "line": 36, "column": 45, "offset": 652 } } }, { "type": "svelteProperty", "name": "isSelected", "value": [ { "type": "svelteDynamicContent", "position": { "start": { "line": 37, "column": 19, "offset": 671 }, "end": { "line": 37, "column": 46, "offset": 698 } }, "expression": { "type": "svelteExpression", "value": " option === selectedItem ", "position": { "start": { "line": 37, "column": 20, "offset": 672 }, "end": { "line": 37, "column": 45, "offset": 697 } } } } ], "modifiers": [], "shorthand": "none", "position": { "start": { "line": 37, "column": 7, "offset": 659 }, "end": { "line": 37, "column": 47, "offset": 699 } } }, { "type": "svelteDirective", "name": "on", "value": [ { "type": "svelteDynamicContent", "position": { "start": { "line": 38, "column": 17, "offset": 716 }, "end": { "line": 38, "column": 48, "offset": 747 } }, "expression": { "type": "svelteExpression", "value": " () => onOptionClick(option) ", "position": { "start": { "line": 38, "column": 18, "offset": 717 }, "end": { "line": 38, "column": 47, "offset": 746 } } } } ], "modifiers": [], "shorthand": "none", "position": { "start": { "line": 38, "column": 7, "offset": 706 }, "end": { "line": 38, "column": 49, "offset": 748 } }, "specifier": "click" } ], "selfClosing": false, "children": [ { "type": "text", "value": "\n ", "position": { "start": { "line": 39, "column": 6, "offset": 754 }, "end": { "line": 40, "column": 7, "offset": 761 } } }, { "type": "svelteDynamicContent", "position": { "start": { "line": 40, "column": 7, "offset": 761 }, "end": { "line": 40, "column": 17, "offset": 771 } }, "expression": { "type": "svelteExpression", "value": "option ", "position": { "start": { "line": 40, "column": 9, "offset": 763 }, "end": { "line": 40, "column": 16, "offset": 770 } } } }, { "type": "text", "value": "\n ", "position": { "start": { "line": 40, "column": 17, "offset": 771 }, "end": { "line": 41, "column": 5, "offset": 776 } } } ], "position": { "start": { "line": 32, "column": 5, "offset": 543 }, "end": { "line": 41, "column": 14, "offset": 785 } } }, { "type": "text", "value": "\n ", "position": { "start": { "line": 41, "column": 14, "offset": 785 }, "end": { "line": 42, "column": 3, "offset": 788 } } } ], "position": { "start": { "line": 31, "column": 3, "offset": 518 }, "end": { "line": 42, "column": 9, "offset": 794 } } }, { "type": "text", "value": "\n ", "position": { "start": { "line": 42, "column": 9, "offset": 794 }, "end": { "line": 43, "column": 3, "offset": 797 } } } ], "position": { "start": { "line": 30, "column": 3, "offset": 488 }, "end": { "line": 43, "column": 3, "offset": 797 } } } ], "position": { "start": { "line": 30, "column": 3, "offset": 488 }, "end": { "line": 43, "column": 12, "offset": 806 } } }, { "type": "text", "value": "\n", "position": { "start": { "line": 43, "column": 12, "offset": 806 }, "end": { "line": 44, "column": 1, "offset": 807 } } } ], "position": { "start": { "line": 29, "column": 1, "offset": 460 }, "end": { "line": 44, "column": 7, "offset": 813 } } } ], "position": { "start": { "column": 1, "line": 1, "offset": 0 }, "end": { "line": 44, "column": 7, "offset": 813 } } }