@vite-hub/docs 0.6.0 → 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 +5 -4
- 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-CYAIBEHE.d.ts → nuxt-B0kdfz6P.d.ts} +11 -3
- package/dist/nuxt.d.ts +1 -1
- package/dist/nuxt.js +41 -69
- 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/AppSearch.vue +33 -10
- package/dist/runtime/app/components/DocsAsideLeftTop.vue +4 -10
- package/dist/runtime/app/components/DocsBuiltWith.vue +31 -0
- package/dist/runtime/app/components/DocsCatalogFooter.vue +4 -3
- package/dist/runtime/app/components/DocsLanding.vue +1 -3
- package/dist/runtime/app/components/DocsLearn.vue +9 -8
- package/dist/runtime/app/components/DocsLearnCodePre.vue +9 -20
- package/dist/runtime/app/components/DocsMarkdown.vue +17 -5
- package/dist/runtime/app/components/DocsPage.vue +26 -2
- 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/{theme-CxBzPBZ9.js → theme-DRktv19v.js} +1 -1
- package/dist/theme.js +1 -1
- package/dist/{types-B6YlHil4.d.ts → types-Dl6yjlwV.d.ts} +2 -0
- package/package.json +17 -14
- package/dist/agent-copy-CY9_RkHN.js +0 -32
|
@@ -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
|
|
@@ -169,6 +169,21 @@ html:where(.vh-docs).dark .shiki span {
|
|
|
169
169
|
overflow-wrap: break-word;
|
|
170
170
|
}
|
|
171
171
|
|
|
172
|
+
/* A guide sits in a `ui-sdk` scope root, where the kit underlines plain links and boxes code. Its prose keeps the docs look. */
|
|
173
|
+
@layer kit {
|
|
174
|
+
.vh-docs-workspace .vh-ws-guide-content a:not([data-slot]) {
|
|
175
|
+
color: inherit;
|
|
176
|
+
text-decoration: inherit;
|
|
177
|
+
}
|
|
178
|
+
|
|
179
|
+
.vh-docs-workspace .vh-ws-guide-content pre code {
|
|
180
|
+
padding: 0;
|
|
181
|
+
border-radius: 0;
|
|
182
|
+
background: none;
|
|
183
|
+
font-size: inherit;
|
|
184
|
+
}
|
|
185
|
+
}
|
|
186
|
+
|
|
172
187
|
/* On a home page, the Markdown between the app's blocks keeps the reading measure and the gutter of a docs page. */
|
|
173
188
|
.vh-docs-home-prose {
|
|
174
189
|
width: 100%;
|
package/dist/server.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { a as createDocsContent, c as checkDocsLinks, i as DocsSourceInput, n as DocsManifestOptions, o as createDocsManifest, r as DocsSource, s as DocsLinkCheckOptions, t as DocsContentSource } from "./manifest-
|
|
2
|
-
import { a as docsSearchSections, i as docsMarkdown, n as DocsParserOptions, r as createDocsParser, t as DocsDocument } from "./markdown-
|
|
3
|
-
import { n as DocsPageResponse, r as docsPageResponse, t as DocsPageLink } from "./page-
|
|
1
|
+
import { a as createDocsContent, c as checkDocsLinks, i as DocsSourceInput, n as DocsManifestOptions, o as createDocsManifest, r as DocsSource, s as DocsLinkCheckOptions, t as DocsContentSource } from "./manifest-DmITPRKL.js";
|
|
2
|
+
import { a as docsSearchSections, i as docsMarkdown, n as DocsParserOptions, r as createDocsParser, t as DocsDocument } from "./markdown-Ul8Z9B5A.js";
|
|
3
|
+
import { n as DocsPageResponse, r as docsPageResponse, t as DocsPageLink } from "./page-Cp7sifcg.js";
|
|
4
4
|
type RawMarkdownOptions = {
|
|
5
5
|
/** Origin that site-relative links point to, such as `https://vitehub.dev`. Empty keeps them relative. */
|
|
6
6
|
siteUrl?: string;
|
package/dist/server.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { l as checkDocsLinks, n as createDocsContent, r as createDocsManifest } from "./manifest-
|
|
1
|
+
import { l as checkDocsLinks, n as createDocsContent, r as createDocsManifest } from "./manifest-CQMreQZ5.js";
|
|
2
2
|
import { a as docsSearchSections, i as docsMarkdown, t as createDocsParser } from "./markdown-BzZkYb24.js";
|
|
3
|
-
import { t as toRawMarkdown } from "./raw-
|
|
3
|
+
import { t as toRawMarkdown } from "./raw-Dh38kL9g.js";
|
|
4
4
|
import { i as docsPageResponse } from "./page-DWsretqk.js";
|
|
5
5
|
export { checkDocsLinks, createDocsContent, createDocsManifest, createDocsParser, docsMarkdown, docsPageResponse, docsSearchSections, toRawMarkdown };
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { c as DocsConnectProvider } from "./types-
|
|
1
|
+
import { c as DocsConnectProvider } from "./types-Dl6yjlwV.js";
|
|
2
2
|
import { WorkspaceRenderContext, WorkspaceRenderResult } from "@vite-hub/ui/workspace";
|
|
3
3
|
import { Component } from "vue";
|
|
4
4
|
/** Text files of an app, keyed by a relative path such as `server/api/greet.post.ts`. */
|
|
@@ -212,7 +212,7 @@ function docsUi(siteName) {
|
|
|
212
212
|
indicator: "inset-y-auto -bottom-px h-px bg-(--ui-text-highlighted) shadow-none",
|
|
213
213
|
trigger: "h-8 px-2.5 py-0 text-muted data-[state=active]:text-highlighted hover:bg-transparent hover:text-highlighted"
|
|
214
214
|
} },
|
|
215
|
-
code: { base: "inline box-decoration-clone wrap-break-word rounded-md border-0 bg-muted px-[0.35em] py-[0.1em] font-mono text-[0.8125rem]/[1.6] text-highlighted ring ring-inset ring-default" },
|
|
215
|
+
code: { base: "inline box-decoration-clone wrap-break-word rounded-md border-0 bg-muted px-[0.35em] py-[0.1em] font-mono text-[0.8125rem]/[1.6] text-highlighted ring ring-inset ring-default data-nowrap:inline-block data-nowrap:w-max data-nowrap:max-w-full data-nowrap:wrap-anywhere" },
|
|
216
216
|
pre: { slots: {
|
|
217
217
|
root: "relative my-5 group",
|
|
218
218
|
header: "flex items-center gap-1.5 border border-default bg-muted border-b-0 relative rounded-t-lg ps-4 pe-12 py-2.5 text-[0.8125rem]",
|
package/dist/theme.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export { t as docsAppConfigUi, n as docsThemeAdditions, i as docsThemeScope, r as docsUi } from "./theme-
|
|
1
|
+
export { t as docsAppConfigUi, n as docsThemeAdditions, i as docsThemeScope, r as docsUi } from "./theme-DRktv19v.js";
|
|
@@ -269,5 +269,7 @@ interface DocsSearchSection {
|
|
|
269
269
|
keywords?: string[];
|
|
270
270
|
/** `false` on the one record of a page that search engines skip, such as a generated error code page. */
|
|
271
271
|
indexed?: false;
|
|
272
|
+
/** `true` on the records of a panel's Overview and the pages inside the panel, such as the diagnostics of a section. */
|
|
273
|
+
panel?: true;
|
|
272
274
|
}
|
|
273
275
|
export { docsPageFields as _, DocsSearchSection as a, expandDottedKeys as b, DocsConnectProvider as c, DocsPageFrontmatter as d, DocsPageNavigation as f, docsLayouts as g, DocsSectionFile as h, DocsPageWorkspace as i, DocsLayout as l, DocsPlaygroundTab as m, DocsManifest as n, DocsSection as o, DocsPlaygroundExample as p, DocsPage as r, DocsTocLink as s, DocsAppPage as t, DocsPageFile as u, docsPageSchema as v, docsSectionSchema as y };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@vite-hub/docs",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.7.0",
|
|
4
4
|
"description": "A documentation site on ViteHub primitives: typed Markdown pages, navigation, tutorials, search, agent resources, Console editing, and a docs assistant.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"content",
|
|
@@ -71,15 +71,18 @@
|
|
|
71
71
|
"@nuxt/fonts": "^1.2.0",
|
|
72
72
|
"@nuxt/kit": "4.6.4",
|
|
73
73
|
"@takumi-rs/core": "2.22.1",
|
|
74
|
-
"@
|
|
75
|
-
"@
|
|
76
|
-
"@vite-hub/
|
|
77
|
-
"@vite-hub/
|
|
78
|
-
"@vite-hub/
|
|
79
|
-
"@vite-hub/
|
|
74
|
+
"@ui-sdk/core": "0.1.0-beta.20",
|
|
75
|
+
"@ui-sdk/vue": "0.1.0-beta.20",
|
|
76
|
+
"@vite-hub/content": "0.7.0",
|
|
77
|
+
"@vite-hub/kit": "0.7.0",
|
|
78
|
+
"@vite-hub/rate-limit": "0.7.0",
|
|
79
|
+
"@vite-hub/source": "0.7.0",
|
|
80
|
+
"@vite-hub/ui": "0.7.0",
|
|
81
|
+
"@vite-hub/web-container": "0.7.0",
|
|
82
|
+
"@vite-hub/workspace": "0.7.0",
|
|
80
83
|
"@vueuse/core": "^15.0.0",
|
|
81
84
|
"comark-content": "0.5.1",
|
|
82
|
-
"comark-zoom": "^0.
|
|
85
|
+
"comark-zoom": "^0.14.3",
|
|
83
86
|
"defu": "^6.1.7",
|
|
84
87
|
"nostics": "1.4.0",
|
|
85
88
|
"nuxt-agent-discovery": "^0.8.2",
|
|
@@ -100,12 +103,12 @@
|
|
|
100
103
|
"@nuxt/ui": "^4.13.0",
|
|
101
104
|
"@types/node": "^24.19.2",
|
|
102
105
|
"@vue/test-utils": "2.6.0",
|
|
103
|
-
"@vite-hub/agent": "0.
|
|
104
|
-
"@vite-hub/gateways": "0.
|
|
106
|
+
"@vite-hub/agent": "0.7.0",
|
|
107
|
+
"@vite-hub/gateways": "0.7.0",
|
|
105
108
|
"@vite-hub/icons": "0.1.0",
|
|
106
109
|
"@vite-hub/internal": "0.0.1",
|
|
107
110
|
"comark": "^0.9.2",
|
|
108
|
-
"comark-ui": "^0.
|
|
111
|
+
"comark-ui": "^0.14.3",
|
|
109
112
|
"h3": "^2.0.8",
|
|
110
113
|
"happy-dom": "21.0.4",
|
|
111
114
|
"linkedom": "^0.18.15",
|
|
@@ -125,10 +128,10 @@
|
|
|
125
128
|
"@comark/html": "^0.8.1 || ^0.9.0",
|
|
126
129
|
"@comark/vue": "^0.8.1 || ^0.9.0",
|
|
127
130
|
"@nuxt/ui": "^4.11.0",
|
|
128
|
-
"@vite-hub/agent": "0.
|
|
129
|
-
"@vite-hub/gateways": "0.
|
|
131
|
+
"@vite-hub/agent": "0.7.0",
|
|
132
|
+
"@vite-hub/gateways": "0.7.0",
|
|
130
133
|
"comark": "^0.8.1 || ^0.9.0",
|
|
131
|
-
"comark-ui": "^0.
|
|
134
|
+
"comark-ui": "^0.14.3",
|
|
132
135
|
"nuxt": "^4.7.0 || >=5.0.0-0",
|
|
133
136
|
"vue": "^3.5.0"
|
|
134
137
|
},
|