mirror of
https://github.com/penpot/penpot.git
synced 2025-12-11 22:14:05 +01:00
Add active theme toggling
This commit is contained in:
@@ -254,6 +254,11 @@
|
||||
[:type [:= :add-temporary-token-theme]]
|
||||
[:token-theme ::ctot/token-theme]]]
|
||||
|
||||
[:update-active-token-themes
|
||||
[:map {:title "UpdateActiveTokenThemes"}
|
||||
[:type [:= :update-active-token-themes]]
|
||||
[:theme-ids [:set ::sm/uuid]]]]
|
||||
|
||||
[:delete-temporary-token-theme
|
||||
[:map {:title "DeleteTemporaryTokenThemeChange"}
|
||||
[:type [:= :delete-temporary-token-theme]]
|
||||
@@ -790,6 +795,10 @@
|
||||
[data {:keys [token-theme]}]
|
||||
(ctotl/add-temporary-token-theme data token-theme))
|
||||
|
||||
(defmethod process-change :update-active-token-themes
|
||||
[data {:keys [theme-ids]}]
|
||||
(ctotl/assoc-active-token-themes data theme-ids))
|
||||
|
||||
(defmethod process-change :delete-temporary-token-theme
|
||||
[data {:keys [id]}]
|
||||
(ctotl/delete-temporary-token-theme data id))
|
||||
|
||||
@@ -702,6 +702,13 @@
|
||||
(update :undo-changes conj {:type :delete-temporary-token-theme :id (:id token-theme)})
|
||||
(apply-changes-local)))
|
||||
|
||||
(defn update-active-token-themes
|
||||
[changes token-active-theme-ids prev-token-active-theme-ids]
|
||||
(-> changes
|
||||
(update :redo-changes conj {:type :update-active-token-themes :theme-ids token-active-theme-ids})
|
||||
(update :undo-changes conj {:type :update-active-token-themes :theme-ids prev-token-active-theme-ids})
|
||||
(apply-changes-local)))
|
||||
|
||||
(defn add-token-theme
|
||||
[changes token-theme]
|
||||
(-> changes
|
||||
|
||||
@@ -65,8 +65,7 @@
|
||||
[:map-of {:gen/max 5} :keyword ::ctpg/plugin-data]]
|
||||
[:token-theme-temporary-id {:optional true}
|
||||
::sm/uuid]
|
||||
[:token-active-themes {:optional true
|
||||
:default #{}}
|
||||
[:token-active-themes {:optional true :default #{}}
|
||||
[:set ::sm/uuid]]
|
||||
[:token-themes {:optional true}
|
||||
[:vector ::sm/uuid]]
|
||||
|
||||
@@ -14,6 +14,10 @@
|
||||
[token-set]
|
||||
(assoc token-set :modified-at (dt/now)))
|
||||
|
||||
(defn assoc-active-token-themes
|
||||
[file-data theme-ids]
|
||||
(assoc file-data :token-active-themes theme-ids))
|
||||
|
||||
(defn add-temporary-token-theme
|
||||
[file-data {:keys [id] :as token-theme}]
|
||||
(-> file-data
|
||||
|
||||
Reference in New Issue
Block a user