Liking cljdoc? Tell your friends :D

std.dom.diff


diff-listclj

(diff-list list-old list-new)

constructs diffs for a lists

(diff-list [:a :b :c] [:b]) => [[:list-remove 0 1] [:list-remove 1 1]]

constructs diffs for a lists

(diff-list [:a :b :c] [:b])
=> [[:list-remove 0 1]
    [:list-remove 1 1]]
raw docstring

diff-list-domclj

(diff-list-dom list-old list-new)

simplified list comparison using :dom/key

(diff-list-dom [(base/dom-compile [:mock/pane {:dom/key 3}]) (base/dom-compile [:mock/pane {:dom/key 1}]) (base/dom-compile [:mock/pane {:dom/key 2}]) (base/dom-compile [:mock/pane {:dom/key 4}])] [(base/dom-compile [:mock/pane {:dom/key 1}]) (base/dom-compile [:mock/pane {:dom/key 2}])]) => [[:list-remove 0 1] [:list-remove 2 1]]

simplified list comparison using :dom/key

(diff-list-dom [(base/dom-compile [:mock/pane {:dom/key 3}])
                (base/dom-compile [:mock/pane {:dom/key 1}])
                (base/dom-compile [:mock/pane {:dom/key 2}])
                (base/dom-compile [:mock/pane {:dom/key 4}])]
               [(base/dom-compile [:mock/pane {:dom/key 1}])
                (base/dom-compile [:mock/pane {:dom/key 2}])])
=> [[:list-remove 0 1] [:list-remove 2 1]]
raw docstring

diff-list-elementclj

(diff-list-element i x-old x-new)

diffs for elements within a list

(diff-list-element 0 1 2) => [:list-set 0 2 1]

diffs for elements within a list

(diff-list-element 0 1 2)
=> [:list-set 0 2 1]
raw docstring

diff-list-elementsclj

(diff-list-elements list-old list-new)

diff elements in array, limit to shortest array

(diff-list-elements [:a :b :c] [:b]) => [[:list-set 0 :b :a]]

(diff-list-elements [(base/dom-create :mock/label {} ["hello"])] [(base/dom-create :mock/label {} ["world"])]) => [[:list-update 0 [[:set :text "world" "hello"]]]]

diff elements in array, limit to shortest array

(diff-list-elements [:a :b :c] [:b])
=> [[:list-set 0 :b :a]]

(diff-list-elements [(base/dom-create :mock/label {} ["hello"])]
                    [(base/dom-create :mock/label {} ["world"])])
=> [[:list-update 0 [[:set :text "world" "hello"]]]]
raw docstring

diff-propsclj

(diff-props props-old props-new)

constructs diff for a set of props

(diff-props {:top (base/dom-create :mock/label {} ["hello"])} {:top (base/dom-create :mock/label {} ["world"])}) => [[:update :top [[:set :text "world" "hello"]]]]

constructs diff for a set of props

(diff-props {:top (base/dom-create :mock/label {} ["hello"])}
            {:top (base/dom-create :mock/label {} ["world"])})
=> [[:update :top [[:set :text "world" "hello"]]]]
raw docstring

diff-props-elementclj

(diff-props-element pk pv-old pv-new)

diffs for elements within a props map

(diff-props-element :text "hello" "world") => [:set :text "world" "hello"]

diffs for elements within a props map

(diff-props-element :text "hello" "world")
=> [:set :text "world" "hello"]
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-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-ops-defaultclj

(dom-ops-default tag props-old props-new)

default implementation for diff-ops

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

default implementation for diff-ops

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

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

× close