0
Fork 0
mirror of https://github.com/penpot/penpot.git synced 2025-01-21 22:22:43 -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] :sizing [:div {:style {:rotate "45deg"}} i/constraint-horizontal]
i/add)) i/add))
(defn tokens->sd [tokens] (defn tokens->sd [tokens]
(let [data {:tokens tokens (let [data {:tokens tokens
:platforms {:json {:files [{:format "json" :platforms {:json {:transformGroup "tokens-studio"
:destination "-"}]}} :files [{:format "custom/json"
:destination "foo"}]}}
:preprocessors ["tokens-studio"]
:log {:warnings "warn" :log {:warnings "warn"
:verbosity "verbose"}} :verbosity "verbose"}}
js-data (clj->js data)] js-data (clj->js data)]
(js/console.log "Input Data" js-data) (js/console.log "Input Data" js-data)
(js/window.StyleDictionary. (clj->js data)))) (js/window.StyleDictionary. js-data)))
(comment (comment
(let [math-token-id (random-uuid) (let [math-token-id (random-uuid)
dynamic-token-id (random-uuid) dynamic-token-id (random-uuid)
tokens-data (-> @refs/workspace-tokens tokens-data {:dimension {"scale" {"value" "2px"
(assoc "type" :sizing}
math-token-id {:id dynamic-token-id "sm" {"value" "{dimension.scale} * {dimension.scale}"
:name "mathToken" "type" :sizing}}}
:type :dimensions #_#_tokens-data (-> #_@refs/workspace-tokens
:value "1 + 2"})
;; dynamic-token-id {:id dynamic-token-id ;; (assoc math-token-id {:id dynamic-token-id
;; :name "ref-token" ;; :name "mathToken"
;; :type :dimensions ;; :type :dimensions
;; :value "{mathToken}"}) ;; :value "1 + 2"}
(wtc/group-tokens-by-type)) ;; dynamic-token-id {:id dynamic-token-id
;; :name "refToken"
;; :type :dimensions
;; :value "{dimensions.mathToken}"})
#_(wtc/group-tokens-by-type))
sd (tokens->sd tokens-data)] sd (tokens->sd tokens-data)]
(js/console.log "StyleDictionary" sd) (js/console.log "StyleDictionary" sd)
(-> sd (-> sd
#_(.exportPlatform sd "json") ;; (.formatPlatform sd "json")
(.buildAllPlatforms 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))) ;; (.finally (fn [x] (js/console.log "Finish" x)))
(mf/defc token-component (mf/defc token-component