mirror of
https://github.com/penpot/penpot.git
synced 2025-08-07 14:38:33 +02:00
Merge remote-tracking branch 'origin/staging' into develop
This commit is contained in:
commit
a3ab524a8a
13 changed files with 85 additions and 53 deletions
13
.editorconfig
Normal file
13
.editorconfig
Normal file
|
@ -0,0 +1,13 @@
|
||||||
|
root = true
|
||||||
|
|
||||||
|
[*.{cljs,cljc,clj,js,css,scss,html,yml,yaml,json,mustache}]
|
||||||
|
charset = utf-8
|
||||||
|
|
||||||
|
indent_size = 2
|
||||||
|
indent_style = space
|
||||||
|
|
||||||
|
end_of_line = lf
|
||||||
|
|
||||||
|
insert_final_newline = true
|
||||||
|
|
||||||
|
trim_trailing_whitespace = true
|
9
.vscode/settings.json
vendored
Normal file
9
.vscode/settings.json
vendored
Normal file
|
@ -0,0 +1,9 @@
|
||||||
|
{
|
||||||
|
"files.exclude": {
|
||||||
|
"**/.clj-kondo": true,
|
||||||
|
"**/.cpcache": true,
|
||||||
|
"**/.lsp": true,
|
||||||
|
"**/.shadow-cljs": true,
|
||||||
|
"**/node_modules": true
|
||||||
|
}
|
||||||
|
}
|
|
@ -355,8 +355,8 @@
|
||||||
(db/get pool :file {:id id} {:columns [:id :modified-at :revn]}))
|
(db/get pool :file {:id id} {:columns [:id :modified-at :revn]}))
|
||||||
|
|
||||||
(defn get-file-etag
|
(defn get-file-etag
|
||||||
[{:keys [modified-at revn]}]
|
[{:keys [::rpc/profile-id]} {:keys [modified-at revn]}]
|
||||||
(str (dt/format-instant modified-at :iso) "-" revn))
|
(str profile-id (dt/format-instant modified-at :iso) revn))
|
||||||
|
|
||||||
(sv/defmethod ::get-file
|
(sv/defmethod ::get-file
|
||||||
"Retrieve a file by its ID. Only authenticated users."
|
"Retrieve a file by its ID. Only authenticated users."
|
||||||
|
@ -371,7 +371,7 @@
|
||||||
(check-read-permissions! perms)
|
(check-read-permissions! perms)
|
||||||
(let [file (-> (get-file conn id features project-id)
|
(let [file (-> (get-file conn id features project-id)
|
||||||
(assoc :permissions perms))]
|
(assoc :permissions perms))]
|
||||||
(vary-meta file assoc ::cond/key (get-file-etag file))))))
|
(vary-meta file assoc ::cond/key (get-file-etag params file))))))
|
||||||
|
|
||||||
|
|
||||||
;; --- COMMAND QUERY: get-file-fragment (by id)
|
;; --- COMMAND QUERY: get-file-fragment (by id)
|
||||||
|
|
|
@ -27,6 +27,8 @@
|
||||||
[app.common.logging :as l]
|
[app.common.logging :as l]
|
||||||
[app.rpc.helpers :as rph]
|
[app.rpc.helpers :as rph]
|
||||||
[app.util.services :as-alias sv]
|
[app.util.services :as-alias sv]
|
||||||
|
[buddy.core.codecs :as bc]
|
||||||
|
[buddy.core.hash :as bh]
|
||||||
[yetti.response :as yrs]))
|
[yetti.response :as yrs]))
|
||||||
|
|
||||||
(def
|
(def
|
||||||
|
@ -34,9 +36,16 @@
|
||||||
:doc "Runtime flag for enable/disable conditional processing of RPC methods."}
|
:doc "Runtime flag for enable/disable conditional processing of RPC methods."}
|
||||||
*enabled* false)
|
*enabled* false)
|
||||||
|
|
||||||
|
(defn- encode
|
||||||
|
[s]
|
||||||
|
(-> s
|
||||||
|
bh/blake2b-256
|
||||||
|
bc/bytes->b64u
|
||||||
|
bc/bytes->str))
|
||||||
|
|
||||||
(defn- fmt-key
|
(defn- fmt-key
|
||||||
[s]
|
[s]
|
||||||
(str "W/\"" s "\""))
|
(str "W/\"" (encode s) "\""))
|
||||||
|
|
||||||
(defn wrap
|
(defn wrap
|
||||||
[_ f {:keys [::get-object ::key-fn ::reuse-key?] :as mdata}]
|
[_ f {:keys [::get-object ::key-fn ::reuse-key?] :as mdata}]
|
||||||
|
@ -46,9 +55,8 @@
|
||||||
(fn [cfg {:keys [::key] :as params}]
|
(fn [cfg {:keys [::key] :as params}]
|
||||||
(if *enabled*
|
(if *enabled*
|
||||||
(let [key' (when (or key reuse-key?)
|
(let [key' (when (or key reuse-key?)
|
||||||
(some-> (get-object cfg params) key-fn fmt-key))]
|
(some->> (get-object cfg params) (key-fn params) (fmt-key)))]
|
||||||
(if (and (some? key)
|
(if (and (some? key) (= key key'))
|
||||||
(= key key'))
|
|
||||||
(fn [_] {::yrs/status 304})
|
(fn [_] {::yrs/status 304})
|
||||||
(let [result (f cfg params)
|
(let [result (f cfg params)
|
||||||
etag (or (and reuse-key? key')
|
etag (or (and reuse-key? key')
|
||||||
|
|
|
@ -115,3 +115,9 @@
|
||||||
[]
|
[]
|
||||||
[[(:id shape) (:component-id shape) :component]]))
|
[[(:id shape) (:component-id shape) :component]]))
|
||||||
[]))
|
[]))
|
||||||
|
|
||||||
|
(defn get-component-annotation
|
||||||
|
[shape libraries]
|
||||||
|
(let [library (dm/get-in libraries [(:component-file shape) :data])
|
||||||
|
component (get-component library (:component-id shape) true)]
|
||||||
|
(:annotation component)))
|
||||||
|
|
|
@ -363,7 +363,7 @@
|
||||||
// LIBRARY VIEW
|
// LIBRARY VIEW
|
||||||
.grid-item {
|
.grid-item {
|
||||||
.library {
|
.library {
|
||||||
height: 556px;
|
height: 580px;
|
||||||
}
|
}
|
||||||
|
|
||||||
&.project-th.library {
|
&.project-th.library {
|
||||||
|
|
|
@ -2414,6 +2414,16 @@
|
||||||
.title .icon {
|
.title .icon {
|
||||||
display: flex;
|
display: flex;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
textarea {
|
||||||
|
min-height: 250px;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
&.creating {
|
||||||
|
textarea {
|
||||||
|
min-height: 250px;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
.hidden {
|
.hidden {
|
||||||
|
@ -2445,7 +2455,6 @@
|
||||||
textarea {
|
textarea {
|
||||||
background-color: $color-gray-60;
|
background-color: $color-gray-60;
|
||||||
color: $color-white;
|
color: $color-white;
|
||||||
min-height: 250px;
|
|
||||||
padding: 10px;
|
padding: 10px;
|
||||||
|
|
||||||
border: none;
|
border: none;
|
||||||
|
|
|
@ -1,28 +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 app.main.data.workspace.annotation-helpers
|
|
||||||
(:require
|
|
||||||
[app.common.data.macros :as dm]
|
|
||||||
[app.common.logging :as log]
|
|
||||||
[app.common.types.components-list :as ctkl]
|
|
||||||
[app.main.refs :as refs]))
|
|
||||||
|
|
||||||
;; Change this to :info :debug or :trace to debug this module, or :warn to reset to default
|
|
||||||
(log/set-level! :warn)
|
|
||||||
|
|
||||||
|
|
||||||
(defn get-main-annotation
|
|
||||||
[shape libraries]
|
|
||||||
(let [library (dm/get-in libraries [(:component-file shape) :data])
|
|
||||||
component (ctkl/get-component library (:component-id shape) true)]
|
|
||||||
(:annotation component)))
|
|
||||||
|
|
||||||
(defn get-main-annotation-viewer
|
|
||||||
[shape libraries]
|
|
||||||
(let [objects (deref (refs/get-viewer-objects))
|
|
||||||
parent (get objects (:parent-id shape))]
|
|
||||||
(get-main-annotation parent libraries)))
|
|
|
@ -113,6 +113,22 @@
|
||||||
typographies (:typographies summary)]
|
typographies (:typographies summary)]
|
||||||
[:*
|
[:*
|
||||||
|
|
||||||
|
(when (and (zero? (:count components)) (zero? (:count colors)) (zero? (:count typographies)))
|
||||||
|
[:*
|
||||||
|
[:div.asset-section
|
||||||
|
[:div.asset-title
|
||||||
|
[:span (tr "workspace.assets.components")]
|
||||||
|
[:span.num-assets (str "\u00A0(") 0 ")"]]] ;; Unicode 00A0 is non-breaking space
|
||||||
|
[:div.asset-section
|
||||||
|
[:div.asset-title
|
||||||
|
[:span (tr "workspace.assets.colors")]
|
||||||
|
[:span.num-assets (str "\u00A0(") 0 ")"]]] ;; Unicode 00A0 is non-breaking space
|
||||||
|
[:div.asset-section
|
||||||
|
[:div.asset-title
|
||||||
|
[:span (tr "workspace.assets.typography")]
|
||||||
|
[:span.num-assets (str "\u00A0(") 0 ")"]]]]) ;; Unicode 00A0 is non-breaking space
|
||||||
|
|
||||||
|
|
||||||
(when (pos? (:count components))
|
(when (pos? (:count components))
|
||||||
[:div.asset-section
|
[:div.asset-section
|
||||||
[:div.asset-title
|
[:div.asset-title
|
||||||
|
|
|
@ -7,7 +7,7 @@
|
||||||
(ns app.main.ui.viewer.inspect.attributes
|
(ns app.main.ui.viewer.inspect.attributes
|
||||||
(:require
|
(:require
|
||||||
[app.common.geom.shapes :as gsh]
|
[app.common.geom.shapes :as gsh]
|
||||||
[app.main.data.workspace.annotation-helpers :as dwah]
|
[app.common.types.components-list :as ctkl]
|
||||||
[app.main.ui.hooks :as hooks]
|
[app.main.ui.hooks :as hooks]
|
||||||
[app.main.ui.viewer.inspect.annotation :refer [annotation]]
|
[app.main.ui.viewer.inspect.annotation :refer [annotation]]
|
||||||
[app.main.ui.viewer.inspect.attributes.blur :refer [blur-panel]]
|
[app.main.ui.viewer.inspect.attributes.blur :refer [blur-panel]]
|
||||||
|
@ -41,9 +41,7 @@
|
||||||
type (if (= (count shapes) 1) (-> shapes first :type) :multiple)
|
type (if (= (count shapes) 1) (-> shapes first :type) :multiple)
|
||||||
options (type->options type)
|
options (type->options type)
|
||||||
content (when (= (count shapes) 1)
|
content (when (= (count shapes) 1)
|
||||||
(if (= from :workspace)
|
(ctkl/get-component-annotation (first shapes) libraries))]
|
||||||
(dwah/get-main-annotation (first shapes) libraries)
|
|
||||||
(dwah/get-main-annotation-viewer (first shapes) libraries)))]
|
|
||||||
|
|
||||||
[:div.element-options
|
[:div.element-options
|
||||||
(for [[idx option] (map-indexed vector options)]
|
(for [[idx option] (map-indexed vector options)]
|
||||||
|
|
|
@ -447,7 +447,6 @@
|
||||||
|
|
||||||
first-shape (first shapes)
|
first-shape (first shapes)
|
||||||
{:keys [id component-id component-file main-instance?]} first-shape
|
{:keys [id component-id component-file main-instance?]} first-shape
|
||||||
lacks-annotation? (nil? (:annotation first-shape))
|
|
||||||
component-shapes (filter #(contains? % :component-id) shapes)
|
component-shapes (filter #(contains? % :component-id) shapes)
|
||||||
|
|
||||||
|
|
||||||
|
@ -458,9 +457,11 @@
|
||||||
|
|
||||||
workspace-data (deref refs/workspace-data)
|
workspace-data (deref refs/workspace-data)
|
||||||
workspace-libraries (deref refs/workspace-libraries)
|
workspace-libraries (deref refs/workspace-libraries)
|
||||||
is-dangling? (nil? (if local-component?
|
component (if local-component?
|
||||||
(ctkl/get-component workspace-data component-id)
|
(ctkl/get-component workspace-data component-id)
|
||||||
(ctf/get-component workspace-libraries component-file component-id)))
|
(ctf/get-component workspace-libraries component-file component-id))
|
||||||
|
is-dangling? (nil? component)
|
||||||
|
lacks-annotation? (nil? (:annotation component))
|
||||||
lib-exists? (and (not local-component?)
|
lib-exists? (and (not local-component?)
|
||||||
(some? (get workspace-libraries component-file)))
|
(some? (get workspace-libraries component-file)))
|
||||||
|
|
||||||
|
@ -535,7 +536,7 @@
|
||||||
[:*
|
[:*
|
||||||
[:& menu-entry {:title (tr "workspace.shape.menu.show-in-assets")
|
[:& menu-entry {:title (tr "workspace.shape.menu.show-in-assets")
|
||||||
:on-click do-show-in-assets}]
|
:on-click do-show-in-assets}]
|
||||||
(when (and components-v2 lacks-annotation?)
|
(when (and components-v2 local-component? lacks-annotation?)
|
||||||
[:& menu-entry {:title (tr "workspace.shape.menu.create-annotation")
|
[:& menu-entry {:title (tr "workspace.shape.menu.create-annotation")
|
||||||
:on-click create-annotation}])]
|
:on-click create-annotation}])]
|
||||||
(if local-component?
|
(if local-component?
|
||||||
|
|
|
@ -733,7 +733,7 @@
|
||||||
|
|
||||||
on-group
|
on-group
|
||||||
(mf/use-fn
|
(mf/use-fn
|
||||||
(mf/deps components selected)
|
(mf/deps components selected create-group)
|
||||||
(fn [event]
|
(fn [event]
|
||||||
(dom/stop-propagation event)
|
(dom/stop-propagation event)
|
||||||
(modal/show! :name-group-dialog {:accept create-group})))
|
(modal/show! :name-group-dialog {:accept create-group})))
|
||||||
|
@ -1110,7 +1110,7 @@
|
||||||
|
|
||||||
create-group
|
create-group
|
||||||
(mf/use-fn
|
(mf/use-fn
|
||||||
(mf/deps objects selected on-clear-selection)
|
(mf/deps objects selected on-clear-selection (:object-id @state))
|
||||||
(fn [group-name]
|
(fn [group-name]
|
||||||
(on-clear-selection)
|
(on-clear-selection)
|
||||||
(let [undo-id (js/Symbol)]
|
(let [undo-id (js/Symbol)]
|
||||||
|
@ -1138,7 +1138,7 @@
|
||||||
|
|
||||||
on-group
|
on-group
|
||||||
(mf/use-fn
|
(mf/use-fn
|
||||||
(mf/deps objects selected)
|
(mf/deps objects selected create-group)
|
||||||
(fn [event]
|
(fn [event]
|
||||||
(dom/stop-propagation event)
|
(dom/stop-propagation event)
|
||||||
(modal/show! :name-group-dialog {:accept create-group})))
|
(modal/show! :name-group-dialog {:accept create-group})))
|
||||||
|
@ -1868,7 +1868,7 @@
|
||||||
(seq (:colors selected)))
|
(seq (:colors selected)))
|
||||||
|
|
||||||
open-groups-ref (mf/with-memo [open-status-ref]
|
open-groups-ref (mf/with-memo [open-status-ref]
|
||||||
(-> (l/in [:groups :components])
|
(-> (l/in [:groups :typographies])
|
||||||
(l/derived open-status-ref)))
|
(l/derived open-status-ref)))
|
||||||
|
|
||||||
open-groups (mf/deref open-groups-ref)
|
open-groups (mf/deref open-groups-ref)
|
||||||
|
|
|
@ -99,7 +99,7 @@
|
||||||
(fn [] (st/emit! (dw/set-annotations-id-for-create nil))))) ;; cleanup set-annotationsid-for-create on unload
|
(fn [] (st/emit! (dw/set-annotations-id-for-create nil))))) ;; cleanup set-annotationsid-for-create on unload
|
||||||
|
|
||||||
(when (or creating? annotation)
|
(when (or creating? annotation)
|
||||||
[:div.component-annotation {:class (dom/classnames :editing @editing?)}
|
[:div.component-annotation {:class (dom/classnames :editing @editing? :creating creating?)}
|
||||||
[:div.title {:class (dom/classnames :expandeable (not (or @editing? creating?)))
|
[:div.title {:class (dom/classnames :expandeable (not (or @editing? creating?)))
|
||||||
:on-click #(expand (not annotations-expanded?))}
|
:on-click #(expand (not annotations-expanded?))}
|
||||||
[:div (if (or @editing? creating?)
|
[:div (if (or @editing? creating?)
|
||||||
|
@ -163,7 +163,6 @@
|
||||||
(:main-instance? values)
|
(:main-instance? values)
|
||||||
true)
|
true)
|
||||||
main-component? (:main-instance? values)
|
main-component? (:main-instance? values)
|
||||||
lacks-annotation? (nil? (:annotation values))
|
|
||||||
local-component? (= library-id current-file-id)
|
local-component? (= library-id current-file-id)
|
||||||
workspace-data (deref refs/workspace-data)
|
workspace-data (deref refs/workspace-data)
|
||||||
workspace-libraries (deref refs/workspace-libraries)
|
workspace-libraries (deref refs/workspace-libraries)
|
||||||
|
@ -171,6 +170,7 @@
|
||||||
(ctkl/get-component workspace-data component-id)
|
(ctkl/get-component workspace-data component-id)
|
||||||
(ctf/get-component workspace-libraries library-id component-id))
|
(ctf/get-component workspace-libraries library-id component-id))
|
||||||
is-dangling? (nil? component)
|
is-dangling? (nil? component)
|
||||||
|
lacks-annotation? (nil? (:annotation component))
|
||||||
lib-exists? (and (not local-component?)
|
lib-exists? (and (not local-component?)
|
||||||
(some? (get workspace-libraries library-id)))
|
(some? (get workspace-libraries library-id)))
|
||||||
|
|
||||||
|
@ -237,7 +237,7 @@
|
||||||
:options
|
:options
|
||||||
(if main-component?
|
(if main-component?
|
||||||
[[(tr "workspace.shape.menu.show-in-assets") do-show-in-assets]
|
[[(tr "workspace.shape.menu.show-in-assets") do-show-in-assets]
|
||||||
(when (and components-v2 lacks-annotation?)
|
(when (and components-v2 local-component? lacks-annotation?)
|
||||||
[(tr "workspace.shape.menu.create-annotation") do-create-annotation])]
|
[(tr "workspace.shape.menu.create-annotation") do-create-annotation])]
|
||||||
(if local-component?
|
(if local-component?
|
||||||
(if is-dangling?
|
(if is-dangling?
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue