From 50918a8128ce0d227d36fc9bbdf73351e686fd1f Mon Sep 17 00:00:00 2001 From: Benjamin Canac Date: Thu, 31 Oct 2024 14:16:26 +0100 Subject: [PATCH] docs: update to `@nuxt/content@next` (#2379) Co-authored-by: Farnabaz --- docs/app/app.vue | 20 +- docs/app/components/Header.vue | 4 +- docs/app/components/content/ComponentCode.vue | 9 +- .../app/components/content/ComponentEmits.vue | 4 +- .../app/components/content/ComponentProps.vue | 4 +- .../app/components/content/ComponentSlots.vue | 4 +- docs/app/error.vue | 11 +- docs/app/layouts/docs.vue | 6 +- docs/app/pages/[...slug].vue | 29 +- docs/content.config.ts | 27 ++ .../content/1.getting-started/.navigation.yml | 1 + docs/content/1.getting-started/_dir.yml | 3 - docs/content/3.components/meter.md | 30 -- docs/nuxt.config.ts | 83 +--- docs/package.json | 4 +- pnpm-lock.yaml | 436 ++++++++++++------ 16 files changed, 364 insertions(+), 311 deletions(-) create mode 100644 docs/content.config.ts create mode 100644 docs/content/1.getting-started/.navigation.yml delete mode 100644 docs/content/1.getting-started/_dir.yml delete mode 100644 docs/content/3.components/meter.md diff --git a/docs/app/app.vue b/docs/app/app.vue index d70202f6..cd9cc885 100644 --- a/docs/app/app.vue +++ b/docs/app/app.vue @@ -2,16 +2,13 @@ import { withoutTrailingSlash } from 'ufo' import colors from 'tailwindcss/colors' // import { debounce } from 'perfect-debounce' -import type { ContentSearchFile } from '@nuxt/ui-pro' const route = useRoute() const appConfig = useAppConfig() const colorMode = useColorMode() -const runtimeConfig = useRuntimeConfig() -const { integrity, api } = runtimeConfig.public.content -const { data: navigation } = await useAsyncData('navigation', () => fetchContentNavigation(), { default: () => [] }) -const { data: files } = await useLazyFetch(`${api.baseURL}/search${integrity ? '-' + integrity : ''}`, { default: () => [] }) +const { data: navigation } = await useAsyncData('navigation', () => queryCollectionNavigation('content')) +const { data: files } = await useAsyncData('files', () => queryCollectionSearchSections('content', { ignoredTags: ['style'] })) const searchTerm = ref('') @@ -29,7 +26,7 @@ const links = computed(() => { icon: 'i-heroicons-book-open', to: '/getting-started', active: route.path.startsWith('/getting-started') || route.path.startsWith('/components') - }, ...(navigation.value.find(item => item._path === '/pro') + }, ...(navigation.value?.find(item => item.path === '/pro') ? [{ label: 'Pro', icon: 'i-heroicons-square-3-stack-3d', @@ -76,12 +73,15 @@ useServerSeoMeta({ twitterCard: 'summary_large_image' }) -const updatedNavigation = computed(() => navigation.value.map(item => ({ +const updatedNavigation = computed(() => navigation.value?.map(item => ({ ...item, - children: item.children?.map(child => ({ + children: item.children?.map((child: typeof item) => ({ ...child, - active: child.title === 'Installation' ? route.path.startsWith('/getting-started/installation') : undefined, - children: child.title === 'Installation' ? [] : child.children + ...(child.path === '/getting-started/installation' && { + title: 'Installation', + active: route.path.startsWith('/getting-started/installation'), + children: [] + }) })) || [] }))) diff --git a/docs/app/components/Header.vue b/docs/app/components/Header.vue index a1b6909b..49946cf2 100644 --- a/docs/app/components/Header.vue +++ b/docs/app/components/Header.vue @@ -1,5 +1,5 @@