@revojs/vue 0.1.16 → 0.1.18
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/client/index.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { $fetch, getState, sendRedirect, setState } from "../dist-CID_dTbk.js";
|
|
2
|
-
import { inject, onServerPrefetch, ref
|
|
2
|
+
import { customRef, inject, onServerPrefetch, ref } from "vue";
|
|
3
3
|
import { useRouter } from "vue-router";
|
|
4
4
|
|
|
5
5
|
//#region src/client/index.ts
|
|
@@ -9,9 +9,18 @@ function useScope() {
|
|
|
9
9
|
throw new Error();
|
|
10
10
|
}
|
|
11
11
|
function useState(scope, name, value) {
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
12
|
+
let state = getState(scope, name) ?? value;
|
|
13
|
+
return customRef((track, trigger) => ({
|
|
14
|
+
get() {
|
|
15
|
+
track();
|
|
16
|
+
return state;
|
|
17
|
+
},
|
|
18
|
+
set(update) {
|
|
19
|
+
state = update;
|
|
20
|
+
setState(scope, name, state);
|
|
21
|
+
trigger();
|
|
22
|
+
}
|
|
23
|
+
}));
|
|
15
24
|
}
|
|
16
25
|
function useAsync(scope, name, invoke, defaultOptions) {
|
|
17
26
|
const state = useState(scope, name);
|
package/dist/index.js
CHANGED
package/dist/module/app.ts
CHANGED
|
@@ -5,10 +5,10 @@ import Main from "#alias/vue/main";
|
|
|
5
5
|
import pages from "#virtual/pages";
|
|
6
6
|
|
|
7
7
|
function toRoute(path: string, node: Node<Component>, index: number): RouteRecordRaw {
|
|
8
|
-
const layout = node.children["
|
|
8
|
+
const layout = node.children["LAYOUT"];
|
|
9
9
|
|
|
10
10
|
if (layout) {
|
|
11
|
-
delete node.children["
|
|
11
|
+
delete node.children["LAYOUT"];
|
|
12
12
|
}
|
|
13
13
|
|
|
14
14
|
const children = Object.entries(node.children).map(([path, node]) => toRoute(path, node, index + 1));
|
|
@@ -38,11 +38,11 @@ export default async (scope: Scope) => {
|
|
|
38
38
|
const radix = new Radix<Component>();
|
|
39
39
|
|
|
40
40
|
for (const name in pages) {
|
|
41
|
-
const [path] = toRoutePath(name);
|
|
41
|
+
const [path, target] = toRoutePath(name);
|
|
42
42
|
|
|
43
|
-
const
|
|
44
|
-
if (
|
|
45
|
-
radix.use(path,
|
|
43
|
+
const Component = pages[name];
|
|
44
|
+
if (Component) {
|
|
45
|
+
radix.use(target === "PAGE" ? path : path + "/" + target, Component);
|
|
46
46
|
}
|
|
47
47
|
}
|
|
48
48
|
|
package/package.json
CHANGED
|
File without changes
|