Skip to main content
Create new
Introduction
Reactivity
Props
Logic
Events
Bindings
Lifecycle
Stores
Motion
Transitions
Animations
Easing
SVG
Actions
Classes
Component composition
Context API
Special elements
Module context
Debugging
7GUIs
Miscellaneous
App.svelte
t_identity.svelte
t_password.svelte
<script>
import Identity from "./t_identity.svelte";
import Password from "./t_password.svelte";

let tabs = [
{ name: "Identity", comp: Identity },
{ name: "Password", comp: Password },
];

let cur = tabs[0];
</script>

{#each tabs as tab}
<button class:selected={cur === tab} on:click={() => (cur = tab)}>
{tab.name}
</button>
{/each}
<main>
<svelte:component this={cur.comp} />
</main>

<style>
button {
cursor: pointer;
padding: 0.5rem 1rem;
border: 1px solid transparent;
margin-bottom: -1px;
background-color: #fff;
border-bottom-color: #abc;
}
button.selected {
border-top-right-radius: 8px;
border-top-left-radius: 8px;
border-top-width: 8px;
border-color: #b0b #abc #fff;
}
fetching https://unpkg.com/clsx@2.1.1/dist/clsx.mjs
import 'svelte/internal/disclose-version';
import 'svelte/internal/flags/legacy';
import * as $ from 'svelte/internal/client';
import Identity from "./t_identity.svelte";
import Password from "./t_password.svelte";

var root_1 = $.template(`<button> </button>`);
var root = $.template(`<!> <main class="svelte-zwxmev"><!></main>`, 1);

export default function App($$anchor) {
let tabs = [
{ name: "Identity", comp: Identity },
{ name: "Password", comp: Password }
];

let cur = $.mutable_state(tabs[0]);
var fragment = root();
var node = $.first_child(fragment);

$.each(node, 1, () => tabs, $.index, ($$anchor, tab) => {
var button = root_1();
let classes;
var text = $.child(button, true);

$.reset(button);

$.template_effect(() => {
classes = $.set_class(button, 1, 'svelte-zwxmev', null, classes, { selected: $.get(cur) === $.get(tab) });
$.set_text(text, $.get(tab).name);
});

$.event('click', button, () => $.set(cur, $.get(tab)));
$.append($$anchor, button);
});

var main = $.sibling(node, 2);
result = svelte.compile(source, {
generate: ,
});

button.svelte-zwxmev {
cursor: pointer;
padding: 0.5rem 1rem;
border: 1px solid transparent;
margin-bottom: -1px;
background-color: #fff;
border-bottom-color: #abc;
}
button.selected.svelte-zwxmev {
border-top-right-radius: 8px;
border-top-left-radius: 8px;
border-top-width: 8px;
border-color: #b0b #abc #fff;
}
main.svelte-zwxmev {
font-size: 1rem;
padding: 2rem;
border: 1px solid #abc;
}

		
			
				
  • Root {
    • css: StyleSheet {...}
      • type: "StyleSheet"
      • start: 404
      • end: 802
      • attributes: []
      • children: [...] (3)
        • Rule {...}
          • type: "Rule"
          • prelude: SelectorList {...}
            • type: "SelectorList"
            • start: 413
            • end: 419
            • children: [...] (1)
              • ComplexSelector {...}
                • type: "ComplexSelector"
                • start: 413
                • end: 419
                • children: [...] (1)
                  • RelativeSelector {...}
                    • type: "RelativeSelector"
                    • combinator: null
                    • selectors: [...] (1)
                      • TypeSelector {...}
                        • type: "TypeSelector"
                        • name: "button"
                        • start: 413
                        • end: 419
                        }
                      ]
                    • start: 413
                    • end: 419
                    }
                  ]
                }
              ]
            }
          • block: Block {...}
            • type: "Block"
            • start: 420
            • end: 578
            • children: [...] (6)
              • Declaration {...}
                • type: "Declaration"
                • start: 424
                • end: 439
                • property: "cursor"
                • value: "pointer"
                }
              • Declaration {...}
                • type: "Declaration"
                • start: 443
                • end: 463
                • property: "padding"
                • value: "0.5rem 1rem"
                }
              • Declaration {...}
                • type: "Declaration"
                • start: 467
                • end: 496
                • property: "border"
                • value: "1px solid transparent"
                }
              • Declaration {...}
                • type: "Declaration"
                • start: 500
                • end: 519
                • property: "margin-bottom"
                • value: "-1px"
                }
              • Declaration {...}
                • type: "Declaration"
                • start: 523
                • end: 545
                • property: "background-color"
                • value: "#fff"
                }
              • Declaration {...}
                • type: "Declaration"
                • start: 549
                • end: 574
                • property: "border-bottom-color"
                • value: "#abc"
                }
              ]
            }
          • start: 413
          • end: 578
          }
        • Rule {...}
          • type: "Rule"
          • prelude: SelectorList {...}
            • type: "SelectorList"
            • start: 580
            • end: 595
            • children: [...] (1)
              • ComplexSelector {...}
                • type: "ComplexSelector"
                • start: 580
                • end: 595
                • children: [...] (1)
                  • RelativeSelector {...}
                    • type: "RelativeSelector"
                    • combinator: null
                    • selectors: [...] (2)
                      • TypeSelector {...}
                        • type: "TypeSelector"
                        • name: "button"
                        • start: 580
                        • end: 586
                        }
                      • ClassSelector {...}
                        • type: "ClassSelector"
                        • name: "selected"
                        • start: 586
                        • end: 595
                        }
                      ]
                    • start: 580
                    • end: 595
                    }
                  ]
                }
              ]
            }
          • block: Block {...}
            • type: "Block"
            • start: 596
            • end: 720
            • children: [...] (4)
              • Declaration {...}
                • type: "Declaration"
                • start: 600
                • end: 628
                • property: "border-top-right-radius"
                • value: "8px"
                }
              • Declaration {...}
                • type: "Declaration"
                • start: 632
                • end: 659
                • property: "border-top-left-radius"
                • value: "8px"
                }
              • Declaration {...}
                • type: "Declaration"
                • start: 663
                • end: 684
                • property: "border-top-width"
                • value: "8px"
                }
              • Declaration {...}
                • type: "Declaration"
                • start: 688
                • end: 716
                • property: "border-color"
                • value: "#b0b #abc #fff"
                }
              ]
            }
          • start: 580
          • end: 720
          }
        • Rule {...}
          • type: "Rule"
          • prelude: SelectorList {...}
            • type: "SelectorList"
            • start: 722
            • end: 726
            • children: [...] (1)
              • ComplexSelector {...}
                • type: "ComplexSelector"
                • start: 722
                • end: 726
                • children: [...] (1)
                  • RelativeSelector {...}
                    • type: "RelativeSelector"
                    • combinator: null
                    • selectors: [...] (1)
                      • TypeSelector {...}
                        • type: "TypeSelector"
                        • name: "main"
                        • start: 722
                        • end: 726
                        }
                      ]
                    • start: 722
                    • end: 726
                    }
                  ]
                }
              ]
            }
          • block: Block {...}
            • type: "Block"
            • start: 727
            • end: 793
            • children: [...] (3)
              • Declaration {...}
                • type: "Declaration"
                • start: 731
                • end: 746
                • property: "font-size"
                • value: "1rem"
                }
              • Declaration {...}
                • type: "Declaration"
                • start: 750
                • end: 763
                • property: "padding"
                • value: "2rem"
                }
              • Declaration {...}
                • type: "Declaration"
                • start: 767
                • end: 789
                • property: "border"
                • value: "1px solid #abc"
                }
              ]
            }
          • start: 722
          • end: 793
          }
        ]
      • content: {...}
        • start: 411
        • end: 794
        • styles: "\n\tbutton {\n\t\tcursor: pointer;\n\t\tpadding: 0.5rem 1rem;\n\t\tborder: 1px solid transparent;\n\t\tmargin-bottom: -1px;\n\t\tbackground-color: #fff;\n\t\tborder-bottom-color: #abc;\n\t}\n\tbutton.selected {\n\t\tborder-top-right-radius: 8px;\n\t\tborder-top-left-radius: 8px;\n\t\tborder-top-width: 8px;\n\t\tborder-color: #b0b #abc #fff;\n\t}\n\tmain {\n\t\tfont-size: 1rem;\n\t\tpadding: 2rem;\n\t\tborder: 1px solid #abc;\n\t}\n"
        • comment: null
        }
      }
    • js: []
    • start: 230
    • end: 402
    • type: "Root"
    • fragment: Fragment {...}
      • type: "Fragment"
      • nodes: [...] (5)
        • Text {...}
          • type: "Text"
          • start: 228
          • end: 230
          • raw: "\n\n"
          • data: "\n\n"
          }
        • EachBlock {...}
          • type: "EachBlock"
          • start: 230
          • end: 349
          • expression: Identifier {...}
            • type: "Identifier"
            • start: 237
            • end: 241
            • loc: {...}
              • start: {...}
                • line: 13
                • column: 7
                }
              • end: {...}
                • line: 13
                • column: 11
                }
              }
            • name: "tabs"
            }
          • body: Fragment {...}
            • type: "Fragment"
            • nodes: [...] (3)
              • Text {...}
                • type: "Text"
                • start: 249
                • end: 251
                • raw: "\n\t"
                • data: "\n\t"
                }
              • RegularElement {...}
                • type: "RegularElement"
                • start: 251
                • end: 341
                • name: "button"
                • attributes: [...] (3)
                  • ClassDirective {...}
                    • start: 259
                    • end: 287
                    • type: "ClassDirective"
                    • name: "selected"
                    • expression: BinaryExpression {...}
                      • type: "BinaryExpression"
                      • start: 275
                      • end: 286
                      • loc: {...}
                        • start: {...}
                          • line: 14
                          • column: 25
                          }
                        • end: {...}
                          • line: 14
                          • column: 36
                          }
                        }
                      • left: Identifier {...}
                        • type: "Identifier"
                        • start: 275
                        • end: 278
                        • loc: {...}
                          • start: {...}
                            • line: 14
                            • column: 25
                            }
                          • end: {...}
                            • line: 14
                            • column: 28
                            }
                          }
                        • name: "cur"
                        }
                      • operator: "==="
                      • right: Identifier {...}
                        • type: "Identifier"
                        • start: 283
                        • end: 286
                        • loc: {...}
                          • start: {...}
                            • line: 14
                            • column: 33
                            }
                          • end: {...}
                            • line: 14
                            • column: 36
                            }
                          }
                        • name: "tab"
                        }
                      }
                    • modifiers: []
                    }
                  • OnDirective {...}
                    • start: 288
                    • end: 316
                    • type: "OnDirective"
                    • name: "click"
                    • expression: ArrowFunctionExpression {...}
                      • type: "ArrowFunctionExpression"
                      • start: 298
                      • end: 315
                      • loc: {...}
                        • start: {...}
                          • line: 14
                          • column: 48
                          }
                        • end: {...}
                          • line: 14
                          • column: 65
                          }
                        }
                      • id: null
                      • expression: true
                      • generator: false
                      • async: false
                      • params: []
                      • body: AssignmentExpression {...}
                        • type: "AssignmentExpression"
                        • start: 305
                        • end: 314
                        • loc: {...}
                          • start: {...}
                            • line: 14
                            • column: 55
                            }
                          • end: {...}
                            • line: 14
                            • column: 64
                            }
                          }
                        • operator: "="
                        • left: Identifier {...}
                          • type: "Identifier"
                          • start: 305
                          • end: 308
                          • loc: {...}
                            • start: {...}
                              • line: 14
                              • column: 55
                              }
                            • end: {...}
                              • line: 14
                              • column: 58
                              }
                            }
                          • name: "cur"
                          }
                        • right: Identifier {...}
                          • type: "Identifier"
                          • start: 311
                          • end: 314
                          • loc: {...}
                            • start: {...}
                              • line: 14
                              • column: 61
                              }
                            • end: {...}
                              • line: 14
                              • column: 64
                              }
                            }
                          • name: "tab"
                          }
                        }
                      }
                    • modifiers: []
                    }
                  • Attribute {...}
                    • type: "Attribute"
                    • start: -1
                    • end: -1
                    • name: "class"
                    • value: [...] (1)
                      • Text {...}
                        • type: "Text"
                        • data: ""
                        • raw: ""
                        • start: -1
                        • end: -1
                        }
                      ]
                    }
                  ]
                • fragment: Fragment {...}
                  • type: "Fragment"
                  • nodes: [...] (3)
                    • Text {...}
                      • type: "Text"
                      • start: 317
                      • end: 320
                      • raw: "\n\t\t"
                      • data: "\n\t\t"
                      }
                    • ExpressionTag {...}
                      • type: "ExpressionTag"
                      • start: 320
                      • end: 330
                      • expression: MemberExpression {...}
                        • type: "MemberExpression"
                        • start: 321
                        • end: 329
                        • loc: {...}
                          • start: {...}
                            • line: 15
                            • column: 3
                            }
                          • end: {...}
                            • line: 15
                            • column: 11
                            }
                          }
                        • object: Identifier {...}
                          • type: "Identifier"
                          • start: 321
                          • end: 324
                          • loc: {...}
                            • start: {...}
                              • line: 15
                              • column: 3
                              }
                            • end: {...}
                              • line: 15
                              • column: 6
                              }
                            }
                          • name: "tab"
                          }
                        • property: Identifier {...}
                          • type: "Identifier"
                          • start: 325
                          • end: 329
                          • loc: {...}
                            • start: {...}
                              • line: 15
                              • column: 7
                              }
                            • end: {...}
                              • line: 15
                              • column: 11
                              }
                            }
                          • name: "name"
                          }
                        • computed: false
                        • optional: false
                        }
                      }
                    • Text {...}
                      • type: "Text"
                      • start: 330
                      • end: 332
                      • raw: "\n\t"
                      • data: "\n\t"
                      }
                    ]
                  }
                }
              • Text {...}
                • type: "Text"
                • start: 341
                • end: 342
                • raw: "\n"
                • data: "\n"
                }
              ]
            }
          • context: Identifier {...}
            • type: "Identifier"
            • name: "tab"
            • start: 245
            • loc: {...}
              • start: {...}
                • line: 13
                • column: 15
                • character: 245
                }
              • end: {...}
                • line: 13
                • column: 18
                • character: 248
                }
              }
            • end: 248
            • typeAnnotation: undefined
            }
          • index: undefined
          • key: undefined
          }
        • Text {...}
          • type: "Text"
          • start: 349
          • end: 350
          • raw: " "
          • data: " "
          }
        • RegularElement {...}
          • type: "RegularElement"
          • start: 350
          • end: 402
          • name: "main"
          • attributes: [...] (1)
            • Attribute {...}
              • type: "Attribute"
              • start: -1
              • end: -1
              • name: "class"
              • value: [...] (1)
                • Text {...}
                  • type: "Text"
                  • data: ""
                  • raw: ""
                  • start: -1
                  • end: -1
                  }
                ]
              }
            ]
          • fragment: Fragment {...}
            • type: "Fragment"
            • nodes: [...] (3)
              • Text {...}
                • type: "Text"
                • start: 356
                • end: 358
                • raw: "\n\t"
                • data: "\n\t"
                }
              • SvelteComponent {...}
                • type: "SvelteComponent"
                • start: 358
                • end: 394
                • name: "svelte:component"
                • attributes: []
                • fragment: Fragment {...}
                  • type: "Fragment"
                  • nodes: []
                  }
                • expression: MemberExpression {...}
                  • type: "MemberExpression"
                  • start: 382
                  • end: 390
                  • loc: {...}
                    • start: {...}
                      • line: 19
                      • column: 25
                      }
                    • end: {...}
                      • line: 19
                      • column: 33
                      }
                    }
                  • object: Identifier {...}
                    • type: "Identifier"
                    • start: 382
                    • end: 385
                    • loc: {...}
                      • start: {...}
                        • line: 19
                        • column: 25
                        }
                      • end: {...}
                        • line: 19
                        • column: 28
                        }
                      }
                    • name: "cur"
                    }
                  • property: Identifier {...}
                    • type: "Identifier"
                    • start: 386
                    • end: 390
                    • loc: {...}
                      • start: {...}
                        • line: 19
                        • column: 29
                        }
                      • end: {...}
                        • line: 19
                        • column: 33
                        }
                      }
                    • name: "comp"
                    }
                  • computed: false
                  • optional: false
                  }
                }
              • Text {...}
                • type: "Text"
                • start: 394
                • end: 395
                • raw: "\n"
                • data: "\n"
                }
              ]
            }
          }
        • Text {...}
          • type: "Text"
          • start: 402
          • end: 404
          • raw: "\n\n"
          • data: "\n\n"
          }
        ]
      }
    • options: null
    • instance: Script {...}
      • type: "Script"
      • start: 0
      • end: 228
      • context: "default"
      • content: Program {...}
        • type: "Program"
        • start: 8
        • end: 219
        • loc: {...}
          • start: {...}
            • line: 1
            • column: 0
            }
          • end: {...}
            • line: 11
            • column: 0
            }
          }
        • body: [...] (4)
          • ImportDeclaration {...}
            • type: "ImportDeclaration"
            • start: 10
            • end: 53
            • loc: {...}
              • start: {...}
                • line: 2
                • column: 1
                }
              • end: {...}
                • line: 2
                • column: 44
                }
              }
            • specifiers: [...] (1)
              • ImportDefaultSpecifier {...}
                • type: "ImportDefaultSpecifier"
                • start: 17
                • end: 25
                • loc: {...}
                  • start: {...}
                    • line: 2
                    • column: 8
                    }
                  • end: {...}
                    • line: 2
                    • column: 16
                    }
                  }
                • local: Identifier {...}
                  • type: "Identifier"
                  • start: 17
                  • end: 25
                  • loc: {...}
                    • start: {...}
                      • line: 2
                      • column: 8
                      }
                    • end: {...}
                      • line: 2
                      • column: 16
                      }
                    }
                  • name: "Identity"
                  }
                }
              ]
            • source: Literal {...}
              • type: "Literal"
              • start: 31
              • end: 52
              • loc: {...}
                • start: {...}
                  • line: 2
                  • column: 22
                  }
                • end: {...}
                  • line: 2
                  • column: 43
                  }
                }
              • value: "./t_identity.svelte"
              • raw: "\"./t_identity.svelte\""
              }
            }
          • ImportDeclaration {...}
            • type: "ImportDeclaration"
            • start: 55
            • end: 98
            • loc: {...}
              • start: {...}
                • line: 3
                • column: 1
                }
              • end: {...}
                • line: 3
                • column: 44
                }
              }
            • specifiers: [...] (1)
              • ImportDefaultSpecifier {...}
                • type: "ImportDefaultSpecifier"
                • start: 62
                • end: 70
                • loc: {...}
                  • start: {...}
                    • line: 3
                    • column: 8
                    }
                  • end: {...}
                    • line: 3
                    • column: 16
                    }
                  }
                • local: Identifier {...}
                  • type: "Identifier"
                  • start: 62
                  • end: 70
                  • loc: {...}
                    • start: {...}
                      • line: 3
                      • column: 8
                      }
                    • end: {...}
                      • line: 3
                      • column: 16
                      }
                    }
                  • name: "Password"
                  }
                }
              ]
            • source: Literal {...}
              • type: "Literal"
              • start: 76
              • end: 97
              • loc: {...}
                • start: {...}
                  • line: 3
                  • column: 22
                  }
                • end: {...}
                  • line: 3
                  • column: 43
                  }
                }
              • value: "./t_password.svelte"
              • raw: "\"./t_password.svelte\""
              }
            }
          • VariableDeclaration {...}
            • type: "VariableDeclaration"
            • start: 101
            • end: 197
            • loc: {...}
              • start: {...}
                • line: 5
                • column: 1
                }
              • end: {...}
                • line: 8
                • column: 3
                }
              }
            • declarations: [...] (1)
              • VariableDeclarator {...}
                • type: "VariableDeclarator"
                • start: 105
                • end: 196
                • loc: {...}
                  • start: {...}
                    • line: 5
                    • column: 5
                    }
                  • end: {...}
                    • line: 8
                    • column: 2
                    }
                  }
                • id: Identifier {...}
                  • type: "Identifier"
                  • start: 105
                  • end: 109
                  • loc: {...}
                    • start: {...}
                      • line: 5
                      • column: 5
                      }
                    • end: {...}
                      • line: 5
                      • column: 9
                      }
                    }
                  • name: "tabs"
                  }
                • init: ArrayExpression {...}
                  • type: "ArrayExpression"
                  • start: 112
                  • end: 196
                  • loc: {...}
                    • start: {...}
                      • line: 5
                      • column: 12
                      }
                    • end: {...}
                      • line: 8
                      • column: 2
                      }
                    }
                  • elements: [...] (2)
                    • ObjectExpression {...}
                      • type: "ObjectExpression"
                      • start: 116
                      • end: 152
                      • loc: {...}
                        • start: {...}
                          • line: 6
                          • column: 2
                          }
                        • end: {...}
                          • line: 6
                          • column: 38
                          }
                        }
                      • properties: [...] (2)
                        • Property {...}
                          • type: "Property"
                          • start: 118
                          • end: 134
                          • loc: {...}
                            • start: {...}
                              • line: 6
                              • column: 4
                              }
                            • end: {...}
                              • line: 6
                              • column: 20
                              }
                            }
                          • method: false
                          • shorthand: false
                          • computed: false
                          • key: Identifier {...}
                            • type: "Identifier"
                            • start: 118
                            • end: 122
                            • loc: {...}
                              • start: {...}
                                • line: 6
                                • column: 4
                                }
                              • end: {...}
                                • line: 6
                                • column: 8
                                }
                              }
                            • name: "name"
                            }
                          • value: Literal {...}
                            • type: "Literal"
                            • start: 124
                            • end: 134
                            • loc: {...}
                              • start: {...}
                                • line: 6
                                • column: 10
                                }
                              • end: {...}
                                • line: 6
                                • column: 20
                                }
                              }
                            • value: "Identity"
                            • raw: "\"Identity\""
                            }
                          • kind: "init"
                          }
                        • Property {...}
                          • type: "Property"
                          • start: 136
                          • end: 150
                          • loc: {...}
                            • start: {...}
                              • line: 6
                              • column: 22
                              }
                            • end: {...}
                              • line: 6
                              • column: 36
                              }
                            }
                          • method: false
                          • shorthand: false
                          • computed: false
                          • key: Identifier {...}
                            • type: "Identifier"
                            • start: 136
                            • end: 140
                            • loc: {...}
                              • start: {...}
                                • line: 6
                                • column: 22
                                }
                              • end: {...}
                                • line: 6
                                • column: 26
                                }
                              }
                            • name: "comp"
                            }
                          • value: Identifier {...}
                            • type: "Identifier"
                            • start: 142
                            • end: 150
                            • loc: {...}
                              • start: {...}
                                • line: 6
                                • column: 28
                                }
                              • end: {...}
                                • line: 6
                                • column: 36
                                }
                              }
                            • name: "Identity"
                            }
                          • kind: "init"
                          }
                        ]
                      }
                    • ObjectExpression {...}
                      • type: "ObjectExpression"
                      • start: 156
                      • end: 192
                      • loc: {...}
                        • start: {...}
                          • line: 7
                          • column: 2
                          }
                        • end: {...}
                          • line: 7
                          • column: 38
                          }
                        }
                      • properties: [...] (2)
                        • Property {...}
                          • type: "Property"
                          • start: 158
                          • end: 174
                          • loc: {...}
                            • start: {...}
                              • line: 7
                              • column: 4
                              }
                            • end: {...}
                              • line: 7
                              • column: 20
                              }
                            }
                          • method: false
                          • shorthand: false
                          • computed: false
                          • key: Identifier {...}
                            • type: "Identifier"
                            • start: 158
                            • end: 162
                            • loc: {...}
                              • start: {...}
                                • line: 7
                                • column: 4
                                }
                              • end: {...}
                                • line: 7
                                • column: 8
                                }
                              }
                            • name: "name"
                            }
                          • value: Literal {...}
                            • type: "Literal"
                            • start: 164
                            • end: 174
                            • loc: {...}
                              • start: {...}
                                • line: 7
                                • column: 10
                                }
                              • end: {...}
                                • line: 7
                                • column: 20
                                }
                              }
                            • value: "Password"
                            • raw: "\"Password\""
                            }
                          • kind: "init"
                          }
                        • Property {...}
                          • type: "Property"
                          • start: 176
                          • end: 190
                          • loc: {...}
                            • start: {...}
                              • line: 7
                              • column: 22
                              }
                            • end: {...}
                              • line: 7
                              • column: 36
                              }
                            }
                          • method: false
                          • shorthand: false
                          • computed: false
                          • key: Identifier {...}
                            • type: "Identifier"
                            • start: 176
                            • end: 180
                            • loc: {...}
                              • start: {...}
                                • line: 7
                                • column: 22
                                }
                              • end: {...}
                                • line: 7
                                • column: 26
                                }
                              }
                            • name: "comp"
                            }
                          • value: Identifier {...}
                            • type: "Identifier"
                            • start: 182
                            • end: 190
                            • loc: {...}
                              • start: {...}
                                • line: 7
                                • column: 28
                                }
                              • end: {...}
                                • line: 7
                                • column: 36
                                }
                              }
                            • name: "Password"
                            }
                          • kind: "init"
                          }
                        ]
                      }
                    ]
                  }
                }
              ]
            • kind: "let"
            }
          • VariableDeclaration {...}
            • type: "VariableDeclaration"
            • start: 200
            • end: 218
            • loc: {...}
              • start: {...}
                • line: 10
                • column: 1
                }
              • end: {...}
                • line: 10
                • column: 19
                }
              }
            • declarations: [...] (1)
              • VariableDeclarator {...}
                • type: "VariableDeclarator"
                • start: 204
                • end: 217
                • loc: {...}
                  • start: {...}
                    • line: 10
                    • column: 5
                    }
                  • end: {...}
                    • line: 10
                    • column: 18
                    }
                  }
                • id: Identifier {...}
                  • type: "Identifier"
                  • start: 204
                  • end: 207
                  • loc: {...}
                    • start: {...}
                      • line: 10
                      • column: 5
                      }
                    • end: {...}
                      • line: 10
                      • column: 8
                      }
                    }
                  • name: "cur"
                  }
                • init: MemberExpression {...}
                  • type: "MemberExpression"
                  • start: 210
                  • end: 217
                  • loc: {...}
                    • start: {...}
                      • line: 10
                      • column: 11
                      }
                    • end: {...}
                      • line: 10
                      • column: 18
                      }
                    }
                  • object: Identifier {...}
                    • type: "Identifier"
                    • start: 210
                    • end: 214
                    • loc: {...}
                      • start: {...}
                        • line: 10
                        • column: 11
                        }
                      • end: {...}
                        • line: 10
                        • column: 15
                        }
                      }
                    • name: "tabs"
                    }
                  • property: Literal {...}
                    • type: "Literal"
                    • start: 215
                    • end: 216
                    • loc: {...}
                      • start: {...}
                        • line: 10
                        • column: 16
                        }
                      • end: {...}
                        • line: 10
                        • column: 17
                        }
                      }
                    • value: 0
                    • raw: "0"
                    }
                  • computed: true
                  • optional: false
                  }
                }
              ]
            • kind: "let"
            }
          ]
        • sourceType: "module"
        }
      • attributes: []
      }
    }
The AST is not public API and may change at any point in time
Svelte Tabs Tutorial • Playground • Svelte