♻️ Move component instantiation to new types module

This commit is contained in:
Andrés Moya 2022-06-28 11:05:45 +02:00
parent 5dc7bc213f
commit bdcbe46d0d
39 changed files with 542 additions and 409 deletions

View file

@ -3,6 +3,7 @@
[app.common.data :as d]
[app.common.geom.point :as gpt]
[app.common.pages.helpers :as cph]
[app.common.types.container :as ctc]
[app.main.data.workspace :as dw]
[app.main.data.workspace.groups :as dwg]
[app.main.data.workspace.libraries :as dwl]
@ -520,7 +521,7 @@
;
(let [page (thp/current-page new-state)
shape1 (thp/get-shape new-state :shape1)
parent1 (cph/get-shape page (:parent-id shape1))
parent1 (ctc/get-shape page (:parent-id shape1))
[[group shape1 shape2]
[c-group c-shape1 c-shape2]

View file

@ -4,6 +4,7 @@
[app.common.data :as d]
[app.common.geom.point :as gpt]
[app.common.pages.helpers :as cph]
[app.common.types.container :as ctc]
[app.main.data.workspace :as dw]
[app.main.data.workspace.changes :as dch]
[app.main.data.workspace.shapes :as dwsh]
@ -1352,7 +1353,7 @@
instance1 (thp/get-shape state :instance1)
instance2 (thp/get-shape state :instance2)
shape2 (cph/get-shape (wsh/lookup-page state)
shape2 (ctc/get-shape (wsh/lookup-page state)
(first (:shapes instance2)))
update-fn1 (fn [shape]

View file

@ -8,6 +8,7 @@
[app.common.geom.point :as gpt]
[app.common.geom.shapes :as gsh]
[app.common.pages.helpers :as cph]
[app.common.types.container :as ctc]
[app.main.data.workspace :as dw]
[app.main.data.workspace.libraries-helpers :as dwlh]
[app.main.data.workspace.state-helpers :as wsh]
@ -59,7 +60,7 @@
verify that they are a well constructed instance tree."
[state root-inst-id]
(let [page (thp/current-page state)
root-inst (cph/get-shape page root-inst-id)
root-inst (ctc/get-shape page root-inst-id)
shapes-inst (cph/get-children-with-self (:objects page)
root-inst-id)]
(is-instance-root (first shapes-inst))
@ -72,7 +73,7 @@
verify that they are not a component instance."
[state root-inst-id]
(let [page (thp/current-page state)
root-inst (cph/get-shape page root-inst-id)
root-inst (ctc/get-shape page root-inst-id)
shapes-inst (cph/get-children-with-self (:objects page)
root-inst-id)]
(run! is-noninstance shapes-inst)
@ -84,7 +85,7 @@
the main component and all its shapes."
[state root-inst-id]
(let [page (thp/current-page state)
root-inst (cph/get-shape page root-inst-id)
root-inst (ctc/get-shape page root-inst-id)
libs (wsh/get-libraries state)
component (cph/get-component libs (:component-id root-inst))
@ -102,7 +103,7 @@
(cph/get-component libs (:component-id component-shape))
main-shape
(cph/get-shape component (:shape-ref shape))]
(ctc/get-shape component (:shape-ref shape))]
(t/is (some? main-shape))))]
@ -122,7 +123,7 @@
corresponding component shape missing."
[state root-inst-id]
(let [page (thp/current-page state)
root-inst (cph/get-shape page root-inst-id)
root-inst (ctc/get-shape page root-inst-id)
libs (wsh/get-libraries state)
component (cph/get-component libs (:component-id root-inst))
@ -140,7 +141,7 @@
(cph/get-component libs (:component-id component-shape))
main-shape
(cph/get-shape component (:shape-ref shape))]
(ctc/get-shape component (:shape-ref shape))]
(t/is (some? main-shape))))]