diff --git a/backend/src/app/rpc/commands/files.clj b/backend/src/app/rpc/commands/files.clj index 29bb36a9c..9b3a6bbc9 100644 --- a/backend/src/app/rpc/commands/files.clj +++ b/backend/src/app/rpc/commands/files.clj @@ -409,7 +409,7 @@ "Given the page data, removes the `:thumbnail` prop from all shapes." [page] - (update page :objects d/update-vals #(dissoc % :thumbnail))) + (update page :objects update-vals #(dissoc % :thumbnail))) (defn get-page [conn {:keys [file-id page-id object-id features]}] diff --git a/common/src/app/common/data.cljc b/common/src/app/common/data.cljc index 8dd84f3ee..c89794e9d 100644 --- a/common/src/app/common/data.cljc +++ b/common/src/app/common/data.cljc @@ -232,13 +232,6 @@ ([mfn coll] (into {} (mapm mfn) coll))) -(defn update-vals - "m f => {k (f v) ...} - Given a map m and a function f of 1-argument, returns a new map where the keys of m - are mapped to result of applying f to the corresponding values of m." - [m f] - (c/update-vals m f)) - (defn removev "Returns a vector of the items in coll for which (fn item) returns logical false" [fn coll] diff --git a/common/src/app/common/pages/helpers.cljc b/common/src/app/common/pages/helpers.cljc index 76e234f57..3428d4797 100644 --- a/common/src/app/common/pages/helpers.cljc +++ b/common/src/app/common/pages/helpers.cljc @@ -411,7 +411,7 @@ cur (-> (or (get objects frame-id) (transient {})) (assoc! id shape))] (assoc! objects frame-id cur)))] - (d/update-vals + (update-vals (->> objects (reduce process-shape (transient {})) (persistent!)) @@ -432,7 +432,7 @@ (update shape :shapes #(filterv selected+parents %)))] (-> (select-keys objects selected+parents) - (d/update-vals remove-children)))) + (update-vals remove-children)))) (defn is-child? [objects parent-id candidate-child-id] diff --git a/common/src/app/common/pages/indices.cljc b/common/src/app/common/pages/indices.cljc index 9a7a94b6a..7a5e8ef1a 100644 --- a/common/src/app/common/pages/indices.cljc +++ b/common/src/app/common/pages/indices.cljc @@ -6,7 +6,6 @@ (ns app.common.pages.indices (:require - [app.common.data :as d] [app.common.pages.helpers :as cph] [app.common.uuid :as uuid])) @@ -54,4 +53,4 @@ (mapcat get-clip-parents)) parents)))] (-> parents-index - (d/update-vals retrieve-clips)))) + (update-vals retrieve-clips)))) diff --git a/common/src/app/common/pages/migrations.cljc b/common/src/app/common/pages/migrations.cljc index 6ff873c8e..effbee310 100644 --- a/common/src/app/common/pages/migrations.cljc +++ b/common/src/app/common/pages/migrations.cljc @@ -54,9 +54,9 @@ (into [] shapes) shapes)))) (update-page [page] - (update page :objects d/update-vals update-object))] + (update page :objects update-vals update-object))] - (update data :pages-index d/update-vals update-page))) + (update data :pages-index update-vals update-page))) ;; Changes paths formats (defmethod migrate 3 @@ -105,9 +105,9 @@ (fix-empty-points))) (update-page [page] - (update page :objects d/update-vals update-object))] + (update page :objects update-vals update-object))] - (update data :pages-index d/update-vals update-page))) + (update data :pages-index update-vals update-page))) ;; We did rollback version 4 migration. ;; Keep this in order to remember the next version to be 5 @@ -123,9 +123,9 @@ object)) (update-page [page] - (update page :objects d/update-vals update-object))] + (update page :objects update-vals update-object))] - (update data :pages-index d/update-vals update-page))) + (update data :pages-index update-vals update-page))) (defmethod migrate 6 [data] @@ -147,11 +147,11 @@ shape)) (update-container [container] - (update container :objects d/update-vals fix-line-paths))] + (update container :objects update-vals fix-line-paths))] (-> data - (update :pages-index d/update-vals update-container) - (update :components d/update-vals update-container)))) + (update :pages-index update-vals update-container) + (update :components update-vals update-container)))) ;; Remove interactions pointing to deleted frames (defmethod migrate 7 @@ -162,9 +162,9 @@ (filterv #(get-in page [:objects (:destination %)]) interactions)))) (update-page [page] - (update page :objects d/update-vals (partial update-object page)))] + (update page :objects update-vals (partial update-object page)))] - (update data :pages-index d/update-vals update-page))) + (update data :pages-index update-vals update-page))) ;; Remove groups without any shape, both in pages and components @@ -205,8 +205,8 @@ (assoc container :objects objects)))))] (-> data - (update :pages-index d/update-vals clean-container) - (update :components d/update-vals clean-container)))) + (update :pages-index update-vals clean-container) + (update :components update-vals clean-container)))) (defmethod migrate 9 [data] @@ -240,7 +240,7 @@ [data] (letfn [(update-page [page] (d/update-in-when page [:objects uuid/zero] dissoc :points :selrect))] - (update data :pages-index d/update-vals update-page))) + (update data :pages-index update-vals update-page))) (defmethod migrate 11 [data] @@ -252,9 +252,9 @@ (update-page [page] (update page :objects (fn [objects] - (d/update-vals objects (partial update-object objects)))))] + (update-vals objects (partial update-object objects)))))] - (update data :pages-index d/update-vals update-page))) + (update data :pages-index update-vals update-page))) (defmethod migrate 12 [data] @@ -264,9 +264,9 @@ (assoc :size nil))) (update-page [page] - (d/update-in-when page [:options :saved-grids] d/update-vals update-grid))] + (d/update-in-when page [:options :saved-grids] update-vals update-grid))] - (update data :pages-index d/update-vals update-page))) + (update data :pages-index update-vals update-page))) ;; Add rx and ry to images (defmethod migrate 13 @@ -284,9 +284,9 @@ (fix-radius))) (update-page [page] - (update page :objects d/update-vals update-object))] + (update page :objects update-vals update-object))] - (update data :pages-index d/update-vals update-page))) + (update data :pages-index update-vals update-page))) (defmethod migrate 14 [data] @@ -314,8 +314,8 @@ (assoc container :objects objects))))] (-> data - (update :pages-index d/update-vals update-container) - (update :components d/update-vals update-container)))) + (update :pages-index update-vals update-container) + (update :components update-vals update-container)))) (defmethod migrate 15 [data] data) @@ -361,11 +361,11 @@ (assign-fills))) (update-container [container] - (update container :objects d/update-vals update-object))] + (update container :objects update-vals update-object))] (-> data - (update :pages-index d/update-vals update-container) - (update :components d/update-vals update-container)))) + (update :pages-index update-vals update-container) + (update :components update-vals update-container)))) (defmethod migrate 17 [data] @@ -390,11 +390,11 @@ (assoc :fills []))) (update-container [container] - (update container :objects d/update-vals update-object))] + (update container :objects update-vals update-object))] (-> data - (update :pages-index d/update-vals update-container) - (update :components d/update-vals update-container)))) + (update :pages-index update-vals update-container) + (update :components update-vals update-container)))) ;;Remove position-data to solve a bug with the text positioning (defmethod migrate 18 @@ -405,11 +405,11 @@ (dissoc :position-data))) (update-container [container] - (update container :objects d/update-vals update-object))] + (update container :objects update-vals update-object))] (-> data - (update :pages-index d/update-vals update-container) - (update :components d/update-vals update-container)))) + (update :pages-index update-vals update-container) + (update :components update-vals update-container)))) (defmethod migrate 19 [data] @@ -421,11 +421,11 @@ (dissoc :position-data))) (update-container [container] - (update container :objects d/update-vals update-object))] + (update container :objects update-vals update-object))] (-> data - (update :pages-index d/update-vals update-container) - (update :components d/update-vals update-container)))) + (update :pages-index update-vals update-container) + (update :components update-vals update-container)))) ;; TODO: pending to do a migration for delete already not used fill ;; and stroke props. This should be done for >1.14.x version. diff --git a/frontend/src/app/main/data/workspace/persistence.cljs b/frontend/src/app/main/data/workspace/persistence.cljs index 47c80be58..202548673 100644 --- a/frontend/src/app/main/data/workspace/persistence.cljs +++ b/frontend/src/app/main/data/workspace/persistence.cljs @@ -6,7 +6,6 @@ (ns app.main.data.workspace.persistence (:require - [app.common.data :as d] [app.common.data.macros :as dm] [app.common.logging :as log] [app.common.pages :as cp] @@ -156,7 +155,7 @@ frame-updates (-> (group-by :page-id changes) - (d/update-vals #(into #{} (mapcat :frames) %)))] + (update-vals #(into #{} (mapcat :frames) %)))] (rx/merge (->> (rx/from frame-updates) diff --git a/frontend/src/app/main/data/workspace/state_helpers.cljs b/frontend/src/app/main/data/workspace/state_helpers.cljs index f1a8acc35..e8bee24ec 100644 --- a/frontend/src/app/main/data/workspace/state_helpers.cljs +++ b/frontend/src/app/main/data/workspace/state_helpers.cljs @@ -132,7 +132,7 @@ children-ids (cph/get-children-ids objects parent-id) children (-> (select-keys objects children-ids) - (d/update-vals + (update-vals (fn [child] (cond-> child (contains? modifiers (:id child)) diff --git a/frontend/src/app/main/ui/workspace/shapes/text/viewport_texts_html.cljs b/frontend/src/app/main/ui/workspace/shapes/text/viewport_texts_html.cljs index 8dc6f1e82..e13e2fced 100644 --- a/frontend/src/app/main/ui/workspace/shapes/text/viewport_texts_html.cljs +++ b/frontend/src/app/main/ui/workspace/shapes/text/viewport_texts_html.cljs @@ -242,7 +242,7 @@ text-shapes (mf/use-memo (mf/deps text-shapes modifiers) - #(d/update-vals text-shapes (partial process-shape modifiers))) + #(update-vals text-shapes (partial process-shape modifiers))) editing-shape (get text-shapes edition) diff --git a/frontend/src/app/worker/import.cljs b/frontend/src/app/worker/import.cljs index a58f4e054..cdccc632e 100644 --- a/frontend/src/app/worker/import.cljs +++ b/frontend/src/app/worker/import.cljs @@ -350,7 +350,7 @@ (mapv #(update % :starting-frame resolve))) guides (-> (get-in page-data [:options :guides]) - (d/update-vals #(update % :frame-id resolve))) + (update-vals #(update % :frame-id resolve))) page-data (-> page-data (d/assoc-in-when [:options :flows] flows)