-
Notifications
You must be signed in to change notification settings - Fork 43
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
Svelte 5 support #304
Comments
Thanks for using this library! I've sadly not used Svelte for the past year or so :( been working with Vue so I haven't looked that much into how runes are used. Specially on libraries since I understand they only work on .svelte.js files? Felte heavily relies on stores to handle state internally (even the adapters for other frameworks use observables internally) Do you have an idea of how you'd expect a runes API to look like for Felte? |
planning to explore the codebase sometime this week. But what I currently have in mind is to replace stores with runes to align the api more to svelte 5. eg. below <script>
let schema = $derived(z.object({ ... }));
let form = createForm({
get extend() {
return validator({schema})
}
}) // or maybe a function that returns a config
<script>
<form use:form.action>
<div>
<input type="email" name="email" />
{#if form.errors.email?.length}
<div>{form.errors.email[0]}</div>
{/if}
</div>
<button type="submit" disabled={form.isSubmitting}>Submit</button>
</form> |
Actually, the package depends on peer svelte@"^3.31.0 || ^4.0.0" which make it unusable with svelte 5. Bumping the svelte peer versions to include v5 will be much appreciated. |
Opened a PR to add |
@calvo-jp I've merged and published your PR. I've checked the new docs and I see even @paradoxe the internals of Felte are quite framework agnostic and accepting runes as parameters would require mayor framework specific code (and the config object has never been anticipated to be reactive). For the returned stores I could imagine a wrapper that creates runes for each data store, subscribes to the stores we use internally and updates the values of said runes. I'd imagine that would mean no more destructuring on the returned object to maintain reactivity, though. |
Tho svelte 5 is backwards compatible, it would be nice if we can have a runes version of this library. I'm a huge fan. Thank you for all the effort you've put in in this lib
The text was updated successfully, but these errors were encountered: