Common Svelte code used in several projects.
This is a collection of random things used in a few places. All of the code here should ultimately be split into a proper library. It's not easy to do that, and in the meantime, copies of this code are spreading, so at least as a first step, deduplicating here.