mirror of
https://github.com/penpot/penpot.git
synced 2025-12-11 22:14:05 +01:00
Merge remote-tracking branch 'origin/staging' into develop
This commit is contained in:
@@ -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 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 context menu on spacing tokens [Taiga #12141](https://tree.taiga.io/project/penpot/issue/12141)
|
||||
|
||||
## 2.9.0
|
||||
|
||||
|
||||
@@ -157,7 +157,9 @@
|
||||
:enable-dashboard-templates-section
|
||||
:enable-google-fonts-provider
|
||||
:enable-component-thumbnails
|
||||
:enable-render-wasm-dpr])
|
||||
:enable-render-wasm-dpr
|
||||
:enable-token-units
|
||||
:enable-token-typography-types])
|
||||
|
||||
(defn parse
|
||||
[& flags]
|
||||
|
||||
@@ -177,6 +177,13 @@
|
||||
|
||||
(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
|
||||
(-> (reduce mu/union [schema:sizing
|
||||
schema:spacing
|
||||
@@ -360,9 +367,9 @@
|
||||
(set/union generic-attributes
|
||||
border-radius-keys))
|
||||
|
||||
(def frame-attributes
|
||||
(def frame-with-layout-attributes
|
||||
(set/union rect-attributes
|
||||
spacing-keys))
|
||||
spacing-gap-padding-keys))
|
||||
|
||||
(def text-attributes
|
||||
(set/union generic-attributes
|
||||
@@ -370,12 +377,14 @@
|
||||
number-keys))
|
||||
|
||||
(defn shape-type->attributes
|
||||
[type]
|
||||
[type is-layout]
|
||||
(case type
|
||||
:bool generic-attributes
|
||||
:circle generic-attributes
|
||||
:rect rect-attributes
|
||||
:frame frame-attributes
|
||||
:frame (if is-layout
|
||||
frame-with-layout-attributes
|
||||
rect-attributes)
|
||||
:image rect-attributes
|
||||
:path generic-attributes
|
||||
:svg-raw generic-attributes
|
||||
@@ -383,14 +392,14 @@
|
||||
nil))
|
||||
|
||||
(defn appliable-attrs
|
||||
"Returns intersection of shape `attributes` for `token-type`."
|
||||
[attributes token-type]
|
||||
(set/intersection attributes (shape-type->attributes token-type)))
|
||||
"Returns intersection of shape `attributes` for `shape-type`."
|
||||
[attributes shape-type is-layout]
|
||||
(set/intersection attributes (shape-type->attributes shape-type is-layout)))
|
||||
|
||||
(defn any-appliable-attr?
|
||||
"Checks if `token-type` supports given shape `attributes`."
|
||||
[attributes token-type]
|
||||
(seq (appliable-attrs attributes token-type)))
|
||||
[attributes token-type is-layout]
|
||||
(seq (appliable-attrs attributes token-type is-layout)))
|
||||
|
||||
;; Token attrs that are set inside content blocks of text shapes, instead
|
||||
;; at the shape level.
|
||||
|
||||
@@ -489,7 +489,7 @@
|
||||
(or
|
||||
(and (ctsl/any-layout-immediate-child? objects shape)
|
||||
(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) [])
|
||||
any-variant? (->> shapes vals (some ctk/is-variant?) boolean)
|
||||
|
||||
|
||||
@@ -342,7 +342,7 @@
|
||||
(:id token)))}]))
|
||||
|
||||
(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}]
|
||||
(let [context-data (assoc context-data :allowed-shape-attributes (allowed-shape-attributes selected-shapes))
|
||||
@@ -446,7 +446,8 @@
|
||||
(if (some? type)
|
||||
(submenu-actions-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)]
|
||||
[:* {:key (dm/str title " " index)}
|
||||
(cond
|
||||
|
||||
@@ -166,7 +166,7 @@
|
||||
;; Edge-case for allowing margin attribute on shapes inside layout parent
|
||||
(and selected-inside-layout? (set/subset? ctt/spacing-margin-keys attrs))
|
||||
(some (fn [shape]
|
||||
(ctt/any-appliable-attr? attrs (:type shape)))
|
||||
(ctt/any-appliable-attr? attrs (:type shape) (:layout shape)))
|
||||
selected-shapes)))
|
||||
|
||||
(def token-types-with-status-icon
|
||||
|
||||
@@ -303,10 +303,10 @@
|
||||
frame-1' (cths/get-shape file' :frame-1)
|
||||
frame-2' (cths/get-shape file' :frame-2)]
|
||||
(t/testing "shape `:applied-tokens` got updated"
|
||||
(t/is (= (:p1 (:applied-tokens frame-1')) (:name token-target')))
|
||||
(t/is (= (:p2 (:applied-tokens frame-1')) (:name token-target')))
|
||||
(t/is (= (:p3 (:applied-tokens frame-1')) (:name token-target')))
|
||||
(t/is (= (:p4 (:applied-tokens frame-1')) (:name token-target')))
|
||||
(t/is (= (:p1 (:applied-tokens frame-1')) nil))
|
||||
(t/is (= (:p2 (:applied-tokens frame-1')) nil))
|
||||
(t/is (= (:p3 (:applied-tokens frame-1')) nil))
|
||||
(t/is (= (:p4 (:applied-tokens frame-1')) nil))
|
||||
|
||||
(t/is (= (:p1 (:applied-tokens frame-2')) (:name token-target')))
|
||||
(t/is (= (:p2 (:applied-tokens frame-2')) (:name token-target')))
|
||||
|
||||
Reference in New Issue
Block a user