0
Fork 0
mirror of https://github.com/penpot/penpot.git synced 2025-04-01 01:21:21 -05:00

💄 Rename "master" to "main" in components

This commit is contained in:
Andrés Moya 2021-03-18 13:36:25 +01:00 committed by Andrey Antukh
parent a1e75c6e03
commit 1e25e543b3
9 changed files with 140 additions and 140 deletions

View file

@ -37,7 +37,7 @@
(d/export helpers/get-container) (d/export helpers/get-container)
(d/export helpers/get-shape) (d/export helpers/get-shape)
(d/export helpers/get-component) (d/export helpers/get-component)
(d/export helpers/is-master-of) (d/export helpers/is-main-of)
(d/export helpers/get-component-root) (d/export helpers/get-component-root)
(d/export helpers/get-children) (d/export helpers/get-children)
(d/export helpers/get-children-objects) (d/export helpers/get-children-objects)

View file

@ -89,11 +89,11 @@
(get-in libraries [library-id :data]))] (get-in libraries [library-id :data]))]
(get-in file [:components component-id]))) (get-in file [:components component-id])))
(defn is-master-of (defn is-main-of
[shape-master shape-inst] [shape-main shape-inst]
(and (:shape-ref shape-inst) (and (:shape-ref shape-inst)
(or (= (:shape-ref shape-inst) (:id shape-master)) (or (= (:shape-ref shape-inst) (:id shape-main))
(= (:shape-ref shape-inst) (:shape-ref shape-master))))) (= (:shape-ref shape-inst) (:shape-ref shape-main)))))
(defn get-component-root (defn get-component-root
[component] [component]

View file

@ -5569,11 +5569,11 @@
}, },
"used-in" : [ "src/app/main/ui/workspace/context_menu.cljs" ] "used-in" : [ "src/app/main/ui/workspace/context_menu.cljs" ]
}, },
"workspace.shape.menu.go-master" : { "workspace.shape.menu.go-main" : {
"translations" : { "translations" : {
"de" : "Zur Hauptkomponentendatei wechseln", "de" : "Zur Hauptkomponentendatei wechseln",
"en" : "Go to master component file", "en" : "Go to main component file",
"es" : "Ir al archivo del componente maestro", "es" : "Ir al archivo del componente principal",
"fr" : "Aller au fichier du composant principal", "fr" : "Aller au fichier du composant principal",
"zh_cn" : "前往主组件文档" "zh_cn" : "前往主组件文档"
}, },
@ -5649,11 +5649,11 @@
}, },
"used-in" : [ "src/app/main/ui/workspace/context_menu.cljs" ] "used-in" : [ "src/app/main/ui/workspace/context_menu.cljs" ]
}, },
"workspace.shape.menu.show-master" : { "workspace.shape.menu.show-main" : {
"translations" : { "translations" : {
"de" : "Hauptkomponente anzeigen", "de" : "Hauptkomponente anzeigen",
"en" : "Show master component", "en" : "Show main component",
"es" : "Ver componente maestro", "es" : "Ver componente principal",
"fr" : "Afficher le composant principal", "fr" : "Afficher le composant principal",
"zh_cn" : "显示主组件" "zh_cn" : "显示主组件"
}, },
@ -5689,11 +5689,11 @@
}, },
"used-in" : [ "src/app/main/ui/workspace/context_menu.cljs" ] "used-in" : [ "src/app/main/ui/workspace/context_menu.cljs" ]
}, },
"workspace.shape.menu.update-master" : { "workspace.shape.menu.update-main" : {
"translations" : { "translations" : {
"de" : "Hauptkomponente aktualisieren", "de" : "Hauptkomponente aktualisieren",
"en" : "Update master component", "en" : "Update main component",
"es" : "Actualizar componente maestro", "es" : "Actualizar componente principal",
"fr" : "Actualiser le composant principal", "fr" : "Actualiser le composant principal",
"zh_cn" : "更新主组件" "zh_cn" : "更新主组件"
}, },

View file

@ -46,7 +46,7 @@
(declare compare-children) (declare compare-children)
(declare add-shape-to-instance) (declare add-shape-to-instance)
(declare add-shape-to-master) (declare add-shape-to-main)
(declare remove-shape) (declare remove-shape)
(declare move-shape) (declare move-shape)
(declare change-touched) (declare change-touched)
@ -498,7 +498,7 @@
;; Subcomponent-2-2 @--> Component-1 ;; Subcomponent-2-2 @--> Component-1
;; Shape-2-2-1 --> Shape-1-1 ;; Shape-2-2-1 --> Shape-1-1
;; ;;
;; * A SUBINSTANCE ACTUALLY HAS TWO MASTERS. For example IShape-2-2-1 ;; * A SUBINSTANCE ACTUALLY HAS TWO MAINS. For example IShape-2-2-1
;; depends on Shape-2-2-1 (in the "near" component) but also on ;; depends on Shape-2-2-1 (in the "near" component) but also on
;; Shape-1-1-1 (in the "remote" component). The "shape-ref" attribute ;; Shape-1-1-1 (in the "remote" component). The "shape-ref" attribute
;; always refer to the remote shape, and it's guaranteed that it's ;; always refer to the remote shape, and it's guaranteed that it's
@ -557,26 +557,26 @@
(:component-file shape-inst) (:component-file shape-inst)
local-library local-library
libraries) libraries)
shape-master (cp/get-shape component (:shape-ref shape-inst)) shape-main (cp/get-shape component (:shape-ref shape-inst))
initial-root? (:component-root? shape-inst) initial-root? (:component-root? shape-inst)
root-inst shape-inst root-inst shape-inst
root-master (cp/get-component-root component)] root-main (cp/get-component-root component)]
(if component (if component
(generate-sync-shape-direct-recursive container (generate-sync-shape-direct-recursive container
shape-inst shape-inst
component component
shape-master shape-main
root-inst root-inst
root-master root-main
reset? reset?
initial-root?) initial-root?)
empty-changes))) empty-changes)))
(defn- generate-sync-shape-direct-recursive (defn- generate-sync-shape-direct-recursive
[container shape-inst component shape-master root-inst root-master reset? initial-root?] [container shape-inst component shape-main root-inst root-main reset? initial-root?]
(log/debug :msg "Sync shape direct recursive" (log/debug :msg "Sync shape direct recursive"
:shape (str (:name shape-inst)) :shape (str (:name shape-inst))
:component (:name component)) :component (:name component))
@ -588,15 +588,15 @@
[rchanges uchanges] [rchanges uchanges]
(concat-changes (concat-changes
(update-attrs shape-inst (update-attrs shape-inst
shape-master shape-main
root-inst root-inst
root-master root-main
container container
omit-touched?) omit-touched?)
(concat-changes (concat-changes
(if reset? (if reset?
(change-touched shape-inst (change-touched shape-inst
shape-master shape-main
container container
{:reset-touched? true}) {:reset-touched? true})
empty-changes) empty-changes)
@ -610,8 +610,8 @@
children-inst (mapv #(cp/get-shape container %) children-inst (mapv #(cp/get-shape container %)
(:shapes shape-inst)) (:shapes shape-inst))
children-master (mapv #(cp/get-shape component %) children-main (mapv #(cp/get-shape component %)
(:shapes shape-master)) (:shapes shape-main))
only-inst (fn [child-inst] only-inst (fn [child-inst]
(when-not (and omit-touched? (when-not (and omit-touched?
@ -621,49 +621,49 @@
container container
omit-touched?))) omit-touched?)))
only-master (fn [child-master] only-main (fn [child-main]
(when-not (and omit-touched? (when-not (and omit-touched?
(contains? (:touched shape-inst) (contains? (:touched shape-inst)
:shapes-group)) :shapes-group))
(add-shape-to-instance child-master (add-shape-to-instance child-main
(d/index-of children-master (d/index-of children-main
child-master) child-main)
component component
container container
root-inst root-inst
root-master root-main
omit-touched? omit-touched?
set-remote-synced?))) set-remote-synced?)))
both (fn [child-inst child-master] both (fn [child-inst child-main]
(let [sub-root? (and (:component-id shape-inst) (let [sub-root? (and (:component-id shape-inst)
(not (:component-root? shape-inst)))] (not (:component-root? shape-inst)))]
(generate-sync-shape-direct-recursive container (generate-sync-shape-direct-recursive container
child-inst child-inst
component component
child-master child-main
(if sub-root? (if sub-root?
shape-inst shape-inst
root-inst) root-inst)
(if sub-root? (if sub-root?
shape-master shape-main
root-master) root-main)
reset? reset?
initial-root?))) initial-root?)))
moved (fn [child-inst child-master] moved (fn [child-inst child-main]
(move-shape (move-shape
child-inst child-inst
(d/index-of children-inst child-inst) (d/index-of children-inst child-inst)
(d/index-of children-master child-master) (d/index-of children-main child-main)
container container
omit-touched?)) omit-touched?))
[child-rchanges child-uchanges] [child-rchanges child-uchanges]
(compare-children children-inst (compare-children children-inst
children-master children-main
only-inst only-inst
only-master only-main
both both
moved moved
false)] false)]
@ -682,25 +682,25 @@
(:component-file shape-inst) (:component-file shape-inst)
local-library local-library
libraries) libraries)
shape-master (cp/get-shape component (:shape-ref shape-inst)) shape-main (cp/get-shape component (:shape-ref shape-inst))
initial-root? (:component-root? shape-inst) initial-root? (:component-root? shape-inst)
root-inst shape-inst root-inst shape-inst
root-master (cp/get-component-root component)] root-main (cp/get-component-root component)]
(if component (if component
(generate-sync-shape-inverse-recursive container (generate-sync-shape-inverse-recursive container
shape-inst shape-inst
component component
shape-master shape-main
root-inst root-inst
root-master root-main
initial-root?) initial-root?)
empty-changes))) empty-changes)))
(defn- generate-sync-shape-inverse-recursive (defn- generate-sync-shape-inverse-recursive
[container shape-inst component shape-master root-inst root-master initial-root?] [container shape-inst component shape-main root-inst root-main initial-root?]
(log/trace :msg "Sync shape inverse recursive" (log/trace :msg "Sync shape inverse recursive"
:shape (str (:name shape-inst)) :shape (str (:name shape-inst))
:component (:name component)) :component (:name component))
@ -713,19 +713,19 @@
[rchanges uchanges] [rchanges uchanges]
(concat-changes (concat-changes
(update-attrs shape-master (update-attrs shape-main
shape-inst shape-inst
root-master root-main
root-inst root-inst
component-container component-container
omit-touched?) omit-touched?)
(concat-changes (concat-changes
(change-touched shape-inst (change-touched shape-inst
shape-master shape-main
container container
{:reset-touched? true}) {:reset-touched? true})
(concat-changes (concat-changes
(change-touched shape-master (change-touched shape-main
shape-inst shape-inst
component-container component-container
{:copy-touched? true}) {:copy-touched? true})
@ -739,52 +739,52 @@
children-inst (mapv #(cp/get-shape container %) children-inst (mapv #(cp/get-shape container %)
(:shapes shape-inst)) (:shapes shape-inst))
children-master (mapv #(cp/get-shape component %) children-main (mapv #(cp/get-shape component %)
(:shapes shape-master)) (:shapes shape-main))
only-inst (fn [child-inst] only-inst (fn [child-inst]
(add-shape-to-master child-inst (add-shape-to-main child-inst
(d/index-of children-inst (d/index-of children-inst
child-inst) child-inst)
component component
container container
root-inst root-inst
root-master)) root-main))
only-master (fn [child-master] only-main (fn [child-main]
(remove-shape child-master (remove-shape child-main
component-container component-container
false)) false))
both (fn [child-inst child-master] both (fn [child-inst child-main]
(let [sub-root? (and (:component-id shape-inst) (let [sub-root? (and (:component-id shape-inst)
(not (:component-root? shape-inst)))] (not (:component-root? shape-inst)))]
(generate-sync-shape-inverse-recursive container (generate-sync-shape-inverse-recursive container
child-inst child-inst
component component
child-master child-main
(if sub-root? (if sub-root?
shape-inst shape-inst
root-inst) root-inst)
(if sub-root? (if sub-root?
shape-master shape-main
root-master) root-main)
initial-root?))) initial-root?)))
moved (fn [child-inst child-master] moved (fn [child-inst child-main]
(move-shape (move-shape
child-master child-main
(d/index-of children-master child-master) (d/index-of children-main child-main)
(d/index-of children-inst child-inst) (d/index-of children-inst child-inst)
component-container component-container
false)) false))
[child-rchanges child-uchanges] [child-rchanges child-uchanges]
(compare-children children-inst (compare-children children-inst
children-master children-main
only-inst only-inst
only-master only-main
both both
moved moved
true) true)
@ -807,70 +807,70 @@
; ---- Operation generation helpers ---- ; ---- Operation generation helpers ----
(defn- compare-children (defn- compare-children
[children-inst children-master only-inst-cb only-master-cb both-cb moved-cb inverse?] [children-inst children-main only-inst-cb only-main-cb both-cb moved-cb inverse?]
(loop [children-inst (seq (or children-inst [])) (loop [children-inst (seq (or children-inst []))
children-master (seq (or children-master [])) children-main (seq (or children-main []))
[rchanges uchanges] [[] []]] [rchanges uchanges] [[] []]]
(let [child-inst (first children-inst) (let [child-inst (first children-inst)
child-master (first children-master)] child-main (first children-main)]
(cond (cond
(and (nil? child-inst) (nil? child-master)) (and (nil? child-inst) (nil? child-main))
[rchanges uchanges] [rchanges uchanges]
(nil? child-inst) (nil? child-inst)
(reduce (fn [changes child] (reduce (fn [changes child]
(concat-changes changes (only-master-cb child))) (concat-changes changes (only-main-cb child)))
[rchanges uchanges] [rchanges uchanges]
children-master) children-main)
(nil? child-master) (nil? child-main)
(reduce (fn [changes child] (reduce (fn [changes child]
(concat-changes changes (only-inst-cb child))) (concat-changes changes (only-inst-cb child)))
[rchanges uchanges] [rchanges uchanges]
children-inst) children-inst)
:else :else
(if (cp/is-master-of child-master child-inst) (if (cp/is-main-of child-main child-inst)
(recur (next children-inst) (recur (next children-inst)
(next children-master) (next children-main)
(concat-changes [rchanges uchanges] (concat-changes [rchanges uchanges]
(both-cb child-inst child-master))) (both-cb child-inst child-main)))
(let [child-inst' (d/seek #(cp/is-master-of child-master %) (let [child-inst' (d/seek #(cp/is-main-of child-main %)
children-inst) children-inst)
child-master' (d/seek #(cp/is-master-of % child-inst) child-main' (d/seek #(cp/is-main-of % child-inst)
children-master)] children-main)]
(cond (cond
(nil? child-inst') (nil? child-inst')
(recur children-inst (recur children-inst
(next children-master) (next children-main)
(concat-changes [rchanges uchanges] (concat-changes [rchanges uchanges]
(only-master-cb child-master))) (only-main-cb child-main)))
(nil? child-master') (nil? child-main')
(recur (next children-inst) (recur (next children-inst)
children-master children-main
(concat-changes [rchanges uchanges] (concat-changes [rchanges uchanges]
(only-inst-cb child-inst))) (only-inst-cb child-inst)))
:else :else
(if inverse? (if inverse?
(recur (next children-inst) (recur (next children-inst)
(remove #(= (:id %) (:id child-master')) children-master) (remove #(= (:id %) (:id child-main')) children-main)
(-> [rchanges uchanges] (-> [rchanges uchanges]
(concat-changes (both-cb child-inst' child-master)) (concat-changes (both-cb child-inst' child-main))
(concat-changes (moved-cb child-inst child-master')))) (concat-changes (moved-cb child-inst child-main'))))
(recur (remove #(= (:id %) (:id child-inst')) children-inst) (recur (remove #(= (:id %) (:id child-inst')) children-inst)
(next children-master) (next children-main)
(-> [rchanges uchanges] (-> [rchanges uchanges]
(concat-changes (both-cb child-inst child-master')) (concat-changes (both-cb child-inst child-main'))
(concat-changes (moved-cb child-inst' child-master)))))))))))) (concat-changes (moved-cb child-inst' child-main))))))))))))
(defn- add-shape-to-instance (defn- add-shape-to-instance
[component-shape index component container root-instance root-master omit-touched? set-remote-synced?] [component-shape index component container root-instance root-main omit-touched? set-remote-synced?]
(log/info :msg (str "ADD [P] " (:name component-shape))) (log/info :msg (str "ADD [P] " (:name component-shape)))
(let [component-parent-shape (cp/get-shape component (:parent-id component-shape)) (let [component-parent-shape (cp/get-shape component (:parent-id component-shape))
parent-shape (d/seek #(cp/is-master-of component-parent-shape %) parent-shape (d/seek #(cp/is-main-of component-parent-shape %)
(cp/get-object-with-children (:id root-instance) (cp/get-object-with-children (:id root-instance)
(:objects container))) (:objects container)))
all-parents (vec (cons (:id parent-shape) all-parents (vec (cons (:id parent-shape)
@ -879,7 +879,7 @@
update-new-shape (fn [new-shape original-shape] update-new-shape (fn [new-shape original-shape]
(let [new-shape (reposition-shape new-shape (let [new-shape (reposition-shape new-shape
root-master root-main
root-instance)] root-instance)]
(cond-> new-shape (cond-> new-shape
true true
@ -933,12 +933,12 @@
empty-changes empty-changes
[rchanges uchanges]))) [rchanges uchanges])))
(defn- add-shape-to-master (defn- add-shape-to-main
[shape index component page root-instance root-master] [shape index component page root-instance root-main]
(log/info :msg (str "ADD [C] " (:name shape))) (log/info :msg (str "ADD [C] " (:name shape)))
(let [parent-shape (cp/get-shape page (:parent-id shape)) (let [parent-shape (cp/get-shape page (:parent-id shape))
component-parent-shape (d/seek #(cp/is-master-of % parent-shape) component-parent-shape (d/seek #(cp/is-main-of % parent-shape)
(cp/get-object-with-children (:id root-master) (cp/get-object-with-children (:id root-main)
(:objects component))) (:objects component)))
all-parents (vec (cons (:id component-parent-shape) all-parents (vec (cons (:id component-parent-shape)
(cp/get-parents (:id component-parent-shape) (cp/get-parents (:id component-parent-shape)
@ -947,7 +947,7 @@
update-new-shape (fn [new-shape original-shape] update-new-shape (fn [new-shape original-shape]
(reposition-shape new-shape (reposition-shape new-shape
root-instance root-instance
root-master)) root-main))
update-original-shape (fn [original-shape new-shape] update-original-shape (fn [original-shape new-shape]
(if-not (:shape-ref original-shape) (if-not (:shape-ref original-shape)

View file

@ -207,9 +207,9 @@
:on-click do-detach-component}] :on-click do-detach-component}]
[:& menu-entry {:title (t locale "workspace.shape.menu.reset-overrides") [:& menu-entry {:title (t locale "workspace.shape.menu.reset-overrides")
:on-click do-reset-component}] :on-click do-reset-component}]
[:& menu-entry {:title (t locale "workspace.shape.menu.update-master") [:& menu-entry {:title (t locale "workspace.shape.menu.update-main")
:on-click do-update-component}] :on-click do-update-component}]
[:& menu-entry {:title (t locale "workspace.shape.menu.show-master") [:& menu-entry {:title (t locale "workspace.shape.menu.show-main")
:on-click do-show-component}]] :on-click do-show-component}]]
[:* [:*
[:& menu-separator] [:& menu-separator]
@ -217,9 +217,9 @@
:on-click do-detach-component}] :on-click do-detach-component}]
[:& menu-entry {:title (t locale "workspace.shape.menu.reset-overrides") [:& menu-entry {:title (t locale "workspace.shape.menu.reset-overrides")
:on-click do-reset-component}] :on-click do-reset-component}]
[:& menu-entry {:title (t locale "workspace.shape.menu.go-master") [:& menu-entry {:title (t locale "workspace.shape.menu.go-main")
:on-click do-navigate-component-file}] :on-click do-navigate-component-file}]
[:& menu-entry {:title (t locale "workspace.shape.menu.update-master") [:& menu-entry {:title (t locale "workspace.shape.menu.update-main")
:on-click do-update-remote-component}]])) :on-click do-update-remote-component}]]))
[:& menu-separator] [:& menu-separator]

View file

@ -94,11 +94,11 @@
:options (if (= (:component-file values) current-file-id) :options (if (= (:component-file values) current-file-id)
[[(t locale "workspace.shape.menu.detach-instance") do-detach-component] [[(t locale "workspace.shape.menu.detach-instance") do-detach-component]
[(t locale "workspace.shape.menu.reset-overrides") do-reset-component] [(t locale "workspace.shape.menu.reset-overrides") do-reset-component]
[(t locale "workspace.shape.menu.update-master") do-update-component] [(t locale "workspace.shape.menu.update-main") do-update-component]
[(t locale "workspace.shape.menu.show-master") do-show-component]] [(t locale "workspace.shape.menu.show-main") do-show-component]]
[[(t locale "workspace.shape.menu.detach-instance") do-detach-component] [[(t locale "workspace.shape.menu.detach-instance") do-detach-component]
[(t locale "workspace.shape.menu.reset-overrides") do-reset-component] [(t locale "workspace.shape.menu.reset-overrides") do-reset-component]
[(t locale "workspace.shape.menu.go-master") do-navigate-component-file] [(t locale "workspace.shape.menu.go-main") do-navigate-component-file]
[(t locale "workspace.shape.menu.update-master") do-update-remote-component]])}]]]]]))) [(t locale "workspace.shape.menu.update-main") do-update-remote-component]])}]]]]])))

View file

@ -33,7 +33,7 @@
(let [shape1 (thp/get-shape new-state :shape1) (let [shape1 (thp/get-shape new-state :shape1)
[[group shape1] [c-group c-shape1] component] [[group shape1] [c-group c-shape1] component]
(thl/resolve-instance-and-master (thl/resolve-instance-and-main
new-state new-state
(:parent-id shape1)) (:parent-id shape1))
@ -79,7 +79,7 @@
[[group shape1 shape2] [[group shape1 shape2]
[c-group c-shape1 c-shape2] [c-group c-shape1 c-shape2]
component] component]
(thl/resolve-instance-and-master (thl/resolve-instance-and-main
new-state new-state
(:parent-id shape1)) (:parent-id shape1))
@ -129,7 +129,7 @@
(let [[[group shape1 shape2] (let [[[group shape1 shape2]
[c-group c-shape1 c-shape2] [c-group c-shape1 c-shape2]
component] component]
(thl/resolve-instance-and-master (thl/resolve-instance-and-main
new-state new-state
(thp/id :group1)) (thp/id :group1))
@ -221,7 +221,7 @@
[[instance1 shape1] [[instance1 shape1]
[c-instance1 c-shape1] [c-instance1 c-shape1]
component1] component1]
(thl/resolve-instance-and-master (thl/resolve-instance-and-main
new-state new-state
(:id instance1)) (:id instance1))
@ -314,7 +314,7 @@
[[instance2 shape2] [[instance2 shape2]
[c-instance2 c-shape2] [c-instance2 c-shape2]
component] component]
(thl/resolve-instance-and-master (thl/resolve-instance-and-main
new-state new-state
new-instance-id)] new-instance-id)]

View file

@ -44,7 +44,7 @@
(let [shape1 (thp/get-shape new-state :shape1) (let [shape1 (thp/get-shape new-state :shape1)
[[group shape1] [c-group c-shape1] component] [[group shape1] [c-group c-shape1] component]
(thl/resolve-instance-and-master (thl/resolve-instance-and-main
new-state new-state
(:id instance1)) (:id instance1))
@ -98,7 +98,7 @@
(let [shape1 (thp/get-shape new-state :shape1) (let [shape1 (thp/get-shape new-state :shape1)
[[group shape1] [c-group c-shape1] component] [[group shape1] [c-group c-shape1] component]
(thl/resolve-instance-and-master (thl/resolve-instance-and-main
new-state new-state
(:id instance1)) (:id instance1))

View file

@ -79,7 +79,7 @@
shapes-inst)) shapes-inst))
(defn resolve-instance-and-master (defn resolve-instance-and-main
[state root-inst-id] [state root-inst-id]
(let [page (thp/current-page state) (let [page (thp/current-page state)
root-inst (cph/get-shape page root-inst-id) root-inst (cph/get-shape page root-inst-id)
@ -94,26 +94,26 @@
shapes-inst (cph/get-object-with-children shapes-inst (cph/get-object-with-children
root-inst-id root-inst-id
(:objects page)) (:objects page))
shapes-master (cph/get-object-with-children shapes-main (cph/get-object-with-children
(:shape-ref root-inst) (:shape-ref root-inst)
(:objects component)) (:objects component))
unique-refs (into #{} (map :shape-ref shapes-inst)) unique-refs (into #{} (map :shape-ref shapes-inst))
master-exists? (fn [shape] main-exists? (fn [shape]
(t/is (some #(= (:id %) (:shape-ref shape)) (t/is (some #(= (:id %) (:shape-ref shape))
shapes-master)))] shapes-main)))]
;; Validate that the instance tree is well constructed ;; Validate that the instance tree is well constructed
(t/is (is-instance-root (first shapes-inst))) (t/is (is-instance-root (first shapes-inst)))
(run! is-instance-child (rest shapes-inst)) (run! is-instance-child (rest shapes-inst))
(run! is-noninstance shapes-master) (run! is-noninstance shapes-main)
(t/is (= (count shapes-inst) (t/is (= (count shapes-inst)
(count shapes-master) (count shapes-main)
(count unique-refs))) (count unique-refs)))
(run! master-exists? shapes-inst) (run! main-exists? shapes-inst)
[shapes-inst shapes-master component])) [shapes-inst shapes-main component]))
(defn resolve-component (defn resolve-component
[state component-id] [state component-id]
@ -126,14 +126,14 @@
file file
nil) nil)
root-master (cph/get-component-root root-main (cph/get-component-root
component) component)
shapes-master (cph/get-object-with-children shapes-main (cph/get-object-with-children
(:id root-master) (:id root-main)
(:objects component))] (:objects component))]
;; Validate that the component tree is well constructed ;; Validate that the component tree is well constructed
(run! is-noninstance shapes-master) (run! is-noninstance shapes-main)
[shapes-master component])) [shapes-main component]))