0
Fork 0
mirror of https://github.com/penpot/penpot.git synced 2025-01-06 14:50:20 -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.shape-layout :as dwsl]
[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 ---------------------------------------------------------------------
@ -77,13 +79,16 @@
shape-ids (->> selected-shapes
(eduction
(remove #(tokens-applied? token % attributes))
(map :id)))
token-value (resolve-token-value token)]
(doseq [shape selected-shapes]
(st/emit! (on-apply {:token-id (:id token)
:shape-id (:id shape)
:attributes attributes}))
(on-update-shape token-value shape-ids attributes))))
(map :id)))]
(p/let [sd-tokens (sd/resolve-workspace-tokens+ {:debug? true})]
(let [resolved-token (get sd-tokens (:id token))
resolved-token-value (resolve-token-value resolved-token)]
(js/console.log "resolved-token resolve-token-value" resolved-token resolve-token-value)
(doseq [shape selected-shapes]
(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]
(st/emit!