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
Chart.svelte
<script>
import Chart from './Chart.svelte';
</script>

<div class="grid">
<div style="width: 33.3%; height: 33.3%"><Chart/></div>
<div style="width: 66.6%; height: 33.3%"><Chart/></div>
<div style="width: 33.3%; height: 66.6%"><Chart/></div>
<div style="width: 66.6%; height: 66.6%"><Chart/></div>
</div>

<style>
:global(body) {
padding: 0;
}
.grid {
width: 100vw;
height: 100vh;
grid-template-columns: repeat(3, 1fr);
grid-template-rows: repeat(3, 1fr);
}
.grid div {
position: relative;
float: left;
padding: 4em;
box-sizing: border-box;
}
</style>
bundling https://unpkg.com/svelte@5.20.5/src/internal/client/index.js
import 'svelte/internal/disclose-version';
import 'svelte/internal/flags/legacy';
import * as $ from 'svelte/internal/client';
import Chart from './Chart.svelte';

var root = $.template(`<div class="grid svelte-1td7vs7"><div style="width: 33.3%; height: 33.3%" class="svelte-1td7vs7"><!></div> <div style="width: 66.6%; height: 33.3%" class="svelte-1td7vs7"><!></div> <div style="width: 33.3%; height: 66.6%" class="svelte-1td7vs7"><!></div> <div style="width: 66.6%; height: 66.6%" class="svelte-1td7vs7"><!></div></div>`);

export default function App($$anchor) {
var div = root();
var div_1 = $.child(div);
var node = $.child(div_1);

Chart(node, {});
$.reset(div_1);

var div_2 = $.sibling(div_1, 2);
var node_1 = $.child(div_2);

Chart(node_1, {});
$.reset(div_2);

var div_3 = $.sibling(div_2, 2);
var node_2 = $.child(div_3);

Chart(node_2, {});
$.reset(div_3);

var div_4 = $.sibling(div_3, 2);
var node_3 = $.child(div_4);

Chart(node_3, {});
$.reset(div_4);
$.reset(div);
$.append($$anchor, div);
}
result = svelte.compile(source, {
generate: ,
});

body {
padding: 0;
}
.grid.svelte-1td7vs7 {
width: 100vw;
height: 100vh;
grid-template-columns: repeat(3, 1fr);
grid-template-rows: repeat(3, 1fr);
}
.grid.svelte-1td7vs7 div:where(.svelte-1td7vs7) {
position: relative;
float: left;
padding: 4em;
box-sizing: border-box;
}

		
			
				
  • Root {
    • css: StyleSheet {...}
      • type: "StyleSheet"
      • start: 312
      • end: 585
      • attributes: []
      • children: [...] (3)
        • Rule {...}
          • type: "Rule"
          • prelude: SelectorList {...}
            • type: "SelectorList"
            • start: 321
            • end: 334
            • children: [...] (1)
              • ComplexSelector {...}
                • type: "ComplexSelector"
                • start: 321
                • end: 334
                • children: [...] (1)
                  • RelativeSelector {...}
                    • type: "RelativeSelector"
                    • combinator: null
                    • selectors: [...] (1)
                      • PseudoClassSelector {...}
                        • type: "PseudoClassSelector"
                        • name: "global"
                        • args: SelectorList {...}
                          • type: "SelectorList"
                          • start: 329
                          • end: 333
                          • children: [...] (1)
                            • ComplexSelector {...}
                              • type: "ComplexSelector"
                              • start: 329
                              • end: 333
                              • children: [...] (1)
                                • RelativeSelector {...}
                                  • type: "RelativeSelector"
                                  • combinator: null
                                  • selectors: [...] (1)
                                    • TypeSelector {...}
                                      • type: "TypeSelector"
                                      • name: "body"
                                      • start: 329
                                      • end: 333
                                      }
                                    ]
                                  • start: 329
                                  • end: 333
                                  }
                                ]
                              }
                            ]
                          }
                        • start: 321
                        • end: 334
                        }
                      ]
                    • start: 321
                    • end: 334
                    }
                  ]
                }
              ]
            }
          • block: Block {...}
            • type: "Block"
            • start: 335
            • end: 353
            • children: [...] (1)
              • Declaration {...}
                • type: "Declaration"
                • start: 339
                • end: 349
                • property: "padding"
                • value: "0"
                }
              ]
            }
          • start: 321
          • end: 353
          }
        • Rule {...}
          • type: "Rule"
          • prelude: SelectorList {...}
            • type: "SelectorList"
            • start: 357
            • end: 362
            • children: [...] (1)
              • ComplexSelector {...}
                • type: "ComplexSelector"
                • start: 357
                • end: 362
                • children: [...] (1)
                  • RelativeSelector {...}
                    • type: "RelativeSelector"
                    • combinator: null
                    • selectors: [...] (1)
                      • ClassSelector {...}
                        • type: "ClassSelector"
                        • name: "grid"
                        • start: 357
                        • end: 362
                        }
                      ]
                    • start: 357
                    • end: 362
                    }
                  ]
                }
              ]
            }
          • block: Block {...}
            • type: "Block"
            • start: 363
            • end: 479
            • children: [...] (4)
              • Declaration {...}
                • type: "Declaration"
                • start: 367
                • end: 379
                • property: "width"
                • value: "100vw"
                }
              • Declaration {...}
                • type: "Declaration"
                • start: 383
                • end: 396
                • property: "height"
                • value: "100vh"
                }
              • Declaration {...}
                • type: "Declaration"
                • start: 400
                • end: 437
                • property: "grid-template-columns"
                • value: "repeat(3, 1fr)"
                }
              • Declaration {...}
                • type: "Declaration"
                • start: 441
                • end: 475
                • property: "grid-template-rows"
                • value: "repeat(3, 1fr)"
                }
              ]
            }
          • start: 357
          • end: 479
          }
        • Rule {...}
          • type: "Rule"
          • prelude: SelectorList {...}
            • type: "SelectorList"
            • start: 483
            • end: 492
            • children: [...] (1)
              • ComplexSelector {...}
                • type: "ComplexSelector"
                • start: 483
                • end: 492
                • children: [...] (2)
                  • RelativeSelector {...}
                    • type: "RelativeSelector"
                    • combinator: null
                    • selectors: [...] (1)
                      • ClassSelector {...}
                        • type: "ClassSelector"
                        • name: "grid"
                        • start: 483
                        • end: 488
                        }
                      ]
                    • start: 483
                    • end: 488
                    }
                  • RelativeSelector {...}
                    • type: "RelativeSelector"
                    • combinator: Combinator {...}
                      • type: "Combinator"
                      • name: " "
                      • start: 488
                      • end: 489
                      }
                    • selectors: [...] (1)
                      • TypeSelector {...}
                        • type: "TypeSelector"
                        • name: "div"
                        • start: 489
                        • end: 492
                        }
                      ]
                    • start: 488
                    • end: 492
                    }
                  ]
                }
              ]
            }
          • block: Block {...}
            • type: "Block"
            • start: 493
            • end: 576
            • children: [...] (4)
              • Declaration {...}
                • type: "Declaration"
                • start: 497
                • end: 515
                • property: "position"
                • value: "relative"
                }
              • Declaration {...}
                • type: "Declaration"
                • start: 519
                • end: 530
                • property: "float"
                • value: "left"
                }
              • Declaration {...}
                • type: "Declaration"
                • start: 534
                • end: 546
                • property: "padding"
                • value: "4em"
                }
              • Declaration {...}
                • type: "Declaration"
                • start: 550
                • end: 572
                • property: "box-sizing"
                • value: "border-box"
                }
              ]
            }
          • start: 483
          • end: 576
          }
        ]
      • content: {...}
        • start: 319
        • end: 577
        • styles: "\n\t:global(body) {\n\t\tpadding: 0;\n\t}\n\t\n\t.grid {\n\t\twidth: 100vw;\n\t\theight: 100vh;\n\t\tgrid-template-columns: repeat(3, 1fr);\n\t\tgrid-template-rows: repeat(3, 1fr);\n\t}\n\t\n\t.grid div {\n\t\tposition: relative;\n\t\tfloat: left;\n\t\tpadding: 4em;\n\t\tbox-sizing: border-box;\n\t}\n"
        • comment: null
        }
      }
    • js: []
    • start: 57
    • end: 310
    • type: "Root"
    • fragment: Fragment {...}
      • type: "Fragment"
      • nodes: [...] (3)
        • Text {...}
          • type: "Text"
          • start: 55
          • end: 57
          • raw: "\n\n"
          • data: "\n\n"
          }
        • RegularElement {...}
          • type: "RegularElement"
          • start: 57
          • end: 310
          • name: "div"
          • attributes: [...] (1)
            • Attribute {...}
              • type: "Attribute"
              • start: 62
              • end: 74
              • name: "class"
              • value: [...] (1)
                • Text {...}
                  • start: 69
                  • end: 73
                  • type: "Text"
                  • raw: "grid"
                  • data: "grid"
                  }
                ]
              }
            ]
          • fragment: Fragment {...}
            • type: "Fragment"
            • nodes: [...] (9)
              • Text {...}
                • type: "Text"
                • start: 75
                • end: 77
                • raw: "\n\t"
                • data: "\n\t"
                }
              • RegularElement {...}
                • type: "RegularElement"
                • start: 77
                • end: 132
                • name: "div"
                • attributes: [...] (2)
                  • Attribute {...}
                    • type: "Attribute"
                    • start: 82
                    • end: 117
                    • name: "style"
                    • value: [...] (1)
                      • Text {...}
                        • start: 89
                        • end: 116
                        • type: "Text"
                        • raw: "width: 33.3%; height: 33.3%"
                        • data: "width: 33.3%; height: 33.3%"
                        }
                      ]
                    }
                  • 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: [...] (1)
                    • Component {...}
                      • type: "Component"
                      • start: 118
                      • end: 126
                      • name: "Chart"
                      • attributes: []
                      • fragment: Fragment {...}
                        • type: "Fragment"
                        • nodes: []
                        }
                      }
                    ]
                  }
                }
              • Text {...}
                • type: "Text"
                • start: 132
                • end: 134
                • raw: " "
                • data: " "
                }
              • RegularElement {...}
                • type: "RegularElement"
                • start: 134
                • end: 189
                • name: "div"
                • attributes: [...] (2)
                  • Attribute {...}
                    • type: "Attribute"
                    • start: 139
                    • end: 174
                    • name: "style"
                    • value: [...] (1)
                      • Text {...}
                        • start: 146
                        • end: 173
                        • type: "Text"
                        • raw: "width: 66.6%; height: 33.3%"
                        • data: "width: 66.6%; height: 33.3%"
                        }
                      ]
                    }
                  • 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: [...] (1)
                    • Component {...}
                      • type: "Component"
                      • start: 175
                      • end: 183
                      • name: "Chart"
                      • attributes: []
                      • fragment: Fragment {...}
                        • type: "Fragment"
                        • nodes: []
                        }
                      }
                    ]
                  }
                }
              • Text {...}
                • type: "Text"
                • start: 189
                • end: 191
                • raw: " "
                • data: " "
                }
              • RegularElement {...}
                • type: "RegularElement"
                • start: 191
                • end: 246
                • name: "div"
                • attributes: [...] (2)
                  • Attribute {...}
                    • type: "Attribute"
                    • start: 196
                    • end: 231
                    • name: "style"
                    • value: [...] (1)
                      • Text {...}
                        • start: 203
                        • end: 230
                        • type: "Text"
                        • raw: "width: 33.3%; height: 66.6%"
                        • data: "width: 33.3%; height: 66.6%"
                        }
                      ]
                    }
                  • 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: [...] (1)
                    • Component {...}
                      • type: "Component"
                      • start: 232
                      • end: 240
                      • name: "Chart"
                      • attributes: []
                      • fragment: Fragment {...}
                        • type: "Fragment"
                        • nodes: []
                        }
                      }
                    ]
                  }
                }
              • Text {...}
                • type: "Text"
                • start: 246
                • end: 248
                • raw: " "
                • data: " "
                }
              • RegularElement {...}
                • type: "RegularElement"
                • start: 248
                • end: 303
                • name: "div"
                • attributes: [...] (2)
                  • Attribute {...}
                    • type: "Attribute"
                    • start: 253
                    • end: 288
                    • name: "style"
                    • value: [...] (1)
                      • Text {...}
                        • start: 260
                        • end: 287
                        • type: "Text"
                        • raw: "width: 66.6%; height: 66.6%"
                        • data: "width: 66.6%; height: 66.6%"
                        }
                      ]
                    }
                  • 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: [...] (1)
                    • Component {...}
                      • type: "Component"
                      • start: 289
                      • end: 297
                      • name: "Chart"
                      • attributes: []
                      • fragment: Fragment {...}
                        • type: "Fragment"
                        • nodes: []
                        }
                      }
                    ]
                  }
                }
              • Text {...}
                • type: "Text"
                • start: 303
                • end: 304
                • raw: "\n"
                • data: "\n"
                }
              ]
            }
          }
        • Text {...}
          • type: "Text"
          • start: 310
          • end: 312
          • raw: "\n\n"
          • data: "\n\n"
          }
        ]
      }
    • options: null
    • instance: Script {...}
      • type: "Script"
      • start: 0
      • end: 55
      • context: "default"
      • content: Program {...}
        • type: "Program"
        • start: 8
        • end: 46
        • loc: {...}
          • start: {...}
            • line: 1
            • column: 0
            }
          • end: {...}
            • line: 3
            • column: 0
            }
          }
        • body: [...] (1)
          • ImportDeclaration {...}
            • type: "ImportDeclaration"
            • start: 10
            • end: 45
            • loc: {...}
              • start: {...}
                • line: 2
                • column: 1
                }
              • end: {...}
                • line: 2
                • column: 36
                }
              }
            • specifiers: [...] (1)
              • ImportDefaultSpecifier {...}
                • type: "ImportDefaultSpecifier"
                • start: 17
                • end: 22
                • loc: {...}
                  • start: {...}
                    • line: 2
                    • column: 8
                    }
                  • end: {...}
                    • line: 2
                    • column: 13
                    }
                  }
                • local: Identifier {...}
                  • type: "Identifier"
                  • start: 17
                  • end: 22
                  • loc: {...}
                    • start: {...}
                      • line: 2
                      • column: 8
                      }
                    • end: {...}
                      • line: 2
                      • column: 13
                      }
                    }
                  • name: "Chart"
                  }
                }
              ]
            • source: Literal {...}
              • type: "Literal"
              • start: 28
              • end: 44
              • loc: {...}
                • start: {...}
                  • line: 2
                  • column: 19
                  }
                • end: {...}
                  • line: 2
                  • column: 35
                  }
                }
              • value: "./Chart.svelte"
              • raw: "'./Chart.svelte'"
              }
            }
          ]
        • sourceType: "module"
        }
      • attributes: []
      }
    }
The AST is not public API and may change at any point in time
Non-borked fluid line charts • Playground • Svelte