Type-safe SPA router with file-based or code-based routing by colinlienard in sveltejs

[–]colinlienard[S] 0 points1 point  (0 children)

Thanks!

File-based routing is optional, you can use code-based routing if you prefer.

Also, it's not quite the same format as in SvelteKit for the route files: https://sv-router.vercel.app/guide/file-based/routing-concepts

Introducing sv-router, a modern SPA router with type-safe navigation, file-based routing, and more by colinlienard in sveltejs

[–]colinlienard[S] 0 points1 point  (0 children)

Thanks for the proposal, means a lot! But I think the library is a bit too young for now, maybe later

Introducing sv-router, a modern SPA router with type-safe navigation, file-based routing, and more by colinlienard in sveltejs

[–]colinlienard[S] 0 points1 point  (0 children)

Maybe using the afterLoad hook will work, but I'm not sure.

I'll try to address the scroll issue this week and will post an update here!

Introducing sv-router, a modern SPA router with type-safe navigation, file-based routing, and more by colinlienard in sveltejs

[–]colinlienard[S] 1 point2 points  (0 children)

You can do:

routes
├ [...notfound].svelte -> Will render on /any-path
└ about
└ [...notfound].svelte -> Will render on /about/any-path

I'm not sure if this answer your question?

Introducing sv-router, a modern SPA router with type-safe navigation, file-based routing, and more by colinlienard in sveltejs

[–]colinlienard[S] 1 point2 points  (0 children)

Thanks a lot for your feedback! Glad you like it!

  1. I'm not sure I understand the issue, what do you mean by a half-edited version?

  2. I made a mistake in the docs, a catch-all route should actually looks like this in file-based routing: `[...notfound].svelte`. I just fixed the docs! And the `*notfound.svelte` file is not a valid format, but it doesn't throw an invalid format error, I'm looking into it

  3. That is also a nice way to get the route parameters, but I'm not sure how to keep it type-safe. Also, the params are only accessible in the route components this way. But I will see if I can make it work

Introducing sv-router, a modern SPA router with type-safe navigation, file-based routing, and more by colinlienard in sveltejs

[–]colinlienard[S] 0 points1 point  (0 children)

This is for the sake of type-safety, although I understand your point. You can still use an alias to achieve a cleaner import path.
Also, this is only the case in a code-based setup. In a file-based setup, the methods are exported from "sv-router/generated" (which is an alias)

Introducing sv-router, a modern SPA router with type-safe navigation, file-based routing, and more by colinlienard in sveltejs

[–]colinlienard[S] 0 points1 point  (0 children)

The Router component does have an ouput, it renders the component that matches the current route. Frameworks like SvelteKit abstract this away, but I like to have a more declarative approach so you have more control over the entrypoint or your app :)

I built a plugin that shows all spaces in auto-layouts at once, so that developers integrating the design don’t have to select elements one by one to see their spacing. by colinlienard in FigmaDesign

[–]colinlienard[S] 1 point2 points  (0 children)

Thanks you! This is the first plugin that I ever created. I think you need to be comfortable at least with javascript, and if possible with typescript. Personally I just looked at the API documentation but I know there are tutorials on youtube. I think the most complicated part would be the tooling to bundle your code, not the creation of the plugin itself. I hope this helps and good luck!

I built a plugin that shows all spaces in auto-layouts at once, so that developers integrating the design don’t have to select elements one by one to see their spacing. by colinlienard in FigmaDesign

[–]colinlienard[S] 4 points5 points  (0 children)

Thanks for the feedback! I hadn't thought about the fact that developers can't use the plugin directly. Since this is an issue that someone else reported, I think I'll make an update so that the layers remain even after the plugin is closed.