diff --git a/frontend/src/app/main/ui/workspace/tokens/core.cljs b/frontend/src/app/main/ui/workspace/tokens/core.cljs index 29d0047207..23940a28ae 100644 --- a/frontend/src/app/main/ui/workspace/tokens/core.cljs +++ b/frontend/src/app/main/ui/workspace/tokens/core.cljs @@ -77,8 +77,7 @@ (fn [sd-tokens] (let [resolved-value (-> (get sd-tokens (:id token)) (resolve-token-value)) - tokenized-attributes (->> (map (fn [attr] {attr (:id token)}) attributes) - (into {}))] + tokenized-attributes (wtt/attributes-map attributes (:id token))] (rx/of (dch/update-shapes shape-ids (fn [shape] (update shape :applied-tokens merge tokenized-attributes))) diff --git a/frontend/src/app/main/ui/workspace/tokens/token.cljs b/frontend/src/app/main/ui/workspace/tokens/token.cljs index e52079f8f8..2db7c24cf1 100644 --- a/frontend/src/app/main/ui/workspace/tokens/token.cljs +++ b/frontend/src/app/main/ui/workspace/tokens/token.cljs @@ -2,6 +2,12 @@ (:require [cuerdas.core :as str])) +(defn attributes-map + "Creats an attributes map using collection of `attributes` for `id`." + [attributes id] + (->> (map (fn [attr] {attr id}) attributes) + (into {}))) + (defn token-applied? "Test if `token` is applied to a `shape` with the given `token-attributes`." [token shape token-attributes]