mirror of
https://github.com/penpot/penpot.git
synced 2025-01-21 06:02:32 -05:00
Add tokens map generators
This commit is contained in:
parent
5e301605ad
commit
d9dbaad281
1 changed files with 11 additions and 0 deletions
|
@ -43,6 +43,17 @@
|
|||
(->> (vals tokens)
|
||||
(group-by :type)))
|
||||
|
||||
(defn tokens-name-map
|
||||
"Convert tokens into a map with their `:name` as the key."
|
||||
[tokens]
|
||||
(->> (map (fn [{:keys [name] :as token}] [name token]) tokens)
|
||||
(into {})))
|
||||
|
||||
(defn tokens-name-map-for-type [token-type tokens]
|
||||
(-> (group-tokens-by-type tokens)
|
||||
(get token-type [])
|
||||
(tokens-name-map)))
|
||||
|
||||
;; Update functions ------------------------------------------------------------
|
||||
|
||||
(defn on-apply-token [{:keys [token token-type-props selected-shapes] :as _props}]
|
||||
|
|
Loading…
Add table
Reference in a new issue