mirror of https://github.com/penpot/penpot.git
🐛 Fix remap skipping tokens with same name in different sets
This commit is contained in:
parent
0a50a038f7
commit
2b4ade243d
|
|
@ -909,7 +909,8 @@ Will return a value that matches this schema:
|
|||
`:all` All of the nested sets are active
|
||||
`:partial` Mixed active state of nested sets")
|
||||
(get-tokens-in-active-sets [_] "set of set names that are active in the the active themes")
|
||||
(get-all-tokens [_] "all tokens in the lib")
|
||||
(get-all-tokens [_] "all tokens in the lib, as a sequence")
|
||||
(get-all-tokens-map [_] "all tokens in the lib, as a map name -> token")
|
||||
(get-tokens [_ set-id] "return a map of tokens in the set, indexed by token-name"))
|
||||
|
||||
(declare parse-multi-set-dtcg-json)
|
||||
|
|
@ -1306,6 +1307,10 @@ Will return a value that matches this schema:
|
|||
tokens))
|
||||
|
||||
(get-all-tokens [this]
|
||||
(mapcat #(vals (get-tokens- %))
|
||||
(get-sets this)))
|
||||
|
||||
(get-all-tokens-map [this]
|
||||
(reduce
|
||||
(fn [tokens' set]
|
||||
(into tokens' (map (fn [x] [(:name x) x]) (vals (get-tokens- set)))))
|
||||
|
|
|
|||
|
|
@ -74,7 +74,7 @@
|
|||
(when unknown-tokens
|
||||
(st/emit! (show-unknown-types-warning unknown-tokens)))
|
||||
(try
|
||||
(->> (ctob/get-all-tokens tokens-lib)
|
||||
(->> (ctob/get-all-tokens-map tokens-lib)
|
||||
(sd/resolve-tokens-with-verbose-errors)
|
||||
(rx/map (fn [_]
|
||||
tokens-lib))
|
||||
|
|
|
|||
|
|
@ -20,6 +20,9 @@
|
|||
[cuerdas.core :as str]
|
||||
[potok.v2.core :as ptk]))
|
||||
|
||||
;; Change this to :info :debug or :trace to debug this module, or :warn to reset to default
|
||||
(log/set-level! :warn)
|
||||
|
||||
;; Token Reference Scanning
|
||||
;; ========================
|
||||
|
||||
|
|
@ -72,7 +75,7 @@
|
|||
;; Scan tokens library for alias references to the specific token
|
||||
matching-aliases (if tokens-lib
|
||||
(let [all-tokens (ctob/get-all-tokens tokens-lib)]
|
||||
(mapcat #(scan-token-value-references % old-token-name) (vals all-tokens)))
|
||||
(mapcat #(scan-token-value-references % old-token-name) all-tokens))
|
||||
[])]
|
||||
(log/info :hint "token-scan-details"
|
||||
:token-name old-token-name
|
||||
|
|
|
|||
|
|
@ -39,7 +39,7 @@
|
|||
(ctob/make-token {:name "borderRadius.largeFn"
|
||||
:value "{borderRadius.sm} * 200000000"
|
||||
:type :border-radius}))
|
||||
(ctob/get-all-tokens))]
|
||||
(ctob/get-all-tokens-map))]
|
||||
(-> (sd/resolve-tokens tokens)
|
||||
(rx/sub!
|
||||
(fn [resolved-tokens]
|
||||
|
|
|
|||
Loading…
Reference in New Issue