@vite-hub/docs 0.0.0-stage → 0.3.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 +453 -2
- package/dist/agent-copy-BJp_Yf5d.js +33 -0
- package/dist/assistant-shared-CdtXowot.js +97 -0
- package/dist/assistant-shared-Dll_F_yy.d.ts +27 -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-9CINWiRf.js +171 -0
- package/dist/draft-DUBx--r9.js +45 -0
- package/dist/error-diagnostics-BoOsP6Y4.js +53 -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-D66AEF8F.js +420 -0
- package/dist/manifest-Dzp5-_AJ.d.ts +74 -0
- package/dist/markdown-Cn9-4oVG.js +378 -0
- package/dist/navigation.d.ts +284 -0
- package/dist/navigation.js +520 -0
- package/dist/nuxt-B5LrERKc.d.ts +240 -0
- package/dist/nuxt.d.ts +3 -0
- package/dist/nuxt.js +1485 -0
- package/dist/page-BbmSfZO8.js +81 -0
- package/dist/page-Dx2JD3y1.d.ts +74 -0
- package/dist/primitive-rail.d.ts +110 -0
- package/dist/primitive-rail.js +284 -0
- package/dist/raw-C03EUJKw.js +851 -0
- package/dist/redirects-BrbWFSzW.js +62 -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/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 +141 -3
|
@@ -0,0 +1,260 @@
|
|
|
1
|
+
<script setup lang="ts">
|
|
2
|
+
import examples from "#docs/examples"
|
|
3
|
+
|
|
4
|
+
// `:::example`: a preview with its source a switch away, and an optional link that opens it in a playground. Around a
|
|
5
|
+
// Markdown code block, the parser put the rendered Markdown in an `example-preview` node before the source. With
|
|
6
|
+
// `name`, the preview is the Vue file of that name in the examples folder, and the parser made its source the code.
|
|
7
|
+
const props = defineProps<{
|
|
8
|
+
label?: string
|
|
9
|
+
/** A playground URL that opens this example. */
|
|
10
|
+
play?: string
|
|
11
|
+
/** A Vue file in the examples folder, without `.vue`. */
|
|
12
|
+
name?: string
|
|
13
|
+
/** The height, in rem, that a Vue example keeps before its module loads. Markdown writes it as a string. */
|
|
14
|
+
height?: number | string
|
|
15
|
+
/** Show a Vue example edge to edge, at a fixed height, for chats and dashboards. */
|
|
16
|
+
flush?: boolean
|
|
17
|
+
/** Show a Reset control that mounts a Vue example again with its first state. */
|
|
18
|
+
reset?: boolean
|
|
19
|
+
}>()
|
|
20
|
+
|
|
21
|
+
// `::examples` passes its view in, so the next tab opens in the view the reader picked.
|
|
22
|
+
const view = defineModel<"preview" | "code">("view", { default: "preview" })
|
|
23
|
+
const loader = props.name ? examples[props.name] : undefined
|
|
24
|
+
const live = loader ? defineAsyncComponent(loader) : undefined
|
|
25
|
+
const mounts = ref(0)
|
|
26
|
+
const seg = useTemplateRef<HTMLElement>("seg")
|
|
27
|
+
const thumb = ref<{ left: number, width: number, slide: boolean } | null>(null)
|
|
28
|
+
|
|
29
|
+
// The thumb slides under the pressed button. Its place is measured, because "Preview" and "Code" differ in width.
|
|
30
|
+
function place(slide = false) {
|
|
31
|
+
const button = seg.value?.querySelector<HTMLElement>(`[data-view="${view.value}"]`)
|
|
32
|
+
if (button?.offsetWidth) thumb.value = { left: button.offsetLeft, width: button.offsetWidth, slide }
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
// A switch in a hidden tab measures zero, so it's placed again, without sliding, whenever its size changes: when its
|
|
36
|
+
// tab opens or the font loads.
|
|
37
|
+
let resizes: ResizeObserver | undefined
|
|
38
|
+
watch(view, () => nextTick(() => place(true)))
|
|
39
|
+
onMounted(() => {
|
|
40
|
+
resizes = new ResizeObserver(() => place())
|
|
41
|
+
if (seg.value) resizes.observe(seg.value)
|
|
42
|
+
})
|
|
43
|
+
onBeforeUnmount(() => resizes?.disconnect())
|
|
44
|
+
</script>
|
|
45
|
+
|
|
46
|
+
<template>
|
|
47
|
+
<div class="vh-example" :data-view="view">
|
|
48
|
+
<div class="vh-example-bar">
|
|
49
|
+
<p v-if="$slots.title" class="vh-example-title"><slot name="title" /></p>
|
|
50
|
+
<a v-if="play" :href="play" class="vh-example-play">
|
|
51
|
+
<UIcon name="i-lucide-flask-conical" class="size-3.5" />
|
|
52
|
+
Playground
|
|
53
|
+
</a>
|
|
54
|
+
<button v-if="live && reset" type="button" class="vh-example-play" @click="mounts++">
|
|
55
|
+
<UIcon name="i-lucide-rotate-ccw" class="size-3.5" />
|
|
56
|
+
Reset
|
|
57
|
+
</button>
|
|
58
|
+
<div ref="seg" class="vh-seg" role="group" aria-label="View">
|
|
59
|
+
<span v-if="thumb" class="vh-seg-thumb" :class="{ 'is-still': !thumb.slide }" :style="{ transform: `translateX(${thumb.left - 3}px)`, width: `${thumb.width}px` }" aria-hidden="true" />
|
|
60
|
+
<button type="button" data-focus-inset data-view="preview" :aria-pressed="view === 'preview'" :class="{ 'is-unmeasured': !thumb }" @click="view = 'preview'">Preview</button>
|
|
61
|
+
<button type="button" data-focus-inset data-view="code" :aria-pressed="view === 'code'" :class="{ 'is-unmeasured': !thumb }" @click="view = 'code'">Code</button>
|
|
62
|
+
</div>
|
|
63
|
+
</div>
|
|
64
|
+
<div class="vh-example-body">
|
|
65
|
+
<div
|
|
66
|
+
v-if="live"
|
|
67
|
+
class="docs-example-preview vh-example-live"
|
|
68
|
+
:class="{ 'is-flush': flush }"
|
|
69
|
+
:style="height ? { '--vh-example-height': `${height}rem` } : undefined"
|
|
70
|
+
>
|
|
71
|
+
<Suspense>
|
|
72
|
+
<component :is="live" :key="mounts" />
|
|
73
|
+
<template #fallback>
|
|
74
|
+
<div role="status" class="vh-example-loading">Loading preview…</div>
|
|
75
|
+
</template>
|
|
76
|
+
</Suspense>
|
|
77
|
+
</div>
|
|
78
|
+
<slot />
|
|
79
|
+
</div>
|
|
80
|
+
</div>
|
|
81
|
+
</template>
|
|
82
|
+
|
|
83
|
+
<style scoped>
|
|
84
|
+
.vh-example {
|
|
85
|
+
margin-block: 1.5rem;
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
/* A lone example puts its controls above the frame, at the right. In a group of examples they join the tab row. */
|
|
89
|
+
.vh-example-bar {
|
|
90
|
+
display: flex;
|
|
91
|
+
align-items: center;
|
|
92
|
+
justify-content: flex-end;
|
|
93
|
+
gap: 0.75rem;
|
|
94
|
+
margin-bottom: 0.5rem;
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
/* A title, such as Correct or Incorrect on a lint rule's examples, leads the bar. */
|
|
98
|
+
.vh-example-title {
|
|
99
|
+
display: inline-flex;
|
|
100
|
+
align-items: center;
|
|
101
|
+
gap: 0.375rem;
|
|
102
|
+
margin: 0 auto 0 0;
|
|
103
|
+
color: var(--ui-text-highlighted);
|
|
104
|
+
font-size: 0.875rem;
|
|
105
|
+
font-weight: 500;
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
.vh-example-play {
|
|
109
|
+
display: inline-flex;
|
|
110
|
+
align-items: center;
|
|
111
|
+
gap: 0.35rem;
|
|
112
|
+
color: var(--ui-text-dimmed);
|
|
113
|
+
font-size: 0.75rem;
|
|
114
|
+
font-weight: 500;
|
|
115
|
+
transition: color 150ms ease;
|
|
116
|
+
}
|
|
117
|
+
|
|
118
|
+
@media (hover: hover) {
|
|
119
|
+
.vh-example-play:hover {
|
|
120
|
+
color: var(--ui-text-highlighted);
|
|
121
|
+
}
|
|
122
|
+
}
|
|
123
|
+
|
|
124
|
+
/* A segmented switch: a muted track and a raised thumb that slides to the pressed button. */
|
|
125
|
+
.vh-seg {
|
|
126
|
+
position: relative;
|
|
127
|
+
display: inline-flex;
|
|
128
|
+
border-radius: calc(var(--ui-radius) * 2);
|
|
129
|
+
background: var(--ui-bg-elevated);
|
|
130
|
+
padding: 3px;
|
|
131
|
+
}
|
|
132
|
+
|
|
133
|
+
.vh-seg-thumb {
|
|
134
|
+
position: absolute;
|
|
135
|
+
top: 3px;
|
|
136
|
+
bottom: 3px;
|
|
137
|
+
left: 3px;
|
|
138
|
+
border-radius: 6px;
|
|
139
|
+
background: var(--vh-raised);
|
|
140
|
+
box-shadow: 0 0 0 1px var(--ui-border);
|
|
141
|
+
transition: transform 200ms var(--vh-ease-out), width 200ms var(--vh-ease-out);
|
|
142
|
+
}
|
|
143
|
+
|
|
144
|
+
.vh-seg button {
|
|
145
|
+
position: relative;
|
|
146
|
+
border-radius: 6px;
|
|
147
|
+
padding: 0.2rem 0.65rem;
|
|
148
|
+
color: var(--ui-text-muted);
|
|
149
|
+
font-size: 0.75rem;
|
|
150
|
+
font-weight: 500;
|
|
151
|
+
line-height: 1.5;
|
|
152
|
+
transition: color 150ms ease;
|
|
153
|
+
}
|
|
154
|
+
|
|
155
|
+
/* Before the thumb is measured, the pressed button carries the raised surface itself. */
|
|
156
|
+
.vh-seg button.is-unmeasured[aria-pressed="true"] {
|
|
157
|
+
background: var(--vh-raised);
|
|
158
|
+
box-shadow: 0 0 0 1px var(--ui-border);
|
|
159
|
+
}
|
|
160
|
+
|
|
161
|
+
.vh-seg button[aria-pressed="true"] {
|
|
162
|
+
color: var(--ui-text-highlighted);
|
|
163
|
+
}
|
|
164
|
+
|
|
165
|
+
@media (hover: hover) {
|
|
166
|
+
.vh-seg button:hover {
|
|
167
|
+
color: var(--ui-text-highlighted);
|
|
168
|
+
}
|
|
169
|
+
}
|
|
170
|
+
|
|
171
|
+
|
|
172
|
+
/* Touch screens get 44px targets. */
|
|
173
|
+
@media (pointer: coarse) {
|
|
174
|
+
.vh-seg button {
|
|
175
|
+
min-height: 2.75rem;
|
|
176
|
+
padding: 0.45rem 0.85rem;
|
|
177
|
+
}
|
|
178
|
+
|
|
179
|
+
.vh-example-play {
|
|
180
|
+
min-height: 2.75rem;
|
|
181
|
+
}
|
|
182
|
+
}
|
|
183
|
+
|
|
184
|
+
.vh-seg-thumb.is-still {
|
|
185
|
+
transition: none;
|
|
186
|
+
}
|
|
187
|
+
|
|
188
|
+
@media (prefers-reduced-motion: reduce) {
|
|
189
|
+
.vh-seg-thumb {
|
|
190
|
+
transition: none;
|
|
191
|
+
}
|
|
192
|
+
}
|
|
193
|
+
|
|
194
|
+
/* The preview sits in a hairline frame. The source shows in its own code block. */
|
|
195
|
+
.vh-example[data-view="preview"] > .vh-example-body:has(> .docs-example-preview) > :deep(:not(.docs-example-preview)),
|
|
196
|
+
.vh-example[data-view="code"] > .vh-example-body > :deep(.docs-example-preview) {
|
|
197
|
+
display: none;
|
|
198
|
+
}
|
|
199
|
+
|
|
200
|
+
.vh-example-body > :deep(.docs-example-preview) {
|
|
201
|
+
border-radius: calc(var(--ui-radius) * 2);
|
|
202
|
+
box-shadow: 0 0 0 1px var(--ui-border);
|
|
203
|
+
padding: 1.25rem 1.5rem;
|
|
204
|
+
}
|
|
205
|
+
|
|
206
|
+
/* Blocks add their own `style` and `script` elements, which aren't the first or last thing a reader sees. */
|
|
207
|
+
.vh-example-body > :deep(.docs-example-preview > :nth-child(1 of :not(style, script))) {
|
|
208
|
+
margin-top: 0;
|
|
209
|
+
}
|
|
210
|
+
|
|
211
|
+
.vh-example-body > :deep(.docs-example-preview > :nth-last-child(1 of :not(style, script))) {
|
|
212
|
+
margin-bottom: 0;
|
|
213
|
+
}
|
|
214
|
+
|
|
215
|
+
/* A block that draws its own frame marks its root with `data-comark-frame` and needs no second one around it, so a
|
|
216
|
+
preview that holds only such blocks drops its ring and padding and stacks them with a gap. comark-ui's charts and
|
|
217
|
+
tables don't carry the marker, and a plain `figure`, `pre`, or `table` frames itself too. A block that only has an
|
|
218
|
+
HTML renderer arrives in a `.comark-html` wrapper, so its direct children are checked for the marker as well.
|
|
219
|
+
Only in the Preview view: these rules come after the one that hides the preview and are as specific, so they would win. */
|
|
220
|
+
.vh-example[data-view="preview"] > .vh-example-body > :deep(.docs-example-preview:not(:has(> :not(style, script, .comark-html, [data-comark-frame], .cch, .ctb, figure, pre, table))):not(:has(> .comark-html > :not(style, script, [data-comark-frame], .cch, .ctb, figure, pre, table)))),
|
|
221
|
+
.vh-example[data-view="preview"] > .vh-example-body > :deep(.docs-example-preview:has(> p > :is(.cm-video, .cm-audio))) {
|
|
222
|
+
display: flex;
|
|
223
|
+
flex-direction: column;
|
|
224
|
+
gap: 1rem;
|
|
225
|
+
box-shadow: none;
|
|
226
|
+
padding: 0;
|
|
227
|
+
}
|
|
228
|
+
|
|
229
|
+
.vh-example-body > :deep(.docs-example-preview > :is([data-comark-frame], .cch, .ctb)),
|
|
230
|
+
.vh-example-body > :deep(.docs-example-preview > .comark-html > [data-comark-frame]) {
|
|
231
|
+
margin-block: 0;
|
|
232
|
+
}
|
|
233
|
+
|
|
234
|
+
.vh-example-body > :deep(:not(.docs-example-preview)) {
|
|
235
|
+
margin-block: 0;
|
|
236
|
+
}
|
|
237
|
+
|
|
238
|
+
/* A Vue example keeps its height before its module loads. The height is a minimum, so text that wraps on a narrow
|
|
239
|
+
screen grows the frame. A flush example fills a fixed height edge to edge, as a chat fills its parent. */
|
|
240
|
+
.vh-example-live {
|
|
241
|
+
min-width: 0;
|
|
242
|
+
min-height: calc(var(--vh-example-height, 0rem) + 2.5rem);
|
|
243
|
+
overflow-x: auto;
|
|
244
|
+
}
|
|
245
|
+
|
|
246
|
+
.vh-example-live.is-flush {
|
|
247
|
+
height: var(--vh-example-height, auto);
|
|
248
|
+
min-height: 0;
|
|
249
|
+
overflow: hidden;
|
|
250
|
+
padding: 0;
|
|
251
|
+
}
|
|
252
|
+
|
|
253
|
+
.vh-example-loading {
|
|
254
|
+
display: grid;
|
|
255
|
+
min-height: var(--vh-example-height, 4rem);
|
|
256
|
+
place-items: center;
|
|
257
|
+
color: var(--ui-text-muted);
|
|
258
|
+
font-size: 0.875rem;
|
|
259
|
+
}
|
|
260
|
+
</style>
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
<script setup lang="ts">
|
|
2
|
+
// `::examples`: one tab per `:::example`. Each example's Playground link and Preview and Code switch sit at the end of
|
|
3
|
+
// the tab row.
|
|
4
|
+
import type { VNode } from "vue"
|
|
5
|
+
|
|
6
|
+
const slots = useSlots()
|
|
7
|
+
const items = computed(() => (slots.default?.() ?? []).filter((node: VNode) => typeof node.type === "object"))
|
|
8
|
+
const labels = computed(() => items.value.map((node, at) => String(node.props?.label ?? `Example ${at + 1}`)))
|
|
9
|
+
const active = ref(0)
|
|
10
|
+
// Mount each preview on first use, then retain its state between tabs.
|
|
11
|
+
const opened = ref(new Set([0]))
|
|
12
|
+
// One view for every example, so Code stays on when the reader changes tabs.
|
|
13
|
+
const view = ref<"preview" | "code">("preview")
|
|
14
|
+
const tabs = computed(() => labels.value.map((label, at) => ({ label, value: at })))
|
|
15
|
+
|
|
16
|
+
watch(active, (at) => opened.value.add(at))
|
|
17
|
+
</script>
|
|
18
|
+
|
|
19
|
+
<template>
|
|
20
|
+
<div class="vh-examples">
|
|
21
|
+
<UTabs v-model="active" :items="tabs" :content="false" class="vh-examples-tabs" aria-label="Examples" />
|
|
22
|
+
<div
|
|
23
|
+
v-for="(item, at) in items"
|
|
24
|
+
v-show="at === active"
|
|
25
|
+
:key="at"
|
|
26
|
+
role="tabpanel"
|
|
27
|
+
:aria-label="labels[at]"
|
|
28
|
+
class="vh-examples-panel"
|
|
29
|
+
>
|
|
30
|
+
<component :is="item" v-if="opened.has(at)" v-model:view="view" />
|
|
31
|
+
</div>
|
|
32
|
+
</div>
|
|
33
|
+
</template>
|
|
34
|
+
|
|
35
|
+
<style scoped>
|
|
36
|
+
.vh-examples {
|
|
37
|
+
position: relative;
|
|
38
|
+
margin: 2.5rem 0 1.5rem;
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
/* The theme's underline tabs. Room is kept at the end for the controls of the open example. */
|
|
42
|
+
.vh-examples-tabs {
|
|
43
|
+
margin: 0 15.5rem 0.75rem 0;
|
|
44
|
+
overflow-x: auto;
|
|
45
|
+
scrollbar-width: none;
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
.vh-examples-panel > :deep(.vh-example) {
|
|
49
|
+
margin-block: 0;
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
.vh-examples-panel :deep(.vh-example-bar) {
|
|
53
|
+
position: absolute;
|
|
54
|
+
top: 0.3rem;
|
|
55
|
+
right: 0;
|
|
56
|
+
margin: 0;
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
/* On a narrow page the controls take their own row under the tabs. */
|
|
60
|
+
@media (width < 40rem) {
|
|
61
|
+
.vh-examples-tabs {
|
|
62
|
+
margin-right: 0;
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
.vh-examples-panel :deep(.vh-example-bar) {
|
|
66
|
+
position: static;
|
|
67
|
+
margin-bottom: 0.5rem;
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
</style>
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
<script setup lang="ts">
|
|
2
|
+
// `::incorrect`: an example titled Incorrect, such as Markdown that a lint rule reports. `title` or the `#title` slot renames it.
|
|
3
|
+
import Example from "./Example.vue"
|
|
4
|
+
|
|
5
|
+
defineOptions({ inheritAttrs: false })
|
|
6
|
+
defineProps<{ title?: string }>()
|
|
7
|
+
</script>
|
|
8
|
+
|
|
9
|
+
<template>
|
|
10
|
+
<Example v-bind="$attrs">
|
|
11
|
+
<template #title>
|
|
12
|
+
<UIcon name="i-lucide-circle-x" class="size-4" :style="{ color: 'var(--ui-error)' }" aria-hidden="true" />
|
|
13
|
+
<slot name="title">{{ title ?? "Incorrect" }}</slot>
|
|
14
|
+
</template>
|
|
15
|
+
<slot />
|
|
16
|
+
</Example>
|
|
17
|
+
</template>
|
|
@@ -0,0 +1,206 @@
|
|
|
1
|
+
<script setup lang="ts">
|
|
2
|
+
import { docsPanelOf, docsPanelPages } from "#docs/navigation"
|
|
3
|
+
|
|
4
|
+
// `::page-list` lists the pages of a section under their sidebar groups, each with its icon and description, so an
|
|
5
|
+
// Overview can link every page without keeping a list by hand. On a panel Overview it lists the pages of the panel.
|
|
6
|
+
// Its own content is the list agents read in the Markdown copy; the site leaves it out.
|
|
7
|
+
const props = defineProps<{
|
|
8
|
+
/** The section to list, by id. Defaults to the section of the page. */
|
|
9
|
+
section?: string
|
|
10
|
+
/** One sidebar group to list, such as `Runtime errors`. */
|
|
11
|
+
group?: string
|
|
12
|
+
/** Sidebar groups to leave out, comma-separated, such as `Start`. */
|
|
13
|
+
exclude?: string
|
|
14
|
+
/**
|
|
15
|
+
* One line per page without icons, for long lists such as one page per error code. It renders a tenth of the markup
|
|
16
|
+
* of a Markdown table, so a list of a thousand pages stays far below the 2 MB that crawlers read.
|
|
17
|
+
*/
|
|
18
|
+
compact?: boolean
|
|
19
|
+
}>()
|
|
20
|
+
|
|
21
|
+
const manifest = useDocsManifest()
|
|
22
|
+
const current = useDocsSection()
|
|
23
|
+
const page = useDocsPage()
|
|
24
|
+
const icons = useDocsIcons()
|
|
25
|
+
const groups = computed(() => {
|
|
26
|
+
const section = props.section ? manifest.sections.find(candidate => candidate.id === props.section) : current.value
|
|
27
|
+
const exclude = new Set((props.exclude ?? "").split(",").map(name => name.trim()).filter(Boolean))
|
|
28
|
+
// Pages in the panel of the current page, or outside every panel: the section sidebar links each panel once.
|
|
29
|
+
const panel = section && !props.section && page.value ? docsPanelOf(section, page.value.page) : null
|
|
30
|
+
const grouped = new Map<string, NonNullable<typeof section>["pages"]>()
|
|
31
|
+
const pages = !section ? [] : panel ? docsPanelPages(section, panel) : section.pages.filter(candidate => candidate.panel || !docsPanelOf(section, candidate))
|
|
32
|
+
for (const candidate of pages) {
|
|
33
|
+
const label = candidate.group?.trim() ?? ""
|
|
34
|
+
if (candidate.navigation === false || candidate.path === page.value?.page.path || exclude.has(label)) continue
|
|
35
|
+
if (props.group !== undefined && label !== props.group) continue
|
|
36
|
+
grouped.set(label, [...(grouped.get(label) ?? []), candidate])
|
|
37
|
+
}
|
|
38
|
+
return [...grouped].map(([label, pages]) => ({ label, pages }))
|
|
39
|
+
})
|
|
40
|
+
</script>
|
|
41
|
+
|
|
42
|
+
<template>
|
|
43
|
+
<div v-if="compact" class="vh-page-list">
|
|
44
|
+
<section v-for="group in groups" :key="group.label">
|
|
45
|
+
<h3 v-if="group.label && group.label !== props.group" class="vh-page-list-group">{{ group.label }}</h3>
|
|
46
|
+
<ul class="vh-page-list-compact">
|
|
47
|
+
<li v-for="item in group.pages" :key="item.path">
|
|
48
|
+
<NuxtLink :to="item.path">{{ item.title }}</NuxtLink>
|
|
49
|
+
<span v-if="item.description">{{ item.description }}</span>
|
|
50
|
+
</li>
|
|
51
|
+
</ul>
|
|
52
|
+
</section>
|
|
53
|
+
</div>
|
|
54
|
+
<div v-else class="vh-page-list">
|
|
55
|
+
<section v-for="group in groups" :key="group.label">
|
|
56
|
+
<h3 v-if="group.label" class="vh-page-list-group">{{ group.label }}</h3>
|
|
57
|
+
<ul>
|
|
58
|
+
<li v-for="item in group.pages" :key="item.path">
|
|
59
|
+
<NuxtLink :to="item.path" class="vh-page-list-link">
|
|
60
|
+
<span class="vh-page-list-icon">
|
|
61
|
+
<UIcon :name="icons.page(item)" class="size-4" aria-hidden="true" />
|
|
62
|
+
</span>
|
|
63
|
+
<span class="vh-page-list-text">
|
|
64
|
+
<span class="vh-page-list-title">{{ item.title }}</span>
|
|
65
|
+
<span v-if="item.description" class="vh-page-list-description">{{ item.description }}</span>
|
|
66
|
+
</span>
|
|
67
|
+
<UIcon name="i-lucide-arrow-right" class="vh-page-list-arrow size-4" aria-hidden="true" />
|
|
68
|
+
</NuxtLink>
|
|
69
|
+
</li>
|
|
70
|
+
</ul>
|
|
71
|
+
</section>
|
|
72
|
+
</div>
|
|
73
|
+
</template>
|
|
74
|
+
|
|
75
|
+
<style scoped>
|
|
76
|
+
/* One track no wider than the page, so a long description truncates instead of widening the list. */
|
|
77
|
+
.vh-page-list {
|
|
78
|
+
display: grid;
|
|
79
|
+
grid-template-columns: minmax(0, 1fr);
|
|
80
|
+
gap: 2rem;
|
|
81
|
+
margin-block: 2rem;
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
.vh-page-list-group {
|
|
85
|
+
margin: 0 0 0.5rem;
|
|
86
|
+
color: var(--ui-text-muted);
|
|
87
|
+
font-size: 0.75rem;
|
|
88
|
+
font-weight: 600;
|
|
89
|
+
letter-spacing: 0.08em;
|
|
90
|
+
text-transform: uppercase;
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
.vh-page-list ul {
|
|
94
|
+
margin: 0;
|
|
95
|
+
padding: 0;
|
|
96
|
+
list-style: none;
|
|
97
|
+
border-block: 1px solid var(--ui-border);
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
.vh-page-list li + li {
|
|
101
|
+
border-top: 1px solid var(--ui-border);
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
/* Plain elements under one class: a list of a thousand rows must not repeat a class on each element. */
|
|
105
|
+
.vh-page-list-compact li {
|
|
106
|
+
display: grid;
|
|
107
|
+
grid-template-columns: minmax(0, 14rem) minmax(0, 1fr);
|
|
108
|
+
gap: 0.25rem 1rem;
|
|
109
|
+
padding-block: 0.5rem;
|
|
110
|
+
font-size: 0.875rem;
|
|
111
|
+
line-height: 1.5rem;
|
|
112
|
+
}
|
|
113
|
+
|
|
114
|
+
.vh-page-list-compact a {
|
|
115
|
+
overflow-wrap: anywhere;
|
|
116
|
+
color: var(--ui-text-highlighted);
|
|
117
|
+
font-family: var(--font-mono);
|
|
118
|
+
font-size: 0.8125rem;
|
|
119
|
+
text-decoration: underline;
|
|
120
|
+
text-decoration-color: var(--ui-border);
|
|
121
|
+
text-underline-offset: 0.2em;
|
|
122
|
+
}
|
|
123
|
+
|
|
124
|
+
.vh-page-list-compact span {
|
|
125
|
+
color: var(--ui-text-muted);
|
|
126
|
+
}
|
|
127
|
+
|
|
128
|
+
@media (hover: hover) {
|
|
129
|
+
.vh-page-list-compact a:hover {
|
|
130
|
+
text-decoration-color: currentColor;
|
|
131
|
+
}
|
|
132
|
+
}
|
|
133
|
+
|
|
134
|
+
@media (max-width: 40rem) {
|
|
135
|
+
.vh-page-list-compact li {
|
|
136
|
+
grid-template-columns: minmax(0, 1fr);
|
|
137
|
+
}
|
|
138
|
+
}
|
|
139
|
+
|
|
140
|
+
.vh-page-list-link {
|
|
141
|
+
display: flex;
|
|
142
|
+
align-items: center;
|
|
143
|
+
gap: 0.75rem;
|
|
144
|
+
padding-block: 0.75rem;
|
|
145
|
+
color: inherit;
|
|
146
|
+
text-decoration: none;
|
|
147
|
+
transition: background-color 150ms ease;
|
|
148
|
+
}
|
|
149
|
+
|
|
150
|
+
|
|
151
|
+
.vh-page-list-icon {
|
|
152
|
+
display: grid;
|
|
153
|
+
flex: none;
|
|
154
|
+
place-items: center;
|
|
155
|
+
width: 2rem;
|
|
156
|
+
height: 2rem;
|
|
157
|
+
border: 1px solid var(--ui-border);
|
|
158
|
+
border-radius: var(--ui-radius);
|
|
159
|
+
background: var(--ui-bg-elevated);
|
|
160
|
+
color: var(--ui-text-muted);
|
|
161
|
+
}
|
|
162
|
+
|
|
163
|
+
.vh-page-list-text {
|
|
164
|
+
min-width: 0;
|
|
165
|
+
flex: 1;
|
|
166
|
+
}
|
|
167
|
+
|
|
168
|
+
.vh-page-list-title {
|
|
169
|
+
display: block;
|
|
170
|
+
color: var(--ui-text-highlighted);
|
|
171
|
+
font-size: 0.875rem;
|
|
172
|
+
font-weight: 500;
|
|
173
|
+
}
|
|
174
|
+
|
|
175
|
+
.vh-page-list-description {
|
|
176
|
+
display: block;
|
|
177
|
+
margin-top: 0.125rem;
|
|
178
|
+
overflow: hidden;
|
|
179
|
+
color: var(--ui-text-muted);
|
|
180
|
+
font-size: 0.75rem;
|
|
181
|
+
line-height: 1.25rem;
|
|
182
|
+
text-overflow: ellipsis;
|
|
183
|
+
white-space: nowrap;
|
|
184
|
+
}
|
|
185
|
+
|
|
186
|
+
.vh-page-list-arrow {
|
|
187
|
+
flex: none;
|
|
188
|
+
color: var(--ui-text-dimmed);
|
|
189
|
+
transition: transform 150ms ease, color 150ms ease;
|
|
190
|
+
}
|
|
191
|
+
|
|
192
|
+
@media (hover: hover) {
|
|
193
|
+
.vh-page-list-link:hover {
|
|
194
|
+
background: color-mix(in srgb, var(--ui-bg-elevated) 45%, transparent);
|
|
195
|
+
}
|
|
196
|
+
|
|
197
|
+
.vh-page-list-link:hover .vh-page-list-icon,
|
|
198
|
+
.vh-page-list-link:hover .vh-page-list-arrow {
|
|
199
|
+
color: var(--ui-text-highlighted);
|
|
200
|
+
}
|
|
201
|
+
|
|
202
|
+
.vh-page-list-link:hover .vh-page-list-arrow {
|
|
203
|
+
transform: translateX(2px);
|
|
204
|
+
}
|
|
205
|
+
}
|
|
206
|
+
</style>
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
<script setup lang="ts">
|
|
2
|
+
// A linked feature in the product landing list.
|
|
3
|
+
defineProps<{
|
|
4
|
+
title: string
|
|
5
|
+
/** Icon shown above the title. */
|
|
6
|
+
icon?: string
|
|
7
|
+
/** Docs page that explains the feature in full. */
|
|
8
|
+
to: string
|
|
9
|
+
}>()
|
|
10
|
+
</script>
|
|
11
|
+
|
|
12
|
+
<template>
|
|
13
|
+
<UPageCard :to="to" :icon="icon">
|
|
14
|
+
<!-- Each feature is a heading of the landing page, so readers can jump between them. -->
|
|
15
|
+
<template #title>
|
|
16
|
+
<h2>{{ title }}</h2>
|
|
17
|
+
</template>
|
|
18
|
+
<template #description>
|
|
19
|
+
<div class="vh-feature-description">
|
|
20
|
+
<slot />
|
|
21
|
+
</div>
|
|
22
|
+
</template>
|
|
23
|
+
</UPageCard>
|
|
24
|
+
</template>
|
|
25
|
+
|
|
26
|
+
<style scoped>
|
|
27
|
+
/* The sentence is Markdown, so its paragraph and inline code take the size of the card description. */
|
|
28
|
+
.vh-feature-description :deep(p) {
|
|
29
|
+
margin: 0;
|
|
30
|
+
font-size: inherit;
|
|
31
|
+
line-height: inherit;
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
.vh-feature-description :deep(code) {
|
|
35
|
+
display: inline;
|
|
36
|
+
border: 0;
|
|
37
|
+
border-radius: 0;
|
|
38
|
+
background: none;
|
|
39
|
+
padding: 0;
|
|
40
|
+
color: var(--ui-text-toned);
|
|
41
|
+
font-size: inherit;
|
|
42
|
+
}
|
|
43
|
+
</style>
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
<script setup lang="ts">
|
|
2
|
+
// `::product-features` is the feature list of a product landing page. Its default slot holds
|
|
3
|
+
// `:::product-feature-item` entries: one claim, one sentence, one link. No code: the hero carries the code.
|
|
4
|
+
defineProps<{
|
|
5
|
+
/** Optional heading above the list. */
|
|
6
|
+
title?: string
|
|
7
|
+
}>()
|
|
8
|
+
</script>
|
|
9
|
+
|
|
10
|
+
<template>
|
|
11
|
+
<section class="not-prose py-10">
|
|
12
|
+
<h2 v-if="title" class="mb-6 text-xl font-semibold text-highlighted">{{ title }}</h2>
|
|
13
|
+
<UPageGrid>
|
|
14
|
+
<slot />
|
|
15
|
+
</UPageGrid>
|
|
16
|
+
</section>
|
|
17
|
+
</template>
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
<script setup lang="ts">
|
|
2
|
+
defineProps<{
|
|
3
|
+
id?: string
|
|
4
|
+
title?: string
|
|
5
|
+
}>()
|
|
6
|
+
</script>
|
|
7
|
+
|
|
8
|
+
<template>
|
|
9
|
+
<section :id="id" class="vh-tutorial-step">
|
|
10
|
+
<slot />
|
|
11
|
+
</section>
|
|
12
|
+
</template>
|
|
13
|
+
|
|
14
|
+
<style scoped>
|
|
15
|
+
.vh-tutorial-step {
|
|
16
|
+
counter-increment: tutorial-step;
|
|
17
|
+
margin-block: 2.5rem;
|
|
18
|
+
scroll-margin-top: calc(var(--ui-header-height) + 2rem);
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
.vh-tutorial-step :deep(h2:first-child) {
|
|
22
|
+
display: flex;
|
|
23
|
+
align-items: baseline;
|
|
24
|
+
gap: 0.75rem;
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
.vh-tutorial-step :deep(h2:first-child)::before {
|
|
28
|
+
content: counter(tutorial-step) ".";
|
|
29
|
+
flex: none;
|
|
30
|
+
color: var(--ui-text-dimmed);
|
|
31
|
+
font-variant-numeric: tabular-nums;
|
|
32
|
+
font-size: 1rem;
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
.vh-tutorial-step :deep(pre) {
|
|
36
|
+
white-space: pre;
|
|
37
|
+
overflow-x: auto;
|
|
38
|
+
}
|
|
39
|
+
</style>
|