Everything about this seems so bad! The website doesn't look serious at all. The code adds crazy html attributes, even more crazy than other crazy front-end frameworks like `data-on-input__debounce.200ms="@get('/examples/active_search/search')"`... this level of wrong is incredible.
What more do you need than writing something like `data-on-input__debounce.200ms="@get('/examples/active_search/search')"` in the DOM as being crazy and wrong?
The poster provided an example of poor abstraction. HTML for display, JS for client side logic. Combining them is part of the problem with other popular frameworks.
No, it's the entire point of datastar - that you don't need much JavaScript at all because some simple html attributes do most of it for you, and any extra can either go in-line, or you can also just fallback to separate js scripts if needed.
I mean, that seems ugly to me, but... Makes intuitive sense and is fine actually? Is HTML a rich language in which to embed stuff like this? No. Does this clearly get the point across? Yes.
[Edit: this should've actually been attached to the GP comment. I agree with the parent.]
Isn't that the whole point of hypermedia frameworks like Datastar and HTMX? It's to extend the declarativeness of HTML.
If you don't like the syntax, that's your preference. But I'm curious to hear why this is "wrong". Since that's a more objective thing, we can discuss it
But again, the API design woes are subjective and I think it's perfectly fine to iterate on getting this to a nicer state.
"Wrong" to me suggests a gap in the understanding of fundamentals or of how things work. If the ideas of Datastar are fine to all of us, and our issues with it are ergnomics, then that can be a more focused discussion.
We are limited to what is possible in the data dash-* spec. If you have better syntax that's going to work everywhere in every browser please let us know!
This wilful insanity is completely incomprehensible to me (HTMX and lit are also fully infected with it): "Oh no, we are just HTML, we can't do anything" while literally doing tons of things outside of HTML.
> What's your alternative that stay HTML spec compliant?
Again: you literally have a custom Javascript-like DSL in Datastar. Use that.
It's like the "it's just HTML" or "it's HTML-compliant" mantra somehow damages the brain, or something.
Edit: this custom JS-like DSL is so prominent and such a crucial part of Datastar, that it's referenced in the very first paragraph of reference: https://data-star.dev/reference
Oh, look, your HTML-spec-compliant thing in which it is apparently impossible to do anything outside data-* attributes somehow calls external functions, and updates signals, and reads signals, and does all sorts of things:
Both Datastar and HTMX have the same issue: they want to pretend to be HTML. So they force themselves into writing several DSLs like this to pretend that this is still "just HTML".
Since they have a full "Datastar expression" language, I'd just expand that. Then you wouldn't need these weird constructs: