Skip to content

Commit af0dfeb

Browse files
authored
docs: rethink the routing strategy
1 parent 27fc376 commit af0dfeb

File tree

1 file changed

+53
-0
lines changed

1 file changed

+53
-0
lines changed

docs/PLAN.md

Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,59 @@ A public figma file
44

55
# Plan
66

7+
## Routing
8+
9+
<details>
10+
I don't see any advantages in using a package for page routes
11+
12+
Just define a global store using `pinia` with fields like this:
13+
14+
```ts
15+
// just a mock-up, i dont remember how pinia stores look like lol
16+
{
17+
"page" : "home" // "home" | "library" | "settings" | `custom-${string}`,
18+
"setPage": (to: /* a type above */) => {
19+
for (const hook of /* window.[...].hooks */) {
20+
hook(to); // handle responses maybe
21+
}
22+
23+
this.page = to;
24+
},
25+
"states": {
26+
"home" : {},
27+
"library" : {},
28+
"settings": { "tab": "plugins" },
29+
// plugins can add their own fields
30+
};
31+
"setState": (key: string; value: object) {
32+
// handle hooks
33+
34+
this.states[key] = value;
35+
},
36+
};
37+
38+
window.__KAEDE__.router = /* pass the non-reactive object, or properties */
39+
```
40+
41+
and in the `layout.vue`:
42+
43+
```vue
44+
<script setup lang="ts">
45+
const router = useRouterStore();
46+
</script>
47+
48+
<template>
49+
<...>
50+
<home-page v-if="router.page === 'home'" />
51+
<... />
52+
<custom-page v-else />
53+
</...>
54+
</template>
55+
```
56+
57+
simple ass
58+
</details>
59+
760
## Extensions
861

962
<details>

0 commit comments

Comments
 (0)