finds.dev← search

// the find

swyxio/svelte-actions

★ 219 · TypeScript · MIT · updated Sep 2022

prototype official actions for Svelte

A grab-bag of six small Svelte actions (clickOutside, longpress, pannable, lazyload, preventTabClose, shortcut) that swyx put together as a proposal for official Svelte actions. It's for someone who wants a quick look at how a specific DOM interaction pattern is typically wired up in Svelte, not for someone looking for a dependency to install.

Each action is a single small file doing one thing, so they're easy to read end to end and just copy into your own codebase instead of taking on the package as a dependency. It has per-action test coverage (contributed later by a community member), which is unusual rigor for what's essentially a snippet collection. The set covers real recurring gaps in Svelte (click-outside, pan gestures, keyboard shortcuts) that a lot of apps end up reinventing badly.

The README says outright not to rely on it because APIs may change, and that warning has aged into a fact: no commits since September 2022, so it predates Svelte 4 and 5 entirely and there's no evidence any of this works with runes or the newer action typing. The six actions don't share a consistent calling convention — clickOutside takes an options object, longpress takes a raw number, preventTabClose takes positional args — so there's no real API design here, just six independent experiments. It never graduated into Svelte core or into a maintained standalone package despite that being the explicit point of the RFC, so adopting it today means inheriting an abandoned prototype rather than a supported library.

View on GitHub →

// want more like this?

We dig through GitHub every week and send a few repos picked for what you actually care about — each with an honest take like this one.

Get finds in your inbox → Search again →