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