Liking cljdoc? Tell your friends :D

std.dom.common


*current-dom*clj


*dom-event*clj


*dom-handler*clj


*local-dom*clj


children->propsclj

(children->props children tag)

converts children array to props

(children->props ["hello"] :mock/label) => {:text "hello"}

(children->props ["hello"] :mock/pane) => {:children ["hello"]}

converts children array to props

(children->props ["hello"] :mock/label)
=> {:text "hello"}

(children->props ["hello"] :mock/pane)
=> {:children ["hello"]}
raw docstring

component?clj

(component? dom)

checks if metatype is of :dom/component

(component? (dom-new :mock/label {})) => false

checks if metatype is of :dom/component

(component? (dom-new :mock/label {}))
=> false
raw docstring

dom-assertclj

(dom-assert props keys)

asserts that the props are valid (dom-assert {:a 1 :b 2} [:a])

(dom-assert {:a 1 :b 2} [:c]) => (throws)

asserts that the props are valid
(dom-assert {:a 1 :b 2} [:a])

(dom-assert {:a 1 :b 2} [:c])
=> (throws)
raw docstring

dom-attachclj

(dom-attach dom handler)

attaches a handler to a dom node

(-> (dom-attach (dom-create :mock/label) (fn [dom event] event)) :handler) => fn?

attaches a handler to a dom node

(-> (dom-attach (dom-create :mock/label)
                (fn [dom event] event))
    :handler)
=> fn?
raw docstring

dom-childrenclj

(dom-children {:keys [tag props] :as dom})

retrieves children of dom object

(dom-children (dom-create :mock/pane {} ["hello"])) => {:key :children :children ["hello"]}

retrieves children of dom object

(dom-children (dom-create :mock/pane {} ["hello"]))
=> {:key :children
    :children ["hello"]}
raw docstring

dom-cloneclj

(dom-clone dom)

creates shallow copy of a node and its data

(def -a- (dom-create :mock/label)) (def -b- (dom-clone -a-))

(= -a- -b-) => false (dom-equal? -a- -b-) => true

creates shallow copy of a node and its data

(def -a- (dom-create :mock/label))
(def -b- (dom-clone -a-))

(= -a- -b-) => false
(dom-equal? -a- -b-) => true
raw docstring

dom-compileclj

(dom-compile form)
(dom-compile [tag props? & children :as form] create-fn)

compiles a tree structure into a dom

(-> (dom-compile [:mock/pane "hello"]) dom-format) => [:- :mock/pane "hello"]

(-> (dom-compile [:mock/pane [:mock/label "hello"] [:mock/label "world"]]) dom-format) => [:- :mock/pane [:- :mock/label "hello"] [:- :mock/label "world"]]

compiles a tree structure into a dom

(-> (dom-compile [:mock/pane "hello"])
    dom-format)
=> [:- :mock/pane "hello"]

(-> (dom-compile [:mock/pane
                  [:mock/label "hello"]
                  [:mock/label "world"]])
    dom-format)
=> [:- :mock/pane [:- :mock/label "hello"] [:- :mock/label "world"]]
raw docstring

dom-createclj

(dom-create tag)
(dom-create tag props)
(dom-create tag props children)

creates an dom

(dom-create :mock/pane {} ["hello"]) ;; [:- :label "hello"] => dom?

creates an dom

(dom-create :mock/pane {} ["hello"])
;; [:- :label "hello"]
=> dom?
raw docstring

dom-detachclj

(dom-detach dom)

detaches a handler from a dom node

(-> (dom-attach (dom-create :mock/label) (fn [dom event] event)) (dom-detach) :handler) => nil

detaches a handler from a dom node

(-> (dom-attach (dom-create :mock/label)
                (fn [dom event] event))
    (dom-detach)
    :handler)
=> nil
raw docstring

dom-equal?clj

(dom-equal? obj-a obj-b)

checks if two dom elements are equal

(dom-equal? (dom-create :mock/label {} ["hello"]) (dom-create :mock/label {} ["hello"])) => true

checks if two dom elements are equal

(dom-equal? (dom-create :mock/label {} ["hello"])
            (dom-create :mock/label {} ["hello"]))
=> true
raw docstring

dom-formatclj

(dom-format {:keys [tag props] :as dom})

formats dom for printing

(dom-format (dom-create :mock/label {} ["hello"])) => [:- :mock/label "hello"]

formats dom for printing

(dom-format (dom-create :mock/label {} ["hello"]))
=> [:- :mock/label "hello"]
raw docstring

dom-itemclj

(dom-item dom)

returns itement associated with the dom

(-> (dom-new :mock/label {:a 1}) (impl/dom-render) (dom-item)) => mock/mock?

(-> (dom-new :mock/label) (dom-item)) => nil

returns itement associated with the dom

(-> (dom-new :mock/label {:a 1})
    (impl/dom-render)
    (dom-item))
=> mock/mock?

(-> (dom-new :mock/label)
    (dom-item))
=> nil
raw docstring

dom-item?clj

(dom-item? dom)

returns whether dom has associated itement

(dom-item? (dom-new :mock/pane)) => false

(-> (dom-new :mock/pane) impl/dom-render dom-item?) => true

returns whether dom has associated itement

(dom-item? (dom-new :mock/pane))
=> false

(-> (dom-new :mock/pane)
    impl/dom-render
    dom-item?)
=> true
raw docstring

dom-metaclassclj

(dom-metaclass dom)

returns the associated metaclass

(dom-metaclass (dom-new :mock/label {})) => :mock/element

returns the associated metaclass

(dom-metaclass (dom-new :mock/label {}))
=> :mock/element
raw docstring

dom-metapropsclj

(dom-metaprops dom)

checks dom for ui type

(dom-metaprops (dom-new :mock/label {})) => (contains {:tag :mock/label :construct fn? :children {:key :text :single true} :metaclass :mock/element :metatype :dom/element})

checks dom for ui type

(dom-metaprops (dom-new :mock/label {}))
=> (contains {:tag :mock/label
              :construct fn?
              :children {:key :text :single true}
              :metaclass :mock/element
              :metatype :dom/element})
raw docstring

dom-metatypeclj

(dom-metatype dom)

returns the associated metatype

(dom-metatype (dom-new :mock/label {})) => :dom/element

returns the associated metatype

(dom-metatype (dom-new :mock/label {}))
=> :dom/element
raw docstring

dom-newclj

(dom-new)
(dom-new obj)
(dom-new tag props)
(dom-new tag props item parent handler shadow cache extra)

creates a new dom type

(dom-new :mock/label {}) => dom?

creates a new dom type

(dom-new :mock/label {})
=> dom?
raw docstring

dom-props-equal?clj

(dom-props-equal? props-a props-b)

checks if two dome nodes have the same props

(dom-props-equal? {:a 1 :b 2} {:a 1 :b 2}) => true

checks if two dome nodes have the same props

(dom-props-equal? {:a 1 :b 2}
                  {:a 1 :b 2})
=> true
raw docstring

dom-split-propsclj

(dom-split-props props)
(dom-split-props props lookup select)

splits :on namespace keywords

(dom-split-props {:on/item :event/item :item "hello"}) => [{:on/item :event/item} {:item "hello"}]

splits :on namespace keywords

(dom-split-props {:on/item :event/item
                  :item "hello"})
=> [{:on/item :event/item} {:item "hello"}]
raw docstring

dom-tags-equal?clj

(dom-tags-equal? obj-a obj-b)

checks if two dom nodes have the same tags

(dom-tags-equal? (dom-create :mock/label) (dom-create :mock/label)) => true

checks if two dom nodes have the same tags

(dom-tags-equal? (dom-create :mock/label)
                 (dom-create :mock/label))
=> true
raw docstring

dom-topclj

(dom-top dom)

returns the top-most dom element

(def -a- (dom-create :mock/label)) (def -b- (dom-create :mock/pane {} [(dom-create :mock/pane {} [-a-])]))

(dom-top -a-) => -b-

returns the top-most dom element

(def -a- (dom-create :mock/label))
(def -b- (dom-create :mock/pane {} [(dom-create :mock/pane {} [-a-])]))

(dom-top -a-) => -b-
raw docstring

dom-triggerclj

(dom-trigger {:keys [parent handler] :as dom} event)

triggers an event, propogating up the dom hierarchy

(def -p- (promise))

(-> (dom-create :mock/label) (dom-attach (fn [dom event] (deliver -p- event) nil)) (dom-trigger {:a 1 :b 2}))

@-p- => {:a 1, :b 2}

triggers an event, propogating up the dom hierarchy

(def -p- (promise))

(-> (dom-create :mock/label)
    (dom-attach (fn [dom event] (deliver -p- event) nil))
    (dom-trigger {:a 1 :b 2}))

@-p- => {:a 1, :b 2}
raw docstring

dom-vector?clj

(dom-vector? obj)

checks if a vector can be a dom representation

(dom-vector? [:fx/label ""]) => true

(dom-vector? ^:data [:fx/label ""]) => false

checks if a vector can be a dom representation

(dom-vector? [:fx/label ""])
=>  true

(dom-vector? ^:data [:fx/label ""])
=> false
raw docstring

dom?clj

(dom? obj)

checks if object is an dom

(dom? (dom-create :mock/label {} ["hello"])) => true

checks if object is an dom

(dom? (dom-create :mock/label {} ["hello"]))
=> true
raw docstring

element?clj

(element? dom)

checks if metatype is of :dom/element

(element? (dom-new :mock/label {})) => true

checks if metatype is of :dom/element

(element? (dom-new :mock/label {}))
=> true
raw docstring

props-applyclj

(props-apply props action)

applies an action to props map

(props-apply {:a (dom-create :mock/label {:text "hello"}) :b (dom-create :mock/pane {} ["world"])} (comp :props dom-item impl/dom-render)) => {:a {:text "hello"}, :b {:children ["world"]}}

applies an action to props map

(props-apply {:a (dom-create :mock/label {:text "hello"})
              :b (dom-create :mock/pane {} ["world"])}
             (comp :props dom-item impl/dom-render))
=> {:a {:text "hello"},
    :b {:children ["world"]}}
raw docstring

value?clj

(value? dom)

checks if metatype is of :dom/value

(value? (dom-new :mock/insets {})) => true

checks if metatype is of :dom/value

(value? (dom-new :mock/insets {}))
=> true
raw docstring

cljdoc is a website building & hosting documentation for Clojure/Script libraries

× close