Files
vue-menu-layer/nuxt.config.ts
Jakub Zych d980f4cf2f feat: MenuNav layer for the SummerCMS menu API
- typed client and useMenu/useMenuApi (SSR, menu:<code>:<locale> key,
  server and public bases, x-forwarded-for forwarded also on cached renders)
- MenuNav and recursive MenuNavItem: WAI disclosure navigation, URL
  allowlist with a text fallback, rel on _blank, active link and trail,
  mobile toggle, Esc / focus-out / outside pointer / route change closing
- menu tokens and base CSS, README
- node tests (link rules, client, server-rendered NavItem) and a playground
  SSR smoke against a fixture API
2026-10-12 18:19:53 +02:00

34 lines
1.2 KiB
TypeScript

// vue-menu-layer: renders a menu of the SummerCMS menu plugin
// (GET /_menu/api/v1/menus/{code}) as an accessible site navigation. An app
// consumes it with `extends: ['vue-menu-layer']` and renders <MenuNav>.
//
// Every path below is absolute and built from this file's directory: a
// relative or ~ path in a layer config resolves against the consuming
// project, not the layer. The layer declares no Nuxt modules.
import { fileURLToPath } from 'node:url'
const currentDir = fileURLToPath(new URL('.', import.meta.url))
export default defineNuxtConfig({
compatibilityDate: '2025-07-15',
devtools: { enabled: false },
// Tokens first, then the neutral styles that use them. The app's own css
// array loads after these, so its token overrides win.
css: [`${currentDir}app/assets/css/menu-tokens.css`, `${currentDir}app/assets/css/menu-base.css`],
runtimeConfig: {
menu: {
// Server-only base for SSR fetches (NUXT_MENU_API_BASE). It never
// comes from request input.
apiBase: 'http://127.0.0.1:8096/_menu/api/v1',
},
public: {
menu: {
// Same-origin base for browser fetches (NUXT_PUBLIC_MENU_API_BASE).
apiBase: '/_menu/api/v1',
},
},
},
})