diff --git a/CHANGES.md b/CHANGES.md index 100296f4de..3df22277a5 100644 --- a/CHANGES.md +++ b/CHANGES.md @@ -7,6 +7,9 @@ - Fix locking contention on cron subsystem (causes backend start blocking) - Fix locking contention on file object thumbails backend RPC calls +### :bug: Bugs fixed + +- Fix color palette sorting [Taiga Issue #7458](https://tree.taiga.io/project/penpot/issue/7458) ## 2.0.1 diff --git a/backend/src/app/auth/oidc.clj b/backend/src/app/auth/oidc.clj index 34e2cee579..efdf568e22 100644 --- a/backend/src/app/auth/oidc.clj +++ b/backend/src/app/auth/oidc.clj @@ -540,6 +540,7 @@ token (tokens/generate (::setup/props cfg) info) params (d/without-nils {:token token + :provider (:provider (:path-params request)) :fullname (:fullname info)}) uri (-> (u/uri (cf/get :public-uri)) (assoc :path "/#/auth/register/validate") diff --git a/common/src/app/common/types/container.cljc b/common/src/app/common/types/container.cljc index b50c5058ab..d038ca50c8 100644 --- a/common/src/app/common/types/container.cljc +++ b/common/src/app/common/types/container.cljc @@ -386,7 +386,8 @@ (fn [new-shape original-shape] (let [new-name (:name new-shape) root? (or (ctk/instance-root? original-shape) ; If shape is inside a component (not components-v2) - (nil? (:parent-id original-shape)))] ; we detect it by having no parent) + (nil? (:parent-id original-shape))) ; we detect it by having no parent) + swap-slot (ctk/get-swap-slot original-shape)] (when root? (vswap! unames conj new-name)) @@ -398,6 +399,9 @@ (-> (gsh/move delta) (dissoc :touched)) + (some? swap-slot) + (assoc :touched #{(ctk/build-swap-slot-group swap-slot)}) + (and main-instance? root?) (assoc :main-instance true) diff --git a/frontend/resources/styles/common/refactor/basic-rules.scss b/frontend/resources/styles/common/refactor/basic-rules.scss index f057974d00..c6141e4318 100644 --- a/frontend/resources/styles/common/refactor/basic-rules.scss +++ b/frontend/resources/styles/common/refactor/basic-rules.scss @@ -6,6 +6,10 @@ // SCROLLBAR .new-scrollbar { + scrollbar-color: rgba(170, 181, 186, 0.3) transparent; + &:hover { + scrollbar-color: rgba(170, 181, 186, 0.7) transparent; + } ::-webkit-scrollbar { background-color: transparent; cursor: pointer; diff --git a/frontend/src/app/libs/file_builder.cljs b/frontend/src/app/libs/file_builder.cljs index 0f0c3d0696..ea046e2550 100644 --- a/frontend/src/app/libs/file_builder.cljs +++ b/frontend/src/app/libs/file_builder.cljs @@ -7,6 +7,7 @@ (ns app.libs.file-builder (:require [app.common.data :as d] + [app.common.features :as cfeat] [app.common.files.builder :as fb] [app.common.media :as cm] [app.common.types.components-list :as ctkl] @@ -73,7 +74,7 @@ manifest-stream (->> files-stream - (rx/map #(e/create-manifest (uuid/next) (:id file) :all % false)) + (rx/map #(e/create-manifest (uuid/next) (:id file) :all % cfeat/default-features)) (rx/map (fn [a] (vector "manifest.json" a)))) @@ -144,7 +145,7 @@ (str (:current-page-id file))) (addPage [_ name options] - (set! file (fb/add-page file {:name name :options options})) + (set! file (fb/add-page file {:name name :options (parse-data options)})) (str (:current-page-id file))) (closePage [_] diff --git a/frontend/src/app/main/data/workspace/selection.cljs b/frontend/src/app/main/data/workspace/selection.cljs index 8ce2cfe1fa..b233f561d0 100644 --- a/frontend/src/app/main/data/workspace/selection.cljs +++ b/frontend/src/app/main/data/workspace/selection.cljs @@ -486,6 +486,7 @@ duplicating-component? (or duplicating-component? (ctk/instance-head? obj)) is-component-main? (ctk/main-instance? obj) subinstance-head? (ctk/subinstance-head? obj) + instance-root? (ctk/instance-root? obj) into-component? (and duplicating-component? (ctn/in-any-component? objects parent)) @@ -508,7 +509,9 @@ :parent-id parent-id :frame-id frame-id) - (cond-> (and subinstance-head? remove-swap-slot?) + (cond-> (and (not instance-root?) + subinstance-head? + remove-swap-slot?) (ctk/remove-swap-slot)) (dissoc :shapes @@ -581,8 +584,9 @@ true (and remove-swap-slot? ;; only remove swap slot of children when the current shape - ;; is not a subinstance head - (not subinstance-head?)))) + ;; is not a subinstance head nor a instance root + (not subinstance-head?) + (not instance-root?)))) changes (map (d/getf objects) (:shapes obj))))))) diff --git a/frontend/src/app/main/ui.cljs b/frontend/src/app/main/ui.cljs index 9c7e3110c3..7b2fb02965 100644 --- a/frontend/src/app/main/ui.cljs +++ b/frontend/src/app/main/ui.cljs @@ -170,7 +170,7 @@ [:& (mf/provider ctx/current-route) {:value route} [:& (mf/provider ctx/current-profile) {:value profile} (if edata - [:& static/exception-page {:data edata}] + [:& static/exception-page {:data edata :route route}] [:* [:& msgs/notifications-hub] (when route diff --git a/frontend/src/app/main/ui/dashboard/templates.cljs b/frontend/src/app/main/ui/dashboard/templates.cljs index f7a42454fc..8927ff0532 100644 --- a/frontend/src/app/main/ui/dashboard/templates.cljs +++ b/frontend/src/app/main/ui/dashboard/templates.cljs @@ -155,7 +155,7 @@ [:div {:class (stl/css :img-container)} [:a {:id id :tab-index (if (or (not is-visible) collapsed) "-1" "0") - :href "https://penpot.app/libraries-templates.html" + :href "https://penpot.app/libraries-templates" :target "_blank" :on-click on-click :on-key-down on-key-down} diff --git a/frontend/src/app/main/ui/releases/v1_9.cljs b/frontend/src/app/main/ui/releases/v1_9.cljs index e5dda41cc8..6a8ddfba80 100644 --- a/frontend/src/app/main/ui/releases/v1_9.cljs +++ b/frontend/src/app/main/ui/releases/v1_9.cljs @@ -99,7 +99,7 @@ [:h2 "Libraries & templates"]] [:div.modal-content [:p "We’ve created a new space on Penpot where you can share your libraries and templates and download the ones you like. Material Design, Cocomaterial or Penpot’s Design System are among them (and a lot more to come!)."] - [:p [:a {:alt "Explore libraries & templates" :target "_blank" :href "https://penpot.app/libraries-templates.html"} "Explore libraries & templates"]]] + [:p [:a {:alt "Explore libraries & templates" :target "_blank" :href "https://penpot.app/libraries-templates"} "Explore libraries & templates"]]] [:div.modal-navigation [:button.btn-secondary {:on-click finish} "Start!"] [:& c/navigation-bullets diff --git a/frontend/src/app/main/ui/static.cljs b/frontend/src/app/main/ui/static.cljs index 54b02f50b2..5a0b0a11aa 100644 --- a/frontend/src/app/main/ui/static.cljs +++ b/frontend/src/app/main/ui/static.cljs @@ -9,6 +9,8 @@ (:require [app.common.data :as d] [app.common.pprint :as pp] + [app.common.uri :as u] + [app.main.data.events :as ev] [app.main.store :as st] [app.main.ui.icons :as i] [app.util.dom :as dom] @@ -16,6 +18,7 @@ [app.util.i18n :refer [tr]] [app.util.router :as rt] [app.util.webapi :as wapi] + [potok.v2.core :as ptk] [rumext.v2 :as mf])) (mf/defc error-container @@ -146,15 +149,19 @@ (mf/defc exception-page {::mf/props :obj} - [{:keys [data] :as props}] - (case (:type data) - :not-found - [:& not-found] + [{:keys [data route] :as props}] + (let [type (:type data) + path (:path route) + query-params (u/map->query-string (:query-params route))] + (st/emit! (ptk/event ::ev/event {::ev/name "exception-page" :type type :path path :query-params query-params})) + (case (:type data) + :not-found + [:& not-found] - :bad-gateway - [:& bad-gateway] + :bad-gateway + [:& bad-gateway] - :service-unavailable - [:& service-unavailable] + :service-unavailable + [:& service-unavailable] - [:> internal-error props])) + [:> internal-error props]))) diff --git a/frontend/src/app/main/ui/workspace/colorpicker/libraries.cljs b/frontend/src/app/main/ui/workspace/colorpicker/libraries.cljs index 14e851d31d..9bb4f067e9 100644 --- a/frontend/src/app/main/ui/workspace/colorpicker/libraries.cljs +++ b/frontend/src/app/main/ui/workspace/colorpicker/libraries.cljs @@ -7,6 +7,7 @@ (ns app.main.ui.workspace.colorpicker.libraries (:require-macros [app.main.style :as stl]) (:require + [app.common.colors :as c] [app.common.data :as d] [app.common.data.macros :as dm] [app.main.data.events :as ev] @@ -24,7 +25,7 @@ [rumext.v2 :as mf])) (mf/defc libraries - [{:keys [state on-select-color on-add-library-color disable-gradient disable-opacity disable-image]}] + [{:keys [state on-select-color on-add-library-color disable-gradient disable-opacity disable-image]}] (let [selected (h/use-shared-state mdc/colorpicker-selected-broadcast-key :recent) current-colors (mf/use-state []) @@ -43,10 +44,23 @@ (parse-uuid event))))) check-valid-color? - (fn [color] - (and (or (not disable-gradient) (not (:gradient color))) - (or (not disable-opacity) (= 1 (:opacity color))) - (or (not disable-image) (not (:image color))))) + (mf/use-fn + (fn [color] + (and (or (not disable-gradient) (not (:gradient color))) + (or (not disable-opacity) (= 1 (:opacity color))) + (or (not disable-image) (not (:image color)))))) + + ;; Sort colors by hue and lightness + get-sorted-colors + (mf/use-fn + (fn [colors] + (sort (fn [a b] + (let [[ah _ al] (c/hex->hsl (:color a)) + [bh _ bl] (c/hex->hsl (:color b)) + a (+ (* ah 100) (* al 99)) + b (+ (* bh 100) (* bl 99))] + (compare a b))) + (into [] (filter check-valid-color?) colors)))) toggle-palette (mf/use-fn @@ -89,13 +103,15 @@ (sort-by :name) (map #(assoc % :file-id file-id)))))] - (reset! current-colors (into [] (filter check-valid-color?) colors)))) + (if (not= @selected :recent) + (reset! current-colors (get-sorted-colors colors)) + (reset! current-colors (into [] (filter check-valid-color? colors)))))) ;; If the file colors change and the file option is selected updates the state (mf/with-effect [file-colors] (when (= @selected :file) (let [colors (vals file-colors)] - (reset! current-colors (into [] (filter check-valid-color?) colors))))) + (reset! current-colors (get-sorted-colors colors))))) [:div {:class (stl/css :libraries)} [:div {:class (stl/css :select-wrapper)}