@vite-hub/docs 0.6.1 → 0.7.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.
- package/README.md +3 -3
- package/dist/agent-copy-DTCo8cLy.js +48 -0
- package/dist/{content-C_WXjV3y.js → content-Chgcvz1q.js} +2 -2
- package/dist/index.d.ts +5 -5
- package/dist/{manifest-Bti_WxDZ.js → manifest-CQMreQZ5.js} +3 -3
- package/dist/{manifest-DJ2DyNue.d.ts → manifest-DmITPRKL.d.ts} +1 -1
- package/dist/{markdown-B97RuMXs.d.ts → markdown-Ul8Z9B5A.d.ts} +1 -1
- package/dist/navigation.d.ts +6 -1
- package/dist/navigation.js +21 -4
- package/dist/{nuxt-CPt71DeE.d.ts → nuxt-B0kdfz6P.d.ts} +8 -3
- package/dist/nuxt.d.ts +1 -1
- package/dist/nuxt.js +38 -19
- package/dist/{page-B8_70-5D.d.ts → page-Cp7sifcg.d.ts} +2 -2
- package/dist/primitive-rail.d.ts +1 -1
- package/dist/primitive-rail.js +3 -2
- package/dist/{raw-CQukuLuj.js → raw-Dh38kL9g.js} +1 -0
- package/dist/runnable.d.ts +2 -2
- package/dist/runtime/app/assistant/DocsAssistantPanel.vue +9 -5
- package/dist/runtime/app/components/AppHeader.vue +3 -9
- package/dist/runtime/app/components/DocsAsideLeftTop.vue +4 -10
- package/dist/runtime/app/components/DocsLearn.vue +9 -8
- package/dist/runtime/app/components/DocsLearnCodePre.vue +9 -20
- package/dist/runtime/app/components/DocsPageHeaderLinks.vue +1 -3
- package/dist/runtime/app/components/DocsPlayground.vue +3 -3
- package/dist/runtime/app/components/DocsRail.vue +14 -30
- package/dist/runtime/app/components/DocsRailTooltip.vue +18 -0
- package/dist/runtime/app/components/DocsSidebarStrip.vue +3 -7
- package/dist/runtime/app/components/DocsSidebars.vue +2 -1
- package/dist/runtime/app/components/content/CopyPrompt.vue +72 -0
- package/dist/runtime/app/components/content/Example.vue +2 -1
- package/dist/runtime/app/composables/docs.ts +11 -24
- package/dist/runtime/app/layouts/docs.vue +7 -0
- package/dist/runtime/app/plugins/vitehub-ui.ts +22 -0
- package/dist/runtime/server/llms.js +1 -1
- package/dist/runtime/server/markdown.js +2 -2
- package/dist/runtime/server/mcp.js +1 -1
- package/dist/runtime/server/page.d.ts +1 -1
- package/dist/runtime/server/page.js +1 -1
- package/dist/runtime/server/raw.js +1 -1
- package/dist/runtime/server/search.d.ts +1 -1
- package/dist/runtime/server/search.js +3 -3
- package/dist/runtime/server/sitemap.js +1 -1
- package/dist/runtime/theme/design.css +15 -0
- package/dist/server.d.ts +3 -3
- package/dist/server.js +2 -2
- package/dist/{steps-C3tGwhNK.d.ts → steps-DzSu3r8K.d.ts} +1 -1
- package/dist/{types-B6YlHil4.d.ts → types-Dl6yjlwV.d.ts} +2 -0
- package/package.json +14 -11
- package/dist/agent-copy-CY9_RkHN.js +0 -32
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
<script setup lang="ts">
|
|
2
|
+
import { Button } from "@ui-sdk/vue/button"
|
|
2
3
|
import { webContainer, Workspace, type WorkspaceExample, type WorkspaceSlotProps, type WorkspaceStep } from "@vite-hub/ui/workspace"
|
|
3
4
|
import { fetchSnapshot } from "@vite-hub/web-container"
|
|
4
5
|
import { docsAppPath } from "#docs/navigation"
|
|
@@ -133,7 +134,7 @@ const guideComponents = { pre: DocsLearnCodePre, DocsLearnFile }
|
|
|
133
134
|
</script>
|
|
134
135
|
|
|
135
136
|
<template>
|
|
136
|
-
<div class="vh-docs-workspace" :data-path="response.page.path">
|
|
137
|
+
<div class="vh-docs-workspace ui-sdk" :data-path="response.page.path">
|
|
137
138
|
<Workspace
|
|
138
139
|
v-model:open="open"
|
|
139
140
|
v-model:selected="selected"
|
|
@@ -151,20 +152,20 @@ const guideComponents = { pre: DocsLearnCodePre, DocsLearnFile }
|
|
|
151
152
|
<p v-if="tutorial.page !== response.page.path" class="mb-4 text-sm text-muted">
|
|
152
153
|
<NuxtLink :to="tutorial.page" class="hover:text-highlighted">Read in the docs</NuxtLink>
|
|
153
154
|
</p>
|
|
154
|
-
<
|
|
155
|
+
<div class="docs-content docs-tutorial-content">
|
|
155
156
|
<DocsMarkdown :key="step" :document="{ nodes: guideNodes, toc: [] }" :components="guideComponents" />
|
|
156
|
-
</
|
|
157
|
+
</div>
|
|
157
158
|
</template>
|
|
158
159
|
|
|
159
160
|
<template #bar-actions="{ guard }">
|
|
160
|
-
<
|
|
161
|
+
<Button data-variant="outline" data-size="sm" @click="solve(guard)"><Icon name="i-lucide-wand-sparkles" data-slot="leadingIcon" /><span data-slot="label">Solve</span></Button>
|
|
161
162
|
</template>
|
|
162
163
|
|
|
163
164
|
<template v-if="pendingStep !== undefined" #banner>
|
|
164
165
|
<div class="vh-docs-learn-bar" role="status">
|
|
165
166
|
<span class="min-w-0 flex-1">You changed {{ edited.length === 1 ? "1 file" : `${edited.length} files` }}. Step {{ pendingStep + 1 }} has its own version.</span>
|
|
166
|
-
<
|
|
167
|
-
<
|
|
167
|
+
<Button data-variant="outline" data-size="xs" @click="loadPending"><span data-slot="label">Load step {{ pendingStep + 1 }}</span></Button>
|
|
168
|
+
<Button data-variant="ghost" data-size="xs" @click="keepMine"><span data-slot="label">Keep mine</span></Button>
|
|
168
169
|
</div>
|
|
169
170
|
</template>
|
|
170
171
|
|
|
@@ -175,9 +176,9 @@ const guideComponents = { pre: DocsLearnCodePre, DocsLearnFile }
|
|
|
175
176
|
|
|
176
177
|
<!-- Without the workspace, such as on a phone, the page is the whole lesson. -->
|
|
177
178
|
<template #fallback>
|
|
178
|
-
<
|
|
179
|
+
<div class="docs-content docs-tutorial-content mt-8">
|
|
179
180
|
<DocsMarkdown :document="lessonDocument" />
|
|
180
|
-
</
|
|
181
|
+
</div>
|
|
181
182
|
</template>
|
|
182
183
|
</Workspace>
|
|
183
184
|
</div>
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
<script setup lang="ts">
|
|
2
|
+
import { Button } from "@ui-sdk/vue/button"
|
|
2
3
|
import { parseCurl } from "#docs/runnable"
|
|
3
4
|
import { docsLearnActionsKey } from "../utils/docs-learn"
|
|
4
5
|
|
|
@@ -38,27 +39,15 @@ async function run() {
|
|
|
38
39
|
<template>
|
|
39
40
|
<div ref="root" class="vh-docs-learn-code">
|
|
40
41
|
<DocsCodePre v-bind="props"><slot /></DocsCodePre>
|
|
41
|
-
<
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
variant="ghost"
|
|
46
|
-
color="neutral"
|
|
47
|
-
icon="i-lucide-file-code"
|
|
48
|
-
label="Show in editor"
|
|
49
|
-
@click="actions?.show(filename!)"
|
|
50
|
-
/>
|
|
42
|
+
<Button v-if="isFile" class="vh-docs-learn-code-action" data-variant="ghost" data-size="xs" @click="actions?.show(filename!)">
|
|
43
|
+
<Icon name="i-lucide-file-code" data-slot="leadingIcon" />
|
|
44
|
+
<span data-slot="label">Show in editor</span>
|
|
45
|
+
</Button>
|
|
51
46
|
<div v-if="isRequest" class="vh-docs-learn-run">
|
|
52
|
-
<
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
icon="i-lucide-play"
|
|
57
|
-
:label="pending ? 'Running' : 'Run in workspace'"
|
|
58
|
-
:loading="pending"
|
|
59
|
-
:disabled="!actions?.running || pending"
|
|
60
|
-
@click="run"
|
|
61
|
-
/>
|
|
47
|
+
<Button data-variant="outline" data-size="xs" :disabled="!actions?.running || pending" :aria-busy="pending || undefined" @click="run">
|
|
48
|
+
<Icon :name="pending ? 'i-lucide-loader-circle' : 'i-lucide-play'" :data-slot="pending ? 'spinner' : 'leadingIcon'" />
|
|
49
|
+
<span data-slot="label">{{ pending ? "Running" : "Run in workspace" }}</span>
|
|
50
|
+
</Button>
|
|
62
51
|
<span v-if="!actions?.running" class="text-xs text-muted">Available when the dev server runs.</span>
|
|
63
52
|
</div>
|
|
64
53
|
<pre v-if="output !== undefined" class="vh-docs-learn-output" aria-live="polite"><code>{{ output }}</code></pre>
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
<script setup lang="ts">
|
|
2
|
-
// Page actions: the Markdown twin of the page, chat tools that read it, and the docs MCP server.
|
|
3
2
|
import { CopyButton, useCopy } from "@vite-hub/ui"
|
|
4
3
|
import { docsMarkdownLinks, docsMcpInstallLinks, findDocsPage } from "#docs/navigation"
|
|
5
4
|
|
|
@@ -19,7 +18,6 @@ function openPendingMenu(event: MouseEvent | KeyboardEvent) {
|
|
|
19
18
|
}
|
|
20
19
|
else if (event.button !== 0 || event.ctrlKey) return
|
|
21
20
|
|
|
22
|
-
// Keep the first activation while the async menu loads. Updating its open prop also starts hydration before idle.
|
|
23
21
|
event.preventDefault()
|
|
24
22
|
event.stopPropagation()
|
|
25
23
|
menuOpen.value = true
|
|
@@ -68,7 +66,7 @@ const items = computed(() => {
|
|
|
68
66
|
<template>
|
|
69
67
|
<!-- `contents` keeps the group a direct flex item of the page header. -->
|
|
70
68
|
<div v-if="links" class="contents">
|
|
71
|
-
<UFieldGroup size="sm" @click.capture="openPendingMenu" @keydown.capture="openPendingMenu">
|
|
69
|
+
<UFieldGroup data-field-group size="sm" @click.capture="openPendingMenu" @keydown.capture="openPendingMenu">
|
|
72
70
|
<CopyButton
|
|
73
71
|
:value="pageMarkdown"
|
|
74
72
|
label="Copy page"
|
|
@@ -48,7 +48,7 @@ function exampleHref(id: string) {
|
|
|
48
48
|
</script>
|
|
49
49
|
|
|
50
50
|
<template>
|
|
51
|
-
<div class="vh-docs-workspace" :data-path="page.path">
|
|
51
|
+
<div class="vh-docs-workspace ui-sdk" :data-path="page.path">
|
|
52
52
|
<Workspace
|
|
53
53
|
v-model:open="open"
|
|
54
54
|
:examples="examples"
|
|
@@ -71,9 +71,9 @@ function exampleHref(id: string) {
|
|
|
71
71
|
|
|
72
72
|
<!-- Without the workspace, such as on a phone, the page shows its own text and the examples. -->
|
|
73
73
|
<template #fallback>
|
|
74
|
-
<
|
|
74
|
+
<div class="docs-content mt-8">
|
|
75
75
|
<DocsMarkdown :document="response.document" />
|
|
76
|
-
</
|
|
76
|
+
</div>
|
|
77
77
|
<h2 class="mt-10 text-lg font-semibold text-highlighted">Examples</h2>
|
|
78
78
|
<ul class="vh-docs-playground-list">
|
|
79
79
|
<li v-for="item in examples" :key="item.id">
|
|
@@ -1,20 +1,14 @@
|
|
|
1
1
|
<script setup lang="ts">
|
|
2
2
|
import { PrimitiveRail, PrimitiveRailGroup, PrimitiveRailItem, resolvePrimitiveIconName } from "#docs/primitive-rail"
|
|
3
3
|
import { NuxtLink } from "#components"
|
|
4
|
-
import {
|
|
4
|
+
import { docsPanelOf, docsRailEntries, docsRailTarget, docsStartPage, normalizeDocsPath } from "#docs/navigation"
|
|
5
5
|
|
|
6
6
|
import type { ComponentPublicInstance } from "vue"
|
|
7
7
|
import type { DocsAppPage, DocsRailEntry, DocsSection } from "@vite-hub/docs"
|
|
8
8
|
|
|
9
9
|
defineProps<{
|
|
10
|
-
/** Shows every label, with no tooltips. Touch has no hover to expand the rail. */
|
|
11
10
|
labeled?: boolean
|
|
12
|
-
/** Shows the brand at the top, for the sidebar of wide screens, which have no site header beside it. */
|
|
13
11
|
brand?: boolean
|
|
14
|
-
/**
|
|
15
|
-
* Shows a button under the brand that opens or collapses the sidebar, on a page with a collapsible sidebar. Collapsed,
|
|
16
|
-
* the rail is the whole sidebar, so it also shows search and the site links.
|
|
17
|
-
*/
|
|
18
12
|
toggle?: "show" | "hide"
|
|
19
13
|
}>()
|
|
20
14
|
|
|
@@ -24,32 +18,25 @@ const search = reactive(useContentSearch())
|
|
|
24
18
|
onMounted(focusMounted)
|
|
25
19
|
const currentSection = useDocsSection()
|
|
26
20
|
const icons = useDocsIcons()
|
|
27
|
-
// One rail group for each catalog category. Sections without a category stay reachable in a last group. The sections
|
|
28
|
-
// of a docs group share one item, which opens the first of them.
|
|
29
|
-
// A section icon from the ViteHub set (`i-vitehub-kv`, or `kv` in the `rail` option) renders inline, so it can move on
|
|
30
|
-
// hover. Any other Iconify icon renders through UIcon.
|
|
31
21
|
const groups = docsRailEntries(useDocsManifest(), { categories, railExclude, groups: docsGroups }).map(entries => entries.map((entry) => {
|
|
32
22
|
const icon = entry.icon ?? icons.rail(entry.sections[0]!)
|
|
33
23
|
return { entry, icon, railIcon: resolvePrimitiveIconName(icon) ?? null }
|
|
34
24
|
}))
|
|
35
25
|
const route = useRoute()
|
|
36
|
-
// Inside a panel, such as the diagnostics of one section, each rail item opens the same panel of its own section.
|
|
37
26
|
const currentPanel = computed(() => {
|
|
38
27
|
const section = currentSection.value
|
|
39
28
|
const page = section?.pages.find(candidate => candidate.path === normalizeDocsPath(route.path))
|
|
40
29
|
return section && page ? docsPanelOf(section, page) : null
|
|
41
30
|
})
|
|
42
|
-
// The item of the start section opens the start link that leads it, such as an Introduction outside every section.
|
|
43
31
|
const startPage = docsStartPage(useDocsManifest(), start)
|
|
44
32
|
function target(entry: DocsRailEntry<DocsAppPage>) {
|
|
45
33
|
const opensStart = startPage && !currentPanel.value && entry.sections.some(section => section.id === start?.section)
|
|
46
34
|
return opensStart ? startPage : docsRailTarget(entry.sections[0]!, currentPanel.value)
|
|
47
35
|
}
|
|
48
36
|
const brandLabel = site.badge ? `${site.name} ${site.badge.label}` : site.name
|
|
49
|
-
const
|
|
37
|
+
const brandLink = useDocsBrandLink()
|
|
50
38
|
const currentEntry = computed(() => groups.flat().find(({ entry }) => entry.sections.some(section => section.id === currentSection.value?.id)))
|
|
51
39
|
|
|
52
|
-
// A section that the rail leaves out, such as a shared reference topic, marks the start section.
|
|
53
40
|
function isCurrent(section: DocsSection<DocsAppPage>) {
|
|
54
41
|
const current = currentSection.value
|
|
55
42
|
if (!current) return false
|
|
@@ -60,12 +47,10 @@ function isCurrentEntry(entry: DocsRailEntry<DocsAppPage>) {
|
|
|
60
47
|
return entry.sections.some(isCurrent)
|
|
61
48
|
}
|
|
62
49
|
|
|
63
|
-
// The sidebar link is the current page, so the rail marks its section with aria-current="true", not "page".
|
|
64
50
|
function ariaCurrent(entry: DocsRailEntry<DocsAppPage>) {
|
|
65
51
|
return isCurrentEntry(entry) ? "true" : undefined
|
|
66
52
|
}
|
|
67
53
|
|
|
68
|
-
// The rail hides its scrollbar. A fade at the clipped edge shows that more items are above or below.
|
|
69
54
|
const rail = useTemplateRef<ComponentPublicInstance>("rail")
|
|
70
55
|
let railBody: HTMLElement | null = null
|
|
71
56
|
let resize: ResizeObserver | undefined
|
|
@@ -91,20 +76,19 @@ onBeforeUnmount(() => {
|
|
|
91
76
|
</script>
|
|
92
77
|
|
|
93
78
|
<template>
|
|
94
|
-
<!-- The expanded rail shows each label, so the tooltips turn off while it is open. -->
|
|
95
79
|
<PrimitiveRail ref="rail" :label="`${site.name} navigation`" class="vh-docs-rail" :class="{ 'vh-docs-rail-labeled': labeled }">
|
|
96
|
-
<!-- Like the header brand
|
|
80
|
+
<!-- Like the header brand, it opens the home page. -->
|
|
97
81
|
<template v-if="brand || toggle" #header="{ expanded }">
|
|
98
|
-
<
|
|
82
|
+
<DocsRailTooltip
|
|
99
83
|
v-if="brand"
|
|
100
84
|
:text="site.badge?.tooltip || brandLabel"
|
|
101
85
|
:content="{ side: 'right', sideOffset: 6 }"
|
|
102
86
|
:delay-duration="150"
|
|
103
|
-
:
|
|
87
|
+
:suspended="expanded && !site.badge?.tooltip"
|
|
104
88
|
ignore-non-keyboard-focus
|
|
105
89
|
:ui="{ content: 'h-auto max-w-64 whitespace-normal px-3 py-2 text-left leading-5' }"
|
|
106
90
|
>
|
|
107
|
-
<PrimitiveRailItem :as="NuxtLink"
|
|
91
|
+
<PrimitiveRailItem :as="NuxtLink" v-bind="brandLink" :label="brandLabel" class="vh-docs-rail-brand">
|
|
108
92
|
<DocsBrandMark v-if="site.logo" />
|
|
109
93
|
<span v-else class="vh-docs-rail-brand-initial">{{ site.name.charAt(0) }}</span>
|
|
110
94
|
<template #label>
|
|
@@ -112,9 +96,9 @@ onBeforeUnmount(() => {
|
|
|
112
96
|
<span v-if="site.badge" class="vh-docs-rail-brand-badge">{{ site.badge.label }}</span>
|
|
113
97
|
</template>
|
|
114
98
|
</PrimitiveRailItem>
|
|
115
|
-
</
|
|
99
|
+
</DocsRailTooltip>
|
|
116
100
|
<!-- The open and collapsed sidebars put this button in the same place, so the pointer can toggle in place. -->
|
|
117
|
-
<
|
|
101
|
+
<DocsRailTooltip v-if="toggle" :text="toggle === 'show' ? 'Show navigation' : 'Hide navigation'" :content="{ side: 'right', sideOffset: 6 }" :delay-duration="150" :suspended="expanded" ignore-non-keyboard-focus>
|
|
118
102
|
<PrimitiveRailItem
|
|
119
103
|
:id="docsSidebarToggleIds[toggle]"
|
|
120
104
|
as="button"
|
|
@@ -124,22 +108,22 @@ onBeforeUnmount(() => {
|
|
|
124
108
|
>
|
|
125
109
|
<UIcon :name="toggle === 'show' ? 'i-lucide-panel-left-open' : 'i-lucide-panel-left-close'" class="size-4" />
|
|
126
110
|
</PrimitiveRailItem>
|
|
127
|
-
</
|
|
128
|
-
<
|
|
111
|
+
</DocsRailTooltip>
|
|
112
|
+
<DocsRailTooltip v-if="toggle === 'show'" text="Search docs" :content="{ side: 'right', sideOffset: 6 }" :delay-duration="150" :suspended="expanded">
|
|
129
113
|
<PrimitiveRailItem as="button" type="button" label="Search docs" @click="search.open = true">
|
|
130
114
|
<UIcon name="i-lucide-search" class="size-4" />
|
|
131
115
|
</PrimitiveRailItem>
|
|
132
|
-
</
|
|
116
|
+
</DocsRailTooltip>
|
|
133
117
|
</template>
|
|
134
118
|
<template #default="{ expanded }">
|
|
135
119
|
<PrimitiveRailGroup v-for="(items, index) in groups" :key="index">
|
|
136
|
-
<
|
|
120
|
+
<DocsRailTooltip
|
|
137
121
|
v-for="{ entry, icon, railIcon } in items"
|
|
138
122
|
:key="entry.sections[0]!.id"
|
|
139
123
|
:text="entry.title"
|
|
140
124
|
:content="{ side: 'right', sideOffset: 6 }"
|
|
141
125
|
:delay-duration="150"
|
|
142
|
-
:
|
|
126
|
+
:suspended="expanded || !!labeled"
|
|
143
127
|
>
|
|
144
128
|
<PrimitiveRailItem
|
|
145
129
|
v-if="railIcon"
|
|
@@ -153,7 +137,7 @@ onBeforeUnmount(() => {
|
|
|
153
137
|
<PrimitiveRailItem v-else :as="NuxtLink" :to="target(entry)" :current="isCurrentEntry(entry)" :aria-current="ariaCurrent(entry)" :label="entry.title">
|
|
154
138
|
<UIcon :name="icon" class="size-4" />
|
|
155
139
|
</PrimitiveRailItem>
|
|
156
|
-
</
|
|
140
|
+
</DocsRailTooltip>
|
|
157
141
|
</PrimitiveRailGroup>
|
|
158
142
|
</template>
|
|
159
143
|
<template v-if="toggle === 'show'" #footer>
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
<script setup lang="ts">
|
|
2
|
+
const props = defineProps<{ suspended: boolean }>()
|
|
3
|
+
const open = ref(false)
|
|
4
|
+
|
|
5
|
+
watch(() => props.suspended, (suspended) => {
|
|
6
|
+
if (suspended) open.value = false
|
|
7
|
+
})
|
|
8
|
+
|
|
9
|
+
function updateOpen(next: boolean) {
|
|
10
|
+
open.value = !props.suspended && next
|
|
11
|
+
}
|
|
12
|
+
</script>
|
|
13
|
+
|
|
14
|
+
<template>
|
|
15
|
+
<UTooltip :disabled="false" :open="!suspended && open" @update:open="updateOpen">
|
|
16
|
+
<slot />
|
|
17
|
+
</UTooltip>
|
|
18
|
+
</template>
|
|
@@ -1,10 +1,6 @@
|
|
|
1
1
|
<script setup lang="ts">
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
// A collapsed sidebar of a site without the rail: the brand, a button that opens the sidebar, search, and the site
|
|
5
|
-
// links, in one narrow column. The open sidebar has its collapse button in the same place.
|
|
6
|
-
const { site, start } = useDocsConfig()
|
|
7
|
-
const docsHome = docsHomePath(useDocsManifest(), start)
|
|
2
|
+
const { site } = useDocsConfig()
|
|
3
|
+
const brandLink = useDocsBrandLink()
|
|
8
4
|
const brandLabel = site.badge ? `${site.name} ${site.badge.label}` : site.name
|
|
9
5
|
const { toggle, focusMounted } = useDocsSidebarToggle()
|
|
10
6
|
onMounted(focusMounted)
|
|
@@ -13,7 +9,7 @@ onMounted(focusMounted)
|
|
|
13
9
|
<template>
|
|
14
10
|
<nav class="vh-docs-strip" :aria-label="`${site.name} navigation`">
|
|
15
11
|
<UTooltip :text="brandLabel" :content="{ side: 'right', sideOffset: 6 }" :delay-duration="150">
|
|
16
|
-
<NuxtLink
|
|
12
|
+
<NuxtLink v-bind="brandLink" class="vh-docs-strip-brand" data-focus-inset :aria-label="brandLabel">
|
|
17
13
|
<DocsBrandMark v-if="site.logo" />
|
|
18
14
|
<span v-else class="vh-docs-strip-initial">{{ site.name.charAt(0) }}</span>
|
|
19
15
|
</NuxtLink>
|
|
@@ -21,7 +21,8 @@ const rail = docsHasRail(useDocsManifest(), config.icons, config.groups, config)
|
|
|
21
21
|
</script>
|
|
22
22
|
|
|
23
23
|
<template>
|
|
24
|
-
|
|
24
|
+
<!-- Navigation is pressed many times in a row, so its links and buttons stay still under the press squash. -->
|
|
25
|
+
<div class="vh-docs-sidebars" data-motion-press="none" :data-docs-sidebar-head="head && (panel || collapsible) ? '' : undefined">
|
|
25
26
|
<DocsRail v-if="rail" :labeled="labeled" :brand="head" :toggle="collapsible ? (panel ? 'hide' : 'show') : undefined" />
|
|
26
27
|
<DocsSidebarStrip v-else-if="collapsible && !panel" />
|
|
27
28
|
<div v-if="panel" class="vh-docs-panel" :class="{ 'is-single': !rail, 'has-head': head }">
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
<script setup lang="ts">
|
|
2
|
+
import { CopyButton } from "@vite-hub/ui"
|
|
3
|
+
|
|
4
|
+
const text = useTemplateRef<HTMLElement>("text")
|
|
5
|
+
function markdown(node: Node): string {
|
|
6
|
+
if (node instanceof HTMLElement && node.tagName === "CODE") return `\`${node.textContent ?? ""}\``
|
|
7
|
+
if (node.nodeType === Node.TEXT_NODE) return node.textContent ?? ""
|
|
8
|
+
return Array.from(node.childNodes, markdown).join("")
|
|
9
|
+
}
|
|
10
|
+
const prompt = () => text.value ? markdown(text.value).replace(/\s+/g, " ").trim() : ""
|
|
11
|
+
const hint = useId()
|
|
12
|
+
</script>
|
|
13
|
+
|
|
14
|
+
<template>
|
|
15
|
+
<div class="vh-copy-prompt not-prose">
|
|
16
|
+
<div ref="text" class="vh-copy-prompt-text">
|
|
17
|
+
<slot />
|
|
18
|
+
</div>
|
|
19
|
+
<div class="vh-copy-prompt-actions">
|
|
20
|
+
<CopyButton :value="prompt" label="Copy prompt" copied-label="Copied" variant="outline" size="sm" :aria-describedby="hint" />
|
|
21
|
+
<span :id="hint" class="vh-copy-prompt-hint">For your coding agent.</span>
|
|
22
|
+
</div>
|
|
23
|
+
</div>
|
|
24
|
+
</template>
|
|
25
|
+
|
|
26
|
+
<style scoped>
|
|
27
|
+
.vh-copy-prompt {
|
|
28
|
+
display: grid;
|
|
29
|
+
gap: 0.75rem;
|
|
30
|
+
margin-block: 1rem 1.5rem;
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
.vh-copy-prompt-text {
|
|
34
|
+
padding: 0.75rem 1rem;
|
|
35
|
+
border-radius: calc(var(--ui-radius) * 2);
|
|
36
|
+
background: var(--ui-bg-elevated);
|
|
37
|
+
font-size: 0.875rem;
|
|
38
|
+
line-height: 1.5rem;
|
|
39
|
+
color: var(--ui-text-highlighted);
|
|
40
|
+
text-wrap: pretty;
|
|
41
|
+
overflow-wrap: anywhere;
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
.vh-copy-prompt-text :deep(p) {
|
|
45
|
+
margin: 0;
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
.vh-copy-prompt-text :deep(a) {
|
|
49
|
+
color: inherit;
|
|
50
|
+
text-decoration: underline;
|
|
51
|
+
text-decoration-color: var(--ui-border-accented);
|
|
52
|
+
text-underline-offset: 0.2em;
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
.vh-copy-prompt-text :deep(code) {
|
|
56
|
+
font-family: var(--font-mono, ui-monospace, monospace);
|
|
57
|
+
font-size: 0.8125rem;
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
.vh-copy-prompt-actions {
|
|
61
|
+
display: flex;
|
|
62
|
+
flex-wrap: wrap;
|
|
63
|
+
align-items: center;
|
|
64
|
+
gap: 0.375rem 0.75rem;
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
.vh-copy-prompt-hint {
|
|
68
|
+
font-size: 0.75rem;
|
|
69
|
+
line-height: 1rem;
|
|
70
|
+
color: var(--ui-text-muted);
|
|
71
|
+
}
|
|
72
|
+
</style>
|
|
@@ -16,6 +16,7 @@ const props = defineProps<{
|
|
|
16
16
|
flush?: boolean
|
|
17
17
|
/** Show a Reset control that mounts a Vue example again with its first state. */
|
|
18
18
|
reset?: boolean
|
|
19
|
+
kit?: boolean
|
|
19
20
|
}>()
|
|
20
21
|
|
|
21
22
|
// `::examples` passes its view in, so the next tab opens in the view the reader picked.
|
|
@@ -60,7 +61,7 @@ function onKeydown(event: KeyboardEvent) {
|
|
|
60
61
|
<div
|
|
61
62
|
v-if="live"
|
|
62
63
|
class="docs-example-preview vh-example-live"
|
|
63
|
-
:class="{ 'is-flush': flush }"
|
|
64
|
+
:class="{ 'is-flush': flush, 'ui-sdk': kit }"
|
|
64
65
|
:style="height ? { '--vh-example-height': `${height}rem` } : undefined"
|
|
65
66
|
>
|
|
66
67
|
<Suspense>
|
|
@@ -1,37 +1,38 @@
|
|
|
1
1
|
import { computed, type ComputedRef } from "vue"
|
|
2
|
-
import { useError, useRoute, useRuntimeConfig } from "#imports"
|
|
2
|
+
import { getRouteRules, useError, useRoute, useRouter, useRuntimeConfig } from "#imports"
|
|
3
3
|
import { useDocsSidebarExpanded } from "./tutorial"
|
|
4
4
|
import manifest from "#docs/manifest"
|
|
5
|
-
import { docsSectionForPath, docsSidebarCollapses, findDocsPage, normalizeDocsPath } from "#docs/navigation"
|
|
5
|
+
import { docsAppPath, docsHomePath, docsSectionForPath, docsSidebarCollapses, findDocsPage, normalizeDocsPath } from "#docs/navigation"
|
|
6
6
|
|
|
7
7
|
import type { DocsAppPage, DocsManifest, DocsPublicConfig, DocsSection } from "@vite-hub/docs"
|
|
8
8
|
|
|
9
|
-
/**
|
|
10
|
-
* Sections and pages of the site, computed from the content folder at build time. Each page has its `DocsAppPage`
|
|
11
|
-
* fields: navigation, title, description, and layout. The page route returns the rest, such as `seo` and `credits`.
|
|
12
|
-
*/
|
|
13
9
|
export function useDocsManifest(): DocsManifest<DocsAppPage> {
|
|
14
10
|
return manifest
|
|
15
11
|
}
|
|
16
12
|
|
|
17
|
-
/** The `docs` options of `nuxt.config`, as the app reads them. */
|
|
18
13
|
export function useDocsConfig(): DocsPublicConfig {
|
|
19
14
|
return useRuntimeConfig().public.docs
|
|
20
15
|
}
|
|
21
16
|
|
|
22
|
-
|
|
17
|
+
export function useDocsBrandLink() {
|
|
18
|
+
if (getRouteRules({ path: "/" }).redirect) return { to: docsAppPath("/", useRuntimeConfig().app.baseURL), external: true }
|
|
19
|
+
if (findDocsPage(manifest, "/")) return { to: "/" }
|
|
20
|
+
const router = useRouter()
|
|
21
|
+
const hasAppRoot = router.getRoutes().some(route => route.name !== "docs-page" && (route.path === "/" || route.path.startsWith("/:")))
|
|
22
|
+
&& router.resolve("/").matched.some(route => route.name !== "docs-page")
|
|
23
|
+
return { to: hasAppRoot ? "/" : docsHomePath(manifest, useDocsConfig().start) ?? "/" }
|
|
24
|
+
}
|
|
25
|
+
|
|
23
26
|
export function isDocsStartLink(config: DocsPublicConfig, path: string): boolean {
|
|
24
27
|
const normalized = normalizeDocsPath(path)
|
|
25
28
|
return (config.start?.links ?? []).some(link => link.to !== config.base && normalizeDocsPath(link.to) === normalized)
|
|
26
29
|
}
|
|
27
30
|
|
|
28
|
-
/** The docs page of the current route, or `null` on other pages. */
|
|
29
31
|
export function useDocsPage(): ComputedRef<{ page: DocsAppPage, section: DocsSection<DocsAppPage> | null } | null> {
|
|
30
32
|
const route = useRoute()
|
|
31
33
|
return computed(() => findDocsPage(manifest, route.path))
|
|
32
34
|
}
|
|
33
35
|
|
|
34
|
-
/** The section of the current route. A start link page resolves to the start section. */
|
|
35
36
|
export function useDocsSection(): ComputedRef<DocsSection<DocsAppPage> | null> {
|
|
36
37
|
const route = useRoute()
|
|
37
38
|
const config = useDocsConfig()
|
|
@@ -42,21 +43,11 @@ export function useDocsSection(): ComputedRef<DocsSection<DocsAppPage> | null> {
|
|
|
42
43
|
})
|
|
43
44
|
}
|
|
44
45
|
|
|
45
|
-
/**
|
|
46
|
-
* Whether the current route renders in the docs shell, whose sidebar carries the site navigation on wide screens. That
|
|
47
|
-
* is the `docs` layout: docs pages get it from the module's middleware, and an app page sets it itself. Any other
|
|
48
|
-
* page, such as a `home` page or an app page under a base of `/`, keeps the site header.
|
|
49
|
-
*/
|
|
50
46
|
export function useDocsShell(): ComputedRef<boolean> {
|
|
51
47
|
const route = useRoute()
|
|
52
48
|
return computed(() => route.meta.layout === "docs")
|
|
53
49
|
}
|
|
54
50
|
|
|
55
|
-
/**
|
|
56
|
-
* How the current route shows the sidebar on wide screens: `open`, `collapsed` to a strip whose button opens it, or
|
|
57
|
-
* `hidden`. A docs page sets it in its frontmatter and an app page in `definePageMeta({ layout: "docs", sidebar })`.
|
|
58
|
-
* Code panel tutorials start collapsed. Once the reader opens a collapsed sidebar, it stays open on every such page.
|
|
59
|
-
*/
|
|
60
51
|
export function useDocsSidebar(): ComputedRef<{ state: "open" | "collapsed" | "hidden", collapsible: boolean }> {
|
|
61
52
|
const shell = useDocsShell()
|
|
62
53
|
const found = useDocsPage()
|
|
@@ -73,10 +64,6 @@ export function useDocsSidebar(): ComputedRef<{ state: "open" | "collapsed" | "h
|
|
|
73
64
|
})
|
|
74
65
|
}
|
|
75
66
|
|
|
76
|
-
/**
|
|
77
|
-
* Whether the route shows the sidebar column, open or collapsed. On wide screens that column then carries the brand,
|
|
78
|
-
* search, and the site links, and the site header hides. A page with `sidebar: false` keeps the header.
|
|
79
|
-
*/
|
|
80
67
|
export function useDocsSidebarShown(): ComputedRef<boolean> {
|
|
81
68
|
const sidebar = useDocsSidebar()
|
|
82
69
|
return computed(() => sidebar.value.state !== "hidden")
|
|
@@ -114,6 +114,13 @@ const docsShellUi = {
|
|
|
114
114
|
border-right: 1px solid var(--ui-border);
|
|
115
115
|
}
|
|
116
116
|
|
|
117
|
+
/* The collapsed sidebar is the rail alone. On hover the rail expands over the page, so the aside does not clip it and
|
|
118
|
+
stays above the page. */
|
|
119
|
+
.vh-docs-shell.is-collapsed .vh-docs-aside {
|
|
120
|
+
z-index: 10;
|
|
121
|
+
overflow: visible;
|
|
122
|
+
}
|
|
123
|
+
|
|
117
124
|
/* The aside container is a flex column. Without a flex basis the sidebars shrink to the rail header and the panel loses its page list. */
|
|
118
125
|
.vh-docs-aside-sidebars {
|
|
119
126
|
min-height: 0;
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { defineNuxtPlugin } from "#imports"
|
|
2
|
+
import { type Component, defineAsyncComponent } from "vue"
|
|
3
|
+
|
|
4
|
+
function lazy(loader: () => Promise<{ default: Component }>): Component {
|
|
5
|
+
return defineAsyncComponent({ loader, suspensible: false })
|
|
6
|
+
}
|
|
7
|
+
|
|
8
|
+
export default defineNuxtPlugin((nuxtApp) => {
|
|
9
|
+
const components = {
|
|
10
|
+
UButton: lazy(() => import("@nuxt/ui/components/Button.vue")),
|
|
11
|
+
UDropdownMenu: lazy(() => import("@nuxt/ui/components/DropdownMenu.vue")),
|
|
12
|
+
UEditorDragHandle: lazy(() => import("@nuxt/ui/components/EditorDragHandle.vue")),
|
|
13
|
+
UEditorSuggestionMenu: lazy(() => import("@nuxt/ui/components/EditorSuggestionMenu.vue")),
|
|
14
|
+
UEditorToolbar: lazy(() => import("@nuxt/ui/components/EditorToolbar.vue")),
|
|
15
|
+
UIcon: lazy(() => import("@nuxt/ui/components/Icon.vue")),
|
|
16
|
+
UInput: lazy(() => import("@nuxt/ui/components/Input.vue")),
|
|
17
|
+
UModal: lazy(() => import("@nuxt/ui/components/Modal.vue")),
|
|
18
|
+
UTabs: lazy(() => import("@nuxt/ui/components/Tabs.vue")),
|
|
19
|
+
UTooltip: lazy(() => import("@nuxt/ui/components/Tooltip.vue")),
|
|
20
|
+
}
|
|
21
|
+
for (const [name, component] of Object.entries(components)) nuxtApp.vueApp.component(name, component)
|
|
22
|
+
})
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { n as docsContent } from "../../content-
|
|
1
|
+
import { n as docsContent } from "../../content-Chgcvz1q.js";
|
|
2
2
|
import { defineContentLlmsHandler } from "@vite-hub/content";
|
|
3
3
|
// src/runtime/server/llms.ts
|
|
4
4
|
/** `/llms.txt`, `/llms-full.txt`, and `/sitemap.md`, from Content. The build prerenders them. */
|
|
@@ -8,8 +8,8 @@ import { serverFetch } from "nitro";
|
|
|
8
8
|
* Content converts the HTML that Nitro renders for the same request. nuxt-agent-discovery answers the docs pages first.
|
|
9
9
|
* Content loads on the first request that asks for Markdown or gets an HTML page.
|
|
10
10
|
*/
|
|
11
|
-
const markdown = defineContentMarkdownHandler(() => import("../../content-
|
|
12
|
-
const rawMarkdown = defineContentMarkdownHandler(() => import("../../content-
|
|
11
|
+
const markdown = defineContentMarkdownHandler(() => import("../../content-Chgcvz1q.js").then((n) => n.t).then((module) => module.docsMarkdownContent()), { render: (request) => serverFetch(request) });
|
|
12
|
+
const rawMarkdown = defineContentMarkdownHandler(() => import("../../content-Chgcvz1q.js").then((n) => n.t).then((module) => module.docsMarkdownContent(true)));
|
|
13
13
|
const handler = async (event, next) => {
|
|
14
14
|
const path = new URL(event.req.url).pathname;
|
|
15
15
|
const raw = docsAppPath("/raw/", useRuntimeConfig().public.docs.appBase);
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { n as docsContent } from "../../content-
|
|
1
|
+
import { n as docsContent } from "../../content-Chgcvz1q.js";
|
|
2
2
|
import { defineContentMcpHandler } from "@vite-hub/content";
|
|
3
3
|
// src/runtime/server/mcp.ts
|
|
4
4
|
/** The docs MCP server at `/mcp`, with the `list-pages` and `get-page` tools of Content. */
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { n as DocsPageResponse } from "../../page-
|
|
1
|
+
import { n as DocsPageResponse } from "../../page-Cp7sifcg.js";
|
|
2
2
|
import { EventHandler, EventHandlerRequest } from "nitro/h3";
|
|
3
3
|
/** `/api/_docs/page/docs/kv.json` is the page at `/docs/kv`. The `.json` suffix lets static hosts store every page beside its folder. */
|
|
4
4
|
declare const handler: EventHandler<EventHandlerRequest, Promise<DocsPageResponse>>;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { a as parseDocsDocument, r as readDocsPage } from "../../content-
|
|
1
|
+
import { a as parseDocsDocument, r as readDocsPage } from "../../content-Chgcvz1q.js";
|
|
2
2
|
import { findDocsPage } from "../../navigation.js";
|
|
3
3
|
import { i as docsPageResponse } from "../../page-DWsretqk.js";
|
|
4
4
|
import manifest from "#docs/manifest";
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { a as DocsSearchSection } from "../../types-
|
|
1
|
+
import { a as DocsSearchSection } from "../../types-Dl6yjlwV.js";
|
|
2
2
|
import { EventHandler, EventHandlerRequest } from "nitro/h3";
|
|
3
3
|
declare const handler: EventHandler<EventHandlerRequest, Promise<DocsSearchSection[]>>;
|
|
4
4
|
export { handler as default };
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { docsIndexedPages, docsManifestPages, docsUnindexedSearchSections } from "../../navigation.js";
|
|
1
|
+
import { docsIndexedPages, docsManifestPages, docsPanelSearchSections, docsUnindexedSearchSections } from "../../navigation.js";
|
|
2
2
|
import { a as docsSearchSections } from "../../markdown-BzZkYb24.js";
|
|
3
|
-
import { r as readDocsPage } from "../../content-
|
|
3
|
+
import { r as readDocsPage } from "../../content-Chgcvz1q.js";
|
|
4
4
|
import manifest from "#docs/manifest";
|
|
5
5
|
import { defineHandler } from "nitro/h3";
|
|
6
6
|
// src/runtime/server/search.ts
|
|
@@ -19,7 +19,7 @@ async function buildIndex() {
|
|
|
19
19
|
}
|
|
20
20
|
sections.push(...docsUnindexedSearchSections(manifest));
|
|
21
21
|
const listed = new Set(docsManifestPages(manifest).filter((page) => page.navigation).map((page) => page.path));
|
|
22
|
-
return sections.filter((record) => listed.has(record.id.split("#")[0] ?? record.id));
|
|
22
|
+
return docsPanelSearchSections(manifest, sections.filter((record) => listed.has(record.id.split("#")[0] ?? record.id)));
|
|
23
23
|
}
|
|
24
24
|
let indexed;
|
|
25
25
|
const handler = defineHandler(() => {
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { docsCanonicalUrl } from "../../navigation.js";
|
|
2
|
-
import { n as docsContent } from "../../content-
|
|
2
|
+
import { n as docsContent } from "../../content-Chgcvz1q.js";
|
|
3
3
|
import { useRuntimeConfig } from "nitro/runtime-config";
|
|
4
4
|
import { defineHandler } from "nitro/h3";
|
|
5
5
|
// ../internal/dist/sitemap.js
|