@sit-onyx/nuxt-docs 0.7.2 → 0.7.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/app/composables/useSidebarNavigation.ts +11 -9
- package/app/error.vue +1 -1
- package/content.config.ts +1 -1
- package/modules/mdc.ts +23 -0
- package/package.json +14 -13
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { computed, useAsyncData, useI18n, useLocalePath, useRoute } from "#imports"; // since nuxt 4.3 the auto-imports don't work for this composable anymore; Might be related to https://github.com/nuxt/nuxt/issues/22342
|
|
2
1
|
import type { Collections, ContentNavigationItem } from "@nuxt/content";
|
|
2
|
+
import { computed, useAsyncData, useI18n, useLocalePath, useRoute } from "#imports"; // since nuxt 4.3 the auto-imports don't work for this composable anymore; Might be related to https://github.com/nuxt/nuxt/issues/22342
|
|
3
3
|
|
|
4
4
|
export type SidebarNavigationItem<TCollection extends keyof Collections = keyof Collections> = {
|
|
5
5
|
title: string;
|
|
@@ -20,11 +20,11 @@ export type SidebarNavigationItem<TCollection extends keyof Collections = keyof
|
|
|
20
20
|
* Custom navigation options. Can be set via the `.navigation.yml` file inside of a content folder.
|
|
21
21
|
*
|
|
22
22
|
* @example
|
|
23
|
-
*
|
|
24
|
-
*
|
|
25
|
-
*
|
|
26
|
-
*
|
|
27
|
-
*
|
|
23
|
+
* ```yaml
|
|
24
|
+
* # .navigation.yml
|
|
25
|
+
* sidebar:
|
|
26
|
+
* root: true
|
|
27
|
+
* ```;
|
|
28
28
|
*/
|
|
29
29
|
export type SidebarNavigationOptions = {
|
|
30
30
|
/**
|
|
@@ -104,8 +104,8 @@ export const useSidebarNavigation = async <
|
|
|
104
104
|
});
|
|
105
105
|
|
|
106
106
|
/**
|
|
107
|
-
* Finds the "previous root" (parent root) for the currently active route within the navigation
|
|
108
|
-
* Useful to e.g. display a back button to traverse up the navigation tree.
|
|
107
|
+
* Finds the "previous root" (parent root) for the currently active route within the navigation
|
|
108
|
+
* tree. Useful to e.g. display a back button to traverse up the navigation tree.
|
|
109
109
|
*/
|
|
110
110
|
const previousRootItem = computed(() => findPreviousRootItem(allItems.value, route.path));
|
|
111
111
|
|
|
@@ -117,7 +117,9 @@ export const useSidebarNavigation = async <
|
|
|
117
117
|
items: SidebarNavigationItem<TCollection>[],
|
|
118
118
|
currentPath: string,
|
|
119
119
|
): SidebarNavigationItem<TCollection> | undefined {
|
|
120
|
-
/**
|
|
120
|
+
/**
|
|
121
|
+
* Helper function to check if a path exists anywhere in a node's subtree
|
|
122
|
+
*/
|
|
121
123
|
const containsPath = (node: SidebarNavigationItem, path: string): boolean => {
|
|
122
124
|
if (node.path === path) return true;
|
|
123
125
|
return node.children?.some((child) => containsPath(child, path)) ?? false;
|
package/app/error.vue
CHANGED
|
@@ -10,7 +10,7 @@ defineSlots<{
|
|
|
10
10
|
/**
|
|
11
11
|
* Slot to override the default "Back to home" action(s).
|
|
12
12
|
*
|
|
13
|
-
* @
|
|
13
|
+
* @param clearError - Function to clear the error and redirect to the home page
|
|
14
14
|
*/
|
|
15
15
|
actions?(props: { clearError: typeof _clearError }): unknown;
|
|
16
16
|
/**
|
package/content.config.ts
CHANGED
package/modules/mdc.ts
ADDED
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import * as onyxMdc from "@sit-onyx/mdc";
|
|
2
|
+
import { addComponent, defineNuxtModule } from "nuxt/kit";
|
|
3
|
+
|
|
4
|
+
export default defineNuxtModule({
|
|
5
|
+
meta: {
|
|
6
|
+
name: "@sit-onyx/mdc",
|
|
7
|
+
},
|
|
8
|
+
setup(options, nuxt) {
|
|
9
|
+
nuxt.options.css.push("@sit-onyx/mdc/style.css");
|
|
10
|
+
|
|
11
|
+
Object.keys(onyxMdc)
|
|
12
|
+
.filter((namedExport) => namedExport.startsWith("Prose"))
|
|
13
|
+
.forEach((component) => {
|
|
14
|
+
addComponent({
|
|
15
|
+
filePath: "@sit-onyx/mdc",
|
|
16
|
+
name: component,
|
|
17
|
+
export: component,
|
|
18
|
+
global: true, // required by Nuxt content
|
|
19
|
+
priority: 1, // prevent warning because we are overriding default Nuxt content components
|
|
20
|
+
});
|
|
21
|
+
});
|
|
22
|
+
},
|
|
23
|
+
});
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@sit-onyx/nuxt-docs",
|
|
3
|
-
"version": "0.7.
|
|
3
|
+
"version": "0.7.3",
|
|
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"
|
|
@@ -15,7 +15,8 @@
|
|
|
15
15
|
"files": [
|
|
16
16
|
"app",
|
|
17
17
|
"content.config.ts",
|
|
18
|
-
"nuxt.config.ts"
|
|
18
|
+
"nuxt.config.ts",
|
|
19
|
+
"modules"
|
|
19
20
|
],
|
|
20
21
|
"type": "module",
|
|
21
22
|
"main": "./nuxt.config.ts",
|
|
@@ -23,22 +24,22 @@
|
|
|
23
24
|
"@sit-onyx/mdc": "^0.3.0"
|
|
24
25
|
},
|
|
25
26
|
"devDependencies": {
|
|
26
|
-
"@fontsource-variable/source-code-pro": "^5.
|
|
27
|
-
"@fontsource-variable/source-sans-3": "^5.
|
|
27
|
+
"@fontsource-variable/source-code-pro": "^5.3.0",
|
|
28
|
+
"@fontsource-variable/source-sans-3": "^5.3.0",
|
|
28
29
|
"@nuxt/content": "^3.15.0",
|
|
29
30
|
"@nuxt/test-utils": "^4.0.3",
|
|
30
31
|
"@nuxtjs/color-mode": "^4.0.1",
|
|
31
|
-
"@nuxtjs/mdc": "~0.22.
|
|
32
|
+
"@nuxtjs/mdc": "~0.22.2",
|
|
32
33
|
"@playwright/experimental-ct-vue": "1.61.1",
|
|
33
34
|
"@playwright/test": "1.61.1",
|
|
34
|
-
"nuxt": "4.
|
|
35
|
+
"nuxt": "4.5.0",
|
|
35
36
|
"sass-embedded": "1.100.0",
|
|
36
37
|
"typescript": "6.0.3",
|
|
37
|
-
"vue": "3.5.
|
|
38
|
-
"@sit-onyx/icons": "^1.
|
|
39
|
-
"@sit-onyx/shared": "^0.1.0",
|
|
38
|
+
"vue": "3.5.40",
|
|
39
|
+
"@sit-onyx/icons": "^1.11.0",
|
|
40
40
|
"@sit-onyx/nuxt": "^1.1.1",
|
|
41
|
-
"sit-onyx": "^1.
|
|
41
|
+
"@sit-onyx/shared": "^0.1.0",
|
|
42
|
+
"sit-onyx": "^1.18.0"
|
|
42
43
|
},
|
|
43
44
|
"peerDependencies": {
|
|
44
45
|
"@fontsource-variable/source-code-pro": ">= 5",
|
|
@@ -48,9 +49,9 @@
|
|
|
48
49
|
"@nuxtjs/i18n": ">= 10",
|
|
49
50
|
"@nuxtjs/mdc": ">= 0.20.2",
|
|
50
51
|
"sass-embedded": ">= 1",
|
|
51
|
-
"@sit-onyx/icons": "^1.
|
|
52
|
-
"sit-onyx": "^1.
|
|
53
|
-
"
|
|
52
|
+
"@sit-onyx/icons": "^1.11.0",
|
|
53
|
+
"@sit-onyx/nuxt": "^1.1.1",
|
|
54
|
+
"sit-onyx": "^1.18.0"
|
|
54
55
|
},
|
|
55
56
|
"engines": {
|
|
56
57
|
"node": ">=20"
|