svelte-parse
Version:
An increidbly relaxed svelte-parser
1,036 lines (1,035 loc) • 24.4 kB
JSON
{
"type": "root",
"children": [
{
"type": "svelteScript",
"tagName": "script",
"properties": [],
"selfClosing": false,
"children": [
{
"type": "text",
"value": "\n import { classnames } from '../../helpers/classnames';\n import { createEventDispatcher } from 'svelte';\n\n import Spinner from '../Spinner/Spinner.svelte';\n import options from './options';\n\n const dispatch = createEventDispatcher();\n\n export let iconPosition = options.iconPosition.ONLY;\n export let isActive = false;\n export let isBlock = false;\n export let isOutlined = false;\n export let isRounded = false;\n export let isSelected = false;\n export let isWaiting = false;\n export let isWide = false;\n export let isDisabled = false;\n export let htmlType = options.htmlType.BUTTON;\n export let Icon = null;\n\n let ClassNames;\n $: {\n ClassNames = classnames({\n [`iconPosition-${iconPosition}`]: Icon,\n isActive,\n isBlock,\n isSelected,\n isOutlined,\n isRounded,\n isWaiting,\n isWide\n });\n }\n\n let HtmlDisabled;\n $: {\n HtmlDisabled = isDisabled || isWaiting;\n }\n\n function onClick(event) {\n dispatch('click', event);\n }\n",
"position": {
"start": {
"line": 1,
"column": 9,
"offset": 8
},
"end": {
"line": 44,
"column": 1,
"offset": 999
}
}
}
],
"position": {
"start": {
"line": 1,
"column": 1,
"offset": 0
},
"end": {
"line": 44,
"column": 10,
"offset": 1008
}
}
},
{
"type": "text",
"value": "\n\n",
"position": {
"start": {
"line": 44,
"column": 10,
"offset": 1008
},
"end": {
"line": 46,
"column": 1,
"offset": 1010
}
}
},
{
"type": "svelteStyle",
"tagName": "style",
"properties": [],
"selfClosing": false,
"children": [
{
"type": "text",
"value": "\n .button {\n background: var(--Button-bg, var(--green_4));\n color: var(--Button-color, var(--white));\n border: var(--Button-border, none);\n border-radius: var(--Button-radius, 3px);\n cursor: pointer;\n display: inline-block;\n font-size: var(--Button-font-size, 14px);\n font-weight: var(--Button-font-weight, 600);\n line-height: var(--Button-line-height, 16px);\n padding: var(--Button-padding, 10px 16px);\n text-align: var(--Button-text-align, center);\n vertical-align: middle;\n white-space: nowrap;\n text-decoration: none;\n position: relative;\n transition: var(\n --Button-transition,\n background 0.1s ease-out,\n box-shadow 0.15s cubic-bezier(0.47, 0.03, 0.49, 1.38)\n );\n overflow: hidden;\n }\n\n .button:disabled {\n pointer-events: none;\n opacity: var(--Button-disabled-opacity, 0.5);\n }\n\n .button:focus {\n outline: none;\n background: var(--Button-focus-bg, var(--green_5));\n }\n\n .button.isActive {\n pointer-events: none;\n }\n\n .button:hover {\n background: var(--Button-hover-bg, var(--green_5));\n }\n\n .button:active {\n background: var(--Button-active-bg, var(--green_6));\n }\n\n .button.isOutlined {\n background: var(--Button-outlined-bg, var(--white));\n border: var(--Button-outlined-border, 1px solid var(--green_4));\n color: var(--Button-outlined-color, var(--green_4));\n }\n\n .button.isSelected {\n background: var(--Button-selected-bg, var(--green_6));\n }\n\n .button.isOutlined:active {\n box-shadow: 0 0 0 1px var(--green_6) inset;\n border: 1px solid var(--green_6);\n }\n\n .button.isBlock {\n width: 100%;\n }\n\n .button.isRounded {\n border-radius: 15px;\n }\n\n .button.isWide {\n padding-left: 32px;\n padding-right: 32px;\n }\n\n .inner {\n display: flex;\n align-items: center;\n justify-content: space-around;\n pointer-events: none;\n }\n\n .isBlock .inner {\n justify-content: center;\n }\n\n .icon {\n display: block;\n width: var(--Button-icon-width, 16px);\n min-width: var(--Button-icon-min-width, 16px);\n height: var(--Button-icon-height, 16px);\n }\n\n .icon :global(svg) {\n width: 100%;\n height: 100%;\n }\n\n .icon :global(path),\n .icon :global(polygon) {\n fill: currentColor;\n }\n\n .iconPosition-left .icon {\n margin-right: 5px;\n order: -1;\n }\n\n .iconPosition-right .icon {\n margin-left: 5px;\n order: 1;\n }\n\n .iconPosition-only .icon {\n width: var(--Button-icon-only-width, 1em); \n height: var(--Button-icon-only-height, 1em);\n }\n\n .spinner {\n width: 16px;\n height: 16px;\n position: absolute;\n top: 50%;\n left: 50%;\n margin-top: -8px;\n margin-left: -8px;\n animation: spinnerEnter 0.3s ease-out;\n }\n\n .isWaiting .inner {\n visibility: hidden;\n }\n\n @keyframes spinnerEnter {\n from {\n opacity: 0;\n }\n }\n",
"position": {
"start": {
"line": 46,
"column": 8,
"offset": 1017
},
"end": {
"line": 184,
"column": 1,
"offset": 3855
}
}
}
],
"position": {
"start": {
"line": 46,
"column": 1,
"offset": 1010
},
"end": {
"line": 184,
"column": 9,
"offset": 3863
}
}
},
{
"type": "text",
"value": "\n\n",
"position": {
"start": {
"line": 184,
"column": 9,
"offset": 3863
},
"end": {
"line": 186,
"column": 1,
"offset": 3865
}
}
},
{
"type": "svelteElement",
"tagName": "button",
"properties": [
{
"type": "svelteProperty",
"name": "class",
"value": [
{
"type": "text",
"value": "button",
"position": {
"start": {
"line": 187,
"column": 10,
"offset": 3882
},
"end": {}
}
},
{
"type": "text",
"value": " ",
"position": {
"start": {
"line": 187,
"column": 16,
"offset": 3888
},
"end": {
"line": 187,
"column": 17,
"offset": 3889
}
}
},
{
"type": "svelteDynamicContent",
"position": {
"start": {
"line": 187,
"column": 17,
"offset": 3889
},
"end": {
"line": 187,
"column": 29,
"offset": 3901
}
},
"expression": {
"type": "svelteExpression",
"value": "ClassNames",
"position": {
"start": {
"line": 187,
"column": 18,
"offset": 3890
},
"end": {
"line": 187,
"column": 28,
"offset": 3900
}
}
}
}
],
"modifiers": [],
"shorthand": "none",
"position": {
"start": {
"line": 187,
"column": 3,
"offset": 3875
},
"end": {
"line": 187,
"column": 30,
"offset": 3902
}
}
},
{
"type": "svelteProperty",
"name": "disabled",
"value": [
{
"type": "svelteDynamicContent",
"position": {
"start": {
"line": 188,
"column": 12,
"offset": 3914
},
"end": {
"line": 188,
"column": 26,
"offset": 3928
}
},
"expression": {
"type": "svelteExpression",
"value": "HtmlDisabled",
"position": {
"start": {
"line": 188,
"column": 13,
"offset": 3915
},
"end": {
"line": 188,
"column": 25,
"offset": 3927
}
}
}
}
],
"modifiers": [],
"shorthand": "none",
"position": {
"start": {
"line": 188,
"column": 3,
"offset": 3905
},
"end": {
"line": 188,
"column": 26,
"offset": 3928
}
}
},
{
"type": "svelteDirective",
"name": "on",
"value": [
{
"type": "svelteDynamicContent",
"position": {
"start": {
"line": 189,
"column": 12,
"offset": 3940
},
"end": {
"line": 189,
"column": 21,
"offset": 3949
}
},
"expression": {
"type": "svelteExpression",
"value": "onClick",
"position": {
"start": {
"line": 189,
"column": 13,
"offset": 3941
},
"end": {
"line": 189,
"column": 20,
"offset": 3948
}
}
}
}
],
"modifiers": [],
"shorthand": "none",
"position": {
"start": {
"line": 189,
"column": 3,
"offset": 3931
},
"end": {
"line": 189,
"column": 21,
"offset": 3949
}
},
"specifier": "click"
},
{
"type": "svelteProperty",
"name": "type",
"value": [
{
"type": "svelteDynamicContent",
"position": {
"start": {
"line": 190,
"column": 8,
"offset": 3957
},
"end": {
"line": 190,
"column": 18,
"offset": 3967
}
},
"expression": {
"type": "svelteExpression",
"value": "htmlType",
"position": {
"start": {
"line": 190,
"column": 9,
"offset": 3958
},
"end": {
"line": 190,
"column": 17,
"offset": 3966
}
}
}
}
],
"modifiers": [],
"shorthand": "none",
"position": {
"start": {
"line": 190,
"column": 3,
"offset": 3952
},
"end": {
"line": 190,
"column": 18,
"offset": 3967
}
}
}
],
"selfClosing": false,
"children": [
{
"type": "text",
"value": "\n ",
"position": {
"start": {
"line": 190,
"column": 19,
"offset": 3968
},
"end": {
"line": 191,
"column": 3,
"offset": 3971
}
}
},
{
"type": "svelteBranchingBlock",
"name": "if",
"branches": [
{
"type": "svelteBranch",
"name": "if",
"expression": {
"type": "svelteExpression",
"value": "isWaiting",
"position": {
"start": {
"line": 191,
"column": 8,
"offset": 3976
},
"end": {
"line": 191,
"column": 17,
"offset": 3985
}
}
},
"children": [
{
"type": "text",
"value": "\n ",
"position": {
"start": {
"line": 191,
"column": 18,
"offset": 3986
},
"end": {
"line": 192,
"column": 5,
"offset": 3991
}
}
},
{
"type": "svelteElement",
"tagName": "span",
"properties": [
{
"type": "svelteProperty",
"name": "class",
"value": [
{
"type": "text",
"value": "spinner",
"position": {
"start": {
"line": 192,
"column": 18,
"offset": 4004
},
"end": {
"line": 192,
"column": 26,
"offset": 4012
}
}
}
],
"modifiers": [],
"shorthand": "none",
"position": {
"start": {
"line": 192,
"column": 11,
"offset": 3997
},
"end": {
"line": 192,
"column": 26,
"offset": 4012
}
}
}
],
"selfClosing": false,
"children": [
{
"type": "text",
"value": "\n ",
"position": {
"start": {
"line": 192,
"column": 27,
"offset": 4013
},
"end": {
"line": 193,
"column": 7,
"offset": 4020
}
}
},
{
"type": "svelteComponent",
"tagName": "Spinner",
"properties": [],
"selfClosing": true,
"children": [],
"position": {
"start": {
"line": 193,
"column": 7,
"offset": 4020
},
"end": {
"line": 193,
"column": 18,
"offset": 4031
}
}
},
{
"type": "text",
"value": "\n ",
"position": {
"start": {
"line": 193,
"column": 18,
"offset": 4031
},
"end": {
"line": 194,
"column": 5,
"offset": 4036
}
}
}
],
"position": {
"start": {
"line": 192,
"column": 5,
"offset": 3991
},
"end": {
"line": 194,
"column": 12,
"offset": 4043
}
}
},
{
"type": "text",
"value": "\n ",
"position": {
"start": {
"line": 194,
"column": 12,
"offset": 4043
},
"end": {
"line": 195,
"column": 3,
"offset": 4046
}
}
}
],
"position": {
"start": {
"line": 191,
"column": 3,
"offset": 3971
},
"end": {
"line": 195,
"column": 3,
"offset": 4046
}
}
}
],
"position": {
"start": {
"line": 191,
"column": 3,
"offset": 3971
},
"end": {
"line": 195,
"column": 8,
"offset": 4051
}
}
},
{
"type": "text",
"value": "\n\n ",
"position": {
"start": {
"line": 195,
"column": 8,
"offset": 4051
},
"end": {
"line": 197,
"column": 3,
"offset": 4055
}
}
},
{
"type": "svelteElement",
"tagName": "span",
"properties": [
{
"type": "svelteProperty",
"name": "class",
"value": [
{
"type": "text",
"value": "inner",
"position": {
"start": {
"line": 197,
"column": 16,
"offset": 4068
},
"end": {
"line": 197,
"column": 22,
"offset": 4074
}
}
}
],
"modifiers": [],
"shorthand": "none",
"position": {
"start": {
"line": 197,
"column": 9,
"offset": 4061
},
"end": {
"line": 197,
"column": 22,
"offset": 4074
}
}
}
],
"selfClosing": false,
"children": [
{
"type": "text",
"value": "\n ",
"position": {
"start": {
"line": 197,
"column": 23,
"offset": 4075
},
"end": {
"line": 198,
"column": 5,
"offset": 4080
}
}
},
{
"type": "svelteBranchingBlock",
"name": "if",
"branches": [
{
"type": "svelteBranch",
"name": "if",
"expression": {
"type": "svelteExpression",
"value": "Icon",
"position": {
"start": {
"line": 198,
"column": 10,
"offset": 4085
},
"end": {
"line": 198,
"column": 14,
"offset": 4089
}
}
},
"children": [
{
"type": "text",
"value": "\n ",
"position": {
"start": {
"line": 198,
"column": 15,
"offset": 4090
},
"end": {
"line": 199,
"column": 7,
"offset": 4097
}
}
},
{
"type": "svelteElement",
"tagName": "span",
"properties": [
{
"type": "svelteProperty",
"name": "class",
"value": [
{
"type": "text",
"value": "icon",
"position": {
"start": {
"line": 199,
"column": 20,
"offset": 4110
},
"end": {
"line": 199,
"column": 25,
"offset": 4115
}
}
}
],
"modifiers": [],
"shorthand": "none",
"position": {
"start": {
"line": 199,
"column": 13,
"offset": 4103
},
"end": {
"line": 199,
"column": 25,
"offset": 4115
}
}
}
],
"selfClosing": false,
"children": [
{
"type": "text",
"value": "\n ",
"position": {
"start": {
"line": 199,
"column": 26,
"offset": 4116
},
"end": {
"line": 200,
"column": 9,
"offset": 4125
}
}
},
{
"type": "svelteMeta",
"tagName": "component",
"properties": [
{
"type": "svelteProperty",
"name": "this",
"value": [
{
"type": "svelteDynamicContent",
"position": {
"start": {
"line": 200,
"column": 33,
"offset": 4149
},
"end": {
"line": 200,
"column": 41,
"offset": 4157
}
},
"expression": {
"type": "svelteExpression",
"value": " Icon ",
"position": {
"start": {
"line": 200,
"column": 34,
"offset": 4150
},
"end": {
"line": 200,
"column": 40,
"offset": 4156
}
}
}
}
],
"modifiers": [],
"shorthand": "none",
"position": {
"start": {
"line": 200,
"column": 27,
"offset": 4143
},
"end": {
"line": 200,
"column": 42,
"offset": 4158
}
}
}
],
"selfClosing": true,
"children": [],
"position": {
"start": {
"line": 200,
"column": 9,
"offset": 4125
},
"end": {
"line": 200,
"column": 45,
"offset": 4161
}
}
},
{
"type": "text",
"value": "\n ",
"position": {
"start": {
"line": 200,
"column": 45,
"offset": 4161
},
"end": {
"line": 201,
"column": 7,
"offset": 4168
}
}
}
],
"position": {
"start": {
"line": 199,
"column": 7,
"offset": 4097
},
"end": {
"line": 201,
"column": 14,
"offset": 4175
}
}
},
{
"type": "text",
"value": "\n ",
"position": {
"start": {
"line": 201,
"column": 14,
"offset": 4175
},
"end": {
"line": 202,
"column": 5,
"offset": 4180
}
}
}
],
"position": {
"start": {
"line": 198,
"column": 5,
"offset": 4080
},
"end": {
"line": 202,
"column": 5,
"offset": 4180
}
}
}
],
"position": {
"start": {
"line": 198,
"column": 5,
"offset": 4080
},
"end": {
"line": 202,
"column": 10,
"offset": 4185
}
}
},
{
"type": "text",
"value": "\n\n ",
"position": {
"start": {
"line": 202,
"column": 10,
"offset": 4185
},
"end": {
"line": 204,
"column": 5,
"offset": 4191
}
}
},
{
"type": "svelteElement",
"tagName": "span",
"properties": [],
"selfClosing": false,
"children": [
{
"type": "text",
"value": "\n ",
"position": {
"start": {
"line": 204,
"column": 11,
"offset": 4197
},
"end": {
"line": 205,
"column": 7,
"offset": 4204
}
}
},
{
"type": "svelteElement",
"tagName": "slot",
"properties": [],
"selfClosing": true,
"children": [],
"position": {
"start": {
"line": 205,
"column": 7,
"offset": 4204
},
"end": {
"line": 205,
"column": 15,
"offset": 4212
}
}
},
{
"type": "text",
"value": "\n ",
"position": {
"start": {
"line": 205,
"column": 15,
"offset": 4212
},
"end": {
"line": 206,
"column": 5,
"offset": 4217
}
}
}
],
"position": {
"start": {
"line": 204,
"column": 5,
"offset": 4191
},
"end": {
"line": 206,
"column": 12,
"offset": 4224
}
}
},
{
"type": "text",
"value": "\n ",
"position": {
"start": {
"line": 206,
"column": 12,
"offset": 4224
},
"end": {
"line": 207,
"column": 3,
"offset": 4227
}
}
}
],
"position": {
"start": {
"line": 197,
"column": 3,
"offset": 4055
},
"end": {
"line": 207,
"column": 10,
"offset": 4234
}
}
},
{
"type": "text",
"value": "\n",
"position": {
"start": {
"line": 207,
"column": 10,
"offset": 4234
},
"end": {
"line": 208,
"column": 1,
"offset": 4235
}
}
}
],
"position": {
"start": {
"line": 186,
"column": 1,
"offset": 3865
},
"end": {
"line": 208,
"column": 10,
"offset": 4244
}
}
}
],
"position": {
"start": {
"column": 1,
"line": 1,
"offset": 0
},
"end": {
"line": 208,
"column": 10,
"offset": 4244
}
}
}