@vite-hub/docs 0.3.1 → 0.5.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 +179 -19
- package/dist/{agent-copy-BJp_Yf5d.js → agent-copy-xPaWye_g.js} +1 -1
- package/dist/assistant-pages-CqNlHsx-.js +37 -0
- package/dist/{assistant-shared-Dll_F_yy.d.ts → assistant-shared-CWIKRtBv.d.ts} +3 -2
- package/dist/{assistant-shared-CdtXowot.js → assistant-shared-DhiLHKSl.js} +23 -7
- package/dist/assistant-worker.d.ts +1 -1
- package/dist/assistant-worker.js +1 -1
- package/dist/assistant.d.ts +1 -1
- package/dist/assistant.js +1 -1
- package/dist/{content-9CINWiRf.js → content-BQVlMshL.js} +57 -47
- package/dist/{draft-DUBx--r9.js → draft-CSsTYSeb.js} +2 -2
- package/dist/error-diagnostics-CmgtG9xa.js +157 -0
- package/dist/files-UY4h1_36.js +38 -0
- package/dist/index.d.ts +7 -6
- package/dist/index.js +4 -4
- package/dist/link-checker-redirects.js +1 -1
- package/dist/{manifest-Dzp5-_AJ.d.ts → manifest-Drbdw1us.d.ts} +9 -3
- package/dist/{manifest-D66AEF8F.js → manifest-DvECmwX-.js} +101 -51
- package/dist/{markdown-Cn9-4oVG.js → markdown-1M1FbjCw.js} +1 -1
- package/dist/{page-Dx2JD3y1.d.ts → markdown-BiKrT08O.d.ts} +2 -25
- package/dist/navigation.d.ts +10 -5
- package/dist/navigation.js +23 -10
- package/dist/{nuxt-B5LrERKc.d.ts → nuxt-8O2OB_hI.d.ts} +84 -7
- package/dist/nuxt.d.ts +2 -2
- package/dist/nuxt.js +1699 -105
- package/dist/{page-BbmSfZO8.js → page-Bb0TfRKi.js} +21 -4
- package/dist/page-BryUCmYf.d.ts +26 -0
- package/dist/primitive-rail.d.ts +2 -5
- package/dist/primitive-rail.js +8 -6
- package/dist/{raw-C03EUJKw.js → raw-BChwipz_.js} +6 -0
- package/dist/redirects-BJj58IsY.js +87 -0
- package/dist/runnable.d.ts +37 -0
- package/dist/runnable.js +105 -0
- package/dist/runtime/app/components/DocsAsideLeftBody.vue +2 -8
- package/dist/runtime/app/components/DocsLearn.vue +215 -0
- package/dist/runtime/app/components/DocsLearnCodePre.vue +98 -0
- package/dist/runtime/app/components/DocsLearnFile.vue +21 -0
- package/dist/runtime/app/components/DocsPage.vue +11 -5
- package/dist/runtime/app/components/DocsPlayground.vue +117 -0
- package/dist/runtime/app/components/content/Example.vue +18 -49
- package/dist/runtime/app/components/content/McpClient.vue +170 -0
- package/dist/runtime/app/components/content/McpInstall.vue +238 -0
- package/dist/runtime/app/components/content/PageList.vue +1 -5
- package/dist/runtime/app/layouts/docs.vue +36 -8
- package/dist/runtime/app/middleware/docs-layout.ts +2 -2
- package/dist/runtime/app/utils/docs-learn.ts +31 -0
- package/dist/runtime/app/utils/docs-playground.ts +3 -0
- package/dist/runtime/server/llms.js +1 -1
- package/dist/runtime/server/markdown.d.ts +0 -5
- package/dist/runtime/server/markdown.js +10 -1
- package/dist/runtime/server/mcp.js +1 -1
- package/dist/runtime/server/page.d.ts +1 -1
- package/dist/runtime/server/page.js +3 -3
- package/dist/runtime/server/raw.js +2 -9
- package/dist/runtime/server/search.d.ts +1 -1
- package/dist/runtime/server/search.js +3 -2
- package/dist/runtime/server/sitemap.js +1 -1
- package/dist/{schema-DwpXW0VZ.js → schema-DcWZ3Q3M.js} +97 -5
- package/dist/server.d.ts +3 -2
- package/dist/server.js +4 -4
- package/dist/snapshot-worker.mjs +40 -0
- package/dist/steps-DBlkJwtD.d.ts +105 -0
- package/dist/steps-DF-11dJn.js +32 -0
- package/dist/{types-BhG6vGfG.d.ts → types-CHU_fy9l.d.ts} +69 -4
- package/package.json +18 -11
- package/dist/error-diagnostics-BoOsP6Y4.js +0 -53
- package/dist/redirects-BrbWFSzW.js +0 -62
|
@@ -0,0 +1,170 @@
|
|
|
1
|
+
<script setup lang="ts">
|
|
2
|
+
// `:::mcp-client{label icon method}` inside `::mcp-install`: the setup of one client. Its Markdown is the steps,
|
|
3
|
+
// usually a numbered list, which shows as numbered circles. `install` adds the client's one-click install link,
|
|
4
|
+
// and `note` adds a footer line.
|
|
5
|
+
import { docsMcpInstallLinks } from "#docs/navigation"
|
|
6
|
+
|
|
7
|
+
const props = defineProps<{
|
|
8
|
+
label: string
|
|
9
|
+
icon?: string
|
|
10
|
+
/** How the server gets into this client, such as "Terminal" or "Settings". */
|
|
11
|
+
method?: string
|
|
12
|
+
/** A client with a one-click install link from the site's MCP config. */
|
|
13
|
+
install?: "cursor" | "vscode"
|
|
14
|
+
note?: string
|
|
15
|
+
}>()
|
|
16
|
+
|
|
17
|
+
const { mcp, site } = useDocsConfig()
|
|
18
|
+
const installUrl = computed(() => props.install && mcp ? docsMcpInstallLinks(mcp)[props.install] : undefined)
|
|
19
|
+
</script>
|
|
20
|
+
|
|
21
|
+
<template>
|
|
22
|
+
<article class="vh-mcp-guide" :aria-label="`${label} setup`">
|
|
23
|
+
<header class="vh-mcp-guide-header">
|
|
24
|
+
<span class="vh-mcp-guide-logo"><UIcon :name="icon ?? 'i-lucide-plug'" aria-hidden="true" /></span>
|
|
25
|
+
<div class="vh-mcp-guide-title">
|
|
26
|
+
<h3>Add the {{ site.name }} MCP to {{ label }}</h3>
|
|
27
|
+
<p v-if="method">{{ method }}</p>
|
|
28
|
+
</div>
|
|
29
|
+
<UButton
|
|
30
|
+
v-if="installUrl"
|
|
31
|
+
:to="installUrl"
|
|
32
|
+
external
|
|
33
|
+
size="sm"
|
|
34
|
+
variant="outline"
|
|
35
|
+
color="neutral"
|
|
36
|
+
trailing-icon="i-lucide-arrow-up-right"
|
|
37
|
+
:label="`Add to ${label}`"
|
|
38
|
+
/>
|
|
39
|
+
</header>
|
|
40
|
+
<div class="vh-mcp-guide-body">
|
|
41
|
+
<slot />
|
|
42
|
+
</div>
|
|
43
|
+
<footer v-if="note" class="vh-mcp-guide-note">{{ note }}</footer>
|
|
44
|
+
</article>
|
|
45
|
+
</template>
|
|
46
|
+
|
|
47
|
+
<style scoped>
|
|
48
|
+
.vh-mcp-guide {
|
|
49
|
+
overflow: hidden;
|
|
50
|
+
border: 1px solid var(--ui-border);
|
|
51
|
+
border-radius: calc(var(--ui-radius) * 3);
|
|
52
|
+
background: var(--ui-bg);
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
.vh-mcp-guide-header {
|
|
56
|
+
display: flex;
|
|
57
|
+
flex-wrap: wrap;
|
|
58
|
+
align-items: center;
|
|
59
|
+
gap: 0.75rem;
|
|
60
|
+
padding: 0.75rem 1rem;
|
|
61
|
+
border-bottom: 1px solid var(--ui-border);
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
.vh-mcp-guide-logo {
|
|
65
|
+
display: flex;
|
|
66
|
+
flex-shrink: 0;
|
|
67
|
+
align-items: center;
|
|
68
|
+
justify-content: center;
|
|
69
|
+
width: 2.25rem;
|
|
70
|
+
height: 2.25rem;
|
|
71
|
+
border: 1px solid var(--ui-border);
|
|
72
|
+
border-radius: calc(var(--ui-radius) * 2);
|
|
73
|
+
font-size: 1.25rem;
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
.vh-mcp-guide-title {
|
|
77
|
+
flex: 1 1 10rem;
|
|
78
|
+
min-width: 0;
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
.vh-mcp-guide-title h3 {
|
|
82
|
+
margin: 0;
|
|
83
|
+
font-size: 0.875rem;
|
|
84
|
+
font-weight: 500;
|
|
85
|
+
line-height: 1.25rem;
|
|
86
|
+
color: var(--ui-text-highlighted);
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
.vh-mcp-guide-title p {
|
|
90
|
+
margin: 0;
|
|
91
|
+
font-size: 0.75rem;
|
|
92
|
+
line-height: 1rem;
|
|
93
|
+
color: var(--ui-text-muted);
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
.vh-mcp-guide-body {
|
|
97
|
+
padding: 1rem;
|
|
98
|
+
font-size: 0.875rem;
|
|
99
|
+
line-height: 1.375rem;
|
|
100
|
+
color: var(--ui-text-muted);
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
.vh-mcp-guide-body :deep(> :first-child) {
|
|
104
|
+
margin-top: 0;
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
.vh-mcp-guide-body :deep(> :last-child) {
|
|
108
|
+
margin-bottom: 0;
|
|
109
|
+
}
|
|
110
|
+
|
|
111
|
+
.vh-mcp-guide-body :deep(p) {
|
|
112
|
+
margin-block: 0.5rem;
|
|
113
|
+
}
|
|
114
|
+
|
|
115
|
+
.vh-mcp-guide-body :deep(code:not(pre code)) {
|
|
116
|
+
color: var(--ui-text-highlighted);
|
|
117
|
+
}
|
|
118
|
+
|
|
119
|
+
/* Numbered steps: each item gets its number in a circle, like a setup guide. */
|
|
120
|
+
.vh-mcp-guide-body :deep(ol) {
|
|
121
|
+
display: grid;
|
|
122
|
+
gap: 0.875rem;
|
|
123
|
+
margin: 0;
|
|
124
|
+
padding: 0;
|
|
125
|
+
list-style: none;
|
|
126
|
+
counter-reset: vh-mcp-step;
|
|
127
|
+
}
|
|
128
|
+
|
|
129
|
+
.vh-mcp-guide-body :deep(ol > li) {
|
|
130
|
+
position: relative;
|
|
131
|
+
min-width: 0;
|
|
132
|
+
margin: 0;
|
|
133
|
+
padding-left: 2.25rem;
|
|
134
|
+
counter-increment: vh-mcp-step;
|
|
135
|
+
}
|
|
136
|
+
|
|
137
|
+
.vh-mcp-guide-body :deep(ol > li)::before {
|
|
138
|
+
content: counter(vh-mcp-step);
|
|
139
|
+
position: absolute;
|
|
140
|
+
top: -0.0625rem;
|
|
141
|
+
left: 0;
|
|
142
|
+
display: flex;
|
|
143
|
+
align-items: center;
|
|
144
|
+
justify-content: center;
|
|
145
|
+
width: 1.5rem;
|
|
146
|
+
height: 1.5rem;
|
|
147
|
+
border: 1px solid var(--ui-border);
|
|
148
|
+
border-radius: 999px;
|
|
149
|
+
font-size: 0.75rem;
|
|
150
|
+
font-variant-numeric: tabular-nums;
|
|
151
|
+
color: var(--ui-text-toned);
|
|
152
|
+
}
|
|
153
|
+
|
|
154
|
+
.vh-mcp-guide-body :deep(ol > li > p:first-child) {
|
|
155
|
+
margin-top: 0;
|
|
156
|
+
}
|
|
157
|
+
|
|
158
|
+
.vh-mcp-guide-body :deep(li .code-block-wrapper) {
|
|
159
|
+
margin-block: 0.5rem 0;
|
|
160
|
+
}
|
|
161
|
+
|
|
162
|
+
.vh-mcp-guide-note {
|
|
163
|
+
padding: 0.75rem 1rem;
|
|
164
|
+
border-top: 1px solid var(--ui-border);
|
|
165
|
+
background: var(--ui-bg-muted);
|
|
166
|
+
font-size: 0.75rem;
|
|
167
|
+
line-height: 1.25rem;
|
|
168
|
+
color: var(--ui-text-muted);
|
|
169
|
+
}
|
|
170
|
+
</style>
|
|
@@ -0,0 +1,238 @@
|
|
|
1
|
+
<script setup lang="ts">
|
|
2
|
+
// `::mcp-install` connects a reader's agent to the docs MCP server. The Client tab lists one `:::mcp-client` per
|
|
3
|
+
// client as a row of logos, and shows the steps of the client the reader picks. The Prompt, MCP URL, and Command tabs
|
|
4
|
+
// come from the site's `mcp` config, so they always name the real server. Raw Markdown keeps every client's steps.
|
|
5
|
+
import { CopyButton } from "@vite-hub/ui"
|
|
6
|
+
import type { VNode } from "vue"
|
|
7
|
+
|
|
8
|
+
const slots = defineSlots<{ default?: () => VNode[] }>()
|
|
9
|
+
const { mcp, site } = useDocsConfig()
|
|
10
|
+
|
|
11
|
+
const tabs = [
|
|
12
|
+
{ value: "client", label: "Client", slot: "client" },
|
|
13
|
+
{ value: "prompt", label: "Prompt", slot: "prompt" },
|
|
14
|
+
{ value: "url", label: "MCP URL", slot: "url" },
|
|
15
|
+
{ value: "command", label: "Command", slot: "command" },
|
|
16
|
+
]
|
|
17
|
+
const tab = ref("client")
|
|
18
|
+
|
|
19
|
+
// Comark wraps children in fragments. A client is any node with a `label` prop.
|
|
20
|
+
function clientNodes(nodes: VNode[]): VNode[] {
|
|
21
|
+
return nodes.flatMap(node => typeof node.type === "symbol" && Array.isArray(node.children)
|
|
22
|
+
? clientNodes(node.children as VNode[])
|
|
23
|
+
: typeof node.props?.label === "string" ? [node] : [])
|
|
24
|
+
}
|
|
25
|
+
const clients = computed(() => clientNodes(slots.default?.() ?? []).map(node => ({
|
|
26
|
+
node,
|
|
27
|
+
label: String(node.props!.label),
|
|
28
|
+
icon: typeof node.props?.icon === "string" ? node.props.icon : "i-lucide-plug",
|
|
29
|
+
})))
|
|
30
|
+
|
|
31
|
+
const storageKey = "vh-mcp-client"
|
|
32
|
+
const selected = ref("")
|
|
33
|
+
const current = computed(() => clients.value.find(client => client.label === selected.value)?.label ?? clients.value[0]?.label)
|
|
34
|
+
function choose(label: string) {
|
|
35
|
+
selected.value = label
|
|
36
|
+
try { localStorage.setItem(storageKey, label) }
|
|
37
|
+
catch { /* Private mode: the choice lasts for this page. */ }
|
|
38
|
+
}
|
|
39
|
+
onMounted(() => {
|
|
40
|
+
try { selected.value = localStorage.getItem(storageKey) ?? "" }
|
|
41
|
+
catch { /* Storage is off: keep the first client. */ }
|
|
42
|
+
})
|
|
43
|
+
|
|
44
|
+
const prompt = computed(() => mcp
|
|
45
|
+
? `Add the ${site.name} MCP server to this agent. Name it ${mcp.name} and use Streamable HTTP at ${mcp.url}. Then list its tools to confirm it works.`
|
|
46
|
+
: "")
|
|
47
|
+
const command = computed(() => mcp ? `npx add-mcp ${mcp.url} --name ${mcp.name}` : "")
|
|
48
|
+
</script>
|
|
49
|
+
|
|
50
|
+
<template>
|
|
51
|
+
<div v-if="mcp" class="vh-mcp not-prose">
|
|
52
|
+
<UTabs v-model="tab" :items="tabs" class="vh-mcp-tabs" aria-label="Setup method">
|
|
53
|
+
<template #client>
|
|
54
|
+
<div class="vh-mcp-clients" role="group" aria-label="Choose your client">
|
|
55
|
+
<button
|
|
56
|
+
v-for="client in clients"
|
|
57
|
+
:key="client.label"
|
|
58
|
+
type="button"
|
|
59
|
+
class="vh-mcp-client"
|
|
60
|
+
:aria-pressed="current === client.label"
|
|
61
|
+
@click="choose(client.label)"
|
|
62
|
+
>
|
|
63
|
+
<span class="vh-mcp-client-logo"><UIcon :name="client.icon" aria-hidden="true" /></span>
|
|
64
|
+
<span class="vh-mcp-client-name">{{ client.label }}</span>
|
|
65
|
+
</button>
|
|
66
|
+
</div>
|
|
67
|
+
<div v-for="client in clients" v-show="current === client.label" :key="client.label">
|
|
68
|
+
<component :is="client.node" />
|
|
69
|
+
</div>
|
|
70
|
+
</template>
|
|
71
|
+
|
|
72
|
+
<template #prompt>
|
|
73
|
+
<p class="vh-mcp-hint">Send this to your agent. It adds the server for you.</p>
|
|
74
|
+
<p class="vh-mcp-prompt">{{ prompt }}</p>
|
|
75
|
+
<CopyButton :value="prompt" label="Copy prompt" variant="solid" size="sm" />
|
|
76
|
+
</template>
|
|
77
|
+
|
|
78
|
+
<template #url>
|
|
79
|
+
<p class="vh-mcp-hint">Add a Streamable HTTP MCP server named <code>{{ mcp.name }}</code> with this URL.</p>
|
|
80
|
+
<div class="vh-mcp-field">
|
|
81
|
+
<code>{{ mcp.url }}</code>
|
|
82
|
+
<CopyButton :value="mcp.url" label="Copy" size="sm" variant="outline" />
|
|
83
|
+
</div>
|
|
84
|
+
</template>
|
|
85
|
+
|
|
86
|
+
<template #command>
|
|
87
|
+
<p class="vh-mcp-hint">Run this in your project, then pick the agents to add the server to. Add <code>-g</code> to add it for every project.</p>
|
|
88
|
+
<DocsCodePre :code="command" language="bash" filename="Terminal">{{ command }}</DocsCodePre>
|
|
89
|
+
</template>
|
|
90
|
+
</UTabs>
|
|
91
|
+
</div>
|
|
92
|
+
</template>
|
|
93
|
+
|
|
94
|
+
<style scoped>
|
|
95
|
+
.vh-mcp {
|
|
96
|
+
margin-block: 1.25rem 1.75rem;
|
|
97
|
+
container-type: inline-size;
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
.vh-mcp-tabs {
|
|
101
|
+
margin-bottom: 1rem;
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
.vh-mcp-clients {
|
|
105
|
+
display: flex;
|
|
106
|
+
flex-wrap: wrap;
|
|
107
|
+
gap: 0.375rem;
|
|
108
|
+
margin-bottom: 0.875rem;
|
|
109
|
+
}
|
|
110
|
+
|
|
111
|
+
/* Narrow: a row of chips. Wide: a grid of logo tiles, like a launcher. */
|
|
112
|
+
.vh-mcp-client {
|
|
113
|
+
display: flex;
|
|
114
|
+
align-items: center;
|
|
115
|
+
gap: 0.5rem;
|
|
116
|
+
min-height: 2.75rem;
|
|
117
|
+
padding: 0.25rem 0.75rem 0.25rem 0.25rem;
|
|
118
|
+
border: 1px solid var(--ui-border);
|
|
119
|
+
border-radius: calc(var(--ui-radius) * 2);
|
|
120
|
+
font-size: 0.8125rem;
|
|
121
|
+
line-height: 1rem;
|
|
122
|
+
color: var(--ui-text-muted);
|
|
123
|
+
cursor: pointer;
|
|
124
|
+
transition: background-color 150ms ease, color 150ms ease, border-color 150ms ease;
|
|
125
|
+
}
|
|
126
|
+
|
|
127
|
+
.vh-mcp-client-logo {
|
|
128
|
+
display: flex;
|
|
129
|
+
flex-shrink: 0;
|
|
130
|
+
align-items: center;
|
|
131
|
+
justify-content: center;
|
|
132
|
+
width: 1.75rem;
|
|
133
|
+
height: 1.75rem;
|
|
134
|
+
border: 1px solid var(--ui-border);
|
|
135
|
+
border-radius: calc(var(--ui-radius) * 1.5);
|
|
136
|
+
background: var(--ui-bg);
|
|
137
|
+
font-size: 1rem;
|
|
138
|
+
}
|
|
139
|
+
|
|
140
|
+
.vh-mcp-client-name {
|
|
141
|
+
overflow: hidden;
|
|
142
|
+
text-overflow: ellipsis;
|
|
143
|
+
white-space: nowrap;
|
|
144
|
+
}
|
|
145
|
+
|
|
146
|
+
@media (hover: hover) {
|
|
147
|
+
.vh-mcp-client:hover {
|
|
148
|
+
background: var(--ui-bg-elevated);
|
|
149
|
+
color: var(--ui-text-highlighted);
|
|
150
|
+
}
|
|
151
|
+
}
|
|
152
|
+
|
|
153
|
+
.vh-mcp-client[aria-pressed="true"] {
|
|
154
|
+
border-color: var(--ui-border-accented);
|
|
155
|
+
background: var(--ui-bg-elevated);
|
|
156
|
+
color: var(--ui-text-highlighted);
|
|
157
|
+
}
|
|
158
|
+
|
|
159
|
+
@container (min-width: 34rem) {
|
|
160
|
+
.vh-mcp-clients {
|
|
161
|
+
display: grid;
|
|
162
|
+
grid-template-columns: repeat(auto-fit, minmax(4.75rem, 1fr));
|
|
163
|
+
}
|
|
164
|
+
|
|
165
|
+
.vh-mcp-client {
|
|
166
|
+
flex-direction: column;
|
|
167
|
+
gap: 0.375rem;
|
|
168
|
+
padding: 0.625rem 0.25rem 0.5rem;
|
|
169
|
+
font-size: 0.75rem;
|
|
170
|
+
}
|
|
171
|
+
|
|
172
|
+
.vh-mcp-client:not([aria-pressed="true"]) {
|
|
173
|
+
border-color: transparent;
|
|
174
|
+
}
|
|
175
|
+
|
|
176
|
+
.vh-mcp-client-logo {
|
|
177
|
+
width: 2rem;
|
|
178
|
+
height: 2rem;
|
|
179
|
+
font-size: 1.125rem;
|
|
180
|
+
}
|
|
181
|
+
|
|
182
|
+
.vh-mcp-client-name {
|
|
183
|
+
width: 100%;
|
|
184
|
+
text-align: center;
|
|
185
|
+
}
|
|
186
|
+
}
|
|
187
|
+
|
|
188
|
+
.vh-mcp-hint {
|
|
189
|
+
margin-bottom: 0.75rem;
|
|
190
|
+
font-size: 0.8125rem;
|
|
191
|
+
line-height: 1.25rem;
|
|
192
|
+
color: var(--ui-text-muted);
|
|
193
|
+
}
|
|
194
|
+
|
|
195
|
+
.vh-mcp-hint code,
|
|
196
|
+
.vh-mcp-field code {
|
|
197
|
+
font-family: var(--font-mono, ui-monospace, monospace);
|
|
198
|
+
font-size: 0.8125rem;
|
|
199
|
+
color: var(--ui-text-highlighted);
|
|
200
|
+
}
|
|
201
|
+
|
|
202
|
+
.vh-mcp-prompt {
|
|
203
|
+
margin-bottom: 0.75rem;
|
|
204
|
+
padding: 1rem;
|
|
205
|
+
border: 1px solid var(--ui-border);
|
|
206
|
+
border-radius: calc(var(--ui-radius) * 2);
|
|
207
|
+
background: var(--ui-bg-elevated);
|
|
208
|
+
font-size: 0.875rem;
|
|
209
|
+
line-height: 1.5rem;
|
|
210
|
+
overflow-wrap: anywhere;
|
|
211
|
+
user-select: text;
|
|
212
|
+
}
|
|
213
|
+
|
|
214
|
+
.vh-mcp-field {
|
|
215
|
+
display: flex;
|
|
216
|
+
align-items: center;
|
|
217
|
+
gap: 0.5rem;
|
|
218
|
+
min-width: 0;
|
|
219
|
+
padding: 0.375rem 0.375rem 0.375rem 1rem;
|
|
220
|
+
border: 1px solid var(--ui-border);
|
|
221
|
+
border-radius: calc(var(--ui-radius) * 2);
|
|
222
|
+
}
|
|
223
|
+
|
|
224
|
+
.vh-mcp-field code {
|
|
225
|
+
flex: 1;
|
|
226
|
+
min-width: 0;
|
|
227
|
+
overflow: hidden;
|
|
228
|
+
text-overflow: ellipsis;
|
|
229
|
+
white-space: nowrap;
|
|
230
|
+
}
|
|
231
|
+
|
|
232
|
+
@media (prefers-reduced-motion: reduce) {
|
|
233
|
+
.vh-mcp-tab,
|
|
234
|
+
.vh-mcp-client {
|
|
235
|
+
transition: none;
|
|
236
|
+
}
|
|
237
|
+
}
|
|
238
|
+
</style>
|
|
@@ -186,7 +186,7 @@ const groups = computed(() => {
|
|
|
186
186
|
.vh-page-list-arrow {
|
|
187
187
|
flex: none;
|
|
188
188
|
color: var(--ui-text-dimmed);
|
|
189
|
-
transition:
|
|
189
|
+
transition: color 150ms ease;
|
|
190
190
|
}
|
|
191
191
|
|
|
192
192
|
@media (hover: hover) {
|
|
@@ -198,9 +198,5 @@ const groups = computed(() => {
|
|
|
198
198
|
.vh-page-list-link:hover .vh-page-list-arrow {
|
|
199
199
|
color: var(--ui-text-highlighted);
|
|
200
200
|
}
|
|
201
|
-
|
|
202
|
-
.vh-page-list-link:hover .vh-page-list-arrow {
|
|
203
|
-
transform: translateX(2px);
|
|
204
|
-
}
|
|
205
201
|
}
|
|
206
202
|
</style>
|
|
@@ -1,4 +1,6 @@
|
|
|
1
1
|
<script setup lang="ts">
|
|
2
|
+
import { isDocsWorkspaceLayout } from "#docs/navigation"
|
|
3
|
+
|
|
2
4
|
const { banner } = useDocsConfig()
|
|
3
5
|
const found = useDocsPage()
|
|
4
6
|
// A tutorial with a code panel uses the whole page column, half for prose and half for files.
|
|
@@ -6,6 +8,10 @@ const hasCodePanel = computed(() => found.value?.page.codePanel === true)
|
|
|
6
8
|
// Pages show the sidebar unless they set `sidebar: false`. A page with `sidebar: "collapsed"`, and a code panel tutorial,
|
|
7
9
|
// shows a narrow strip until the reader opens the sidebar.
|
|
8
10
|
const sidebar = useDocsSidebar()
|
|
11
|
+
// A `playground` or `learn` page, and an app page that sets `sidebar: "collapsed"` in its page meta, fill the viewport
|
|
12
|
+
// under the header. Markdown pages with a collapsed sidebar, and code panel tutorials, keep the window scroll.
|
|
13
|
+
const route = useRoute()
|
|
14
|
+
const fills = computed(() => isDocsWorkspaceLayout(found.value?.page.layout) || (sidebar.value.collapsible && route.meta.sidebar === "collapsed"))
|
|
9
15
|
|
|
10
16
|
// The sidebar sits on the left edge of the viewport on every docs page. The page content centers in the remaining space.
|
|
11
17
|
const docsShellUi = {
|
|
@@ -29,15 +35,20 @@ const docsShellUi = {
|
|
|
29
35
|
</UPageAside>
|
|
30
36
|
</template>
|
|
31
37
|
|
|
32
|
-
<!-- The
|
|
33
|
-
<div id="docs-content" tabindex="-1" class="
|
|
34
|
-
|
|
35
|
-
<!-- A page with a collapsible sidebar, such as a playground, fills the viewport, so it has no banner. -->
|
|
36
|
-
<div v-if="banner && !sidebar.collapsible" class="flex min-h-10 items-center justify-center border-b border-default bg-default px-4 py-2 text-center text-sm/5">
|
|
37
|
-
<span class="text-muted">{{ banner }}</span>
|
|
38
|
-
</div>
|
|
38
|
+
<!-- The window does not scroll. A page that is taller than the viewport, such as the playground intro on a phone, scrolls in here. -->
|
|
39
|
+
<div v-if="fills" id="docs-content" tabindex="-1" class="vh-docs-fill">
|
|
40
|
+
<slot />
|
|
39
41
|
</div>
|
|
40
|
-
<
|
|
42
|
+
<template v-else>
|
|
43
|
+
<!-- The banner spans the page column, so its border meets the sidebar and the right edge. -->
|
|
44
|
+
<div id="docs-content" tabindex="-1" class="relative">
|
|
45
|
+
<!-- 40px including the border, the same height as the sidebar search, so both bottom rules line up. It grows when the text wraps. -->
|
|
46
|
+
<div v-if="banner && !sidebar.collapsible" class="flex min-h-10 items-center justify-center border-b border-default bg-default px-4 py-2 text-center text-sm/5">
|
|
47
|
+
<span class="text-muted">{{ banner }}</span>
|
|
48
|
+
</div>
|
|
49
|
+
</div>
|
|
50
|
+
<slot />
|
|
51
|
+
</template>
|
|
41
52
|
</UPage>
|
|
42
53
|
</UMain>
|
|
43
54
|
</DocsAppShell>
|
|
@@ -63,6 +74,16 @@ const docsShellUi = {
|
|
|
63
74
|
transform: none;
|
|
64
75
|
}
|
|
65
76
|
|
|
77
|
+
/* One cell as tall as the viewport under the header. The root of the page is exactly that size, so `height: 100%` inside it
|
|
78
|
+
fills the viewport. Content that is taller scrolls in here. */
|
|
79
|
+
.vh-docs-fill {
|
|
80
|
+
display: grid;
|
|
81
|
+
height: calc(100dvh - var(--ui-header-height));
|
|
82
|
+
grid-template-columns: minmax(0, 1fr);
|
|
83
|
+
grid-template-rows: minmax(0, 1fr);
|
|
84
|
+
overflow: auto;
|
|
85
|
+
}
|
|
86
|
+
|
|
66
87
|
@media (min-width: 64rem) {
|
|
67
88
|
/* Beside a tutorial the navigation is a short page list, so its panel is narrower and the prose and code keep the width. */
|
|
68
89
|
/* The sum is set again here, because a custom property resolves its calc() where it is declared. */
|
|
@@ -102,3 +123,10 @@ const docsShellUi = {
|
|
|
102
123
|
}
|
|
103
124
|
|
|
104
125
|
</style>
|
|
126
|
+
|
|
127
|
+
<style>
|
|
128
|
+
/* The fill column scrolls instead of the window. */
|
|
129
|
+
:root:has(.vh-docs-fill) {
|
|
130
|
+
overflow: hidden;
|
|
131
|
+
}
|
|
132
|
+
</style>
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { defineNuxtRouteMiddleware, isDocsStartLink, navigateTo, useDocsConfig, useRuntimeConfig } from "#imports"
|
|
2
2
|
import manifest from "#docs/manifest"
|
|
3
3
|
import panels from "#docs/panels"
|
|
4
|
-
import { docsAppPath, docsSectionForPath, findDocsPage, loadDocsPanels } from "#docs/navigation"
|
|
4
|
+
import { docsAppPath, docsSectionForPath, findDocsPage, isDocsWorkspaceLayout, loadDocsPanels } from "#docs/navigation"
|
|
5
5
|
import { articleLayout } from "#docs/shell"
|
|
6
6
|
|
|
7
7
|
// A docs page renders in the docs shell whichever app page serves its path. A page outside the docs base, such as
|
|
@@ -12,7 +12,7 @@ export default defineNuxtRouteMiddleware(async (to, from) => {
|
|
|
12
12
|
// The pages inside a panel load when the reader opens it, before anything reads the manifest for this route.
|
|
13
13
|
await loadDocsPanels(manifest, to.path, panels)
|
|
14
14
|
const found = findDocsPage(manifest, to.path)
|
|
15
|
-
if (found) to.meta.layout = found.page.layout !== "home" && (found.section || found.page.path === manifest.root?.path || isDocsStartLink(useDocsConfig(), to.path)) ? "docs" : articleLayout
|
|
15
|
+
if (found) to.meta.layout = isDocsWorkspaceLayout(found.page.layout) || (found.page.layout !== "home" && (found.section || found.page.path === manifest.root?.path || isDocsStartLink(useDocsConfig(), to.path))) ? "docs" : articleLayout
|
|
16
16
|
// A new page that exists only as a Content draft renders in the shell of its section.
|
|
17
17
|
else if (docsSectionForPath(manifest, to.path)) to.meta.layout = "docs"
|
|
18
18
|
// No docs page and no app page answers the path, but the host may: a static app copied into the output, such as a
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import type { InjectionKey } from "vue"
|
|
2
|
+
import type { Node as ComarkNode } from "comark"
|
|
3
|
+
|
|
4
|
+
export interface DocsLearnActions {
|
|
5
|
+
available: boolean
|
|
6
|
+
running: boolean
|
|
7
|
+
paths: readonly string[]
|
|
8
|
+
show: (path: string) => void
|
|
9
|
+
run: (command: string) => Promise<string>
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
export const docsLearnActionsKey: InjectionKey<DocsLearnActions> = Symbol("docs-learn-actions")
|
|
13
|
+
|
|
14
|
+
export function docsLearnGuideNodes(nodes: readonly ComarkNode[], paths: ReadonlySet<string>): ComarkNode[] {
|
|
15
|
+
const link = (node: ComarkNode): ComarkNode => {
|
|
16
|
+
if (typeof node === "string" || node[0] === null || node[0] === "pre") return node
|
|
17
|
+
const [tag, attributes, ...children] = node
|
|
18
|
+
if (tag === "code" && children.length === 1 && typeof children[0] === "string" && paths.has(children[0])) {
|
|
19
|
+
return ["docs-learn-file", { path: children[0] }, node]
|
|
20
|
+
}
|
|
21
|
+
return [tag, attributes, ...children.map(link)]
|
|
22
|
+
}
|
|
23
|
+
return nodes.map(link)
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
export function docsLearnStepNodes(step: ComarkNode | undefined): ComarkNode[] {
|
|
27
|
+
if (!step || typeof step === "string" || step[0] === null) return []
|
|
28
|
+
const [, , ...children] = step
|
|
29
|
+
const [first, ...rest] = children
|
|
30
|
+
return first !== undefined && typeof first !== "string" && first[0] === "h2" ? rest : children
|
|
31
|
+
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { n as docsContent } from "../../content-
|
|
1
|
+
import { n as docsContent } from "../../content-BQVlMshL.js";
|
|
2
2
|
import { defineContentLlmsHandler } from "@vite-hub/content";
|
|
3
3
|
//#region src/runtime/server/llms.ts
|
|
4
4
|
/** `/llms.txt`, `/llms-full.txt`, and `/sitemap.md`, from Content. The build prerenders them. */
|
|
@@ -1,10 +1,5 @@
|
|
|
1
1
|
import { ContentMiddleware } from "@vite-hub/content/markdown";
|
|
2
2
|
//#region src/runtime/server/markdown.d.ts
|
|
3
|
-
/**
|
|
4
|
-
* The Markdown copy of each app page that is not a docs page, at its URL plus `.md` and for `Accept: text/markdown`.
|
|
5
|
-
* Content converts the HTML that Nitro renders for the same request. nuxt-agent-discovery answers the docs pages first.
|
|
6
|
-
* Content loads on the first request that asks for Markdown or gets an HTML page.
|
|
7
|
-
*/
|
|
8
3
|
declare const handler: ContentMiddleware;
|
|
9
4
|
//#endregion
|
|
10
5
|
export { handler as default };
|
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
import { docsAppPath } from "../../navigation.js";
|
|
2
|
+
import { useRuntimeConfig } from "nitro/runtime-config";
|
|
1
3
|
import { defineContentMarkdownHandler } from "@vite-hub/content/markdown";
|
|
2
4
|
import { serverFetch } from "nitro";
|
|
3
5
|
//#region src/runtime/server/markdown.ts
|
|
@@ -6,6 +8,13 @@ import { serverFetch } from "nitro";
|
|
|
6
8
|
* Content converts the HTML that Nitro renders for the same request. nuxt-agent-discovery answers the docs pages first.
|
|
7
9
|
* Content loads on the first request that asks for Markdown or gets an HTML page.
|
|
8
10
|
*/
|
|
9
|
-
const
|
|
11
|
+
const markdown = defineContentMarkdownHandler(() => import("../../content-BQVlMshL.js").then((n) => n.t).then((module) => module.docsMarkdownContent()), { render: (request) => serverFetch(request) });
|
|
12
|
+
const rawMarkdown = defineContentMarkdownHandler(() => import("../../content-BQVlMshL.js").then((n) => n.t).then((module) => module.docsMarkdownContent(true)));
|
|
13
|
+
const handler = async (event, next) => {
|
|
14
|
+
const path = new URL(event.req.url).pathname;
|
|
15
|
+
const raw = docsAppPath("/raw/", useRuntimeConfig().public.docs.appBase);
|
|
16
|
+
if (path.startsWith(raw) && path.endsWith(".md")) return await rawMarkdown(event, next);
|
|
17
|
+
return await markdown(event, next);
|
|
18
|
+
};
|
|
10
19
|
//#endregion
|
|
11
20
|
export { handler as default };
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { n as docsContent } from "../../content-
|
|
1
|
+
import { n as docsContent } from "../../content-BQVlMshL.js";
|
|
2
2
|
import { defineContentMcpHandler } from "@vite-hub/content";
|
|
3
3
|
//#region 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-BryUCmYf.js";
|
|
2
2
|
import { EventHandler, EventHandlerRequest } from "nitro/h3";
|
|
3
3
|
//#region src/runtime/server/page.d.ts
|
|
4
4
|
/** `/api/_docs/page/docs/kv.json` is the page at `/docs/kv`. The `.json` suffix lets static hosts store every page beside its folder. */
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { a as parseDocsDocument, r as readDocsPage } from "../../content-
|
|
1
|
+
import { a as parseDocsDocument, r as readDocsPage } from "../../content-BQVlMshL.js";
|
|
2
2
|
import { findDocsPage } from "../../navigation.js";
|
|
3
|
-
import { i as docsPageResponse } from "../../page-
|
|
3
|
+
import { i as docsPageResponse } from "../../page-Bb0TfRKi.js";
|
|
4
4
|
import manifest from "#docs/manifest";
|
|
5
5
|
import { HTTPError, defineHandler, getRouterParam } from "nitro/h3";
|
|
6
6
|
import { content } from "#docs/content";
|
|
@@ -9,7 +9,7 @@ import { content } from "#docs/content";
|
|
|
9
9
|
const handler = defineHandler(async (event) => {
|
|
10
10
|
const path = `/${(getRouterParam(event, "_") ?? "").replace(/\.json$/, "")}`;
|
|
11
11
|
if (content && (content.preview.active() || content.preview.frame())) {
|
|
12
|
-
const { docsDraftResponse } = await import("../../draft-
|
|
12
|
+
const { docsDraftResponse } = await import("../../draft-CSsTYSeb.js");
|
|
13
13
|
const draft = await docsDraftResponse(content, manifest, path, parseDocsDocument);
|
|
14
14
|
if (draft) {
|
|
15
15
|
event.res.headers.set("cache-control", "private, no-store");
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { i as readDocsRawCopy } from "../../content-
|
|
1
|
+
import { i as readDocsRawCopy } from "../../content-BQVlMshL.js";
|
|
2
2
|
import { HTTPError, defineHandler } from "nitro/h3";
|
|
3
3
|
//#region src/runtime/server/raw.ts
|
|
4
4
|
/**
|
|
@@ -7,14 +7,7 @@ import { HTTPError, defineHandler } from "nitro/h3";
|
|
|
7
7
|
* fetch the copy inside the server, from this route.
|
|
8
8
|
*/
|
|
9
9
|
const handler = defineHandler(async (event) => {
|
|
10
|
-
|
|
11
|
-
try {
|
|
12
|
-
path = decodeURIComponent(event.url.pathname);
|
|
13
|
-
} catch {
|
|
14
|
-
throw HTTPError.status(404, "Page not found");
|
|
15
|
-
}
|
|
16
|
-
const index = path.indexOf("/raw/");
|
|
17
|
-
const markdown = index < 0 || !path.endsWith(".md") ? null : await readDocsRawCopy(path.slice(index));
|
|
10
|
+
const markdown = await readDocsRawCopy(new URL(event.req.url).pathname);
|
|
18
11
|
if (markdown === null) throw HTTPError.status(404, "Page not found");
|
|
19
12
|
event.res.headers.set("content-type", "text/markdown; charset=utf-8");
|
|
20
13
|
return markdown;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { a as DocsSearchSection } from "../../types-CHU_fy9l.js";
|
|
2
2
|
import { EventHandler, EventHandlerRequest } from "nitro/h3";
|
|
3
3
|
//#region src/runtime/server/search.d.ts
|
|
4
4
|
declare const handler: EventHandler<EventHandlerRequest, Promise<DocsSearchSection[]>>;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { r as readDocsPage } from "../../content-
|
|
1
|
+
import { r as readDocsPage } from "../../content-BQVlMshL.js";
|
|
2
2
|
import { docsIndexedPages, docsManifestPages, docsUnindexedSearchSections } from "../../navigation.js";
|
|
3
|
-
import { a as docsSearchSections } from "../../markdown-
|
|
3
|
+
import { a as docsSearchSections } from "../../markdown-1M1FbjCw.js";
|
|
4
4
|
import manifest from "#docs/manifest";
|
|
5
5
|
import { defineHandler } from "nitro/h3";
|
|
6
6
|
//#region src/runtime/server/search.ts
|
|
@@ -8,6 +8,7 @@ import { defineHandler } from "nitro/h3";
|
|
|
8
8
|
async function buildIndex() {
|
|
9
9
|
const sections = [];
|
|
10
10
|
for (const page of docsIndexedPages(manifest)) {
|
|
11
|
+
if (!page.navigation) continue;
|
|
11
12
|
const document = await readDocsPage(page);
|
|
12
13
|
if (!document) continue;
|
|
13
14
|
const [entry, ...headings] = docsSearchSections(page.path, page.sourceTitle, document.nodes);
|