@xyz/navigation 1.2.1 → 1.2.2
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
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { NavigationConfig, NavigationResult, UseNavigationOptions } from '../types/index.js';
|
|
1
|
+
import type { NavigationConfig, NavigationResult, UseNavigationOptions, NavigationSection } from '../types/index.js';
|
|
2
2
|
/**
|
|
3
3
|
* Main navigation composable
|
|
4
4
|
* Processes navigation configuration and returns resolved items
|
|
@@ -15,5 +15,7 @@ import type { NavigationConfig, NavigationResult, UseNavigationOptions } from '.
|
|
|
15
15
|
* const { sections } = useNavigation(config)
|
|
16
16
|
* // sections.app.value → processed items
|
|
17
17
|
* ```
|
|
18
|
+
* Main composable for context-aware navigation
|
|
19
|
+
* Auto-uses navigationConfig if no config provided
|
|
18
20
|
*/
|
|
19
|
-
export declare function useNavigation<T extends
|
|
21
|
+
export declare function useNavigation<T extends Record<string, NavigationSection>>(config?: NavigationConfig<T>, options?: UseNavigationOptions): NavigationResult<T>;
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { computed, isRef, unref } from "vue";
|
|
2
2
|
import { useNuxtApp } from "#app";
|
|
3
|
+
import navigationConfig from "#build/navigation-config";
|
|
3
4
|
import { useNavigationContext } from "./useNavigationContext.js";
|
|
4
5
|
import { processNavigationItems } from "../utils/processor.js";
|
|
5
6
|
import { createTemplateRegistry } from "../config/default-templates.js";
|
|
@@ -8,7 +9,7 @@ import { computeActiveStates } from "../utils/active-state.js";
|
|
|
8
9
|
function isNestedSection(section) {
|
|
9
10
|
return typeof section === "object" && !Array.isArray(section) && ("items" in section || "children" in section || "footer" in section || "header" in section);
|
|
10
11
|
}
|
|
11
|
-
export function useNavigation(config, options = {}) {
|
|
12
|
+
export function useNavigation(config = navigationConfig, options = {}) {
|
|
12
13
|
if (import.meta.dev) {
|
|
13
14
|
validateNavigationConfig(config);
|
|
14
15
|
}
|