From 922b0a16230d1f96ddfac114e7af109574c89408 Mon Sep 17 00:00:00 2001 From: Hayden <64056131+hay-kot@users.noreply.github.com> Date: Fri, 27 Jan 2023 14:07:29 -0900 Subject: [PATCH] initial tree location elements --- frontend/components/Location/Tree/Node.vue | 105 ++++++++++++++++++ frontend/components/Location/Tree/Root.vue | 20 ++++ .../components/Location/Tree/tree-state.ts | 17 +++ 3 files changed, 142 insertions(+) create mode 100644 frontend/components/Location/Tree/Node.vue create mode 100644 frontend/components/Location/Tree/Root.vue create mode 100644 frontend/components/Location/Tree/tree-state.ts diff --git a/frontend/components/Location/Tree/Node.vue b/frontend/components/Location/Tree/Node.vue new file mode 100644 index 0000000..9debd87 --- /dev/null +++ b/frontend/components/Location/Tree/Node.vue @@ -0,0 +1,105 @@ + + + + + diff --git a/frontend/components/Location/Tree/Root.vue b/frontend/components/Location/Tree/Root.vue new file mode 100644 index 0000000..6ace6d7 --- /dev/null +++ b/frontend/components/Location/Tree/Root.vue @@ -0,0 +1,20 @@ + + + + + diff --git a/frontend/components/Location/Tree/tree-state.ts b/frontend/components/Location/Tree/tree-state.ts new file mode 100644 index 0000000..f344394 --- /dev/null +++ b/frontend/components/Location/Tree/tree-state.ts @@ -0,0 +1,17 @@ +import type { Ref } from "vue"; + +type TreeState = Record; + +const store: Record> = {}; + +export function newTreeKey(): string { + return Math.random().toString(36).substring(2); +} + +export function useTreeState(key: string): Ref { + if (!store[key]) { + store[key] = ref({}); + } + + return store[key]; +}