0
Fork 0
mirror of https://github.com/penpot/penpot.git synced 2025-01-20 05:34:23 -05:00

Add themes data to decoding

This commit is contained in:
Andrey Fedorov 2024-12-10 07:54:48 +01:00
parent 19ce9e8ce3
commit d0ad149e20

View file

@ -902,6 +902,7 @@ When `before-set-name` is nil, move set to bottom")
(decode-dtcg-json [_ parsed-json]
(let [;; tokens-studio/plugin will add these meta properties, remove them for now
sets-data (dissoc parsed-json "$themes" "$metadata")
themes-data (get parsed-json "$themes")
lib (make-tokens-lib)
lib' (reduce
(fn [lib [set-name tokens]]
@ -909,7 +910,20 @@ When `before-set-name` is nil, move set to bottom")
:name set-name
:tokens (flatten-nested-tokens-json tokens ""))))
lib sets-data)]
lib'))
(reduce
(fn [lib {:strs [name
group
description
is-source
modified-at
sets]}]
(add-theme lib (TokenTheme. name
group
description
is-source
(dt/parse-instant modified-at)
(set sets))))
lib' themes-data)))
(get-all-tokens [this]
(reduce