(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"]}(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(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)(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?(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"]}(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
(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"]](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?(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(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(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"](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(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(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(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})(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(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?(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(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"}](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(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-(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}(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
(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(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(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"]}}(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 {}))
=> truecljdoc builds & hosts documentation for Clojure/Script libraries
| Ctrl+k | Jump to recent docs |
| ← | Move to previous article |
| → | Move to next article |
| Ctrl+/ | Jump to the search field |