New mxWeb artifact tiltontec/mxweb/0.3.0-SNAPSHOT/mxweb-0.3.0-20230118.174709-8.pom now has better support for custom attributes and -- wait for it -- SVG! Thanks to @dawdler for the push on SVG. 🙏
The code:
(defn basic-shapes []
;;
(svg {:width 200 :height 250}
(rect {:x 10 :y 10 :width 30 :height 30
:stroke :black :stroke-width 5 :fill :transparent})
(rect {:x 60 :y 10 :rx 10 :ry 10 :width 30 :height 30
:stroke :black :stroke-width 5 :fill :transparent})
(circle {:cx 25 :cy 75 :r 20 :stroke :red :stroke-width 5 :fill :transparent})
(ellipse {:cx 75 :cy 75 :rx 20 :ry 5 :stroke :red :stroke-width 5 :fill :transparent})
(line {:x1 10 :x2 50 :y1 110 :y2 150 :stroke :orange :stroke-width 5})
(polyline {:points [60 110 65 120 70 115 75 130 80 125 85 140 90 135 95 150 100 145]
:stroke :orange :stroke-width 5 :fill :transparent})
(polygon {:points [50 160 55 180 70 180 60 190 65 205 50 195 35 205 40 190 30 180 45 180]
:stroke :green :stroke-width 5 :fill :transparent})
(path {:d ["M20,230" "Q40,205" "50,230" "T90,230"]
:fill :none :stroke :blue :stroke-width 5})))
(defn main []
(println "[main]: loading")
(let [root (gdom/getElement "app") ;; must be defined in index.html
app-matrix (md/make :mx-dom (cFonce (md/with-par me
[(basic-shapes)])))
app-dom (tag-dom-create
(mget app-matrix :mx-dom))]
(set! (.-innerHTML root) nil)
(gdom/appendChild root app-dom)))
(main) Important fix to :id handling: tiltontec/mxweb/0.3.0-SNAPSHOT/mxweb-0.3.0-20230118.192034-9.jar