From 7d7594818cf35b1a5c637ccc54ce1763628d8770 Mon Sep 17 00:00:00 2001 From: Pablo Alba Date: Fri, 11 Oct 2024 14:32:54 +0200 Subject: [PATCH 01/14] :bug: Fix Internal Error page: "go to your penpot" wrong design --- CHANGES.md | 1 + frontend/src/app/main/ui/static.cljs | 6 ++++-- frontend/src/app/main/ui/static.scss | 24 +++++++++++++++++++----- 3 files changed, 24 insertions(+), 7 deletions(-) diff --git a/CHANGES.md b/CHANGES.md index ee6227421..da1e694d7 100644 --- a/CHANGES.md +++ b/CHANGES.md @@ -36,6 +36,7 @@ - Fix problem with precision on boolean calculation [Taiga #8482](https://tree.taiga.io/project/penpot/issue/8482) - Fix problem when translating multiple path points [Github #4459](https://github.com/penpot/penpot/issues/4459) - Fix problem on importing (and exporting) files with flows [Taiga #8914](https://tree.taiga.io/project/penpot/issue/8914) +- Fix Internal Error page: "go to your penpot" wrong design [Taiga #8922](https://tree.taiga.io/project/penpot/issue/8922) ## 2.2.1 diff --git a/frontend/src/app/main/ui/static.cljs b/frontend/src/app/main/ui/static.cljs index fcc17b55d..50a3141e8 100644 --- a/frontend/src/app/main/ui/static.cljs +++ b/frontend/src/app/main/ui/static.cljs @@ -20,6 +20,8 @@ [app.main.ui.auth.recovery-request :refer [recovery-request-page recovery-sent-page]] [app.main.ui.auth.register :as register] [app.main.ui.dashboard.sidebar :refer [sidebar]] + [app.main.ui.ds.foundations.assets.icon :refer [icon*]] + [app.main.ui.ds.foundations.assets.raw-svg :refer [raw-svg*]] [app.main.ui.icons :as i] [app.main.ui.viewer.header :as viewer.header] [app.util.dom :as dom] @@ -43,9 +45,9 @@ [:button {:class (stl/css :exception-header) :on-click on-nav-root} - i/logo-icon + [:> raw-svg* {:id "penpot-logo-icon" :class (stl/css :penpot-logo)}] (when profile-id - (str "< " (tr "not-found.no-permission.go-dashboard")))] + [:div {:class (stl/css :go-back-wrapper)} [:> icon* {:id "arrow" :class (stl/css :back-arrow)}] [:span (tr "not-found.no-permission.go-dashboard")]])] [:div {:class (stl/css :deco-before)} i/logo-error-screen] (when-not profile-id [:button {:class (stl/css :login-header) diff --git a/frontend/src/app/main/ui/static.scss b/frontend/src/app/main/ui/static.scss index 601bd780c..0a509f016 100644 --- a/frontend/src/app/main/ui/static.scss +++ b/frontend/src/app/main/ui/static.scss @@ -66,6 +66,7 @@ justify-content: flex-end; height: 100%; width: 25%; + padding-bottom: $s-28; &:first-child { text-align: right; @@ -82,12 +83,25 @@ cursor: pointer; display: flex; align-items: center; +} - svg { - fill: var(--color-foreground-primary); - width: $s-48; - height: auto; - } +.penpot-logo { + fill: var(--color-foreground-primary); + width: $s-48; + height: $s-48; +} + +.back-arrow { + transform: rotate(180deg); +} + +.go-back-wrapper { + display: flex; + justify-content: center; + align-items: center; + gap: $s-8; + margin-left: $s-12; + font-size: $fs-14; } .login-header { From eda6c6a4c3e9fafcce499c1bfecdfb51193dec59 Mon Sep 17 00:00:00 2001 From: Pablo Alba Date: Fri, 11 Oct 2024 13:25:17 +0200 Subject: [PATCH 02/14] :bug: Fix "Done" button on toolbar on inspect mode should go to design mode --- CHANGES.md | 1 + frontend/src/app/main/ui/workspace/sidebar/options.cljs | 3 +++ 2 files changed, 4 insertions(+) diff --git a/CHANGES.md b/CHANGES.md index da1e694d7..94da9261a 100644 --- a/CHANGES.md +++ b/CHANGES.md @@ -37,6 +37,7 @@ - Fix problem when translating multiple path points [Github #4459](https://github.com/penpot/penpot/issues/4459) - Fix problem on importing (and exporting) files with flows [Taiga #8914](https://tree.taiga.io/project/penpot/issue/8914) - Fix Internal Error page: "go to your penpot" wrong design [Taiga #8922](https://tree.taiga.io/project/penpot/issue/8922) +- Fix "Done" button on toolbar on inspect mode should go to design mode [Taiga #8933](https://tree.taiga.io/project/penpot/issue/8933) ## 2.2.1 diff --git a/frontend/src/app/main/ui/workspace/sidebar/options.cljs b/frontend/src/app/main/ui/workspace/sidebar/options.cljs index cc6cef0bc..abd2aaf7e 100644 --- a/frontend/src/app/main/ui/workspace/sidebar/options.cljs +++ b/frontend/src/app/main/ui/workspace/sidebar/options.cljs @@ -138,6 +138,8 @@ first-selected-shape (first selected-shapes) shape-parent-frame (cfh/get-frame objects (:frame-id first-selected-shape)) + options-mode (mf/deref refs/options-mode-global) + on-change-tab (fn [options-mode] (let [options-mode (keyword options-mode)] @@ -187,6 +189,7 @@ [:> tab-switcher* {:tabs tabs :default-selected "info" :on-change-tab on-change-tab + :selected (name options-mode) :class (stl/css :options-tab-switcher)}]])) ;; TODO: this need optimizations, selected-objects and From bd888dcde21e24f18297814b81c3dfe9f871c90f Mon Sep 17 00:00:00 2001 From: Eva Marco Date: Fri, 11 Oct 2024 16:18:11 +0200 Subject: [PATCH 03/14] :bug: Fix constraints buttons --- CHANGES.md | 1 + .../sidebar/options/menus/constraints.scss | 56 ++++++++++--------- 2 files changed, 32 insertions(+), 25 deletions(-) diff --git a/CHANGES.md b/CHANGES.md index 94da9261a..d1f27cfbe 100644 --- a/CHANGES.md +++ b/CHANGES.md @@ -28,6 +28,7 @@ ### :bug: Bugs fixed +- Fix problem with constraints buttons [Taiga #8465](https://tree.taiga.io/project/penpot/issue/8465) - Fix problem with go back button on error page [Taiga #8887](https://tree.taiga.io/project/penpot/issue/8887) - Fix problem with shadows in text for Safari [Taiga #8770](https://tree.taiga.io/project/penpot/issue/8770) - Fix a regression with feedback form subject and content limits [Taiga #8908](https://tree.taiga.io/project/penpot/issue/8908) diff --git a/frontend/src/app/main/ui/workspace/sidebar/options/menus/constraints.scss b/frontend/src/app/main/ui/workspace/sidebar/options/menus/constraints.scss index 88da9410d..2384facf2 100644 --- a/frontend/src/app/main/ui/workspace/sidebar/options/menus/constraints.scss +++ b/frontend/src/app/main/ui/workspace/sidebar/options/menus/constraints.scss @@ -36,32 +36,37 @@ .constraints-bottom { @include flexCenter; grid-area: top; - .constraint-btn, - .constraint-btn-special, - .constraint-btn-rotated { - @include buttonStyle; - @include flexCenter; - width: 100%; - height: 100%; - .resalted-area { - width: $s-32; - height: $s-3; - border-radius: $br-8; - background-color: var(--button-constraint-background-color-rest); - padding: 0; - margin: 0; - } - &.active .resalted-area { - outline: $s-4 solid var(--button-constraint-border-color-hover); - background-color: var(--button-constraint-background-color-hover); - } - &:hover .resalted-area, - &:focus .resalted-area { - outline: $s-4 solid var(--button-constraint-border-color-hover); - background-color: var(--button-constraint-background-color-hover); - } +} +.constraint-btn, +.constraint-btn-special, +.constraint-btn-rotated { + @include buttonStyle; + @include flexCenter; + width: 100%; + height: 100%; + --resalted-area-background-color: var(--button-constraint-background-color-rest); + --resalted-area-border-color: none; + &.active { + --resalted-area-border-color: var(--button-constraint-border-color-hover); + --resalted-area-background-color: var(--button-constraint-background-color-hover); + } + &:hover, + &:focus-visible { + --resalted-area-border-color: var(--button-constraint-border-color-hover); + --resalted-area-background-color: var(--button-constraint-background-color-hover); } } + +.resalted-area { + width: $s-32; + height: $s-3; + border-radius: $br-8; + background-color: var(--resalted-area-background-color); + outline: $s-4 solid var(--resalted-area-border-color); + padding: 0; + margin: 0; +} + .constraints-left { grid-area: left; .constraint-btn-rotated { @@ -73,6 +78,7 @@ } } } + .constraints-center { grid-area: center; position: relative; @@ -113,7 +119,7 @@ grid-area: bottom; } -.contraints-selects { +.constraints-selects { @include flexColumn; } From 97ae295cb9cefbbbb94f52e594fe74b7cd2c0fcc Mon Sep 17 00:00:00 2001 From: "alonso.torres" Date: Fri, 11 Oct 2024 11:55:22 +0200 Subject: [PATCH 04/14] :bug: Fix problem updating layout when toggle visibility in component copy --- CHANGES.md | 1 + common/src/app/common/logic/shapes.cljc | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/CHANGES.md b/CHANGES.md index d1f27cfbe..77d2c8c4e 100644 --- a/CHANGES.md +++ b/CHANGES.md @@ -38,6 +38,7 @@ - Fix problem when translating multiple path points [Github #4459](https://github.com/penpot/penpot/issues/4459) - Fix problem on importing (and exporting) files with flows [Taiga #8914](https://tree.taiga.io/project/penpot/issue/8914) - Fix Internal Error page: "go to your penpot" wrong design [Taiga #8922](https://tree.taiga.io/project/penpot/issue/8922) +- Fix problem updating layout when toggle visibility in component copy[Github #5143](https://github.com/penpot/penpot/issues/5143) - Fix "Done" button on toolbar on inspect mode should go to design mode [Taiga #8933](https://tree.taiga.io/project/penpot/issue/8933) ## 2.2.1 diff --git a/common/src/app/common/logic/shapes.cljc b/common/src/app/common/logic/shapes.cljc index de3bd4c83..1bb1b109a 100644 --- a/common/src/app/common/logic/shapes.cljc +++ b/common/src/app/common/logic/shapes.cljc @@ -124,7 +124,7 @@ ;; All parents of any deleted shape must be resized. (into res (cfh/get-parent-ids objects id))) (d/ordered-set) - ids-to-delete) + (concat ids-to-delete ids-to-hide)) all-children (->> ids-to-delete ;; Children of deleted shapes must be also deleted. From f8fad95fef3e8971963db14e4036927b70a805a1 Mon Sep 17 00:00:00 2001 From: "alonso.torres" Date: Fri, 11 Oct 2024 13:27:26 +0200 Subject: [PATCH 05/14] :bug: Fix problem with shortcuts in text editor --- CHANGES.md | 3 ++- frontend/src/app/main/data/shortcuts_impl.js | 4 ++++ 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/CHANGES.md b/CHANGES.md index 77d2c8c4e..7b50269b0 100644 --- a/CHANGES.md +++ b/CHANGES.md @@ -38,8 +38,9 @@ - Fix problem when translating multiple path points [Github #4459](https://github.com/penpot/penpot/issues/4459) - Fix problem on importing (and exporting) files with flows [Taiga #8914](https://tree.taiga.io/project/penpot/issue/8914) - Fix Internal Error page: "go to your penpot" wrong design [Taiga #8922](https://tree.taiga.io/project/penpot/issue/8922) -- Fix problem updating layout when toggle visibility in component copy[Github #5143](https://github.com/penpot/penpot/issues/5143) +- Fix problem updating layout when toggle visibility in component copy [Github #5143](https://github.com/penpot/penpot/issues/5143) - Fix "Done" button on toolbar on inspect mode should go to design mode [Taiga #8933](https://tree.taiga.io/project/penpot/issue/8933) +- Fix problem with shortcuts in text editor [Github #5078](https://github.com/penpot/penpot/issues/5078) ## 2.2.1 diff --git a/frontend/src/app/main/data/shortcuts_impl.js b/frontend/src/app/main/data/shortcuts_impl.js index e381cc150..0dcc27538 100644 --- a/frontend/src/app/main/data/shortcuts_impl.js +++ b/frontend/src/app/main/data/shortcuts_impl.js @@ -24,6 +24,10 @@ target.stopCallback = function (e, element, combo) { return false } + if ((' ' + element.className + ' ').indexOf(' mousetrap ') > -1) { + return false; + } + if ('composedPath' in e && typeof e.composedPath === 'function') { // For open shadow trees, update `element` so that the following check works. const initialEventTarget = e.composedPath()[0]; From c236e0765b27c6cb3d49b4f625686ac32bdb8220 Mon Sep 17 00:00:00 2001 From: "alonso.torres" Date: Fri, 11 Oct 2024 15:27:34 +0200 Subject: [PATCH 06/14] :bug: Fix problems with show in viewer and interactions --- CHANGES.md | 1 + common/src/app/common/logic/shapes.cljc | 15 ++-- .../logic/hide_in_viewer_test.cljc | 75 ------------------- .../app/main/data/workspace/interactions.cljs | 55 ++++++++------ 4 files changed, 40 insertions(+), 106 deletions(-) delete mode 100644 common/test/common_tests/logic/hide_in_viewer_test.cljc diff --git a/CHANGES.md b/CHANGES.md index 7b50269b0..8fb55004d 100644 --- a/CHANGES.md +++ b/CHANGES.md @@ -41,6 +41,7 @@ - Fix problem updating layout when toggle visibility in component copy [Github #5143](https://github.com/penpot/penpot/issues/5143) - Fix "Done" button on toolbar on inspect mode should go to design mode [Taiga #8933](https://tree.taiga.io/project/penpot/issue/8933) - Fix problem with shortcuts in text editor [Github #5078](https://github.com/penpot/penpot/issues/5078) +- Fix problems with show in viewer and interactions [Github #4868](https://github.com/penpot/penpot/issues/4868) ## 2.2.1 diff --git a/common/src/app/common/logic/shapes.cljc b/common/src/app/common/logic/shapes.cljc index 1bb1b109a..0e292847f 100644 --- a/common/src/app/common/logic/shapes.cljc +++ b/common/src/app/common/logic/shapes.cljc @@ -408,17 +408,12 @@ ;; Resize parent containers that need to (pcb/resize-parents parents)))) - - - (defn change-show-in-viewer [shape hide?] - (cond-> (assoc shape :hide-in-viewer hide?) - ;; When a frame is no longer shown in view mode, it cannot have interactions - hide? - (dissoc :interactions))) + (assoc shape :hide-in-viewer hide?)) (defn add-new-interaction [shape interaction] (-> shape - (update :interactions ctsi/add-interaction interaction) - ;; When a interaction is created, the frame must be shown in view mode - (dissoc :hide-in-viewer))) + (update :interactions ctsi/add-interaction interaction))) + +(defn show-in-viewer [shape] + (dissoc shape :hide-in-viewer)) diff --git a/common/test/common_tests/logic/hide_in_viewer_test.cljc b/common/test/common_tests/logic/hide_in_viewer_test.cljc deleted file mode 100644 index 051a4732e..000000000 --- a/common/test/common_tests/logic/hide_in_viewer_test.cljc +++ /dev/null @@ -1,75 +0,0 @@ -;; This Source Code Form is subject to the terms of the Mozilla Public -;; License, v. 2.0. If a copy of the MPL was not distributed with this -;; file, You can obtain one at http://mozilla.org/MPL/2.0/. -;; -;; Copyright (c) KALEIDOS INC - -(ns common-tests.logic.hide-in-viewer-test - (:require - [app.common.files.changes-builder :as pcb] - [app.common.logic.shapes :as cls] - [app.common.test-helpers.compositions :as tho] - [app.common.test-helpers.files :as thf] - [app.common.test-helpers.ids-map :as thi] - [app.common.test-helpers.shapes :as ths] - [app.common.types.shape.interactions :as ctsi] - [clojure.test :as t])) - -(t/use-fixtures :each thi/test-fixture) - - -(t/deftest test-remove-show-in-view-mode-delete-interactions - (let [;; ==== Setup - - file (-> (thf/sample-file :file1) - (tho/add-frame :frame-dest) - (tho/add-frame :frame-origin) - (ths/add-interaction :frame-origin :frame-dest)) - - frame-origin (ths/get-shape file :frame-origin) - - page (thf/current-page file) - - - ;; ==== Action - changes (-> (pcb/empty-changes nil (:id page)) - (pcb/with-objects (:objects page)) - (pcb/update-shapes [(:id frame-origin)] #(cls/change-show-in-viewer % true))) - file' (thf/apply-changes file changes) - - ;; ==== Get - frame-origin' (ths/get-shape file' :frame-origin)] - - ;; ==== Check - (t/is (some? (:interactions frame-origin))) - (t/is (nil? (:interactions frame-origin'))))) - - - -(t/deftest test-add-new-interaction-updates-show-in-view-mode - (let [;; ==== Setup - - file (-> (thf/sample-file :file1) - (tho/add-frame :frame-dest :hide-in-viewer true) - (tho/add-frame :frame-origin :hide-in-viewer true)) - frame-dest (ths/get-shape file :frame-dest) - frame-origin (ths/get-shape file :frame-origin) - - page (thf/current-page file) - - ;; ==== Action - new-interaction (-> ctsi/default-interaction - (ctsi/set-destination (:id frame-dest)) - (assoc :position-relative-to (:id frame-dest))) - - changes (-> (pcb/empty-changes nil (:id page)) - (pcb/with-objects (:objects page)) - (pcb/update-shapes [(:id frame-origin)] #(cls/add-new-interaction % new-interaction))) - file' (thf/apply-changes file changes) - - ;; ==== Get - frame-origin' (ths/get-shape file' :frame-origin)] - - ;; ==== Check - (t/is (true? (:hide-in-viewer frame-origin))) - (t/is (nil? (:hide-in-viewer frame-origin'))))) diff --git a/frontend/src/app/main/data/workspace/interactions.cljs b/frontend/src/app/main/data/workspace/interactions.cljs index b2387e270..e8dfd1253 100644 --- a/frontend/src/app/main/data/workspace/interactions.cljs +++ b/frontend/src/app/main/data/workspace/interactions.cljs @@ -147,11 +147,15 @@ ptk/WatchEvent (watch [_ state _] (let [page-id (or page-id (:current-page-id state))] - (rx/of (dwsh/update-shapes - [shape-id] - (fn [shape] - (cls/add-new-interaction shape interaction)) - {:page-id page-id})))))) + (rx/of (dwsh/update-shapes [shape-id] + (fn [shape] + (cls/add-new-interaction shape interaction)) + {:page-id page-id}) + + (when (:destination interaction) + (dwsh/update-shapes [(:destination interaction)] + cls/show-in-viewer + {:page-id page-id}))))))) (defn add-new-interaction ([shape] (add-new-interaction shape nil)) @@ -167,15 +171,20 @@ flows (get page :objects) flow (ctp/get-frame-flow flows (:id frame))] (rx/concat - (rx/of (dwsh/update-shapes [(:id shape)] - (fn [shape] - (let [new-interaction (-> ctsi/default-interaction - (ctsi/set-destination destination) - (assoc :position-relative-to (:id shape)))] - (cls/add-new-interaction shape new-interaction))))) - (when (and (not (connected-frame? objects (:id frame))) - (nil? flow)) - (rx/of (add-flow (:id frame)))))))))) + (rx/of (dwsh/update-shapes + [(:id shape)] + (fn [shape] + (let [new-interaction (-> ctsi/default-interaction + (ctsi/set-destination destination) + (assoc :position-relative-to (:id shape)))] + (cls/add-new-interaction shape new-interaction)))) + + (when destination + (dwsh/update-shapes [destination] cls/show-in-viewer)) + + (when (and (not (connected-frame? objects (:id frame))) + (nil? flow)) + (add-flow (:id frame)))))))))) (defn remove-interaction ([shape index] @@ -186,8 +195,7 @@ (watch [_ _ _] (rx/of (dwsh/update-shapes [(:id shape)] (fn [shape] - (update shape :interactions - ctsi/remove-interaction index)) + (update shape :interactions ctsi/remove-interaction index)) {:page-id page-id})))))) (defn update-interaction ([shape index update-fn] @@ -196,11 +204,16 @@ (ptk/reify ::update-interaction ptk/WatchEvent (watch [_ _ _] - (rx/of (dwsh/update-shapes [(:id shape)] - (fn [shape] - (update shape :interactions - ctsi/update-interaction index update-fn)) - options)))))) + (let [interactions (ctsi/update-interaction (:interactions shape) index update-fn) + interaction (nth interactions index)] + (rx/of (dwsh/update-shapes + [(:id shape)] + (fn [shape] + (assoc shape :interactions interactions)) + options) + + (when (some? (:destination interaction)) + (dwsh/update-shapes [(:destination interaction)] cls/show-in-viewer options)))))))) (defn remove-all-interactions-nav-to "Remove all interactions that navigate to the given frame." From 3a9119cf29062a0561ff3311a88ecdffd341a414 Mon Sep 17 00:00:00 2001 From: "alonso.torres" Date: Mon, 14 Oct 2024 10:06:28 +0200 Subject: [PATCH 07/14] :bug: Add visual feedback when moving an element into a board --- CHANGES.md | 1 + frontend/src/app/main/ui/workspace/viewport.cljs | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/CHANGES.md b/CHANGES.md index 8fb55004d..11c31f4f7 100644 --- a/CHANGES.md +++ b/CHANGES.md @@ -42,6 +42,7 @@ - Fix "Done" button on toolbar on inspect mode should go to design mode [Taiga #8933](https://tree.taiga.io/project/penpot/issue/8933) - Fix problem with shortcuts in text editor [Github #5078](https://github.com/penpot/penpot/issues/5078) - Fix problems with show in viewer and interactions [Github #4868](https://github.com/penpot/penpot/issues/4868) +- Add visual feedback when moving an element into a board [Github #3210](https://github.com/penpot/penpot/issues/3210) ## 2.2.1 diff --git a/frontend/src/app/main/ui/workspace/viewport.cljs b/frontend/src/app/main/ui/workspace/viewport.cljs index 052f84c8f..7040c2c1e 100644 --- a/frontend/src/app/main/ui/workspace/viewport.cljs +++ b/frontend/src/app/main/ui/workspace/viewport.cljs @@ -397,7 +397,7 @@ (->> @hover-ids (filter #(cfh/frame-shape? (get base-objects %))) (remove selected) - (first)) + (last)) outlined-frame (get objects outlined-frame-id)] [:* [:& outline/shape-outlines From a25abd0ca4c971a2c8e82d4475d0968c76925c0a Mon Sep 17 00:00:00 2001 From: "alonso.torres" Date: Mon, 14 Oct 2024 10:07:07 +0200 Subject: [PATCH 08/14] :bug: Fix percent calculation on grid layout tracks --- CHANGES.md | 1 + .../ui/workspace/sidebar/options/menus/layout_container.cljs | 2 +- .../ui/workspace/sidebar/options/menus/layout_container.scss | 1 + 3 files changed, 3 insertions(+), 1 deletion(-) diff --git a/CHANGES.md b/CHANGES.md index 11c31f4f7..2a78e06e5 100644 --- a/CHANGES.md +++ b/CHANGES.md @@ -43,6 +43,7 @@ - Fix problem with shortcuts in text editor [Github #5078](https://github.com/penpot/penpot/issues/5078) - Fix problems with show in viewer and interactions [Github #4868](https://github.com/penpot/penpot/issues/4868) - Add visual feedback when moving an element into a board [Github #3210](https://github.com/penpot/penpot/issues/3210) +- Fix percent calculation on grid layout tracks [Github #4688](https://github.com/penpot/penpot/issues/4688) ## 2.2.1 diff --git a/frontend/src/app/main/ui/workspace/sidebar/options/menus/layout_container.cljs b/frontend/src/app/main/ui/workspace/sidebar/options/menus/layout_container.cljs index 83caf49bd..5bede159d 100644 --- a/frontend/src/app/main/ui/workspace/sidebar/options/menus/layout_container.cljs +++ b/frontend/src/app/main/ui/workspace/sidebar/options/menus/layout_container.cljs @@ -677,7 +677,7 @@ [{:keys [type value]}] (case type :auto "auto" - :percent (fmt/format-percent value) + :percent (fmt/format-percent (/ value 100)) :flex (fmt/format-frs value) :fixed (fmt/format-pixels value) value)) diff --git a/frontend/src/app/main/ui/workspace/sidebar/options/menus/layout_container.scss b/frontend/src/app/main/ui/workspace/sidebar/options/menus/layout_container.scss index 531b94989..00d7c2f7f 100644 --- a/frontend/src/app/main/ui/workspace/sidebar/options/menus/layout_container.scss +++ b/frontend/src/app/main/ui/workspace/sidebar/options/menus/layout_container.scss @@ -150,6 +150,7 @@ .grid-layout-menu { @include flexColumn; gap: $s-8; + overflow: hidden; .row { @include flexRow; From 2dc0cfdee3cd4ce0133527273f2db57b6f25f469 Mon Sep 17 00:00:00 2001 From: "alonso.torres" Date: Mon, 14 Oct 2024 11:43:34 +0200 Subject: [PATCH 09/14] :bug: Fix problem with caps and inner shadows --- CHANGES.md | 1 + common/src/app/common/geom/shapes/bounds.cljc | 3 ++- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/CHANGES.md b/CHANGES.md index 2a78e06e5..7363d47ee 100644 --- a/CHANGES.md +++ b/CHANGES.md @@ -44,6 +44,7 @@ - Fix problems with show in viewer and interactions [Github #4868](https://github.com/penpot/penpot/issues/4868) - Add visual feedback when moving an element into a board [Github #3210](https://github.com/penpot/penpot/issues/3210) - Fix percent calculation on grid layout tracks [Github #4688](https://github.com/penpot/penpot/issues/4688) +- Fix problem with caps and inner shadows [Github #4517](https://github.com/penpot/penpot/issues/4517) ## 2.2.1 diff --git a/common/src/app/common/geom/shapes/bounds.cljc b/common/src/app/common/geom/shapes/bounds.cljc index 5612837b4..d87ad2a4f 100644 --- a/common/src/app/common/geom/shapes/bounds.cljc +++ b/common/src/app/common/geom/shapes/bounds.cljc @@ -60,6 +60,7 @@ filter-y (mth/min y (+ y offset-y (- spread) (- blur) -5)) filter-w (+ w (mth/abs offset-x) (* spread 2) (* blur 2) 10) filter-h (+ h (mth/abs offset-y) (* spread 2) (* blur 2) 10)] + (grc/make-rect filter-x filter-y filter-w filter-h))) (defn get-rect-filter-bounds @@ -101,7 +102,7 @@ (map #(case (get % :stroke-alignment :center) :center (/ (:stroke-width % 0) 2) :outer (:stroke-width % 0) - 0)) + (:stroke-width % 0))) (reduce d/max 0)) stroke-margin From 9d2f484aa36301a31ba6013b0261a0d1acdec037 Mon Sep 17 00:00:00 2001 From: "alonso.torres" Date: Mon, 14 Oct 2024 11:44:29 +0200 Subject: [PATCH 10/14] :bug: Fix problem with horizontal/vertical lines and shadows --- CHANGES.md | 1 + frontend/src/app/main/ui/shapes/filters.cljs | 39 +++++++++++++++++--- 2 files changed, 35 insertions(+), 5 deletions(-) diff --git a/CHANGES.md b/CHANGES.md index 7363d47ee..46e567bbf 100644 --- a/CHANGES.md +++ b/CHANGES.md @@ -45,6 +45,7 @@ - Add visual feedback when moving an element into a board [Github #3210](https://github.com/penpot/penpot/issues/3210) - Fix percent calculation on grid layout tracks [Github #4688](https://github.com/penpot/penpot/issues/4688) - Fix problem with caps and inner shadows [Github #4517](https://github.com/penpot/penpot/issues/4517) +- Fix problem with horizontal/vertical lines and shadows [Github #4516](https://github.com/penpot/penpot/issues/4516) ## 2.2.1 diff --git a/frontend/src/app/main/ui/shapes/filters.cljs b/frontend/src/app/main/ui/shapes/filters.cljs index f7ff505db..5d23c26ab 100644 --- a/frontend/src/app/main/ui/shapes/filters.cljs +++ b/frontend/src/app/main/ui/shapes/filters.cljs @@ -10,6 +10,7 @@ [app.common.data :as d] [app.common.data.macros :as dm] [app.common.geom.shapes.bounds :as gsb] + [app.common.math :as mth] [app.common.uuid :as uuid] [cuerdas.core :as str] [rumext.v2 :as mf])) @@ -129,6 +130,34 @@ [filters] (map #(assoc %1 :filter-in %2) filters (cons nil (map :id filters)))) +(defn filter-coords + [bounds selrect padding] + (if (or (mth/close? 0.01 (:width selrect)) + (mth/close? 0.01 (:height selrect))) + + ;; We cannot use "objectBoundingbox" if the shape doesn't have width/heigth + ;; From the SVG spec (https://www.w3.org/TR/SVG11/coords.html#ObjectBoundingBox + ;; Keyword objectBoundingBox should not be used when the geometry of the applicable element + ;; has no width or no height, such as the case of a horizontal or vertical line, even when + ;; the line has actual thickness when viewed due to having a non-zero stroke width since + ;; stroke width is ignored for bounding box calculations. When the geometry of the + ;; applicable element has no width or height and objectBoundingBox is specified, then + ;; the given effect (e.g., a gradient or a filter) will be ignored. + (let [filter-width (+ (:width bounds) (* 2 (:horizontal padding))) + filter-height (+ (:height bounds) (* 2 (:vertical padding))) + filter-x (- (:x bounds) #_(:x selrect) (:horizontal padding)) + filter-y (- (:y bounds) #_(:y selrect) (:vertical padding)) + filter-units "userSpaceOnUse"] + [filter-x filter-y filter-width filter-height filter-units]) + + ;; If the width/height is not zero we use objectBoundingBox as it's more stable + (let [filter-width (/ (+ (:width bounds) (* 2 (:horizontal padding))) (:width selrect)) + filter-height (/ (+ (:height bounds) (* 2 (:vertical padding))) (:height selrect)) + filter-x (/ (- (:x bounds) (:x selrect) (:horizontal padding)) (:width selrect)) + filter-y (/ (- (:y bounds) (:y selrect) (:vertical padding)) (:height selrect)) + filter-units "objectBoundingBox"] + [filter-x filter-y filter-width filter-height filter-units]))) + (mf/defc filters [{:keys [filter-id shape]}] @@ -136,17 +165,17 @@ bounds (gsb/get-rect-filter-bounds (:selrect shape) filters (or (-> shape :blur :value) 0)) padding (gsb/calculate-padding shape) selrect (:selrect shape) - filter-x (/ (- (:x bounds) (:x selrect) (:horizontal padding)) (:width selrect)) - filter-y (/ (- (:y bounds) (:y selrect) (:vertical padding)) (:height selrect)) - filter-width (/ (+ (:width bounds) (* 2 (:horizontal padding))) (:width selrect)) - filter-height (/ (+ (:height bounds) (* 2 (:vertical padding))) (:height selrect))] + + [filter-x filter-y filter-width filter-height filter-units] + (filter-coords bounds selrect padding)] + (when (> (count filters) 2) [:filter {:id filter-id :x filter-x :y filter-y :width filter-width :height filter-height - :filterUnits "objectBoundingBox" + :filterUnits filter-units :color-interpolation-filters "sRGB"} (for [[index entry] (d/enumerate filters)] [:& filter-entry {:key (dm/str filter-id "-" index) From 6d8c1831609a3b9b66b46f72f54d761f349f0abf Mon Sep 17 00:00:00 2001 From: "alonso.torres" Date: Mon, 14 Oct 2024 11:59:06 +0200 Subject: [PATCH 11/14] :sparkles: Add plugins whitelisting for removing the disclaimer --- frontend/src/app/config.cljs | 1 + frontend/src/app/main/ui/workspace/plugins.cljs | 11 ++++++----- frontend/src/app/main/ui/workspace/plugins.scss | 2 +- 3 files changed, 8 insertions(+), 6 deletions(-) diff --git a/frontend/src/app/config.cljs b/frontend/src/app/config.cljs index 72bbb4d00..e6b4361b0 100644 --- a/frontend/src/app/config.cljs +++ b/frontend/src/app/config.cljs @@ -111,6 +111,7 @@ (def flex-help-uri (obj/get global "penpotGridHelpURI" "https://help.penpot.app/user-guide/flexible-layouts/")) (def grid-help-uri (obj/get global "penpotGridHelpURI" "https://help.penpot.app/user-guide/flexible-layouts/")) (def plugins-list-uri (obj/get global "penpotPluginsListUri" "https://penpot-docs-plugins.pages.dev/plugins/getting-started/#examples")) +(def plugins-whitelist (into #{} (obj/get global "penpotPluginsWhitelist" []))) (defn- normalize-uri [uri-str] diff --git a/frontend/src/app/main/ui/workspace/plugins.cljs b/frontend/src/app/main/ui/workspace/plugins.cljs index cecc22bf6..3beba2d16 100644 --- a/frontend/src/app/main/ui/workspace/plugins.cljs +++ b/frontend/src/app/main/ui/workspace/plugins.cljs @@ -9,7 +9,7 @@ (:require [app.common.data :as d] [app.common.data.macros :as dm] - [app.config :as cf] + [app.config :as cfg] [app.main.data.events :as ev] [app.main.data.modal :as modal] [app.main.data.plugins :as dp] @@ -169,7 +169,7 @@ [:> i18n/tr-html* {:class (stl/css :discover) :on-click #(st/emit! (ptk/event ::ev/event {::ev/name "open-plugins-list"})) - :content (tr "workspace.plugins.discover" cf/plugins-list-uri)}]) + :content (tr "workspace.plugins.discover" cfg/plugins-list-uri)}]) [:hr] @@ -178,7 +178,7 @@ [:div {:class (stl/css :plugins-empty-logo)} i/puzzle] [:div {:class (stl/css :plugins-empty-text)} (tr "workspace.plugins.empty-plugins")] [:a {:class (stl/css :plugins-link) - :href cf/plugins-list-uri + :href cfg/plugins-list-uri :target "_blank" :on-click #(st/emit! (ptk/event ::ev/event {::ev/name "open-plugins-list"}))} (tr "workspace.plugins.plugin-list-link") i/external-link]] @@ -287,8 +287,9 @@ [:div {:class (stl/css :modal-content)} [:& plugins-permission-list {:permissions permissions}] - [:div {:class (stl/css :permissions-disclaimer)} - (tr "workspace.plugins.permissions.disclaimer")]] + (when-not (contains? cfg/plugins-whitelist host) + [:div {:class (stl/css :permissions-disclaimer)} + (tr "workspace.plugins.permissions.disclaimer")])] [:div {:class (stl/css :modal-footer)} [:div {:class (stl/css :action-buttons)} diff --git a/frontend/src/app/main/ui/workspace/plugins.scss b/frontend/src/app/main/ui/workspace/plugins.scss index ba736acf8..643b4957a 100644 --- a/frontend/src/app/main/ui/workspace/plugins.scss +++ b/frontend/src/app/main/ui/workspace/plugins.scss @@ -272,7 +272,7 @@ div.input-error { @include bodySmallTypography; padding: $s-16; background: var(--color-background-quaternary); - color: var(--color-foreground-quaternary); + color: var(--color-foreground-primary); border-radius: $br-4; } From dbbb8e76ab25a21f5e214dbad4cdb53d46e92420 Mon Sep 17 00:00:00 2001 From: Andrey Antukh Date: Mon, 14 Oct 2024 23:16:34 +0200 Subject: [PATCH 12/14] :sparkles: Allow override java opts for build scripts --- exporter/scripts/build | 2 +- manage.sh | 10 ++++++++-- 2 files changed, 9 insertions(+), 3 deletions(-) diff --git a/exporter/scripts/build b/exporter/scripts/build index 004460584..7ad0aecf5 100755 --- a/exporter/scripts/build +++ b/exporter/scripts/build @@ -10,7 +10,7 @@ rm -rf target export NODE_ENV=production; # Build the application -clojure -J-Xms100M -J-Xmx1000M -J-XX:+UseSerialGC -M:dev:shadow-cljs release main; +clojure -M:dev:shadow-cljs release main; # Remove source rm -rf target/app; diff --git a/manage.sh b/manage.sh index aa1580d48..942aec241 100755 --- a/manage.sh +++ b/manage.sh @@ -7,6 +7,9 @@ export DEVENV_PNAME="penpotdev"; export CURRENT_USER_ID=$(id -u); export CURRENT_BRANCH=$(git rev-parse --abbrev-ref HEAD); +# Set default java options +export JAVA_OPTS=${JAVA_OPTS:-"-Xmx1000m -Xms50m"}; + set -e function print-current-version { @@ -95,10 +98,12 @@ function run-devenv-shell { if [[ ! $(docker ps -f "name=penpot-devenv-main" -q) ]]; then start-devenv fi - docker exec -ti penpot-devenv-main sudo -EH -u penpot bash + docker exec -ti \ + -e JAVA_OPTS="$JAVA_OPTS" \ + -e EXTERNAL_UID=$CURRENT_USER_ID \ + penpot-devenv-main sudo -EH -u penpot bash; } - function build { echo ">> build start: $1" local version=$(print-current-version); @@ -111,6 +116,7 @@ function build { -e EXTERNAL_UID=$CURRENT_USER_ID \ -e BUILD_STORYBOOK=$BUILD_STORYBOOK \ -e SHADOWCLJS_EXTRA_PARAMS=$SHADOWCLJS_EXTRA_PARAMS \ + -e JAVA_OPTS="$JAVA_OPTS" \ -w /home/penpot/penpot/$1 \ $DEVENV_IMGNAME:latest sudo -EH -u penpot ./scripts/build $version From ac80e9a1ac43707c13cd6d8f32281307691a96db Mon Sep 17 00:00:00 2001 From: Andrey Antukh Date: Tue, 15 Oct 2024 08:37:37 +0200 Subject: [PATCH 13/14] :sparkles: Respect overrides of jvm_opts on devenv bashrc file --- docker/devenv/files/bashrc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docker/devenv/files/bashrc b/docker/devenv/files/bashrc index dca37aadb..da3fdfde0 100644 --- a/docker/devenv/files/bashrc +++ b/docker/devenv/files/bashrc @@ -1,7 +1,7 @@ #!/usr/bin/env bash export PATH=/usr/lib/jvm/openjdk/bin:/usr/local/nodejs/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/snap/bin -export JAVA_OPTS="-Xmx1000m -Xms50m" +export JAVA_OPTS=${JAVA_OPTS:-"-Xmx1000m -Xms200m"}; alias l='ls --color -GFlh' alias rm='rm -r' From 1fb21d537c8026aeeb2a4be9263a81875e02bda0 Mon Sep 17 00:00:00 2001 From: Andrey Antukh Date: Tue, 15 Oct 2024 09:00:49 +0200 Subject: [PATCH 14/14] :bug: Send thread-id on create-comment-thread rpc method --- backend/src/app/loggers/webhooks.clj | 2 +- backend/src/app/rpc/commands/comments.clj | 6 ++++-- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/backend/src/app/loggers/webhooks.clj b/backend/src/app/loggers/webhooks.clj index 371b627bb..4bcd2b009 100644 --- a/backend/src/app/loggers/webhooks.clj +++ b/backend/src/app/loggers/webhooks.clj @@ -135,7 +135,7 @@ (l/dbg :hint "run webhook" :event-name (:name event) - :webhook-id (:id whook) + :webhook-id (str (:id whook)) :webhook-uri (:uri whook) :webhook-mtype (:mtype whook)) diff --git a/backend/src/app/rpc/commands/comments.clj b/backend/src/app/rpc/commands/comments.clj index ba201fe8c..fafecd8b8 100644 --- a/backend/src/app/rpc/commands/comments.clj +++ b/backend/src/app/rpc/commands/comments.clj @@ -328,8 +328,10 @@ :page-name page-name :position position :content content - :frame-id frame-id}] - (db/tx-run! cfg create-comment-thread params)))) + :frame-id frame-id} + thread (db/tx-run! cfg create-comment-thread params)] + + (vary-meta thread assoc ::audit/props thread)))) (defn- create-comment-thread [{:keys [::db/conn] :as cfg}