diff --git a/common/src/app/common/types/token.cljc b/common/src/app/common/types/token.cljc index 6fe15169e0..5ee3661a91 100644 --- a/common/src/app/common/types/token.cljc +++ b/common/src/app/common/types/token.cljc @@ -59,6 +59,7 @@ :dimensions "dimension" :font-family "fontFamilies" :font-size "fontSizes" + :font-weight "fontWeights" :letter-spacing "letterSpacing" :number "number" :opacity "opacity" @@ -70,7 +71,6 @@ :stroke-width "borderWidth" :text-case "textCase" :text-decoration "textDecoration" - :font-weight "fontWeights" :typography "typography"}) (def dtcg-token-type->token-type diff --git a/common/src/app/common/types/tokens_lib.cljc b/common/src/app/common/types/tokens_lib.cljc index 55e4d0cf41..5e278588a7 100644 --- a/common/src/app/common/types/tokens_lib.cljc +++ b/common/src/app/common/types/tokens_lib.cljc @@ -1545,7 +1545,7 @@ Will return a value that matches this schema: (and (not (contains? decoded-json "$metadata")) (not (contains? decoded-json "$themes")))) -(defn- convert-dtcg-font-family +(defn convert-dtcg-font-family "Convert font-family token value from DTCG format to internal format. - If value is a string, split it into a collection of font families - If value is already an array, keep it as is @@ -1556,7 +1556,7 @@ Will return a value that matches this schema: (sequential? value) value :else value)) -(defn- convert-dtcg-typography-composite +(defn convert-dtcg-typography-composite "Convert typography token value keys from DTCG format to internal format." [value] (if (map? value) @@ -1568,7 +1568,7 @@ Will return a value that matches this schema: ;; Reference value value)) -(defn- convert-dtcg-shadow-composite +(defn convert-dtcg-shadow-composite "Convert shadow token value from DTCG format to internal format." [value] (let [process-shadow (fn [shadow] diff --git a/frontend/src/app/plugins/tokens.cljs b/frontend/src/app/plugins/tokens.cljs index a3737d706d..da85575fb3 100644 --- a/frontend/src/app/plugins/tokens.cljs +++ b/frontend/src/app/plugins/tokens.cljs @@ -194,7 +194,12 @@ :addToken (fn [type-str name value] - (let [type (cto/dtcg-token-type->token-type type-str)] + (let [type (cto/dtcg-token-type->token-type type-str) + value (case type + :font-family (ctob/convert-dtcg-font-family (js->clj value)) + :typography (ctob/convert-dtcg-typography-composite (js->clj value)) + :shadow (ctob/convert-dtcg-shadow-composite (js->clj value)) + (js->clj value))] (cond (nil? type) (u/display-not-valid :addTokenType type-str)