diff --git a/frontend/src/app/main/data/style_dictionary.cljs b/frontend/src/app/main/data/style_dictionary.cljs index 5005dedeed..16e1bc72f5 100644 --- a/frontend/src/app/main/data/style_dictionary.cljs +++ b/frontend/src/app/main/data/style_dictionary.cljs @@ -255,14 +255,19 @@ (defn- parse-sd-token-font-family-value [value] - (let [missing-references (seq (some cto/find-token-value-references value))] + (let [value (-> (js->clj value) (flatten)) + valid-font-family (or (string? value) (every? string? value)) + missing-references (seq (some cto/find-token-value-references value))] (cond + (not valid-font-family) + {:errors [(wte/error-with-value :error.style-dictionary/invalid-token-value-font-family value)]} + missing-references {:errors [(wte/error-with-value :error.style-dictionary/missing-reference missing-references)] :references missing-references} :else - {:value (-> (js->clj value) (flatten))}))) + {:value value}))) (defn parse-atomic-typography-value [token-type token-value] (case token-type diff --git a/frontend/src/app/main/data/workspace/tokens/errors.cljs b/frontend/src/app/main/data/workspace/tokens/errors.cljs index 0be73b58a8..64aec75351 100644 --- a/frontend/src/app/main/data/workspace/tokens/errors.cljs +++ b/frontend/src/app/main/data/workspace/tokens/errors.cljs @@ -88,6 +88,10 @@ {:error/code :error.style-dictionary/invalid-token-value-font-weight :error/fn #(tr "workspace.tokens.invalid-font-weight-token-value" %)} + :error.style-dictionary/invalid-token-value-font-family + {:error/code :error.style-dictionary/invalid-token-value-font-family + :error/fn #(tr "workspace.tokens.invalid-font-family-token-value" %)} + :error.style-dictionary/invalid-token-value-typography {:error/code :error.style-dictionary/invalid-token-value-typography :error/fn #(tr "workspace.tokens.invalid-token-value-typography" %)} diff --git a/frontend/translations/en.po b/frontend/translations/en.po index f560cba50d..7d035665cf 100644 --- a/frontend/translations/en.po +++ b/frontend/translations/en.po @@ -7745,6 +7745,10 @@ msgstr "" "Invalid token value: only none, Uppercase, Lowercase or Capitalize are " "accepted" +#: src/app/main/data/workspace/tokens/errors.cljs:93 +msgid "workspace.tokens.invalid-font-family-token-value" +msgstr "Invalid token value: only text delimited by ',' allowed" + #: src/app/main/data/workspace/tokens/errors.cljs:85 msgid "workspace.tokens.invalid-text-decoration-token-value" msgstr "Invalid token value: only none, underline and strike-through are accepted"