mirror of
https://github.com/penpot/penpot.git
synced 2025-08-04 00:49:02 +02:00
🎉 Show changed assets when updating libraries
This commit is contained in:
parent
96a5444357
commit
ca88314524
19 changed files with 475 additions and 50 deletions
|
@ -51,4 +51,6 @@
|
|||
(->> (ctc/get-all-colors shape)
|
||||
(keep #(get-ref-color (:data library) %))
|
||||
(remove #(< (:modified-at %) since-date)) ;; Note that :modified-at may be nil
|
||||
(map #(vector (:id shape) (:id %) :color))))
|
||||
(map (fn [color] {:shape-id (:id shape)
|
||||
:asset-id (:id color)
|
||||
:asset-type :color}))))
|
||||
|
|
|
@ -116,7 +116,9 @@
|
|||
(let [component (get-component (:data library) (:component-id shape))]
|
||||
(if (< (:modified-at component) since-date) ;; Note that :modified-at may be nil
|
||||
[]
|
||||
[[(:id shape) (:component-id shape) :component]]))
|
||||
[{:shape-id (:id shape)
|
||||
:asset-id (:component-id shape)
|
||||
:asset-type :component}]))
|
||||
[]))
|
||||
|
||||
(defn get-component-annotation
|
||||
|
|
|
@ -223,7 +223,7 @@
|
|||
"Add an :objects property to the component, with only the shapes that belong to it"
|
||||
[file-data component]
|
||||
(let [components-v2 (dm/get-in file-data [:options :components-v2])]
|
||||
(if (and components-v2 component (nil? (:objects component))) ;; This operation may be called twice, e.g. in an idempotent change
|
||||
(if (and components-v2 component (empty? (:objects component))) ;; This operation may be called twice, e.g. in an idempotent change
|
||||
(let [component-page (get-component-page file-data component)
|
||||
page-objects (:objects component-page)
|
||||
objects (->> (cons (:main-instance-id component)
|
||||
|
@ -324,14 +324,15 @@
|
|||
been modified after the given date."
|
||||
[file-data library since-date]
|
||||
(letfn [(used-assets-shape [shape]
|
||||
(concat
|
||||
(ctkl/used-components-changed-since shape library since-date)
|
||||
(ctcl/used-colors-changed-since shape library since-date)
|
||||
(ctyl/used-typographies-changed-since shape library since-date)))
|
||||
(concat
|
||||
(ctkl/used-components-changed-since shape library since-date)
|
||||
(ctcl/used-colors-changed-since shape library since-date)
|
||||
(ctyl/used-typographies-changed-since shape library since-date)))
|
||||
|
||||
(used-assets-container [container]
|
||||
(->> (mapcat used-assets-shape (ctn/shapes-seq container))
|
||||
(map #(cons (:id container) %))))]
|
||||
(->> (ctn/shapes-seq container)
|
||||
(mapcat used-assets-shape)
|
||||
(map #(assoc % :container-id (:id container)))))]
|
||||
|
||||
(mapcat used-assets-container (containers-seq file-data))))
|
||||
|
||||
|
|
|
@ -53,4 +53,6 @@
|
|||
txt/node-seq
|
||||
(keep #(get-ref-typography (:data library) %))
|
||||
(remove #(< (:modified-at %) since-date)) ;; Note that :modified-at may be nil
|
||||
(map #(vector (:id shape) (:id %) :typography))))
|
||||
(map (fn [node] {:shape-id (:id shape)
|
||||
:asset-id (:id node)
|
||||
:asset-type :typography}))))
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue