0
Fork 0
mirror of https://github.com/penpot/penpot.git synced 2025-01-07 15:39:42 -05:00

Applying resolved token value

This commit is contained in:
Florian Schroedl 2024-06-11 17:52:12 +02:00
parent 66b4b892df
commit 4fec7d5af2

View file

@ -14,7 +14,9 @@
[app.main.data.workspace.changes :as dch] [app.main.data.workspace.changes :as dch]
[app.main.data.workspace.shape-layout :as dwsl] [app.main.data.workspace.shape-layout :as dwsl]
[app.main.data.workspace.transforms :as dwt] [app.main.data.workspace.transforms :as dwt]
[app.main.store :as st])) [app.main.store :as st]
[app.main.ui.workspace.tokens.style-dictionary :as sd]
[promesa.core :as p]))
;; Helpers --------------------------------------------------------------------- ;; Helpers ---------------------------------------------------------------------
@ -77,13 +79,16 @@
shape-ids (->> selected-shapes shape-ids (->> selected-shapes
(eduction (eduction
(remove #(tokens-applied? token % attributes)) (remove #(tokens-applied? token % attributes))
(map :id))) (map :id)))]
token-value (resolve-token-value token)] (p/let [sd-tokens (sd/resolve-workspace-tokens+ {:debug? true})]
(doseq [shape selected-shapes] (let [resolved-token (get sd-tokens (:id token))
(st/emit! (on-apply {:token-id (:id token) resolved-token-value (resolve-token-value resolved-token)]
:shape-id (:id shape) (js/console.log "resolved-token resolve-token-value" resolved-token resolve-token-value)
:attributes attributes})) (doseq [shape selected-shapes]
(on-update-shape token-value shape-ids attributes)))) (st/emit! (on-apply {:token-id (:id token)
:shape-id (:id shape)
:attributes attributes}))
(on-update-shape resolved-token-value shape-ids attributes))))))
(defn update-shape-radius [value shape-ids] (defn update-shape-radius [value shape-ids]
(st/emit! (st/emit!