Merge remote-tracking branch 'origin/staging' into develop

This commit is contained in:
Andrey Antukh 2025-06-19 15:35:19 +02:00
commit 7e909dfbe8
17 changed files with 141 additions and 39 deletions

View File

@ -67,6 +67,11 @@ on-premises instances** that want to keep up to date.
- Fix issue with importing files where flex/grid is used [Taiga #11334](https://tree.taiga.io/project/penpot/issue/11334)
- Fix wrong color in the export progress bar [Taiga #11299](https://tree.taiga.io/project/penpot/issue/11299)
- Fix right sidebar width overflow on long layer names [Taiga #11212](https://tree.taiga.io/project/penpot/issue/11212)
- Fix comment icon fill [Taiga #11388](https://tree.taiga.io/project/penpot/issue/11388)
- Fix gap on radio-buttons component [Taiga #11360](https://tree.taiga.io/project/penpot/issue/11360)
- Fix button width [Taiga #11394](https://tree.taiga.io/project/penpot/issue/11394)
- Fix mixed letter spacing and line height [Taiga #11178](https://tree.taiga.io/project/penpot/issue/11178)
- Fix snap nodes shortcut [Taiga #11054](https://tree.taiga.io/project/penpot/issue/11054)
## 2.7.2

View File

@ -117,6 +117,12 @@
([shape]
(d/not-empty? (:shapes shape))))
(defn has-layout?
"Returns true if the provided shape has a layout assigned"
[objects id]
(let [shape (get objects id)]
(boolean (and shape (:layout shape)))))
(defn group-like-shape?
([objects id]
(group-like-shape? (get objects id)))
@ -127,6 +133,24 @@
;; ---- ACCESSORS
(defn get-selected-type
"Returns the type of the shape if only one, or :multiple if more
than one"
[objects selected]
(if (= 1 (count selected))
(let [shape (get objects (first selected))]
(:type shape))
:multiple))
(defn get-shape-type
"Returns the type of the shape, or 'root' if it's Root Frame, always
as string"
[objects id]
(let [shape (get objects id)]
(if (root? shape)
:root
(dm/get-prop shape :type))))
(defn get-children-ids
[objects id]
(letfn [(get-children-ids-rec [id processed]

View File

@ -206,7 +206,7 @@ services:
# communicate with the frontend.
PENPOT_PUBLIC_URI: http://penpot-frontend:8080
## Valkey (or previowsly Redis) is used for the websockets notifications.
## Valkey (or previously Redis) is used for the websockets notifications.
PENPOT_REDIS_URI: redis://penpot-valkey/0
penpot-postgres:

View File

@ -242,3 +242,7 @@
(l/error :hint "error on event batching stream" :cause cause))
(fn []
(l/debug :hitn "events batching stream terminated")))))))))
(defn event
[props]
(ptk/data-event ::events props))

View File

@ -80,8 +80,9 @@
(rx/of (fetch-bundle (d/without-nils params))
;; Only fetch threads for logged-in users
(when (some? (:profile state))
(fetch-comment-threads params))))
(fetch-comment-threads params))
(when (:share-id params)
(rx/of (ptk/event ::ev/event {::ev/name "shared-prototipe-visited"})))))
ptk/EffectEvent
(effect [_ _ _]
;; Set the window name, the window name is used on inter-tab

View File

@ -902,13 +902,30 @@
undo-id (js/Symbol)]
(rx/concat
(->> (filter ctc/instance-head? orig-shapes)
(map (fn [{:keys [component-file]}]
(ptk/event ::ev/event
{::ev/name "use-library-component"
::ev/origin "paste"
:external-library (not= file-id component-file)})))
(rx/from))
(->> (rx/from orig-shapes)
(rx/map (fn [shape]
(let [parent-type (cfh/get-shape-type all-objects (:parent-id shape))
external-lib? (not= file-id (:component-file shape))
origin "workspace:paste"]
;; NOTE: we don't emit the create-shape event all the time for
;; avoid send a lot of events (that are not necessary); this
;; decision is made explicitly by the responsible team.
(if (ctc/instance-head? shape)
(ev/event {::ev/name "use-library-component"
::ev/origin origin
:is-external-library external-lib?
:parent-shape-type parent-type})
(if (cfh/has-layout? objects (:parent-id shape))
(ev/event {::ev/name "layout-add-element"
::ev/origin origin
:element-type (get shape :type)
:parent-type parent-type})
(ev/event {::ev/name "create-shape"
::ev/origin origin
:shape-type (get shape :type)
:parent-shape-type parent-type})))))))
(rx/of (dwu/start-undo-transaction undo-id)
(dch/commit-changes changes)
(dws/select-shapes selected)

View File

@ -62,6 +62,8 @@
(defn add-flow-selected-frame
[]
(ptk/reify ::add-flow-selected-frame
ev/Event
(-data [_] {::ev/name "add-prototype-interaction"})
ptk/WatchEvent
(watch [_ state _]
(let [selected (dsh/lookup-selected state)]
@ -187,9 +189,10 @@
(when (and (not (connected-frame? objects (:id frame)))
(nil? flow))
(rx/of (add-flow (:id frame))))
(when first?
(if first?
;; When the first interaction of the page is created we emit the event "create-prototype"
(rx/of (ptk/event ::ev/event {::ev/name "create-prototype"})))))))))
(rx/of (ev/event {::ev/name "create-prototype"}))
(rx/of (ev/event {::ev/name "add-prototype-interaction"})))))))))
(defn remove-interaction
([shape index]

View File

@ -73,7 +73,8 @@
:fn #(st/emit! (drp/make-curve))}
:snap-nodes {:tooltip (ds/meta "'")
:command (ds/c-mod "'")
;;https://github.com/ccampbell/mousetrap/issues/85
:command [(ds/c-mod "'") (ds/c-mod "219")]
:subsections [:path-editor]
:fn #(st/emit! (drp/toggle-snap))}

View File

@ -479,15 +479,32 @@
ids)
undo-id (js/Symbol)]
(rx/concat
(->> (map (d/getf objects) ids)
(filter ctk/instance-head?)
(map (fn [{:keys [component-file]}]
(ptk/event ::ev/event
{::ev/name "use-library-component"
::ev/origin "duplicate"
:external-library (not= file-id component-file)})))
(rx/from))
;; Warning: This order is important for the focus mode.
(->> (rx/from ids)
(rx/map (fn [shape-id]
(let [shape (get objects shape-id)
parent-type (cfh/get-shape-type objects (:parent-id shape))
external-lib? (not= file-id (:component-file shape))
origin "workspace:duplicate-shapes"]
;; NOTE: we don't emit the create-shape event all the time for
;; avoid send a lot of events (that are not necessary); this
;; decision is made explicitly by the responsible team.
(if (ctk/instance-head? shape)
(ev/event {::ev/name "use-library-component"
::ev/origin origin
:is-external-library external-lib?
:parent-shape-type parent-type})
(if (cfh/has-layout? objects (:parent-id shape))
(ev/event {::ev/name "layout-add-element"
::ev/origin origin
:element-type (get shape :type)
:parent-type parent-type})
(ev/event {::ev/name "create-shape"
::ev/origin origin
:shape-type (get shape :type)
:parent-shape-type parent-type})))))))
;; Warning: This order is important for the focus mode.
(->> (rx/of
(dwu/start-undo-transaction undo-id)
(dch/commit-changes changes)

View File

@ -294,7 +294,13 @@
(seq padding-attrs)
(assoc :changed-sub-attr padding-attrs)))
(ptk/data-event :layout/update {:ids ids})
(dwu/commit-undo-transaction undo-id)))))))
(dwu/commit-undo-transaction undo-id)
(when (or (:layout-align-content changes) (:layout-justify-content changes))
(ptk/event ::ev/event
{::ev/name "layout-change-alignment"}))
(when (or (:layout-padding changes) (:layout-gap changes))
(ptk/event ::ev/event
{::ev/name "layout-change-margin"}))))))))
(defn add-layout-track
([ids type value]

View File

@ -142,8 +142,16 @@
(when (cfh/text-shape? shape)
(->> (rx/of (dwe/start-edition-mode (:id shape)))
(rx/observe-on :async)))
(when (cfh/frame-shape? shape)
(rx/of (ptk/event ::ev/event {::ev/name "add-frame"})))))))))
(rx/of (ev/event {::ev/name "create-shape"
::ev/origin "workspace:add-shape"
:type (get shape :type)
:parent-type (cfh/get-shape-type objects (:parent-id shape))}))
(when (cfh/has-layout? objects (:parent-id shape))
(rx/of (ev/event {::ev/name "layout-add-element"
::ev/origin "workspace:add-shape"
:element-type (get shape :type)})))))))))
(defn move-shapes-into-frame
[frame-id shapes]
@ -284,6 +292,9 @@
(dch/commit-changes changes)
(dws/select-shapes (d/ordered-set (:id frame-shape)))
(ptk/data-event :layout/update {:ids [(:id frame-shape)]})
(ev/event {::ev/name "create-board"
:converted-from (cfh/get-selected-type objects selected)
:parent-type (cfh/get-shape-type objects (:parent-id frame-shape))})
(dwu/commit-undo-transaction undo-id))))))))
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

View File

@ -28,6 +28,7 @@
[app.common.types.shape.layout :as ctl]
[app.common.uuid :as uuid]
[app.main.data.changes :as dch]
[app.main.data.event :as ev]
[app.main.data.helpers :as dsh]
[app.main.data.workspace.collapse :as dwc]
[app.main.data.workspace.modifiers :as dwm]
@ -1083,9 +1084,20 @@
ids
:cell cell))]
(when (and (some? frame-id) (d/not-empty? changes))
(rx/of (dch/commit-changes changes)
(dwc/expand-collapse frame-id)))))))
(rx/concat
(let [shapes (mapv #(get objects %) ids)
moved-count (count (filter #(not= (:parent-id %) frame-id) shapes))
emit-layout-event? (and (cfh/has-layout? objects frame-id)
(pos? moved-count))]
(when emit-layout-event?
(rx/of (ev/event {::ev/name "layout-add-element"
::ev/origin "workspace:move-shapes-to-frame"
:element-type (cfh/get-selected-type objects ids)
:moved moved-count}))))
(when (and (some? frame-id) (d/not-empty? changes))
(rx/of (dch/commit-changes changes)
(dwc/expand-collapse frame-id))))))))
(defn- get-displacement
"Retrieve the correct displacement delta point for the

View File

@ -301,11 +301,10 @@
}
.open-mentions-button {
stroke: none;
fill: var(--color-foreground-secondary);
color: var(--color-foreground-secondary);
&.is-toggled {
fill: var(--color-accent-primary);
color: var(--color-accent-primary);
}
}

View File

@ -11,6 +11,7 @@
border-radius: $br-8;
height: $s-32;
background-color: var(--input-background-color);
gap: $s-4;
}
.radio-icon {

View File

@ -39,6 +39,7 @@
.multiple-exports {
@include flexRow;
grid-column: 1 / 9;
}
.label {

View File

@ -110,7 +110,8 @@
(mf/use-effect
(mf/deps shapes handle-change-tab)
(fn []
(when-not (seq shapes)
(if (seq shapes)
(st/emit! (ptk/event ::ev/event {::ev/name "inspect-mode-click-element"}))
(handle-change-tab :info))))
[:aside {:class (stl/css-case :settings-bar-right true

View File

@ -360,11 +360,8 @@
[{:keys [values on-change on-blur]}]
(let [{:keys [line-height
letter-spacing]} values
line-height (or line-height "1.2")
letter-spacing (or letter-spacing "0")
line-height-nillable (if (= (str line-height) "1.2") false true)
handle-change
(fn [value attr]
(on-change {attr (str value)}))]
@ -379,11 +376,11 @@
{:min -200
:max 200
:step 0.1
:default "1.2"
:default-value "1.2"
:class (stl/css :line-height-input)
:value (attr->string line-height)
:placeholder (tr "settings.multiple")
:nillable line-height-nillable
:placeholder (if (= :multiple line-height) (tr "settings.multiple") "--")
:nillable (= :multiple line-height)
:on-change #(handle-change % :line-height)
:on-blur on-blur}]]
@ -397,10 +394,12 @@
{:min -200
:max 200
:step 0.1
:default-value "0"
:class (stl/css :letter-spacing-input)
:value (attr->string letter-spacing)
:placeholder (tr "settings.multiple")
:placeholder (if (= :multiple letter-spacing) (tr "settings.multiple") "--")
:on-change #(handle-change % :letter-spacing)
:nillable (= :multiple letter-spacing)
:on-blur on-blur}]]]))
(mf/defc text-transform-options