From 4df3f085d821112ef08aa26061a3993c748fdab6 Mon Sep 17 00:00:00 2001 From: Andrey Antukh Date: Mon, 30 Mar 2026 10:53:26 +0000 Subject: [PATCH] :recycle: Update frontend rendering and UI for :path-data Update the WASM render bridge and UI shape components to read :path-data instead of :content for path and bool shapes. The render_wasm/shape.cljs case dispatch now handles :path-data separately from :content (which remains for text and svg-raw shapes). Affected namespaces: - app.render-wasm.{shape,api} - app.main.ui.shapes.{path,bool} - app.main.ui.workspace.shapes.{path,bool} - app.main.ui.workspace.shapes.path.editor Signed-off-by: Andrey Antukh --- frontend/src/app/main/ui/shapes/bool.cljs | 4 ++-- frontend/src/app/main/ui/shapes/path.cljs | 2 +- frontend/src/app/main/ui/workspace/shapes/bool.cljs | 2 +- frontend/src/app/main/ui/workspace/shapes/path.cljs | 2 +- .../src/app/main/ui/workspace/shapes/path/editor.cljs | 2 +- frontend/src/app/render_wasm/api.cljs | 5 +++-- frontend/src/app/render_wasm/shape.cljs | 11 ++++++----- 7 files changed, 15 insertions(+), 13 deletions(-) diff --git a/frontend/src/app/main/ui/shapes/bool.cljs b/frontend/src/app/main/ui/shapes/bool.cljs index 7f831a1ddb..e066d3c076 100644 --- a/frontend/src/app/main/ui/shapes/bool.cljs +++ b/frontend/src/app/main/ui/shapes/bool.cljs @@ -25,7 +25,7 @@ metadata? (mf/use-ctx use/include-metadata-ctx) content (mf/with-memo [shape child-objs] - (let [content (:content shape)] + (let [content (:path-data shape)] (cond (some? content) content @@ -34,7 +34,7 @@ (path/calc-bool-content shape child-objs)))) shape (mf/with-memo [shape content] - (assoc shape :content content))] + (assoc shape :path-data content))] [:* (when (some? content) diff --git a/frontend/src/app/main/ui/shapes/path.cljs b/frontend/src/app/main/ui/shapes/path.cljs index e1a21eac89..5a8bf1b653 100644 --- a/frontend/src/app/main/ui/shapes/path.cljs +++ b/frontend/src/app/main/ui/shapes/path.cljs @@ -27,7 +27,7 @@ (mf/defc path-shape {::mf/props :obj} [{:keys [shape]}] - (let [content (get shape :content) + (let [content (get shape :path-data) pdata (mf/with-memo [content] (try (content->string content) diff --git a/frontend/src/app/main/ui/workspace/shapes/bool.cljs b/frontend/src/app/main/ui/workspace/shapes/bool.cljs index 536bd7fe68..397815e6c5 100644 --- a/frontend/src/app/main/ui/workspace/shapes/bool.cljs +++ b/frontend/src/app/main/ui/workspace/shapes/bool.cljs @@ -35,7 +35,7 @@ shape (cond-> shape ^boolean child-sel? - (dissoc :content))] + (dissoc :path-data))] [:> shape-container {:shape shape} [:& bool-shape {:shape shape diff --git a/frontend/src/app/main/ui/workspace/shapes/path.cljs b/frontend/src/app/main/ui/workspace/shapes/path.cljs index 0f8da115b3..ce21940335 100644 --- a/frontend/src/app/main/ui/workspace/shapes/path.cljs +++ b/frontend/src/app/main/ui/workspace/shapes/path.cljs @@ -23,7 +23,7 @@ (defn- apply-content-modifiers [shape content-modifiers] - (let [shape (update shape :content types.path/apply-content-modifiers content-modifiers)] + (let [shape (update shape :path-data types.path/apply-content-modifiers content-modifiers)] (types.path/update-geometry shape))) (mf/defc path-wrapper diff --git a/frontend/src/app/main/ui/workspace/shapes/path/editor.cljs b/frontend/src/app/main/ui/workspace/shapes/path/editor.cljs index 24996169ac..db88631d28 100644 --- a/frontend/src/app/main/ui/workspace/shapes/path/editor.cljs +++ b/frontend/src/app/main/ui/workspace/shapes/path/editor.cljs @@ -283,7 +283,7 @@ (or selected-points #{}) base-content - (get shape :content) + (get shape :path-data) base-points (mf/with-memo [base-content] diff --git a/frontend/src/app/render_wasm/api.cljs b/frontend/src/app/render_wasm/api.cljs index 27dc63e5c6..4d423140ff 100644 --- a/frontend/src/app/render_wasm/api.cljs +++ b/frontend/src/app/render_wasm/api.cljs @@ -1028,6 +1028,7 @@ (if (= type :text) (ensure-text-content content) content)) + path-data (get shape :path-data) bool-type (get shape :bool-type) grow-type (get shape :grow-type) blur (get shape :blur) @@ -1043,10 +1044,10 @@ (set-masked (boolean masked))) (when (= type :bool) (set-shape-bool-type bool-type)) - (when (and (some? content) + (when (and (some? path-data) (or (= type :path) (= type :bool))) - (set-shape-path-content content)) + (set-shape-path-content path-data)) (when (some? svg-attrs) (set-shape-svg-attrs svg-attrs)) (when (and (some? content) (= type :svg-raw)) diff --git a/frontend/src/app/render_wasm/shape.cljs b/frontend/src/app/render_wasm/shape.cljs index 7809d5ca0f..11a5861170 100644 --- a/frontend/src/app/render_wasm/shape.cljs +++ b/frontend/src/app/render_wasm/shape.cljs @@ -144,7 +144,7 @@ (do (api/set-shape-type v) (when (or (= v :path) (= v :bool)) - (api/set-shape-path-content (:content shape)))) + (api/set-shape-path-content (:path-data shape)))) :bool-type (api/set-shape-bool-type v) @@ -236,12 +236,13 @@ (when (cfh/group-shape? shape) (api/set-masked (boolean (:masked-group shape)))) + :path-data + (when (or (cfh/path-shape? shape) + (cfh/bool-shape? shape)) + (api/set-shape-path-content v)) + :content (cond - (or (cfh/path-shape? shape) - (cfh/bool-shape? shape)) - (api/set-shape-path-content v) - (cfh/svg-raw-shape? shape) (api/set-shape-svg-raw-content (api/get-static-markup shape))