docus 5.10.1 → 5.12.0

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.
Files changed (34) hide show
  1. package/app/app.config.ts +4 -1
  2. package/app/app.vue +22 -27
  3. package/app/components/app/AppSearch.vue +54 -0
  4. package/app/components/docs/DocsAsideRight.vue +1 -2
  5. package/app/components/docs/DocsAsideRightBottom.vue +2 -2
  6. package/app/components/docs/DocsPageHeaderLinks.vue +11 -6
  7. package/app/composables/useDocusShortcuts.ts +24 -0
  8. package/app/composables/useUIConfig.ts +1 -1
  9. package/app/error.vue +1 -10
  10. package/app/pages/[[lang]]/[...slug].vue +6 -4
  11. package/app/plugins/i18n.ts +1 -1
  12. package/app/types/index.d.ts +22 -0
  13. package/i18n/locales/pl.json +2 -2
  14. package/modules/assistant/index.ts +13 -5
  15. package/modules/assistant/runtime/components/AssistantChat.vue +5 -2
  16. package/modules/assistant/runtime/components/AssistantComark.ts +9 -0
  17. package/modules/assistant/runtime/components/AssistantFloatingInput.vue +9 -10
  18. package/modules/assistant/runtime/components/AssistantIndicator.vue +116 -0
  19. package/modules/assistant/runtime/components/AssistantPanel.vue +268 -258
  20. package/modules/assistant/runtime/components/AssistantPreStream.vue +1 -1
  21. package/modules/assistant/runtime/composables/useAssistant.ts +34 -38
  22. package/modules/assistant/runtime/server/api/search.ts +22 -42
  23. package/modules/config.ts +12 -1
  24. package/modules/css.ts +35 -6
  25. package/modules/markdown-rewrite.ts +1 -1
  26. package/modules/skills/index.ts +4 -2
  27. package/nuxt.schema.ts +28 -0
  28. package/package.json +47 -28
  29. package/server/mcp/tools/get-page.ts +17 -8
  30. package/server/mcp/tools/list-pages.ts +10 -6
  31. package/server/routes/sitemap.xml.ts +7 -4
  32. package/server/utils/content.ts +4 -0
  33. package/modules/assistant/runtime/components/AssistantLoading.vue +0 -164
  34. package/modules/assistant/runtime/components/AssistantMatrix.vue +0 -92
@@ -1,164 +0,0 @@
1
- <script setup lang="ts">
2
- import { motion } from 'motion-v'
3
- import { useDocusI18n } from '../../../../app/composables/useDocusI18n'
4
-
5
- interface ToolCall {
6
- toolCallId: string
7
- toolName: string
8
- args: Record<string, unknown>
9
- }
10
-
11
- const props = defineProps<{
12
- text?: string
13
- toolCalls?: ToolCall[]
14
- isLoading?: boolean
15
- }>()
16
-
17
- const { t } = useDocusI18n()
18
-
19
- const messages = computed(() => [
20
- t('assistant.loading.searching'),
21
- t('assistant.loading.reading'),
22
- t('assistant.loading.analyzing'),
23
- t('assistant.loading.finding'),
24
- ])
25
-
26
- const finishedMessage = computed(() => t('assistant.loading.finished'))
27
-
28
- const currentIndex = ref(0)
29
- const targetText = computed(() => {
30
- if (!props.isLoading) {
31
- return finishedMessage.value
32
- }
33
- return props.text || messages.value[currentIndex.value]
34
- })
35
- const displayedText = ref(targetText.value)
36
-
37
- const chars = 'abcdefghijklmnopqrstuvwxyz'
38
-
39
- function scrambleText(from: string, to: string) {
40
- const maxLength = Math.max(from.length, to.length)
41
- let frame = 0
42
- const totalFrames = 15
43
-
44
- const animate = () => {
45
- frame++
46
- let result = ''
47
-
48
- for (let i = 0; i < maxLength; i++) {
49
- const progress = frame / totalFrames
50
- const charProgress = progress * maxLength
51
-
52
- if (i < charProgress - 2) {
53
- result += to[i] || ''
54
- }
55
- else if (i < charProgress) {
56
- result += chars[Math.floor(Math.random() * chars.length)]
57
- }
58
- else {
59
- result += from[i] || ''
60
- }
61
- }
62
-
63
- displayedText.value = result
64
-
65
- if (frame < totalFrames) {
66
- requestAnimationFrame(animate)
67
- }
68
- else {
69
- displayedText.value = to
70
- }
71
- }
72
-
73
- requestAnimationFrame(animate)
74
- }
75
-
76
- let textInterval: ReturnType<typeof setInterval> | null = null
77
-
78
- watch(targetText, (newText, oldText) => {
79
- if (newText !== oldText && newText && oldText) {
80
- scrambleText(oldText, newText)
81
- }
82
- })
83
-
84
- // Stop text rotation when loading finishes
85
- watch(() => props.isLoading, (isLoading) => {
86
- if (!isLoading && textInterval) {
87
- clearInterval(textInterval)
88
- textInterval = null
89
- }
90
- })
91
-
92
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
93
- function getToolLabel(toolName: string, args: any) {
94
- const path = args?.path || ''
95
-
96
- if (toolName === 'list-pages') {
97
- return t('assistant.toolListPages')
98
- }
99
-
100
- if (toolName === 'get-page') {
101
- return `${t('assistant.toolReadPage')} ${path || '...'}`
102
- }
103
-
104
- return toolName
105
- }
106
-
107
- onMounted(() => {
108
- // Text rotation only when loading
109
- if (!props.text && props.isLoading) {
110
- textInterval = setInterval(() => {
111
- currentIndex.value = (currentIndex.value + 1) % messages.value.length
112
- }, 3500)
113
- }
114
- })
115
-
116
- onUnmounted(() => {
117
- if (textInterval) clearInterval(textInterval)
118
- })
119
- </script>
120
-
121
- <template>
122
- <div class="flex flex-col gap-2">
123
- <!-- Main loader with matrix and text -->
124
- <div class="flex items-center text-xs text-muted overflow-hidden">
125
- <motion.div
126
- v-if="isLoading"
127
- :initial="{ opacity: 1, width: 'auto' }"
128
- :exit="{ opacity: 0, width: 0 }"
129
- :transition="{ duration: 0.2 }"
130
- class="shrink-0 mr-2"
131
- >
132
- <AssistantMatrix />
133
- </motion.div>
134
- <motion.span
135
- :animate="{ x: 0 }"
136
- :transition="{ duration: 0.2 }"
137
- class="font-mono tracking-tight"
138
- >
139
- {{ displayedText }}
140
- </motion.span>
141
- </div>
142
-
143
- <!-- Tool calls displayed below -->
144
- <div
145
- v-if="toolCalls?.length"
146
- class="flex flex-col gap-1"
147
- :class="isLoading ? 'pl-[22px]' : 'pl-0'"
148
- >
149
- <motion.div
150
- v-for="tool in toolCalls"
151
- :key="`${tool.toolCallId}-${JSON.stringify(tool.args)}`"
152
- :initial="{ opacity: 0, x: -4 }"
153
- :animate="{ opacity: 1, x: 0 }"
154
- :transition="{ duration: 0.15 }"
155
- class="flex items-center gap-1.5"
156
- >
157
- <span class="size-1 rounded-full bg-current opacity-40" />
158
- <span class="text-[11px] text-dimmed truncate max-w-[200px]">
159
- {{ getToolLabel(tool.toolName, tool.args) }}
160
- </span>
161
- </motion.div>
162
- </div>
163
- </div>
164
- </template>
@@ -1,92 +0,0 @@
1
- <script setup lang="ts">
2
- interface Props {
3
- size?: number
4
- dotSize?: number
5
- gap?: number
6
- }
7
-
8
- const props = withDefaults(defineProps<Props>(), {
9
- size: 4,
10
- dotSize: 2,
11
- gap: 2,
12
- })
13
-
14
- const totalDots = computed(() => props.size * props.size)
15
- const activeDots = ref<Set<number>>(new Set())
16
-
17
- // Patterns for 4x4 grid (indices 0-15)
18
- // Grid layout:
19
- // 0 1 2 3
20
- // 4 5 6 7
21
- // 8 9 10 11
22
- // 12 13 14 15
23
- const patterns = [
24
- // Spiral inward
25
- [[0], [1], [2], [3], [7], [11], [15], [14], [13], [12], [8], [4], [5], [6], [10], [9]],
26
- // Wave horizontal
27
- [[0, 4, 8, 12], [1, 5, 9, 13], [2, 6, 10, 14], [3, 7, 11, 15]],
28
- // Diamond pulse
29
- [[5, 6, 9, 10], [1, 4, 7, 8, 11, 14], [0, 3, 12, 15], [1, 4, 7, 8, 11, 14], [5, 6, 9, 10]],
30
- // Loading bar
31
- [[0, 1, 2, 3], [4, 5, 6, 7], [8, 9, 10, 11], [12, 13, 14, 15]],
32
- // Corners rotate
33
- [[0], [3], [15], [12]],
34
- // Cross pulse
35
- [[5, 6, 9, 10], [1, 2, 4, 7, 8, 11, 13, 14], [0, 3, 12, 15]],
36
- // Snake
37
- [[0], [1], [2], [3], [7], [6], [5], [4], [8], [9], [10], [11], [15], [14], [13], [12]],
38
- // Diagonal wave
39
- [[0], [1, 4], [2, 5, 8], [3, 6, 9, 12], [7, 10, 13], [11, 14], [15]],
40
- ]
41
-
42
- let patternIndex = 0
43
- let stepIndex = 0
44
- let interval: ReturnType<typeof setInterval> | null = null
45
-
46
- function nextStep() {
47
- const pattern = patterns[patternIndex]
48
- if (!pattern) return
49
-
50
- activeDots.value = new Set(pattern[stepIndex])
51
- stepIndex++
52
-
53
- if (stepIndex >= pattern.length) {
54
- stepIndex = 0
55
- patternIndex = (patternIndex + 1) % patterns.length
56
- }
57
- }
58
-
59
- const gridStyle = computed(() => ({
60
- display: 'grid',
61
- gridTemplateColumns: `repeat(${props.size}, 1fr)`,
62
- gap: `${props.gap}px`,
63
- width: `${props.size * props.dotSize + (props.size - 1) * props.gap}px`,
64
- height: `${props.size * props.dotSize + (props.size - 1) * props.gap}px`,
65
- }))
66
-
67
- const dotStyle = computed(() => ({
68
- width: `${props.dotSize}px`,
69
- height: `${props.dotSize}px`,
70
- }))
71
-
72
- onMounted(() => {
73
- interval = setInterval(nextStep, 120)
74
- nextStep()
75
- })
76
-
77
- onUnmounted(() => {
78
- if (interval) clearInterval(interval)
79
- })
80
- </script>
81
-
82
- <template>
83
- <div :style="gridStyle">
84
- <span
85
- v-for="i in totalDots"
86
- :key="i"
87
- class="rounded-[0.5px] bg-current transition-opacity duration-100"
88
- :class="activeDots.has(i - 1) ? 'opacity-100' : 'opacity-20'"
89
- :style="dotStyle"
90
- />
91
- </div>
92
- </template>