0
Fork 0
mirror of https://github.com/penpot/penpot.git synced 2025-03-12 07:41:43 -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 "Return a map without the keys provided
in the `keys` parameter." in the `keys` parameter."
[data keys] [data keys]
(when (and (some? data) (map? data)) (when (map? data)
(persistent! (persistent!
(reduce #(dissoc! %1 %2) (transient data) keys)))) (reduce #(dissoc! %1 %2) (transient data) keys))))

View file

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

View file

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

View file

@ -506,7 +506,7 @@
(let [typographies (get-assets library-id :typographies state) (let [typographies (get-assets library-id :typographies state)
update-node (fn [node] update-node (fn [node]
(if-let [typography (get typographies (:typography-ref-id 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 (dissoc node :typography-ref-id
:typography-ref-file)))] :typography-ref-file)))]
(generate-sync-text-shape shape container update-node))) (generate-sync-text-shape shape container update-node)))

View file

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

View file

@ -57,7 +57,7 @@
(let [{:keys [x y width height fill-color] :as shape} (obj/get props "shape")] (let [{:keys [x y width height fill-color] :as shape} (obj/get props "shape")]
(if (some? (:thumbnail shape)) (if (some? (:thumbnail shape))
[:& thumbnail {:shape 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 (defn custom-deferred
[component] [component]

View file

@ -1172,7 +1172,7 @@
attrs (merge attrs (merge
{:typography-ref-file file-id {:typography-ref-file file-id
:typography-ref-id (:id typography)} :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})) (run! #(st/emit! (dwt/update-text-attrs {:id % :editor (get-in local [:editors %]) :attrs attrs}))
ids))) ids)))

View file

@ -78,7 +78,7 @@
update-color update-color
(fn [index] (fn [index]
(fn [color opacity] (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 (st/emit! (dch/update-shapes
ids ids
#(-> % #(-> %

View file

@ -483,7 +483,7 @@
color {:color (:color attrs) color {:color (:color attrs)
:opacity (-> attrs :opacity d/parse-double)} :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 :size d/parse-double)
(d/update-when :item-length d/parse-double) (d/update-when :item-length d/parse-double)
(d/update-when :gutter d/parse-double) (d/update-when :gutter d/parse-double)