diff --git a/CHANGES.md b/CHANGES.md index f585799b2a..577cd2b3be 100644 --- a/CHANGES.md +++ b/CHANGES.md @@ -61,12 +61,16 @@ - Fix remove color button in the gradient editor [Taiga #11623](https://tree.taiga.io/project/penpot/issue/11623) - Fix "Copy as SVG" generates different code from the Inspect panel [Taiga #11519](https://tree.taiga.io/project/penpot/issue/11519) - Fix overriden tokens in text copies are not preserved [Taiga #11486](https://tree.taiga.io/project/penpot/issue/11486) +- Fix problem when changing between flex/grid layout [Taiga #11625](https://tree.taiga.io/project/penpot/issue/11625) +- Fix opacity on stroke gradients [Taiga #11646](https://tree.taiga.io/project/penpot/issue/11646) +- Fix change from gradient to solid color [Taiga #11648](https://tree.taiga.io/project/penpot/issue/11648) ## 2.8.1 (Unreleased) ### :bug: Bugs fixed - Fix unexpected exception on processing old texts [Github #6889](https://github.com/penpot/penpot/pull/6889) +- Fix UI theme selection from main menu [Taiga #11567](https://tree.taiga.io/project/penpot/issue/11567) ## 2.8.0 diff --git a/common/src/app/common/types/tokens_lib.cljc b/common/src/app/common/types/tokens_lib.cljc index 398bf4a881..8073e5b0b1 100644 --- a/common/src/app/common/types/tokens_lib.cljc +++ b/common/src/app/common/types/tokens_lib.cljc @@ -167,6 +167,11 @@ (get-tokens [_] "return an ordered sequence of all tokens in the set") (get-tokens-map [_] "return a map of tokens in the set, indexed by token-name")) +;; TODO: this structure is temporary. It's needed to be able to migrate TokensLib +;; from 1.2 to 1.3 when TokenSet datatype was changed to a deftype. This should +;; be removed after migrations are consolidated. +(defrecord TokenSetLegacy [id name description modified-at tokens]) + (deftype TokenSet [id name description modified-at tokens] #?@(:clj [clojure.lang.IDeref (deref [_] {:id id @@ -255,6 +260,10 @@ [o] (instance? TokenSet o)) +(defn token-set-legacy? + [o] + (instance? TokenSetLegacy o)) + (def schema:token-set-attrs [:map {:title "TokenSet"} [:id ::sm/uuid] @@ -1738,10 +1747,11 @@ Will return a value that matches this schema: migrate-sets-node (fn recurse [node] - (if (token-set? node) - (assoc node - :id (uuid/next) - :tokens (d/update-vals (:tokens node) migrate-token)) + (if (token-set-legacy? node) + (make-token-set + (assoc node + :id (uuid/next) + :tokens (d/update-vals (:tokens node) migrate-token))) (d/update-vals node recurse))) sets @@ -1769,6 +1779,26 @@ Will return a value that matches this schema: (->TokensLib sets themes active-themes)))) +#?(:clj + (defn- read-tokens-lib-v1-3 + "Reads the tokens lib data structure and removes the TokenSetLegacy data type, + needed for a temporary migration step." + [r] + (let [sets (fres/read-object! r) + themes (fres/read-object! r) + active-themes (fres/read-object! r) + + migrate-sets-node + (fn recurse [node] + (if (token-set-legacy? node) + (make-token-set node) + (d/update-vals node recurse))) + + sets + (d/update-vals sets migrate-sets-node)] + + (->TokensLib sets themes active-themes)))) + #?(:clj (defn- write-tokens-lib [n w ^TokensLib o] @@ -1797,6 +1827,11 @@ Will return a value that matches this schema: (make-token obj)))} {:name "penpot/token-set/v1" + :rfn (fn [r] + (let [obj (fres/read-object! r)] + (map->TokenSetLegacy obj)))} + + {:name "penpot/token-set/v2" :class TokenSet :wfn (fn [n w o] (fres/write-tag! w n 1) @@ -1824,8 +1859,11 @@ Will return a value that matches this schema: {:name "penpot/tokens-lib/v1.2" :rfn read-tokens-lib-v1-2} - ;; CURRENT TOKENS LIB READER & WRITTER {:name "penpot/tokens-lib/v1.3" + :rfn read-tokens-lib-v1-3} + + ;; CURRENT TOKENS LIB READER & WRITTER + {:name "penpot/tokens-lib/v1.4" :class TokensLib :wfn write-tokens-lib :rfn read-tokens-lib})) diff --git a/frontend/src/app/main/data/profile.cljs b/frontend/src/app/main/data/profile.cljs index f8521484af..75a42c0e26 100644 --- a/frontend/src/app/main/data/profile.cljs +++ b/frontend/src/app/main/data/profile.cljs @@ -20,7 +20,6 @@ [app.plugins.register :as plugins.register] [app.util.i18n :as i18n :refer [tr]] [app.util.storage :as storage] - [app.util.theme :as theme] [beicon.v2.core :as rx] [potok.v2.core :as ptk])) @@ -159,9 +158,6 @@ (update-in state [:profile :theme] (fn [current] (let [current (cond - (= current "system") - (theme/get-system-theme) - ;; NOTE: this is a workaround for ;; the old data on the database ;; where whe have `default` value @@ -172,7 +168,8 @@ current)] (case current "dark" "light" - "light" "dark" + "light" "system" + "system" "dark" ; Failsafe for missing data "dark"))))) diff --git a/frontend/src/app/main/data/workspace/colors.cljs b/frontend/src/app/main/data/workspace/colors.cljs index 8ed474cb22..266df3483c 100644 --- a/frontend/src/app/main/data/workspace/colors.cljs +++ b/frontend/src/app/main/data/workspace/colors.cljs @@ -1093,7 +1093,11 @@ (fn [state] (-> state (assoc :type :color) - (dissoc :editing-stop :stops :gradient))))))) + (dissoc :editing-stop :stops :gradient))))) + + ptk/WatchEvent + (watch [_ _ _] + (rx/of (update-colorpicker-color {} false))))) (defn activate-colorpicker-gradient [type] diff --git a/frontend/src/app/main/ui/settings/subscription.cljs b/frontend/src/app/main/ui/settings/subscription.cljs index 650e20e0df..e72c4f9b86 100644 --- a/frontend/src/app/main/ui/settings/subscription.cljs +++ b/frontend/src/app/main/ui/settings/subscription.cljs @@ -179,7 +179,9 @@ :type "button" :value (if subscribe-to-trial (tr "subscription.settings.start-trial") (tr "labels.continue")) - :on-click (if subscribe-to-trial subscribe-to-enterprise handle-accept-dialog)}]]])]]])) + :on-click (if (or subscribe-to-trial + (contains? #{"unpaid" "canceled"} (:status current-subscription))) + subscribe-to-enterprise handle-accept-dialog)}]]])]]])) (mf/defc subscription-success-dialog {::mf/register modal/components @@ -413,7 +415,7 @@ (tr "subscription.settings.unlimited.bill"), (tr "subscription.settings.unlimited.storage-autosave")] :cta-text (if subscription (tr "subscription.settings.subscribe") (tr "subscription.settings.try-it-free")) - :cta-link #(open-subscription-modal "unlimited" subscription-type) + :cta-link #(open-subscription-modal "unlimited" subscription) :cta-text-with-icon (tr "subscription.settings.more-information") :cta-link-with-icon go-to-pricing-page}]) @@ -427,6 +429,6 @@ (tr "subscription.settings.enterprise.capped-bill"), (tr "subscription.settings.enterprise.unlimited-storage")] :cta-text (if subscription (tr "subscription.settings.subscribe") (tr "subscription.settings.try-it-free")) - :cta-link #(open-subscription-modal "enterprise") + :cta-link #(open-subscription-modal "enterprise" subscription) :cta-text-with-icon (tr "subscription.settings.more-information") :cta-link-with-icon go-to-pricing-page}])]]])) diff --git a/frontend/src/app/main/ui/shapes/attrs.cljs b/frontend/src/app/main/ui/shapes/attrs.cljs index 6c6bfd58e1..4fcc386e06 100644 --- a/frontend/src/app/main/ui/shapes/attrs.cljs +++ b/frontend/src/app/main/ui/shapes/attrs.cljs @@ -103,15 +103,15 @@ (obj/set! attrs "strokeWidth" width) - (when (some? gradient) + (if (some? gradient) (let [gradient-id (dm/str "stroke-color-gradient-" render-id "-" index)] - (obj/set! attrs "stroke" (str/ffmt "url(#%)" gradient-id)))) + (obj/set! attrs "stroke" (str/ffmt "url(#%)" gradient-id))) - (when-not (some? gradient) (when (some? color) - (obj/set! attrs "stroke" color)) - (when (some? opacity) - (obj/set! attrs "strokeOpacity" opacity))) + (obj/set! attrs "stroke" color))) + + (when (some? opacity) + (obj/set! attrs "strokeOpacity" opacity)) (when (not= style :svg) (obj/set! attrs "strokeDasharray" (calculate-dasharray style width))) diff --git a/frontend/src/app/main/ui/workspace/main_menu.cljs b/frontend/src/app/main/ui/workspace/main_menu.cljs index 2c9be80e5e..3ea6523e64 100644 --- a/frontend/src/app/main/ui/workspace/main_menu.cljs +++ b/frontend/src/app/main/ui/workspace/main_menu.cljs @@ -280,8 +280,8 @@ :data-testid "toggle-theme" :id "file-menu-toggle-theme"} [:span {:class (stl/css :item-name)} - (case (:theme profile) ;; default = dark -> light -> system -> dark and so on - "default" (tr "workspace.header.menu.toggle-light-theme") + (case (:theme profile) ;; dark -> light -> system -> dark and so on + "dark" (tr "workspace.header.menu.toggle-light-theme") "light" (tr "workspace.header.menu.toggle-system-theme") "system" (tr "workspace.header.menu.toggle-dark-theme") (tr "workspace.header.menu.toggle-light-theme"))] diff --git a/frontend/src/app/main/ui/workspace/sidebar/options/menus/layout_item.cljs b/frontend/src/app/main/ui/workspace/sidebar/options/menus/layout_item.cljs index 8b81bdba8e..31d35d2062 100644 --- a/frontend/src/app/main/ui/workspace/sidebar/options/menus/layout_item.cljs +++ b/frontend/src/app/main/ui/workspace/sidebar/options/menus/layout_item.cljs @@ -310,7 +310,7 @@ :id "align-self-end"}]]) (mf/defc layout-item-menu - {::mf/memo #{:ids :values :type :is-layout-child? :is-grid-parent :is-flex-parent?} + {::mf/memo #{:ids :values :type :is-layout-child? :is-grid-parent :is-flex-parent? :is-grid-layout? :is-flex-layout?} ::mf/props :obj} [{:keys [ids values ^boolean is-layout-child?