std.dom.update
dom-apply
multimethod
added in 3.0
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}
dom-apply-default
added in 3.0
(dom-apply-default dom ops)default function for dom-apply
(-> (dom-apply-default (doto (base/dom-compile [:mock/pane {:items “a”}]) (impl/dom-render)) :update :items :list-set 0 "A") (base/dom-item) (mock/mock-format)) => [:mock/pane {:items “A”}]
dom-refresh
added in 3.0
(dom-refresh dom)refreshes current dom, used for components
(-> (base/dom-compile :mock/pane {:b 2}) (impl/dom-render) (dom-refresh) str read-string) => :+ :mock/pane {:b 2}
dom-update
added in 3.0
(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}]
update-list
added in 3.0
(update-list dom k list ops)updates a list within props
(update-list (impl/dom-render (base/dom-compile :mock/pane “a”)) :items “a” :list-set 0 "A" "a") => “A”
update-list-append
added in 3.0
(update-list-append list [_ new])updates :append changes to list
(update-list-append “A” :list-append “B”) => “A” “B”
update-list-drop
added in 3.0
(update-list-drop list [_ old])updates :drop changes to list
(update-list-drop “A” “B” :list-drop “B”) => “A”
update-list-insert
added in 3.0
(update-list-insert list [_ i items])update-list-remove
added in 3.0
(update-list-remove list [_ i number])updates the list by deleting values
(update-list-remove 1 2 3 4 :list-remove 1 2) => 1 4
update-list-update
added in 3.0
(update-list-update list [_ k ops])updates :update changes to list
(update-list-update [(-> (base/dom-compile :mock/label) (impl/dom-render))] [:update 0 :set :text "hello"]) => (contains #(= “hello” (:text (:props %))))
update-props
added in 3.0
(update-props dom props ops)updates props of doms
(update-props (base/dom-compile :mock/label) {} :set :text "hello") => {:text “hello”}
update-props-delete
added in 3.0
(update-props-delete props [_ k old])updates props given an operation
(update-props-delete {:text “hello”} :delete :text “hello”) => {}
update-props-update
added in 3.0
(update-props-update dom props [_ k ops :as op])updates :update changes to props
(update-props-update (doto (base/dom-compile :mock/pane) impl/dom-render) {:items “A”} [:update :items :list-set 0 "B"]) => {:items “B”}
update-set
added in 3.0
(update-set props [_ k new old])sets props given a transform
(update-set {} :set :a 1) => {:a 1}
(update-set {} [:set :a (base/dom-compile :mock/label “hello”)]) => (contains {:a base/dom?})