diff --git a/common/src/app/common/files/changes.cljc b/common/src/app/common/files/changes.cljc index 27940f6be..5bbe20b11 100644 --- a/common/src/app/common/files/changes.cljc +++ b/common/src/app/common/files/changes.cljc @@ -292,7 +292,6 @@ [:mod-token-set [:map {:title "ModTokenSetChange"} [:type [:= :mod-token-set]] - [:id ::sm/uuid] [:name :string] [:token-set ::ctot/token-set]]] diff --git a/common/src/app/common/files/changes_builder.cljc b/common/src/app/common/files/changes_builder.cljc index c422adb2c..df67b78e4 100644 --- a/common/src/app/common/files/changes_builder.cljc +++ b/common/src/app/common/files/changes_builder.cljc @@ -745,8 +745,8 @@ (defn update-token-set [changes token-set prev-token-set] (-> changes - (update :redo-changes conj {:type :mod-token-set :id (:id token-set) :name (:name prev-token-set) :token-set token-set}) - (update :undo-changes conj {:type :mod-token-set :id (:id token-set) :name (:name prev-token-set) :token-set (or prev-token-set token-set)}) + (update :redo-changes conj {:type :mod-token-set :name (:name prev-token-set) :token-set token-set}) + (update :undo-changes conj {:type :mod-token-set :name (:name prev-token-set) :token-set (or prev-token-set token-set)}) (apply-changes-local))) (defn delete-token-set diff --git a/common/src/app/common/types/token_theme.cljc b/common/src/app/common/types/token_theme.cljc index 59d1bdc03..e370fb389 100644 --- a/common/src/app/common/types/token_theme.cljc +++ b/common/src/app/common/types/token_theme.cljc @@ -19,27 +19,9 @@ [:modified-at {:optional true} ::sm/inst] [:sets [:set {:gen/max 10 :gen/min 1} ::sm/uuid]]]) -(sm/register! ::token-set-group-ref - [:map - [:id ::sm/uuid] - [:type [:= :group]]]) - -(sm/register! ::token-set-ref - [:map - [:id ::sm/uuid] - [:type [:= :set]]]) - -(sm/register! ::token-set-group - [:map {:title "TokenSetGroup"} - [:id ::sm/uuid] - [:name :string] - [:items [:vector {:gen/max 10 :gen/min 1} - [:or ::token-set-group-ref ::token-set-ref]]]]) - (sm/register! ::token-set [:map {:title "TokenSet"} - [:id ::sm/uuid] [:name :string] - [:description {:optional true} :string] + [:description {:optional true} [:maybe :string]] [:modified-at {:optional true} ::sm/inst] - [:tokens [:vector {:gen/max 10 :gen/min 1} ::sm/uuid]]]) + [:tokens :any]]) diff --git a/frontend/src/app/main/data/tokens.cljs b/frontend/src/app/main/data/tokens.cljs index 12ccff1c3..f9e44ed75 100644 --- a/frontend/src/app/main/data/tokens.cljs +++ b/frontend/src/app/main/data/tokens.cljs @@ -182,11 +182,12 @@ (set-selected-token-set-id (:name new-token-set)) (dch/commit-changes changes))))))) -(defn update-token-set [token-set] +(defn update-token-set [set-name token-set] (ptk/reify ::update-token-set ptk/WatchEvent (watch [it state _] - (let [prev-token-set (wtts/get-token-set (:id token-set) state) + (let [prev-token-set (some-> (get-tokens-lib state) + (ctob/get-set set-name)) changes (-> (pcb/empty-changes it) (pcb/update-token-set token-set prev-token-set))] (rx/of diff --git a/frontend/src/app/main/ui/workspace/tokens/sets.cljs b/frontend/src/app/main/ui/workspace/tokens/sets.cljs index 48beaa723..447ba9f50 100644 --- a/frontend/src/app/main/ui/workspace/tokens/sets.cljs +++ b/frontend/src/app/main/ui/workspace/tokens/sets.cljs @@ -31,8 +31,8 @@ (dom/stop-propagation event) (st/emit! (wdt/delete-token-set (dm/legacy nil) name))) -(defn on-update-token-set [token-set] - (st/emit! (wdt/update-token-set token-set))) +(defn on-update-token-set [set-name token-set] + (st/emit! (wdt/update-token-set set-name token-set))) (defn on-create-token-set [token-set] (st/emit! (wdt/create-token-set token-set))) @@ -159,7 +159,7 @@ :on-edit on-edit :on-toggle on-toggle-token-set :on-submit #(do - (on-update-token-set %) + (on-update-token-set (:name token-set) %) (on-reset)) :on-cancel on-reset}])) (when new?