@xyz/navigation 1.2.2 → 1.2.3
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/module.json
CHANGED
|
@@ -10,7 +10,12 @@ function isNestedSection(section) {
|
|
|
10
10
|
return typeof section === "object" && !Array.isArray(section) && ("items" in section || "children" in section || "footer" in section || "header" in section);
|
|
11
11
|
}
|
|
12
12
|
export function useNavigation(config = navigationConfig, options = {}) {
|
|
13
|
-
if (
|
|
13
|
+
if (!config) {
|
|
14
|
+
throw new Error(
|
|
15
|
+
"[xyz-navigation] No navigation config provided. Either create navigation.config.ts or pass config to useNavigation(config)."
|
|
16
|
+
);
|
|
17
|
+
}
|
|
18
|
+
if (process.dev) {
|
|
14
19
|
validateNavigationConfig(config);
|
|
15
20
|
}
|
|
16
21
|
const baseContext = useNavigationContext();
|
|
@@ -38,7 +43,7 @@ export function useNavigation(config = navigationConfig, options = {}) {
|
|
|
38
43
|
const result = {};
|
|
39
44
|
if (isNestedSection(section)) {
|
|
40
45
|
if (section.header) {
|
|
41
|
-
result.header = section.header(ctx);
|
|
46
|
+
result.header = typeof section.header === "function" ? section.header(ctx) : section.header;
|
|
42
47
|
}
|
|
43
48
|
if (section.items) {
|
|
44
49
|
const items = processNavigationItems(section.items, ctx, processingOptions);
|
|
@@ -212,24 +212,24 @@ export interface UseNavigationOptions {
|
|
|
212
212
|
translationFn?: (key: string) => string;
|
|
213
213
|
}
|
|
214
214
|
/**
|
|
215
|
-
* Result
|
|
215
|
+
* Result returned by useNavigation composable
|
|
216
216
|
*/
|
|
217
|
-
export
|
|
217
|
+
export type NavigationResult<T extends Record<string, NavigationSection>> = {
|
|
218
218
|
/**
|
|
219
|
-
*
|
|
219
|
+
* All sections grouped in a single computed ref
|
|
220
220
|
*/
|
|
221
|
-
sections:
|
|
222
|
-
[K in keyof T]: import('vue').ComputedRef<NavigationMenuItem[]>;
|
|
223
|
-
};
|
|
221
|
+
sections: import('vue').ComputedRef<Record<keyof T, ProcessedNestedSection>>;
|
|
224
222
|
/**
|
|
225
|
-
*
|
|
223
|
+
* Navigation context
|
|
226
224
|
*/
|
|
227
225
|
context: import('vue').ComputedRef<NavigationContext>;
|
|
228
226
|
/**
|
|
229
|
-
*
|
|
227
|
+
* Force refresh/recompute navigation
|
|
230
228
|
*/
|
|
231
229
|
refresh: () => void;
|
|
232
|
-
}
|
|
230
|
+
} & {
|
|
231
|
+
[K in keyof T]: import('vue').ComputedRef<ProcessedNestedSection>;
|
|
232
|
+
};
|
|
233
233
|
/**
|
|
234
234
|
* Sidebar state options
|
|
235
235
|
*/
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@xyz/navigation",
|
|
3
|
-
"version": "1.2.
|
|
3
|
+
"version": "1.2.3",
|
|
4
4
|
"description": "Context-aware, type-safe navigation for multi-tenant Nuxt applications",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"exports": {
|
|
@@ -47,14 +47,6 @@
|
|
|
47
47
|
],
|
|
48
48
|
"author": "xyz",
|
|
49
49
|
"license": "MIT",
|
|
50
|
-
"repository": {
|
|
51
|
-
"type": "git",
|
|
52
|
-
"url": "git+https://github.com/xyzhub/xyz-navigation.git"
|
|
53
|
-
},
|
|
54
|
-
"bugs": {
|
|
55
|
-
"url": "https://github.com/xyzhub/xyz-navigation/issues"
|
|
56
|
-
},
|
|
57
|
-
"homepage": "https://github.com/xyzhub/xyz-navigation#readme",
|
|
58
50
|
"dependencies": {
|
|
59
51
|
"defu": "^6.1.4"
|
|
60
52
|
},
|