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
Timer.svelte
<script>
import Timer from './Timer.svelte';
import { confetti } from '@neoconfetti/svelte'
import { tick } from 'svelte';
let countFrom = 0;
let done = false;
let countFromInput;

const confettiOpts = {
particleCount: 300,
force: 1,
particleSize: 5
};

async function timesUp() {
await tick();
done = true;
}

async function reset() {
done = false;
countFrom = 0;
await tick();
countFromInput?.focus();
}
</script>

<h1>Timer</h1>

<p><label>Timer's initial count, in seconds:&nbsp;<input type="number" min="0" bind:value={countFrom} bind:this={countFromInput} /></label></p>

Wait for <span class="timer-container"><Timer class="app-timer" {countFrom} on:timesup={timesUp} />
{#if done}
<span class="confetti" use:confetti={confettiOpts} />
{/if}
bundling https://unpkg.com/@neoconfetti/svelte@2.2.1/dist/index.js
import 'svelte/internal/disclose-version';
import 'svelte/internal/flags/legacy';
import * as $ from 'svelte/internal/client';
import Timer from './Timer.svelte';
import { confetti } from '@neoconfetti/svelte';
import { tick } from 'svelte';

var root_1 = $.template(`<span class="confetti svelte-13v592q"></span>`);
var root_2 = $.template(`<button class="svelte-13v592q">Reset</button>`);
var root = $.template(`<h1>Timer</h1> <p><label>Timer's initial count, in seconds:&nbsp;<input type="number" min="0"></label></p> Wait for <span class="timer-container svelte-13v592q"><!> <!></span> for a surprise. <p>The quick brown fox jumps over the lazy dog.´</p> <!>`, 1);

export default function App($$anchor, $$props) {
$.push($$props, false);

let countFrom = $.mutable_state(0);
let done = $.mutable_state(false);
let countFromInput = $.mutable_state();

const confettiOpts = {
particleCount: 300,
force: 1,
particleSize: 5
};

async function timesUp() {
await tick();
$.set(done, true);
}

async function reset() {
$.set(done, false);
$.set(countFrom, 0);
await tick();
$.get(countFromInput)?.focus();
}

result = svelte.compile(source, {
generate: ,
});

span.timer-container.svelte-13v592q {
position: relative;
}
.app-timer {
font-family: monospace;
font-weight: bold;
padding: 0 0.3em;
border-radius: 0.3em;
font-size: larger;
background-color: lightblue;
}
body.dark .app-timer {
background-color: lightcyan;
color: black;
}
span.confetti.svelte-13v592q {
position: absolute;
left: 50%;
}
button.svelte-13v592q {
background-color: darkgray;
color: white;
}
body.dark button.svelte-13v592q {
background-color: lightgray;
color: black;
}

		
			
				
  • Root {
    • css: StyleSheet {...}
      • type: "StyleSheet"
      • start: 918
      • end: 1437
      • attributes: []
      • children: [...] (6)
        • Rule {...}
          • type: "Rule"
          • prelude: SelectorList {...}
            • type: "SelectorList"
            • start: 927
            • end: 947
            • children: [...] (1)
              • ComplexSelector {...}
                • type: "ComplexSelector"
                • start: 927
                • end: 947
                • children: [...] (1)
                  • RelativeSelector {...}
                    • type: "RelativeSelector"
                    • combinator: null
                    • selectors: [...] (2)
                      • TypeSelector {...}
                        • type: "TypeSelector"
                        • name: "span"
                        • start: 927
                        • end: 931
                        }
                      • ClassSelector {...}
                        • type: "ClassSelector"
                        • name: "timer-container"
                        • start: 931
                        • end: 947
                        }
                      ]
                    • start: 927
                    • end: 947
                    }
                  ]
                }
              ]
            }
          • block: Block {...}
            • type: "Block"
            • start: 948
            • end: 974
            • children: [...] (1)
              • Declaration {...}
                • type: "Declaration"
                • start: 952
                • end: 970
                • property: "position"
                • value: "relative"
                }
              ]
            }
          • start: 927
          • end: 974
          }
        • Rule {...}
          • type: "Rule"
          • prelude: SelectorList {...}
            • type: "SelectorList"
            • start: 976
            • end: 995
            • children: [...] (1)
              • ComplexSelector {...}
                • type: "ComplexSelector"
                • start: 976
                • end: 995
                • children: [...] (1)
                  • RelativeSelector {...}
                    • type: "RelativeSelector"
                    • combinator: null
                    • selectors: [...] (1)
                      • PseudoClassSelector {...}
                        • type: "PseudoClassSelector"
                        • name: "global"
                        • args: SelectorList {...}
                          • type: "SelectorList"
                          • start: 984
                          • end: 994
                          • children: [...] (1)
                            • ComplexSelector {...}
                              • type: "ComplexSelector"
                              • start: 984
                              • end: 994
                              • children: [...] (1)
                                • RelativeSelector {...}
                                  • type: "RelativeSelector"
                                  • combinator: null
                                  • selectors: [...] (1)
                                    • ClassSelector {...}
                                      • type: "ClassSelector"
                                      • name: "app-timer"
                                      • start: 984
                                      • end: 994
                                      }
                                    ]
                                  • start: 984
                                  • end: 994
                                  }
                                ]
                              }
                            ]
                          }
                        • start: 976
                        • end: 995
                        }
                      ]
                    • start: 976
                    • end: 995
                    }
                  ]
                }
              ]
            }
          • block: Block {...}
            • type: "Block"
            • start: 996
            • end: 1143
            • children: [...] (6)
              • Declaration {...}
                • type: "Declaration"
                • start: 1000
                • end: 1022
                • property: "font-family"
                • value: "monospace"
                }
              • Declaration {...}
                • type: "Declaration"
                • start: 1026
                • end: 1043
                • property: "font-weight"
                • value: "bold"
                }
              • Declaration {...}
                • type: "Declaration"
                • start: 1047
                • end: 1063
                • property: "padding"
                • value: "0 0.3em"
                }
              • Declaration {...}
                • type: "Declaration"
                • start: 1067
                • end: 1087
                • property: "border-radius"
                • value: "0.3em"
                }
              • Declaration {...}
                • type: "Declaration"
                • start: 1091
                • end: 1108
                • property: "font-size"
                • value: "larger"
                }
              • Declaration {...}
                • type: "Declaration"
                • start: 1112
                • end: 1139
                • property: "background-color"
                • value: "lightblue"
                }
              ]
            }
          • start: 976
          • end: 1143
          }
        • Rule {...}
          • type: "Rule"
          • prelude: SelectorList {...}
            • type: "SelectorList"
            • start: 1145
            • end: 1183
            • children: [...] (1)
              • ComplexSelector {...}
                • type: "ComplexSelector"
                • start: 1145
                • end: 1183
                • children: [...] (2)
                  • RelativeSelector {...}
                    • type: "RelativeSelector"
                    • combinator: null
                    • selectors: [...] (1)
                      • PseudoClassSelector {...}
                        • type: "PseudoClassSelector"
                        • name: "global"
                        • args: SelectorList {...}
                          • type: "SelectorList"
                          • start: 1153
                          • end: 1162
                          • children: [...] (1)
                            • ComplexSelector {...}
                              • type: "ComplexSelector"
                              • start: 1153
                              • end: 1162
                              • children: [...] (1)
                                • RelativeSelector {...}
                                  • type: "RelativeSelector"
                                  • combinator: null
                                  • selectors: [...] (2)
                                    • TypeSelector {...}
                                      • type: "TypeSelector"
                                      • name: "body"
                                      • start: 1153
                                      • end: 1157
                                      }
                                    • ClassSelector {...}
                                      • type: "ClassSelector"
                                      • name: "dark"
                                      • start: 1157
                                      • end: 1162
                                      }
                                    ]
                                  • start: 1153
                                  • end: 1162
                                  }
                                ]
                              }
                            ]
                          }
                        • start: 1145
                        • end: 1163
                        }
                      ]
                    • start: 1145
                    • end: 1163
                    }
                  • RelativeSelector {...}
                    • type: "RelativeSelector"
                    • combinator: Combinator {...}
                      • type: "Combinator"
                      • name: " "
                      • start: 1163
                      • end: 1164
                      }
                    • selectors: [...] (1)
                      • PseudoClassSelector {...}
                        • type: "PseudoClassSelector"
                        • name: "global"
                        • args: SelectorList {...}
                          • type: "SelectorList"
                          • start: 1172
                          • end: 1182
                          • children: [...] (1)
                            • ComplexSelector {...}
                              • type: "ComplexSelector"
                              • start: 1172
                              • end: 1182
                              • children: [...] (1)
                                • RelativeSelector {...}
                                  • type: "RelativeSelector"
                                  • combinator: null
                                  • selectors: [...] (1)
                                    • ClassSelector {...}
                                      • type: "ClassSelector"
                                      • name: "app-timer"
                                      • start: 1172
                                      • end: 1182
                                      }
                                    ]
                                  • start: 1172
                                  • end: 1182
                                  }
                                ]
                              }
                            ]
                          }
                        • start: 1164
                        • end: 1183
                        }
                      ]
                    • start: 1163
                    • end: 1183
                    }
                  ]
                }
              ]
            }
          • block: Block {...}
            • type: "Block"
            • start: 1184
            • end: 1235
            • children: [...] (2)
              • Declaration {...}
                • type: "Declaration"
                • start: 1188
                • end: 1215
                • property: "background-color"
                • value: "lightcyan"
                }
              • Declaration {...}
                • type: "Declaration"
                • start: 1219
                • end: 1231
                • property: "color"
                • value: "black"
                }
              ]
            }
          • start: 1145
          • end: 1235
          }
        • Rule {...}
          • type: "Rule"
          • prelude: SelectorList {...}
            • type: "SelectorList"
            • start: 1237
            • end: 1250
            • children: [...] (1)
              • ComplexSelector {...}
                • type: "ComplexSelector"
                • start: 1237
                • end: 1250
                • children: [...] (1)
                  • RelativeSelector {...}
                    • type: "RelativeSelector"
                    • combinator: null
                    • selectors: [...] (2)
                      • TypeSelector {...}
                        • type: "TypeSelector"
                        • name: "span"
                        • start: 1237
                        • end: 1241
                        }
                      • ClassSelector {...}
                        • type: "ClassSelector"
                        • name: "confetti"
                        • start: 1241
                        • end: 1250
                        }
                      ]
                    • start: 1237
                    • end: 1250
                    }
                  ]
                }
              ]
            }
          • block: Block {...}
            • type: "Block"
            • start: 1251
            • end: 1290
            • children: [...] (2)
              • Declaration {...}
                • type: "Declaration"
                • start: 1255
                • end: 1273
                • property: "position"
                • value: "absolute"
                }
              • Declaration {...}
                • type: "Declaration"
                • start: 1277
                • end: 1286
                • property: "left"
                • value: "50%"
                }
              ]
            }
          • start: 1237
          • end: 1290
          }
        • Rule {...}
          • type: "Rule"
          • prelude: SelectorList {...}
            • type: "SelectorList"
            • start: 1292
            • end: 1298
            • children: [...] (1)
              • ComplexSelector {...}
                • type: "ComplexSelector"
                • start: 1292
                • end: 1298
                • children: [...] (1)
                  • RelativeSelector {...}
                    • type: "RelativeSelector"
                    • combinator: null
                    • selectors: [...] (1)
                      • TypeSelector {...}
                        • type: "TypeSelector"
                        • name: "button"
                        • start: 1292
                        • end: 1298
                        }
                      ]
                    • start: 1292
                    • end: 1298
                    }
                  ]
                }
              ]
            }
          • block: Block {...}
            • type: "Block"
            • start: 1299
            • end: 1349
            • children: [...] (2)
              • Declaration {...}
                • type: "Declaration"
                • start: 1303
                • end: 1329
                • property: "background-color"
                • value: "darkgray"
                }
              • Declaration {...}
                • type: "Declaration"
                • start: 1333
                • end: 1345
                • property: "color"
                • value: "white"
                }
              ]
            }
          • start: 1292
          • end: 1349
          }
        • Rule {...}
          • type: "Rule"
          • prelude: SelectorList {...}
            • type: "SelectorList"
            • start: 1351
            • end: 1376
            • children: [...] (1)
              • ComplexSelector {...}
                • type: "ComplexSelector"
                • start: 1351
                • end: 1376
                • children: [...] (2)
                  • RelativeSelector {...}
                    • type: "RelativeSelector"
                    • combinator: null
                    • selectors: [...] (1)
                      • PseudoClassSelector {...}
                        • type: "PseudoClassSelector"
                        • name: "global"
                        • args: SelectorList {...}
                          • type: "SelectorList"
                          • start: 1359
                          • end: 1368
                          • children: [...] (1)
                            • ComplexSelector {...}
                              • type: "ComplexSelector"
                              • start: 1359
                              • end: 1368
                              • children: [...] (1)
                                • RelativeSelector {...}
                                  • type: "RelativeSelector"
                                  • combinator: null
                                  • selectors: [...] (2)
                                    • TypeSelector {...}
                                      • type: "TypeSelector"
                                      • name: "body"
                                      • start: 1359
                                      • end: 1363
                                      }
                                    • ClassSelector {...}
                                      • type: "ClassSelector"
                                      • name: "dark"
                                      • start: 1363
                                      • end: 1368
                                      }
                                    ]
                                  • start: 1359
                                  • end: 1368
                                  }
                                ]
                              }
                            ]
                          }
                        • start: 1351
                        • end: 1369
                        }
                      ]
                    • start: 1351
                    • end: 1369
                    }
                  • RelativeSelector {...}
                    • type: "RelativeSelector"
                    • combinator: Combinator {...}
                      • type: "Combinator"
                      • name: " "
                      • start: 1369
                      • end: 1370
                      }
                    • selectors: [...] (1)
                      • TypeSelector {...}
                        • type: "TypeSelector"
                        • name: "button"
                        • start: 1370
                        • end: 1376
                        }
                      ]
                    • start: 1369
                    • end: 1376
                    }
                  ]
                }
              ]
            }
          • block: Block {...}
            • type: "Block"
            • start: 1377
            • end: 1428
            • children: [...] (2)
              • Declaration {...}
                • type: "Declaration"
                • start: 1381
                • end: 1408
                • property: "background-color"
                • value: "lightgray"
                }
              • Declaration {...}
                • type: "Declaration"
                • start: 1412
                • end: 1424
                • property: "color"
                • value: "black"
                }
              ]
            }
          • start: 1351
          • end: 1428
          }
        ]
      • content: {...}
        • start: 925
        • end: 1429
        • styles: "\n\tspan.timer-container {\n\t\tposition: relative;\n\t}\n\t:global(.app-timer) {\n\t\tfont-family: monospace;\n\t\tfont-weight: bold;\n\t\tpadding: 0 0.3em;\n\t\tborder-radius: 0.3em;\n\t\tfont-size: larger;\n\t\tbackground-color: lightblue;\n\t}\n\t:global(body.dark) :global(.app-timer) {\n\t\tbackground-color: lightcyan;\n\t\tcolor: black;\n\t}\n\tspan.confetti {\n\t\tposition: absolute;\n\t\tleft: 50%;\n\t}\n\tbutton {\n\t\tbackground-color: darkgray;\n\t\tcolor: white;\n\t}\n\t:global(body.dark) button {\n\t\tbackground-color: lightgray;\n\t\tcolor: black;\n\t}\n"
        • comment: null
        }
      }
    • js: []
    • start: 449
    • end: 916
    • type: "Root"
    • fragment: Fragment {...}
      • type: "Fragment"
      • nodes: [...] (11)
        • Text {...}
          • type: "Text"
          • start: 447
          • end: 449
          • raw: "\n\n"
          • data: "\n\n"
          }
        • RegularElement {...}
          • type: "RegularElement"
          • start: 449
          • end: 463
          • name: "h1"
          • attributes: []
          • fragment: Fragment {...}
            • type: "Fragment"
            • nodes: [...] (1)
              • Text {...}
                • type: "Text"
                • start: 453
                • end: 458
                • raw: "Timer"
                • data: "Timer"
                }
              ]
            }
          }
        • Text {...}
          • type: "Text"
          • start: 463
          • end: 465
          • raw: " "
          • data: " "
          }
        • RegularElement {...}
          • type: "RegularElement"
          • start: 465
          • end: 608
          • name: "p"
          • attributes: []
          • fragment: Fragment {...}
            • type: "Fragment"
            • nodes: [...] (1)
              • RegularElement {...}
                • type: "RegularElement"
                • start: 468
                • end: 604
                • name: "label"
                • attributes: []
                • fragment: Fragment {...}
                  • type: "Fragment"
                  • nodes: [...] (2)
                    • Text {...}
                      • type: "Text"
                      • start: 475
                      • end: 515
                      • raw: "Timer's initial count, in seconds:&nbsp;"
                      • data: "Timer's initial count, in seconds: "
                      }
                    • RegularElement {...}
                      • type: "RegularElement"
                      • start: 515
                      • end: 596
                      • name: "input"
                      • attributes: [...] (4)
                        • Attribute {...}
                          • type: "Attribute"
                          • start: 522
                          • end: 535
                          • name: "type"
                          • value: [...] (1)
                            • Text {...}
                              • start: 528
                              • end: 534
                              • type: "Text"
                              • raw: "number"
                              • data: "number"
                              }
                            ]
                          }
                        • Attribute {...}
                          • type: "Attribute"
                          • start: 536
                          • end: 543
                          • name: "min"
                          • value: [...] (1)
                            • Text {...}
                              • start: 541
                              • end: 542
                              • type: "Text"
                              • raw: "0"
                              • data: "0"
                              }
                            ]
                          }
                        • BindDirective {...}
                          • start: 544
                          • end: 566
                          • type: "BindDirective"
                          • name: "value"
                          • expression: Identifier {...}
                            • type: "Identifier"
                            • start: 556
                            • end: 565
                            • loc: {...}
                              • start: {...}
                                • line: 31
                                • column: 91
                                }
                              • end: {...}
                                • line: 31
                                • column: 100
                                }
                              }
                            • name: "countFrom"
                            }
                          • modifiers: []
                          }
                        • BindDirective {...}
                          • start: 567
                          • end: 593
                          • type: "BindDirective"
                          • name: "this"
                          • expression: Identifier {...}
                            • type: "Identifier"
                            • start: 578
                            • end: 592
                            • loc: {...}
                              • start: {...}
                                • line: 31
                                • column: 113
                                }
                              • end: {...}
                                • line: 31
                                • column: 127
                                }
                              }
                            • name: "countFromInput"
                            }
                          • modifiers: []
                          }
                        ]
                      • fragment: Fragment {...}
                        • type: "Fragment"
                        • nodes: []
                        }
                      }
                    ]
                  }
                }
              ]
            }
          }
        • Text {...}
          • type: "Text"
          • start: 608
          • end: 619
          • raw: " Wait for "
          • data: " Wait for "
          }
        • RegularElement {...}
          • type: "RegularElement"
          • start: 619
          • end: 789
          • name: "span"
          • attributes: [...] (1)
            • Attribute {...}
              • type: "Attribute"
              • start: 625
              • end: 648
              • name: "class"
              • value: [...] (1)
                • Text {...}
                  • start: 632
                  • end: 647
                  • type: "Text"
                  • raw: "timer-container"
                  • data: "timer-container"
                  }
                ]
              }
            ]
          • fragment: Fragment {...}
            • type: "Fragment"
            • nodes: [...] (4)
              • Component {...}
                • type: "Component"
                • start: 649
                • end: 709
                • name: "Timer"
                • attributes: [...] (3)
                  • Attribute {...}
                    • type: "Attribute"
                    • start: 656
                    • end: 673
                    • name: "class"
                    • value: [...] (1)
                      • Text {...}
                        • start: 663
                        • end: 672
                        • type: "Text"
                        • raw: "app-timer"
                        • data: "app-timer"
                        }
                      ]
                    }
                  • Attribute {...}
                    • type: "Attribute"
                    • start: 674
                    • end: 685
                    • name: "countFrom"
                    • value: ExpressionTag {...}
                      • type: "ExpressionTag"
                      • start: 675
                      • end: 684
                      • expression: Identifier {...}
                        • start: 675
                        • end: 684
                        • type: "Identifier"
                        • name: "countFrom"
                        }
                      }
                    }
                  • OnDirective {...}
                    • start: 686
                    • end: 706
                    • type: "OnDirective"
                    • name: "timesup"
                    • expression: Identifier {...}
                      • type: "Identifier"
                      • start: 698
                      • end: 705
                      • loc: {...}
                        • start: {...}
                          • line: 33
                          • column: 88
                          }
                        • end: {...}
                          • line: 33
                          • column: 95
                          }
                        }
                      • name: "timesUp"
                      }
                    • modifiers: []
                    }
                  ]
                • fragment: Fragment {...}
                  • type: "Fragment"
                  • nodes: []
                  }
                }
              • Text {...}
                • type: "Text"
                • start: 709
                • end: 710
                • raw: " "
                • data: " "
                }
              • IfBlock {...}
                • type: "IfBlock"
                • elseif: false
                • start: 710
                • end: 781
                • test: Identifier {...}
                  • type: "Identifier"
                  • start: 715
                  • end: 719
                  • loc: {...}
                    • start: {...}
                      • line: 34
                      • column: 5
                      }
                    • end: {...}
                      • line: 34
                      • column: 9
                      }
                    }
                  • name: "done"
                  }
                • consequent: Fragment {...}
                  • type: "Fragment"
                  • nodes: [...] (3)
                    • Text {...}
                      • type: "Text"
                      • start: 720
                      • end: 722
                      • raw: "\n\t"
                      • data: "\n\t"
                      }
                    • RegularElement {...}
                      • type: "RegularElement"
                      • start: 722
                      • end: 775
                      • name: "span"
                      • attributes: [...] (2)
                        • Attribute {...}
                          • type: "Attribute"
                          • start: 728
                          • end: 744
                          • name: "class"
                          • value: [...] (1)
                            • Text {...}
                              • start: 735
                              • end: 743
                              • type: "Text"
                              • raw: "confetti"
                              • data: "confetti"
                              }
                            ]
                          }
                        • UseDirective {...}
                          • start: 745
                          • end: 772
                          • type: "UseDirective"
                          • name: "confetti"
                          • expression: Identifier {...}
                            • type: "Identifier"
                            • start: 759
                            • end: 771
                            • loc: {...}
                              • start: {...}
                                • line: 35
                                • column: 38
                                }
                              • end: {...}
                                • line: 35
                                • column: 50
                                }
                              }
                            • name: "confettiOpts"
                            }
                          • modifiers: []
                          }
                        ]
                      • fragment: Fragment {...}
                        • type: "Fragment"
                        • nodes: []
                        }
                      }
                    • Text {...}
                      • type: "Text"
                      • start: 775
                      • end: 776
                      • raw: "\n"
                      • data: "\n"
                      }
                    ]
                  }
                • alternate: null
                }
              • Text {...}
                • type: "Text"
                • start: 781
                • end: 782
                • raw: "\n"
                • data: "\n"
                }
              ]
            }
          }
        • Text {...}
          • type: "Text"
          • start: 789
          • end: 806
          • raw: " for a surprise. "
          • data: " for a surprise. "
          }
        • RegularElement {...}
          • type: "RegularElement"
          • start: 806
          • end: 858
          • name: "p"
          • attributes: []
          • fragment: Fragment {...}
            • type: "Fragment"
            • nodes: [...] (1)
              • Text {...}
                • type: "Text"
                • start: 809
                • end: 854
                • raw: "The quick brown fox jumps over the lazy dog.´"
                • data: "The quick brown fox jumps over the lazy dog.´"
                }
              ]
            }
          }
        • Text {...}
          • type: "Text"
          • start: 858
          • end: 859
          • raw: " "
          • data: " "
          }
        • IfBlock {...}
          • type: "IfBlock"
          • elseif: false
          • start: 859
          • end: 916
          • test: Identifier {...}
            • type: "Identifier"
            • start: 864
            • end: 868
            • loc: {...}
              • start: {...}
                • line: 40
                • column: 5
                }
              • end: {...}
                • line: 40
                • column: 9
                }
              }
            • name: "done"
            }
          • consequent: Fragment {...}
            • type: "Fragment"
            • nodes: [...] (3)
              • Text {...}
                • type: "Text"
                • start: 869
                • end: 871
                • raw: "\n\t"
                • data: "\n\t"
                }
              • RegularElement {...}
                • type: "RegularElement"
                • start: 871
                • end: 910
                • name: "button"
                • attributes: [...] (2)
                  • OnDirective {...}
                    • start: 879
                    • end: 895
                    • type: "OnDirective"
                    • name: "click"
                    • expression: Identifier {...}
                      • type: "Identifier"
                      • start: 889
                      • end: 894
                      • loc: {...}
                        • start: {...}
                          • line: 41
                          • column: 19
                          }
                        • end: {...}
                          • line: 41
                          • column: 24
                          }
                        }
                      • name: "reset"
                      }
                    • 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: [...] (1)
                    • Text {...}
                      • type: "Text"
                      • start: 896
                      • end: 901
                      • raw: "Reset"
                      • data: "Reset"
                      }
                    ]
                  }
                }
              • Text {...}
                • type: "Text"
                • start: 910
                • end: 911
                • raw: "\n"
                • data: "\n"
                }
              ]
            }
          • alternate: null
          }
        • Text {...}
          • type: "Text"
          • start: 916
          • end: 918
          • raw: "\n\n"
          • data: "\n\n"
          }
        ]
      }
    • options: null
    • instance: Script {...}
      • type: "Script"
      • start: 0
      • end: 447
      • context: "default"
      • content: Program {...}
        • type: "Program"
        • start: 8
        • end: 438
        • loc: {...}
          • start: {...}
            • line: 1
            • column: 0
            }
          • end: {...}
            • line: 27
            • column: 0
            }
          }
        • body: [...] (9)
          • 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: "Timer"
                  }
                }
              ]
            • source: Literal {...}
              • type: "Literal"
              • start: 28
              • end: 44
              • loc: {...}
                • start: {...}
                  • line: 2
                  • column: 19
                  }
                • end: {...}
                  • line: 2
                  • column: 35
                  }
                }
              • value: "./Timer.svelte"
              • raw: "'./Timer.svelte'"
              }
            }
          • ImportDeclaration {...}
            • type: "ImportDeclaration"
            • start: 47
            • end: 93
            • loc: {...}
              • start: {...}
                • line: 3
                • column: 1
                }
              • end: {...}
                • line: 3
                • column: 47
                }
              }
            • specifiers: [...] (1)
              • ImportSpecifier {...}
                • type: "ImportSpecifier"
                • start: 56
                • end: 64
                • loc: {...}
                  • start: {...}
                    • line: 3
                    • column: 10
                    }
                  • end: {...}
                    • line: 3
                    • column: 18
                    }
                  }
                • imported: Identifier {...}
                  • type: "Identifier"
                  • start: 56
                  • end: 64
                  • loc: {...}
                    • start: {...}
                      • line: 3
                      • column: 10
                      }
                    • end: {...}
                      • line: 3
                      • column: 18
                      }
                    }
                  • name: "confetti"
                  }
                • local: Identifier {...}
                  • type: "Identifier"
                  • start: 56
                  • end: 64
                  • loc: {...}
                    • start: {...}
                      • line: 3
                      • column: 10
                      }
                    • end: {...}
                      • line: 3
                      • column: 18
                      }
                    }
                  • name: "confetti"
                  }
                }
              ]
            • source: Literal {...}
              • type: "Literal"
              • start: 72
              • end: 93
              • loc: {...}
                • start: {...}
                  • line: 3
                  • column: 26
                  }
                • end: {...}
                  • line: 3
                  • column: 47
                  }
                }
              • value: "@neoconfetti/svelte"
              • raw: "'@neoconfetti/svelte'"
              }
            }
          • ImportDeclaration {...}
            • type: "ImportDeclaration"
            • start: 95
            • end: 125
            • loc: {...}
              • start: {...}
                • line: 4
                • column: 1
                }
              • end: {...}
                • line: 4
                • column: 31
                }
              }
            • specifiers: [...] (1)
              • ImportSpecifier {...}
                • type: "ImportSpecifier"
                • start: 104
                • end: 108
                • loc: {...}
                  • start: {...}
                    • line: 4
                    • column: 10
                    }
                  • end: {...}
                    • line: 4
                    • column: 14
                    }
                  }
                • imported: Identifier {...}
                  • type: "Identifier"
                  • start: 104
                  • end: 108
                  • loc: {...}
                    • start: {...}
                      • line: 4
                      • column: 10
                      }
                    • end: {...}
                      • line: 4
                      • column: 14
                      }
                    }
                  • name: "tick"
                  }
                • local: Identifier {...}
                  • type: "Identifier"
                  • start: 104
                  • end: 108
                  • loc: {...}
                    • start: {...}
                      • line: 4
                      • column: 10
                      }
                    • end: {...}
                      • line: 4
                      • column: 14
                      }
                    }
                  • name: "tick"
                  }
                }
              ]
            • source: Literal {...}
              • type: "Literal"
              • start: 116
              • end: 124
              • loc: {...}
                • start: {...}
                  • line: 4
                  • column: 22
                  }
                • end: {...}
                  • line: 4
                  • column: 30
                  }
                }
              • value: "svelte"
              • raw: "'svelte'"
              }
            }
          • VariableDeclaration {...}
            • type: "VariableDeclaration"
            • start: 129
            • end: 147
            • loc: {...}
              • start: {...}
                • line: 6
                • column: 1
                }
              • end: {...}
                • line: 6
                • column: 19
                }
              }
            • declarations: [...] (1)
              • VariableDeclarator {...}
                • type: "VariableDeclarator"
                • start: 133
                • end: 146
                • loc: {...}
                  • start: {...}
                    • line: 6
                    • column: 5
                    }
                  • end: {...}
                    • line: 6
                    • column: 18
                    }
                  }
                • id: Identifier {...}
                  • type: "Identifier"
                  • start: 133
                  • end: 142
                  • loc: {...}
                    • start: {...}
                      • line: 6
                      • column: 5
                      }
                    • end: {...}
                      • line: 6
                      • column: 14
                      }
                    }
                  • name: "countFrom"
                  }
                • init: Literal {...}
                  • type: "Literal"
                  • start: 145
                  • end: 146
                  • loc: {...}
                    • start: {...}
                      • line: 6
                      • column: 17
                      }
                    • end: {...}
                      • line: 6
                      • column: 18
                      }
                    }
                  • value: 0
                  • raw: "0"
                  }
                }
              ]
            • kind: "let"
            }
          • VariableDeclaration {...}
            • type: "VariableDeclaration"
            • start: 149
            • end: 166
            • loc: {...}
              • start: {...}
                • line: 7
                • column: 1
                }
              • end: {...}
                • line: 7
                • column: 18
                }
              }
            • declarations: [...] (1)
              • VariableDeclarator {...}
                • type: "VariableDeclarator"
                • start: 153
                • end: 165
                • loc: {...}
                  • start: {...}
                    • line: 7
                    • column: 5
                    }
                  • end: {...}
                    • line: 7
                    • column: 17
                    }
                  }
                • id: Identifier {...}
                  • type: "Identifier"
                  • start: 153
                  • end: 157
                  • loc: {...}
                    • start: {...}
                      • line: 7
                      • column: 5
                      }
                    • end: {...}
                      • line: 7
                      • column: 9
                      }
                    }
                  • name: "done"
                  }
                • init: Literal {...}
                  • type: "Literal"
                  • start: 160
                  • end: 165
                  • loc: {...}
                    • start: {...}
                      • line: 7
                      • column: 12
                      }
                    • end: {...}
                      • line: 7
                      • column: 17
                      }
                    }
                  • value: false
                  • raw: "false"
                  }
                }
              ]
            • kind: "let"
            }
          • VariableDeclaration {...}
            • type: "VariableDeclaration"
            • start: 168
            • end: 187
            • loc: {...}
              • start: {...}
                • line: 8
                • column: 1
                }
              • end: {...}
                • line: 8
                • column: 20
                }
              }
            • declarations: [...] (1)
              • VariableDeclarator {...}
                • type: "VariableDeclarator"
                • start: 172
                • end: 186
                • loc: {...}
                  • start: {...}
                    • line: 8
                    • column: 5
                    }
                  • end: {...}
                    • line: 8
                    • column: 19
                    }
                  }
                • id: Identifier {...}
                  • type: "Identifier"
                  • start: 172
                  • end: 186
                  • loc: {...}
                    • start: {...}
                      • line: 8
                      • column: 5
                      }
                    • end: {...}
                      • line: 8
                      • column: 19
                      }
                    }
                  • name: "countFromInput"
                  }
                • init: null
                }
              ]
            • kind: "let"
            }
          • VariableDeclaration {...}
            • type: "VariableDeclaration"
            • start: 190
            • end: 268
            • loc: {...}
              • start: {...}
                • line: 10
                • column: 1
                }
              • end: {...}
                • line: 14
                • column: 3
                }
              }
            • declarations: [...] (1)
              • VariableDeclarator {...}
                • type: "VariableDeclarator"
                • start: 196
                • end: 267
                • loc: {...}
                  • start: {...}
                    • line: 10
                    • column: 7
                    }
                  • end: {...}
                    • line: 14
                    • column: 2
                    }
                  }
                • id: Identifier {...}
                  • type: "Identifier"
                  • start: 196
                  • end: 208
                  • loc: {...}
                    • start: {...}
                      • line: 10
                      • column: 7
                      }
                    • end: {...}
                      • line: 10
                      • column: 19
                      }
                    }
                  • name: "confettiOpts"
                  }
                • init: ObjectExpression {...}
                  • type: "ObjectExpression"
                  • start: 211
                  • end: 267
                  • loc: {...}
                    • start: {...}
                      • line: 10
                      • column: 22
                      }
                    • end: {...}
                      • line: 14
                      • column: 2
                      }
                    }
                  • properties: [...] (3)
                    • Property {...}
                      • type: "Property"
                      • start: 215
                      • end: 233
                      • loc: {...}
                        • start: {...}
                          • line: 11
                          • column: 2
                          }
                        • end: {...}
                          • line: 11
                          • column: 20
                          }
                        }
                      • method: false
                      • shorthand: false
                      • computed: false
                      • key: Identifier {...}
                        • type: "Identifier"
                        • start: 215
                        • end: 228
                        • loc: {...}
                          • start: {...}
                            • line: 11
                            • column: 2
                            }
                          • end: {...}
                            • line: 11
                            • column: 15
                            }
                          }
                        • name: "particleCount"
                        }
                      • value: Literal {...}
                        • type: "Literal"
                        • start: 230
                        • end: 233
                        • loc: {...}
                          • start: {...}
                            • line: 11
                            • column: 17
                            }
                          • end: {...}
                            • line: 11
                            • column: 20
                            }
                          }
                        • value: 300
                        • raw: "300"
                        }
                      • kind: "init"
                      }
                    • Property {...}
                      • type: "Property"
                      • start: 237
                      • end: 245
                      • loc: {...}
                        • start: {...}
                          • line: 12
                          • column: 2
                          }
                        • end: {...}
                          • line: 12
                          • column: 10
                          }
                        }
                      • method: false
                      • shorthand: false
                      • computed: false
                      • key: Identifier {...}
                        • type: "Identifier"
                        • start: 237
                        • end: 242
                        • loc: {...}
                          • start: {...}
                            • line: 12
                            • column: 2
                            }
                          • end: {...}
                            • line: 12
                            • column: 7
                            }
                          }
                        • name: "force"
                        }
                      • value: Literal {...}
                        • type: "Literal"
                        • start: 244
                        • end: 245
                        • loc: {...}
                          • start: {...}
                            • line: 12
                            • column: 9
                            }
                          • end: {...}
                            • line: 12
                            • column: 10
                            }
                          }
                        • value: 1
                        • raw: "1"
                        }
                      • kind: "init"
                      }
                    • Property {...}
                      • type: "Property"
                      • start: 249
                      • end: 264
                      • loc: {...}
                        • start: {...}
                          • line: 13
                          • column: 2
                          }
                        • end: {...}
                          • line: 13
                          • column: 17
                          }
                        }
                      • method: false
                      • shorthand: false
                      • computed: false
                      • key: Identifier {...}
                        • type: "Identifier"
                        • start: 249
                        • end: 261
                        • loc: {...}
                          • start: {...}
                            • line: 13
                            • column: 2
                            }
                          • end: {...}
                            • line: 13
                            • column: 14
                            }
                          }
                        • name: "particleSize"
                        }
                      • value: Literal {...}
                        • type: "Literal"
                        • start: 263
                        • end: 264
                        • loc: {...}
                          • start: {...}
                            • line: 13
                            • column: 16
                            }
                          • end: {...}
                            • line: 13
                            • column: 17
                            }
                          }
                        • value: 5
                        • raw: "5"
                        }
                      • kind: "init"
                      }
                    ]
                  }
                }
              ]
            • kind: "const"
            }
          • FunctionDeclaration {...}
            • type: "FunctionDeclaration"
            • start: 271
            • end: 331
            • loc: {...}
              • start: {...}
                • line: 16
                • column: 1
                }
              • end: {...}
                • line: 19
                • column: 2
                }
              }
            • id: Identifier {...}
              • type: "Identifier"
              • start: 286
              • end: 293
              • loc: {...}
                • start: {...}
                  • line: 16
                  • column: 16
                  }
                • end: {...}
                  • line: 16
                  • column: 23
                  }
                }
              • name: "timesUp"
              }
            • expression: false
            • generator: false
            • async: true
            • params: []
            • body: BlockStatement {...}
              • type: "BlockStatement"
              • start: 296
              • end: 331
              • loc: {...}
                • start: {...}
                  • line: 16
                  • column: 26
                  }
                • end: {...}
                  • line: 19
                  • column: 2
                  }
                }
              • body: [...] (2)
                • ExpressionStatement {...}
                  • type: "ExpressionStatement"
                  • start: 300
                  • end: 313
                  • loc: {...}
                    • start: {...}
                      • line: 17
                      • column: 2
                      }
                    • end: {...}
                      • line: 17
                      • column: 15
                      }
                    }
                  • expression: AwaitExpression {...}
                    • type: "AwaitExpression"
                    • start: 300
                    • end: 312
                    • loc: {...}
                      • start: {...}
                        • line: 17
                        • column: 2
                        }
                      • end: {...}
                        • line: 17
                        • column: 14
                        }
                      }
                    • argument: CallExpression {...}
                      • type: "CallExpression"
                      • start: 306
                      • end: 312
                      • loc: {...}
                        • start: {...}
                          • line: 17
                          • column: 8
                          }
                        • end: {...}
                          • line: 17
                          • column: 14
                          }
                        }
                      • callee: Identifier {...}
                        • type: "Identifier"
                        • start: 306
                        • end: 310
                        • loc: {...}
                          • start: {...}
                            • line: 17
                            • column: 8
                            }
                          • end: {...}
                            • line: 17
                            • column: 12
                            }
                          }
                        • name: "tick"
                        }
                      • arguments: []
                      • optional: false
                      }
                    }
                  }
                • ExpressionStatement {...}
                  • type: "ExpressionStatement"
                  • start: 316
                  • end: 328
                  • loc: {...}
                    • start: {...}
                      • line: 18
                      • column: 2
                      }
                    • end: {...}
                      • line: 18
                      • column: 14
                      }
                    }
                  • expression: AssignmentExpression {...}
                    • type: "AssignmentExpression"
                    • start: 316
                    • end: 327
                    • loc: {...}
                      • start: {...}
                        • line: 18
                        • column: 2
                        }
                      • end: {...}
                        • line: 18
                        • column: 13
                        }
                      }
                    • operator: "="
                    • left: Identifier {...}
                      • type: "Identifier"
                      • start: 316
                      • end: 320
                      • loc: {...}
                        • start: {...}
                          • line: 18
                          • column: 2
                          }
                        • end: {...}
                          • line: 18
                          • column: 6
                          }
                        }
                      • name: "done"
                      }
                    • right: Literal {...}
                      • type: "Literal"
                      • start: 323
                      • end: 327
                      • loc: {...}
                        • start: {...}
                          • line: 18
                          • column: 9
                          }
                        • end: {...}
                          • line: 18
                          • column: 13
                          }
                        }
                      • value: true
                      • raw: "true"
                      }
                    }
                  }
                ]
              }
            }
          • FunctionDeclaration {...}
            • type: "FunctionDeclaration"
            • start: 334
            • end: 437
            • loc: {...}
              • start: {...}
                • line: 21
                • column: 1
                }
              • end: {...}
                • line: 26
                • column: 2
                }
              }
            • id: Identifier {...}
              • type: "Identifier"
              • start: 349
              • end: 354
              • loc: {...}
                • start: {...}
                  • line: 21
                  • column: 16
                  }
                • end: {...}
                  • line: 21
                  • column: 21
                  }
                }
              • name: "reset"
              }
            • expression: false
            • generator: false
            • async: true
            • params: []
            • body: BlockStatement {...}
              • type: "BlockStatement"
              • start: 357
              • end: 437
              • loc: {...}
                • start: {...}
                  • line: 21
                  • column: 24
                  }
                • end: {...}
                  • line: 26
                  • column: 2
                  }
                }
              • body: [...] (4)
                • ExpressionStatement {...}
                  • type: "ExpressionStatement"
                  • start: 361
                  • end: 374
                  • loc: {...}
                    • start: {...}
                      • line: 22
                      • column: 2
                      }
                    • end: {...}
                      • line: 22
                      • column: 15
                      }
                    }
                  • expression: AssignmentExpression {...}
                    • type: "AssignmentExpression"
                    • start: 361
                    • end: 373
                    • loc: {...}
                      • start: {...}
                        • line: 22
                        • column: 2
                        }
                      • end: {...}
                        • line: 22
                        • column: 14
                        }
                      }
                    • operator: "="
                    • left: Identifier {...}
                      • type: "Identifier"
                      • start: 361
                      • end: 365
                      • loc: {...}
                        • start: {...}
                          • line: 22
                          • column: 2
                          }
                        • end: {...}
                          • line: 22
                          • column: 6
                          }
                        }
                      • name: "done"
                      }
                    • right: Literal {...}
                      • type: "Literal"
                      • start: 368
                      • end: 373
                      • loc: {...}
                        • start: {...}
                          • line: 22
                          • column: 9
                          }
                        • end: {...}
                          • line: 22
                          • column: 14
                          }
                        }
                      • value: false
                      • raw: "false"
                      }
                    }
                  }
                • ExpressionStatement {...}
                  • type: "ExpressionStatement"
                  • start: 377
                  • end: 391
                  • loc: {...}
                    • start: {...}
                      • line: 23
                      • column: 2
                      }
                    • end: {...}
                      • line: 23
                      • column: 16
                      }
                    }
                  • expression: AssignmentExpression {...}
                    • type: "AssignmentExpression"
                    • start: 377
                    • end: 390
                    • loc: {...}
                      • start: {...}
                        • line: 23
                        • column: 2
                        }
                      • end: {...}
                        • line: 23
                        • column: 15
                        }
                      }
                    • operator: "="
                    • left: Identifier {...}
                      • type: "Identifier"
                      • start: 377
                      • end: 386
                      • loc: {...}
                        • start: {...}
                          • line: 23
                          • column: 2
                          }
                        • end: {...}
                          • line: 23
                          • column: 11
                          }
                        }
                      • name: "countFrom"
                      }
                    • right: Literal {...}
                      • type: "Literal"
                      • start: 389
                      • end: 390
                      • loc: {...}
                        • start: {...}
                          • line: 23
                          • column: 14
                          }
                        • end: {...}
                          • line: 23
                          • column: 15
                          }
                        }
                      • value: 0
                      • raw: "0"
                      }
                    }
                  }
                • ExpressionStatement {...}
                  • type: "ExpressionStatement"
                  • start: 394
                  • end: 407
                  • loc: {...}
                    • start: {...}
                      • line: 24
                      • column: 2
                      }
                    • end: {...}
                      • line: 24
                      • column: 15
                      }
                    }
                  • expression: AwaitExpression {...}
                    • type: "AwaitExpression"
                    • start: 394
                    • end: 406
                    • loc: {...}
                      • start: {...}
                        • line: 24
                        • column: 2
                        }
                      • end: {...}
                        • line: 24
                        • column: 14
                        }
                      }
                    • argument: CallExpression {...}
                      • type: "CallExpression"
                      • start: 400
                      • end: 406
                      • loc: {...}
                        • start: {...}
                          • line: 24
                          • column: 8
                          }
                        • end: {...}
                          • line: 24
                          • column: 14
                          }
                        }
                      • callee: Identifier {...}
                        • type: "Identifier"
                        • start: 400
                        • end: 404
                        • loc: {...}
                          • start: {...}
                            • line: 24
                            • column: 8
                            }
                          • end: {...}
                            • line: 24
                            • column: 12
                            }
                          }
                        • name: "tick"
                        }
                      • arguments: []
                      • optional: false
                      }
                    }
                  }
                • ExpressionStatement {...}
                  • type: "ExpressionStatement"
                  • start: 410
                  • end: 434
                  • loc: {...}
                    • start: {...}
                      • line: 25
                      • column: 2
                      }
                    • end: {...}
                      • line: 25
                      • column: 26
                      }
                    }
                  • expression: ChainExpression {...}
                    • type: "ChainExpression"
                    • start: 410
                    • end: 433
                    • loc: {...}
                      • start: {...}
                        • line: 25
                        • column: 2
                        }
                      • end: {...}
                        • line: 25
                        • column: 25
                        }
                      }
                    • expression: CallExpression {...}
                      • type: "CallExpression"
                      • start: 410
                      • end: 433
                      • loc: {...}
                        • start: {...}
                          • line: 25
                          • column: 2
                          }
                        • end: {...}
                          • line: 25
                          • column: 25
                          }
                        }
                      • callee: MemberExpression {...}
                        • type: "MemberExpression"
                        • start: 410
                        • end: 431
                        • loc: {...}
                          • start: {...}
                            • line: 25
                            • column: 2
                            }
                          • end: {...}
                            • line: 25
                            • column: 23
                            }
                          }
                        • object: Identifier {...}
                          • type: "Identifier"
                          • start: 410
                          • end: 424
                          • loc: {...}
                            • start: {...}
                              • line: 25
                              • column: 2
                              }
                            • end: {...}
                              • line: 25
                              • column: 16
                              }
                            }
                          • name: "countFromInput"
                          }
                        • property: Identifier {...}
                          • type: "Identifier"
                          • start: 426
                          • end: 431
                          • loc: {...}
                            • start: {...}
                              • line: 25
                              • column: 18
                              }
                            • end: {...}
                              • line: 25
                              • column: 23
                              }
                            }
                          • name: "focus"
                          }
                        • computed: false
                        • optional: true
                        }
                      • arguments: []
                      • optional: false
                      }
                    }
                  }
                ]
              }
            }
          ]
        • sourceType: "module"
        }
      • attributes: []
      }
    }
The AST is not public API and may change at any point in time
Animated Timer • Playground • Svelte