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
<script>
let visible = $state(false);

function typewriter(node, { speed = 1 }) {
const valid = node.childNodes.length === 1 && node.childNodes[0].nodeType === Node.TEXT_NODE;

if (!valid) {
throw new Error(`This transition only works on elements with a single text node child`);
}

const text = node.textContent;
const duration = text.length / (speed * 0.01);

return {
duration,
tick: (t) => {
const i = ~~(text.length * t);
node.textContent = text.slice(0, i);
}
};
}
</script>

<label>
<input type="checkbox" bind:checked={visible} />
visible
</label>

{#if visible}
<p transition:typewriter>The quick brown fox jumps over the lazy dog</p>
{/if}

Error compiling component

WebAssembly.instantiateStreaming(): value type opcode @+13
import 'svelte/internal/disclose-version';
import * as $ from 'svelte/internal/client';

var root_1 = $.template(`<p>The quick brown fox jumps over the lazy dog</p>`);
var root = $.template(`<label><input type="checkbox"> visible</label> <!>`, 1);

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

let visible = $.state(false);

function typewriter(node, { speed = 1 }) {
const valid = node.childNodes.length === 1 && node.childNodes[0].nodeType === Node.TEXT_NODE;

if (!valid) {
throw new Error(`This transition only works on elements with a single text node child`);
}

const text = node.textContent;
const duration = text.length / (speed * 0.01);

return {
duration,
tick: (t) => {
const i = ~~(text.length * t);

node.textContent = text.slice(0, i);
}
};
}

var fragment = root();
var label = $.first_child(fragment);
var input = $.child(label);

$.remove_input_defaults(input);
result = svelte.compile(source, {
generate: ,
});
/* Add a <style> tag to see the CSS output */
		
			
				
  • Root {
    • css: null
    • js: []
    • start: 519
    • end: 689
    • type: "Root"
    • fragment: Fragment {...}
      • type: "Fragment"
      • nodes: [...] (4)
        • Text {...}
          • type: "Text"
          • start: 517
          • end: 519
          • raw: "\n\n"
          • data: "\n\n"
          }
        • RegularElement {...}
          • type: "RegularElement"
          • start: 519
          • end: 594
          • name: "label"
          • attributes: []
          • fragment: Fragment {...}
            • type: "Fragment"
            • nodes: [...] (3)
              • Text {...}
                • type: "Text"
                • start: 526
                • end: 528
                • raw: "\n\t"
                • data: "\n\t"
                }
              • RegularElement {...}
                • type: "RegularElement"
                • start: 528
                • end: 576
                • name: "input"
                • attributes: [...] (2)
                  • Attribute {...}
                    • type: "Attribute"
                    • start: 535
                    • end: 550
                    • name: "type"
                    • value: [...] (1)
                      • Text {...}
                        • start: 541
                        • end: 549
                        • type: "Text"
                        • raw: "checkbox"
                        • data: "checkbox"
                        }
                      ]
                    }
                  • BindDirective {...}
                    • start: 551
                    • end: 573
                    • type: "BindDirective"
                    • name: "checked"
                    • expression: Identifier {...}
                      • type: "Identifier"
                      • start: 565
                      • end: 572
                      • loc: {...}
                        • start: {...}
                          • line: 25
                          • column: 38
                          }
                        • end: {...}
                          • line: 25
                          • column: 45
                          }
                        }
                      • name: "visible"
                      }
                    • modifiers: []
                    }
                  ]
                • fragment: Fragment {...}
                  • type: "Fragment"
                  • nodes: []
                  }
                }
              • Text {...}
                • type: "Text"
                • start: 576
                • end: 586
                • raw: " visible"
                • data: " visible"
                }
              ]
            }
          }
        • Text {...}
          • type: "Text"
          • start: 594
          • end: 596
          • raw: " "
          • data: " "
          }
        • IfBlock {...}
          • type: "IfBlock"
          • elseif: false
          • start: 596
          • end: 689
          • test: Identifier {...}
            • type: "Identifier"
            • start: 601
            • end: 608
            • loc: {...}
              • start: {...}
                • line: 29
                • column: 5
                }
              • end: {...}
                • line: 29
                • column: 12
                }
              }
            • name: "visible"
            }
          • consequent: Fragment {...}
            • type: "Fragment"
            • nodes: [...] (3)
              • Text {...}
                • type: "Text"
                • start: 609
                • end: 611
                • raw: "\n\t"
                • data: "\n\t"
                }
              • RegularElement {...}
                • type: "RegularElement"
                • start: 611
                • end: 683
                • name: "p"
                • attributes: [...] (1)
                  • TransitionDirective {...}
                    • start: 614
                    • end: 635
                    • type: "TransitionDirective"
                    • name: "typewriter"
                    • expression: null
                    • modifiers: []
                    • intro: true
                    • outro: true
                    }
                  ]
                • fragment: Fragment {...}
                  • type: "Fragment"
                  • nodes: [...] (1)
                    • Text {...}
                      • type: "Text"
                      • start: 636
                      • end: 679
                      • raw: "The quick brown fox jumps over the lazy dog"
                      • data: "The quick brown fox jumps over the lazy dog"
                      }
                    ]
                  }
                }
              • Text {...}
                • type: "Text"
                • start: 683
                • end: 684
                • raw: "\n"
                • data: "\n"
                }
              ]
            }
          • alternate: null
          }
        ]
      }
    • options: null
    • instance: Script {...}
      • type: "Script"
      • start: 0
      • end: 517
      • context: "default"
      • content: Program {...}
        • type: "Program"
        • start: 8
        • end: 508
        • loc: {...}
          • start: {...}
            • line: 1
            • column: 0
            }
          • end: {...}
            • line: 22
            • column: 0
            }
          }
        • body: [...] (2)
          • VariableDeclaration {...}
            • type: "VariableDeclaration"
            • start: 10
            • end: 38
            • loc: {...}
              • start: {...}
                • line: 2
                • column: 1
                }
              • end: {...}
                • line: 2
                • column: 29
                }
              }
            • declarations: [...] (1)
              • VariableDeclarator {...}
                • type: "VariableDeclarator"
                • start: 14
                • end: 37
                • loc: {...}
                  • start: {...}
                    • line: 2
                    • column: 5
                    }
                  • end: {...}
                    • line: 2
                    • column: 28
                    }
                  }
                • id: Identifier {...}
                  • type: "Identifier"
                  • start: 14
                  • end: 21
                  • loc: {...}
                    • start: {...}
                      • line: 2
                      • column: 5
                      }
                    • end: {...}
                      • line: 2
                      • column: 12
                      }
                    }
                  • name: "visible"
                  }
                • init: CallExpression {...}
                  • type: "CallExpression"
                  • start: 24
                  • end: 37
                  • loc: {...}
                    • start: {...}
                      • line: 2
                      • column: 15
                      }
                    • end: {...}
                      • line: 2
                      • column: 28
                      }
                    }
                  • callee: Identifier {...}
                    • type: "Identifier"
                    • start: 24
                    • end: 30
                    • loc: {...}
                      • start: {...}
                        • line: 2
                        • column: 15
                        }
                      • end: {...}
                        • line: 2
                        • column: 21
                        }
                      }
                    • name: "$state"
                    }
                  • arguments: [...] (1)
                    • Literal {...}
                      • type: "Literal"
                      • start: 31
                      • end: 36
                      • loc: {...}
                        • start: {...}
                          • line: 2
                          • column: 22
                          }
                        • end: {...}
                          • line: 2
                          • column: 27
                          }
                        }
                      • value: false
                      • raw: "false"
                      }
                    ]
                  • optional: false
                  }
                }
              ]
            • kind: "let"
            }
          • FunctionDeclaration {...}
            • type: "FunctionDeclaration"
            • start: 41
            • end: 507
            • loc: {...}
              • start: {...}
                • line: 4
                • column: 1
                }
              • end: {...}
                • line: 21
                • column: 2
                }
              }
            • id: Identifier {...}
              • type: "Identifier"
              • start: 50
              • end: 60
              • loc: {...}
                • start: {...}
                  • line: 4
                  • column: 10
                  }
                • end: {...}
                  • line: 4
                  • column: 20
                  }
                }
              • name: "typewriter"
              }
            • expression: false
            • generator: false
            • async: false
            • params: [...] (2)
              • Identifier {...}
                • type: "Identifier"
                • start: 61
                • end: 65
                • loc: {...}
                  • start: {...}
                    • line: 4
                    • column: 21
                    }
                  • end: {...}
                    • line: 4
                    • column: 25
                    }
                  }
                • name: "node"
                }
              • ObjectPattern {...}
                • type: "ObjectPattern"
                • start: 67
                • end: 80
                • loc: {...}
                  • start: {...}
                    • line: 4
                    • column: 27
                    }
                  • end: {...}
                    • line: 4
                    • column: 40
                    }
                  }
                • properties: [...] (1)
                  • Property {...}
                    • type: "Property"
                    • start: 69
                    • end: 78
                    • loc: {...}
                      • start: {...}
                        • line: 4
                        • column: 29
                        }
                      • end: {...}
                        • line: 4
                        • column: 38
                        }
                      }
                    • method: false
                    • shorthand: true
                    • computed: false
                    • key: Identifier {...}
                      • type: "Identifier"
                      • start: 69
                      • end: 74
                      • loc: {...}
                        • start: {...}
                          • line: 4
                          • column: 29
                          }
                        • end: {...}
                          • line: 4
                          • column: 34
                          }
                        }
                      • name: "speed"
                      }
                    • kind: "init"
                    • value: AssignmentPattern {...}
                      • type: "AssignmentPattern"
                      • start: 69
                      • end: 78
                      • loc: {...}
                        • start: {...}
                          • line: 4
                          • column: 29
                          }
                        • end: {...}
                          • line: 4
                          • column: 38
                          }
                        }
                      • left: Identifier {...}
                        • type: "Identifier"
                        • start: 69
                        • end: 74
                        • loc: {...}
                          • start: {...}
                            • line: 4
                            • column: 29
                            }
                          • end: {...}
                            • line: 4
                            • column: 34
                            }
                          }
                        • name: "speed"
                        }
                      • right: Literal {...}
                        • type: "Literal"
                        • start: 77
                        • end: 78
                        • loc: {...}
                          • start: {...}
                            • line: 4
                            • column: 37
                            }
                          • end: {...}
                            • line: 4
                            • column: 38
                            }
                          }
                        • value: 1
                        • raw: "1"
                        }
                      }
                    }
                  ]
                }
              ]
            • body: BlockStatement {...}
              • type: "BlockStatement"
              • start: 82
              • end: 507
              • loc: {...}
                • start: {...}
                  • line: 4
                  • column: 42
                  }
                • end: {...}
                  • line: 21
                  • column: 2
                  }
                }
              • body: [...] (5)
                • VariableDeclaration {...}
                  • type: "VariableDeclaration"
                  • start: 86
                  • end: 179
                  • loc: {...}
                    • start: {...}
                      • line: 5
                      • column: 2
                      }
                    • end: {...}
                      • line: 5
                      • column: 95
                      }
                    }
                  • declarations: [...] (1)
                    • VariableDeclarator {...}
                      • type: "VariableDeclarator"
                      • start: 92
                      • end: 178
                      • loc: {...}
                        • start: {...}
                          • line: 5
                          • column: 8
                          }
                        • end: {...}
                          • line: 5
                          • column: 94
                          }
                        }
                      • id: Identifier {...}
                        • type: "Identifier"
                        • start: 92
                        • end: 97
                        • loc: {...}
                          • start: {...}
                            • line: 5
                            • column: 8
                            }
                          • end: {...}
                            • line: 5
                            • column: 13
                            }
                          }
                        • name: "valid"
                        }
                      • init: LogicalExpression {...}
                        • type: "LogicalExpression"
                        • start: 100
                        • end: 178
                        • loc: {...}
                          • start: {...}
                            • line: 5
                            • column: 16
                            }
                          • end: {...}
                            • line: 5
                            • column: 94
                            }
                          }
                        • left: BinaryExpression {...}
                          • type: "BinaryExpression"
                          • start: 100
                          • end: 128
                          • loc: {...}
                            • start: {...}
                              • line: 5
                              • column: 16
                              }
                            • end: {...}
                              • line: 5
                              • column: 44
                              }
                            }
                          • left: MemberExpression {...}
                            • type: "MemberExpression"
                            • start: 100
                            • end: 122
                            • loc: {...}
                              • start: {...}
                                • line: 5
                                • column: 16
                                }
                              • end: {...}
                                • line: 5
                                • column: 38
                                }
                              }
                            • object: MemberExpression {...}
                              • type: "MemberExpression"
                              • start: 100
                              • end: 115
                              • loc: {...}
                                • start: {...}
                                  • line: 5
                                  • column: 16
                                  }
                                • end: {...}
                                  • line: 5
                                  • column: 31
                                  }
                                }
                              • object: Identifier {...}
                                • type: "Identifier"
                                • start: 100
                                • end: 104
                                • loc: {...}
                                  • start: {...}
                                    • line: 5
                                    • column: 16
                                    }
                                  • end: {...}
                                    • line: 5
                                    • column: 20
                                    }
                                  }
                                • name: "node"
                                }
                              • property: Identifier {...}
                                • type: "Identifier"
                                • start: 105
                                • end: 115
                                • loc: {...}
                                  • start: {...}
                                    • line: 5
                                    • column: 21
                                    }
                                  • end: {...}
                                    • line: 5
                                    • column: 31
                                    }
                                  }
                                • name: "childNodes"
                                }
                              • computed: false
                              • optional: false
                              }
                            • property: Identifier {...}
                              • type: "Identifier"
                              • start: 116
                              • end: 122
                              • loc: {...}
                                • start: {...}
                                  • line: 5
                                  • column: 32
                                  }
                                • end: {...}
                                  • line: 5
                                  • column: 38
                                  }
                                }
                              • name: "length"
                              }
                            • computed: false
                            • optional: false
                            }
                          • operator: "==="
                          • right: Literal {...}
                            • type: "Literal"
                            • start: 127
                            • end: 128
                            • loc: {...}
                              • start: {...}
                                • line: 5
                                • column: 43
                                }
                              • end: {...}
                                • line: 5
                                • column: 44
                                }
                              }
                            • value: 1
                            • raw: "1"
                            }
                          }
                        • operator: "&&"
                        • right: BinaryExpression {...}
                          • type: "BinaryExpression"
                          • start: 132
                          • end: 178
                          • loc: {...}
                            • start: {...}
                              • line: 5
                              • column: 48
                              }
                            • end: {...}
                              • line: 5
                              • column: 94
                              }
                            }
                          • left: MemberExpression {...}
                            • type: "MemberExpression"
                            • start: 132
                            • end: 159
                            • loc: {...}
                              • start: {...}
                                • line: 5
                                • column: 48
                                }
                              • end: {...}
                                • line: 5
                                • column: 75
                                }
                              }
                            • object: MemberExpression {...}
                              • type: "MemberExpression"
                              • start: 132
                              • end: 150
                              • loc: {...}
                                • start: {...}
                                  • line: 5
                                  • column: 48
                                  }
                                • end: {...}
                                  • line: 5
                                  • column: 66
                                  }
                                }
                              • object: MemberExpression {...}
                                • type: "MemberExpression"
                                • start: 132
                                • end: 147
                                • loc: {...}
                                  • start: {...}
                                    • line: 5
                                    • column: 48
                                    }
                                  • end: {...}
                                    • line: 5
                                    • column: 63
                                    }
                                  }
                                • object: Identifier {...}
                                  • type: "Identifier"
                                  • start: 132
                                  • end: 136
                                  • loc: {...}
                                    • start: {...}
                                      • line: 5
                                      • column: 48
                                      }
                                    • end: {...}
                                      • line: 5
                                      • column: 52
                                      }
                                    }
                                  • name: "node"
                                  }
                                • property: Identifier {...}
                                  • type: "Identifier"
                                  • start: 137
                                  • end: 147
                                  • loc: {...}
                                    • start: {...}
                                      • line: 5
                                      • column: 53
                                      }
                                    • end: {...}
                                      • line: 5
                                      • column: 63
                                      }
                                    }
                                  • name: "childNodes"
                                  }
                                • computed: false
                                • optional: false
                                }
                              • property: Literal {...}
                                • type: "Literal"
                                • start: 148
                                • end: 149
                                • loc: {...}
                                  • start: {...}
                                    • line: 5
                                    • column: 64
                                    }
                                  • end: {...}
                                    • line: 5
                                    • column: 65
                                    }
                                  }
                                • value: 0
                                • raw: "0"
                                }
                              • computed: true
                              • optional: false
                              }
                            • property: Identifier {...}
                              • type: "Identifier"
                              • start: 151
                              • end: 159
                              • loc: {...}
                                • start: {...}
                                  • line: 5
                                  • column: 67
                                  }
                                • end: {...}
                                  • line: 5
                                  • column: 75
                                  }
                                }
                              • name: "nodeType"
                              }
                            • computed: false
                            • optional: false
                            }
                          • operator: "==="
                          • right: MemberExpression {...}
                            • type: "MemberExpression"
                            • start: 164
                            • end: 178
                            • loc: {...}
                              • start: {...}
                                • line: 5
                                • column: 80
                                }
                              • end: {...}
                                • line: 5
                                • column: 94
                                }
                              }
                            • object: Identifier {...}
                              • type: "Identifier"
                              • start: 164
                              • end: 168
                              • loc: {...}
                                • start: {...}
                                  • line: 5
                                  • column: 80
                                  }
                                • end: {...}
                                  • line: 5
                                  • column: 84
                                  }
                                }
                              • name: "Node"
                              }
                            • property: Identifier {...}
                              • type: "Identifier"
                              • start: 169
                              • end: 178
                              • loc: {...}
                                • start: {...}
                                  • line: 5
                                  • column: 85
                                  }
                                • end: {...}
                                  • line: 5
                                  • column: 94
                                  }
                                }
                              • name: "TEXT_NODE"
                              }
                            • computed: false
                            • optional: false
                            }
                          }
                        }
                      }
                    ]
                  • kind: "const"
                  }
                • IfStatement {...}
                  • type: "IfStatement"
                  • start: 183
                  • end: 292
                  • loc: {...}
                    • start: {...}
                      • line: 7
                      • column: 2
                      }
                    • end: {...}
                      • line: 9
                      • column: 3
                      }
                    }
                  • test: UnaryExpression {...}
                    • type: "UnaryExpression"
                    • start: 187
                    • end: 193
                    • loc: {...}
                      • start: {...}
                        • line: 7
                        • column: 6
                        }
                      • end: {...}
                        • line: 7
                        • column: 12
                        }
                      }
                    • operator: "!"
                    • prefix: true
                    • argument: Identifier {...}
                      • type: "Identifier"
                      • start: 188
                      • end: 193
                      • loc: {...}
                        • start: {...}
                          • line: 7
                          • column: 7
                          }
                        • end: {...}
                          • line: 7
                          • column: 12
                          }
                        }
                      • name: "valid"
                      }
                    }
                  • consequent: BlockStatement {...}
                    • type: "BlockStatement"
                    • start: 195
                    • end: 292
                    • loc: {...}
                      • start: {...}
                        • line: 7
                        • column: 14
                        }
                      • end: {...}
                        • line: 9
                        • column: 3
                        }
                      }
                    • body: [...] (1)
                      • ThrowStatement {...}
                        • type: "ThrowStatement"
                        • start: 200
                        • end: 288
                        • loc: {...}
                          • start: {...}
                            • line: 8
                            • column: 3
                            }
                          • end: {...}
                            • line: 8
                            • column: 91
                            }
                          }
                        • argument: NewExpression {...}
                          • type: "NewExpression"
                          • start: 206
                          • end: 287
                          • loc: {...}
                            • start: {...}
                              • line: 8
                              • column: 9
                              }
                            • end: {...}
                              • line: 8
                              • column: 90
                              }
                            }
                          • callee: Identifier {...}
                            • type: "Identifier"
                            • start: 210
                            • end: 215
                            • loc: {...}
                              • start: {...}
                                • line: 8
                                • column: 13
                                }
                              • end: {...}
                                • line: 8
                                • column: 18
                                }
                              }
                            • name: "Error"
                            }
                          • arguments: [...] (1)
                            • TemplateLiteral {...}
                              • type: "TemplateLiteral"
                              • start: 216
                              • end: 286
                              • loc: {...}
                                • start: {...}
                                  • line: 8
                                  • column: 19
                                  }
                                • end: {...}
                                  • line: 8
                                  • column: 89
                                  }
                                }
                              • expressions: []
                              • quasis: [...] (1)
                                • TemplateElement {...}
                                  • type: "TemplateElement"
                                  • start: 217
                                  • end: 285
                                  • loc: {...}
                                    • start: {...}
                                      • line: 8
                                      • column: 20
                                      }
                                    • end: {...}
                                      • line: 8
                                      • column: 88
                                      }
                                    }
                                  • value: {...}
                                    • raw: "This transition only works on elements with a single text node child"
                                    • cooked: "This transition only works on elements with a single text node child"
                                    }
                                  • tail: true
                                  }
                                ]
                              }
                            ]
                          }
                        }
                      ]
                    }
                  • alternate: null
                  }
                • VariableDeclaration {...}
                  • type: "VariableDeclaration"
                  • start: 296
                  • end: 326
                  • loc: {...}
                    • start: {...}
                      • line: 11
                      • column: 2
                      }
                    • end: {...}
                      • line: 11
                      • column: 32
                      }
                    }
                  • declarations: [...] (1)
                    • VariableDeclarator {...}
                      • type: "VariableDeclarator"
                      • start: 302
                      • end: 325
                      • loc: {...}
                        • start: {...}
                          • line: 11
                          • column: 8
                          }
                        • end: {...}
                          • line: 11
                          • column: 31
                          }
                        }
                      • id: Identifier {...}
                        • type: "Identifier"
                        • start: 302
                        • end: 306
                        • loc: {...}
                          • start: {...}
                            • line: 11
                            • column: 8
                            }
                          • end: {...}
                            • line: 11
                            • column: 12
                            }
                          }
                        • name: "text"
                        }
                      • init: MemberExpression {...}
                        • type: "MemberExpression"
                        • start: 309
                        • end: 325
                        • loc: {...}
                          • start: {...}
                            • line: 11
                            • column: 15
                            }
                          • end: {...}
                            • line: 11
                            • column: 31
                            }
                          }
                        • object: Identifier {...}
                          • type: "Identifier"
                          • start: 309
                          • end: 313
                          • loc: {...}
                            • start: {...}
                              • line: 11
                              • column: 15
                              }
                            • end: {...}
                              • line: 11
                              • column: 19
                              }
                            }
                          • name: "node"
                          }
                        • property: Identifier {...}
                          • type: "Identifier"
                          • start: 314
                          • end: 325
                          • loc: {...}
                            • start: {...}
                              • line: 11
                              • column: 20
                              }
                            • end: {...}
                              • line: 11
                              • column: 31
                              }
                            }
                          • name: "textContent"
                          }
                        • computed: false
                        • optional: false
                        }
                      }
                    ]
                  • kind: "const"
                  }
                • VariableDeclaration {...}
                  • type: "VariableDeclaration"
                  • start: 329
                  • end: 375
                  • loc: {...}
                    • start: {...}
                      • line: 12
                      • column: 2
                      }
                    • end: {...}
                      • line: 12
                      • column: 48
                      }
                    }
                  • declarations: [...] (1)
                    • VariableDeclarator {...}
                      • type: "VariableDeclarator"
                      • start: 335
                      • end: 374
                      • loc: {...}
                        • start: {...}
                          • line: 12
                          • column: 8
                          }
                        • end: {...}
                          • line: 12
                          • column: 47
                          }
                        }
                      • id: Identifier {...}
                        • type: "Identifier"
                        • start: 335
                        • end: 343
                        • loc: {...}
                          • start: {...}
                            • line: 12
                            • column: 8
                            }
                          • end: {...}
                            • line: 12
                            • column: 16
                            }
                          }
                        • name: "duration"
                        }
                      • init: BinaryExpression {...}
                        • type: "BinaryExpression"
                        • start: 346
                        • end: 374
                        • loc: {...}
                          • start: {...}
                            • line: 12
                            • column: 19
                            }
                          • end: {...}
                            • line: 12
                            • column: 47
                            }
                          }
                        • left: MemberExpression {...}
                          • type: "MemberExpression"
                          • start: 346
                          • end: 357
                          • loc: {...}
                            • start: {...}
                              • line: 12
                              • column: 19
                              }
                            • end: {...}
                              • line: 12
                              • column: 30
                              }
                            }
                          • object: Identifier {...}
                            • type: "Identifier"
                            • start: 346
                            • end: 350
                            • loc: {...}
                              • start: {...}
                                • line: 12
                                • column: 19
                                }
                              • end: {...}
                                • line: 12
                                • column: 23
                                }
                              }
                            • name: "text"
                            }
                          • property: Identifier {...}
                            • type: "Identifier"
                            • start: 351
                            • end: 357
                            • loc: {...}
                              • start: {...}
                                • line: 12
                                • column: 24
                                }
                              • end: {...}
                                • line: 12
                                • column: 30
                                }
                              }
                            • name: "length"
                            }
                          • computed: false
                          • optional: false
                          }
                        • operator: "/"
                        • right: BinaryExpression {...}
                          • type: "BinaryExpression"
                          • start: 361
                          • end: 373
                          • loc: {...}
                            • start: {...}
                              • line: 12
                              • column: 34
                              }
                            • end: {...}
                              • line: 12
                              • column: 46
                              }
                            }
                          • left: Identifier {...}
                            • type: "Identifier"
                            • start: 361
                            • end: 366
                            • loc: {...}
                              • start: {...}
                                • line: 12
                                • column: 34
                                }
                              • end: {...}
                                • line: 12
                                • column: 39
                                }
                              }
                            • name: "speed"
                            }
                          • operator: "*"
                          • right: Literal {...}
                            • type: "Literal"
                            • start: 369
                            • end: 373
                            • loc: {...}
                              • start: {...}
                                • line: 12
                                • column: 42
                                }
                              • end: {...}
                                • line: 12
                                • column: 46
                                }
                              }
                            • value: 0.01
                            • raw: "0.01"
                            }
                          }
                        }
                      }
                    ]
                  • kind: "const"
                  }
                • ReturnStatement {...}
                  • type: "ReturnStatement"
                  • start: 379
                  • end: 504
                  • loc: {...}
                    • start: {...}
                      • line: 14
                      • column: 2
                      }
                    • end: {...}
                      • line: 20
                      • column: 4
                      }
                    }
                  • argument: ObjectExpression {...}
                    • type: "ObjectExpression"
                    • start: 386
                    • end: 503
                    • loc: {...}
                      • start: {...}
                        • line: 14
                        • column: 9
                        }
                      • end: {...}
                        • line: 20
                        • column: 3
                        }
                      }
                    • properties: [...] (2)
                      • Property {...}
                        • type: "Property"
                        • start: 391
                        • end: 399
                        • loc: {...}
                          • start: {...}
                            • line: 15
                            • column: 3
                            }
                          • end: {...}
                            • line: 15
                            • column: 11
                            }
                          }
                        • method: false
                        • shorthand: true
                        • computed: false
                        • key: Identifier {...}
                          • type: "Identifier"
                          • start: 391
                          • end: 399
                          • loc: {...}
                            • start: {...}
                              • line: 15
                              • column: 3
                              }
                            • end: {...}
                              • line: 15
                              • column: 11
                              }
                            }
                          • name: "duration"
                          }
                        • kind: "init"
                        • value: Identifier {...}
                          • type: "Identifier"
                          • start: 391
                          • end: 399
                          • loc: {...}
                            • start: {...}
                              • line: 15
                              • column: 3
                              }
                            • end: {...}
                              • line: 15
                              • column: 11
                              }
                            }
                          • name: "duration"
                          }
                        }
                      • Property {...}
                        • type: "Property"
                        • start: 404
                        • end: 499
                        • loc: {...}
                          • start: {...}
                            • line: 16
                            • column: 3
                            }
                          • end: {...}
                            • line: 19
                            • column: 4
                            }
                          }
                        • method: false
                        • shorthand: false
                        • computed: false
                        • key: Identifier {...}
                          • type: "Identifier"
                          • start: 404
                          • end: 408
                          • loc: {...}
                            • start: {...}
                              • line: 16
                              • column: 3
                              }
                            • end: {...}
                              • line: 16
                              • column: 7
                              }
                            }
                          • name: "tick"
                          }
                        • value: ArrowFunctionExpression {...}
                          • type: "ArrowFunctionExpression"
                          • start: 410
                          • end: 499
                          • loc: {...}
                            • start: {...}
                              • line: 16
                              • column: 9
                              }
                            • end: {...}
                              • line: 19
                              • column: 4
                              }
                            }
                          • id: null
                          • expression: false
                          • generator: false
                          • async: false
                          • params: [...] (1)
                            • Identifier {...}
                              • type: "Identifier"
                              • start: 411
                              • end: 412
                              • loc: {...}
                                • start: {...}
                                  • line: 16
                                  • column: 10
                                  }
                                • end: {...}
                                  • line: 16
                                  • column: 11
                                  }
                                }
                              • name: "t"
                              }
                            ]
                          • body: BlockStatement {...}
                            • type: "BlockStatement"
                            • start: 417
                            • end: 499
                            • loc: {...}
                              • start: {...}
                                • line: 16
                                • column: 16
                                }
                              • end: {...}
                                • line: 19
                                • column: 4
                                }
                              }
                            • body: [...] (2)
                              • VariableDeclaration {...}
                                • type: "VariableDeclaration"
                                • start: 423
                                • end: 453
                                • loc: {...}
                                  • start: {...}
                                    • line: 17
                                    • column: 4
                                    }
                                  • end: {...}
                                    • line: 17
                                    • column: 34
                                    }
                                  }
                                • declarations: [...] (1)
                                  • VariableDeclarator {...}
                                    • type: "VariableDeclarator"
                                    • start: 429
                                    • end: 452
                                    • loc: {...}
                                      • start: {...}
                                        • line: 17
                                        • column: 10
                                        }
                                      • end: {...}
                                        • line: 17
                                        • column: 33
                                        }
                                      }
                                    • id: Identifier {...}
                                      • type: "Identifier"
                                      • start: 429
                                      • end: 430
                                      • loc: {...}
                                        • start: {...}
                                          • line: 17
                                          • column: 10
                                          }
                                        • end: {...}
                                          • line: 17
                                          • column: 11
                                          }
                                        }
                                      • name: "i"
                                      }
                                    • init: UnaryExpression {...}
                                      • type: "UnaryExpression"
                                      • start: 433
                                      • end: 452
                                      • loc: {...}
                                        • start: {...}
                                          • line: 17
                                          • column: 14
                                          }
                                        • end: {...}
                                          • line: 17
                                          • column: 33
                                          }
                                        }
                                      • operator: "~"
                                      • prefix: true
                                      • argument: UnaryExpression {...}
                                        • type: "UnaryExpression"
                                        • start: 434
                                        • end: 452
                                        • loc: {...}
                                          • start: {...}
                                            • line: 17
                                            • column: 15
                                            }
                                          • end: {...}
                                            • line: 17
                                            • column: 33
                                            }
                                          }
                                        • operator: "~"
                                        • prefix: true
                                        • argument: BinaryExpression {...}
                                          • type: "BinaryExpression"
                                          • start: 436
                                          • end: 451
                                          • loc: {...}
                                            • start: {...}
                                              • line: 17
                                              • column: 17
                                              }
                                            • end: {...}
                                              • line: 17
                                              • column: 32
                                              }
                                            }
                                          • left: MemberExpression {...}
                                            • type: "MemberExpression"
                                            • start: 436
                                            • end: 447
                                            • loc: {...}
                                              • start: {...}
                                                • line: 17
                                                • column: 17
                                                }
                                              • end: {...}
                                                • line: 17
                                                • column: 28
                                                }
                                              }
                                            • object: Identifier {...}
                                              • type: "Identifier"
                                              • start: 436
                                              • end: 440
                                              • loc: {...}
                                                • start: {...}
                                                  • line: 17
                                                  • column: 17
                                                  }
                                                • end: {...}
                                                  • line: 17
                                                  • column: 21
                                                  }
                                                }
                                              • name: "text"
                                              }
                                            • property: Identifier {...}
                                              • type: "Identifier"
                                              • start: 441
                                              • end: 447
                                              • loc: {...}
                                                • start: {...}
                                                  • line: 17
                                                  • column: 22
                                                  }
                                                • end: {...}
                                                  • line: 17
                                                  • column: 28
                                                  }
                                                }
                                              • name: "length"
                                              }
                                            • computed: false
                                            • optional: false
                                            }
                                          • operator: "*"
                                          • right: Identifier {...}
                                            • type: "Identifier"
                                            • start: 450
                                            • end: 451
                                            • loc: {...}
                                              • start: {...}
                                                • line: 17
                                                • column: 31
                                                }
                                              • end: {...}
                                                • line: 17
                                                • column: 32
                                                }
                                              }
                                            • name: "t"
                                            }
                                          }
                                        }
                                      }
                                    }
                                  ]
                                • kind: "const"
                                }
                              • ExpressionStatement {...}
                                • type: "ExpressionStatement"
                                • start: 458
                                • end: 494
                                • loc: {...}
                                  • start: {...}
                                    • line: 18
                                    • column: 4
                                    }
                                  • end: {...}
                                    • line: 18
                                    • column: 40
                                    }
                                  }
                                • expression: AssignmentExpression {...}
                                  • type: "AssignmentExpression"
                                  • start: 458
                                  • end: 493
                                  • loc: {...}
                                    • start: {...}
                                      • line: 18
                                      • column: 4
                                      }
                                    • end: {...}
                                      • line: 18
                                      • column: 39
                                      }
                                    }
                                  • operator: "="
                                  • left: MemberExpression {...}
                                    • type: "MemberExpression"
                                    • start: 458
                                    • end: 474
                                    • loc: {...}
                                      • start: {...}
                                        • line: 18
                                        • column: 4
                                        }
                                      • end: {...}
                                        • line: 18
                                        • column: 20
                                        }
                                      }
                                    • object: Identifier {...}
                                      • type: "Identifier"
                                      • start: 458
                                      • end: 462
                                      • loc: {...}
                                        • start: {...}
                                          • line: 18
                                          • column: 4
                                          }
                                        • end: {...}
                                          • line: 18
                                          • column: 8
                                          }
                                        }
                                      • name: "node"
                                      }
                                    • property: Identifier {...}
                                      • type: "Identifier"
                                      • start: 463
                                      • end: 474
                                      • loc: {...}
                                        • start: {...}
                                          • line: 18
                                          • column: 9
                                          }
                                        • end: {...}
                                          • line: 18
                                          • column: 20
                                          }
                                        }
                                      • name: "textContent"
                                      }
                                    • computed: false
                                    • optional: false
                                    }
                                  • right: CallExpression {...}
                                    • type: "CallExpression"
                                    • start: 477
                                    • end: 493
                                    • loc: {...}
                                      • start: {...}
                                        • line: 18
                                        • column: 23
                                        }
                                      • end: {...}
                                        • line: 18
                                        • column: 39
                                        }
                                      }
                                    • callee: MemberExpression {...}
                                      • type: "MemberExpression"
                                      • start: 477
                                      • end: 487
                                      • loc: {...}
                                        • start: {...}
                                          • line: 18
                                          • column: 23
                                          }
                                        • end: {...}
                                          • line: 18
                                          • column: 33
                                          }
                                        }
                                      • object: Identifier {...}
                                        • type: "Identifier"
                                        • start: 477
                                        • end: 481
                                        • loc: {...}
                                          • start: {...}
                                            • line: 18
                                            • column: 23
                                            }
                                          • end: {...}
                                            • line: 18
                                            • column: 27
                                            }
                                          }
                                        • name: "text"
                                        }
                                      • property: Identifier {...}
                                        • type: "Identifier"
                                        • start: 482
                                        • end: 487
                                        • loc: {...}
                                          • start: {...}
                                            • line: 18
                                            • column: 28
                                            }
                                          • end: {...}
                                            • line: 18
                                            • column: 33
                                            }
                                          }
                                        • name: "slice"
                                        }
                                      • computed: false
                                      • optional: false
                                      }
                                    • arguments: [...] (2)
                                      • Literal {...}
                                        • type: "Literal"
                                        • start: 488
                                        • end: 489
                                        • loc: {...}
                                          • start: {...}
                                            • line: 18
                                            • column: 34
                                            }
                                          • end: {...}
                                            • line: 18
                                            • column: 35
                                            }
                                          }
                                        • value: 0
                                        • raw: "0"
                                        }
                                      • Identifier {...}
                                        • type: "Identifier"
                                        • start: 491
                                        • end: 492
                                        • loc: {...}
                                          • start: {...}
                                            • line: 18
                                            • column: 37
                                            }
                                          • end: {...}
                                            • line: 18
                                            • column: 38
                                            }
                                          }
                                        • name: "i"
                                        }
                                      ]
                                    • optional: false
                                    }
                                  }
                                }
                              ]
                            }
                          }
                        • kind: "init"
                        }
                      ]
                    }
                  }
                ]
              }
            }
          ]
        • sourceType: "module"
        }
      • attributes: []
      }
    }
The AST is not public API and may change at any point in time
Custom JS transitions • Playground • Svelte