Liking cljdoc? Tell your friends :D

std.dom


defcompcljmacro

(defcomp tag doc? attr? & [bindings & body])

defines a component

defines a component
raw docstring

dom-applycljmultimethod

applies operations to the dom (-> (base/dom-create :mock/pane {:a 1}) (impl/dom-render) (dom-apply [[:set :b 2 nil] [:delete :a 1]]) (base/dom-item) :props) => {:b 2}

applies operations to the dom
(-> (base/dom-create :mock/pane {:a 1})
    (impl/dom-render)
    (dom-apply [[:set :b 2 nil]
                [:delete :a 1]])
    (base/dom-item)
    :props)
=> {:b 2}
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-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-diffclj

(dom-diff old new)

returns ops for dom transform

(dom-diff (base/dom-create :mock/pane {:hello 1} [:a :b :c]) (base/dom-create :mock/pane {:hello 2} [:a :B :c])) => [[:set :hello 2 1] [:update :children [[:list-remove 1 1] [:list-insert 1 [:B]]]]]

returns ops for dom transform

(dom-diff (base/dom-create :mock/pane {:hello 1} [:a :b :c])
          (base/dom-create :mock/pane {:hello 2} [:a :B :c]))
=> [[:set :hello 2 1]
    [:update :children [[:list-remove 1 1]
                        [:list-insert 1 [:B]]]]]
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-findclj

(dom-find dom key match)

find dom element

(-> (dom/dom-compile [:mock/pane {:children [[:mock/pane {:tag "A"}] [:mock/pane {:tag "B"}]]}]) (dom-find :tag identity) str read-string) => [:- :mock/pane {:tag "A"}]

find dom element

(-> (dom/dom-compile [:mock/pane {:children [[:mock/pane {:tag "A"}]
                                             [:mock/pane {:tag "B"}]]}])
    (dom-find :tag identity)
    str read-string)
=> [:- :mock/pane {:tag "A"}]
raw docstring

dom-find-allclj

(dom-find-all dom key match)
(dom-find-all dom key match state)

finds all matching dom elements

(-> (dom/dom-compile [:mock/pane {:children [[:mock/pane {:tag "A"}] [:mock/pane {:tag "B"}]]}]) (dom-find-all :tag string?) str read-string) => [[:- :mock/pane {:tag "A"}] [:- :mock/pane {:tag "B"}]]

finds all matching dom elements

(-> (dom/dom-compile [:mock/pane {:children [[:mock/pane {:tag "A"}]
                                             [:mock/pane {:tag "B"}]]}])
    (dom-find-all :tag string?)
    str read-string)
=> [[:- :mock/pane {:tag "A"}] [:- :mock/pane {:tag "B"}]]
raw docstring

dom-initclj

(dom-init obj)

renders the dom element if input is dom and not rendered

(dom-init 1) => 1

(base/dom-format (dom-init (base/dom-create :mock/pane))) => [:+ :mock/pane]

renders the dom element if input is dom and not rendered

(dom-init 1) => 1

(base/dom-format (dom-init (base/dom-create :mock/pane)))
=> [:+ :mock/pane]
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-match?clj

(dom-match? dom key match)

tests dom to match on either function or value

(dom-match? (dom/dom-compile [:mock/pane {:hello "world"}]) :hello string?) => true

tests dom to match on either function or value

(dom-match? (dom/dom-compile [:mock/pane {:hello "world"}])
            :hello
            string?)
=> 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-opscljmultimethod

converts a set of props into operations

(dom-ops :mock/pane {:a 1} {:b 2}) => [[:set :b 2 nil] [:delete :a 1]]

converts a set of props into operations

(dom-ops :mock/pane
          {:a 1}
          {:b 2})
=> [[:set :b 2 nil]
    [:delete :a 1]]
raw docstring

dom-removecljmultimethod

provides an extensible interface removing rendered elem from dom

(-> (base/dom-create :mock/pane {} ["hello"]) (dom-render) (dom-remove) (base/dom-format)) => [:- :mock/pane "hello"]

provides an extensible interface removing rendered elem from dom

(-> (base/dom-create :mock/pane {} ["hello"])
    (dom-render)
    (dom-remove)
    (base/dom-format))
=> [:- :mock/pane "hello"]
raw docstring

dom-rendercljmultimethod

enables rendering of dom ui

(-> (base/dom-create :mock/pane {} ["hello"]) (dom-render) (base/dom-format)) => [:+ :mock/pane "hello"]

enables rendering of dom ui

(-> (base/dom-create :mock/pane {} ["hello"])
    (dom-render)
    (base/dom-format))
=> [:+ :mock/pane "hello"]
raw docstring

dom-renderedclj

(dom-rendered form)

renders the dom and returns the actual element

(dom-rendered [:mock/pane]) => mock/mock?

renders the dom and returns the actual element

(dom-rendered [:mock/pane])
=> mock/mock?
raw docstring

dom-replacecljmultimethod

replaces one dom element with another

(-> (base/dom-create :mock/pane {} ["hello"]) (dom-render) (dom-replace (base/dom-create :mock/pane {} ["world"])) (base/dom-item) :props) => {:children ["world"]}

replaces one dom element with another

(-> (base/dom-create :mock/pane {} ["hello"])
    (dom-render)
    (dom-replace (base/dom-create :mock/pane {} ["world"]))
    (base/dom-item)
    :props)
=> {:children ["world"]}
raw docstring

dom-send-localclj

(dom-send-local dom)

sends events that are in :local/events

sends events that are in :local/events
raw docstring

dom-set-localclj

(dom-set-local dom {:keys [id new key cursor transform mute] :as m})

function for setting local dom

function for setting local dom
raw docstring

dom-set-stateclj

(dom-set-state {:keys [state key cursor new transform mute]
                :or {transform identity}})

sets a state given function params

(def -state- (atom {}))

(do (dom-set-state {:state -state- :key :hello :new 1 :transform str}) @-state-) => {:hello "1"}

sets a state given function params

(def -state- (atom {}))

(do (dom-set-state {:state -state-
                    :key :hello
                    :new 1
                    :transform str})
    @-state-)
=> {:hello "1"}
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-state-handlerclj

(dom-state-handler
  _
  {:keys [cursor state new transform] :as event :or {transform identity}})

updates the state with given value

(dom-state-handler nil {:state (atom {}) :cursor [:data] :new "hello" :transform keyword}) => {:data :hello}

updates the state with given value

(dom-state-handler nil {:state (atom {})
                        :cursor [:data]
                        :new "hello"
                        :transform keyword})
=> {:data :hello}
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-updateclj

(dom-update dom new-dom)

updates current dom given new dom

(-> (doto (base/dom-compile [:mock/pane {:a 1} [:mock/pane {:b 2}] [:mock/pane {:c 3}]]) (impl/dom-render) (dom-update (base/dom-compile [:mock/pane {:a 1} [:mock/pane {:b 2}] [:mock/pane {:c 4}]]))) (base/dom-item) str read-string) => [:mock/pane {:a 1} [:mock/pane {:b 2}] [:mock/pane {:c 4}]]

updates current dom given new dom

(-> (doto (base/dom-compile [:mock/pane {:a 1}
                             [:mock/pane {:b 2}]
                             [:mock/pane {:c 3}]])
      (impl/dom-render)
      (dom-update (base/dom-compile [:mock/pane {:a 1}
                                     [:mock/pane {:b 2}]
                                     [:mock/pane {:c 4}]])))
    (base/dom-item)
    str read-string)
=> [:mock/pane {:a 1} [:mock/pane {:b 2}] [:mock/pane {:c 4}]]
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

event-handlerclj

(event-handler dom)

finds the relevant handler by ancestry

(def -parent- (doto (dom/dom-create :mock/pane) (dom/dom-attach :parent-handler)))

(def -child- (doto (dom/dom-create :mock/pane) (mut/mutable:set :parent -parent-)))

(event-handler -child-) => :parent-handler

finds the relevant handler by ancestry

(def -parent- (doto (dom/dom-create :mock/pane)
                (dom/dom-attach :parent-handler)))

(def -child-  (doto (dom/dom-create :mock/pane)
                (mut/mutable:set :parent -parent-)))

(event-handler -child-)
=> :parent-handler
raw docstring

handle-eventclj

(handle-event dom params item listener data)

handles an event given all necessary inputs

handles an event given all necessary inputs
raw docstring

item-accessclj

(item-access tag item k)

accesses the actual value of the object

(item-access :test/cat (item-create :test/cat {:name "fluffy"}) :name) => "fluffy"

accesses the actual value of the object

(item-access :test/cat
             (item-create :test/cat {:name "fluffy"})
             :name)
=> "fluffy"
raw docstring

item-cleanupcljmultimethod

provides an extensible interface for itement cleanup

(item-cleanup :mock/pane (item-create :mock/pane)) => mock/mock?

provides an extensible interface for itement cleanup

(item-cleanup :mock/pane (item-create :mock/pane))
=> mock/mock?
raw docstring

item-constructorcljmultimethod

returns the given constructor for the tag

(item-constructor :test/date) => fn?

returns the given constructor for the tag

(item-constructor :test/date)
=> fn?
raw docstring

item-createclj

(item-create tag)
(item-create tag props)

generic constructor for creating dom items

(item-create :test/date) => java.util.Date

generic constructor for creating dom items

(item-create :test/date)
=> java.util.Date
raw docstring

item-getterscljmultimethod

returns the getters for the given tag

(item-getters :test/cat) => (contains-in {:name {:type java.lang.String, :fn fn?}})

returns the getters for the given tag

(item-getters :test/cat)
=> (contains-in {:name {:type java.lang.String, :fn fn?}})
raw docstring

item-props-deletecljmultimethod

provides an extensible interface for delete item prop calls

(item-props-delete :test/cat (item-create :test/cat {:name "hello"}) {:name "hello"}) => test.Cat

provides an extensible interface for delete item prop calls

(item-props-delete :test/cat
                   (item-create :test/cat {:name "hello"})
                   {:name "hello"})
=> test.Cat
raw docstring

item-props-setcljmultimethod

provides an extensible interface for set item prop calls

(.getName ^test.Cat (item-props-set :test/cat (item-create :test/cat) {:name "spike"})) => "spike"

(doto (item-create :mock/pane) (#(item-props-set :mock/pane % {:a 1 :b 2})))

provides an extensible interface for set item prop calls


(.getName ^test.Cat
          (item-props-set :test/cat
                          (item-create :test/cat)
                          {:name "spike"}))
=> "spike"

(doto (item-create :mock/pane)
  (#(item-props-set :mock/pane % {:a 1 :b 2})))
raw docstring

item-setterscljmultimethod

returns the setters for the given tag

(item-setters :test/cat) => (contains-in {:name {:type java.lang.String, :fn fn?}})

returns the setters for the given tag

(item-setters :test/cat)
=> (contains-in {:name {:type java.lang.String, :fn fn?}})
raw docstring

item-updateclj

(item-update tag item ops)

updates item given transform operations

(-> (item-update :mock/pane (item-create :mock/pane {:a 1}) [[:delete :a 1] [:set :b 2]]) :props) => {:b 2}

updates item given transform operations

(-> (item-update :mock/pane
                 (item-create :mock/pane {:a 1})
                 [[:delete :a 1]
                  [:set :b 2]])
    :props)
=> {:b 2}
raw docstring

localclj

(local key)
(local dom key)

accesses current local state

(binding [base/local-dom (doto (base/dom-create :mock/label) (mut/mutable:set :cache {:local/state (atom {:hello 1})})) react/react (volatile! #{})] (local :hello)) => 1

accesses current local state

(binding [base/*local-dom* (doto (base/dom-create :mock/label)
                             (mut/mutable:set :cache {:local/state (atom {:hello 1})}))
          react/*react* (volatile! #{})]
  (local :hello))
=> 1
raw docstring

local-domclj

(local-dom dom)

returns the local dom

returns the local dom
raw docstring

local-dom-stateclj

(local-dom-state dom)

returns the local dom state

returns the local dom state
raw docstring

local-parentclj

(local-parent dom)

returns the local dom parent

returns the local dom parent
raw docstring

local-parent-stateclj

(local-parent-state dom)

returns the local dom parent state

returns the local dom parent state
raw docstring

metaclassclj

(metaclass)
(metaclass id)

returns info associated with given metaclass

(metaclass-add :test {:metatype :value :data "hello"})

(metaclass :test) => {:id :test :metatype :value :data "hello"}

returns info associated with given metaclass

(metaclass-add :test {:metatype :value :data "hello"})

(metaclass :test)
=> {:id :test :metatype :value :data "hello"}
raw docstring

metaclass-addclj

(metaclass-add id m)

adds metaclass information

(metaclass-add :test {:metatype :value})

adds metaclass information

(metaclass-add :test {:metatype :value})
raw docstring

metaclass-removeclj

(metaclass-remove id)

removes metaclass information

(metaclass-remove :test)

removes metaclass information

(metaclass-remove :test)
raw docstring

metapropsclj

(metaprops)
(metaprops tag)

returns metaprops info associated with the node

(metaprops-add :test {:tag :test/node})

(metaprops :test/node) => {:tag :test/node, :metaclass :test, :metatype :value}

returns metaprops info associated with the node

(metaprops-add :test {:tag :test/node})

(metaprops :test/node)
=> {:tag :test/node,
    :metaclass :test,
    :metatype :value}
raw docstring

metaprops-addclj

(metaprops-add id m)

adds metaprops information

(metaprops-add :test {:tag :test/node})

adds metaprops information

(metaprops-add :test {:tag :test/node})
raw docstring

metaprops-installclj

(metaprops-install m)

adds metaclass information

(metaprops-install {:test/a {:tag :test/a :metaclass :dom/value :metatype :dom/value}})

adds metaclass information

(metaprops-install {:test/a {:tag :test/a
                             :metaclass :dom/value
                            :metatype :dom/value}})
raw docstring

metaprops-removeclj

(metaprops-remove tag)

removes metaprops information

(metaprops-remove :test/node)

removes metaprops information

(metaprops-remove :test/node)
raw docstring

reactclj

(react ref)
(react ref path & more)

call to react, for use within component

(binding [react (volatile! #{})] (react (atom {:data 1}) [:data])) => 1

call to react, for use within component

(binding [*react* (volatile! #{})]
  (react (atom {:data 1}) [:data]))
=> 1
raw docstring

cljdoc builds & hosts documentation for Clojure/Script libraries

Keyboard shortcuts
Ctrl+kJump to recent docs
Move to previous article
Move to next article
Ctrl+/Jump to the search field
× close