I have an SVG constructed using d3, that depends on the value of an <input> element on the page. I'd like for the SVG to update whenever the input value has changed. There is simple reactivity demo in the tutorial. However, the example using d3 puts the code in onMount and this seems to break reactivity.
Here's an example:
<script>
import { onMount } from 'svelte';
import * as d3 from 'd3';
var word = "Hello";
let container;
onMount(() => { d3.select(container).text(word); });
</script>
<p><input bind:value={word}></p>
<p>You typed "<span bind:this={container}></span>"</p>
You'll find that typing in the text box does not cause the text in the span to update:
A bonus would be for the SVG to only update after a delay, so that the user has time to finish what they are typing. (The real SVG is much heavier than the toy example above).