mirror of
https://github.com/penpot/penpot.git
synced 2025-02-09 08:38:15 -05:00
Merge pull request #4079 from penpot/hiru-enhance-debug-tool
🔧 Improve debug tool
This commit is contained in:
commit
e1befadc18
1 changed files with 32 additions and 5 deletions
|
@ -17,12 +17,42 @@
|
||||||
[debug :as dbg]
|
[debug :as dbg]
|
||||||
[rumext.v2 :as mf]))
|
[rumext.v2 :as mf]))
|
||||||
|
|
||||||
|
(def display-attrs
|
||||||
|
[:type
|
||||||
|
:id
|
||||||
|
:parent-id
|
||||||
|
:frame-id
|
||||||
|
:shapes
|
||||||
|
:component-id
|
||||||
|
:component-file
|
||||||
|
:component-root
|
||||||
|
:main-instance
|
||||||
|
:shape-ref
|
||||||
|
:x
|
||||||
|
:y
|
||||||
|
:width
|
||||||
|
:height
|
||||||
|
:selrect
|
||||||
|
:points
|
||||||
|
:transform
|
||||||
|
:transform-inverse])
|
||||||
|
|
||||||
(def remove-attrs
|
(def remove-attrs
|
||||||
#{:id :name})
|
#{:name, :remote-synced})
|
||||||
|
|
||||||
(def vertical-layout-attrs
|
(def vertical-layout-attrs
|
||||||
#{})
|
#{})
|
||||||
|
|
||||||
|
(defn get-attrs
|
||||||
|
[shape]
|
||||||
|
(let [shape-attrs (->> (keys shape)
|
||||||
|
(remove (set display-attrs))
|
||||||
|
(remove remove-attrs)
|
||||||
|
(sort-by name))]
|
||||||
|
(as-> display-attrs $
|
||||||
|
(d/removev #(nil? (get shape %)) $)
|
||||||
|
(into $ shape-attrs))))
|
||||||
|
|
||||||
(def custom-renderer
|
(def custom-renderer
|
||||||
{:parent-id :shape-link
|
{:parent-id :shape-link
|
||||||
:frame-id :shape-link
|
:frame-id :shape-link
|
||||||
|
@ -87,10 +117,7 @@
|
||||||
[:button {:on-click #(debug/dump-subtree (dm/str (:id current)) true)} "tree"]]
|
[:button {:on-click #(debug/dump-subtree (dm/str (:id current)) true)} "tree"]]
|
||||||
|
|
||||||
[:div {:class (stl/css :shape-attrs)}
|
[:div {:class (stl/css :shape-attrs)}
|
||||||
(let [attrs (->> (keys current)
|
(let [attrs (get-attrs current)]
|
||||||
(remove remove-attrs))
|
|
||||||
attrs (concat [:frame-id :parent-id :shapes]
|
|
||||||
(->> attrs (remove #{:frame-id :parent-id :shapes})))]
|
|
||||||
(for [attr attrs]
|
(for [attr attrs]
|
||||||
(when-let [value (get current attr)]
|
(when-let [value (get current attr)]
|
||||||
[:div {:class (stl/css-case :attrs-container-attr true
|
[:div {:class (stl/css-case :attrs-container-attr true
|
||||||
|
|
Loading…
Add table
Reference in a new issue