mirror of
https://github.com/penpot/penpot.git
synced 2025-08-01 13:38:33 +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
|
@ -120,7 +120,7 @@
|
||||||
"rxjs": "8.0.0-alpha.14",
|
"rxjs": "8.0.0-alpha.14",
|
||||||
"sax": "^1.4.1",
|
"sax": "^1.4.1",
|
||||||
"source-map-support": "^0.5.21",
|
"source-map-support": "^0.5.21",
|
||||||
"style-dictionary": "4.0.0-prerelease.34",
|
"style-dictionary": "4.0.0-prerelease.36",
|
||||||
"tdigest": "^0.1.2",
|
"tdigest": "^0.1.2",
|
||||||
"tinycolor2": "npm:^1.6.0",
|
"tinycolor2": "npm:^1.6.0",
|
||||||
"ua-parser-js": "2.0.0-rc.1",
|
"ua-parser-js": "2.0.0-rc.1",
|
||||||
|
|
|
@ -129,10 +129,10 @@
|
||||||
:attrs [:strokes]}))
|
:attrs [:strokes]}))
|
||||||
|
|
||||||
(defn update-color [f value shape-ids]
|
(defn update-color [f value shape-ids]
|
||||||
(let [color (some->> value
|
(when-let [color (some->> value
|
||||||
(tinycolor/valid-color)
|
(tinycolor/valid-color)
|
||||||
(tinycolor/->hex)
|
(tinycolor/->hex)
|
||||||
(str "#"))]
|
(str "#"))]
|
||||||
(f shape-ids {:color color} 0)))
|
(f shape-ids {:color color} 0)))
|
||||||
|
|
||||||
(defn update-fill
|
(defn update-fill
|
||||||
|
|
|
@ -70,7 +70,10 @@
|
||||||
:on-context-menu on-context-menu
|
:on-context-menu on-context-menu
|
||||||
:disabled errors?}
|
:disabled errors?}
|
||||||
(when-let [color (if (seq (ctob/find-token-value-references (:value token)))
|
(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))]
|
(wtt/resolved-value-hex token))]
|
||||||
[:& color-bullet {:color color
|
[:& color-bullet {:color color
|
||||||
:mini? true}])
|
:mini? true}])
|
||||||
|
@ -259,8 +262,12 @@
|
||||||
active-theme-tokens (sd/use-active-theme-sets-tokens)
|
active-theme-tokens (sd/use-active-theme-sets-tokens)
|
||||||
|
|
||||||
tokens (sd/use-resolved-workspace-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]
|
[:& token-context-menu]
|
||||||
[:& title-bar {:all-clickable true
|
[:& title-bar {:all-clickable true
|
||||||
|
|
|
@ -252,8 +252,10 @@
|
||||||
@tokens-state))
|
@tokens-state))
|
||||||
|
|
||||||
(defn use-resolved-workspace-tokens []
|
(defn use-resolved-workspace-tokens []
|
||||||
(-> (mf/deref refs/workspace-selected-token-set-tokens)
|
(let [active-theme-tokens (mf/deref refs/workspace-active-theme-sets-tokens)
|
||||||
(use-resolved-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 []
|
(defn use-active-theme-sets-tokens []
|
||||||
(-> (mf/deref refs/workspace-active-theme-sets-tokens)
|
(-> (mf/deref refs/workspace-active-theme-sets-tokens)
|
||||||
|
|
|
@ -4359,7 +4359,7 @@ __metadata:
|
||||||
shadow-cljs: "npm:2.28.18"
|
shadow-cljs: "npm:2.28.18"
|
||||||
source-map-support: "npm:^0.5.21"
|
source-map-support: "npm:^0.5.21"
|
||||||
storybook: "npm:^8.3.6"
|
storybook: "npm:^8.3.6"
|
||||||
style-dictionary: "npm:4.0.0-prerelease.34"
|
style-dictionary: "npm:4.0.0-prerelease.36"
|
||||||
svg-sprite: "npm:^2.0.4"
|
svg-sprite: "npm:^2.0.4"
|
||||||
tdigest: "npm:^0.1.2"
|
tdigest: "npm:^0.1.2"
|
||||||
tinycolor2: "npm:^1.6.0"
|
tinycolor2: "npm:^1.6.0"
|
||||||
|
@ -8495,9 +8495,9 @@ __metadata:
|
||||||
languageName: node
|
languageName: node
|
||||||
linkType: hard
|
linkType: hard
|
||||||
|
|
||||||
"style-dictionary@npm:4.0.0-prerelease.34":
|
"style-dictionary@npm:4.0.0-prerelease.36":
|
||||||
version: 4.0.0-prerelease.34
|
version: 4.0.0-prerelease.36
|
||||||
resolution: "style-dictionary@npm:4.0.0-prerelease.34"
|
resolution: "style-dictionary@npm:4.0.0-prerelease.36"
|
||||||
dependencies:
|
dependencies:
|
||||||
"@bundled-es-modules/deepmerge": "npm:^4.3.1"
|
"@bundled-es-modules/deepmerge": "npm:^4.3.1"
|
||||||
"@bundled-es-modules/glob": "npm:^10.3.13"
|
"@bundled-es-modules/glob": "npm:^10.3.13"
|
||||||
|
@ -8513,7 +8513,7 @@ __metadata:
|
||||||
tinycolor2: "npm:^1.6.0"
|
tinycolor2: "npm:^1.6.0"
|
||||||
bin:
|
bin:
|
||||||
style-dictionary: bin/style-dictionary.js
|
style-dictionary: bin/style-dictionary.js
|
||||||
checksum: 10c0/775d00c0e6aec7749dd5554c448550bc0793aaff9ab028d61ba219476ffa827d3e11866d326c34a27d3e848156b885e476beaade0909fe6b174a50e857dd5009
|
checksum: 10c0/8707b3cced5ee7a858c425b296b53f3b9055f388839ab77ec94f9ed012ca99db43ce28fb540cec1659b92680a2769b1ed24d9af891ea98b9b298895341781f30
|
||||||
languageName: node
|
languageName: node
|
||||||
linkType: hard
|
linkType: hard
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue