diff --git a/backend/src/app/db.clj b/backend/src/app/db.clj index c874fb9cc..9b923495b 100644 --- a/backend/src/app/db.clj +++ b/backend/src/app/db.clj @@ -213,7 +213,7 @@ [& args] `(jdbc/with-transaction ~@args)) -(defn ^Connection open +(defn open [pool] (jdbc/get-connection pool)) diff --git a/backend/src/app/rpc/mutations/ldap.clj b/backend/src/app/rpc/mutations/ldap.clj index b4cc37afb..8ff5c2305 100644 --- a/backend/src/app/rpc/mutations/ldap.clj +++ b/backend/src/app/rpc/mutations/ldap.clj @@ -27,7 +27,8 @@ (s/def ::info-data (s/keys :req-un [::fullname ::email ::backend])) -(defn ^java.lang.AutoCloseable connect +(defn connect + ^java.lang.AutoCloseable [] (let [params {:ssl? (cfg/get :ldap-ssl) :startTLS? (cfg/get :ldap-starttls) diff --git a/backend/src/app/storage/s3.clj b/backend/src/app/storage/s3.clj index f169f6bcf..9c2129638 100644 --- a/backend/src/app/storage/s3.clj +++ b/backend/src/app/storage/s3.clj @@ -130,7 +130,8 @@ (def default-timeout (dt/duration {:seconds 30})) -(defn- ^Region lookup-region +(defn- lookup-region + ^Region [region] (Region/of (name region))) diff --git a/backend/src/app/util/emails.clj b/backend/src/app/util/emails.clj index 7136a288c..dca9b732e 100644 --- a/backend/src/app/util/emails.clj +++ b/backend/src/app/util/emails.clj @@ -30,7 +30,8 @@ [v] (InternetAddress/parse ^String v)) -(defn- ^Message$RecipientType resolve-recipient-type +(defn- resolve-recipient-type + ^Message$RecipientType [type] (case type :to Message$RecipientType/TO @@ -157,7 +158,8 @@ (.setDebug session debug) session)) -(defn ^MimeMessage smtp-message +(defn smtp-message + ^MimeMessage [cfg message] (let [^Session session (smtp-session cfg)] (build-message cfg session message))) diff --git a/frontend/src/app/main/ui/shapes/attrs.cljs b/frontend/src/app/main/ui/shapes/attrs.cljs index 3eb2d1377..32353e9f7 100644 --- a/frontend/src/app/main/ui/shapes/attrs.cljs +++ b/frontend/src/app/main/ui/shapes/attrs.cljs @@ -169,7 +169,7 @@ [svg-attrs svg-styles] (extract-svg-attrs render-id svg-defs svg-attrs) - styles (-> (obj/get props "style" (obj/new)) + styles (-> (obj/get props "style" (obj/create)) (obj/merge! svg-styles) (add-layer-props shape)) @@ -211,24 +211,24 @@ (defn extract-style-attrs [shape] - (-> (obj/new) + (-> (obj/create) (add-style-attrs shape))) (defn extract-fill-attrs [fill-data render-id index type] - (let [fill-styles (-> (obj/get fill-data "style" (obj/new)) + (let [fill-styles (-> (obj/get fill-data "style" (obj/create)) (add-fill fill-data render-id index type))] - (-> (obj/new) + (-> (obj/create) (obj/set! "style" fill-styles)))) (defn extract-stroke-attrs [stroke-data index render-id] - (let [stroke-styles (-> (obj/get stroke-data "style" (obj/new)) + (let [stroke-styles (-> (obj/get stroke-data "style" (obj/create)) (add-stroke stroke-data render-id index))] - (-> (obj/new) + (-> (obj/create) (obj/set! "style" stroke-styles)))) (defn extract-border-radius-attrs [shape] - (-> (obj/new) + (-> (obj/create) (add-border-radius shape))) diff --git a/frontend/src/app/main/ui/shapes/custom_stroke.cljs b/frontend/src/app/main/ui/shapes/custom_stroke.cljs index 5c5782b02..775a2eb6d 100644 --- a/frontend/src/app/main/ui/shapes/custom_stroke.cljs +++ b/frontend/src/app/main/ui/shapes/custom_stroke.cljs @@ -428,7 +428,7 @@ elem-name (obj/get child "type") render-id (or (obj/get props "render-id") (mf/use-ctx muc/render-ctx)) stroke-id (dm/fmt "strokes-%" (:id shape)) - stroke-props (-> (obj/new) + stroke-props (-> (obj/create) (obj/set! "id" stroke-id) (cond-> ;; There is a blur diff --git a/frontend/src/app/main/ui/shapes/export.cljs b/frontend/src/app/main/ui/shapes/export.cljs index c5b548ccf..c59b46a6b 100644 --- a/frontend/src/app/main/ui/shapes/export.cljs +++ b/frontend/src/app/main/ui/shapes/export.cljs @@ -262,7 +262,7 @@ (when (= (:type shape) :svg-raw) (let [shape (-> shape (d/update-in-when [:content :attrs :style] str->style)) props - (-> (obj/new) + (-> (obj/create) (obj/set! "penpot:x" (:x shape)) (obj/set! "penpot:y" (:y shape)) (obj/set! "penpot:width" (:width shape)) @@ -328,7 +328,7 @@ (mf/defc export-data [{:keys [shape]}] - (let [props (-> (obj/new) (add-data shape) (add-library-refs shape))] + (let [props (-> (obj/create) (add-data shape) (add-library-refs shape))] [:> "penpot:shape" props (export-shadow-data shape) (export-blur-data shape) diff --git a/frontend/src/app/main/ui/shapes/group.cljs b/frontend/src/app/main/ui/shapes/group.cljs index 403a9f2a0..88dc6186d 100644 --- a/frontend/src/app/main/ui/shapes/group.cljs +++ b/frontend/src/app/main/ui/shapes/group.cljs @@ -34,18 +34,18 @@ ; Firefox bug: https://bugzilla.mozilla.org/show_bug.cgi?id=1734805 [clip-wrapper clip-props] (if masked-group? - ["g" (-> (obj/new) + ["g" (-> (obj/create) (obj/set! "clipPath" (clip-url render-id mask)))] [mf/Fragment nil]) [mask-wrapper mask-props] (if masked-group? - ["g" (-> (obj/new) - (obj/set! "mask" (mask-url render-id mask)))] + ["g" (-> (obj/create) + (obj/set! "mask" (mask-url render-id mask)))] [mf/Fragment nil]) ;; 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 + ;; These props are generated in viewer wrappers only, in the rest of the ;; cases these props will be nil, not affecting the code. delta (unchecked-get props "delta") fixed? (unchecked-get props "fixed?")] diff --git a/frontend/src/app/main/ui/shapes/shape.cljs b/frontend/src/app/main/ui/shapes/shape.cljs index 6ec138194..c22da29d8 100644 --- a/frontend/src/app/main/ui/shapes/shape.cljs +++ b/frontend/src/app/main/ui/shapes/shape.cljs @@ -55,9 +55,8 @@ type (:type shape) render-id (mf/use-memo #(str (uuid/next))) filter-id (str "filter_" render-id) - styles (-> (obj/new) + styles (-> (obj/create) (obj/set! "pointerEvents" pointer-events) - (cond-> (and (:blend-mode shape) (not= (:blend-mode shape) :normal)) (obj/set! "mixBlendMode" (d/name (:blend-mode shape))))) diff --git a/frontend/src/app/main/ui/shapes/svg_defs.cljs b/frontend/src/app/main/ui/shapes/svg_defs.cljs index d127361cb..d46007c9f 100644 --- a/frontend/src/app/main/ui/shapes/svg_defs.cljs +++ b/frontend/src/app/main/ui/shapes/svg_defs.cljs @@ -11,7 +11,6 @@ [app.common.geom.matrix :as gmt] [app.common.geom.shapes :as gsh] [app.main.ui.shapes.filters :as f] - [app.util.object :as obj] [app.util.svg :as usvg] [rumext.alpha :as mf])) @@ -68,7 +67,7 @@ [wrapper wrapper-props] (if (= tag :mask) ["g" #js {:className "svg-mask-wrapper" :transform (str transform)}] - [mf/Fragment (obj/new)])] + [mf/Fragment #js {}])] [:> (name tag) (clj->js attrs) [:> wrapper wrapper-props diff --git a/frontend/src/app/main/ui/shapes/text/fo_text.cljs b/frontend/src/app/main/ui/shapes/text/fo_text.cljs index 1e6a259d1..8f3f53575 100644 --- a/frontend/src/app/main/ui/shapes/text/fo_text.cljs +++ b/frontend/src/app/main/ui/shapes/text/fo_text.cljs @@ -212,11 +212,11 @@ :y y :id id :data-colors (->> colors (str/join ",")) - :data-mapping (-> color-mapping-inverse (clj->js) (js/JSON.stringify)) + :data-mapping (-> color-mapping-inverse clj->js js/JSON.stringify) :transform transform :width (if (#{:auto-width} grow-type) 100000 width) :height (if (#{:auto-height :auto-width} grow-type) 100000 height) - :style (-> (obj/new) (attrs/add-layer-props shape)) + :style (-> (obj/create) (attrs/add-layer-props shape)) :ref ref} ;; We use a class here because react has a bug that won't use the appropriate selector for ;; `background-clip` diff --git a/frontend/src/app/main/ui/viewer/handoff/render.cljs b/frontend/src/app/main/ui/viewer/handoff/render.cljs index a016077cc..d46c2eabd 100644 --- a/frontend/src/app/main/ui/viewer/handoff/render.cljs +++ b/frontend/src/app/main/ui/viewer/handoff/render.cljs @@ -89,7 +89,7 @@ childs (mapv #(get objects %) (:shapes shape)) shape (geom/transform-shape shape) - props (-> (obj/new) + props (-> (obj/create) (obj/merge! props) (obj/merge! #js {:shape shape :childs childs}))] @@ -105,7 +105,7 @@ [props] (let [shape (unchecked-get props "shape") childs (mapv #(get objects %) (:shapes shape)) - props (-> (obj/new) + props (-> (obj/create) (obj/merge! props) (obj/merge! #js {:childs childs}))] [:> group-wrapper props])))) @@ -121,7 +121,7 @@ (let [shape (unchecked-get props "shape") children (->> (cph/get-children-ids objects (:id shape)) (select-keys objects)) - props (-> (obj/new) + props (-> (obj/create) (obj/merge! props) (obj/merge! #js {:childs children}))] [:> bool-wrapper props])))) @@ -136,7 +136,7 @@ [props] (let [shape (unchecked-get props "shape") childs (mapv #(get objects %) (:shapes shape)) - props (-> (obj/new) + props (-> (obj/create) (obj/merge! props) (obj/merge! #js {:childs childs}))] [:> svg-raw-wrapper props])))) diff --git a/frontend/src/app/util/object.cljs b/frontend/src/app/util/object.cljs index 0abdd9c90..325cfe344 100644 --- a/frontend/src/app/util/object.cljs +++ b/frontend/src/app/util/object.cljs @@ -6,12 +6,12 @@ (ns app.util.object "A collection of helpers for work with javascript objects." - (:refer-clojure :exclude [set! get get-in merge clone contains?]) + (:refer-clojure :exclude [set! new get get-in merge clone contains?]) (:require ["lodash/omit" :as omit] [cuerdas.core :as str])) -(defn new [] #js {}) +(defn create [] #js {}) (defn get ([obj k]