mirror of
https://github.com/penpot/penpot.git
synced 2026-09-14 07:59:36 +00:00
🐛 Disallow font-family referencing composite token
This commit is contained in:
parent
e8201402a7
commit
3d8a251741
@ -255,14 +255,19 @@
|
|||||||
|
|
||||||
(defn- parse-sd-token-font-family-value
|
(defn- parse-sd-token-font-family-value
|
||||||
[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
|
(cond
|
||||||
|
(not valid-font-family)
|
||||||
|
{:errors [(wte/error-with-value :error.style-dictionary/invalid-token-value-font-family value)]}
|
||||||
|
|
||||||
missing-references
|
missing-references
|
||||||
{:errors [(wte/error-with-value :error.style-dictionary/missing-reference missing-references)]
|
{:errors [(wte/error-with-value :error.style-dictionary/missing-reference missing-references)]
|
||||||
:references missing-references}
|
:references missing-references}
|
||||||
|
|
||||||
:else
|
:else
|
||||||
{:value (-> (js->clj value) (flatten))})))
|
{:value value})))
|
||||||
|
|
||||||
(defn parse-atomic-typography-value [token-type token-value]
|
(defn parse-atomic-typography-value [token-type token-value]
|
||||||
(case token-type
|
(case token-type
|
||||||
|
|||||||
@ -88,6 +88,10 @@
|
|||||||
{:error/code :error.style-dictionary/invalid-token-value-font-weight
|
{:error/code :error.style-dictionary/invalid-token-value-font-weight
|
||||||
:error/fn #(tr "workspace.tokens.invalid-font-weight-token-value" %)}
|
: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.style-dictionary/invalid-token-value-typography
|
||||||
{:error/code :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" %)}
|
:error/fn #(tr "workspace.tokens.invalid-token-value-typography" %)}
|
||||||
|
|||||||
@ -7745,6 +7745,10 @@ msgstr ""
|
|||||||
"Invalid token value: only none, Uppercase, Lowercase or Capitalize are "
|
"Invalid token value: only none, Uppercase, Lowercase or Capitalize are "
|
||||||
"accepted"
|
"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
|
#: src/app/main/data/workspace/tokens/errors.cljs:85
|
||||||
msgid "workspace.tokens.invalid-text-decoration-token-value"
|
msgid "workspace.tokens.invalid-text-decoration-token-value"
|
||||||
msgstr "Invalid token value: only none, underline and strike-through are accepted"
|
msgstr "Invalid token value: only none, underline and strike-through are accepted"
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user