mirror of
https://github.com/penpot/penpot.git
synced 2025-07-31 16:08:22 +02:00
Merge pull request #350 from tokens-studio/sets-reference-bug
Token Resolving Issues
This commit is contained in:
commit
2464ae1eef
5 changed files with 24 additions and 15 deletions
|
@ -129,10 +129,10 @@
|
|||
:attrs [:strokes]}))
|
||||
|
||||
(defn update-color [f value shape-ids]
|
||||
(let [color (some->> value
|
||||
(tinycolor/valid-color)
|
||||
(tinycolor/->hex)
|
||||
(str "#"))]
|
||||
(when-let [color (some->> value
|
||||
(tinycolor/valid-color)
|
||||
(tinycolor/->hex)
|
||||
(str "#"))]
|
||||
(f shape-ids {:color color} 0)))
|
||||
|
||||
(defn update-fill
|
||||
|
|
|
@ -70,7 +70,10 @@
|
|||
:on-context-menu on-context-menu
|
||||
:disabled errors?}
|
||||
(when-let [color (if (seq (ctob/find-token-value-references (:value token)))
|
||||
(wtt/resolved-value-hex theme-token)
|
||||
(or
|
||||
(wtt/resolved-value-hex theme-token)
|
||||
;; Fallback when the current set is inactive and has a reference that resolves in this inactive set
|
||||
(wtt/resolved-value-hex token))
|
||||
(wtt/resolved-value-hex token))]
|
||||
[:& color-bullet {:color color
|
||||
:mini? true}])
|
||||
|
@ -259,8 +262,12 @@
|
|||
active-theme-tokens (sd/use-active-theme-sets-tokens)
|
||||
|
||||
tokens (sd/use-resolved-workspace-tokens)
|
||||
token-groups (mf/with-memo [tokens]
|
||||
(sorted-token-groups tokens))]
|
||||
|
||||
selected-token-set-tokens (mf/deref refs/workspace-selected-token-set-tokens)
|
||||
|
||||
token-groups (mf/with-memo [tokens selected-token-set-tokens]
|
||||
(-> (select-keys tokens (keys selected-token-set-tokens))
|
||||
(sorted-token-groups)))]
|
||||
[:*
|
||||
[:& token-context-menu]
|
||||
[:& title-bar {:all-clickable true
|
||||
|
|
|
@ -252,8 +252,10 @@
|
|||
@tokens-state))
|
||||
|
||||
(defn use-resolved-workspace-tokens []
|
||||
(-> (mf/deref refs/workspace-selected-token-set-tokens)
|
||||
(use-resolved-tokens)))
|
||||
(let [active-theme-tokens (mf/deref refs/workspace-active-theme-sets-tokens)
|
||||
selected-token-set-tokens (mf/deref refs/workspace-selected-token-set-tokens)
|
||||
prefer-selected-token-set-tokens (merge active-theme-tokens selected-token-set-tokens)]
|
||||
(use-resolved-tokens prefer-selected-token-set-tokens)))
|
||||
|
||||
(defn use-active-theme-sets-tokens []
|
||||
(-> (mf/deref refs/workspace-active-theme-sets-tokens)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue