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
Hamburger.svelte
Logo.svelte
Main.svelte
Menu.svelte
Navbar.svelte
Sidebar.svelte
<script>
import Navbar from './Navbar.svelte'
import Sidebar from './Sidebar.svelte'
import Main from './Main.svelte'

let open = false
</script>

<Sidebar bind:open/>
<Navbar bind:sidebar={open}/>
<Main/>

<svelte:head>
<link href="https://unpkg.com/tailwindcss@^1.0/dist/tailwind.min.css" rel="stylesheet"/>
</svelte:head>

<style>
:global(body) {
padding: 0;
}
</style>
bundling https://unpkg.com/svelte@5.20.5/src/internal/shared/warnings.js
import 'svelte/internal/disclose-version';
import 'svelte/internal/flags/legacy';
import * as $ from 'svelte/internal/client';
import Navbar from './Navbar.svelte';
import Sidebar from './Sidebar.svelte';
import Main from './Main.svelte';

var root_1 = $.template(`<link href="https://unpkg.com/tailwindcss@^1.0/dist/tailwind.min.css" rel="stylesheet">`);
var root = $.template(`<!> <!> <!>`, 1);

export default function App($$anchor) {
let open = $.mutable_state(false);
var fragment = root();

$.head(($$anchor) => {
var link = root_1();

$.append($$anchor, link);
});

var node = $.first_child(fragment);

Sidebar(node, {
get open() {
return $.get(open);
},
set open($$value) {
$.set(open, $$value);
},
$$legacy: true
});

var node_1 = $.sibling(node, 2);

Navbar(node_1, {
get sidebar() {
result = svelte.compile(source, {
generate: ,
});

body {
padding: 0;
}

		
			
				
  • Root {
    • css: StyleSheet {...}
      • type: "StyleSheet"
      • start: 331
      • end: 381
      • attributes: []
      • children: [...] (1)
        • Rule {...}
          • type: "Rule"
          • prelude: SelectorList {...}
            • type: "SelectorList"
            • start: 340
            • end: 353
            • children: [...] (1)
              • ComplexSelector {...}
                • type: "ComplexSelector"
                • start: 340
                • end: 353
                • children: [...] (1)
                  • RelativeSelector {...}
                    • type: "RelativeSelector"
                    • combinator: null
                    • selectors: [...] (1)
                      • PseudoClassSelector {...}
                        • type: "PseudoClassSelector"
                        • name: "global"
                        • args: SelectorList {...}
                          • type: "SelectorList"
                          • start: 348
                          • end: 352
                          • children: [...] (1)
                            • ComplexSelector {...}
                              • type: "ComplexSelector"
                              • start: 348
                              • end: 352
                              • children: [...] (1)
                                • RelativeSelector {...}
                                  • type: "RelativeSelector"
                                  • combinator: null
                                  • selectors: [...] (1)
                                    • TypeSelector {...}
                                      • type: "TypeSelector"
                                      • name: "body"
                                      • start: 348
                                      • end: 352
                                      }
                                    ]
                                  • start: 348
                                  • end: 352
                                  }
                                ]
                              }
                            ]
                          }
                        • start: 340
                        • end: 353
                        }
                      ]
                    • start: 340
                    • end: 353
                    }
                  ]
                }
              ]
            }
          • block: Block {...}
            • type: "Block"
            • start: 354
            • end: 372
            • children: [...] (1)
              • Declaration {...}
                • type: "Declaration"
                • start: 358
                • end: 368
                • property: "padding"
                • value: "0"
                }
              ]
            }
          • start: 340
          • end: 372
          }
        ]
      • content: {...}
        • start: 338
        • end: 373
        • styles: "\n\t:global(body) {\n\t\tpadding: 0;\n\t}\n"
        • comment: null
        }
      }
    • js: []
    • start: 151
    • end: 329
    • type: "Root"
    • fragment: Fragment {...}
      • type: "Fragment"
      • nodes: [...] (9)
        • Text {...}
          • type: "Text"
          • start: 149
          • end: 151
          • raw: "\n\n"
          • data: "\n\n"
          }
        • Component {...}
          • type: "Component"
          • start: 151
          • end: 171
          • name: "Sidebar"
          • attributes: [...] (1)
            • BindDirective {...}
              • start: 160
              • end: 169
              • type: "BindDirective"
              • name: "open"
              • expression: Identifier {...}
                • start: 165
                • end: 169
                • type: "Identifier"
                • name: "open"
                }
              • modifiers: []
              }
            ]
          • fragment: Fragment {...}
            • type: "Fragment"
            • nodes: []
            }
          }
        • Text {...}
          • type: "Text"
          • start: 171
          • end: 172
          • raw: " "
          • data: " "
          }
        • Component {...}
          • type: "Component"
          • start: 172
          • end: 201
          • name: "Navbar"
          • attributes: [...] (1)
            • BindDirective {...}
              • start: 180
              • end: 199
              • type: "BindDirective"
              • name: "sidebar"
              • expression: Identifier {...}
                • type: "Identifier"
                • start: 194
                • end: 198
                • loc: {...}
                  • start: {...}
                    • line: 10
                    • column: 22
                    }
                  • end: {...}
                    • line: 10
                    • column: 26
                    }
                  }
                • name: "open"
                }
              • modifiers: []
              }
            ]
          • fragment: Fragment {...}
            • type: "Fragment"
            • nodes: []
            }
          }
        • Text {...}
          • type: "Text"
          • start: 201
          • end: 202
          • raw: " "
          • data: " "
          }
        • Component {...}
          • type: "Component"
          • start: 202
          • end: 209
          • name: "Main"
          • attributes: []
          • fragment: Fragment {...}
            • type: "Fragment"
            • nodes: []
            }
          }
        • Text {...}
          • type: "Text"
          • start: 209
          • end: 211
          • raw: "\n\n"
          • data: "\n\n"
          }
        • SvelteHead {...}
          • type: "SvelteHead"
          • start: 211
          • end: 329
          • name: "svelte:head"
          • attributes: []
          • fragment: Fragment {...}
            • type: "Fragment"
            • nodes: [...] (3)
              • Text {...}
                • type: "Text"
                • start: 224
                • end: 226
                • raw: "\n\t"
                • data: "\n\t"
                }
              • RegularElement {...}
                • type: "RegularElement"
                • start: 226
                • end: 314
                • name: "link"
                • attributes: [...] (2)
                  • Attribute {...}
                    • type: "Attribute"
                    • start: 232
                    • end: 295
                    • name: "href"
                    • value: [...] (1)
                      • Text {...}
                        • start: 238
                        • end: 294
                        • type: "Text"
                        • raw: "https://unpkg.com/tailwindcss@^1.0/dist/tailwind.min.css"
                        • data: "https://unpkg.com/tailwindcss@^1.0/dist/tailwind.min.css"
                        }
                      ]
                    }
                  • Attribute {...}
                    • type: "Attribute"
                    • start: 296
                    • end: 312
                    • name: "rel"
                    • value: [...] (1)
                      • Text {...}
                        • start: 301
                        • end: 311
                        • type: "Text"
                        • raw: "stylesheet"
                        • data: "stylesheet"
                        }
                      ]
                    }
                  ]
                • fragment: Fragment {...}
                  • type: "Fragment"
                  • nodes: []
                  }
                }
              • Text {...}
                • type: "Text"
                • start: 314
                • end: 315
                • raw: "\n"
                • data: "\n"
                }
              ]
            }
          }
        • Text {...}
          • type: "Text"
          • start: 329
          • end: 331
          • raw: "\n\n"
          • data: "\n\n"
          }
        ]
      }
    • options: null
    • instance: Script {...}
      • type: "Script"
      • start: 0
      • end: 149
      • context: "default"
      • content: Program {...}
        • type: "Program"
        • start: 8
        • end: 140
        • loc: {...}
          • start: {...}
            • line: 1
            • column: 0
            }
          • end: {...}
            • line: 7
            • column: 0
            }
          }
        • body: [...] (4)
          • ImportDeclaration {...}
            • type: "ImportDeclaration"
            • start: 10
            • end: 46
            • loc: {...}
              • start: {...}
                • line: 2
                • column: 1
                }
              • end: {...}
                • line: 2
                • column: 37
                }
              }
            • specifiers: [...] (1)
              • ImportDefaultSpecifier {...}
                • type: "ImportDefaultSpecifier"
                • start: 17
                • end: 23
                • loc: {...}
                  • start: {...}
                    • line: 2
                    • column: 8
                    }
                  • end: {...}
                    • line: 2
                    • column: 14
                    }
                  }
                • local: Identifier {...}
                  • type: "Identifier"
                  • start: 17
                  • end: 23
                  • loc: {...}
                    • start: {...}
                      • line: 2
                      • column: 8
                      }
                    • end: {...}
                      • line: 2
                      • column: 14
                      }
                    }
                  • name: "Navbar"
                  }
                }
              ]
            • source: Literal {...}
              • type: "Literal"
              • start: 29
              • end: 46
              • loc: {...}
                • start: {...}
                  • line: 2
                  • column: 20
                  }
                • end: {...}
                  • line: 2
                  • column: 37
                  }
                }
              • value: "./Navbar.svelte"
              • raw: "'./Navbar.svelte'"
              }
            }
          • ImportDeclaration {...}
            • type: "ImportDeclaration"
            • start: 48
            • end: 86
            • loc: {...}
              • start: {...}
                • line: 3
                • column: 1
                }
              • end: {...}
                • line: 3
                • column: 39
                }
              }
            • specifiers: [...] (1)
              • ImportDefaultSpecifier {...}
                • type: "ImportDefaultSpecifier"
                • start: 55
                • end: 62
                • loc: {...}
                  • start: {...}
                    • line: 3
                    • column: 8
                    }
                  • end: {...}
                    • line: 3
                    • column: 15
                    }
                  }
                • local: Identifier {...}
                  • type: "Identifier"
                  • start: 55
                  • end: 62
                  • loc: {...}
                    • start: {...}
                      • line: 3
                      • column: 8
                      }
                    • end: {...}
                      • line: 3
                      • column: 15
                      }
                    }
                  • name: "Sidebar"
                  }
                }
              ]
            • source: Literal {...}
              • type: "Literal"
              • start: 68
              • end: 86
              • loc: {...}
                • start: {...}
                  • line: 3
                  • column: 21
                  }
                • end: {...}
                  • line: 3
                  • column: 39
                  }
                }
              • value: "./Sidebar.svelte"
              • raw: "'./Sidebar.svelte'"
              }
            }
          • ImportDeclaration {...}
            • type: "ImportDeclaration"
            • start: 88
            • end: 120
            • loc: {...}
              • start: {...}
                • line: 4
                • column: 1
                }
              • end: {...}
                • line: 4
                • column: 33
                }
              }
            • specifiers: [...] (1)
              • ImportDefaultSpecifier {...}
                • type: "ImportDefaultSpecifier"
                • start: 95
                • end: 99
                • loc: {...}
                  • start: {...}
                    • line: 4
                    • column: 8
                    }
                  • end: {...}
                    • line: 4
                    • column: 12
                    }
                  }
                • local: Identifier {...}
                  • type: "Identifier"
                  • start: 95
                  • end: 99
                  • loc: {...}
                    • start: {...}
                      • line: 4
                      • column: 8
                      }
                    • end: {...}
                      • line: 4
                      • column: 12
                      }
                    }
                  • name: "Main"
                  }
                }
              ]
            • source: Literal {...}
              • type: "Literal"
              • start: 105
              • end: 120
              • loc: {...}
                • start: {...}
                  • line: 4
                  • column: 18
                  }
                • end: {...}
                  • line: 4
                  • column: 33
                  }
                }
              • value: "./Main.svelte"
              • raw: "'./Main.svelte'"
              }
            }
          • VariableDeclaration {...}
            • type: "VariableDeclaration"
            • start: 123
            • end: 139
            • loc: {...}
              • start: {...}
                • line: 6
                • column: 1
                }
              • end: {...}
                • line: 6
                • column: 17
                }
              }
            • declarations: [...] (1)
              • VariableDeclarator {...}
                • type: "VariableDeclarator"
                • start: 127
                • end: 139
                • loc: {...}
                  • start: {...}
                    • line: 6
                    • column: 5
                    }
                  • end: {...}
                    • line: 6
                    • column: 17
                    }
                  }
                • id: Identifier {...}
                  • type: "Identifier"
                  • start: 127
                  • end: 131
                  • loc: {...}
                    • start: {...}
                      • line: 6
                      • column: 5
                      }
                    • end: {...}
                      • line: 6
                      • column: 9
                      }
                    }
                  • name: "open"
                  }
                • init: Literal {...}
                  • type: "Literal"
                  • start: 134
                  • end: 139
                  • loc: {...}
                    • start: {...}
                      • line: 6
                      • column: 12
                      }
                    • end: {...}
                      • line: 6
                      • column: 17
                      }
                    }
                  • value: false
                  • raw: "false"
                  }
                }
              ]
            • kind: "let"
            }
          ]
        • sourceType: "module"
        }
      • attributes: []
      }
    }
The AST is not public API and may change at any point in time
Sidebar • Playground • Svelte