mirror of
https://github.com/penpot/penpot.git
synced 2025-03-12 15:51:37 -05:00
🔥 Remove unused d/update-vals function
Already available as clojure.core/update-vals
This commit is contained in:
parent
ccb7c466bf
commit
1b9dea01e2
9 changed files with 42 additions and 51 deletions
|
@ -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]}]
|
||||
|
|
|
@ -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]
|
||||
|
|
|
@ -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]
|
||||
|
|
|
@ -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))))
|
||||
|
|
|
@ -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.
|
||||
|
|
|
@ -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)
|
||||
|
|
|
@ -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))
|
||||
|
|
|
@ -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)
|
||||
|
||||
|
|
|
@ -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)
|
||||
|
|
Loading…
Add table
Reference in a new issue