What design do you think would be better?
Since they have a full "Datastar expression" language, I'd just expand that. Then you wouldn't need these weird constructs:
<button data-on-click__window__debounce.500ms.leading="$foo = ''"></button>By expanding the "Datastar expression" language, do you mean a compiled language or moving all the expressions into JS files or something else?
Doesn't matter. They literally already have a Javascript-like DSL: https://data-star.dev/guide/datastar_expressions