svelte-parse
Version:
An increidbly relaxed svelte-parser
325 lines (324 loc) • 6.33 kB
JSON
{
"type": "root",
"children": [
{
"type": "svelteScript",
"tagName": "script",
"properties": [],
"selfClosing": false,
"children": [
{
"type": "text",
"value": "\n import { createEventDispatcher, onMount } from 'svelte';\n import { classnames } from '../../helpers/classnames';\n\n const dispatch = createEventDispatcher();\n\n export let isClickable = false;\n export let isSelected = false;\n export let isMulti = false;\n\n\n export let ClassNames;\n $: {\n ClassNames = classnames({\n isClickable,\n isSelected,\n isMulti\n });\n }\n\n function onClick(event) {\n if (isClickable) {\n dispatch('click', event);\n }\n }\n\n onMount(() => {\n isClickable = !!arguments[0].$$.callbacks.click;\n });\n",
"position": {
"start": {
"line": 1,
"column": 9,
"offset": 8
},
"end": {
"line": 30,
"column": 1,
"offset": 567
}
}
}
],
"position": {
"start": {
"line": 1,
"column": 1,
"offset": 0
},
"end": {
"line": 30,
"column": 10,
"offset": 576
}
}
},
{
"type": "text",
"value": "\n\n",
"position": {
"start": {
"line": 30,
"column": 10,
"offset": 576
},
"end": {
"line": 32,
"column": 1,
"offset": 578
}
}
},
{
"type": "svelteStyle",
"tagName": "style",
"properties": [],
"selfClosing": false,
"children": [
{
"type": "text",
"value": "\n .dropdownMenuItem {\n color: var(--neutral_7);\n clear: both;\n display: flex;\n border: 0;\n padding: 14px 16px;\n text-align: left;\n }\n\n .dropdownMenuItem:first-child {\n border-radius: 4px 4px 0 0;\n }\n\n .dropdownMenuItem:last-child {\n border-radius: 0 0 4px 4px;\n }\n\n .dropdownMenuItem.isClickable {\n cursor: pointer;\n }\n\n .dropdownMenuItem.isClickable:hover {\n background-color: var(--blue_0);\n }\n",
"position": {
"start": {
"line": 32,
"column": 8,
"offset": 585
},
"end": {
"line": 57,
"column": 1,
"offset": 1021
}
}
}
],
"position": {
"start": {
"line": 32,
"column": 1,
"offset": 578
},
"end": {
"line": 57,
"column": 9,
"offset": 1029
}
}
},
{
"type": "text",
"value": "\n\n",
"position": {
"start": {
"line": 57,
"column": 9,
"offset": 1029
},
"end": {
"line": 59,
"column": 1,
"offset": 1031
}
}
},
{
"type": "svelteElement",
"tagName": "div",
"properties": [
{
"type": "svelteProperty",
"name": "class",
"value": [
{
"type": "text",
"value": "dropdownMenuItem",
"position": {
"start": {
"line": 59,
"column": 13,
"offset": 1043
},
"end": {}
}
},
{
"type": "text",
"value": " ",
"position": {
"start": {
"line": 59,
"column": 29,
"offset": 1059
},
"end": {
"line": 59,
"column": 30,
"offset": 1060
}
}
},
{
"type": "svelteDynamicContent",
"position": {
"start": {
"line": 59,
"column": 30,
"offset": 1060
},
"end": {
"line": 59,
"column": 44,
"offset": 1074
}
},
"expression": {
"type": "svelteExpression",
"value": " ClassNames ",
"position": {
"start": {
"line": 59,
"column": 31,
"offset": 1061
},
"end": {
"line": 59,
"column": 43,
"offset": 1073
}
}
}
}
],
"modifiers": [],
"shorthand": "none",
"position": {
"start": {
"line": 59,
"column": 6,
"offset": 1036
},
"end": {
"line": 59,
"column": 45,
"offset": 1075
}
}
},
{
"type": "svelteDirective",
"name": "on",
"value": [
{
"type": "svelteDynamicContent",
"position": {
"start": {
"line": 59,
"column": 56,
"offset": 1086
},
"end": {
"line": 59,
"column": 65,
"offset": 1095
}
},
"expression": {
"type": "svelteExpression",
"value": "onClick",
"position": {
"start": {
"line": 59,
"column": 57,
"offset": 1087
},
"end": {
"line": 59,
"column": 64,
"offset": 1094
}
}
}
}
],
"modifiers": [],
"shorthand": "none",
"position": {
"start": {
"line": 59,
"column": 46,
"offset": 1076
},
"end": {
"line": 59,
"column": 66,
"offset": 1096
}
},
"specifier": "click"
}
],
"selfClosing": false,
"children": [
{
"type": "text",
"value": "\n ",
"position": {
"start": {
"line": 59,
"column": 67,
"offset": 1097
},
"end": {
"line": 60,
"column": 3,
"offset": 1100
}
}
},
{
"type": "svelteElement",
"tagName": "slot",
"properties": [],
"selfClosing": false,
"children": [],
"position": {
"start": {
"line": 60,
"column": 3,
"offset": 1100
},
"end": {
"line": 60,
"column": 16,
"offset": 1113
}
}
},
{
"type": "text",
"value": "\n",
"position": {
"start": {
"line": 60,
"column": 16,
"offset": 1113
},
"end": {
"line": 61,
"column": 1,
"offset": 1114
}
}
}
],
"position": {
"start": {
"line": 59,
"column": 1,
"offset": 1031
},
"end": {
"line": 61,
"column": 7,
"offset": 1120
}
}
}
],
"position": {
"start": {
"column": 1,
"line": 1,
"offset": 0
},
"end": {
"line": 61,
"column": 7,
"offset": 1120
}
}
}