-
-
Notifications
You must be signed in to change notification settings - Fork 35
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat: Add FiniteStateMachine #111
Conversation
🦋 Changeset detectedLatest commit: c9fd7f7 The changes in this PR will be included in the next version bump. This PR includes changesets to release 1 package
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
built with Refined Cloudflare Pages Action⚡ Cloudflare Pages Deployment
|
A lil' demo video of the demo at the top of the docs: CleanShot.2024-07-02.at.16.49.32.mp4 |
Could you capitalize the types in the example code? It's a typescript convention. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Awesome work, thank you so much! Left a few comments :)
packages/runed/src/lib/utilities/FiniteStateMachine/FiniteStateMachine.svelte.ts
Show resolved
Hide resolved
packages/runed/src/lib/utilities/FiniteStateMachine/FiniteStateMachine.svelte.ts
Outdated
Show resolved
Hide resolved
packages/runed/src/lib/utilities/FiniteStateMachine/FiniteStateMachine.svelte.ts
Show resolved
Hide resolved
packages/runed/src/lib/utilities/FiniteStateMachine/FiniteStateMachine.svelte.ts
Outdated
Show resolved
Hide resolved
packages/runed/src/lib/utilities/FiniteStateMachine/FiniteStateMachine.svelte.ts
Outdated
Show resolved
Hide resolved
Thanks @TGlide for the excellent review.
@TGlide thanks, what a lovely review. I fixed all the things except for the generic vs type assertion. I don't have a better idea, but from a DX perspective, I definitely want the current state to be of type |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you again! LGTM 🎉
Adds a new
useFSM
rune that allows you to create minimalistic finite state machines.Ported over from https://github.com/githubnext/tiny-svelte-fsm (which was already MIT, and I'm the author there). I made a couple of minor fixes along the way as well, mostly to enable people to call
.debounce
in actions and lifecycle handlers.This PR includes:
✅ Docs with an interactive demo and examples
✅ Tests
Per our conversation in the Svelte Discord: