mirror of
https://github.com/ArthurDanjou/ui.git
synced 2026-01-14 12:14:41 +01:00
docs: make generate work
This commit is contained in:
@@ -9,7 +9,7 @@ const runtimeConfig = useRuntimeConfig()
|
||||
const { integrity, api } = runtimeConfig.public.content
|
||||
|
||||
const { data: navigation } = await useAsyncData('navigation', () => fetchContentNavigation(), { default: () => [] })
|
||||
const { data: files } = await useLazyFetch<any[]>(`${api.baseURL}/search${integrity ? '.' + integrity : ''}`, { default: () => [] })
|
||||
const { data: files } = await useLazyFetch<any[]>(`${api.baseURL}/search${integrity ? '-' + integrity : ''}`, { default: () => [] })
|
||||
|
||||
const searchTerm = ref('')
|
||||
|
||||
@@ -71,24 +71,29 @@ useServerSeoMeta({
|
||||
})
|
||||
|
||||
provide('navigation', navigation)
|
||||
provide('files', files)
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<UApp>
|
||||
<NuxtLoadingIndicator />
|
||||
|
||||
<Banner v-if="!route.path.startsWith('/examples')" />
|
||||
<template v-if="!route.path.startsWith('/examples')">
|
||||
<Banner />
|
||||
|
||||
<Header v-if="!route.path.startsWith('/examples')" :links="links" />
|
||||
<Header :links="links" />
|
||||
</template>
|
||||
|
||||
<NuxtLayout>
|
||||
<NuxtPage />
|
||||
</NuxtLayout>
|
||||
|
||||
<Footer v-if="!route.path.startsWith('/examples')" />
|
||||
<template v-if="!route.path.startsWith('/examples')">
|
||||
<Footer />
|
||||
|
||||
<LazyUContentSearch v-model:search-term="searchTerm" :files="files" :navigation="navigation" :fuse="{ resultLimit: 42 }" />
|
||||
<ClientOnly>
|
||||
<LazyUContentSearch v-model:search-term="searchTerm" :files="files" :navigation="navigation" :fuse="{ resultLimit: 42 }" />
|
||||
</ClientOnly>
|
||||
</template>
|
||||
</UApp>
|
||||
</template>
|
||||
|
||||
|
||||
@@ -2,6 +2,7 @@
|
||||
<script setup lang="ts">
|
||||
import json5 from 'json5'
|
||||
import { upperFirst, camelCase, kebabCase } from 'scule'
|
||||
import { hash } from 'ohash'
|
||||
import * as theme from '#build/ui'
|
||||
import { get, set } from '#ui/utils'
|
||||
|
||||
@@ -179,7 +180,7 @@ const code = computed(() => {
|
||||
return code
|
||||
})
|
||||
|
||||
const { data: ast } = await useAsyncData(`component-code-${name}-${JSON.stringify({ props: componentProps, slots: props.slots })}`, async () => {
|
||||
const { data: ast } = await useAsyncData(`component-code-${name}-${hash({ props: componentProps, slots: props.slots })}`, async () => {
|
||||
if (!props.prettier) {
|
||||
return parseMarkdown(code.value)
|
||||
}
|
||||
|
||||
@@ -22,7 +22,7 @@ const meta = await fetchComponentMeta(name as any)
|
||||
</ProseTr>
|
||||
</ProseThead>
|
||||
<ProseTbody>
|
||||
<ProseTr v-for="event in meta.meta.events" :key="event.name">
|
||||
<ProseTr v-for="event in (meta?.meta?.events || [])" :key="event.name">
|
||||
<ProseTd>
|
||||
<ProseCodeInline>
|
||||
{{ event.name }}
|
||||
|
||||
@@ -22,7 +22,7 @@ const meta = await fetchComponentMeta(name as any)
|
||||
</ProseTr>
|
||||
</ProseThead>
|
||||
<ProseTbody>
|
||||
<ProseTr v-for="slot in meta.meta.slots" :key="slot.name">
|
||||
<ProseTr v-for="slot in (meta?.meta?.slots || [])" :key="slot.name">
|
||||
<ProseTd>
|
||||
<ProseCodeInline>
|
||||
{{ slot.name }}
|
||||
|
||||
@@ -9,8 +9,8 @@ const name = camelCase(route.params.slug?.[route.params.slug.length - 1] ?? '')
|
||||
|
||||
const strippedCompoundVariants = ref(false)
|
||||
|
||||
function stripCompoundVariants(component: any) {
|
||||
if (component.compoundVariants) {
|
||||
function stripCompoundVariants(component?: any) {
|
||||
if (component?.compoundVariants) {
|
||||
component.compoundVariants = component.compoundVariants.filter((compoundVariant: any) => {
|
||||
if (compoundVariant.color) {
|
||||
if (!['primary', 'gray'].includes(compoundVariant.color)) {
|
||||
|
||||
@@ -1,4 +1,6 @@
|
||||
<script setup lang="ts">
|
||||
import { murmurHash } from 'ohash'
|
||||
|
||||
const props = defineProps<{
|
||||
type: string
|
||||
}>()
|
||||
@@ -21,7 +23,7 @@ const type = computed(() => {
|
||||
return type
|
||||
})
|
||||
|
||||
const { data: ast } = await useAsyncData(`hightlight-inline-code-${type.value}`, () => parseMarkdown(`\`${type.value}\`{lang="ts-type"}`))
|
||||
const { data: ast } = await useAsyncData(`hightlight-inline-code-${murmurHash(type.value)}`, () => parseMarkdown(`\`${type.value}\`{lang="ts-type"}`))
|
||||
</script>
|
||||
|
||||
<template>
|
||||
|
||||
@@ -79,7 +79,7 @@ defineOgImageComponent('Docs', {
|
||||
|
||||
<template>
|
||||
<UPage v-if="page">
|
||||
<UPageHeader :title="page.title" :links="page.links" :headline="headline" :ui="{}">
|
||||
<UPageHeader :title="page.title" :links="page.links" :headline="headline">
|
||||
<template #description>
|
||||
<MDC v-if="page.description" :value="page.description" unwrap="p" />
|
||||
</template>
|
||||
@@ -90,7 +90,7 @@ defineOgImageComponent('Docs', {
|
||||
|
||||
<USeparator />
|
||||
|
||||
<UContentSurround :surround="surround as any" />
|
||||
<UContentSurround :surround="(surround as any)" />
|
||||
</UPageBody>
|
||||
|
||||
<template v-if="page?.body?.toc?.links?.length" #right>
|
||||
|
||||
@@ -15,7 +15,7 @@ navigation:
|
||||
|
||||
## Examples
|
||||
|
||||
## API
|
||||
<!-- ## API
|
||||
|
||||
### Props
|
||||
|
||||
@@ -31,4 +31,4 @@ navigation:
|
||||
|
||||
## Theme
|
||||
|
||||
:component-theme
|
||||
:component-theme -->
|
||||
|
||||
@@ -15,7 +15,7 @@ navigation:
|
||||
|
||||
## Examples
|
||||
|
||||
## API
|
||||
<!-- ## API
|
||||
|
||||
### Props
|
||||
|
||||
@@ -31,4 +31,4 @@ navigation:
|
||||
|
||||
## Theme
|
||||
|
||||
:component-theme
|
||||
:component-theme -->
|
||||
|
||||
@@ -31,6 +31,10 @@ export default defineNuxtConfig({
|
||||
compatibilityVersion: 4
|
||||
},
|
||||
|
||||
experimental: {
|
||||
buildCache: true
|
||||
},
|
||||
|
||||
runtimeConfig: {
|
||||
public: {
|
||||
version: pkg.version
|
||||
@@ -72,16 +76,17 @@ export default defineNuxtConfig({
|
||||
provider: 'ipx'
|
||||
},
|
||||
|
||||
// nitro: {
|
||||
// prerender: {
|
||||
// routes: [
|
||||
// '/getting-started'
|
||||
// // '/api/releases.json',
|
||||
// // '/api/pulls.json'
|
||||
// ],
|
||||
// ignore: !process.env.NUXT_GITHUB_TOKEN ? ['/pro'] : []
|
||||
// }
|
||||
// },
|
||||
nitro: {
|
||||
prerender: {
|
||||
routes: [
|
||||
'/getting-started'
|
||||
// '/api/releases.json',
|
||||
// '/api/pulls.json'
|
||||
],
|
||||
crawlLinks: true
|
||||
// ignore: !process.env.NUXT_GITHUB_TOKEN ? ['/pro'] : []
|
||||
}
|
||||
},
|
||||
|
||||
routeRules: {
|
||||
'/': { redirect: '/getting-started', prerender: false },
|
||||
|
||||
Reference in New Issue
Block a user