nicojs / typed-html

TypeSafe HTML templates using TypeScript. No need to learn a template library.
332 stars 50 forks source link

Alpine Js support #48

Open dullkingsman opened 6 months ago

dullkingsman commented 6 months ago

I am trying to use Alpine JS for a bit of client-side interactivity and it has directives that use syntax that are not supported. I was able to bypass some of them, but there is no way around some of them. For example,

<input @click="...">

could be updated to work as

<input x-on:click="...">

but something like:

<input x-on:keyup.enter="...">

is not possible to include because of the . and Alpine does not provide alternatives.

It would be great to provide support for this. Or maybe provide a way to escape illegal characters.

believelody commented 1 month ago

Hi, the only workaround I found is as follows: <input {...{ "x-on:keyup.enter": "..." }} /> Very very...ugly but...since attributes are key/value pair as tag is an object, this works.