mirror of
https://github.com/penpot/penpot.git
synced 2025-12-12 06:24:17 +01:00
Merge remote-tracking branch 'origin/staging' into develop
This commit is contained in:
@@ -80,6 +80,7 @@
|
|||||||
- Fix moving elements up or down while pressing alt [Taiga Issue #11992](https://tree.taiga.io/project/penpot/issue/11992)
|
- Fix moving elements up or down while pressing alt [Taiga Issue #11992](https://tree.taiga.io/project/penpot/issue/11992)
|
||||||
- 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)
|
||||||
|
|
||||||
## 2.9.0
|
## 2.9.0
|
||||||
|
|
||||||
|
|||||||
@@ -6,22 +6,24 @@
|
|||||||
|
|
||||||
(ns user
|
(ns user
|
||||||
(:require
|
(:require
|
||||||
|
[app.binfile.common :as bfc]
|
||||||
[app.common.data :as d]
|
[app.common.data :as d]
|
||||||
[app.common.debug :as debug]
|
[app.common.debug :as debug]
|
||||||
[app.common.exceptions :as ex]
|
[app.common.exceptions :as ex]
|
||||||
[app.common.files.helpers :as cfh]
|
[app.common.files.helpers :as cfh]
|
||||||
[app.common.fressian :as fres]
|
[app.common.fressian :as fres]
|
||||||
[app.common.geom.matrix :as gmt]
|
[app.common.geom.matrix :as gmt]
|
||||||
|
[app.common.json :as json]
|
||||||
[app.common.logging :as l]
|
[app.common.logging :as l]
|
||||||
[app.common.perf :as perf]
|
[app.common.perf :as perf]
|
||||||
[app.common.pprint :as pp]
|
[app.common.pprint :as pp]
|
||||||
[app.common.schema :as sm]
|
[app.common.schema :as sm]
|
||||||
[app.common.schema.desc-js-like :as smdj]
|
[app.common.schema.desc-js-like :as smdj]
|
||||||
[app.common.schema.desc-native :as smdn]
|
[app.common.schema.desc-native :as smdn]
|
||||||
[app.common.schema.openapi :as oapi]
|
|
||||||
[app.common.schema.generators :as sg]
|
[app.common.schema.generators :as sg]
|
||||||
|
[app.common.schema.openapi :as oapi]
|
||||||
[app.common.spec :as us]
|
[app.common.spec :as us]
|
||||||
[app.common.json :as json]
|
[app.common.time :as ct]
|
||||||
[app.common.transit :as t]
|
[app.common.transit :as t]
|
||||||
[app.common.types.file :as ctf]
|
[app.common.types.file :as ctf]
|
||||||
[app.common.uuid :as uuid]
|
[app.common.uuid :as uuid]
|
||||||
@@ -31,7 +33,6 @@
|
|||||||
[app.srepl.helpers :as srepl.helpers]
|
[app.srepl.helpers :as srepl.helpers]
|
||||||
[app.srepl.main :as srepl]
|
[app.srepl.main :as srepl]
|
||||||
[app.util.blob :as blob]
|
[app.util.blob :as blob]
|
||||||
[app.common.time :as ct]
|
|
||||||
[clj-async-profiler.core :as prof]
|
[clj-async-profiler.core :as prof]
|
||||||
[clojure.contrib.humanize :as hum]
|
[clojure.contrib.humanize :as hum]
|
||||||
[clojure.java.io :as io]
|
[clojure.java.io :as io]
|
||||||
|
|||||||
@@ -188,9 +188,9 @@
|
|||||||
and decoding."
|
and decoding."
|
||||||
[cfg file-id & {:as opts}]
|
[cfg file-id & {:as opts}]
|
||||||
(db/run! cfg (fn [{:keys [::db/conn] :as cfg}]
|
(db/run! cfg (fn [{:keys [::db/conn] :as cfg}]
|
||||||
(some->> (db/get* conn :file {:id file-id}
|
(when-let [row (db/get* conn :file {:id file-id}
|
||||||
(assoc opts ::db/remove-deleted false))
|
(assoc opts ::db/remove-deleted false))]
|
||||||
(decode-file cfg)))))
|
(decode-file cfg row opts)))))
|
||||||
|
|
||||||
(defn clean-file-features
|
(defn clean-file-features
|
||||||
[file]
|
[file]
|
||||||
|
|||||||
@@ -27,7 +27,7 @@
|
|||||||
[app.common.types.page :as ctp]
|
[app.common.types.page :as ctp]
|
||||||
[app.common.types.plugins :as ctpg]
|
[app.common.types.plugins :as ctpg]
|
||||||
[app.common.types.shape :as cts]
|
[app.common.types.shape :as cts]
|
||||||
[app.common.types.tokens-lib :as cto]
|
[app.common.types.tokens-lib :as ctob]
|
||||||
[app.common.types.typography :as cty]
|
[app.common.types.typography :as cty]
|
||||||
[app.common.uuid :as uuid]
|
[app.common.uuid :as uuid]
|
||||||
[app.config :as cf]
|
[app.config :as cf]
|
||||||
@@ -120,7 +120,7 @@
|
|||||||
(sm/encoder cty/schema:typography sm/json-transformer))
|
(sm/encoder cty/schema:typography sm/json-transformer))
|
||||||
|
|
||||||
(def encode-tokens-lib
|
(def encode-tokens-lib
|
||||||
(sm/encoder cto/schema:tokens-lib sm/json-transformer))
|
(sm/encoder ctob/schema:tokens-lib sm/json-transformer))
|
||||||
|
|
||||||
(def encode-plugin-data
|
(def encode-plugin-data
|
||||||
(sm/encoder ctpg/schema:plugin-data sm/json-transformer))
|
(sm/encoder ctpg/schema:plugin-data sm/json-transformer))
|
||||||
@@ -158,7 +158,7 @@
|
|||||||
(sm/decoder cty/schema:typography sm/json-transformer))
|
(sm/decoder cty/schema:typography sm/json-transformer))
|
||||||
|
|
||||||
(def decode-tokens-lib
|
(def decode-tokens-lib
|
||||||
(sm/decoder cto/schema:tokens-lib sm/json-transformer))
|
(sm/decoder ctob/schema:tokens-lib sm/json-transformer))
|
||||||
|
|
||||||
(def decode-plugin-data
|
(def decode-plugin-data
|
||||||
(sm/decoder ctpg/schema:plugin-data sm/json-transformer))
|
(sm/decoder ctpg/schema:plugin-data sm/json-transformer))
|
||||||
@@ -196,7 +196,7 @@
|
|||||||
(sm/check-fn cty/schema:typography))
|
(sm/check-fn cty/schema:typography))
|
||||||
|
|
||||||
(def validate-tokens-lib
|
(def validate-tokens-lib
|
||||||
(sm/check-fn cto/schema:tokens-lib))
|
(sm/check-fn ctob/schema:tokens-lib))
|
||||||
|
|
||||||
(def validate-plugin-data
|
(def validate-plugin-data
|
||||||
(sm/check-fn ctpg/schema:plugin-data))
|
(sm/check-fn ctpg/schema:plugin-data))
|
||||||
@@ -349,7 +349,8 @@
|
|||||||
typography (encode-typography object)]
|
typography (encode-typography object)]
|
||||||
(write-entry! output path typography)))
|
(write-entry! output path typography)))
|
||||||
|
|
||||||
(when tokens-lib
|
(when (and tokens-lib
|
||||||
|
(not (ctob/empty-lib? tokens-lib)))
|
||||||
(let [path (str "files/" file-id "/tokens.json")
|
(let [path (str "files/" file-id "/tokens.json")
|
||||||
encoded-tokens (encode-tokens-lib tokens-lib)]
|
encoded-tokens (encode-tokens-lib tokens-lib)]
|
||||||
(write-entry! output path encoded-tokens)))))
|
(write-entry! output path encoded-tokens)))))
|
||||||
|
|||||||
@@ -31,6 +31,7 @@
|
|||||||
[app.common.types.shape :as cts]
|
[app.common.types.shape :as cts]
|
||||||
[app.common.types.shape.interactions :as ctsi]
|
[app.common.types.shape.interactions :as ctsi]
|
||||||
[app.common.types.shape.shadow :as ctss]
|
[app.common.types.shape.shadow :as ctss]
|
||||||
|
[app.common.types.shape.text :as ctst]
|
||||||
[app.common.types.text :as types.text]
|
[app.common.types.text :as types.text]
|
||||||
[app.common.uuid :as uuid]
|
[app.common.uuid :as uuid]
|
||||||
[clojure.set :as set]
|
[clojure.set :as set]
|
||||||
@@ -1585,6 +1586,25 @@
|
|||||||
(-> data
|
(-> data
|
||||||
(update :pages-index d/update-vals update-page))))
|
(update :pages-index d/update-vals update-page))))
|
||||||
|
|
||||||
|
(defmethod migrate-data "0012-fix-position-data"
|
||||||
|
[data _]
|
||||||
|
(let [decode-fn
|
||||||
|
(sm/decoder ctst/schema:position-data sm/json-transformer)
|
||||||
|
|
||||||
|
update-object
|
||||||
|
(fn [object]
|
||||||
|
(if (cfh/text-shape? object)
|
||||||
|
(d/update-when object :position-data decode-fn)
|
||||||
|
object))
|
||||||
|
|
||||||
|
update-container
|
||||||
|
(fn [container]
|
||||||
|
(d/update-when container :objects d/update-vals update-object))]
|
||||||
|
|
||||||
|
(-> data
|
||||||
|
(update :pages-index d/update-vals update-container)
|
||||||
|
(d/update-when :components d/update-vals update-container))))
|
||||||
|
|
||||||
(def available-migrations
|
(def available-migrations
|
||||||
(into (d/ordered-set)
|
(into (d/ordered-set)
|
||||||
["legacy-2"
|
["legacy-2"
|
||||||
@@ -1652,4 +1672,5 @@
|
|||||||
"0009-clean-library-colors"
|
"0009-clean-library-colors"
|
||||||
"0009-add-partial-text-touched-flags"
|
"0009-add-partial-text-touched-flags"
|
||||||
"0010-fix-swap-slots-pointing-non-existent-shapes"
|
"0010-fix-swap-slots-pointing-non-existent-shapes"
|
||||||
"0011-fix-invalid-text-touched-flags"]))
|
"0011-fix-invalid-text-touched-flags"
|
||||||
|
"0012-fix-position-data"]))
|
||||||
|
|||||||
@@ -768,7 +768,8 @@
|
|||||||
(theme-active? [_ group name] "predicate if token theme is active")
|
(theme-active? [_ group name] "predicate if token theme is active")
|
||||||
(activate-theme [_ group name] "adds theme from the active-themes")
|
(activate-theme [_ group name] "adds theme from the active-themes")
|
||||||
(deactivate-theme [_ group name] "removes theme from the active-themes")
|
(deactivate-theme [_ group name] "removes theme from the active-themes")
|
||||||
(toggle-theme-active? [_ group name] "toggles theme in the active-themes"))
|
(toggle-theme-active? [_ group name] "toggles theme in the active-themes")
|
||||||
|
(get-hidden-theme [_] "get the hidden temporary theme"))
|
||||||
|
|
||||||
(def schema:token-themes
|
(def schema:token-themes
|
||||||
[:and
|
[:and
|
||||||
@@ -906,6 +907,7 @@
|
|||||||
|
|
||||||
(defprotocol ITokensLib
|
(defprotocol ITokensLib
|
||||||
"A library of tokens, sets and themes."
|
"A library of tokens, sets and themes."
|
||||||
|
(empty-lib? [_] "True if the lib does not contain any token, set or theme")
|
||||||
(set-path-exists? [_ path] "if a set at `path` exists")
|
(set-path-exists? [_ path] "if a set at `path` exists")
|
||||||
(set-group-path-exists? [_ path] "if a set group at `path` exists")
|
(set-group-path-exists? [_ path] "if a set group at `path` exists")
|
||||||
(add-token-in-set [_ set-name token] "add token to a set")
|
(add-token-in-set [_ set-name token] "add token to a set")
|
||||||
@@ -1235,7 +1237,16 @@ Will return a value that matches this schema:
|
|||||||
(filter #(theme-active? this (:group %) (:name %))))
|
(filter #(theme-active? this (:group %) (:name %))))
|
||||||
(tree-seq d/ordered-map? vals themes)))
|
(tree-seq d/ordered-map? vals themes)))
|
||||||
|
|
||||||
|
(get-hidden-theme [this]
|
||||||
|
(get-theme this hidden-theme-group hidden-theme-name))
|
||||||
|
|
||||||
ITokensLib
|
ITokensLib
|
||||||
|
(empty-lib? [this]
|
||||||
|
(and (empty? sets)
|
||||||
|
(or (empty? themes)
|
||||||
|
(and (= (theme-count this) 1)
|
||||||
|
(get-hidden-theme this)))))
|
||||||
|
|
||||||
(set-path-exists? [_ set-path]
|
(set-path-exists? [_ set-path]
|
||||||
(some? (get-in sets (set-full-path->set-prefixed-full-path set-path))))
|
(some? (get-in sets (set-full-path->set-prefixed-full-path set-path))))
|
||||||
|
|
||||||
@@ -1338,10 +1349,6 @@ Will return a value that matches this schema:
|
|||||||
cljs.core/IEncodeJS
|
cljs.core/IEncodeJS
|
||||||
(-clj->js [this] (clj->js (datafy this)))))
|
(-clj->js [this] (clj->js (datafy this)))))
|
||||||
|
|
||||||
(defn get-hidden-theme
|
|
||||||
[tokens-lib]
|
|
||||||
(get-theme tokens-lib hidden-theme-group hidden-theme-name))
|
|
||||||
|
|
||||||
(defn valid-tokens-lib?
|
(defn valid-tokens-lib?
|
||||||
[o]
|
[o]
|
||||||
(and (instance? TokensLib o)
|
(and (instance? TokensLib o)
|
||||||
@@ -1785,11 +1792,12 @@ Will return a value that matches this schema:
|
|||||||
active-set-names
|
active-set-names
|
||||||
(get-active-themes-set-names tokens-lib)]
|
(get-active-themes-set-names tokens-lib)]
|
||||||
|
|
||||||
|
(when-not (empty-lib? tokens-lib)
|
||||||
(-> sets
|
(-> sets
|
||||||
(assoc "$themes" themes)
|
(assoc "$themes" themes)
|
||||||
(assoc "$metadata" {"tokenSetOrder" ordered-set-names
|
(assoc "$metadata" {"tokenSetOrder" ordered-set-names
|
||||||
"activeThemes" active-themes
|
"activeThemes" active-themes
|
||||||
"activeSets" active-set-names}))))
|
"activeSets" active-set-names})))))
|
||||||
|
|
||||||
(defn get-tokens-of-unknown-type
|
(defn get-tokens-of-unknown-type
|
||||||
"Search for all tokens in the decoded json file that have a type that is not currently
|
"Search for all tokens in the decoded json file that have a type that is not currently
|
||||||
|
|||||||
@@ -148,6 +148,7 @@
|
|||||||
(->> (rp/cmd! ::sse/import-binfile
|
(->> (rp/cmd! ::sse/import-binfile
|
||||||
{:name (str/replace (:name data) #".penpot$" "")
|
{:name (str/replace (:name data) #".penpot$" "")
|
||||||
:file file
|
:file file
|
||||||
|
:version 1
|
||||||
:project-id project-id})
|
:project-id project-id})
|
||||||
(rx/tap (fn [event]
|
(rx/tap (fn [event]
|
||||||
(let [payload (sse/get-payload event)
|
(let [payload (sse/get-payload event)
|
||||||
|
|||||||
Reference in New Issue
Block a user