sci 2023-10-27

I'm trying some hoplon on the playground and I think the attribute providers are not being loaded, attributes are not reacting as they should. I tried to require them manually and got ERROR: Could not find namespace hoplon.jquery. {:type :sci/error, :line 3, :column 3, :message "Could not find namespace hoplon.jquery.", :sci.impl/callstack #object[cljs.core.Volatile {:val ({:line 3, :column 3, :file nil, :ns #object[iP view.index]})}], :file nil}. I'm not sure about what I need to do to fix this.

I guess the hoplon.jquery namespace needs to be loaded, I didn't do that since I didn't know why I should be doing that

can you give an example which triggers that error?

That error is shown when I add hoplon.jquery to the requires

don't do that. just give me a code example which shows WHY you need hoplon.jquery at all

I tried to add :toggle to an element with a boolean cell to make the element hide/show when the cell value changed.

please, a self-contained example ;)

I'm writing a simpler one, just a minute

;; hoplon_demo.cljs
(ns view.index
  (:require
    [hoplon.core  :as h]
    [javelin.core :as j]))

(def fade? (j/cell false))
(defn hello []
  (h/div
    (h/h1 "Hello, Hoplon")
    (h/p :toggle fade? "Toggle")
    (h/button :click #(swap! fade? not) "click me")))

(.replaceChildren (.getElementById js/document "app")
    (hello))

When I click the button, the p element should hide/show.

alright. would it be possible to make a hoplon.dom namespace or so which doesn't use jquery? looking at the code, this should be not so much work?

or should I load hoplon.goog perhaps?

it would be better if we would have no goog or jquery, the dom APIs are strong enough these days

hoplon.goog would work.

ok I added this to the playground, try refreshing in 5 minutes or so

I agree. We have that because 10 years ago that was not the case. But I want to create one version that uses dom APIs directly.

And it works! gratitude

Do I have to do something special to use macros? Both j/defc and h/defelem are failing with Evaluation failed: Could not resolve symbol

Those need to be added to the configuration then. I just made work what was mentioned in the README.md of hoplon 🤷 Feel free to make PRs

Ok, thank you. Will do.

Run the playground in development mode so you can test

if you have any questions let me know