mirror of
https://github.com/penpot/penpot.git
synced 2025-05-07 12:15:53 +02:00
🎉 Add many functions to assets panel and big refactor
This commit is contained in:
parent
3c7dda02c6
commit
b2fef7b7a8
9 changed files with 906 additions and 446 deletions
|
@ -5,6 +5,11 @@
|
||||||
|
|
||||||
### :sparkles: New features
|
### :sparkles: New features
|
||||||
|
|
||||||
|
- Allow nested asset groups [Taiga #1716](https://tree.taiga.io/project/penpot/us/1716)
|
||||||
|
- Allow to ungroup assets [Taiga #1719](https://tree.taiga.io/project/penpot/us/1719)
|
||||||
|
- Allow to rename assets groups [Taiga #1721](https://tree.taiga.io/project/penpot/us/1721)
|
||||||
|
- Memorize collapse state of assets in panel [Taiga #1718](https://tree.taiga.io/project/penpot/us/1718)
|
||||||
|
|
||||||
### :bug: Bugs fixed
|
### :bug: Bugs fixed
|
||||||
### :arrow_up: Deps updates
|
### :arrow_up: Deps updates
|
||||||
### :boom: Breaking changes
|
### :boom: Breaking changes
|
||||||
|
|
|
@ -479,8 +479,7 @@
|
||||||
:var [2 nil]}
|
:var [2 nil]}
|
||||||
:d [nil 10] }
|
:d [nil 10] }
|
||||||
|
|
||||||
If both maps are identical the result will be an empty map
|
If both maps are identical the result will be an empty map."
|
||||||
"
|
|
||||||
[m1 m2]
|
[m1 m2]
|
||||||
|
|
||||||
(let [m1ks (set (keys m1))
|
(let [m1ks (set (keys m1))
|
||||||
|
|
|
@ -60,6 +60,8 @@
|
||||||
(d/export helpers/get-base-shape)
|
(d/export helpers/get-base-shape)
|
||||||
(d/export helpers/is-parent?)
|
(d/export helpers/is-parent?)
|
||||||
(d/export helpers/get-index-in-parent)
|
(d/export helpers/get-index-in-parent)
|
||||||
|
(d/export helpers/split-path)
|
||||||
|
(d/export helpers/join-path)
|
||||||
(d/export helpers/parse-path-name)
|
(d/export helpers/parse-path-name)
|
||||||
(d/export helpers/merge-path-item)
|
(d/export helpers/merge-path-item)
|
||||||
(d/export helpers/compact-path)
|
(d/export helpers/compact-path)
|
||||||
|
|
|
@ -408,11 +408,17 @@
|
||||||
|
|
||||||
(defn split-path
|
(defn split-path
|
||||||
"Decompose a string in the form 'one / two / three' into
|
"Decompose a string in the form 'one / two / three' into
|
||||||
an array of strings, normalizing spaces."
|
a vector of strings, normalizing spaces."
|
||||||
[path]
|
[path]
|
||||||
(->> (str/split path "/")
|
(->> (str/split path "/")
|
||||||
(map str/trim)
|
(map str/trim)
|
||||||
(remove str/empty?)))
|
(remove str/empty?)
|
||||||
|
vec))
|
||||||
|
|
||||||
|
(defn join-path
|
||||||
|
"Regenerate a path as a string, from a vector."
|
||||||
|
[path-vec]
|
||||||
|
(str/join " / " path-vec))
|
||||||
|
|
||||||
(defn parse-path-name
|
(defn parse-path-name
|
||||||
"Parse a string in the form 'group / subgroup / name'.
|
"Parse a string in the form 'group / subgroup / name'.
|
||||||
|
@ -427,7 +433,9 @@
|
||||||
"Put the item at the end of the path."
|
"Put the item at the end of the path."
|
||||||
[path name]
|
[path name]
|
||||||
(if-not (empty? path)
|
(if-not (empty? path)
|
||||||
|
(if-not (empty? name)
|
||||||
(str path " / " name)
|
(str path " / " name)
|
||||||
|
path)
|
||||||
name))
|
name))
|
||||||
|
|
||||||
(defn compact-path
|
(defn compact-path
|
||||||
|
|
|
@ -71,6 +71,13 @@
|
||||||
(update [_ state]
|
(update [_ state]
|
||||||
(assoc-in state [:workspace-local :assets-files-open file-id box] open?))))
|
(assoc-in state [:workspace-local :assets-files-open file-id box] open?))))
|
||||||
|
|
||||||
|
(defn set-assets-group-open
|
||||||
|
[file-id box path open?]
|
||||||
|
(ptk/reify ::set-assets-group-open
|
||||||
|
ptk/UpdateEvent
|
||||||
|
(update [_ state]
|
||||||
|
(assoc-in state [:workspace-local :assets-files-open file-id :groups box path] open?))))
|
||||||
|
|
||||||
(defn default-color-name [color]
|
(defn default-color-name [color]
|
||||||
(or (:color color)
|
(or (:color color)
|
||||||
(case (get-in color [:gradient :type])
|
(case (get-in color [:gradient :type])
|
||||||
|
|
|
@ -105,7 +105,9 @@
|
||||||
{:class (dom/classnames :is-selected (and selected (= option-name selected)))
|
{:class (dom/classnames :is-selected (and selected (= option-name selected)))
|
||||||
:key option-name}
|
:key option-name}
|
||||||
(if-not sub-options
|
(if-not sub-options
|
||||||
[:a.context-menu-action {:on-click option-handler}
|
[:a.context-menu-action {:on-click #(do (dom/stop-propagation %)
|
||||||
|
(on-close)
|
||||||
|
(option-handler %))}
|
||||||
option-name]
|
option-name]
|
||||||
[:a.context-menu-action.submenu
|
[:a.context-menu-action.submenu
|
||||||
{:data-no-close true
|
{:data-no-close true
|
||||||
|
|
File diff suppressed because it is too large
Load diff
|
@ -1591,6 +1591,10 @@ msgstr "No assets found"
|
||||||
msgid "workspace.assets.rename"
|
msgid "workspace.assets.rename"
|
||||||
msgstr "Rename"
|
msgstr "Rename"
|
||||||
|
|
||||||
|
#: src/app/main/ui/workspace/sidebar/assets.cljs
|
||||||
|
msgid "workspace.assets.rename-group"
|
||||||
|
msgstr "Rename group"
|
||||||
|
|
||||||
#: src/app/main/ui/workspace/sidebar/assets.cljs
|
#: src/app/main/ui/workspace/sidebar/assets.cljs
|
||||||
msgid "workspace.assets.search"
|
msgid "workspace.assets.search"
|
||||||
msgstr "Search assets"
|
msgstr "Search assets"
|
||||||
|
@ -1641,6 +1645,10 @@ msgstr "Ag"
|
||||||
msgid "workspace.assets.typography.text-transform"
|
msgid "workspace.assets.typography.text-transform"
|
||||||
msgstr "Text Transform"
|
msgstr "Text Transform"
|
||||||
|
|
||||||
|
#: src/app/main/ui/workspace/sidebar/assets.cljs
|
||||||
|
msgid "workspace.assets.ungroup"
|
||||||
|
msgstr "Ungroup"
|
||||||
|
|
||||||
#: src/app/main/data/workspace/libraries.cljs, src/app/main/ui/components/color_bullet.cljs
|
#: src/app/main/data/workspace/libraries.cljs, src/app/main/ui/components/color_bullet.cljs
|
||||||
msgid "workspace.gradients.linear"
|
msgid "workspace.gradients.linear"
|
||||||
msgstr "Linear gradient"
|
msgstr "Linear gradient"
|
||||||
|
|
|
@ -1583,6 +1583,10 @@ msgstr "No se encontraron recursos"
|
||||||
msgid "workspace.assets.rename"
|
msgid "workspace.assets.rename"
|
||||||
msgstr "Renombrar"
|
msgstr "Renombrar"
|
||||||
|
|
||||||
|
#: src/app/main/ui/workspace/sidebar/assets.cljs
|
||||||
|
msgid "workspace.assets.rename-group"
|
||||||
|
msgstr "Renombrar grupo"
|
||||||
|
|
||||||
#: src/app/main/ui/workspace/sidebar/assets.cljs
|
#: src/app/main/ui/workspace/sidebar/assets.cljs
|
||||||
msgid "workspace.assets.search"
|
msgid "workspace.assets.search"
|
||||||
msgstr "Buscar recursos"
|
msgstr "Buscar recursos"
|
||||||
|
@ -1633,6 +1637,10 @@ msgstr "Ag"
|
||||||
msgid "workspace.assets.typography.text-transform"
|
msgid "workspace.assets.typography.text-transform"
|
||||||
msgstr "Transformar texto"
|
msgstr "Transformar texto"
|
||||||
|
|
||||||
|
#: src/app/main/ui/workspace/sidebar/assets.cljs
|
||||||
|
msgid "workspace.assets.ungroup"
|
||||||
|
msgstr "Desagrupar"
|
||||||
|
|
||||||
#: src/app/main/data/workspace/libraries.cljs, src/app/main/ui/components/color_bullet.cljs
|
#: src/app/main/data/workspace/libraries.cljs, src/app/main/ui/components/color_bullet.cljs
|
||||||
msgid "workspace.gradients.linear"
|
msgid "workspace.gradients.linear"
|
||||||
msgstr "Degradado lineal"
|
msgstr "Degradado lineal"
|
||||||
|
|
Loading…
Add table
Reference in a new issue