@movk/nuxt-docs 1.7.0 → 1.7.1

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>
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@movk/nuxt-docs",
3
3
  "type": "module",
4
- "version": "1.7.0",
4
+ "version": "1.7.1",
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>",