0
Fork 0
mirror of https://github.com/penpot/penpot.git synced 2025-02-03 04:49:03 -05:00

💄 Fix args and docstrings

This commit is contained in:
Andrés Moya 2021-02-01 17:25:29 +01:00 committed by Alonso Torres
parent 77973af49f
commit 526e0afc70

View file

@ -50,7 +50,8 @@
(-> state (-> state
(update-in [:workspace-file :colors] #(d/replace-by-id % color)))))) (update-in [:workspace-file :colors] #(d/replace-by-id % color))))))
(defn change-palette-size [size] (defn change-palette-size
[size]
(s/assert #{:big :small} size) (s/assert #{:big :small} size)
(ptk/reify ::change-palette-size (ptk/reify ::change-palette-size
ptk/UpdateEvent ptk/UpdateEvent
@ -58,24 +59,27 @@
(-> state (-> state
(assoc-in [:workspace-local :selected-palette-size] size))))) (assoc-in [:workspace-local :selected-palette-size] size)))))
(defn change-palette-selected [selected] (defn change-palette-selected
"Change the library used by the general palette tool" "Change the library used by the general palette tool"
[selected]
(ptk/reify ::change-palette-selected (ptk/reify ::change-palette-selected
ptk/UpdateEvent ptk/UpdateEvent
(update [_ state] (update [_ state]
(-> state (-> state
(assoc-in [:workspace-local :selected-palette] selected))))) (assoc-in [:workspace-local :selected-palette] selected)))))
(defn change-palette-selected-colorpicker [selected] (defn change-palette-selected-colorpicker
"Change the library used by the color picker" "Change the library used by the color picker"
[selected]
(ptk/reify ::change-palette-selected-colorpicker (ptk/reify ::change-palette-selected-colorpicker
ptk/UpdateEvent ptk/UpdateEvent
(update [_ state] (update [_ state]
(-> state (-> state
(assoc-in [:workspace-local :selected-palette-colorpicker] selected))))) (assoc-in [:workspace-local :selected-palette-colorpicker] selected)))))
(defn show-palette [selected] (defn show-palette
"Show the palette tool and change the library it uses" "Show the palette tool and change the library it uses"
[selected]
(ptk/reify ::change-palette-selected (ptk/reify ::change-palette-selected
ptk/UpdateEvent ptk/UpdateEvent
(update [_ state] (update [_ state]
@ -83,14 +87,16 @@
(update :workspace-layout conj :colorpalette) (update :workspace-layout conj :colorpalette)
(assoc-in [:workspace-local :selected-palette] selected))))) (assoc-in [:workspace-local :selected-palette] selected)))))
(defn start-picker [] (defn start-picker
[]
(ptk/reify ::start-picker (ptk/reify ::start-picker
ptk/UpdateEvent ptk/UpdateEvent
(update [_ state] (update [_ state]
(-> state (-> state
(assoc-in [:workspace-local :picking-color?] true))))) (assoc-in [:workspace-local :picking-color?] true)))))
(defn stop-picker [] (defn stop-picker
[]
(ptk/reify ::stop-picker (ptk/reify ::stop-picker
ptk/UpdateEvent ptk/UpdateEvent
(update [_ state] (update [_ state]
@ -99,14 +105,16 @@
(update :workspace-local dissoc :picked-shift?) (update :workspace-local dissoc :picked-shift?)
(assoc-in [:workspace-local :picking-color?] false))))) (assoc-in [:workspace-local :picking-color?] false)))))
(defn pick-color [rgba] (defn pick-color
[rgba]
(ptk/reify ::pick-color (ptk/reify ::pick-color
ptk/UpdateEvent ptk/UpdateEvent
(update [_ state] (update [_ state]
(-> state (-> state
(assoc-in [:workspace-local :picked-color] rgba))))) (assoc-in [:workspace-local :picked-color] rgba)))))
(defn pick-color-select [value shift?] (defn pick-color-select
[value shift?]
(ptk/reify ::pick-color-select (ptk/reify ::pick-color-select
ptk/UpdateEvent ptk/UpdateEvent
(update [_ state] (update [_ state]
@ -141,7 +149,8 @@
(map #(dwt/update-text-attrs {:id % :editor (get editors %) :attrs attrs}) text-ids) (map #(dwt/update-text-attrs {:id % :editor (get editors %) :attrs attrs}) text-ids)
(dwc/update-shapes shape-ids update-fn)))))))) (dwc/update-shapes shape-ids update-fn))))))))
(defn change-stroke [ids color] (defn change-stroke
[ids color]
(ptk/reify ::change-stroke (ptk/reify ::change-stroke
ptk/WatchEvent ptk/WatchEvent
(watch [_ state s] (watch [_ state s]
@ -163,7 +172,8 @@
:stroke-opacity 1)))] :stroke-opacity 1)))]
(rx/of (dwc/update-shapes ids update-fn)))))) (rx/of (dwc/update-shapes ids update-fn))))))
(defn picker-for-selected-shape [] (defn picker-for-selected-shape
[]
(let [sub (rx/subject)] (let [sub (rx/subject)]
(ptk/reify ::picker-for-selected-shape (ptk/reify ::picker-for-selected-shape
ptk/WatchEvent ptk/WatchEvent
@ -199,7 +209,8 @@
:props {:on-change handle-change-color} :props {:on-change handle-change-color}
:allow-click-outside true}))))))) :allow-click-outside true})))))))
(defn start-gradient [gradient] (defn start-gradient
[gradient]
(ptk/reify ::start-gradient (ptk/reify ::start-gradient
ptk/UpdateEvent ptk/UpdateEvent
(update [_ state] (update [_ state]
@ -208,21 +219,24 @@
(assoc-in [:workspace-local :current-gradient] gradient) (assoc-in [:workspace-local :current-gradient] gradient)
(assoc-in [:workspace-local :current-gradient :shape-id] id)))))) (assoc-in [:workspace-local :current-gradient :shape-id] id))))))
(defn stop-gradient [] (defn stop-gradient
[]
(ptk/reify ::stop-gradient (ptk/reify ::stop-gradient
ptk/UpdateEvent ptk/UpdateEvent
(update [_ state] (update [_ state]
(-> state (-> state
(update :workspace-local dissoc :current-gradient))))) (update :workspace-local dissoc :current-gradient)))))
(defn update-gradient [changes] (defn update-gradient
[changes]
(ptk/reify ::update-gradient (ptk/reify ::update-gradient
ptk/UpdateEvent ptk/UpdateEvent
(update [_ state] (update [_ state]
(-> state (-> state
(update-in [:workspace-local :current-gradient] merge changes))))) (update-in [:workspace-local :current-gradient] merge changes)))))
(defn select-gradient-stop [spot] (defn select-gradient-stop
[spot]
(ptk/reify ::select-gradient-stop (ptk/reify ::select-gradient-stop
ptk/UpdateEvent ptk/UpdateEvent
(update [_ state] (update [_ state]