diff --git a/frontend/src/app/main/ui/context.cljs b/frontend/src/app/main/ui/context.cljs index 012408866..ed8079435 100644 --- a/frontend/src/app/main/ui/context.cljs +++ b/frontend/src/app/main/ui/context.cljs @@ -8,7 +8,7 @@ (:require [rumext.alpha :as mf])) -(def render-ctx (mf/create-context nil)) +(def render-id (mf/create-context nil)) (def current-route (mf/create-context nil)) (def current-profile (mf/create-context nil)) diff --git a/frontend/src/app/main/ui/shapes/attrs.cljs b/frontend/src/app/main/ui/shapes/attrs.cljs index 4b95e4350..f94871a5f 100644 --- a/frontend/src/app/main/ui/shapes/attrs.cljs +++ b/frontend/src/app/main/ui/shapes/attrs.cljs @@ -159,7 +159,7 @@ (defn add-style-attrs ([props shape] - (let [render-id (mf/use-ctx muc/render-ctx)] + (let [render-id (mf/use-ctx muc/render-id)] (add-style-attrs props shape render-id))) ([props shape render-id] diff --git a/frontend/src/app/main/ui/shapes/custom_stroke.cljs b/frontend/src/app/main/ui/shapes/custom_stroke.cljs index c0eb8ddf4..7753c3f32 100644 --- a/frontend/src/app/main/ui/shapes/custom_stroke.cljs +++ b/frontend/src/app/main/ui/shapes/custom_stroke.cljs @@ -211,7 +211,7 @@ {::mf/wrap-props false} [props] - (let [render-id (mf/use-ctx muc/render-ctx) + (let [render-id (mf/use-ctx muc/render-id) child (obj/get props "children") base-props (obj/get child "props") elem-name (obj/get child "type") @@ -253,7 +253,7 @@ (mf/defc inner-stroke {::mf/wrap-props false} [props] - (let [render-id (mf/use-ctx muc/render-ctx) + (let [render-id (mf/use-ctx muc/render-id) child (obj/get props "children") base-props (obj/get child "props") elem-name (obj/get child "type") @@ -292,7 +292,7 @@ (let [child (obj/get props "children") shape (obj/get props "shape") - render-id (mf/use-ctx muc/render-ctx) + render-id (mf/use-ctx muc/render-id) index (obj/get props "index") stroke-width (:stroke-width shape 0) stroke-style (:stroke-style shape :none) @@ -417,7 +417,7 @@ shape (obj/get props "shape") elem-name (obj/get child "type") position (or (obj/get props "position") 0) - render-id (or (obj/get props "render-id") (mf/use-ctx muc/render-ctx))] + render-id (or (obj/get props "render-id") (mf/use-ctx muc/render-id))] [:g {:id (dm/fmt "fills-%" (:id shape))} [:> elem-name (build-fill-props shape child position render-id)]])) @@ -427,7 +427,7 @@ (let [child (obj/get props "children") shape (obj/get props "shape") elem-name (obj/get child "type") - render-id (or (obj/get props "render-id") (mf/use-ctx muc/render-ctx)) + render-id (or (obj/get props "render-id") (mf/use-ctx muc/render-id)) stroke-id (dm/fmt "strokes-%" (:id shape)) stroke-props (-> (obj/create) (obj/set! "id" stroke-id) diff --git a/frontend/src/app/main/ui/shapes/export.cljs b/frontend/src/app/main/ui/shapes/export.cljs index 5f8ceba50..b2453f7e0 100644 --- a/frontend/src/app/main/ui/shapes/export.cljs +++ b/frontend/src/app/main/ui/shapes/export.cljs @@ -286,7 +286,7 @@ (for [[index fill] (d/enumerate fills)] [:> "penpot:fill" #js {:penpot:fill-color (if (some? (:fill-color-gradient fill)) - (str/format "url(#%s)" (str "fill-color-gradient_" (mf/use-ctx muc/render-ctx) "_" index)) + (str/format "url(#%s)" (str "fill-color-gradient_" (mf/use-ctx muc/render-id) "_" index)) (d/name (:fill-color fill))) :penpot:fill-color-ref-file (d/name (:fill-color-ref-file fill)) :penpot:fill-color-ref-id (d/name (:fill-color-ref-id fill)) @@ -299,7 +299,7 @@ (for [[index stroke] (d/enumerate strokes)] [:> "penpot:stroke" #js {:penpot:stroke-color (if (some? (:stroke-color-gradient stroke)) - (str/format "url(#%s)" (str "stroke-color-gradient_" (mf/use-ctx muc/render-ctx) "_" index)) + (str/format "url(#%s)" (str "stroke-color-gradient_" (mf/use-ctx muc/render-id) "_" index)) (d/name (:stroke-color stroke))) :penpot:stroke-color-ref-file (d/name (:stroke-color-ref-file stroke)) :penpot:stroke-color-ref-id (d/name (:stroke-color-ref-id stroke)) diff --git a/frontend/src/app/main/ui/shapes/frame.cljs b/frontend/src/app/main/ui/shapes/frame.cljs index 1aa7a7b5b..ba821a5d7 100644 --- a/frontend/src/app/main/ui/shapes/frame.cljs +++ b/frontend/src/app/main/ui/shapes/frame.cljs @@ -62,7 +62,7 @@ :height height :className "frame-background"})) path? (some? (.-d props)) - render-id (mf/use-ctx muc/render-ctx)] + render-id (mf/use-ctx muc/render-id)] [:* [:g {:clip-path (when (not show-content) (frame-clip-url shape render-id))} diff --git a/frontend/src/app/main/ui/shapes/gradients.cljs b/frontend/src/app/main/ui/shapes/gradients.cljs index a57678bf4..9d45482f4 100644 --- a/frontend/src/app/main/ui/shapes/gradients.cljs +++ b/frontend/src/app/main/ui/shapes/gradients.cljs @@ -104,7 +104,7 @@ (let [attr (obj/get props "attr") shape (obj/get props "shape") id (obj/get props "id") - id' (mf/use-ctx muc/render-ctx) + id' (mf/use-ctx muc/render-id) id (or id (dm/str (name attr) "_" id')) gradient (get shape attr) gradient-props #js {:id id diff --git a/frontend/src/app/main/ui/shapes/group.cljs b/frontend/src/app/main/ui/shapes/group.cljs index 88dc6186d..664c4e834 100644 --- a/frontend/src/app/main/ui/shapes/group.cljs +++ b/frontend/src/app/main/ui/shapes/group.cljs @@ -21,7 +21,7 @@ (let [shape (unchecked-get props "shape") childs (unchecked-get props "childs") objects (unchecked-get props "objects") - render-id (mf/use-ctx muc/render-ctx) + render-id (mf/use-ctx muc/render-id) masked-group? (:masked-group? shape) [mask childs] (if masked-group? diff --git a/frontend/src/app/main/ui/shapes/mask.cljs b/frontend/src/app/main/ui/shapes/mask.cljs index 5c353d120..c43b12a60 100644 --- a/frontend/src/app/main/ui/shapes/mask.cljs +++ b/frontend/src/app/main/ui/shapes/mask.cljs @@ -47,18 +47,18 @@ {::mf/wrap-props false} [props] (let [mask (unchecked-get props "mask") - render-id (mf/use-ctx muc/render-ctx) + render-id (mf/use-ctx muc/render-id) svg-text? (and (= :text (:type mask)) (some? (:position-data mask))) ;; This factory is generic, it's used for viewer, workspace and handoff. - ;; These props are generated in viewer wrappers only, in the rest of the - ;; cases these props will be nil, not affecting the code. + ;; These props are generated in viewer wrappers only, in the rest of the + ;; cases these props will be nil, not affecting the code. fixed? (unchecked-get props "fixed?") delta (unchecked-get props "delta") mask-bb (-> (gsh/transform-shape mask) (cond-> fixed? (gsh/move delta)) (:points)) - + mask-bb-rect (gsh/points->rect mask-bb)] [:defs [:filter {:id (filter-id render-id mask)} diff --git a/frontend/src/app/main/ui/shapes/shape.cljs b/frontend/src/app/main/ui/shapes/shape.cljs index 3b868ca9d..9743204d0 100644 --- a/frontend/src/app/main/ui/shapes/shape.cljs +++ b/frontend/src/app/main/ui/shapes/shape.cljs @@ -93,7 +93,7 @@ svg-group? (propagate-wrapper-styles wrapper-props))] - [:& (mf/provider muc/render-ctx) {:value render-id} + [:& (mf/provider muc/render-id) {:value render-id} [:> :g wrapper-props (when include-metadata? [:& ed/export-data {:shape shape}]) diff --git a/frontend/src/app/main/ui/shapes/text/svg_text.cljs b/frontend/src/app/main/ui/shapes/text/svg_text.cljs index b4585b532..3f90c6cd3 100644 --- a/frontend/src/app/main/ui/shapes/text/svg_text.cljs +++ b/frontend/src/app/main/ui/shapes/text/svg_text.cljs @@ -53,7 +53,7 @@ ::mf/wrap [mf/memo]} [props] - (let [render-id (mf/use-ctx muc/render-ctx) + (let [render-id (mf/use-ctx muc/render-id) shape (obj/get props "shape") shape (cond-> shape (:is-mask? shape) set-white-fill) @@ -106,6 +106,6 @@ (obj/set! "fill" (str "url(#fill-" index "-" render-id ")")))}) shape (assoc shape :fills (:fills data))] - [:& (mf/provider muc/render-ctx) {:key index :value (str render-id "_" (:id shape) "_" index)} + [:& (mf/provider muc/render-id) {:key index :value (str render-id "_" (:id shape) "_" index)} [:& shape-custom-strokes {:shape shape :position index :render-id render-id} [:> :text props (:text data)]]]))]]))