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

This commit is contained in:
Andrey Antukh
2025-09-29 13:24:31 +02:00
7 changed files with 31 additions and 18 deletions

View File

@@ -106,6 +106,7 @@
- Fix conflicting shortcuts (remove dec/inc line height and letter spacing) [Taiga #12102](https://tree.taiga.io/project/penpot/issue/12102) - Fix conflicting shortcuts (remove dec/inc line height and letter spacing) [Taiga #12102](https://tree.taiga.io/project/penpot/issue/12102)
- Fix conflicting shortcuts (remove text-align shortcuts) [Taiga #12047](https://tree.taiga.io/project/penpot/issue/12047) - Fix conflicting shortcuts (remove text-align shortcuts) [Taiga #12047](https://tree.taiga.io/project/penpot/issue/12047)
- Fix export file with empty tokens library [Taiga #12137](https://tree.taiga.io/project/penpot/issue/12137) - Fix export file with empty tokens library [Taiga #12137](https://tree.taiga.io/project/penpot/issue/12137)
- Fix context menu on spacing tokens [Taiga #12141](https://tree.taiga.io/project/penpot/issue/12141)
## 2.9.0 ## 2.9.0

View File

@@ -157,7 +157,9 @@
:enable-dashboard-templates-section :enable-dashboard-templates-section
:enable-google-fonts-provider :enable-google-fonts-provider
:enable-component-thumbnails :enable-component-thumbnails
:enable-render-wasm-dpr]) :enable-render-wasm-dpr
:enable-token-units
:enable-token-typography-types])
(defn parse (defn parse
[& flags] [& flags]

View File

@@ -177,6 +177,13 @@
(def spacing-keys (schema-keys schema:spacing)) (def spacing-keys (schema-keys schema:spacing))
(def ^:private schema:spacing-gap-padding
(-> (reduce mu/union [schema:spacing-gap
schema:spacing-padding])
(mu/update-properties assoc :title "SpacingGapPaddingTokenAttrs")))
(def spacing-gap-padding-keys (schema-keys schema:spacing-gap-padding))
(def ^:private schema:dimensions (def ^:private schema:dimensions
(-> (reduce mu/union [schema:sizing (-> (reduce mu/union [schema:sizing
schema:spacing schema:spacing
@@ -360,9 +367,9 @@
(set/union generic-attributes (set/union generic-attributes
border-radius-keys)) border-radius-keys))
(def frame-attributes (def frame-with-layout-attributes
(set/union rect-attributes (set/union rect-attributes
spacing-keys)) spacing-gap-padding-keys))
(def text-attributes (def text-attributes
(set/union generic-attributes (set/union generic-attributes
@@ -370,12 +377,14 @@
number-keys)) number-keys))
(defn shape-type->attributes (defn shape-type->attributes
[type] [type is-layout]
(case type (case type
:bool generic-attributes :bool generic-attributes
:circle generic-attributes :circle generic-attributes
:rect rect-attributes :rect rect-attributes
:frame frame-attributes :frame (if is-layout
frame-with-layout-attributes
rect-attributes)
:image rect-attributes :image rect-attributes
:path generic-attributes :path generic-attributes
:svg-raw generic-attributes :svg-raw generic-attributes
@@ -383,14 +392,14 @@
nil)) nil))
(defn appliable-attrs (defn appliable-attrs
"Returns intersection of shape `attributes` for `token-type`." "Returns intersection of shape `attributes` for `shape-type`."
[attributes token-type] [attributes shape-type is-layout]
(set/intersection attributes (shape-type->attributes token-type))) (set/intersection attributes (shape-type->attributes shape-type is-layout)))
(defn any-appliable-attr? (defn any-appliable-attr?
"Checks if `token-type` supports given shape `attributes`." "Checks if `token-type` supports given shape `attributes`."
[attributes token-type] [attributes token-type is-layout]
(seq (appliable-attrs attributes token-type))) (seq (appliable-attrs attributes token-type is-layout)))
;; Token attrs that are set inside content blocks of text shapes, instead ;; Token attrs that are set inside content blocks of text shapes, instead
;; at the shape level. ;; at the shape level.

View File

@@ -489,7 +489,7 @@
(or (or
(and (ctsl/any-layout-immediate-child? objects shape) (and (ctsl/any-layout-immediate-child? objects shape)
(some ctt/spacing-margin-keys attributes)) (some ctt/spacing-margin-keys attributes))
(ctt/any-appliable-attr? attributes (:type shape)))))) (ctt/any-appliable-attr? attributes (:type shape) (:layout shape))))))
shape-ids (d/nilv (keys shapes) []) shape-ids (d/nilv (keys shapes) [])
any-variant? (->> shapes vals (some ctk/is-variant?) boolean) any-variant? (->> shapes vals (some ctk/is-variant?) boolean)

View File

@@ -342,7 +342,7 @@
(:id token)))}])) (:id token)))}]))
(defn- allowed-shape-attributes [shapes] (defn- allowed-shape-attributes [shapes]
(reduce into #{} (map #(ctt/shape-type->attributes (:type %)) shapes))) (reduce into #{} (map #(ctt/shape-type->attributes (:type %) (:layout %)) shapes)))
(defn menu-actions [{:keys [type token selected-shapes] :as context-data}] (defn menu-actions [{:keys [type token selected-shapes] :as context-data}]
(let [context-data (assoc context-data :allowed-shape-attributes (allowed-shape-attributes selected-shapes)) (let [context-data (assoc context-data :allowed-shape-attributes (allowed-shape-attributes selected-shapes))
@@ -446,7 +446,8 @@
(if (some? type) (if (some? type)
(submenu-actions-selection-actions context-data) (submenu-actions-selection-actions context-data)
(selection-actions context-data)) (selection-actions context-data))
(default-actions context-data))] (default-actions context-data))
entries (clean-separators entries)]
(for [[index {:keys [title action selected? hint submenu no-selectable] :as entry}] (d/enumerate entries)] (for [[index {:keys [title action selected? hint submenu no-selectable] :as entry}] (d/enumerate entries)]
[:* {:key (dm/str title " " index)} [:* {:key (dm/str title " " index)}
(cond (cond

View File

@@ -166,7 +166,7 @@
;; Edge-case for allowing margin attribute on shapes inside layout parent ;; Edge-case for allowing margin attribute on shapes inside layout parent
(and selected-inside-layout? (set/subset? ctt/spacing-margin-keys attrs)) (and selected-inside-layout? (set/subset? ctt/spacing-margin-keys attrs))
(some (fn [shape] (some (fn [shape]
(ctt/any-appliable-attr? attrs (:type shape))) (ctt/any-appliable-attr? attrs (:type shape) (:layout shape)))
selected-shapes))) selected-shapes)))
(def token-types-with-status-icon (def token-types-with-status-icon

View File

@@ -303,10 +303,10 @@
frame-1' (cths/get-shape file' :frame-1) frame-1' (cths/get-shape file' :frame-1)
frame-2' (cths/get-shape file' :frame-2)] frame-2' (cths/get-shape file' :frame-2)]
(t/testing "shape `:applied-tokens` got updated" (t/testing "shape `:applied-tokens` got updated"
(t/is (= (:p1 (:applied-tokens frame-1')) (:name token-target'))) (t/is (= (:p1 (:applied-tokens frame-1')) nil))
(t/is (= (:p2 (:applied-tokens frame-1')) (:name token-target'))) (t/is (= (:p2 (:applied-tokens frame-1')) nil))
(t/is (= (:p3 (:applied-tokens frame-1')) (:name token-target'))) (t/is (= (:p3 (:applied-tokens frame-1')) nil))
(t/is (= (:p4 (:applied-tokens frame-1')) (:name token-target'))) (t/is (= (:p4 (:applied-tokens frame-1')) nil))
(t/is (= (:p1 (:applied-tokens frame-2')) (:name token-target'))) (t/is (= (:p1 (:applied-tokens frame-2')) (:name token-target')))
(t/is (= (:p2 (:applied-tokens frame-2')) (:name token-target'))) (t/is (= (:p2 (:applied-tokens frame-2')) (:name token-target')))