Skip to content

feat: Svelte 5 attachment — @formkit/auto-animate/svelte (#235) - #257

Merged
justin-schroeder merged 1 commit into
masterfrom
feat/235-svelte-attachment
Nov 22, 2026
Merged

justin-schroeder merged 1 commit into
masterfrom
feat/235-svelte-attachment

Conversation

@justin-schroeder

Copy link
Copy Markdown
Member

Closes #235.

<script>
  import { autoAnimate } from '@formkit/auto-animate/svelte'
</script>
<ul {@attach autoAnimate}>…</ul>
<ul {@attach autoAnimate({ duration })}>…</ul>
  • New subpath @formkit/auto-animate/svelte exports autoAnimate, which works bare ((el) => cleanup) or called with options or a plugin (it returns an attachment).
  • No svelte dependency: attachments are plain (el) => cleanup functions. Cleanup calls the controller's destroy().
  • Options are reactive for free: Svelte wraps {@attach autoAnimate({ duration })} in an effect and re-attaches when duration changes. I checked this by compiling a real Svelte 5 component: 0 warnings, emits $.attach(ul, () => autoAnimate({ duration })).
  • use:autoAnimate (Svelte 4 actions) is unchanged.

Wiring: a rollup step, a declarations move, the .d.ts import fix list, and a package.json export.

Tests: svelte-attachment.spec.ts covers bare use, options (duration honored) and cleanup stopping animations. exports.spec.ts checks the built subpath. Full e2e: 106 passed, 8 skipped.

Docs: a new "Svelte 5 attachment" section with an example.

@vercel

vercel Bot commented Nov 22, 2026 •

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated
auto-animate Ready Ready Preview Nov 22, 2026 8:42pm UTC

Request Review

@justin-schroeder
justin-schroeder merged commit 80f6e43 into master Nov 22, 2026
3 checks passed
@justin-schroeder
justin-schroeder deleted the feat/235-svelte-attachment branch November 22, 2026 20:46

This branch was successfully deployed

1 active deployment
Preview — 5341ec12 Deployed Nov 22, 2026 by vercel[bot]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

svelte: use attachments

1 participant