@xyz/navigation 1.0.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.
@@ -0,0 +1,13 @@
1
+ import type { NavigationItemConfig } from '../types/index.js';
2
+ /**
3
+ * Validate navigation item configuration
4
+ */
5
+ export declare function validateNavigationItem(item: NavigationItemConfig): boolean;
6
+ /**
7
+ * Validate navigation configuration in development mode
8
+ */
9
+ export declare function validateNavigationConfig(config: Record<string, NavigationItemConfig[]>): void;
10
+ /**
11
+ * Type guard for NavigationItemConfig
12
+ */
13
+ export declare function isNavigationItem(value: any): value is NavigationItemConfig;
@@ -0,0 +1,27 @@
1
+ export function validateNavigationItem(item) {
2
+ if (!item.label || typeof item.label !== "string") {
3
+ console.warn('[xyz-navigation] Navigation item missing required "label" field:', item);
4
+ return false;
5
+ }
6
+ if (!item.to && !item.children && !item.onSelect && !item.divider) {
7
+ console.warn('[xyz-navigation] Navigation item should have "to", "children", "onSelect", or be a divider:', item);
8
+ return false;
9
+ }
10
+ return true;
11
+ }
12
+ export function validateNavigationConfig(config) {
13
+ if (import.meta.dev) {
14
+ for (const [section, items] of Object.entries(config)) {
15
+ if (!Array.isArray(items)) {
16
+ console.warn(`[xyz-navigation] Navigation section "${section}" is not an array`);
17
+ continue;
18
+ }
19
+ for (const item of items) {
20
+ validateNavigationItem(item);
21
+ }
22
+ }
23
+ }
24
+ }
25
+ export function isNavigationItem(value) {
26
+ return typeof value === "object" && value !== null && "label" in value && typeof value.label === "string";
27
+ }
@@ -0,0 +1 @@
1
+ export { type ModuleOptions } from './module.js'
@@ -0,0 +1 @@
1
+ export { type ModuleOptions } from './module'
package/package.json ADDED
@@ -0,0 +1,63 @@
1
+ {
2
+ "name": "@xyz/navigation",
3
+ "version": "1.0.0",
4
+ "description": "Context-aware, type-safe navigation for multi-tenant Nuxt applications",
5
+ "type": "module",
6
+ "exports": {
7
+ ".": {
8
+ "types": "./dist/types.d.ts",
9
+ "import": "./dist/module.mjs",
10
+ "require": "./dist/module.cjs"
11
+ }
12
+ },
13
+ "main": "./dist/module.cjs",
14
+ "types": "./dist/types.d.ts",
15
+ "files": [
16
+ "dist",
17
+ "README.md",
18
+ "LICENSE"
19
+ ],
20
+ "scripts": {
21
+ "prepack": "nuxt-module-build build",
22
+ "dev": "nuxi dev playground",
23
+ "dev:build": "nuxi build playground",
24
+ "dev:prepare": "nuxt-module-build build --stub && nuxt-module-build prepare && nuxi prepare playground",
25
+ "build": "nuxt-module-build build",
26
+ "test": "vitest",
27
+ "test:unit": "vitest run tests/unit",
28
+ "test:integration": "vitest run tests/integration",
29
+ "typecheck": "tsc --noEmit",
30
+ "lint": "eslint .",
31
+ "release": "npm run build && npm publish"
32
+ },
33
+ "keywords": [
34
+ "nuxt",
35
+ "nuxt-module",
36
+ "nuxt4",
37
+ "navigation",
38
+ "context-aware",
39
+ "multi-tenant",
40
+ "saas",
41
+ "dynamic-routing",
42
+ "typescript"
43
+ ],
44
+ "license": "MIT",
45
+ "dependencies": {
46
+ "defu": "^6.1.4"
47
+ },
48
+ "devDependencies": {
49
+ "@nuxt/kit": "^4.2.2",
50
+ "@nuxt/module-builder": "^0.8.4",
51
+ "@nuxt/schema": "^4.2.2",
52
+ "@nuxt/test-utils": "^3.14.3",
53
+ "@types/node": "^22.10.2",
54
+ "nuxt": "^4.2.2",
55
+ "typescript": "^5.7.2",
56
+ "unbuild": "^2.0.0",
57
+ "vitest": "^2.1.8",
58
+ "vue": "^3.5.13"
59
+ },
60
+ "publishConfig": {
61
+ "access": "public"
62
+ }
63
+ }