0
Fork 0
mirror of https://github.com/penpot/penpot.git synced 2025-01-10 08:50:57 -05:00

🔧 Improve debug tool

This commit is contained in:
Andrés Moya 2024-01-30 16:15:54 +01:00 committed by Alejandro Alonso
parent a6e8d408b5
commit 891dab7f06

View file

@ -17,12 +17,42 @@
[debug :as dbg]
[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
#{:id :name})
#{:name, :remote-synced})
(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
{:parent-id :shape-link
:frame-id :shape-link
@ -87,10 +117,7 @@
[:button {:on-click #(debug/dump-subtree (dm/str (:id current)) true)} "tree"]]
[:div {:class (stl/css :shape-attrs)}
(let [attrs (->> (keys current)
(remove remove-attrs))
attrs (concat [:frame-id :parent-id :shapes]
(->> attrs (remove #{:frame-id :parent-id :shapes})))]
(let [attrs (get-attrs current)]
(for [attr attrs]
(when-let [value (get current attr)]
[:div {:class (stl/css-case :attrs-container-attr true