From 90d052464f7711242a6c6a260a20f5ecb17ce1b4 Mon Sep 17 00:00:00 2001 From: Andrey Antukh Date: Thu, 2 Apr 2026 16:14:40 +0000 Subject: [PATCH] :recycle: Convert text-palette components to modern * format Convert typography-item, palette and text-palette to typography-item*, palette* and text-palette* using {:keys [...]} destructuring. Rename prop name-only? to is-name-only in typography-item*. Update internal call sites to [:> ...] and update the :refer import in palette.cljs. --- .../src/app/main/ui/workspace/palette.cljs | 8 ++--- .../app/main/ui/workspace/text_palette.cljs | 35 +++++++++---------- 2 files changed, 21 insertions(+), 22 deletions(-) diff --git a/frontend/src/app/main/ui/workspace/palette.cljs b/frontend/src/app/main/ui/workspace/palette.cljs index 80c396989e..74f5d6901f 100644 --- a/frontend/src/app/main/ui/workspace/palette.cljs +++ b/frontend/src/app/main/ui/workspace/palette.cljs @@ -23,7 +23,7 @@ [app.main.ui.icons :as deprecated-icon] [app.main.ui.workspace.color-palette :refer [color-palette*]] [app.main.ui.workspace.color-palette-ctx-menu :refer [color-palette-ctx-menu*]] - [app.main.ui.workspace.text-palette :refer [text-palette]] + [app.main.ui.workspace.text-palette :refer [text-palette*]] [app.main.ui.workspace.text-palette-ctx-menu :refer [text-palette-ctx-menu]] [app.util.dom :as dom] [app.util.i18n :refer [tr]] @@ -207,9 +207,9 @@ :close-menu on-close-menu :on-select-palette on-select-text-palette-menu :selected selected-text}] - [:& text-palette {:size size - :selected selected-text - :width vport-width}]]) + [:> text-palette* {:size size + :selected selected-text + :width vport-width}]]) (when color-palette? [:* [:> color-palette-ctx-menu* {:show show-menu? diff --git a/frontend/src/app/main/ui/workspace/text_palette.cljs b/frontend/src/app/main/ui/workspace/text_palette.cljs index 5325102a05..1e20f48bcf 100644 --- a/frontend/src/app/main/ui/workspace/text_palette.cljs +++ b/frontend/src/app/main/ui/workspace/text_palette.cljs @@ -22,8 +22,9 @@ [potok.v2.core :as ptk] [rumext.v2 :as mf])) -(mf/defc typography-item - [{:keys [file-id selected-ids typography name-only? size current-file-id]}] +(mf/defc typography-item* + {::mf/private true} + [{:keys [file-id selected-ids typography size current-file-id]}] (let [font-data (f/get-font-data (:font-id typography)) font-variant-id (:font-variant-id typography) variant-data (->> font-data :variants (d/seek #(= (:id %) font-variant-id))) @@ -60,14 +61,12 @@ :font-weight (:font-weight typography) :font-style (:font-style typography)}} (:name typography)] - (when-not name-only? - [:* - [:div {:class (stl/css :typography-font)} - (:name font-data)] - [:div {:class (stl/css :typography-data)} - (str (:font-size typography) "px | " (:name variant-data))]])])) + [:div {:class (stl/css :typography-font)} + (:name font-data)] + [:div {:class (stl/css :typography-data)} + (str (:font-size typography) "px | " (:name variant-data))]])) -(mf/defc palette +(mf/defc palette* [{:keys [selected selected-ids current-file-id file-typographies libraries size width]}] (let [file-id (case selected @@ -165,7 +164,7 @@ :max-width (str width "px") :right (str (* offset-step offset) "px")}} (for [[idx item] (map-indexed vector current-typographies)] - [:& typography-item + [:> typography-item* {:key idx :file-id file-id :current-file-id current-file-id @@ -178,7 +177,7 @@ :disabled (= offset max-offset) :on-click on-right-arrow-click} deprecated-icon/arrow])])) -(mf/defc text-palette +(mf/defc text-palette* {::mf/wrap [mf/memo]} [{:keys [size width selected] :as props}] (let [selected-ids (mf/deref refs/selected-shapes) @@ -189,10 +188,10 @@ file-typographies (mf/deref refs/workspace-file-typography) libraries (mf/deref refs/files) current-file-id (mf/use-ctx ctx/current-file-id)] - [:& palette {:current-file-id current-file-id - :selected-ids selected-ids - :file-typographies file-typographies - :libraries libraries - :width width - :selected selected - :size size}])) + [:> palette* {:current-file-id current-file-id + :selected-ids selected-ids + :file-typographies file-typographies + :libraries libraries + :width width + :selected selected + :size size}]))