AlexxNB / tinro

Highly declarative, tiny, dependency free router for Svelte's web applications.
MIT License
669 stars 30 forks source link

Use action parameters #86

Open Prinzhorn opened 2 years ago

Prinzhorn commented 2 years ago

I find it very odd to use exact or active-class attributes (even with data-*). This feels like jQuery-esque 2008 era code and not like Svelte.

Can we migrate this to:

<a href="/page" use:active={{exact: true, activeClass: 'super-active'}}>Link</a>

?

Edit: This would even allow for a third argument, a function that returns a boolean. So that you can implement custom logic.

<a href="/page" use:active={{test: route => route.path.includes('some-token')}}>Link</a>
Prinzhorn commented 2 years ago

For tinro-ignore I suggest a use:ignore action that handles this behind the scenes. Either by adding a data-tinro-ignore for you or by keeping a WeakSet<Node> that you can test against inside aClickListener (this would not pollute the DOM with an unnecessary attribute)

AlexxNB commented 2 years ago

I like attributes notation more. Mustaches looks dirty.

Prinzhorn commented 2 years ago

Interesting, but Svelte uses Mustaches all over the place?

AlexxNB commented 2 years ago

I mean double curves