Fork me on GitHub
#biff
<
2022-12-22
>
Lyn Headley00:12:39

Might be nice to write hyperscript in sexps

Lyn Headley00:12:51

Not sold on hyperscript yet. Reconsidering jQuery believe it or not.

Jacob O'Bryant01:12:41

nothing wrong with that 🙂 I don't use that much hyperscript myself, just a line or two here and there. Just did grep -R ':_' on Yakread out of curiosity and got this:

com/yakread/ui.clj:                      :_ "on click toggle .hidden on .top-nav"})
com/yakread/ui.clj:                      :_ "on click toggle .hidden on .top-nav"})]
com/yakread/ui.clj:      :_ "on error remove me"
com/yakread/ui.clj:              :_ "on error remove me"
com/yakread/subscribe.clj:       :_ "on error remove me"
com/yakread/subscribe.clj:                  :_ "on load set my value to window.location.href"}]
com/yakread/subscribe.clj:                  :_ "on load set my value to document.referrer"}]
com/yakread/feat/home.clj:            :_ "on load set my value to window.location.href"}]
com/yakread/feat/home.clj:            :_ "on load set my value to document.referrer"}]
com/yakread/feat/app/social.clj:      [:button.btn.mastodon-form-toggle {:_ "on click toggle .hidden on .mastodon-form-toggle"}
com/yakread/feat/app/books.clj:                     :_ "on load call me.focus()"})]
com/yakread/feat/app/books.clj:                    :_ "on change call uploadFile(me, '/connections/epub/upload')"
com/yakread/feat/app/share.clj:          :_ "on click put 'Copied!' into me"}
com/yakread/feat/app/share.clj:       :_ "on error remove me"
com/yakread/feat/app/subscriptions.clj:       {:_ "on click toggle .hidden on .email-form"}
com/yakread/feat/app/subscriptions.clj:                   :_ "on click if #subscriptions match .hidden toggle .hidden on .expand-collapse end"}
com/yakread/feat/app/subscriptions.clj:    [:button.link#expand-collapse {:_ "on click toggle .hidden on .expand-collapse"}
com/yakread/feat/app/subscriptions.clj:                             :_ "on htmx:afterRequest remove <div.rss-sub-item/>"}
com/yakread/feat/app/read_later.clj:                    :_ "on change call uploadFile(me, '/upload/pdf')"
for anything more complicated than that I just add a plain JS file or use htmx

Jacob O'Bryant01:12:00

(`uploadFile` is an example; I define the function in js and just use hyperscript to call it)

loganrios03:12:33

Implemented my first line of hyperscript last night, and must admit I also just used it to toggle a .hidden. I’ve a bit of a wild hair to try and implement Borkdude’s Squint/Cherry to see if I can write CLJS and have it output little baby JS, rather than bring in all of the CLJS compiler, but I haven’t had a use case that demanded it yet… edit: https://github.com/squint-cljs/squint

Lyn Headley04:12:18

I was thinking the same, bring in squint somehow.