mirror of
https://github.com/penpot/penpot.git
synced 2025-06-14 18:51:38 +02:00
🎉 Improved transformations
This commit is contained in:
parent
d050103f58
commit
b73958efd0
21 changed files with 1257 additions and 1017 deletions
37
frontend/src/uxbox/util/debug.cljs
Normal file
37
frontend/src/uxbox/util/debug.cljs
Normal file
|
@ -0,0 +1,37 @@
|
|||
(ns uxbox.util.debug
|
||||
"Debugging utils")
|
||||
|
||||
(def debug-options #{:bounding-boxes :group :events #_:simple-selection})
|
||||
|
||||
(defonce ^:dynamic *debug* (atom #{}))
|
||||
|
||||
(defn debug-all! [] (reset! *debug* debug-options))
|
||||
(defn debug-none! [] (reset! *debug* #{}))
|
||||
(defn debug! [option] (swap! *debug* conj option))
|
||||
(defn -debug! [option] (swap! *debug* disj option))
|
||||
(defn debug? [option] (@*debug* option))
|
||||
|
||||
(defn tap
|
||||
"Transducer function that can execute a side-effect `effect-fn` per input"
|
||||
[effect-fn]
|
||||
|
||||
(fn [rf]
|
||||
(fn
|
||||
([] (rf))
|
||||
([result] (rf result))
|
||||
([result input]
|
||||
(effect-fn input)
|
||||
(rf result input)))))
|
||||
|
||||
(defn logjs
|
||||
([str] (tap (partial logjs str)))
|
||||
([str val]
|
||||
(js/console.log str (clj->js val))
|
||||
val))
|
||||
|
||||
(defn dump-state []
|
||||
(logjs "state" @uxbox.main.store/state))
|
||||
|
||||
(defn dump-objects []
|
||||
(let [page-id (get @uxbox.main.store/state :page-id)]
|
||||
(logjs "state" (get-in @uxbox.main.store/state [:workspace-data page-id :objects]))))
|
Loading…
Add table
Add a link
Reference in a new issue