@movk/nuxt-docs 1.7.0 → 1.7.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.
|
@@ -0,0 +1,119 @@
|
|
|
1
|
+
<script setup lang="ts">
|
|
2
|
+
import { kebabCase } from 'scule'
|
|
3
|
+
|
|
4
|
+
interface Star {
|
|
5
|
+
x: number
|
|
6
|
+
y: number
|
|
7
|
+
size: number
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
const { starCount = 300, color = 'var(--ui-primary)', size = { min: 1, max: 2 } } = defineProps<{
|
|
11
|
+
starCount?: number
|
|
12
|
+
color?: string
|
|
13
|
+
size?: { min: number, max: number }
|
|
14
|
+
}>()
|
|
15
|
+
|
|
16
|
+
const route = useRoute()
|
|
17
|
+
|
|
18
|
+
// Generate random star positions and sizes
|
|
19
|
+
function generateStars(count: number): Star[] {
|
|
20
|
+
return Array.from({ length: count }, () => ({
|
|
21
|
+
x: Math.floor(Math.random() * 2000),
|
|
22
|
+
y: Math.floor(Math.random() * 2000),
|
|
23
|
+
size: typeof size === 'number'
|
|
24
|
+
? size
|
|
25
|
+
: Math.random() * (size.max - size.min) + size.min
|
|
26
|
+
}))
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
// Define speed configurations once
|
|
30
|
+
const speedMap = {
|
|
31
|
+
slow: { duration: 200, opacity: 0.5, ratio: 0.3 },
|
|
32
|
+
normal: { duration: 150, opacity: 0.75, ratio: 0.3 },
|
|
33
|
+
fast: { duration: 100, opacity: 1, ratio: 0.4 }
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
// Use a more efficient approach to generate and store stars
|
|
37
|
+
const stars = useState<{ slow: Star[], normal: Star[], fast: Star[] }>(`${kebabCase(route.path)}-stars`, () => {
|
|
38
|
+
return {
|
|
39
|
+
slow: generateStars(Math.floor(starCount * speedMap.slow.ratio)),
|
|
40
|
+
normal: generateStars(Math.floor(starCount * speedMap.normal.ratio)),
|
|
41
|
+
fast: generateStars(Math.floor(starCount * speedMap.fast.ratio))
|
|
42
|
+
}
|
|
43
|
+
})
|
|
44
|
+
|
|
45
|
+
// Compute star layers with different speeds and opacities
|
|
46
|
+
const starLayers = computed(() => [
|
|
47
|
+
{ stars: stars.value.fast, ...speedMap.fast },
|
|
48
|
+
{ stars: stars.value.normal, ...speedMap.normal },
|
|
49
|
+
{ stars: stars.value.slow, ...speedMap.slow }
|
|
50
|
+
])
|
|
51
|
+
</script>
|
|
52
|
+
|
|
53
|
+
<template>
|
|
54
|
+
<div class="absolute pointer-events-none z-[-1] inset-y-0 inset-x-5 sm:inset-x-7 lg:inset-x-9 overflow-hidden">
|
|
55
|
+
<div class="stars size-full absolute inset-x-0 top-0">
|
|
56
|
+
<div
|
|
57
|
+
v-for="(layer, index) in starLayers"
|
|
58
|
+
:key="index"
|
|
59
|
+
class="star-layer"
|
|
60
|
+
:style="{
|
|
61
|
+
'--star-duration': `${layer.duration}s`,
|
|
62
|
+
'--star-opacity': layer.opacity,
|
|
63
|
+
'--star-color': color
|
|
64
|
+
}"
|
|
65
|
+
>
|
|
66
|
+
<div
|
|
67
|
+
v-for="(star, starIndex) in layer.stars"
|
|
68
|
+
:key="starIndex"
|
|
69
|
+
class="star absolute rounded-full"
|
|
70
|
+
:style="{
|
|
71
|
+
left: `${star.x}px`,
|
|
72
|
+
top: `${star.y}px`,
|
|
73
|
+
width: `${star.size}px`,
|
|
74
|
+
height: `${star.size}px`,
|
|
75
|
+
backgroundColor: 'var(--star-color)',
|
|
76
|
+
opacity: 'var(--star-opacity)'
|
|
77
|
+
}"
|
|
78
|
+
/>
|
|
79
|
+
</div>
|
|
80
|
+
</div>
|
|
81
|
+
</div>
|
|
82
|
+
</template>
|
|
83
|
+
|
|
84
|
+
<style scoped>
|
|
85
|
+
.stars {
|
|
86
|
+
left: 50%;
|
|
87
|
+
transform: translate(-50%);
|
|
88
|
+
-webkit-mask-image: linear-gradient(180deg,
|
|
89
|
+
rgba(217, 217, 217, 0) 0%,
|
|
90
|
+
rgba(217, 217, 217, 0.8) 25%,
|
|
91
|
+
#d9d9d9 50%,
|
|
92
|
+
rgba(217, 217, 217, 0.8) 75%,
|
|
93
|
+
rgba(217, 217, 217, 0) 100%);
|
|
94
|
+
mask-image: linear-gradient(180deg,
|
|
95
|
+
rgba(217, 217, 217, 0) 0%,
|
|
96
|
+
rgba(217, 217, 217, 0.8) 25%,
|
|
97
|
+
#d9d9d9 50%,
|
|
98
|
+
rgba(217, 217, 217, 0.8) 75%,
|
|
99
|
+
rgba(217, 217, 217, 0) 100%);
|
|
100
|
+
-webkit-mask-size: cover;
|
|
101
|
+
mask-size: cover;
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
.star-layer {
|
|
105
|
+
animation: risingStarsAnimation linear infinite;
|
|
106
|
+
animation-duration: var(--star-duration);
|
|
107
|
+
will-change: transform;
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
@keyframes risingStarsAnimation {
|
|
111
|
+
0% {
|
|
112
|
+
transform: translateY(0);
|
|
113
|
+
}
|
|
114
|
+
|
|
115
|
+
100% {
|
|
116
|
+
transform: translateY(-2000px);
|
|
117
|
+
}
|
|
118
|
+
}
|
|
119
|
+
</style>
|
|
@@ -53,7 +53,9 @@ export function useTheme() {
|
|
|
53
53
|
},
|
|
54
54
|
set(option) {
|
|
55
55
|
appConfig.theme.font = option
|
|
56
|
-
|
|
56
|
+
if (appConfig.theme.font) {
|
|
57
|
+
window.localStorage.setItem(`${site.name}-ui-font`, appConfig.theme.font)
|
|
58
|
+
}
|
|
57
59
|
if (appConfig.vercelAnalytics?.debug) track('Theme Changed', { setting: 'font', value: option })
|
|
58
60
|
}
|
|
59
61
|
})
|
|
@@ -78,7 +80,9 @@ export function useTheme() {
|
|
|
78
80
|
set(option) {
|
|
79
81
|
appConfig.theme.icons = option
|
|
80
82
|
appConfig.ui.icons = themeIcons[option as keyof typeof themeIcons] as any
|
|
81
|
-
|
|
83
|
+
if (appConfig.theme.icons) {
|
|
84
|
+
window.localStorage.setItem(`${site.name}-ui-icons`, appConfig.theme.icons)
|
|
85
|
+
}
|
|
82
86
|
if (appConfig.vercelAnalytics?.debug) track('Theme Changed', { setting: 'icons', value: option })
|
|
83
87
|
}
|
|
84
88
|
})
|
package/app/layouts/default.vue
CHANGED
|
@@ -64,7 +64,7 @@ defineShortcuts(shortcuts)
|
|
|
64
64
|
class="fixed bottom-6 left-1/2 -translate-x-1/2 z-50 px-4"
|
|
65
65
|
style="will-change: transform"
|
|
66
66
|
>
|
|
67
|
-
<
|
|
67
|
+
<form @submit.prevent="handleSubmit">
|
|
68
68
|
<UInput
|
|
69
69
|
ref="inputRef"
|
|
70
70
|
v-model="input"
|
|
@@ -94,7 +94,7 @@ defineShortcuts(shortcuts)
|
|
|
94
94
|
</div>
|
|
95
95
|
</template>
|
|
96
96
|
</UInput>
|
|
97
|
-
</
|
|
97
|
+
</form>
|
|
98
98
|
</motion.div>
|
|
99
99
|
</AnimatePresence>
|
|
100
100
|
</template>
|
package/nuxt.schema.ts
CHANGED
|
@@ -2,6 +2,42 @@ import { field, group } from '@nuxt/content/preview'
|
|
|
2
2
|
|
|
3
3
|
export default defineNuxtSchema({
|
|
4
4
|
appConfig: {
|
|
5
|
+
theme: group({
|
|
6
|
+
title: '主题',
|
|
7
|
+
description: '主题相关配置',
|
|
8
|
+
icon: 'i-lucide-palette',
|
|
9
|
+
fields: {
|
|
10
|
+
radius: field({
|
|
11
|
+
type: 'number',
|
|
12
|
+
title: '圆角',
|
|
13
|
+
description: '全局圆角值,单位 rem',
|
|
14
|
+
icon: 'i-lucide-corner-up-left',
|
|
15
|
+
default: 0.25
|
|
16
|
+
}),
|
|
17
|
+
blackAsPrimary: field({
|
|
18
|
+
type: 'boolean',
|
|
19
|
+
title: '黑色主色调',
|
|
20
|
+
description: '是否将黑色设置为主色调',
|
|
21
|
+
icon: 'i-lucide-moon',
|
|
22
|
+
default: false
|
|
23
|
+
}),
|
|
24
|
+
icons: field({
|
|
25
|
+
type: 'string',
|
|
26
|
+
title: '图标集',
|
|
27
|
+
description: '全局图标集名称',
|
|
28
|
+
icon: 'i-lucide-icon',
|
|
29
|
+
default: 'lucide'
|
|
30
|
+
}),
|
|
31
|
+
font: field({
|
|
32
|
+
type: 'string',
|
|
33
|
+
title: '字体',
|
|
34
|
+
description: '全局字体名称',
|
|
35
|
+
icon: 'i-lucide-type',
|
|
36
|
+
default: 'Public Sans'
|
|
37
|
+
})
|
|
38
|
+
}
|
|
39
|
+
}),
|
|
40
|
+
|
|
5
41
|
vercelAnalytics: group({
|
|
6
42
|
title: 'Vercel Analytics',
|
|
7
43
|
description: 'Vercel Analytics 配置',
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@movk/nuxt-docs",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "1.7.
|
|
4
|
+
"version": "1.7.2",
|
|
5
5
|
"private": false,
|
|
6
6
|
"description": "Modern Nuxt 4 documentation theme with auto-generated component docs, AI chat assistant, MCP server, and complete developer experience optimization.",
|
|
7
7
|
"author": "YiXuan <mhaibaraai@gmail.com>",
|
|
@@ -28,9 +28,9 @@
|
|
|
28
28
|
"README.md"
|
|
29
29
|
],
|
|
30
30
|
"dependencies": {
|
|
31
|
-
"@ai-sdk/gateway": "^3.0.
|
|
32
|
-
"@ai-sdk/mcp": "^1.0.
|
|
33
|
-
"@ai-sdk/vue": "^3.0.
|
|
31
|
+
"@ai-sdk/gateway": "^3.0.13",
|
|
32
|
+
"@ai-sdk/mcp": "^1.0.6",
|
|
33
|
+
"@ai-sdk/vue": "^3.0.33",
|
|
34
34
|
"@iconify-json/lucide": "^1.2.84",
|
|
35
35
|
"@iconify-json/simple-icons": "^1.2.66",
|
|
36
36
|
"@iconify-json/vscode-icons": "^1.2.38",
|
|
@@ -48,11 +48,11 @@
|
|
|
48
48
|
"@vercel/speed-insights": "^1.3.1",
|
|
49
49
|
"@vueuse/core": "^14.1.0",
|
|
50
50
|
"@vueuse/nuxt": "^14.1.0",
|
|
51
|
-
"ai": "^6.0.
|
|
51
|
+
"ai": "^6.0.33",
|
|
52
52
|
"defu": "^6.1.4",
|
|
53
53
|
"exsolve": "^1.0.8",
|
|
54
54
|
"git-url-parse": "^16.1.0",
|
|
55
|
-
"motion-v": "^1.
|
|
55
|
+
"motion-v": "^1.9.0",
|
|
56
56
|
"nuxt": "^4.2.2",
|
|
57
57
|
"nuxt-component-meta": "^0.16.0",
|
|
58
58
|
"nuxt-llms": "^0.1.3",
|