@movk/nuxt-docs 1.5.0 → 1.5.2

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.
package/app/app.config.ts CHANGED
@@ -1,4 +1,4 @@
1
- import type { ButtonProps } from '@nuxt/ui'
1
+ import type { ExtendedButtonProps } from './types'
2
2
 
3
3
  export default defineAppConfig({
4
4
  toaster: {
@@ -44,17 +44,31 @@ export default defineAppConfig({
44
44
  to: '/',
45
45
  search: true,
46
46
  colorMode: true,
47
- links: [] as ButtonProps[]
47
+ links: [] as ExtendedButtonProps[]
48
48
  },
49
49
  footer: {
50
50
  credits: `Copyright © 2024 - ${new Date().getFullYear()}`,
51
- socials: [] as ButtonProps[]
51
+ socials: [] as ExtendedButtonProps[]
52
52
  },
53
53
  toc: {
54
54
  title: '页面导航',
55
55
  bottom: {
56
56
  title: '社区',
57
- links: [] as ButtonProps[]
57
+ links: [] as ExtendedButtonProps[]
58
+ }
59
+ },
60
+ github: {
61
+ rootDir: '',
62
+ dateFormat: {
63
+ locale: 'zh-CN',
64
+ options: {
65
+ year: 'numeric',
66
+ month: 'numeric',
67
+ day: 'numeric',
68
+ hour: '2-digit',
69
+ minute: '2-digit',
70
+ timeZone: 'Asia/Shanghai'
71
+ }
58
72
  }
59
73
  }
60
74
  })
@@ -1,5 +1,5 @@
1
1
  <script setup lang="ts">
2
- import { camelCase, upperFirst } from '@movk/core'
2
+ import { camelCase, kebabCase, upperFirst } from '@movk/core'
3
3
 
4
4
  interface Commit {
5
5
  sha: string
@@ -29,6 +29,15 @@ const props = defineProps<{
29
29
  * The author to filter commits by.
30
30
  */
31
31
  author?: string
32
+ /**
33
+ * The casing format for the file name.
34
+ * - 'auto': Vue files use PascalCase, others use camelCase (default)
35
+ * - 'kebab': Keep kebab-case (e.g., use-user.ts)
36
+ * - 'camel': Convert to camelCase (e.g., useUser.ts)
37
+ * - 'pascal': Convert to PascalCase (e.g., UseUser.ts)
38
+ * @defaultValue 'auto'
39
+ */
40
+ casing?: 'auto' | 'kebab' | 'camel' | 'pascal'
32
41
  }>()
33
42
 
34
43
  const SHA_SHORT_LENGTH = 5
@@ -46,11 +55,26 @@ const filePath = computed(() => {
46
55
  const fileExtension = props.suffix ?? (github && typeof github === 'object' ? github.suffix : 'vue')
47
56
  const fileName = props.name ?? routeName.value
48
57
 
49
- const camelName = fileExtension === 'vue'
50
- ? upperFirst(camelCase(fileName))
51
- : camelCase(fileName)
58
+ // 根据 casing 参数转换文件名
59
+ const transformedName = (() => {
60
+ const casing = props.casing ?? (github && typeof github === 'object' ? github.casing : undefined) ?? 'auto'
61
+
62
+ switch (casing) {
63
+ case 'kebab':
64
+ return kebabCase(fileName)
65
+ case 'camel':
66
+ return camelCase(fileName)
67
+ case 'pascal':
68
+ return upperFirst(camelCase(fileName))
69
+ case 'auto':
70
+ default:
71
+ return fileExtension === 'vue'
72
+ ? upperFirst(camelCase(fileName))
73
+ : camelCase(fileName)
74
+ }
75
+ })()
52
76
 
53
- return `${basePath}/${filePrefix}${camelName}.${fileExtension}`
77
+ return `${basePath}/${filePrefix}${transformedName}.${fileExtension}`
54
78
  })
55
79
 
56
80
  const { data: commits } = await useLazyFetch<Commit[]>('/api/github/commits', {
@@ -1,5 +1,9 @@
1
1
  import type { ButtonProps } from '@nuxt/ui'
2
2
 
3
+ export interface ExtendedButtonProps extends ButtonProps {
4
+ label?: string
5
+ }
6
+
3
7
  declare module 'nuxt/schema' {
4
8
  interface AppConfig {
5
9
  vercelAnalytics: {
@@ -17,17 +21,17 @@ declare module 'nuxt/schema' {
17
21
  to: string
18
22
  search: boolean
19
23
  colorMode: boolean
20
- links: ButtonProps[]
24
+ links: ExtendedButtonProps[]
21
25
  }
22
26
  footer: {
23
27
  credits: string
24
- socials: ButtonProps[]
28
+ socials: ExtendedButtonProps[]
25
29
  }
26
30
  toc: {
27
31
  title: string
28
32
  bottom: {
29
33
  title: string
30
- links: ButtonProps[]
34
+ links: ExtendedButtonProps[]
31
35
  }
32
36
  }
33
37
  github: {
@@ -42,6 +46,12 @@ declare module 'nuxt/schema' {
42
46
  per_page: number
43
47
  until: string
44
48
  author: string
49
+ /**
50
+ * 文件命名格式
51
+ * @default 'auto'
52
+ * @example 'kebab' | 'camel' | 'pascal' | 'auto'
53
+ */
54
+ casing: 'auto' | 'kebab' | 'camel' | 'pascal'
45
55
  /**
46
56
  * 日期格式化配置
47
57
  * @example { locale: 'zh-CN', options: { year: 'numeric', month: '2-digit', day: '2-digit', hour: '2-digit', minute: '2-digit' } }
package/content.config.ts CHANGED
@@ -1,7 +1,8 @@
1
- import { defineCollection, defineContentConfig, z } from '@nuxt/content'
1
+ import { defineCollection, defineContentConfig } from '@nuxt/content'
2
2
  import { useNuxt } from '@nuxt/kit'
3
3
  import { asSeoCollection } from '@nuxtjs/seo/content'
4
4
  import { joinURL } from 'ufo'
5
+ import { z } from 'zod/v4'
5
6
 
6
7
  const { options } = useNuxt()
7
8
  const cwd = joinURL(options.rootDir, 'content')
package/modules/config.ts CHANGED
@@ -70,7 +70,19 @@ export default defineNuxtModule({
70
70
  'nuxt-og-image',
71
71
  '@nuxtjs/plausible',
72
72
  '@nuxt/ui',
73
- new RegExp(`${componentsPath.replace(/[/\\]/g, '[/\\\\]')}/(?!content/(ComponentEmits|ComponentProps|ComponentSlots|ComponentExample|CommitChangelog|PageLastCommit)\\.vue$)`)
73
+ (component: { filePath: string }) => {
74
+ const allowedComponents = [
75
+ 'CommitChangelog.vue',
76
+ 'ComponentEmits.vue',
77
+ 'ComponentExample.vue',
78
+ 'ComponentProps.vue',
79
+ 'ComponentSlots.vue',
80
+ 'PageLastCommit.vue',
81
+ 'Motion.vue'
82
+ ]
83
+ return component.filePath.startsWith(componentsPath)
84
+ && !allowedComponents.some(name => component.filePath.endsWith(`/content/${name}`))
85
+ }
74
86
  ],
75
87
  metaFields: {
76
88
  type: false,
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@movk/nuxt-docs",
3
3
  "type": "module",
4
- "version": "1.5.0",
4
+ "version": "1.5.2",
5
5
  "private": false,
6
6
  "description": "An elegant documentation theme for Nuxt, powered by Nuxt UI and Nuxt Content.",
7
7
  "author": "YiXuan <mhaibaraai@gmail.com>",
@@ -54,6 +54,7 @@
54
54
  "scule": "^1.3.0",
55
55
  "shiki-transformer-color-highlight": "^1.0.0",
56
56
  "tailwindcss": "^4.1.18",
57
- "ufo": "^1.6.1"
57
+ "ufo": "^1.6.1",
58
+ "zod": "^4.2.1"
58
59
  }
59
60
  }