UNPKG

svelte-parse

Version:

An increidbly relaxed svelte-parser

341 lines (340 loc) 5.89 kB
{ "type": "root", "children": [ { "type": "svelteScript", "tagName": "script", "properties": [], "selfClosing": false, "children": [ { "type": "text", "value": "\n\timport Keypad from './Keypad.svelte';\n\n\tlet pin;\n\t$: view = pin ? pin.replace(/\\d(?!$)/g, '•') : 'enter your pin';\n\n\tfunction handleSubmit() {\n\t\talert(`submitted ${pin}`);\n\t}\n", "position": { "start": { "line": 1, "column": 9, "offset": 8 }, "end": { "line": 10, "column": 1, "offset": 185 } } } ], "position": { "start": { "line": 1, "column": 1, "offset": 0 }, "end": { "line": 10, "column": 10, "offset": 194 } } }, { "type": "text", "value": "\n\n", "position": { "start": { "line": 10, "column": 10, "offset": 194 }, "end": { "line": 12, "column": 1, "offset": 196 } } }, { "type": "svelteElement", "tagName": "h1", "properties": [ { "type": "svelteProperty", "name": "style", "value": [ { "type": "text", "value": "color:", "position": { "start": { "line": 12, "column": 12, "offset": 207 }, "end": {} } }, { "type": "text", "value": " ", "position": { "start": { "line": 12, "column": 18, "offset": 213 }, "end": { "line": 12, "column": 19, "offset": 214 } } }, { "type": "svelteDynamicContent", "position": { "start": { "line": 12, "column": 19, "offset": 214 }, "end": { "line": 12, "column": 42, "offset": 237 } }, "expression": { "type": "svelteExpression", "value": "pin ? '#333' : '#ccc'", "position": { "start": { "line": 12, "column": 20, "offset": 215 }, "end": { "line": 12, "column": 41, "offset": 236 } } } } ], "modifiers": [], "shorthand": "none", "position": { "start": { "line": 12, "column": 5, "offset": 200 }, "end": { "line": 12, "column": 43, "offset": 238 } } } ], "selfClosing": false, "children": [ { "type": "svelteDynamicContent", "position": { "start": { "line": 12, "column": 44, "offset": 239 }, "end": { "line": 12, "column": 50, "offset": 245 } }, "expression": { "type": "svelteExpression", "value": "view", "position": { "start": { "line": 12, "column": 45, "offset": 240 }, "end": { "line": 12, "column": 49, "offset": 244 } } } } ], "position": { "start": { "line": 12, "column": 1, "offset": 196 }, "end": { "line": 12, "column": 55, "offset": 250 } } }, { "type": "text", "value": "\n\n", "position": { "start": { "line": 12, "column": 55, "offset": 250 }, "end": { "line": 14, "column": 1, "offset": 252 } } }, { "type": "svelteComponent", "tagName": "Keypad", "properties": [ { "type": "svelteDirective", "name": "bind", "value": [ { "type": "svelteDynamicContent", "position": { "start": { "line": 14, "column": 20, "offset": 271 }, "end": { "line": 14, "column": 25, "offset": 276 } }, "expression": { "type": "svelteExpression", "value": "pin", "position": { "start": { "line": 14, "column": 21, "offset": 272 }, "end": { "line": 14, "column": 24, "offset": 275 } } } } ], "modifiers": [], "shorthand": "none", "position": { "start": { "line": 14, "column": 9, "offset": 260 }, "end": { "line": 14, "column": 25, "offset": 276 } }, "specifier": "value" }, { "type": "svelteDirective", "name": "on", "value": [ { "type": "svelteDynamicContent", "position": { "start": { "line": 14, "column": 36, "offset": 287 }, "end": { "line": 14, "column": 50, "offset": 301 } }, "expression": { "type": "svelteExpression", "value": "handleSubmit", "position": { "start": { "line": 14, "column": 37, "offset": 288 }, "end": { "line": 14, "column": 49, "offset": 300 } } } } ], "modifiers": [], "shorthand": "none", "position": { "start": { "line": 14, "column": 26, "offset": 277 }, "end": { "line": 14, "column": 50, "offset": 301 } }, "specifier": "submit" } ], "selfClosing": true, "children": [], "position": { "start": { "line": 14, "column": 1, "offset": 252 }, "end": { "line": 14, "column": 52, "offset": 303 } } } ], "position": { "start": { "column": 1, "line": 1, "offset": 0 }, "end": { "line": 14, "column": 52, "offset": 303 } } }