 
 ;; --- Text Component
 
-(declare text-shape)
+(declare text-shape-html)
 (declare text-shape-wrapper)
 (declare text-shape-edit)
 

  [own]
  (let [[shape] (:rum/args own)
        dom (mx/ref-node own "fobject")
        html (mx/render-static-html (text-shape shape))]
    (set! (.-innerHTML dom) html))
    own)


                     :width width
                     :height height}]))

;; --- Text Shape Html

(mx/defc text-shape-html
  [{:keys [content] :as shape}]
  (let [style (make-style shape)]
    [:div {:style style} content]))


;; --- Text Shape Html

(mx/defc text-shape
  {:mixins [mx/static]
   :did-mount text-shape-wrapper-did-mount
   :did-remount text-shape-wrapper-did-remount}
  [{:keys [id content tmp-resize-xform tmp-displacement] :as shape}]
  (let [xfmt (cond-> (gmt/matrix)
                tmp-displacement (gmt/translate tmp-displacement)
                tmp-resize-xform (gmt/multiply tmp-resize-xform))

        {:keys [x1 y1 width height] :as shape} (-> (geom/transform shape xfmt)
                                                   (geom/size))
        style (make-style shape)]
    [:foreignObject {:x x1
                     :y y1
                     :id (str id)
                     :ref "fobject"
                     :width width
                     :height height}
     [:div {:style style}
      [:p content]]]))
