@sit-onyx/nuxt-docs 0.7.3 → 0.7.4-dev-20260820145414

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.
@@ -98,7 +98,17 @@ export const useSidebarNavigation = async <
98
98
 
99
99
  const navigation = computed(() => {
100
100
  // support multiple sidebars / roots so different pages can have their own sub-sidebar
101
- const root = findDeepestRoot(allItems.value, route.path);
101
+ let root = findDeepestRoot(allItems.value, route.path);
102
+
103
+ // if the current path is not found in the navigation, fall back to parent paths
104
+ // e.g. /components/buttons/not-found -> /components/buttons -> /components
105
+ if (!root) {
106
+ for (const path of getPathAncestors(route.path)) {
107
+ root = findDeepestRoot(allItems.value, path);
108
+ if (root) break;
109
+ }
110
+ }
111
+
102
112
  if (!root) return allItems.value;
103
113
  return root.children ?? [root];
104
114
  });
@@ -193,3 +203,18 @@ export const useSidebarNavigation = async <
193
203
 
194
204
  return { navigation, allItems, previousRootItem };
195
205
  };
206
+
207
+ /**
208
+ * Returns all ancestor paths of the given path, from deepest to shallowest.
209
+ * e.g. "/components/buttons/icon-button"
210
+ * -> ["/components/buttons/icon-button", "/components/buttons", "/components", "/"]
211
+ */
212
+ function getPathAncestors(path: string): string[] {
213
+ const segments = path.split("/").filter(Boolean).slice(0, -1);
214
+ const ancestors: string[] = [];
215
+ for (let i = segments.length; i > 0; i--) {
216
+ ancestors.push("/" + segments.slice(0, i).join("/"));
217
+ }
218
+ ancestors.push("/");
219
+ return ancestors;
220
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@sit-onyx/nuxt-docs",
3
- "version": "0.7.3",
3
+ "version": "0.7.4-dev-20260820145414",
4
4
  "description": "Nuxt layer/template for creating documentations with the onyx design system",
5
5
  "bugs": {
6
6
  "url": "https://github.com/SchwarzIT/onyx/issues"
@@ -26,20 +26,20 @@
26
26
  "devDependencies": {
27
27
  "@fontsource-variable/source-code-pro": "^5.3.0",
28
28
  "@fontsource-variable/source-sans-3": "^5.3.0",
29
- "@nuxt/content": "^3.15.0",
30
- "@nuxt/test-utils": "^4.0.3",
29
+ "@nuxt/content": "^3.15.2",
30
+ "@nuxt/test-utils": "^4.1.0",
31
31
  "@nuxtjs/color-mode": "^4.0.1",
32
- "@nuxtjs/mdc": "~0.22.2",
33
- "@playwright/experimental-ct-vue": "1.61.1",
34
- "@playwright/test": "1.61.1",
35
- "nuxt": "4.5.0",
36
- "sass-embedded": "1.100.0",
32
+ "@nuxtjs/mdc": "~0.23.1",
33
+ "@playwright/experimental-ct-vue": "1.62.1",
34
+ "@playwright/test": "1.62.1",
35
+ "nuxt": "4.5.2",
36
+ "sass-embedded": "1.102.0",
37
37
  "typescript": "6.0.3",
38
- "vue": "3.5.40",
39
- "@sit-onyx/icons": "^1.11.0",
40
- "@sit-onyx/nuxt": "^1.1.1",
38
+ "vue": "3.5.41",
39
+ "@sit-onyx/nuxt": "^1.1.2",
41
40
  "@sit-onyx/shared": "^0.1.0",
42
- "sit-onyx": "^1.18.0"
41
+ "sit-onyx": "^1.20.0-dev-20260820145414",
42
+ "@sit-onyx/icons": "^1.12.0"
43
43
  },
44
44
  "peerDependencies": {
45
45
  "@fontsource-variable/source-code-pro": ">= 5",
@@ -49,9 +49,9 @@
49
49
  "@nuxtjs/i18n": ">= 10",
50
50
  "@nuxtjs/mdc": ">= 0.20.2",
51
51
  "sass-embedded": ">= 1",
52
- "@sit-onyx/icons": "^1.11.0",
53
- "@sit-onyx/nuxt": "^1.1.1",
54
- "sit-onyx": "^1.18.0"
52
+ "@sit-onyx/icons": "^1.12.0",
53
+ "sit-onyx": "^1.20.0-dev-20260820145414",
54
+ "@sit-onyx/nuxt": "^1.1.2"
55
55
  },
56
56
  "engines": {
57
57
  "node": ">=20"