(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]]
(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]]
(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]
(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"]]]]
(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"]]]]
(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"]
(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]]]]]
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]]
(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]]
cljdoc is a website building & hosting documentation for Clojure/Script libraries
× close