mirror of
https://github.com/penpot/penpot.git
synced 2025-01-26 00:19:07 -05:00
✨ Changes name to typography collection
This commit is contained in:
parent
f45845cf85
commit
2c23b0e7f4
7 changed files with 20 additions and 20 deletions
|
@ -877,15 +877,15 @@
|
||||||
|
|
||||||
(defmethod process-change :add-typography
|
(defmethod process-change :add-typography
|
||||||
[data {:keys [typography]}]
|
[data {:keys [typography]}]
|
||||||
(update data :typography assoc (:id typography) typography))
|
(update data :typographies assoc (:id typography) typography))
|
||||||
|
|
||||||
(defmethod process-change :mod-typography
|
(defmethod process-change :mod-typography
|
||||||
[data {:keys [typography]}]
|
[data {:keys [typography]}]
|
||||||
(d/update-in-when data [:typography (:id typography)] merge typography))
|
(d/update-in-when data [:typographies (:id typography)] merge typography))
|
||||||
|
|
||||||
(defmethod process-change :del-typography
|
(defmethod process-change :del-typography
|
||||||
[data {:keys [id]}]
|
[data {:keys [id]}]
|
||||||
(update data :typography dissoc id))
|
(update data :typographies dissoc id))
|
||||||
|
|
||||||
;; -- Operations
|
;; -- Operations
|
||||||
|
|
||||||
|
|
|
@ -453,7 +453,7 @@
|
||||||
(let [[rchanges1 uchanges1] (dwlh/generate-sync-file-components state file-id)
|
(let [[rchanges1 uchanges1] (dwlh/generate-sync-file-components state file-id)
|
||||||
[rchanges2 uchanges2] (dwlh/generate-sync-library-components state file-id)
|
[rchanges2 uchanges2] (dwlh/generate-sync-library-components state file-id)
|
||||||
[rchanges3 uchanges3] (dwlh/generate-sync-file :colors file-id state)
|
[rchanges3 uchanges3] (dwlh/generate-sync-file :colors file-id state)
|
||||||
[rchanges4 uchanges4] (dwlh/generate-sync-file :typography file-id state)
|
[rchanges4 uchanges4] (dwlh/generate-sync-file :typographies file-id state)
|
||||||
rchanges (d/concat rchanges1 rchanges2 rchanges3 rchanges4)
|
rchanges (d/concat rchanges1 rchanges2 rchanges3 rchanges4)
|
||||||
uchanges (d/concat uchanges1 uchanges2 uchanges3 uchanges4)]
|
uchanges (d/concat uchanges1 uchanges2 uchanges3 uchanges4)]
|
||||||
(rx/concat
|
(rx/concat
|
||||||
|
@ -543,7 +543,7 @@
|
||||||
(ptk/reify ::update-typography
|
(ptk/reify ::update-typography
|
||||||
ptk/WatchEvent
|
ptk/WatchEvent
|
||||||
(watch [_ state stream]
|
(watch [_ state stream]
|
||||||
(let [prev (get-in state [:workspace-data :typography (:id typography)])
|
(let [prev (get-in state [:workspace-data :typographies (:id typography)])
|
||||||
rchg {:type :mod-typography
|
rchg {:type :mod-typography
|
||||||
:typography typography}
|
:typography typography}
|
||||||
uchg {:type :mod-typography
|
uchg {:type :mod-typography
|
||||||
|
@ -557,7 +557,7 @@
|
||||||
(ptk/reify ::delete-typography
|
(ptk/reify ::delete-typography
|
||||||
ptk/WatchEvent
|
ptk/WatchEvent
|
||||||
(watch [_ state stream]
|
(watch [_ state stream]
|
||||||
(let [prev (get-in state [:workspace-data :typography id])
|
(let [prev (get-in state [:workspace-data :typographies id])
|
||||||
rchg {:type :del-typography
|
rchg {:type :del-typography
|
||||||
:id id}
|
:id id}
|
||||||
uchg {:type :add-typography
|
uchg {:type :add-typography
|
||||||
|
|
|
@ -35,7 +35,7 @@
|
||||||
and call synchronize"
|
and call synchronize"
|
||||||
[asset-type library-id state]
|
[asset-type library-id state]
|
||||||
|
|
||||||
(s/assert #{:colors :components :typography} asset-type)
|
(s/assert #{:colors :components :typographies} asset-type)
|
||||||
(s/assert (s/nilable ::us/uuid) library-id)
|
(s/assert (s/nilable ::us/uuid) library-id)
|
||||||
|
|
||||||
(let [library-items
|
(let [library-items
|
||||||
|
@ -73,7 +73,7 @@
|
||||||
(= library-id (get shape attr-ref-file))))
|
(= library-id (get shape attr-ref-file))))
|
||||||
cp/color-sync-attrs))
|
cp/color-sync-attrs))
|
||||||
|
|
||||||
:typography
|
:typographies
|
||||||
(fn [shape]
|
(fn [shape]
|
||||||
(and (= (:type shape) :text)
|
(and (= (:type shape) :text)
|
||||||
(->> shape
|
(->> shape
|
||||||
|
@ -146,7 +146,7 @@
|
||||||
(conj roperations roperation)
|
(conj roperations roperation)
|
||||||
(conj uoperations uoperation)))))))))
|
(conj uoperations uoperation)))))))))
|
||||||
|
|
||||||
(defmethod generate-sync-shape :typography
|
(defmethod generate-sync-shape :typographies
|
||||||
[_ library-id library-items page shape]
|
[_ library-id library-items page shape]
|
||||||
(let [update-node (fn [node]
|
(let [update-node (fn [node]
|
||||||
(if-let [typography (get library-items (:typography-ref-id node))]
|
(if-let [typography (get library-items (:typography-ref-id node))]
|
||||||
|
|
|
@ -100,7 +100,7 @@
|
||||||
(def workspace-file-typography
|
(def workspace-file-typography
|
||||||
(l/derived (fn [state]
|
(l/derived (fn [state]
|
||||||
(when-let [file (:workspace-file state)]
|
(when-let [file (:workspace-file state)]
|
||||||
(get-in file [:data :typography])))
|
(get-in file [:data :typographies])))
|
||||||
st/state))
|
st/state))
|
||||||
|
|
||||||
(def workspace-project
|
(def workspace-project
|
||||||
|
|
|
@ -28,7 +28,7 @@
|
||||||
(let [components-count (count (get-in library [:data :components] []))
|
(let [components-count (count (get-in library [:data :components] []))
|
||||||
graphics-count (count (get-in library [:data :media] []))
|
graphics-count (count (get-in library [:data :media] []))
|
||||||
colors-count (count (get-in library [:data :colors] []))
|
colors-count (count (get-in library [:data :colors] []))
|
||||||
typography-count (count (get-in library [:data :typography] []))]
|
typography-count (count (get-in library [:data :typographies] []))]
|
||||||
;; Include a so this block has always some content
|
;; Include a so this block has always some content
|
||||||
(str
|
(str
|
||||||
(str/join " · "
|
(str/join " · "
|
||||||
|
|
|
@ -465,8 +465,8 @@
|
||||||
(l/derived (fn [state]
|
(l/derived (fn [state]
|
||||||
(let [wfile (:workspace-file state)]
|
(let [wfile (:workspace-file state)]
|
||||||
(if (= (:id wfile) id)
|
(if (= (:id wfile) id)
|
||||||
(vals (get-in wfile [:data :typography]))
|
(vals (get-in wfile [:data :typographies]))
|
||||||
(vals (get-in state [:workspace-libraries id :data :typography])))))
|
(vals (get-in state [:workspace-libraries id :data :typographies])))))
|
||||||
st/state =))
|
st/state =))
|
||||||
|
|
||||||
(defn apply-filters
|
(defn apply-filters
|
||||||
|
@ -487,7 +487,7 @@
|
||||||
toggles (mf/use-state #{:components
|
toggles (mf/use-state #{:components
|
||||||
:graphics
|
:graphics
|
||||||
:colors
|
:colors
|
||||||
:typography})
|
:typographies})
|
||||||
|
|
||||||
url (rt/resolve router :workspace
|
url (rt/resolve router :workspace
|
||||||
{:project-id (:project-id file)
|
{:project-id (:project-id file)
|
||||||
|
@ -537,7 +537,7 @@
|
||||||
(or (> (count colors) 0)
|
(or (> (count colors) 0)
|
||||||
(str/empty? (:term filters))))
|
(str/empty? (:term filters))))
|
||||||
show-typography? (and (or (= (:box filters) :all)
|
show-typography? (and (or (= (:box filters) :all)
|
||||||
(= (:box filters) :typography))
|
(= (:box filters) :typographies))
|
||||||
(or (> (count colors) 0)
|
(or (> (count colors) 0)
|
||||||
(str/empty? (:term filters))))]
|
(str/empty? (:term filters))))]
|
||||||
[:div.tool-window-content
|
[:div.tool-window-content
|
||||||
|
@ -570,9 +570,9 @@
|
||||||
:local? local?
|
:local? local?
|
||||||
:locale locale
|
:locale locale
|
||||||
:typographies typographies
|
:typographies typographies
|
||||||
:open? (contains? @toggles :typography)
|
:open? (contains? @toggles :typographies)
|
||||||
:on-open #(swap! toggles conj :typography)
|
:on-open #(swap! toggles conj :typographies)
|
||||||
:on-close #(swap! toggles disj :typography)}])
|
:on-close #(swap! toggles disj :typographies)}])
|
||||||
|
|
||||||
(when (and (not show-components?) (not show-graphics?) (not show-colors?))
|
(when (and (not show-components?) (not show-graphics?) (not show-colors?))
|
||||||
[:div.asset-group
|
[:div.asset-group
|
||||||
|
@ -636,7 +636,7 @@
|
||||||
[:option {:value ":components"} (t locale "workspace.assets.components")]
|
[:option {:value ":components"} (t locale "workspace.assets.components")]
|
||||||
[:option {:value ":graphics"} (t locale "workspace.assets.graphics")]
|
[:option {:value ":graphics"} (t locale "workspace.assets.graphics")]
|
||||||
[:option {:value ":colors"} (t locale "workspace.assets.colors")]
|
[:option {:value ":colors"} (t locale "workspace.assets.colors")]
|
||||||
[:option {:value ":typography"} (t locale "workspace.assets.typography")]]]]
|
[:option {:value ":typographies"} (t locale "workspace.assets.typography")]]]]
|
||||||
|
|
||||||
[:div.libraries-wrapper
|
[:div.libraries-wrapper
|
||||||
[:& file-library
|
[:& file-library
|
||||||
|
|
|
@ -207,7 +207,7 @@
|
||||||
(not= (:typography-ref-id values) :multiple)
|
(not= (:typography-ref-id values) :multiple)
|
||||||
(:typography-ref-file values))
|
(:typography-ref-file values))
|
||||||
(-> shared-libs
|
(-> shared-libs
|
||||||
(get-in [(:typography-ref-file values) :data :typography (:typography-ref-id values)])
|
(get-in [(:typography-ref-file values) :data :typographies (:typography-ref-id values)])
|
||||||
(assoc :file-id (:typography-ref-file values)))
|
(assoc :file-id (:typography-ref-file values)))
|
||||||
|
|
||||||
(and (:typography-ref-id values)
|
(and (:typography-ref-id values)
|
||||||
|
|
Loading…
Add table
Reference in a new issue