Skip to content
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

#228 HTMX attributes prototype #250

Merged
merged 3 commits into from
Jan 23, 2024

Conversation

JPonte
Copy link
Contributor

@JPonte JPonte commented Jan 6, 2024

I was intrigued by this issue #228 and decided to see what the fuss is all about with this htmx.

I found it quite interesting to use Tyrian exclusively in the server and ship only the htmx.js to provide client side logic so I created a sandbox with JVM only that does that.
I'm no expert in htmx and there are way more features that I'd like to explore in the future, for now this is really barebones.

One thing I'm not happy with is the Trigger part for the hx-trigger.

Trigger(tyrian.htmx.Event.Input)
  .withModifiers(Modifier.Changed, Modifier.Delay("300ms")),
Trigger(tyrian.htmx.Event.KeyDown)
  .withFilter("key=='Enter'")
  .withModifiers(Modifier.From("body"))

gets correctly "compiled" to input changed delay:1500ms, keydown[key=='Enter'] from:body but feels a bit too verbose.

I'm not sure if this is of any use and if it's what you had in mind in the issue but I thought I'd share anyway😅

@davesmith00000 davesmith00000 requested a review from a team January 6, 2024 22:25
@davesmith00000
Copy link
Member

This is exactly what I had in mind, amazing! You are a hero. 🙇 🥇

@JPonte JPonte marked this pull request as ready for review January 17, 2024 22:30
@JPonte
Copy link
Contributor Author

JPonte commented Jan 17, 2024

I added a few more examples, including one with websockets and server side SVG generation which I found quite fun and maybe useful to someone 😄
I think there are lot more features that I didn't explore yet but these basic attributes seem already enough to do some interesting things.

Copy link
Member

@davesmith00000 davesmith00000 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fantastic work @JPonte! Apologies for the delay getting around to this PR.

I really don't have any feedback on the work. I've tried it, it works brilliantly, I love Love LOVE the game of life demo! 😍

Being as I am, not an HTMX expert 😋, I think the best thing to do is just put it out there and await feedback.

I'll hit the approve button, my only question to you is: Are you happy? Do you think it's good as a first cut? Anything else you want to do to it?

@davesmith00000
Copy link
Member

htmx-game-of-life
Love it. 😁

@JPonte
Copy link
Contributor Author

JPonte commented Jan 23, 2024

Yes, I think I'm happy as it is right now.

I hope to actually use it myself soon in more personal projects. I really liked remaining fully on the server side for the whole stack 😀

Maybe I'll have something else to add later but for now, I think it's a good start.

@davesmith00000 davesmith00000 merged commit 9a1abda into PurpleKingdomGames:main Jan 23, 2024
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants