0
Fork 0
mirror of https://github.com/penpot/penpot.git synced 2025-01-21 06:02:32 -05:00

Got resolve working

This commit is contained in:
Florian Schroedl 2024-06-10 15:50:48 +02:00
parent 7da772d6a2
commit a5b22d5427

View file

@ -55,37 +55,48 @@
:sizing [:div {:style {:rotate "45deg"}} i/constraint-horizontal]
i/add))
(defn tokens->sd [tokens]
(let [data {:tokens tokens
:platforms {:json {:files [{:format "json"
:destination "-"}]}}
:platforms {:json {:transformGroup "tokens-studio"
:files [{:format "custom/json"
:destination "foo"}]}}
:preprocessors ["tokens-studio"]
:log {:warnings "warn"
:verbosity "verbose"}}
js-data (clj->js data)]
(js/console.log "Input Data" js-data)
(js/window.StyleDictionary. (clj->js data))))
(js/window.StyleDictionary. js-data)))
(comment
(let [math-token-id (random-uuid)
dynamic-token-id (random-uuid)
tokens-data (-> @refs/workspace-tokens
(assoc
math-token-id {:id dynamic-token-id
:name "mathToken"
:type :dimensions
:value "1 + 2"})
;; dynamic-token-id {:id dynamic-token-id
;; :name "ref-token"
;; :type :dimensions
;; :value "{mathToken}"})
(wtc/group-tokens-by-type))
tokens-data {:dimension {"scale" {"value" "2px"
"type" :sizing}
"sm" {"value" "{dimension.scale} * {dimension.scale}"
"type" :sizing}}}
#_#_tokens-data (-> #_@refs/workspace-tokens
;; (assoc math-token-id {:id dynamic-token-id
;; :name "mathToken"
;; :type :dimensions
;; :value "1 + 2"}
;; dynamic-token-id {:id dynamic-token-id
;; :name "refToken"
;; :type :dimensions
;; :value "{dimensions.mathToken}"})
#_(wtc/group-tokens-by-type))
sd (tokens->sd tokens-data)]
(js/console.log "StyleDictionary" sd)
(-> sd
#_(.exportPlatform sd "json")
;; (.formatPlatform sd "json")
(.buildAllPlatforms sd "json")
;; (.then js/console.log)
(.catch js/console.error))))
(.catch js/console.error)
(.then #(js/console.log "Finished" (.-allTokens %)))))
nil)
;; (.finally (fn [x] (js/console.log "Finish" x)))
(mf/defc token-component