mirror of
https://github.com/penpot/penpot.git
synced 2025-05-19 03:16:11 +02:00
Merge pull request #3292 from penpot/hiru-fix-export-components
🐛 Fix export components for v2
This commit is contained in:
commit
8d37d63a27
1 changed files with 19 additions and 14 deletions
|
@ -20,6 +20,7 @@
|
||||||
[app.common.geom.shapes.bounds :as gsb]
|
[app.common.geom.shapes.bounds :as gsb]
|
||||||
[app.common.math :as mth]
|
[app.common.math :as mth]
|
||||||
[app.common.pages.helpers :as cph]
|
[app.common.pages.helpers :as cph]
|
||||||
|
[app.common.types.file :as ctf]
|
||||||
[app.common.types.modifiers :as ctm]
|
[app.common.types.modifiers :as ctm]
|
||||||
[app.common.types.shape-tree :as ctst]
|
[app.common.types.shape-tree :as ctst]
|
||||||
[app.config :as cfg]
|
[app.config :as cfg]
|
||||||
|
@ -378,18 +379,20 @@
|
||||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||||
|
|
||||||
(mf/defc component-symbol
|
(mf/defc component-symbol
|
||||||
[{:keys [id data] :as props}]
|
[{:keys [component] :as props}]
|
||||||
(let [name (:name data)
|
(let [name (:name component)
|
||||||
path (:path data)
|
path (:path component)
|
||||||
objects (-> (:objects data)
|
root-id (or (:main-instance-id component)
|
||||||
(adapt-objects-for-shape id))
|
(:id component))
|
||||||
root-shape (get objects id)
|
objects (adapt-objects-for-shape (:objects component)
|
||||||
|
root-id)
|
||||||
|
root-shape (get objects root-id)
|
||||||
selrect (:selrect root-shape)
|
selrect (:selrect root-shape)
|
||||||
|
|
||||||
main-instance-id (:main-instance-id data)
|
main-instance-id (:main-instance-id component)
|
||||||
main-instance-page (:main-instance-page data)
|
main-instance-page (:main-instance-page component)
|
||||||
main-instance-x (:main-instance-x data)
|
main-instance-x (:main-instance-x component)
|
||||||
main-instance-y (:main-instance-y data)
|
main-instance-y (:main-instance-y component)
|
||||||
|
|
||||||
vbox
|
vbox
|
||||||
(format-viewbox
|
(format-viewbox
|
||||||
|
@ -406,7 +409,7 @@
|
||||||
(mf/deps objects)
|
(mf/deps objects)
|
||||||
(fn [] (frame-wrapper-factory objects)))]
|
(fn [] (frame-wrapper-factory objects)))]
|
||||||
|
|
||||||
[:> "symbol" #js {:id (str id)
|
[:> "symbol" #js {:id (str root-id)
|
||||||
:viewBox vbox
|
:viewBox vbox
|
||||||
"penpot:path" path
|
"penpot:path" path
|
||||||
"penpot:main-instance-id" main-instance-id
|
"penpot:main-instance-id" main-instance-id
|
||||||
|
@ -436,9 +439,10 @@
|
||||||
:style {:display (when-not (some? children) "none")}
|
:style {:display (when-not (some? children) "none")}
|
||||||
:fill "none"}
|
:fill "none"}
|
||||||
[:defs
|
[:defs
|
||||||
(for [[id data] (source data)]
|
(for [[id component] (source data)]
|
||||||
[:& component-symbol {:id id :key (dm/str id) :data data}])]
|
(let [component (ctf/load-component-objects data component)]
|
||||||
|
[:& component-symbol {:key (dm/str id) :component component}]))]
|
||||||
|
|
||||||
children]]]))
|
children]]]))
|
||||||
|
|
||||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||||
|
@ -498,6 +502,7 @@
|
||||||
(let [;; Join all components objects into a single map
|
(let [;; Join all components objects into a single map
|
||||||
objects (->> (source data)
|
objects (->> (source data)
|
||||||
(vals)
|
(vals)
|
||||||
|
(map (partial ctf/load-component-objects data))
|
||||||
(map :objects)
|
(map :objects)
|
||||||
(reduce conj))]
|
(reduce conj))]
|
||||||
(rx/concat
|
(rx/concat
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue