UNPKG

svelte-parse

Version:

An increidbly relaxed svelte-parser

1,958 lines (1,957 loc) 48.6 kB
{ "type": "root", "children": [ { "type": "svelteElement", "tagName": "div", "properties": [ { "type": "svelteDirective", "name": "use", "value": [ { "type": "svelteDynamicContent", "position": { "start": { "line": 2, "column": 17, "offset": 22 }, "end": { "line": 2, "column": 22, "offset": 27 } }, "expression": { "type": "svelteExpression", "value": "use", "position": { "start": { "line": 2, "column": 18, "offset": 23 }, "end": { "line": 2, "column": 21, "offset": 26 } } } } ], "modifiers": [], "shorthand": "none", "position": { "start": { "line": 2, "column": 5, "offset": 10 }, "end": { "line": 2, "column": 22, "offset": 27 } }, "specifier": "actions" }, { "type": "svelteDirective", "name": "use", "value": [], "modifiers": [], "shorthand": "none", "position": { "start": { "line": 3, "column": 5, "offset": 32 }, "end": { "line": 3, "column": 15, "offset": 42 } }, "specifier": "events" }, { "type": "svelteProperty", "name": "class", "value": [ { "type": "svelteDynamicContent", "position": { "start": { "line": 4, "column": 12, "offset": 54 }, "end": { "line": 10, "column": 7, "offset": 181 } }, "expression": { "type": "svelteExpression", "value": "clsxd(\n 'ui',\n fluid && 'fluid',\n inverted && 'inverted',\n className,\n 'placeholder'\n )", "position": { "start": { "line": 4, "column": 13, "offset": 55 }, "end": { "line": 10, "column": 6, "offset": 180 } } } } ], "modifiers": [], "shorthand": "none", "position": { "start": { "line": 4, "column": 5, "offset": 47 }, "end": { "line": 10, "column": 8, "offset": 182 } } } ], "selfClosing": false, "children": [ { "type": "text", "value": "\n ", "position": { "start": { "line": 11, "column": 2, "offset": 184 }, "end": { "line": 12, "column": 5, "offset": 189 } } }, { "type": "svelteBranchingBlock", "name": "if", "branches": [ { "type": "svelteBranch", "name": "if", "expression": { "type": "svelteExpression", "value": "header", "position": { "start": { "line": 12, "column": 10, "offset": 194 }, "end": { "line": 12, "column": 16, "offset": 200 } } }, "children": [ { "type": "text", "value": "\n ", "position": { "start": { "line": 12, "column": 17, "offset": 201 }, "end": { "line": 13, "column": 9, "offset": 210 } } }, { "type": "svelteElement", "tagName": "div", "properties": [ { "type": "svelteProperty", "name": "class", "value": [ { "type": "text", "value": "header", "position": { "start": { "line": 13, "column": 21, "offset": 222 }, "end": { "line": 13, "column": 28, "offset": 229 } } } ], "modifiers": [], "shorthand": "none", "position": { "start": { "line": 13, "column": 14, "offset": 215 }, "end": { "line": 13, "column": 28, "offset": 229 } } }, { "type": "svelteDirective", "name": "class", "value": [], "modifiers": [], "shorthand": "none", "position": { "start": { "line": 13, "column": 29, "offset": 230 }, "end": { "line": 13, "column": 40, "offset": 241 } }, "specifier": "image" } ], "selfClosing": false, "children": [ { "type": "text", "value": "\n ", "position": { "start": { "line": 13, "column": 41, "offset": 242 }, "end": { "line": 14, "column": 13, "offset": 255 } } }, { "type": "svelteElement", "tagName": "slot", "properties": [ { "type": "svelteProperty", "name": "name", "value": [ { "type": "text", "value": "header", "position": { "start": { "line": 14, "column": 25, "offset": 267 }, "end": { "line": 14, "column": 32, "offset": 274 } } } ], "modifiers": [], "shorthand": "none", "position": { "start": { "line": 14, "column": 19, "offset": 261 }, "end": { "line": 14, "column": 32, "offset": 274 } } } ], "selfClosing": false, "children": [ { "type": "text", "value": "\n ", "position": { "start": { "line": 14, "column": 33, "offset": 275 }, "end": { "line": 15, "column": 17, "offset": 292 } } }, { "type": "svelteBranchingBlock", "name": "each", "branches": [ { "type": "svelteBranch", "name": "each", "expression": { "type": "svelteExpression", "value": "iterable(header) as line", "position": { "start": { "line": 15, "column": 24, "offset": 299 }, "end": { "line": 15, "column": 48, "offset": 323 } } }, "children": [ { "type": "text", "value": "\n ", "position": { "start": { "line": 15, "column": 49, "offset": 324 }, "end": { "line": 16, "column": 21, "offset": 345 } } }, { "type": "svelteComponent", "tagName": "Line", "properties": [ { "type": "svelteProperty", "name": "size", "value": [ { "type": "svelteDynamicContent", "position": { "start": { "line": 16, "column": 32, "offset": 356 }, "end": { "line": 16, "column": 38, "offset": 362 } }, "expression": { "type": "svelteExpression", "value": "line", "position": { "start": { "line": 16, "column": 33, "offset": 357 }, "end": { "line": 16, "column": 37, "offset": 361 } } } } ], "modifiers": [], "shorthand": "none", "position": { "start": { "line": 16, "column": 27, "offset": 351 }, "end": { "line": 16, "column": 38, "offset": 362 } } } ], "selfClosing": true, "children": [], "position": { "start": { "line": 16, "column": 21, "offset": 345 }, "end": { "line": 16, "column": 41, "offset": 365 } } }, { "type": "text", "value": "\n ", "position": { "start": { "line": 16, "column": 41, "offset": 365 }, "end": { "line": 17, "column": 17, "offset": 382 } } } ], "position": { "start": { "line": 15, "column": 17, "offset": 292 }, "end": { "line": 17, "column": 17, "offset": 382 } } } ], "position": { "start": { "line": 15, "column": 17, "offset": 292 }, "end": { "line": 17, "column": 24, "offset": 389 } } }, { "type": "text", "value": "\n ", "position": { "start": { "line": 17, "column": 24, "offset": 389 }, "end": { "line": 18, "column": 13, "offset": 402 } } } ], "position": { "start": { "line": 14, "column": 13, "offset": 255 }, "end": { "line": 18, "column": 20, "offset": 409 } } }, { "type": "text", "value": "\n ", "position": { "start": { "line": 18, "column": 20, "offset": 409 }, "end": { "line": 19, "column": 9, "offset": 418 } } } ], "position": { "start": { "line": 13, "column": 9, "offset": 210 }, "end": { "line": 19, "column": 15, "offset": 424 } } }, { "type": "text", "value": "\n ", "position": { "start": { "line": 19, "column": 15, "offset": 424 }, "end": { "line": 20, "column": 5, "offset": 429 } } } ], "position": { "start": { "line": 12, "column": 5, "offset": 189 }, "end": { "line": 20, "column": 5, "offset": 429 } } } ], "position": { "start": { "line": 12, "column": 5, "offset": 189 }, "end": { "line": 20, "column": 10, "offset": 434 } } }, { "type": "text", "value": "\n ", "position": { "start": { "line": 20, "column": 10, "offset": 434 }, "end": { "line": 21, "column": 5, "offset": 439 } } }, { "type": "svelteElement", "tagName": "slot", "properties": [], "selfClosing": false, "children": [ { "type": "text", "value": "\n ", "position": { "start": { "line": 21, "column": 11, "offset": 445 }, "end": { "line": 22, "column": 9, "offset": 454 } } }, { "type": "svelteBranchingBlock", "name": "if", "branches": [ { "type": "svelteBranch", "name": "if", "expression": { "type": "svelteExpression", "value": "image && !header", "position": { "start": { "line": 22, "column": 14, "offset": 459 }, "end": { "line": 22, "column": 30, "offset": 475 } } }, "children": [ { "type": "text", "value": "\n ", "position": { "start": { "line": 22, "column": 31, "offset": 476 }, "end": { "line": 23, "column": 13, "offset": 489 } } }, { "type": "svelteElement", "tagName": "div", "properties": [ { "type": "svelteProperty", "name": "class", "value": [ { "type": "text", "value": "image", "position": { "start": { "line": 23, "column": 25, "offset": 501 }, "end": {} } }, { "type": "text", "value": " ", "position": { "start": { "line": 23, "column": 30, "offset": 506 }, "end": { "line": 23, "column": 31, "offset": 507 } } }, { "type": "svelteDynamicContent", "position": { "start": { "line": 23, "column": 31, "offset": 507 }, "end": { "line": 23, "column": 38, "offset": 514 } }, "expression": { "type": "svelteExpression", "value": "image", "position": { "start": { "line": 23, "column": 32, "offset": 508 }, "end": { "line": 23, "column": 37, "offset": 513 } } } } ], "modifiers": [], "shorthand": "none", "position": { "start": { "line": 23, "column": 18, "offset": 494 }, "end": { "line": 23, "column": 39, "offset": 515 } } } ], "selfClosing": false, "children": [], "position": { "start": { "line": 23, "column": 13, "offset": 489 }, "end": { "line": 23, "column": 46, "offset": 522 } } }, { "type": "text", "value": "\n ", "position": { "start": { "line": 23, "column": 46, "offset": 522 }, "end": { "line": 24, "column": 9, "offset": 531 } } } ], "position": { "start": { "line": 22, "column": 9, "offset": 454 }, "end": { "line": 24, "column": 9, "offset": 531 } } }, { "type": "svelteBranch", "name": "else if", "expression": { "type": "svelteExpression", "value": "paragraphs && lines", "position": { "start": { "line": 24, "column": 19, "offset": 541 }, "end": { "line": 24, "column": 38, "offset": 560 } } }, "children": [ { "type": "text", "value": "\n ", "position": { "start": { "line": 24, "column": 39, "offset": 561 }, "end": { "line": 25, "column": 13, "offset": 574 } } }, { "type": "svelteBranchingBlock", "name": "each", "branches": [ { "type": "svelteBranch", "name": "each", "expression": { "type": "svelteExpression", "value": "iterable(paragraphs) as para", "position": { "start": { "line": 25, "column": 20, "offset": 581 }, "end": { "line": 25, "column": 48, "offset": 609 } } }, "children": [ { "type": "text", "value": "\n ", "position": { "start": { "line": 25, "column": 49, "offset": 610 }, "end": { "line": 26, "column": 17, "offset": 627 } } }, { "type": "svelteComponent", "tagName": "Paragraph", "properties": [], "selfClosing": false, "children": [ { "type": "text", "value": "\n ", "position": { "start": { "line": 26, "column": 28, "offset": 638 }, "end": { "line": 27, "column": 21, "offset": 659 } } }, { "type": "svelteBranchingBlock", "name": "each", "branches": [ { "type": "svelteBranch", "name": "each", "expression": { "type": "svelteExpression", "value": "iterable(lines) as line", "position": { "start": { "line": 27, "column": 28, "offset": 666 }, "end": { "line": 27, "column": 51, "offset": 689 } } }, "children": [ { "type": "text", "value": "\n ", "position": { "start": { "line": 27, "column": 52, "offset": 690 }, "end": { "line": 28, "column": 25, "offset": 715 } } }, { "type": "svelteComponent", "tagName": "Line", "properties": [ { "type": "svelteProperty", "name": "size", "value": [ { "type": "svelteDynamicContent", "position": { "start": { "line": 28, "column": 36, "offset": 726 }, "end": { "line": 28, "column": 42, "offset": 732 } }, "expression": { "type": "svelteExpression", "value": "line", "position": { "start": { "line": 28, "column": 37, "offset": 727 }, "end": { "line": 28, "column": 41, "offset": 731 } } } } ], "modifiers": [], "shorthand": "none", "position": { "start": { "line": 28, "column": 31, "offset": 721 }, "end": { "line": 28, "column": 42, "offset": 732 } } } ], "selfClosing": true, "children": [], "position": { "start": { "line": 28, "column": 25, "offset": 715 }, "end": { "line": 28, "column": 45, "offset": 735 } } }, { "type": "text", "value": "\n ", "position": { "start": { "line": 28, "column": 45, "offset": 735 }, "end": { "line": 29, "column": 21, "offset": 756 } } } ], "position": { "start": { "line": 27, "column": 21, "offset": 659 }, "end": { "line": 29, "column": 21, "offset": 756 } } } ], "position": { "start": { "line": 27, "column": 21, "offset": 659 }, "end": { "line": 29, "column": 28, "offset": 763 } } }, { "type": "text", "value": "\n ", "position": { "start": { "line": 29, "column": 28, "offset": 763 }, "end": { "line": 30, "column": 17, "offset": 780 } } } ], "position": { "start": { "line": 26, "column": 17, "offset": 627 }, "end": { "line": 30, "column": 29, "offset": 792 } } }, { "type": "text", "value": "\n ", "position": { "start": { "line": 30, "column": 29, "offset": 792 }, "end": { "line": 31, "column": 13, "offset": 805 } } } ], "position": { "start": { "line": 25, "column": 13, "offset": 574 }, "end": { "line": 31, "column": 13, "offset": 805 } } } ], "position": { "start": { "line": 25, "column": 13, "offset": 574 }, "end": { "line": 31, "column": 20, "offset": 812 } } }, { "type": "text", "value": "\n ", "position": { "start": { "line": 31, "column": 20, "offset": 812 }, "end": { "line": 32, "column": 9, "offset": 821 } } } ], "position": { "start": { "line": 24, "column": 9, "offset": 531 }, "end": { "line": 32, "column": 9, "offset": 821 } } }, { "type": "svelteBranch", "name": "else if", "expression": { "type": "svelteExpression", "value": "paragraphs", "position": { "start": { "line": 32, "column": 19, "offset": 831 }, "end": { "line": 32, "column": 29, "offset": 841 } } }, "children": [ { "type": "text", "value": "\n ", "position": { "start": { "line": 32, "column": 30, "offset": 842 }, "end": { "line": 33, "column": 13, "offset": 855 } } }, { "type": "svelteBranchingBlock", "name": "each", "branches": [ { "type": "svelteBranch", "name": "each", "expression": { "type": "svelteExpression", "value": "iterable(paragraphs) as para", "position": { "start": { "line": 33, "column": 20, "offset": 862 }, "end": { "line": 33, "column": 48, "offset": 890 } } }, "children": [ { "type": "text", "value": "\n ", "position": { "start": { "line": 33, "column": 49, "offset": 891 }, "end": { "line": 34, "column": 17, "offset": 908 } } }, { "type": "svelteComponent", "tagName": "Paragraph", "properties": [], "selfClosing": false, "children": [ { "type": "text", "value": "\n ", "position": { "start": { "line": 34, "column": 28, "offset": 919 }, "end": { "line": 35, "column": 21, "offset": 940 } } }, { "type": "svelteBranchingBlock", "name": "each", "branches": [ { "type": "svelteBranch", "name": "each", "expression": { "type": "svelteExpression", "value": "iterable(para) as line", "position": { "start": { "line": 35, "column": 28, "offset": 947 }, "end": { "line": 35, "column": 50, "offset": 969 } } }, "children": [ { "type": "text", "value": "\n ", "position": { "start": { "line": 35, "column": 51, "offset": 970 }, "end": { "line": 36, "column": 25, "offset": 995 } } }, { "type": "svelteComponent", "tagName": "Line", "properties": [ { "type": "svelteProperty", "name": "size", "value": [ { "type": "svelteDynamicContent", "position": { "start": { "line": 36, "column": 36, "offset": 1006 }, "end": { "line": 36, "column": 42, "offset": 1012 } }, "expression": { "type": "svelteExpression", "value": "line", "position": { "start": { "line": 36, "column": 37, "offset": 1007 }, "end": { "line": 36, "column": 41, "offset": 1011 } } } } ], "modifiers": [], "shorthand": "none", "position": { "start": { "line": 36, "column": 31, "offset": 1001 }, "end": { "line": 36, "column": 42, "offset": 1012 } } } ], "selfClosing": true, "children": [], "position": { "start": { "line": 36, "column": 25, "offset": 995 }, "end": { "line": 36, "column": 45, "offset": 1015 } } }, { "type": "text", "value": "\n ", "position": { "start": { "line": 36, "column": 45, "offset": 1015 }, "end": { "line": 37, "column": 21, "offset": 1036 } } } ], "position": { "start": { "line": 35, "column": 21, "offset": 940 }, "end": { "line": 37, "column": 21, "offset": 1036 } } } ], "position": { "start": { "line": 35, "column": 21, "offset": 940 }, "end": { "line": 37, "column": 28, "offset": 1043 } } }, { "type": "text", "value": "\n ", "position": { "start": { "line": 37, "column": 28, "offset": 1043 }, "end": { "line": 38, "column": 17, "offset": 1060 } } } ], "position": { "start": { "line": 34, "column": 17, "offset": 908 }, "end": { "line": 38, "column": 29, "offset": 1072 } } }, { "type": "text", "value": "\n ", "position": { "start": { "line": 38, "column": 29, "offset": 1072 }, "end": { "line": 39, "column": 13, "offset": 1085 } } } ], "position": { "start": { "line": 33, "column": 13, "offset": 855 }, "end": { "line": 39, "column": 13, "offset": 1085 } } } ], "position": { "start": { "line": 33, "column": 13, "offset": 855 }, "end": { "line": 39, "column": 20, "offset": 1092 } } }, { "type": "text", "value": "\n ", "position": { "start": { "line": 39, "column": 20, "offset": 1092 }, "end": { "line": 40, "column": 9, "offset": 1101 } } } ], "position": { "start": { "line": 32, "column": 9, "offset": 821 }, "end": { "line": 40, "column": 9, "offset": 1101 } } }, { "type": "svelteBranch", "name": "else if", "expression": { "type": "svelteExpression", "value": "lines", "position": { "start": { "line": 40, "column": 19, "offset": 1111 }, "end": { "line": 40, "column": 24, "offset": 1116 } } }, "children": [ { "type": "text", "value": "\n ", "position": { "start": { "line": 40, "column": 25, "offset": 1117 }, "end": { "line": 41, "column": 13, "offset": 1130 } } }, { "type": "svelteBranchingBlock", "name": "each", "branches": [ { "type": "svelteBranch", "name": "each", "expression": { "type": "svelteExpression", "value": "iterable(lines) as line", "position": { "start": { "line": 41, "column": 20, "offset": 1137 }, "end": { "line": 41, "column": 43, "offset": 1160 } } }, "children": [ { "type": "text", "value": "\n ", "position": { "start": { "line": 41, "column": 44, "offset": 1161 }, "end": { "line": 42, "column": 17, "offset": 1178 } } }, { "type": "svelteComponent", "tagName": "Line", "properties": [ { "type": "svelteProperty", "name": "size", "value": [ { "type": "svelteDynamicContent", "position": { "start": { "line": 42, "column": 28, "offset": 1189 }, "end": { "line": 42, "column": 34, "offset": 1195 } }, "expression": { "type": "svelteExpression", "value": "line", "position": { "start": { "line": 42, "column": 29, "offset": 1190 }, "end": { "line": 42, "column": 33, "offset": 1194 } } } } ], "modifiers": [], "shorthand": "none", "position": { "start": { "line": 42, "column": 23, "offset": 1184 }, "end": { "line": 42, "column": 34, "offset": 1195 } } } ], "selfClosing": true, "children": [], "position": { "start": { "line": 42, "column": 17, "offset": 1178 }, "end": { "line": 42, "column": 37, "offset": 1198 } } }, { "type": "text", "value": "\n ", "position": { "start": { "line": 42, "column": 37, "offset": 1198 }, "end": { "line": 43, "column": 13, "offset": 1211 } } } ], "position": { "start": { "line": 41, "column": 13, "offset": 1130 }, "end": { "line": 43, "column": 13, "offset": 1211 } } } ], "position": { "start": { "line": 41, "column": 13, "offset": 1130 }, "end": { "line": 43, "column": 20, "offset": 1218 } } }, { "type": "text", "value": "\n ", "position": { "start": { "line": 43, "column": 20, "offset": 1218 }, "end": { "line": 44, "column": 9, "offset": 1227 } } } ], "position": { "start": { "line": 40, "column": 9, "offset": 1101 }, "end": { "line": 44, "column": 9, "offset": 1227 } } } ], "position": { "start": { "line": 22, "column": 9, "offset": 454 }, "end": { "line": 44, "column": 14, "offset": 1232 } } }, { "type": "text", "value": "\n ", "position": { "start": { "line": 44, "column": 14, "offset": 1232 }, "end": { "line": 45, "column": 5, "offset": 1237 } } } ], "position": { "start": { "line": 21, "column": 5, "offset": 439 }, "end": { "line": 45, "column": 12, "offset": 1244 } } }, { "type": "text", "value": "\n", "position": { "start": { "line": 45, "column": 12, "offset": 1244 }, "end": { "line": 46, "column": 1, "offset": 1245 } } } ], "position": { "start": { "line": 1, "column": 1, "offset": 0 }, "end": { "line": 46, "column": 7, "offset": 1251 } } }, { "type": "text", "value": "\n\n", "position": { "start": { "line": 46, "column": 7, "offset": 1251 }, "end": { "line": 48, "column": 1, "offset": 1253 } } }, { "type": "svelteScript", "tagName": "script", "properties": [ { "type": "svelteProperty", "name": "context", "value": [ { "type": "text", "value": "module", "position": { "start": { "line": 48, "column": 18, "offset": 1270 }, "end": { "line": 48, "column": 25, "offset": 1277 } } } ], "modifiers": [], "shorthand": "none", "position": { "start": { "line": 48, "column": 9, "offset": 1261 }, "end": { "line": 48, "column": 25, "offset": 1277 } } } ], "selfClosing": false, "children": [ { "type": "text", "value": "\n import { exclude, eventsBuilder, actions, clsxd } from '../../lib'\n import { current_component } from 'svelte/internal'\n import Paragraph from './Paragraph.svelte'\n import Line from './Line.svelte'\n\n export { Line, Paragraph }\n", "position": { "start": { "line": 48, "column": 26, "offset": 1278 }, "end": { "line": 55, "column": 1, "offset": 1522 } } } ], "position": { "start": { "line": 48, "column": 1, "offset": 1253 }, "end": { "line": 55, "column": 10, "offset": 1531 } } }, { "type": "text", "value": "\n\n", "position": { "start": { "line": 55, "column": 10, "offset": 1531 }, "end": { "line": 57, "column": 1, "offset": 1533 } } }, { "type": "svelteScript", "tagName": "script", "properties": [], "selfClosing": false, "children": [ { "type": "text", "value": "\n const events = eventsBuilder(current_component)\n\n export let use = [];\n let className = '';\n export { className as class };\n\n export let fluid = false;\n export let inverted = false;\n export let header = false;\n export let image = '';\n export let lines = '';\n export let paragraphs = []\n\n function iterable(t) {\n if (Array.isArray(t)) return t;\n else {\n t = parseInt(t)\n return Array(isNaN(t) ? 1 : t).fill('');\n }\n }\n", "position": { "start": { "line": 57, "column": 9, "offset": 1541 }, "end": { "line": 78, "column": 1, "offset": 2039 } } } ], "position": { "start": { "line": 57, "column": 1, "offset": 1533 }, "end": { "line": 78, "column": 10, "offset": 2048 } } } ], "position": { "start": { "column": 1, "line": 1, "offset": 0 }, "end": { "line": 78, "column": 10, "offset": 2048 } } }