From 8f852bf48fb658819f067c9411377930f99a8592 Mon Sep 17 00:00:00 2001 From: Florian Schroedl Date: Wed, 15 May 2024 17:26:10 +0200 Subject: [PATCH 01/13] Use :as --- frontend/src/app/main/ui/workspace/tokens/sidebar.cljs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/frontend/src/app/main/ui/workspace/tokens/sidebar.cljs b/frontend/src/app/main/ui/workspace/tokens/sidebar.cljs index 7e4e306d5..8928eac03 100644 --- a/frontend/src/app/main/ui/workspace/tokens/sidebar.cljs +++ b/frontend/src/app/main/ui/workspace/tokens/sidebar.cljs @@ -14,7 +14,7 @@ [app.main.ui.icons :as i] [app.main.ui.workspace.sidebar.assets.common :as cmm] [app.main.ui.workspace.tokens.common :refer [workspace-shapes]] - [app.main.ui.workspace.tokens.core :refer [tokens-applied?] :as wtc] + [app.main.ui.workspace.tokens.core :as wtc] [app.util.dom :as dom] [rumext.v2 :as mf])) @@ -106,7 +106,7 @@ [:& token-pill {:key (:id token) :token token - :highlighted? (tokens-applied? token selected-shapes attributes) + :highlighted? (wtc/tokens-applied? token selected-shapes attributes) :on-click #(on-token-pill-click % token) :on-context-menu #(on-context-menu % token)}])]])]])) From 622843f18d1bfa2f056e56805203b580f5917cee Mon Sep 17 00:00:00 2001 From: Florian Schroedl Date: Wed, 15 May 2024 17:43:49 +0200 Subject: [PATCH 02/13] Take tokens as ref --- frontend/src/app/main/refs.cljs | 6 +++++ .../app/main/ui/workspace/tokens/sidebar.cljs | 22 +++++++++---------- 2 files changed, 16 insertions(+), 12 deletions(-) diff --git a/frontend/src/app/main/refs.cljs b/frontend/src/app/main/refs.cljs index 33e558446..a84a6fe82 100644 --- a/frontend/src/app/main/refs.cljs +++ b/frontend/src/app/main/refs.cljs @@ -230,6 +230,12 @@ (def workspace-data (l/derived :workspace-data st/state)) +(def workspace-tokens + (l/derived (fn [data] + (get data :tokens [])) + workspace-data + =)) + (def workspace-file-colors (l/derived (fn [data] (when data diff --git a/frontend/src/app/main/ui/workspace/tokens/sidebar.cljs b/frontend/src/app/main/ui/workspace/tokens/sidebar.cljs index 8928eac03..ae607051c 100644 --- a/frontend/src/app/main/ui/workspace/tokens/sidebar.cljs +++ b/frontend/src/app/main/ui/workspace/tokens/sidebar.cljs @@ -7,13 +7,13 @@ (ns app.main.ui.workspace.tokens.sidebar (:require-macros [app.main.style :as stl]) (:require + [app.common.data :as d] [app.main.data.modal :as modal] [app.main.data.tokens :as dt] [app.main.refs :as refs] [app.main.store :as st] [app.main.ui.icons :as i] [app.main.ui.workspace.sidebar.assets.common :as cmm] - [app.main.ui.workspace.tokens.common :refer [workspace-shapes]] [app.main.ui.workspace.tokens.core :as wtc] [app.util.dom :as dom] [rumext.v2 :as mf])) @@ -52,7 +52,7 @@ i/add)) (mf/defc token-component - [{:keys [type file tokens selected-shapes token-type-props]}] + [{:keys [type tokens selected-shapes token-type-props]}] (let [open? (mf/use-state false) {:keys [modal attributes title]} token-type-props @@ -87,8 +87,7 @@ :selected-shapes selected-shapes}))) tokens-count (count tokens)] [:div {:on-click on-toggle-open-click} - [:& cmm/asset-section {:file-id (:id file) - :icon (mf/fnc icon-wrapper [_] + [:& cmm/asset-section {:icon (mf/fnc icon-wrapper [_] [:div {:class (stl/css :section-icon)} [:& token-section-icon {:type type}]]) @@ -128,21 +127,20 @@ (mf/defc tokens-explorer [_props] - (let [file (mf/deref refs/workspace-file) - current-page-id (:current-page-id @st/state) - workspace-data (mf/deref refs/workspace-data) - tokens (get workspace-data :tokens) + (let [objects (mf/deref refs/workspace-page-objects) + + selected (mf/deref refs/selected-shapes) + selected-shapes (into [] (keep (d/getf objects)) selected) + + tokens (mf/deref refs/workspace-tokens) token-groups (mf/with-memo [tokens] - (sorted-token-groups tokens)) - selected-shape-ids (mf/deref refs/selected-shapes) - selected-shapes (workspace-shapes workspace-data current-page-id selected-shape-ids)] + (sorted-token-groups tokens))] [:article [:div.assets-bar (for [{:keys [token-key token-type-props tokens]} (concat (:filled token-groups) (:empty token-groups))] [:& token-component {:key token-key :type token-key - :file file :selected-shapes selected-shapes :tokens tokens :token-type-props token-type-props}])]])) From 5e301605ade4bb9c80b3a4942030928424c47866 Mon Sep 17 00:00:00 2001 From: Florian Schroedl Date: Wed, 15 May 2024 17:44:06 +0200 Subject: [PATCH 03/13] Extract token grouping to core --- frontend/src/app/main/ui/workspace/tokens/core.cljs | 6 ++++++ frontend/src/app/main/ui/workspace/tokens/sidebar.cljs | 5 ++--- 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/frontend/src/app/main/ui/workspace/tokens/core.cljs b/frontend/src/app/main/ui/workspace/tokens/core.cljs index b1e0aabbf..2fd5bfc1a 100644 --- a/frontend/src/app/main/ui/workspace/tokens/core.cljs +++ b/frontend/src/app/main/ui/workspace/tokens/core.cljs @@ -37,6 +37,12 @@ int-or-double (throw (ex-info (str "Implement token value resolve for " value) token)))) +(defn group-tokens-by-type + "Groups tokens by their `:type` property." + [tokens] + (->> (vals tokens) + (group-by :type))) + ;; Update functions ------------------------------------------------------------ (defn on-apply-token [{:keys [token token-type-props selected-shapes] :as _props}] diff --git a/frontend/src/app/main/ui/workspace/tokens/sidebar.cljs b/frontend/src/app/main/ui/workspace/tokens/sidebar.cljs index ae607051c..015d2635f 100644 --- a/frontend/src/app/main/ui/workspace/tokens/sidebar.cljs +++ b/frontend/src/app/main/ui/workspace/tokens/sidebar.cljs @@ -113,13 +113,12 @@ "Separate token-types into groups of `:empty` or `:filled` depending if tokens exist for that type. Sort each group alphabetically (by their `:token-key`)." [tokens] - (let [tokens-by-group (->> (vals tokens) - (group-by :type)) + (let [tokens-by-type (wtc/group-tokens-by-type tokens) {:keys [empty filled]} (->> wtc/token-types (map (fn [[token-key token-type-props]] {:token-key token-key :token-type-props token-type-props - :tokens (get tokens-by-group token-key [])})) + :tokens (get tokens-by-type token-key [])})) (group-by (fn [{:keys [tokens]}] (if (empty? tokens) :empty :filled))))] {:empty (sort-by :token-key empty) From d9dbaad281558b7b56cba37655f3c0af462f002c Mon Sep 17 00:00:00 2001 From: Florian Schroedl Date: Wed, 15 May 2024 18:20:28 +0200 Subject: [PATCH 04/13] Add tokens map generators --- frontend/src/app/main/ui/workspace/tokens/core.cljs | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/frontend/src/app/main/ui/workspace/tokens/core.cljs b/frontend/src/app/main/ui/workspace/tokens/core.cljs index 2fd5bfc1a..c237cae76 100644 --- a/frontend/src/app/main/ui/workspace/tokens/core.cljs +++ b/frontend/src/app/main/ui/workspace/tokens/core.cljs @@ -43,6 +43,17 @@ (->> (vals tokens) (group-by :type))) +(defn tokens-name-map + "Convert tokens into a map with their `:name` as the key." + [tokens] + (->> (map (fn [{:keys [name] :as token}] [name token]) tokens) + (into {}))) + +(defn tokens-name-map-for-type [token-type tokens] + (-> (group-tokens-by-type tokens) + (get token-type []) + (tokens-name-map))) + ;; Update functions ------------------------------------------------------------ (defn on-apply-token [{:keys [token token-type-props selected-shapes] :as _props}] From 9a58188dc3895ed44ec8a3bc5e5ae78656ec7095 Mon Sep 17 00:00:00 2001 From: Florian Schroedl Date: Wed, 15 May 2024 18:20:47 +0200 Subject: [PATCH 05/13] Show border-radius tokens as options --- .../sidebar/options/menus/measures.cljs | 23 +++++++++++++++---- 1 file changed, 19 insertions(+), 4 deletions(-) diff --git a/frontend/src/app/main/ui/workspace/sidebar/options/menus/measures.cljs b/frontend/src/app/main/ui/workspace/sidebar/options/menus/measures.cljs index 13c4ffe53..510d6ac0a 100644 --- a/frontend/src/app/main/ui/workspace/sidebar/options/menus/measures.cljs +++ b/frontend/src/app/main/ui/workspace/sidebar/options/menus/measures.cljs @@ -12,6 +12,7 @@ [app.common.types.shape.layout :as ctl] [app.common.types.shape.radius :as ctsr] [app.main.constants :refer [size-presets]] + [app.main.data.tokens :as dt] [app.main.data.workspace :as udw] [app.main.data.workspace.changes :as dch] [app.main.data.workspace.interactions :as dwi] @@ -19,10 +20,12 @@ [app.main.refs :as refs] [app.main.store :as st] [app.main.ui.components.dropdown :refer [dropdown]] + [app.main.ui.components.editable-select :refer [editable-select]] [app.main.ui.components.numeric-input :refer [numeric-input*]] [app.main.ui.components.radio-buttons :refer [radio-button radio-buttons]] [app.main.ui.hooks :as hooks] [app.main.ui.icons :as i] + [app.main.ui.workspace.tokens.core :as wtc] [app.util.dom :as dom] [app.util.i18n :as i18n :refer [tr]] [clojure.set :refer [rename-keys union]] @@ -95,6 +98,10 @@ selection-parents-ref (mf/use-memo (mf/deps ids) #(refs/parents-by-ids ids)) selection-parents (mf/deref selection-parents-ref) + tokens (mf/deref refs/workspace-tokens) + border-radius-tokens (mf/use-memo (mf/deps tokens) #(wtc/tokens-name-map-for-type :border-radius tokens)) + border-radius-options (mf/use-memo (mf/deps border-radius-tokens) #(map (comp :name val) border-radius-tokens)) + flex-child? (->> selection-parents (some ctl/flex-layout?)) absolute? (ctl/item-absolute? shape) flex-container? (ctl/flex-layout? shape) @@ -284,7 +291,14 @@ (mf/use-fn (mf/deps ids change-radius) (fn [value] - (st/emit! (change-radius #(ctsr/set-radius-1 % value))))) + (let [token (when (symbol? value) + (get border-radius-tokens (str value))) + token-value (wtc/resolve-token-value token)] + (st/emit! + (dt/update-token-from-attributes {:token-id (:id token) + :shape-id (first ids) + :attributes (get-in wtc/token-types [:border-radius :attributes])}) + (change-radius #(ctsr/set-radius-1 % (or token-value value))))))) on-radius-multi-change (mf/use-fn @@ -468,12 +482,13 @@ [:div {:class (stl/css :radius-1) :title (tr "workspace.options.radius")} [:span {:class (stl/css :icon)} i/corner-radius] - [:> numeric-input* + [:& editable-select {:placeholder (if (= :multiple (:rx values)) (tr "settings.multiple") "--") - :ref radius-input-ref + :type "number" :min 0 + :input-class (stl/css :numeric-input) :on-change on-radius-1-change - :className (stl/css :numeric-input) + :options border-radius-options :value (:rx values)}]] @radius-multi? From 4e3af1407dec0429c9f68af807e7327e02251249 Mon Sep 17 00:00:00 2001 From: Florian Schroedl Date: Wed, 15 May 2024 18:28:04 +0200 Subject: [PATCH 06/13] Fix styling of dropdown items? --- .../main/ui/workspace/sidebar/options/menus/measures.cljs | 1 + .../main/ui/workspace/sidebar/options/menus/measures.scss | 7 +++++++ 2 files changed, 8 insertions(+) diff --git a/frontend/src/app/main/ui/workspace/sidebar/options/menus/measures.cljs b/frontend/src/app/main/ui/workspace/sidebar/options/menus/measures.cljs index 510d6ac0a..f300dab8b 100644 --- a/frontend/src/app/main/ui/workspace/sidebar/options/menus/measures.cljs +++ b/frontend/src/app/main/ui/workspace/sidebar/options/menus/measures.cljs @@ -484,6 +484,7 @@ [:span {:class (stl/css :icon)} i/corner-radius] [:& editable-select {:placeholder (if (= :multiple (:rx values)) (tr "settings.multiple") "--") + :class (stl/css :token-select) :type "number" :min 0 :input-class (stl/css :numeric-input) diff --git a/frontend/src/app/main/ui/workspace/sidebar/options/menus/measures.scss b/frontend/src/app/main/ui/workspace/sidebar/options/menus/measures.scss index 71fdbefa7..810c79f37 100644 --- a/frontend/src/app/main/ui/workspace/sidebar/options/menus/measures.scss +++ b/frontend/src/app/main/ui/workspace/sidebar/options/menus/measures.scss @@ -236,3 +236,10 @@ .checkbox-button { @extend .button-icon; } + +.token-select { + li > span { + display: flex; + align-content: center; + } +} From cdca00a986ca154e99f05a2ec771e7f35a3d2736 Mon Sep 17 00:00:00 2001 From: Florian Schroedl Date: Thu, 16 May 2024 09:02:48 +0200 Subject: [PATCH 07/13] Extract token apply function --- frontend/src/app/main/data/tokens.cljs | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/frontend/src/app/main/data/tokens.cljs b/frontend/src/app/main/data/tokens.cljs index 503941a8b..f04dd7ad7 100644 --- a/frontend/src/app/main/data/tokens.cljs +++ b/frontend/src/app/main/data/tokens.cljs @@ -55,15 +55,20 @@ (->> (map (fn [attr] [attr token-id]) attributes) (into {}))) +(defn apply-token-id [{:keys [shape token-id attributes]}] + (let [token (token-from-attributes token-id attributes)] + (toggle-or-apply-token shape token))) + (defn update-token-from-attributes [{:keys [token-id shape-id attributes]}] (ptk/reify ::update-token-from-attributes ptk/WatchEvent (watch [_ state _] (let [shape (get-shape-from-state shape-id state) - token (token-from-attributes token-id attributes) - next-applied-tokens (toggle-or-apply-token shape token)] - (rx/of (update-shape shape-id {:applied-tokens next-applied-tokens})))))) + applied-tokens (apply-token-id {:shape shape + :token-id token-id + :attributes attributes})] + (rx/of (update-shape shape-id {:applied-tokens applied-tokens})))))) (defn add-token [token] From c60c5ac34fb971bfb8deffb29b17349cfec0b9b1 Mon Sep 17 00:00:00 2001 From: Florian Schroedl Date: Thu, 16 May 2024 09:33:20 +0200 Subject: [PATCH 08/13] Apply tokens directly to shape --- frontend/src/app/main/data/tokens.cljs | 12 ++++++++---- .../workspace/sidebar/options/menus/measures.cljs | 14 ++++++++------ .../src/app/main/ui/workspace/tokens/core.cljs | 3 +++ 3 files changed, 19 insertions(+), 10 deletions(-) diff --git a/frontend/src/app/main/data/tokens.cljs b/frontend/src/app/main/data/tokens.cljs index f04dd7ad7..b960a4369 100644 --- a/frontend/src/app/main/data/tokens.cljs +++ b/frontend/src/app/main/data/tokens.cljs @@ -55,19 +55,23 @@ (->> (map (fn [attr] [attr token-id]) attributes) (into {}))) -(defn apply-token-id [{:keys [shape token-id attributes]}] +(defn apply-token-id-to-attributes [{:keys [shape token-id attributes]}] (let [token (token-from-attributes token-id attributes)] (toggle-or-apply-token shape token))) +(defn apply-token-to-shape [{:keys [shape _token-id _attributes] :as props}] + (let [applied-tokens (apply-token-id-to-attributes props)] + (update shape :applied-tokens #(merge % applied-tokens)))) + (defn update-token-from-attributes [{:keys [token-id shape-id attributes]}] (ptk/reify ::update-token-from-attributes ptk/WatchEvent (watch [_ state _] (let [shape (get-shape-from-state shape-id state) - applied-tokens (apply-token-id {:shape shape - :token-id token-id - :attributes attributes})] + applied-tokens (apply-token-id-to-attributes {:shape shape + :token-id token-id + :attributes attributes})] (rx/of (update-shape shape-id {:applied-tokens applied-tokens})))))) (defn add-token diff --git a/frontend/src/app/main/ui/workspace/sidebar/options/menus/measures.cljs b/frontend/src/app/main/ui/workspace/sidebar/options/menus/measures.cljs index f300dab8b..fd942ffe6 100644 --- a/frontend/src/app/main/ui/workspace/sidebar/options/menus/measures.cljs +++ b/frontend/src/app/main/ui/workspace/sidebar/options/menus/measures.cljs @@ -262,7 +262,7 @@ (update-fn shape) shape)) {:reg-objects? true - :attrs [:rx :ry :r1 :r2 :r3 :r4]}))) + :attrs [:rx :ry :r1 :r2 :r3 :r4 :applied-tokens]}))) on-switch-to-radius-1 (mf/use-fn @@ -293,12 +293,14 @@ (fn [value] (let [token (when (symbol? value) (get border-radius-tokens (str value))) - token-value (wtc/resolve-token-value token)] + token-value (some-> token wtc/resolve-token-value)] (st/emit! - (dt/update-token-from-attributes {:token-id (:id token) - :shape-id (first ids) - :attributes (get-in wtc/token-types [:border-radius :attributes])}) - (change-radius #(ctsr/set-radius-1 % (or token-value value))))))) + (change-radius (fn [shape] + (cond-> shape + token-value (#(dt/apply-token-to-shape {:token-id (:id token) + :shape % + :attributes (wtc/token-attributes :border-radius)})) + :always (ctsr/set-radius-1 (or token-value value))))))))) on-radius-multi-change (mf/use-fn diff --git a/frontend/src/app/main/ui/workspace/tokens/core.cljs b/frontend/src/app/main/ui/workspace/tokens/core.cljs index c237cae76..d502ae4aa 100644 --- a/frontend/src/app/main/ui/workspace/tokens/core.cljs +++ b/frontend/src/app/main/ui/workspace/tokens/core.cljs @@ -188,3 +188,6 @@ {:label "Paragraph Indent" :key :paragraph-indent} {:label "Text Decoration" :key :text-decoration} {:label "Text Case" :key :text-case}]}}])) + +(defn token-attributes [token-type] + (get-in token-types [token-type :attributes])) From 0d154679e9f6dc52c13518a63c148cd1efa4b967 Mon Sep 17 00:00:00 2001 From: Florian Schroedl Date: Thu, 16 May 2024 09:44:11 +0200 Subject: [PATCH 09/13] Add docstrings --- frontend/src/app/main/ui/workspace/tokens/core.cljs | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/frontend/src/app/main/ui/workspace/tokens/core.cljs b/frontend/src/app/main/ui/workspace/tokens/core.cljs index d502ae4aa..20eebea40 100644 --- a/frontend/src/app/main/ui/workspace/tokens/core.cljs +++ b/frontend/src/app/main/ui/workspace/tokens/core.cljs @@ -44,12 +44,18 @@ (group-by :type))) (defn tokens-name-map - "Convert tokens into a map with their `:name` as the key." + "Convert tokens into a map with their `:name` as the key. + + E.g.: {\"sm\" {:token-type :border-radius :id #uuid \"000\" ...}}" [tokens] (->> (map (fn [{:keys [name] :as token}] [name token]) tokens) (into {}))) -(defn tokens-name-map-for-type [token-type tokens] +(defn tokens-name-map-for-type + "Convert tokens with `token-type` into a map with their `:name` as the key. + + E.g.: {\"sm\" {:token-type :border-radius :id #uuid \"000\" ...}}" + [token-type tokens] (-> (group-tokens-by-type tokens) (get token-type []) (tokens-name-map))) From 48c85d72002a1a2023c1774c13c3a2075c585b55 Mon Sep 17 00:00:00 2001 From: Florian Schroedl Date: Thu, 16 May 2024 09:55:57 +0200 Subject: [PATCH 10/13] Simplify token application --- frontend/src/app/main/data/tokens.cljs | 15 +++++++++++++-- .../workspace/sidebar/options/menus/measures.cljs | 10 +++++----- 2 files changed, 18 insertions(+), 7 deletions(-) diff --git a/frontend/src/app/main/data/tokens.cljs b/frontend/src/app/main/data/tokens.cljs index b960a4369..fce743303 100644 --- a/frontend/src/app/main/data/tokens.cljs +++ b/frontend/src/app/main/data/tokens.cljs @@ -59,10 +59,21 @@ (let [token (token-from-attributes token-id attributes)] (toggle-or-apply-token shape token))) -(defn apply-token-to-shape [{:keys [shape _token-id _attributes] :as props}] - (let [applied-tokens (apply-token-id-to-attributes props)] +(defn apply-token-to-shape + "When the passed `:token` is non-nil apply it to the `:applied-tokens` on a shape." + [{:keys [shape token attributes] :as props}] + (let [applied-tokens (apply-token-id-to-attributes {:shape shape + :token-id (:id token) + :attributes attributes})] (update shape :applied-tokens #(merge % applied-tokens)))) +(defn maybe-apply-token-to-shape + "When the passed `:token` is non-nil apply it to the `:applied-tokens` on a shape." + [{:keys [shape token _attributes] :as props}] + (if token + (apply-token-to-shape props) + shape)) + (defn update-token-from-attributes [{:keys [token-id shape-id attributes]}] (ptk/reify ::update-token-from-attributes diff --git a/frontend/src/app/main/ui/workspace/sidebar/options/menus/measures.cljs b/frontend/src/app/main/ui/workspace/sidebar/options/menus/measures.cljs index fd942ffe6..7350b15ce 100644 --- a/frontend/src/app/main/ui/workspace/sidebar/options/menus/measures.cljs +++ b/frontend/src/app/main/ui/workspace/sidebar/options/menus/measures.cljs @@ -296,11 +296,11 @@ token-value (some-> token wtc/resolve-token-value)] (st/emit! (change-radius (fn [shape] - (cond-> shape - token-value (#(dt/apply-token-to-shape {:token-id (:id token) - :shape % - :attributes (wtc/token-attributes :border-radius)})) - :always (ctsr/set-radius-1 (or token-value value))))))))) + (-> (dt/maybe-apply-token-to-shape + {:token-id token + :shape shape + :attributes (wtc/token-attributes :border-radius)}) + (ctsr/set-radius-1 (or token-value value))))))))) on-radius-multi-change (mf/use-fn From 23bee8415a69355135a57eb80a609ff672ce557a Mon Sep 17 00:00:00 2001 From: Florian Schroedl Date: Thu, 16 May 2024 09:59:55 +0200 Subject: [PATCH 11/13] Fix missing dependency --- .../app/main/ui/workspace/sidebar/options/menus/measures.cljs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/frontend/src/app/main/ui/workspace/sidebar/options/menus/measures.cljs b/frontend/src/app/main/ui/workspace/sidebar/options/menus/measures.cljs index 7350b15ce..433e1f007 100644 --- a/frontend/src/app/main/ui/workspace/sidebar/options/menus/measures.cljs +++ b/frontend/src/app/main/ui/workspace/sidebar/options/menus/measures.cljs @@ -289,7 +289,7 @@ on-radius-1-change (mf/use-fn - (mf/deps ids change-radius) + (mf/deps ids change-radius border-radius-tokens) (fn [value] (let [token (when (symbol? value) (get border-radius-tokens (str value))) From 5205b684e9dde4582dd5b99ea67710a6e0af4a56 Mon Sep 17 00:00:00 2001 From: Florian Schroedl Date: Thu, 16 May 2024 11:36:08 +0200 Subject: [PATCH 12/13] Fix token not being applied --- .../main/ui/workspace/sidebar/options/menus/measures.cljs | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/frontend/src/app/main/ui/workspace/sidebar/options/menus/measures.cljs b/frontend/src/app/main/ui/workspace/sidebar/options/menus/measures.cljs index 433e1f007..d457c3d7a 100644 --- a/frontend/src/app/main/ui/workspace/sidebar/options/menus/measures.cljs +++ b/frontend/src/app/main/ui/workspace/sidebar/options/menus/measures.cljs @@ -296,10 +296,9 @@ token-value (some-> token wtc/resolve-token-value)] (st/emit! (change-radius (fn [shape] - (-> (dt/maybe-apply-token-to-shape - {:token-id token - :shape shape - :attributes (wtc/token-attributes :border-radius)}) + (-> (dt/maybe-apply-token-to-shape {:token token + :shape shape + :attributes (wtc/token-attributes :border-radius)}) (ctsr/set-radius-1 (or token-value value))))))))) on-radius-multi-change From c654766f87563ddcac7ce3c9330b9841e08fc357 Mon Sep 17 00:00:00 2001 From: Florian Schroedl Date: Thu, 16 May 2024 11:43:37 +0200 Subject: [PATCH 13/13] Cleanup outdated props --- frontend/src/app/main/data/tokens.cljs | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/frontend/src/app/main/data/tokens.cljs b/frontend/src/app/main/data/tokens.cljs index fce743303..b2935364b 100644 --- a/frontend/src/app/main/data/tokens.cljs +++ b/frontend/src/app/main/data/tokens.cljs @@ -60,8 +60,7 @@ (toggle-or-apply-token shape token))) (defn apply-token-to-shape - "When the passed `:token` is non-nil apply it to the `:applied-tokens` on a shape." - [{:keys [shape token attributes] :as props}] + [{:keys [shape token attributes] :as _props}] (let [applied-tokens (apply-token-id-to-attributes {:shape shape :token-id (:id token) :attributes attributes})]