@vite-hub/docs 0.0.0 → 0.4.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.
- package/LICENSE +201 -0
- package/README.md +456 -0
- package/dist/agent-copy-xPaWye_g.js +33 -0
- package/dist/assistant-pages-BN7hNsSZ.js +37 -0
- package/dist/assistant-shared-CWIKRtBv.d.ts +28 -0
- package/dist/assistant-shared-WzButktj.js +113 -0
- package/dist/assistant-worker.d.ts +11 -0
- package/dist/assistant-worker.js +16 -0
- package/dist/assistant.d.ts +14 -0
- package/dist/assistant.js +19 -0
- package/dist/content-CPZGnn3S.js +141 -0
- package/dist/draft-BjWmaiLn.js +45 -0
- package/dist/error-diagnostics-B_ZOy7kF.js +93 -0
- package/dist/files-UY4h1_36.js +38 -0
- package/dist/index.d.ts +28 -0
- package/dist/index.js +27 -0
- package/dist/link-checker-redirects.d.ts +13 -0
- package/dist/link-checker-redirects.js +25 -0
- package/dist/manifest-CMoxcwPm.d.ts +80 -0
- package/dist/manifest-ZdxLrcvt.js +434 -0
- package/dist/markdown-DUWnEMPp.js +378 -0
- package/dist/navigation.d.ts +283 -0
- package/dist/navigation.js +519 -0
- package/dist/nuxt-CAGpKl_-.d.ts +241 -0
- package/dist/nuxt.d.ts +3 -0
- package/dist/nuxt.js +1868 -0
- package/dist/page-Dx2JD3y1.d.ts +74 -0
- package/dist/page-GPt09oex.js +82 -0
- package/dist/primitive-rail.d.ts +110 -0
- package/dist/primitive-rail.js +289 -0
- package/dist/raw-BChwipz_.js +857 -0
- package/dist/redirects-CmR1yu5A.js +74 -0
- package/dist/runtime/app/app.vue +11 -0
- package/dist/runtime/app/assistant/DocsAssistant.vue +81 -0
- package/dist/runtime/app/assistant/DocsAssistantOff.vue +8 -0
- package/dist/runtime/app/assistant/DocsAssistantPanel.vue +322 -0
- package/dist/runtime/app/components/AppHeader.vue +368 -0
- package/dist/runtime/app/components/AppSearch.vue +68 -0
- package/dist/runtime/app/components/DocsAppShell.vue +62 -0
- package/dist/runtime/app/components/DocsArticle.vue +184 -0
- package/dist/runtime/app/components/DocsAsideFooter.vue +94 -0
- package/dist/runtime/app/components/DocsAsideLeftBody.vue +584 -0
- package/dist/runtime/app/components/DocsAsideLeftTop.vue +132 -0
- package/dist/runtime/app/components/DocsBrandMark.vue +52 -0
- package/dist/runtime/app/components/DocsCatalogFooter.vue +129 -0
- package/dist/runtime/app/components/DocsCodePanel.vue +388 -0
- package/dist/runtime/app/components/DocsCodePre.vue +120 -0
- package/dist/runtime/app/components/DocsHeaderActions.vue +4 -0
- package/dist/runtime/app/components/DocsLanding.vue +83 -0
- package/dist/runtime/app/components/DocsMarkdown.vue +64 -0
- package/dist/runtime/app/components/DocsPage.vue +149 -0
- package/dist/runtime/app/components/DocsPageCredits.vue +41 -0
- package/dist/runtime/app/components/DocsPageHeaderLinks.vue +120 -0
- package/dist/runtime/app/components/DocsRail.vue +239 -0
- package/dist/runtime/app/components/DocsSidebarStrip.vue +81 -0
- package/dist/runtime/app/components/DocsSidebars.vue +63 -0
- package/dist/runtime/app/components/OgImage/DocsPage.takumi.vue +33 -0
- package/dist/runtime/app/components/content/AgentOnly.vue +9 -0
- package/dist/runtime/app/components/content/CodeTree.vue +203 -0
- package/dist/runtime/app/components/content/ComarkHtml.vue +31 -0
- package/dist/runtime/app/components/content/Correct.vue +17 -0
- package/dist/runtime/app/components/content/Example.vue +260 -0
- package/dist/runtime/app/components/content/ExamplePreview.vue +6 -0
- package/dist/runtime/app/components/content/Examples.vue +71 -0
- package/dist/runtime/app/components/content/Incorrect.vue +17 -0
- 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 +206 -0
- package/dist/runtime/app/components/content/ProductFeatureItem.vue +43 -0
- package/dist/runtime/app/components/content/ProductFeatures.vue +17 -0
- package/dist/runtime/app/components/content/TutorialStep.vue +39 -0
- package/dist/runtime/app/composables/docs-assistant-problem.ts +59 -0
- package/dist/runtime/app/composables/docs-theme.ts +15 -0
- package/dist/runtime/app/composables/docs.ts +83 -0
- package/dist/runtime/app/composables/headerActions.ts +6 -0
- package/dist/runtime/app/composables/icons.ts +14 -0
- package/dist/runtime/app/composables/seo.ts +64 -0
- package/dist/runtime/app/composables/tutorial.ts +40 -0
- package/dist/runtime/app/composables/useDocsAssistant.ts +17 -0
- package/dist/runtime/app/error.vue +88 -0
- package/dist/runtime/app/layouts/default.vue +7 -0
- package/dist/runtime/app/layouts/docs.vue +104 -0
- package/dist/runtime/app/middleware/docs-layout.ts +23 -0
- package/dist/runtime/app/pages/docs-page.vue +3 -0
- package/dist/runtime/app/plugins/comark-css.ts +14 -0
- package/dist/runtime/app/plugins/icon-stroke.ts +12 -0
- package/dist/runtime/app/plugins/theme-color.ts +18 -0
- package/dist/runtime/app/utils/docs-theme.ts +43 -0
- package/dist/runtime/app/utils/file-tree.ts +40 -0
- package/dist/runtime/server/llms.d.ts +6 -0
- package/dist/runtime/server/llms.js +7 -0
- package/dist/runtime/server/markdown.d.ts +10 -0
- package/dist/runtime/server/markdown.js +11 -0
- package/dist/runtime/server/mcp.d.ts +6 -0
- package/dist/runtime/server/mcp.js +7 -0
- package/dist/runtime/server/page.d.ts +7 -0
- package/dist/runtime/server/page.js +27 -0
- package/dist/runtime/server/raw.d.ts +10 -0
- package/dist/runtime/server/raw.js +23 -0
- package/dist/runtime/server/search.d.ts +6 -0
- package/dist/runtime/server/search.js +32 -0
- package/dist/runtime/server/sitemap.d.ts +6 -0
- package/dist/runtime/server/sitemap.js +52 -0
- package/dist/runtime/server/trailing-slash.d.ts +10 -0
- package/dist/runtime/server/trailing-slash.js +28 -0
- package/dist/runtime/theme/design.css +464 -0
- package/dist/schema-DwpXW0VZ.js +98 -0
- package/dist/server.d.ts +15 -0
- package/dist/server.js +5 -0
- package/dist/theme-BXyu4uFL.d.ts +32 -0
- package/dist/theme-DzC8LtMH.js +237 -0
- package/dist/theme.d.ts +2 -0
- package/dist/theme.js +2 -0
- package/dist/types-BhG6vGfG.d.ts +212 -0
- package/package.json +144 -1
|
@@ -0,0 +1,368 @@
|
|
|
1
|
+
<script setup lang="ts">
|
|
2
|
+
import { useMediaQuery } from "@vueuse/core"
|
|
3
|
+
import { docsHomePath, isDocsPath, normalizeDocsPath } from "#docs/navigation"
|
|
4
|
+
import { useDocsHeaderActionsTarget } from "../composables/headerActions"
|
|
5
|
+
|
|
6
|
+
const route = useRoute()
|
|
7
|
+
const { base, github, site, socials, start } = useDocsConfig()
|
|
8
|
+
const docsHome = docsHomePath(useDocsManifest(), start)
|
|
9
|
+
// Docs routes and the start links use the docs shell. There the brand opens the docs home, like a docs site logo,
|
|
10
|
+
// and the menu shows the docs sidebar. Elsewhere the brand opens the home page.
|
|
11
|
+
// The header is the same on every page: the brand, search in the middle, and the site's links and controls.
|
|
12
|
+
const shell = useDocsShell()
|
|
13
|
+
const error = useError()
|
|
14
|
+
const isDocsRoute = computed(() => shell.value && !error.value)
|
|
15
|
+
const menuOpen = ref(false)
|
|
16
|
+
const wide = useMediaQuery("(min-width: 64rem)", { ssrWidth: 0 })
|
|
17
|
+
const actionsTargetId = useDocsHeaderActionsTarget()
|
|
18
|
+
const actionsTarget = computed(() => wide.value && actionsTargetId.value ? document.getElementById(actionsTargetId.value) : null)
|
|
19
|
+
// Nuxt turns a `null` in runtime config into "", so only a number counts.
|
|
20
|
+
const stars = github && typeof github.stars === "number" ? new Intl.NumberFormat("en", { notation: "compact" }).format(github.stars) : null
|
|
21
|
+
|
|
22
|
+
// A site without docs pages has no "Docs" link. A start link that "Docs" already opens would repeat it.
|
|
23
|
+
const navLinks = [
|
|
24
|
+
...docsHome ? [{ label: "Docs", to: docsHome }] : [],
|
|
25
|
+
...(start?.links ?? []).filter(link => link.to !== base && normalizeDocsPath(link.to) !== docsHome).map(link => ({ label: link.label, to: link.to })),
|
|
26
|
+
]
|
|
27
|
+
|
|
28
|
+
const mobileLinks = [
|
|
29
|
+
{ label: "Home", to: "/" },
|
|
30
|
+
...navLinks,
|
|
31
|
+
]
|
|
32
|
+
|
|
33
|
+
// The docs drawer already lists the docs pages.
|
|
34
|
+
const docsMobileLinks = mobileLinks.filter(link => !isDocsPath(link.to, base))
|
|
35
|
+
|
|
36
|
+
function isActiveLink(to: string) {
|
|
37
|
+
return route.path === to || route.path.startsWith(`${to}/`)
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
// Touch screens get 44px header icon buttons. Below 360px they are 40px wide, so the brand and four buttons fit a 320px row.
|
|
41
|
+
const touchIconButton = "pointer-coarse:size-11 max-[22.5rem]:pointer-coarse:w-10 pointer-coarse:justify-center"
|
|
42
|
+
</script>
|
|
43
|
+
|
|
44
|
+
<template>
|
|
45
|
+
<div class="vh-docs-header sticky top-0 z-50">
|
|
46
|
+
<UHeader
|
|
47
|
+
v-model:open="menuOpen"
|
|
48
|
+
:ui="withDocsTheme('header', {
|
|
49
|
+
// Docs pages pin the rail to the left edge, so the header spans the full width.
|
|
50
|
+
container: isDocsRoute ? 'max-w-none' : undefined,
|
|
51
|
+
right: 'pointer-coarse:gap-0.5',
|
|
52
|
+
toggle: touchIconButton,
|
|
53
|
+
})"
|
|
54
|
+
>
|
|
55
|
+
<template #left>
|
|
56
|
+
<!-- The menu repeats this slot and focuses the brand first. Its tooltip would take the first Escape, so it is off there. -->
|
|
57
|
+
<UTooltip
|
|
58
|
+
:text="site.badge?.tooltip ?? undefined"
|
|
59
|
+
:disabled="!site.badge?.tooltip || menuOpen"
|
|
60
|
+
:content="{ side: 'bottom', sideOffset: 8 }"
|
|
61
|
+
ignore-non-keyboard-focus
|
|
62
|
+
:ui="{ content: 'h-auto max-w-64 whitespace-normal px-3 py-2 text-left leading-5' }"
|
|
63
|
+
>
|
|
64
|
+
<ULink :to="isDocsRoute && docsHome ? docsHome : '/'" class="vh-brand" :aria-label="site.badge ? `${site.name} ${site.badge.label}` : site.name">
|
|
65
|
+
<DocsBrandMark class="vh-brand-mark" />
|
|
66
|
+
<span class="vh-brand-name">
|
|
67
|
+
<span>{{ site.name }}</span>
|
|
68
|
+
<span v-if="site.badge" class="vh-brand-alpha">{{ site.badge.label }}</span>
|
|
69
|
+
</span>
|
|
70
|
+
</ULink>
|
|
71
|
+
</UTooltip>
|
|
72
|
+
|
|
73
|
+
<nav v-if="!isDocsRoute" class="hidden items-center gap-1 lg:flex" aria-label="Primary">
|
|
74
|
+
<UButton
|
|
75
|
+
v-for="link in navLinks"
|
|
76
|
+
:key="link.to"
|
|
77
|
+
:to="link.to"
|
|
78
|
+
:label="link.label"
|
|
79
|
+
:active="isActiveLink(link.to)"
|
|
80
|
+
variant="ghost"
|
|
81
|
+
active-variant="soft"
|
|
82
|
+
/>
|
|
83
|
+
</nav>
|
|
84
|
+
</template>
|
|
85
|
+
|
|
86
|
+
<UContentSearchButton
|
|
87
|
+
:collapsed="false"
|
|
88
|
+
label="Search docs"
|
|
89
|
+
:kbds="['meta', 'K']"
|
|
90
|
+
:ui="withDocsTheme('contentSearchButton', {
|
|
91
|
+
base: 'vh-header-search hidden w-full lg:inline-flex',
|
|
92
|
+
trailing: 'ms-auto flex items-center gap-0.5',
|
|
93
|
+
})"
|
|
94
|
+
/>
|
|
95
|
+
|
|
96
|
+
<template #right>
|
|
97
|
+
<!-- Empty here: an app adds its own items with a `DocsHeaderActions` component, such as the package a page documents. -->
|
|
98
|
+
<!-- Move one instance between shells so app state, IDs, and subscriptions stay unique. -->
|
|
99
|
+
<Teleport :to="actionsTarget || '#teleports'" :disabled="!actionsTarget">
|
|
100
|
+
<DocsHeaderActions />
|
|
101
|
+
</Teleport>
|
|
102
|
+
<UContentSearchButton
|
|
103
|
+
collapsed
|
|
104
|
+
:kbds="[]"
|
|
105
|
+
:ui="withDocsTheme('contentSearchButton', {
|
|
106
|
+
base: '!w-8 shrink-0 justify-center !p-1.5 text-default pointer-coarse:!size-11 max-[22.5rem]:pointer-coarse:!w-10 lg:hidden',
|
|
107
|
+
label: 'sr-only',
|
|
108
|
+
trailing: 'hidden',
|
|
109
|
+
})"
|
|
110
|
+
/>
|
|
111
|
+
<a
|
|
112
|
+
v-if="github"
|
|
113
|
+
:href="github.url"
|
|
114
|
+
target="_blank"
|
|
115
|
+
rel="noopener"
|
|
116
|
+
class="vh-header-github"
|
|
117
|
+
:aria-label="stars ? `${site.name} on GitHub, ${stars} stars` : `${site.name} on GitHub`"
|
|
118
|
+
>
|
|
119
|
+
<UIcon name="i-simple-icons-github" class="size-4 shrink-0" />
|
|
120
|
+
<span class="vh-header-github-label">GitHub</span>
|
|
121
|
+
<span v-if="stars" class="vh-header-github-stars">
|
|
122
|
+
<UIcon name="i-lucide-star" class="size-3.5 shrink-0" />
|
|
123
|
+
{{ stars }}
|
|
124
|
+
</span>
|
|
125
|
+
</a>
|
|
126
|
+
<UButton
|
|
127
|
+
v-for="link in socials"
|
|
128
|
+
:key="link.to"
|
|
129
|
+
:to="link.to"
|
|
130
|
+
target="_blank"
|
|
131
|
+
:icon="link.icon"
|
|
132
|
+
:label="link.icon ? undefined : link.label"
|
|
133
|
+
variant="ghost"
|
|
134
|
+
:aria-label="link.label"
|
|
135
|
+
:class="['hidden lg:inline-flex', link.icon ? touchIconButton : 'pointer-coarse:h-11']"
|
|
136
|
+
/>
|
|
137
|
+
<!-- The button renders both icons and the color mode class picks one, so the server draws it too. -->
|
|
138
|
+
<UColorModeButton :class="touchIconButton" />
|
|
139
|
+
</template>
|
|
140
|
+
|
|
141
|
+
<template #body>
|
|
142
|
+
<div v-if="isDocsRoute" class="vh-docs-menu -mx-4 -my-2">
|
|
143
|
+
<nav class="flex shrink-0 flex-wrap items-center gap-1 border-b border-default px-2 py-1.5" aria-label="Site">
|
|
144
|
+
<UButton
|
|
145
|
+
v-for="link in docsMobileLinks"
|
|
146
|
+
:key="link.to"
|
|
147
|
+
:to="link.to"
|
|
148
|
+
:label="link.label"
|
|
149
|
+
variant="ghost"
|
|
150
|
+
class="pointer-coarse:h-11"
|
|
151
|
+
/>
|
|
152
|
+
<UButton
|
|
153
|
+
v-for="link in socials"
|
|
154
|
+
:key="link.to"
|
|
155
|
+
:to="link.to"
|
|
156
|
+
:label="link.label"
|
|
157
|
+
:icon="link.icon"
|
|
158
|
+
target="_blank"
|
|
159
|
+
variant="ghost"
|
|
160
|
+
class="pointer-coarse:h-11"
|
|
161
|
+
/>
|
|
162
|
+
</nav>
|
|
163
|
+
<DocsSidebars class="vh-docs-menu-sidebars" panel labeled />
|
|
164
|
+
</div>
|
|
165
|
+
<nav v-else-if="!isDocsRoute" class="grid gap-1">
|
|
166
|
+
<UButton
|
|
167
|
+
v-for="link in mobileLinks"
|
|
168
|
+
:key="link.to"
|
|
169
|
+
:to="link.to"
|
|
170
|
+
:label="link.label"
|
|
171
|
+
variant="ghost"
|
|
172
|
+
block
|
|
173
|
+
class="justify-start"
|
|
174
|
+
/>
|
|
175
|
+
<UButton
|
|
176
|
+
v-for="link in socials"
|
|
177
|
+
:key="link.to"
|
|
178
|
+
:to="link.to"
|
|
179
|
+
:label="link.label"
|
|
180
|
+
:icon="link.icon"
|
|
181
|
+
target="_blank"
|
|
182
|
+
variant="ghost"
|
|
183
|
+
block
|
|
184
|
+
class="justify-start pointer-coarse:h-11"
|
|
185
|
+
/>
|
|
186
|
+
</nav>
|
|
187
|
+
</template>
|
|
188
|
+
</UHeader>
|
|
189
|
+
</div>
|
|
190
|
+
</template>
|
|
191
|
+
|
|
192
|
+
<style scoped>
|
|
193
|
+
/* A replacement layout or sidebar keeps the header until it supplies the sidebar controls. */
|
|
194
|
+
@media (min-width: 64rem) {
|
|
195
|
+
:global(body:has([data-docs-sidebar-head]) .vh-docs-header) {
|
|
196
|
+
display: none;
|
|
197
|
+
}
|
|
198
|
+
}
|
|
199
|
+
|
|
200
|
+
/*
|
|
201
|
+
* In the mobile menu the rail and the page panel sit side by side, as on wide screens.
|
|
202
|
+
* The menu fills the visible body of the fullscreen menu (its padding minus this block's negative margin),
|
|
203
|
+
* so the rail and the panel each scroll inside a bounded height.
|
|
204
|
+
*/
|
|
205
|
+
.vh-docs-menu {
|
|
206
|
+
display: flex;
|
|
207
|
+
height: calc(100dvh - var(--ui-header-height) - 1rem);
|
|
208
|
+
flex-direction: column;
|
|
209
|
+
}
|
|
210
|
+
|
|
211
|
+
.vh-docs-menu-sidebars {
|
|
212
|
+
min-height: 0;
|
|
213
|
+
flex: 1 1 0;
|
|
214
|
+
}
|
|
215
|
+
|
|
216
|
+
@media (min-width: 40rem) {
|
|
217
|
+
.vh-docs-menu {
|
|
218
|
+
height: calc(100dvh - var(--ui-header-height) - 2rem);
|
|
219
|
+
}
|
|
220
|
+
}
|
|
221
|
+
|
|
222
|
+
.vh-docs-menu-sidebars :deep(.vh-docs-panel) {
|
|
223
|
+
flex: 1 1 auto;
|
|
224
|
+
width: auto;
|
|
225
|
+
border-right: 0;
|
|
226
|
+
}
|
|
227
|
+
|
|
228
|
+
.vh-brand {
|
|
229
|
+
--vh-docs-mark-size: 1.5rem;
|
|
230
|
+
display: inline-flex;
|
|
231
|
+
flex-shrink: 0;
|
|
232
|
+
align-items: center;
|
|
233
|
+
gap: 0.5rem;
|
|
234
|
+
color: var(--ui-text-highlighted);
|
|
235
|
+
font-size: 0.875rem;
|
|
236
|
+
font-weight: 500;
|
|
237
|
+
letter-spacing: 0;
|
|
238
|
+
white-space: nowrap;
|
|
239
|
+
}
|
|
240
|
+
|
|
241
|
+
/* On touch screens the brand text is about 20px tall. An invisible area makes the tap target 44px without moving the header. */
|
|
242
|
+
@media (pointer: coarse) {
|
|
243
|
+
.vh-brand {
|
|
244
|
+
position: relative;
|
|
245
|
+
}
|
|
246
|
+
|
|
247
|
+
.vh-brand::after {
|
|
248
|
+
position: absolute;
|
|
249
|
+
inset: -0.75rem -0.25rem;
|
|
250
|
+
content: "";
|
|
251
|
+
}
|
|
252
|
+
}
|
|
253
|
+
|
|
254
|
+
.vh-brand-name {
|
|
255
|
+
display: inline-flex;
|
|
256
|
+
align-items: baseline;
|
|
257
|
+
gap: 0.3rem;
|
|
258
|
+
}
|
|
259
|
+
|
|
260
|
+
.vh-brand-alpha {
|
|
261
|
+
border-bottom: 1px dotted currentcolor;
|
|
262
|
+
color: var(--ui-text-muted);
|
|
263
|
+
font-family: var(--font-mono);
|
|
264
|
+
font-size: 0.625rem;
|
|
265
|
+
font-weight: 500;
|
|
266
|
+
letter-spacing: 0.02em;
|
|
267
|
+
line-height: 1;
|
|
268
|
+
transition: color 150ms ease;
|
|
269
|
+
}
|
|
270
|
+
|
|
271
|
+
.vh-brand:hover .vh-brand-alpha {
|
|
272
|
+
color: var(--ui-text-highlighted);
|
|
273
|
+
}
|
|
274
|
+
|
|
275
|
+
/* The search button of the old comark-ui header: a soft field in the middle column, with its shortcut at the end. */
|
|
276
|
+
:deep(.vh-header-search) {
|
|
277
|
+
height: 2.25rem;
|
|
278
|
+
gap: 0.5rem;
|
|
279
|
+
border-radius: calc(var(--ui-radius) * 1.5);
|
|
280
|
+
background: var(--ui-bg-muted);
|
|
281
|
+
box-shadow: inset 0 0 0 1px var(--ui-border);
|
|
282
|
+
padding: 0 0.375rem 0 0.75rem;
|
|
283
|
+
color: var(--ui-text-dimmed);
|
|
284
|
+
font-size: 0.875rem;
|
|
285
|
+
font-weight: 400;
|
|
286
|
+
transition: box-shadow 150ms ease, color 150ms ease;
|
|
287
|
+
}
|
|
288
|
+
|
|
289
|
+
:deep(.vh-header-search kbd) {
|
|
290
|
+
text-transform: none;
|
|
291
|
+
}
|
|
292
|
+
|
|
293
|
+
@media (hover: hover) {
|
|
294
|
+
:deep(.vh-header-search:hover) {
|
|
295
|
+
box-shadow: inset 0 0 0 1px var(--ui-text-dimmed);
|
|
296
|
+
color: var(--ui-text-muted);
|
|
297
|
+
}
|
|
298
|
+
}
|
|
299
|
+
|
|
300
|
+
/* A framed link with the star count after a hairline, as on the old comark-ui site, with the control radius of the design system. */
|
|
301
|
+
.vh-header-github {
|
|
302
|
+
display: inline-flex;
|
|
303
|
+
height: 2rem;
|
|
304
|
+
flex: none;
|
|
305
|
+
align-items: center;
|
|
306
|
+
gap: 0.375rem;
|
|
307
|
+
border-radius: calc(var(--ui-radius) * 1.5);
|
|
308
|
+
box-shadow: inset 0 0 0 1px var(--ui-border);
|
|
309
|
+
padding: 0 0.75rem;
|
|
310
|
+
color: var(--ui-text-highlighted);
|
|
311
|
+
font-size: 0.8125rem;
|
|
312
|
+
font-weight: 500;
|
|
313
|
+
transition: box-shadow 150ms ease;
|
|
314
|
+
}
|
|
315
|
+
|
|
316
|
+
.vh-header-github-stars {
|
|
317
|
+
display: inline-flex;
|
|
318
|
+
align-items: center;
|
|
319
|
+
gap: 0.25rem;
|
|
320
|
+
margin-left: 0.125rem;
|
|
321
|
+
border-left: 1px solid var(--ui-border);
|
|
322
|
+
padding-left: 0.625rem;
|
|
323
|
+
color: var(--ui-text-muted);
|
|
324
|
+
font-family: var(--font-mono);
|
|
325
|
+
font-size: 0.75rem;
|
|
326
|
+
font-variant-numeric: tabular-nums;
|
|
327
|
+
}
|
|
328
|
+
|
|
329
|
+
@media (hover: hover) {
|
|
330
|
+
.vh-header-github:hover {
|
|
331
|
+
box-shadow: inset 0 0 0 1px var(--ui-text-dimmed);
|
|
332
|
+
}
|
|
333
|
+
}
|
|
334
|
+
|
|
335
|
+
/* Narrow screens keep the mark alone, a 44px target on touch. */
|
|
336
|
+
@media (width < 60rem) {
|
|
337
|
+
.vh-header-github {
|
|
338
|
+
width: 2.5rem;
|
|
339
|
+
justify-content: center;
|
|
340
|
+
box-shadow: none;
|
|
341
|
+
padding: 0;
|
|
342
|
+
}
|
|
343
|
+
|
|
344
|
+
.vh-header-github-label,
|
|
345
|
+
.vh-header-github-stars {
|
|
346
|
+
display: none;
|
|
347
|
+
}
|
|
348
|
+
}
|
|
349
|
+
|
|
350
|
+
@media (pointer: coarse) {
|
|
351
|
+
.vh-header-github {
|
|
352
|
+
height: 2.75rem;
|
|
353
|
+
}
|
|
354
|
+
}
|
|
355
|
+
|
|
356
|
+
/* 44px wide on touch, like the other header buttons, and 40px below 360px so the row still fits a 320px screen. */
|
|
357
|
+
@media (width < 60rem) and (pointer: coarse) {
|
|
358
|
+
.vh-header-github {
|
|
359
|
+
width: 2.75rem;
|
|
360
|
+
}
|
|
361
|
+
}
|
|
362
|
+
|
|
363
|
+
@media (width < 22.5rem) and (pointer: coarse) {
|
|
364
|
+
.vh-header-github {
|
|
365
|
+
width: 2.5rem;
|
|
366
|
+
}
|
|
367
|
+
}
|
|
368
|
+
</style>
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
<script setup lang="ts">
|
|
2
|
+
import { createDocsSearch, docsAppPath, docsSectionHome } from "#docs/navigation"
|
|
3
|
+
|
|
4
|
+
import type { DocsSearchSection } from "@vite-hub/docs"
|
|
5
|
+
|
|
6
|
+
// A result shows the page path over its heading. One line, "Page > Section > Heading", cut off the heading on a phone.
|
|
7
|
+
const { appBase } = useDocsConfig()
|
|
8
|
+
const manifest = useDocsManifest()
|
|
9
|
+
const icons = useDocsIcons()
|
|
10
|
+
const navigation = manifest.sections.map(section => ({
|
|
11
|
+
title: section.title,
|
|
12
|
+
path: section.path,
|
|
13
|
+
icon: icons.section(section),
|
|
14
|
+
children: section.pages.filter(page => page.navigation).map(page => ({ title: page.title, path: page.path, icon: icons.page(page) })),
|
|
15
|
+
}))
|
|
16
|
+
const links = navigation.map((item, index) => ({ label: item.title, icon: item.icon, to: docsSectionHome(manifest.sections[index]!) }))
|
|
17
|
+
|
|
18
|
+
// The index loads when the dialog first opens, so pages do not pay for it.
|
|
19
|
+
const status = ref<"idle" | "loading" | "ready" | "error">("idle")
|
|
20
|
+
let rank: ReturnType<typeof createDocsSearch> | undefined
|
|
21
|
+
const { open } = useContentSearch()
|
|
22
|
+
watch(open, async (value) => {
|
|
23
|
+
if (!value || status.value === "loading" || status.value === "ready") return
|
|
24
|
+
status.value = "loading"
|
|
25
|
+
try {
|
|
26
|
+
const records = await $fetch<DocsSearchSection[]>(docsAppPath("/api/_docs/search.json", appBase))
|
|
27
|
+
rank = createDocsSearch(records)
|
|
28
|
+
status.value = "ready"
|
|
29
|
+
}
|
|
30
|
+
catch {
|
|
31
|
+
status.value = "error"
|
|
32
|
+
}
|
|
33
|
+
})
|
|
34
|
+
|
|
35
|
+
async function search(query: string, options?: { limit?: number }) {
|
|
36
|
+
return rank?.(query, options?.limit ?? 30) ?? []
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
// The section list helps before the first key press. After it, the ranked results are the whole list.
|
|
40
|
+
const searchTerm = ref("")
|
|
41
|
+
|
|
42
|
+
// Nuxt UI builds the prefix as "Page > Section >".
|
|
43
|
+
function searchPath(prefix: string) {
|
|
44
|
+
return prefix.replace(/\s*>$/, "").split(" > ").join(" / ")
|
|
45
|
+
}
|
|
46
|
+
</script>
|
|
47
|
+
|
|
48
|
+
<template>
|
|
49
|
+
<LazyUContentSearch
|
|
50
|
+
v-model:search-term="searchTerm"
|
|
51
|
+
:links="searchTerm ? [] : links"
|
|
52
|
+
:navigation="navigation"
|
|
53
|
+
:search="search"
|
|
54
|
+
:search-status="status"
|
|
55
|
+
:fuse="{ resultLimit: 30 }"
|
|
56
|
+
>
|
|
57
|
+
<template #item-label="{ item }">
|
|
58
|
+
<span v-if="item.prefix" class="vh-search-path">{{ searchPath(item.prefix) }}</span>
|
|
59
|
+
<span class="vh-search-title">{{ item.label }}</span>
|
|
60
|
+
</template>
|
|
61
|
+
|
|
62
|
+
<template #empty="{ searchTerm: term }">
|
|
63
|
+
<span v-if="status === 'error'">Search could not load. Reload the page to try again.</span>
|
|
64
|
+
<span v-else-if="status !== 'ready'">Loading the search index…</span>
|
|
65
|
+
<span v-else>No pages match “{{ term }}”.</span>
|
|
66
|
+
</template>
|
|
67
|
+
</LazyUContentSearch>
|
|
68
|
+
</template>
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
<script setup lang="ts">
|
|
2
|
+
import { docsCanonicalUrl } from "#docs/navigation"
|
|
3
|
+
import { ownsApp } from "#docs/shell"
|
|
4
|
+
import design from "#docs/theme"
|
|
5
|
+
|
|
6
|
+
import { resolveDocsTheme } from "../utils/docs-theme"
|
|
7
|
+
|
|
8
|
+
const props = defineProps<{
|
|
9
|
+
/** Set by the docs layouts. They draw the shell only in an app with its own `app.vue`, where the docs `app.vue` does not. */
|
|
10
|
+
layout?: boolean
|
|
11
|
+
}>()
|
|
12
|
+
|
|
13
|
+
const active = !props.layout || !ownsApp
|
|
14
|
+
const route = useRoute()
|
|
15
|
+
const words = (text: string) => ` ${text.toLowerCase().replace(/[^\p{L}\p{N}]+/gu, " ").trim()} `
|
|
16
|
+
const { site, appBase } = useDocsConfig()
|
|
17
|
+
const appConfig = useAppConfig()
|
|
18
|
+
const theme = computed(() => resolveDocsTheme(design, appConfig.ui))
|
|
19
|
+
|
|
20
|
+
// The same URL that the sitemap lists and that a trailing slash redirects to.
|
|
21
|
+
const canonical = () => docsCanonicalUrl(site.url, route.path, appBase)
|
|
22
|
+
|
|
23
|
+
if (active) {
|
|
24
|
+
useHead({
|
|
25
|
+
// One title pattern for every page: "KV configuration · ViteHub". A title that already names the site stays as written.
|
|
26
|
+
// The check ignores case and punctuation, so "Comark UI" counts as naming `comark-ui`.
|
|
27
|
+
titleTemplate: title => !title ? site.name : words(title).includes(words(site.name)) ? title : `${title} · ${site.name}`,
|
|
28
|
+
link: site.url ? [{ rel: "canonical", href: canonical }] : [],
|
|
29
|
+
// In an app with its own `app.vue`, the app's head stays on its pages, and the docs pages add what they need.
|
|
30
|
+
meta: ownsApp ? [] : [{ name: "viewport", content: "width=device-width, initial-scale=1, viewport-fit=cover, interactive-widget=resizes-content" }],
|
|
31
|
+
// The theme's CSS applies below `.vh-docs`. A docs site sets it on every page in its head config.
|
|
32
|
+
htmlAttrs: ownsApp ? {} : { class: "vh-docs" },
|
|
33
|
+
})
|
|
34
|
+
|
|
35
|
+
// Open Graph needs `og:url` and `og:type` besides the title and image, or share previews and site audits call it incomplete.
|
|
36
|
+
useSeoMeta({
|
|
37
|
+
ogSiteName: site.name,
|
|
38
|
+
ogType: "website",
|
|
39
|
+
...site.url ? { ogUrl: canonical } : {},
|
|
40
|
+
twitterCard: "summary_large_image",
|
|
41
|
+
robots: "index, follow, max-image-preview:large, max-snippet:-1, max-video-preview:-1",
|
|
42
|
+
})
|
|
43
|
+
}
|
|
44
|
+
</script>
|
|
45
|
+
|
|
46
|
+
<template>
|
|
47
|
+
<!-- In an app with its own `app.vue`, the theme reaches the docs pages through `<UTheme>`. Its maps are empty in a docs site. -->
|
|
48
|
+
<UTheme v-if="active" :ui="theme.ui" :props="theme.props">
|
|
49
|
+
<div class="flex">
|
|
50
|
+
<div class="min-w-0 flex-1">
|
|
51
|
+
<AppHeader v-if="$route.meta.header !== false" />
|
|
52
|
+
<slot />
|
|
53
|
+
|
|
54
|
+
<ClientOnly>
|
|
55
|
+
<AppSearch />
|
|
56
|
+
</ClientOnly>
|
|
57
|
+
<DocsAssistant />
|
|
58
|
+
</div>
|
|
59
|
+
</div>
|
|
60
|
+
</UTheme>
|
|
61
|
+
<slot v-else />
|
|
62
|
+
</template>
|
|
@@ -0,0 +1,184 @@
|
|
|
1
|
+
<script setup lang="ts">
|
|
2
|
+
import DocsCodePre from "./DocsCodePre.vue"
|
|
3
|
+
|
|
4
|
+
import type { ComponentPublicInstance } from "vue"
|
|
5
|
+
import type { DocsPageResponse } from "@vite-hub/docs"
|
|
6
|
+
|
|
7
|
+
const props = defineProps<{
|
|
8
|
+
response: DocsPageResponse
|
|
9
|
+
}>()
|
|
10
|
+
|
|
11
|
+
const page = computed(() => props.response.page)
|
|
12
|
+
const tutorial = computed(() => page.value.layout === "tutorial")
|
|
13
|
+
const tocLinks = computed(() => page.value.toc ? props.response.document.toc : [])
|
|
14
|
+
const section = useDocsSection()
|
|
15
|
+
// A tutorial with `codePanel: true` splits in half on wide screens: the prose on the left, its files on the right.
|
|
16
|
+
const hasCodePanel = computed(() => tutorial.value && page.value.codePanel === true)
|
|
17
|
+
const body = useTemplateRef<ComponentPublicInstance>("body")
|
|
18
|
+
const bodyElement = computed(() => {
|
|
19
|
+
const element: unknown = body.value?.$el
|
|
20
|
+
return import.meta.client && element instanceof HTMLElement ? element : null
|
|
21
|
+
})
|
|
22
|
+
const pageUi = computed(() => ({
|
|
23
|
+
root: hasCodePanel.value
|
|
24
|
+
? "!grid !grid-cols-1 !gap-0 lg:!grid-cols-1 lg:!gap-0 xl:!grid-cols-[minmax(0,0.85fr)_minmax(0,1.15fr)] xl:!gap-8"
|
|
25
|
+
: tocLinks.value.length
|
|
26
|
+
? "!grid !grid-cols-1 !gap-0 lg:!grid-cols-1 lg:!gap-0 xl:!grid-cols-[minmax(0,1fr)_var(--vh-toc-width)] xl:!gap-10"
|
|
27
|
+
: "!grid !grid-cols-1 !gap-0 lg:!grid-cols-1 lg:!gap-0",
|
|
28
|
+
center: "min-w-0 lg:!col-span-1",
|
|
29
|
+
// The outline is 0.5rem wider than its column and pulled back by its negative margin, so the padding that keeps focus
|
|
30
|
+
// rings whole does not narrow the links.
|
|
31
|
+
right: hasCodePanel.value ? "hidden xl:block xl:!col-span-1 xl:!w-full" : "hidden xl:block xl:!col-span-1 xl:!w-[calc(100%+0.5rem)]",
|
|
32
|
+
}))
|
|
33
|
+
const headerUi = {
|
|
34
|
+
root: "!px-0 !pt-10 !pb-0",
|
|
35
|
+
title: "text-[2rem] sm:text-[2rem] leading-[1.15] tracking-[-0.025em] font-semibold text-highlighted text-balance",
|
|
36
|
+
description: "mt-2 max-w-[34rem] text-[1.0625rem] leading-[1.7] text-muted text-pretty",
|
|
37
|
+
}
|
|
38
|
+
// The aside scrolls the outline. The list and its root do not scroll too, so only the aside clips, and its padding keeps
|
|
39
|
+
// the focus ring of a link whole.
|
|
40
|
+
const outlineUi = {
|
|
41
|
+
root: "!static !mx-0 !px-0 !overflow-visible",
|
|
42
|
+
container: "!pt-0 !border-s-0 !ps-0",
|
|
43
|
+
link: "!h-auto min-h-6 !py-1 text-[0.8125rem] leading-5 !text-dimmed hover:!text-highlighted data-[active]:!text-highlighted",
|
|
44
|
+
// Long code headings such as KV_UNSUPPORTED_OPERATION have no spaces, so they break anywhere instead of overflowing the column.
|
|
45
|
+
linkText: "!whitespace-normal !overflow-visible !text-clip [overflow-wrap:anywhere]",
|
|
46
|
+
content: "!min-h-0 !overflow-visible",
|
|
47
|
+
}
|
|
48
|
+
const mobileTocUi = {
|
|
49
|
+
// The page body has no top margin, so the outline keeps the space that separates it from the first heading.
|
|
50
|
+
root: "xl:hidden !static !px-0 !mx-0 mb-6",
|
|
51
|
+
container: "!border-s-0 !border-b !border-default !ps-0 !py-3",
|
|
52
|
+
// Touch screens get a 44px toggle.
|
|
53
|
+
trigger: "!py-1 pointer-coarse:min-h-11 text-sm font-medium text-muted",
|
|
54
|
+
content: "!pb-2",
|
|
55
|
+
link: "!text-muted hover:!text-highlighted",
|
|
56
|
+
}
|
|
57
|
+
</script>
|
|
58
|
+
|
|
59
|
+
<template>
|
|
60
|
+
<article class="vh-docs-article" :class="{ 'has-code-panel': hasCodePanel }" :data-path="page.path">
|
|
61
|
+
<UPage :ui="withDocsTheme('page', pageUi)">
|
|
62
|
+
<UPageHeader :headline="page.eyebrow ?? undefined" :title="page.sourceTitle" :description="page.tagline ?? undefined" :ui="withDocsTheme('pageHeader', headerUi)">
|
|
63
|
+
<template #links>
|
|
64
|
+
<DocsPageHeaderLinks />
|
|
65
|
+
</template>
|
|
66
|
+
</UPageHeader>
|
|
67
|
+
|
|
68
|
+
<UContentToc
|
|
69
|
+
v-if="tocLinks.length"
|
|
70
|
+
class="vh-mobile-outline"
|
|
71
|
+
title="On this page"
|
|
72
|
+
:highlight="false"
|
|
73
|
+
:links="tocLinks"
|
|
74
|
+
:ui="withDocsTheme('contentToc', mobileTocUi)"
|
|
75
|
+
/>
|
|
76
|
+
|
|
77
|
+
<UPageBody
|
|
78
|
+
ref="body"
|
|
79
|
+
prose
|
|
80
|
+
class="docs-content vh-article-body !px-0 !pb-16"
|
|
81
|
+
:class="{ 'docs-tutorial-content': tutorial }"
|
|
82
|
+
>
|
|
83
|
+
<!-- Code is comark-ui's code block, except beside a code panel, which reads the file name bar of DocsCodePre. -->
|
|
84
|
+
<DocsMarkdown :document="response.document" :components="hasCodePanel ? { pre: DocsCodePre } : undefined" />
|
|
85
|
+
<DocsPageCredits v-if="response.credits" :credits="response.credits" class="not-prose mt-10" />
|
|
86
|
+
</UPageBody>
|
|
87
|
+
|
|
88
|
+
<!-- Every page ends with the full product list, in the content column. -->
|
|
89
|
+
<!-- Below the content: its links work before it hydrates. -->
|
|
90
|
+
<LazyDocsCatalogFooter hydrate-on-visible :current="section" class="vh-article-explore" />
|
|
91
|
+
|
|
92
|
+
<template v-if="hasCodePanel" #right>
|
|
93
|
+
<DocsCodePanel :body="bodyElement" />
|
|
94
|
+
</template>
|
|
95
|
+
|
|
96
|
+
<template v-else-if="tocLinks.length" #right>
|
|
97
|
+
<aside class="vh-article-outline" aria-label="Page outline">
|
|
98
|
+
<UContentToc title="On this page" :highlight="false" :links="tocLinks" :ui="withDocsTheme('contentToc', outlineUi)" />
|
|
99
|
+
</aside>
|
|
100
|
+
</template>
|
|
101
|
+
</UPage>
|
|
102
|
+
</article>
|
|
103
|
+
</template>
|
|
104
|
+
|
|
105
|
+
<style scoped>
|
|
106
|
+
.vh-docs-article {
|
|
107
|
+
width: 100%;
|
|
108
|
+
max-width: calc(var(--vh-content-width) + var(--vh-toc-width) + 6rem);
|
|
109
|
+
margin-inline: auto;
|
|
110
|
+
padding-inline: 1rem;
|
|
111
|
+
}
|
|
112
|
+
|
|
113
|
+
/* Below 40rem this is the only gutter. Wider pages add the page padding around it. */
|
|
114
|
+
@media (min-width: 40rem) {
|
|
115
|
+
.vh-docs-article {
|
|
116
|
+
padding-inline: 1.25rem;
|
|
117
|
+
}
|
|
118
|
+
}
|
|
119
|
+
|
|
120
|
+
.vh-article-body {
|
|
121
|
+
min-width: 0;
|
|
122
|
+
}
|
|
123
|
+
|
|
124
|
+
/* Beside the code panel the article spans the page column, and the panel reaches the right edge. */
|
|
125
|
+
@media (min-width: 80rem) {
|
|
126
|
+
.vh-docs-article.has-code-panel {
|
|
127
|
+
max-width: none;
|
|
128
|
+
padding-right: 0;
|
|
129
|
+
padding-left: 1.5rem;
|
|
130
|
+
}
|
|
131
|
+
}
|
|
132
|
+
|
|
133
|
+
/* The page body already ends with padding, so the list drops its own top margin. */
|
|
134
|
+
.vh-docs-article .vh-article-explore {
|
|
135
|
+
margin-top: 0;
|
|
136
|
+
margin-bottom: 4rem;
|
|
137
|
+
}
|
|
138
|
+
|
|
139
|
+
.vh-article-body :deep(h1:first-child) {
|
|
140
|
+
display: none;
|
|
141
|
+
}
|
|
142
|
+
|
|
143
|
+
.docs-tutorial-content {
|
|
144
|
+
counter-reset: tutorial-step;
|
|
145
|
+
}
|
|
146
|
+
|
|
147
|
+
.vh-article-outline {
|
|
148
|
+
position: sticky;
|
|
149
|
+
align-self: start;
|
|
150
|
+
top: calc(var(--ui-header-height) + 2rem);
|
|
151
|
+
max-height: calc(100dvh - var(--ui-header-height) - 4rem);
|
|
152
|
+
overflow-y: auto;
|
|
153
|
+
margin-inline: -0.25rem;
|
|
154
|
+
padding: 2.5rem 0.25rem;
|
|
155
|
+
}
|
|
156
|
+
|
|
157
|
+
@media (min-width: 40rem) {
|
|
158
|
+
.vh-docs-article {
|
|
159
|
+
padding-inline: 2rem;
|
|
160
|
+
}
|
|
161
|
+
}
|
|
162
|
+
</style>
|
|
163
|
+
|
|
164
|
+
<!--
|
|
165
|
+
Nuxt UI opens the outline from the lg breakpoint, but the right column starts at xl.
|
|
166
|
+
Between the two, keep the collapsed toggle. UContentToc's root does not carry this component's scope, so these rules are global.
|
|
167
|
+
-->
|
|
168
|
+
<style>
|
|
169
|
+
@media (max-width: 79.99rem) {
|
|
170
|
+
.vh-mobile-outline button[data-slot="trigger"],
|
|
171
|
+
.vh-mobile-outline [data-slot="trailingIcon"] {
|
|
172
|
+
display: flex;
|
|
173
|
+
}
|
|
174
|
+
|
|
175
|
+
.vh-mobile-outline [data-slot="content"][data-state="open"] {
|
|
176
|
+
display: block;
|
|
177
|
+
}
|
|
178
|
+
|
|
179
|
+
.vh-mobile-outline p[data-slot="trigger"],
|
|
180
|
+
.vh-mobile-outline [data-slot="content"]:not([data-state]) {
|
|
181
|
+
display: none;
|
|
182
|
+
}
|
|
183
|
+
}
|
|
184
|
+
</style>
|