0
Fork 0
mirror of https://github.com/penpot/penpot.git synced 2025-03-11 23:31:21 -05:00

Improvements after review

This commit is contained in:
alonso.torres 2021-12-01 14:39:02 +01:00
parent 565046aaa6
commit 7564f27f95
9 changed files with 12 additions and 12 deletions

View file

@ -157,7 +157,7 @@
"Return a map without the keys provided
in the `keys` parameter."
[data keys]
(when (and (some? data) (map? data))
(when (map? data)
(persistent!
(reduce #(dissoc! %1 %2) (transient data) keys))))

View file

@ -345,8 +345,7 @@
;; or not.
(defn empty-modifiers? [modifiers]
(or (nil? modifiers)
(empty? (d/without-keys modifiers [:ignore-geometry?]))))
(empty? (dissoc modifiers :ignore-geometry?)))
(defn resize-modifiers
[shape attr value]

View file

@ -502,6 +502,7 @@
(defn children-seq
"Creates a sequence of shapes through the objects tree"
[shape objects]
(tree-seq #(d/not-empty? (get shape :shapes))
#(->> (get % :shapes) (map (partial get objects)))
shape))
(let [getter (partial get objects)]
(tree-seq #(d/not-empty? (get shape :shapes))
#(->> (get % :shapes) (map getter))
shape)))

View file

@ -506,7 +506,7 @@
(let [typographies (get-assets library-id :typographies state)
update-node (fn [node]
(if-let [typography (get typographies (:typography-ref-id node))]
(merge node (d/without-keys typography [:name :id]))
(merge node (dissoc typography :name :id))
(dissoc node :typography-ref-id
:typography-ref-file)))]
(generate-sync-text-shape shape container update-node)))

View file

@ -133,7 +133,7 @@
[{:keys [grids]}]
[:> "penpot:grids" #js {}
(for [{:keys [type display params]} grids]
(let [props (->> (d/without-keys params [:color])
(let [props (->> (dissoc params :color)
(prefix-keys)
(clj->js))]
[:> "penpot:grid"

View file

@ -57,7 +57,7 @@
(let [{:keys [x y width height fill-color] :as shape} (obj/get props "shape")]
(if (some? (:thumbnail shape))
[:& thumbnail {:shape shape}]
[:rect {:x x :y y :width width :height height :style {:fill (or fill-color "white")}}])))
[:rect {:x x :y y :width width :height height :style {:fill (or fill-color "var(--color-white)")}}])))
(defn custom-deferred
[component]

View file

@ -1172,7 +1172,7 @@
attrs (merge
{:typography-ref-file file-id
:typography-ref-id (:id typography)}
(d/without-keys typography [:id :name]))]
(dissoc typography :id :name))]
(run! #(st/emit! (dwt/update-text-attrs {:id % :editor (get-in local [:editors %]) :attrs attrs}))
ids)))

View file

@ -78,7 +78,7 @@
update-color
(fn [index]
(fn [color opacity]
(let [color (d/without-keys color [:id :file-id :gradient])]
(let [color (dissoc color :id :file-id :gradient)]
(st/emit! (dch/update-shapes
ids
#(-> %

View file

@ -483,7 +483,7 @@
color {:color (:color attrs)
:opacity (-> attrs :opacity d/parse-double)}
params (-> (d/without-keys attrs [:color :opacity :display :type])
params (-> (dissoc attrs :color :opacity :display :type)
(d/update-when :size d/parse-double)
(d/update-when :item-length d/parse-double)
(d/update-when :gutter d/parse-double)