Retrospectives and New Svelte Feature
In Svelte news, version 3.35 came out this week with the new <svelte:fragment>
tag, which removes the previous restriction that a slot had to be bound to a single HTML element.
This is a big change, especially useful with table rows and flex or grid layouts where a wrapper element may interfere with the desired layout.
<Table {data}>
<svelte:fragment slot="footer">
<tr><td>Footer Row 1</td></tr>
<tr><td>Footer Row 2</td></tr>
</svelte:fragment>
</Table>
Previously, you could just fill the slot multiple times. This usually worked, but the implementation had at least two bugs and I had the feeling that this possibility was only left in since there was no better alternative until now.
<Table {data}>
<tr slot="footer"><td>Footer Row 1</td></tr>
<tr slot="footer"><td>Footer Row 2</td></tr>
</Table>
The Svelte compiler has also added some sugar syntax that uses an implicit svelte:fragment
to let you put a component directly in a slot:
<Table {data}>
<OtherComponent slot="footer" />
</Table>
Many Svelte users have been working around for a while now in various ways, so it's great news to see <svelte:fragment>
supported.
Recommended Reading and Videos
SVG Can Do That! by Sarah Drasner
A conference talk showcasing some cool SVG tricks. The most notable things to me were drag-and-drop interactions and SVG filters, a feature I haven't played with before.
The first 10 minutes of the video are just demos but it gets into more details after that.
What I Worked On by Paul Graham
This is a mini-biography by Paul Graham, one of the founders of Y Combinator. It's a long read, and I resorted to Matter's text-to-speech feature to listen while washing the dishes over a few nights.
But there's a lot of interesting content about computer history, running businesses, and the internal struggle between making money vs. following your passions. (Of course, it's less of an issue for someone as successful as Paul Graham.) This quote, in particular, stuck out:
It's not that unprestigious types of work are good per se. But when you find yourself drawn to some kind of work despite its current lack of prestige, it's a sign both that there's something real to be discovered there, and that you have the right kind of motives. Impure motives are a big danger for the ambitious. If anything is going to lead you astray, it will be the desire to impress people. So while working on things that aren't prestigious doesn't guarantee you're on the right track, it at least guarantees you're not on the most common type of wrong one.
10 Years of Open-Source Visualization by Mike Bostock
Another retrospective post, this one from the creator of D3.js. A much quicker read than What I Worked On, Mike has some general advice for creating visualizations as well as reflections on creating and maintaining a wildly popular open-source project.
The only way to recognize — and then bridge — the gulf of understanding between you and people using your tool is to observe their struggles and talk to them. It’s amazing how quickly glaring flaws are revealed this way. Answering questions on Stack Overflow (or GitHub, Twitter, Slack, or wherever else) is not a selfless act of altruism; it’s a chance to learn, to find where people struggle and hear their perspective.
What I'm Working On
I finished up my Rust social card generator, got it compiled to WebAssembly, and embedded inside a Vercel serverless function to work on my blog.
Predictably, I added a lot more features and it ended up much more complex than I expected, but I'm pretty happy with the end result. I'll write a blog post about some details in the near future.
If you enjoyed this newsletter, I'd love if you share it with a friend (sign up here) or just reply to this email with your thoughts. Thanks for reading!