@frigear-nu/menu 0.1.2 → 0.2.0
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.d.mts
CHANGED
|
@@ -28,6 +28,11 @@ type MenuItem = {
|
|
|
28
28
|
icon?: string;
|
|
29
29
|
to?: string;
|
|
30
30
|
external?: boolean;
|
|
31
|
+
/**
|
|
32
|
+
* Makes the item an action instead of a link: a view sends a request with this method to `to` (e.g. `POST
|
|
33
|
+
* /api/auth/logout`) and then reloads the site's home page, instead of navigating to `to`.
|
|
34
|
+
*/
|
|
35
|
+
method?: 'post';
|
|
31
36
|
tags?: string[];
|
|
32
37
|
/** Lower numbers render first. Items without an `order` are rendered last, in registration order. */
|
|
33
38
|
order?: number;
|
package/dist/module.json
CHANGED
package/dist/module.mjs
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { defineNuxtModule, createResolver, addImports, hasNuxtModule, addTypeTemplate, addPlugin, addServerImports } from '@nuxt/kit';
|
|
2
|
-
import { registerModule, defineVirtualRegistry } from '@frigear-nu/module-kit/utils';
|
|
2
|
+
import { registerModule, addOptionalImports, defineVirtualRegistry, inlineModuleRuntime } from '@frigear-nu/module-kit/utils';
|
|
3
3
|
|
|
4
4
|
const DEFAULT_CONTENT_COLLECTION = "config";
|
|
5
5
|
const DEFAULT_CONTENT_FIELD = "navigation";
|
|
@@ -16,6 +16,12 @@ const module$1 = defineNuxtModule({
|
|
|
16
16
|
if (contentEntries.length > 0 && !hasNuxtModule("@nuxt/content")) {
|
|
17
17
|
throw new Error("[@frigear-nu/menu] `content` is configured for one or more menus, but `@nuxt/content` module is not installed. Please install @nuxt/content or remove the `content` option.");
|
|
18
18
|
}
|
|
19
|
+
addOptionalImports(nuxt, "#menu/optional", [{
|
|
20
|
+
name: "queryCollection",
|
|
21
|
+
available: () => hasNuxtModule("@nuxt/content", nuxt),
|
|
22
|
+
fallback: `() => { throw new Error('[@frigear-nu/menu] \`@nuxt/content\` is not installed') }`,
|
|
23
|
+
fallbackType: "(collection: string) => never"
|
|
24
|
+
}]);
|
|
19
25
|
nuxt.options.runtimeConfig.public.menus = {
|
|
20
26
|
content: Object.fromEntries(
|
|
21
27
|
contentEntries.map(([menu, source]) => {
|
|
@@ -72,6 +78,7 @@ export const sources = [${sources.map((source, index) => `{ menu: ${JSON.stringi
|
|
|
72
78
|
from: resolver.resolve("./runtime/server/utils"),
|
|
73
79
|
as: "useMenu"
|
|
74
80
|
});
|
|
81
|
+
inlineModuleRuntime(nuxt, resolver);
|
|
75
82
|
}
|
|
76
83
|
});
|
|
77
84
|
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { computed, unref } from "vue";
|
|
2
2
|
import { useAsyncData, useNuxtApp, useRuntimeConfig } from "#imports";
|
|
3
|
+
import { queryCollection } from "#menu/optional";
|
|
3
4
|
import { collectMenuItems, matchesMenuGroup, parseMenuPath, sortByOrder, translateMenuItem } from "../../utils/menu.js";
|
|
4
5
|
import { getAppMenuStore } from "../utils/state.js";
|
|
5
6
|
function useMenuLocale() {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@frigear-nu/menu",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.2.0",
|
|
4
4
|
"description": "Named, shareable navigation menus - modules contribute items (extendMenu / a runtime/menus.ts source) and/or Nuxt Content, consumers read them via useMenu and render them however they like.",
|
|
5
5
|
"homepage": "https://docs.frigear.dev/modules/menu",
|
|
6
6
|
"repository": {
|
|
@@ -31,7 +31,7 @@
|
|
|
31
31
|
],
|
|
32
32
|
"dependencies": {
|
|
33
33
|
"@nuxt/kit": "^4.6.1",
|
|
34
|
-
"@frigear-nu/module-kit": "1.
|
|
34
|
+
"@frigear-nu/module-kit": "1.2.0",
|
|
35
35
|
"zod": "^4.6.5"
|
|
36
36
|
},
|
|
37
37
|
"devDependencies": {
|