undocs 0.2.15 → 0.2.17

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.
@@ -10,12 +10,14 @@ const { metaSymbol } = useShortcuts()
10
10
  const docsNav = useDocsNav()
11
11
 
12
12
  const headerLinks = computed(() => {
13
- return docsNav.links.map((link) => {
14
- return {
15
- ...link,
16
- children: link.children?.filter((child) => !child.children || child.children.some((c) => c.to === child.to)),
17
- }
18
- })
13
+ return docsNav.links
14
+ .filter((link) => link.hasIndex)
15
+ .map((link) => {
16
+ return {
17
+ ...link,
18
+ children: link.children?.filter((child) => !child.children || child.children.some((c) => c.to === child.to)),
19
+ }
20
+ })
19
21
  })
20
22
  </script>
21
23
 
@@ -22,12 +22,9 @@ onMounted(() => {
22
22
  </script>
23
23
 
24
24
  <template>
25
- <div
26
- class="bg absolute left-0 right-0 top-0 bottom-0 -z-10 transform-gpu blur-3xl overflow-hidden"
27
- aria-hidden="true"
28
- >
25
+ <div class="bg absolute inset-0 -z-10 transform-gpu blur-3xl overflow-hidden" aria-hidden="true">
29
26
  <div
30
- class="aspect-[1.7] w-full bg-gradient-to-r from-[rgb(var(--color-primary-DEFAULT))] to-white/10 lg:opacity-30 xs:opacity-50"
27
+ class="aspect-[1.7] h-full w-full bg-gradient-to-r from-[rgb(var(--color-primary-DEFAULT))] to-white/10 lg:opacity-30 xs:opacity-50"
31
28
  :style="{ 'clip-path': `polygon(${poly})` }"
32
29
  />
33
30
  </div>
@@ -1,6 +1,6 @@
1
1
  <!-- eslint-disable vue/no-v-html -->
2
2
  <template>
3
- <Callout icon="i-ph-bookmark-simple-duotone" :to="to || '#'">
3
+ <Callout icon="i-ph-bookmark-simple-duotone" :to="to">
4
4
  <MDCSlot unwrap="p"> Read more in <span class="font-bold" v-html="computedTitle" />. </MDCSlot>
5
5
  </Callout>
6
6
  </template>
@@ -25,9 +25,9 @@ const props = defineProps({
25
25
  },
26
26
  })
27
27
 
28
- const createBreadcrumb = (link: string = 'Missing link') => {
28
+ const createBreadcrumb = (link: string = 'here') => {
29
29
  if (link.startsWith('http')) {
30
- return link
30
+ return link.replace(/^https?:\/\//, '')
31
31
  }
32
32
  return link
33
33
  .split('/')
@@ -56,7 +56,7 @@ export default defineNuxtConfig({
56
56
  '\\.(js|mjs|ts)$',
57
57
  ],
58
58
  highlight: {
59
- langs: ['json5', 'jsonc', 'toml', 'yaml', 'html', 'sh', 'shell', 'bash'],
59
+ langs: ['json5', 'jsonc', 'toml', 'yaml', 'html', 'sh', 'shell', 'bash', 'mdc', 'markdown', 'md'],
60
60
  },
61
61
  },
62
62
  routeRules: {
@@ -92,7 +92,11 @@ const hero = computed(() => {
92
92
  <template v-if="page.features?.length > 0 && !hero.withFeatures">
93
93
  <ULandingSection :title="page.featuresTitle">
94
94
  <UPageGrid>
95
- <ULandingCard v-for="(item, index) of page.features" :key="index" v-bind="item" />
95
+ <ULandingCard v-for="(item, index) of page.features" :key="index" v-bind="item">
96
+ <template v-if="item.description" #description>
97
+ <MDC :value="item.description" tag="p" class="prose prose-primary dark:prose-invert" />
98
+ </template>
99
+ </ULandingCard>
96
100
  </UPageGrid>
97
101
  </ULandingSection>
98
102
  </template>
package/app/utils/nav.ts CHANGED
@@ -9,24 +9,35 @@ export function useDocsNav() {
9
9
 
10
10
  const links = computed(() => {
11
11
  return mapContentNavigation(navigation.value).map((item) => {
12
+ console.log(item)
13
+
14
+ // Flatren single child
12
15
  if (item.children?.length === 1) {
13
- return {
16
+ item = {
14
17
  ...item,
15
18
  ...item.children[0],
16
19
  children: undefined,
17
- active: isActive(item.to as string),
18
20
  }
19
21
  }
22
+
23
+ // Check if group index is not exists and default to first child
24
+ const originalTo = item.to as string
25
+ if (item.children?.length && !item.children.some((c) => c.to === originalTo)) {
26
+ item.to = item.children[0].to
27
+ }
28
+
20
29
  return {
21
30
  ...item,
22
- label: titleCase(item.to),
23
- active: isActive(item.to as string),
31
+ originalTo,
32
+ hasIndex: item.to === originalTo,
33
+ label: titleCase(originalTo),
34
+ active: isActive(originalTo),
24
35
  }
25
36
  })
26
37
  })
27
38
 
28
39
  const activeLinks = computed(() => {
29
- return links.value.find((l) => route.path.startsWith(l.to as string))?.children || []
40
+ return links.value.find((l) => route.path.startsWith(l.originalTo))?.children || []
30
41
  })
31
42
 
32
43
  return reactive({
package/cli/main.mjs CHANGED
@@ -8,7 +8,7 @@ const cli = createCLI({
8
8
  setup: {
9
9
  defaults: {
10
10
  github: 'unjs',
11
- themeColor: '#ECDC5A',
11
+ themeColor: 'amber',
12
12
  },
13
13
  },
14
14
  })
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "undocs",
3
- "version": "0.2.15",
3
+ "version": "0.2.17",
4
4
  "repository": "unjs/undocs",
5
5
  "license": "MIT",
6
6
  "type": "module",