@vite-hub/docs 0.5.1 → 0.6.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/README.md CHANGED
@@ -356,6 +356,7 @@ Most changes are options in `nuxt.config.ts`:
356
356
  | `start` | None | `{ section, links }`: the section that new readers open first, and site pages listed at its top. |
357
357
  | `socials` | `[]` | Community links at the foot of the docs sidebar and in the header of other pages, or in its menu on narrow screens. |
358
358
  | `footer` | `[]` | Site pages linked at the end of every docs page, such as About and Privacy. |
359
+ | `builtWith` | `true` | A "Built with ViteHub Docs" line at the end of every docs page. `false` removes it. |
359
360
  | `banner` | None | One line above every docs page. |
360
361
  | `github` | `false` | `{ repo, branch, dir }`. Adds a GitHub link beside the socials, with the star count when available. |
361
362
  | `icons` | Lucide fallbacks | Icon maps of the rail and the sidebar. |
@@ -498,7 +499,7 @@ Product landing components become plain Markdown, with the hero tagline, hosts,
498
499
 
499
500
  Every page gets its title, description, canonical link, Open Graph and Twitter tags, Schema.org (`WebSite`, `WebPage`, `TechArticle`, and a breadcrumb), and a share image, from its frontmatter and the `site` options. [Nuxt SEO](https://nuxtseo.com) does the work: `nuxt-site-config` takes `site`, `nuxt-schema-org` writes the graph, and `nuxt-og-image` renders each image while the build prerenders, so the server carries no renderer and a Worker stays small. The default image shows the site, the section, the page title, and the description. A page sets `seo.image` to share a file of its own. For another design, add `components/OgImage/Docs.takumi.vue` with the props `title`, `description`, `site`, `section`, `logo`, and `host`, and set `ogImage: { component: "Docs" }`. An app page, such as a playground, calls `useDocsSeo({ title, description })` to get the same tags and image.
500
501
 
501
- Search indexes every page by heading. `⌘K` opens it. Page titles rank first, then headings, then text, and a typo still finds the page. The index loads the first time the dialog opens, from `/api/_docs/search.json`. `::agent-only` content is not indexed.
502
+ Search indexes every page by heading. `⌘K` opens it. Page titles rank first, then headings, then text, and a typo still finds the page. A production page loads the index from `/api/_docs/search.json` once it is idle, so the dialog has results at the first key press. With Save-Data on, and in development, the index loads when the dialog first opens. `::agent-only` content is not indexed.
502
503
 
503
504
  ## Comments
504
505
 
package/dist/index.d.ts CHANGED
@@ -1,7 +1,7 @@
1
1
  import { _ as docsPageFields, a as DocsSearchSection, b as expandDottedKeys, d as DocsPageFrontmatter, f as DocsPageNavigation, g as docsLayouts, h as DocsSectionFile, i as DocsPageWorkspace, l as DocsLayout, m as DocsPlaygroundTab, n as DocsManifest, o as DocsSection, p as DocsPlaygroundExample, r as DocsPage, s as DocsTocLink, t as DocsAppPage, u as DocsPageFile, v as docsPageSchema, y as docsSectionSchema } from "./types-B6YlHil4.js";
2
2
  import { t as DocsDocument } from "./markdown-B97RuMXs.js";
3
3
  import { n as DocsPageResponse, t as DocsPageLink } from "./page-B8_70-5D.js";
4
- import { a as DocsPublicConfig, d as DocsRunnableOptions, l as DocsRunnableExample, n as DocsLogo, o as DocsSiteOptions, r as DocsModuleOptions, s as DocsStartOptions, u as DocsRunnableLesson } from "./nuxt-CYAIBEHE.js";
4
+ import { a as DocsPublicConfig, d as DocsRunnableOptions, l as DocsRunnableExample, n as DocsLogo, o as DocsSiteOptions, r as DocsModuleOptions, s as DocsStartOptions, u as DocsRunnableLesson } from "./nuxt-CPt71DeE.js";
5
5
  import { DocsCatalogGroup, DocsGroup, DocsIcons, DocsLink, DocsMarkdownLinks, DocsPanelLoaders, DocsRailEntry, DocsSidebarGroup, DocsSidebarSection, DocsSidebarSectionBlock, docsCatalog, docsManifestPages, docsMarkdownLinks, docsMcpInstallLinks, docsPageIcon, docsRailEntries, docsRailEntry, docsRailGroups, docsRailIcon, docsRawPath, docsRelatedSections, docsSectionForPath, docsSectionGroup, docsSectionIcon, docsSidebarCollapses, docsSidebarGroups, docsSidebarSections, docsTutorialNavigationCookie, findDocsPage, isDocsWorkspaceLayout, normalizeDocsBase, normalizeDocsPath } from "./navigation.js";
6
6
  import { i as DocsSourceInput, r as DocsSource, t as DocsContentSource } from "./manifest-DJ2DyNue.js";
7
7
  import { ContentLabel, DocumentsDefinition } from "@vite-hub/content";
@@ -137,6 +137,8 @@ interface DocsModuleOptions {
137
137
  socials?: DocsLink[];
138
138
  /** Site pages linked at the end of every docs page, such as About and Privacy, so each one has a link to it. */
139
139
  footer?: DocsLink[];
140
+ /** A "Built with ViteHub Docs" line at the end of every docs page. `false` removes it. */
141
+ builtWith?: boolean;
140
142
  /** One line above every docs page, such as a release status. */
141
143
  banner?: string;
142
144
  /** More paths for `/sitemap.xml`, such as app pages outside the content folder. Every docs page is listed already. */
@@ -264,6 +266,7 @@ interface DocsPublicConfig {
264
266
  };
265
267
  socials: DocsLink[];
266
268
  footer: DocsLink[];
269
+ builtWith: boolean;
267
270
  banner: string | null;
268
271
  sitemap: string[];
269
272
  /** `stars` is the repository's star count when the build could read it, else `null`. */
package/dist/nuxt.d.ts CHANGED
@@ -1,3 +1,3 @@
1
- import { a as DocsPublicConfig, c as docsNuxtModule, d as DocsRunnableOptions, f as DocsCommentsOptions, i as DocsNuxtModule, l as DocsRunnableExample, n as DocsLogo, o as DocsSiteOptions, r as DocsModuleOptions, s as DocsStartOptions, t as DocsLlmsOptions, u as DocsRunnableLesson } from "./nuxt-CYAIBEHE.js";
1
+ import { a as DocsPublicConfig, c as docsNuxtModule, d as DocsRunnableOptions, f as DocsCommentsOptions, i as DocsNuxtModule, l as DocsRunnableExample, n as DocsLogo, o as DocsSiteOptions, r as DocsModuleOptions, s as DocsStartOptions, t as DocsLlmsOptions, u as DocsRunnableLesson } from "./nuxt-CPt71DeE.js";
2
2
  import { a as DocsThemeScope } from "./theme-CgJRnVdT.js";
3
3
  export { type DocsCommentsOptions, DocsLlmsOptions, DocsLogo, DocsModuleOptions, DocsNuxtModule, DocsPublicConfig, type DocsRunnableExample, type DocsRunnableLesson, type DocsRunnableOptions, DocsSiteOptions, DocsStartOptions, type DocsThemeScope, docsNuxtModule as default };
package/dist/nuxt.js CHANGED
@@ -5,7 +5,7 @@ import { docsAppPath, docsIndexedPages, docsManifestPages, docsPageIcon, docsPag
5
5
  import { a as replacesDocsPage, o as routePaths, t as docsMount } from "./page-DWsretqk.js";
6
6
  import { r as docsContentSource } from "./agent-copy-CY9_RkHN.js";
7
7
  import { i as docsServerRoutes, n as docsRedirectProblems, r as docsRedirects, t as docsRedirectError } from "./redirects-BEFu4KLR.js";
8
- import { i as docsThemeScope, n as docsThemeAdditions, r as docsUi, t as docsAppConfigUi } from "./theme-CxBzPBZ9.js";
8
+ import { i as docsThemeScope, n as docsThemeAdditions, r as docsUi, t as docsAppConfigUi } from "./theme-DRktv19v.js";
9
9
  import { createRequire } from "node:module";
10
10
  import { addComponent, addComponentsDir, addImportsDir, addPlugin, addRouteMiddleware, addServerHandler, addTemplate, addTypeTemplate, createResolver, defineNuxtModule, extendPages, updateTemplates, useLogger } from "@nuxt/kit";
11
11
  import { addRoute, createRouter, findAllRoutes, routeToRegExp } from "rou3";
@@ -13,7 +13,7 @@ import { defineDiagnostics, formatDiagnostic } from "nostics";
13
13
  import { createHash } from "node:crypto";
14
14
  import { existsSync, lstatSync, mkdirSync, readFileSync, readdirSync, rmSync, statSync, watch, writeFileSync } from "node:fs";
15
15
  import { copyFile, glob, mkdir, readFile, readdir, rm, writeFile } from "node:fs/promises";
16
- import { fileURLToPath, pathToFileURL } from "node:url";
16
+ import { fileURLToPath } from "node:url";
17
17
  import { basename, dirname, isAbsolute, join, matchesGlob, parse, posix, relative, resolve, sep } from "node:path";
18
18
  import { tmpdir } from "node:os";
19
19
  import { findContentEntry } from "@vite-hub/source/vite";
@@ -156,7 +156,7 @@ function findPackageDir(file) {
156
156
  function ownModule(importMetaUrl, modulePath) {
157
157
  return resolveRuntimeModule(findPackageDir(fileURLToPath(importMetaUrl)), modulePath);
158
158
  }
159
- // ../internal/dist/vite-CELQZdD3.js
159
+ // ../internal/dist/vite-D86Q14G4.js
160
160
  const projectRootDirectoryMarkers = [
161
161
  ["server", "agents"],
162
162
  ["server", "channels"],
@@ -358,44 +358,6 @@ function setupDocsAssistant(nuxt, config) {
358
358
  if (!(await viteHubModuleOptions(nuxt))?.agent) throw docsErrorDiagnostics.DOCS_ASSISTANT_AGENTS_MISSING({ agent: assistant.agent });
359
359
  });
360
360
  }
361
- // src/comark-blocks.ts
362
- /**
363
- * The source of a module whose default export is comark-ui's block components by tag, each one loaded on first use.
364
- * `comark-ui/vue` imports every block package, so a page that rendered with it downloaded all of them. Each tag imports
365
- * the package that defines its component. The tags that comark-ui defines itself, such as the Mermaid wrapper, import
366
- * `comark-ui/vue`. comark-ui 0.12.2 has `comark-ui/vue/lazy` (https://github.com/onmax/comark-ui/pull/434), but its block
367
- * packages change the spacing of callouts, so the switch waits for that decision.
368
- */
369
- async function comarkBlocksSource() {
370
- let ui;
371
- try {
372
- ui = createRequire(import.meta.url).resolve("comark-ui/package.json");
373
- } catch {
374
- return "export default {}\n";
375
- }
376
- const fromUi = createRequire(ui);
377
- const uiVue = fromUi.resolve("comark-ui/vue");
378
- const uiModule = await import(pathToFileURL(uiVue).href);
379
- const components = uiModule.components ?? uiModule.default().components;
380
- const files = /* @__PURE__ */ new Map();
381
- const dependencies = Object.keys(JSON.parse(readFileSync(ui, "utf8")).dependencies ?? {});
382
- for (const name of dependencies.filter((name) => name.startsWith("comark-"))) {
383
- let file;
384
- try {
385
- file = fromUi.resolve(`${name}/vue`);
386
- } catch {
387
- continue;
388
- }
389
- const plugin = await import(pathToFileURL(file).href);
390
- for (const component of Object.values(plugin.components ?? {})) files.set(component, file);
391
- }
392
- return `import { defineAsyncComponent } from "vue"\nexport default {\n${Object.entries(components).map(([tag, component]) => {
393
- const owner = files.get(component);
394
- const file = JSON.stringify(owner ?? uiVue);
395
- const map = owner ? "module.components" : "(module.components ?? module.default().components)";
396
- return ` ${JSON.stringify(tag)}: defineAsyncComponent(() => import(${file}).then(module => ${map}[${JSON.stringify(tag)}])),`;
397
- }).join("\n")}\n}\n`;
398
- }
399
361
  // src/comments-nuxt.ts
400
362
  /** Whether the app can import `name`, as `vite-hub` resolves its optional peers. */
401
363
  function installed(name, rootDir) {
@@ -2283,16 +2245,6 @@ const docsNuxtModule = defineNuxtModule({
2283
2245
  write: true,
2284
2246
  getContents: () => `import type { Component } from "vue"\ndeclare const components: Record<string, Component>\nexport default components\n`
2285
2247
  });
2286
- nuxt.options.alias["#docs/blocks"] = addTemplate({
2287
- filename: "docs/blocks.mjs",
2288
- write: true,
2289
- getContents: () => comarkBlocksSource()
2290
- }).dst;
2291
- addTemplate({
2292
- filename: "docs/blocks.d.mts",
2293
- write: true,
2294
- getContents: () => `import type { Component } from "vue"\ndeclare const blocks: Record<string, Component>\nexport default blocks\n`
2295
- });
2296
2248
  addTypeTemplate({
2297
2249
  filename: "types/docs-page-meta.d.ts",
2298
2250
  getContents: () => `declare module "#app" {\n interface PageMeta {\n /** \`false\` hides the docs sidebar. \`"collapsed"\` shows a narrow strip with a button that opens it. */\n sidebar?: boolean | "collapsed"\n }\n}\nexport {}\n`
@@ -2599,6 +2551,7 @@ const docsNuxtModule = defineNuxtModule({
2599
2551
  });
2600
2552
  addServerHandler({
2601
2553
  middleware: true,
2554
+ route: "/**",
2602
2555
  handler: resolver.resolve("./runtime/server/trailing-slash.js")
2603
2556
  });
2604
2557
  for (const method of ["get", "head"]) for (const route of [
@@ -2616,6 +2569,7 @@ const docsNuxtModule = defineNuxtModule({
2616
2569
  });
2617
2570
  if (config.markdownPages) addServerHandler({
2618
2571
  middleware: true,
2572
+ route: "/**",
2619
2573
  handler: resolver.resolve("./runtime/server/markdown.js")
2620
2574
  });
2621
2575
  /**
@@ -2988,6 +2942,7 @@ function publicConfig(options, base, appBase) {
2988
2942
  } : void 0,
2989
2943
  socials: options.socials ?? [],
2990
2944
  footer: options.footer ?? [],
2945
+ builtWith: options.builtWith !== false,
2991
2946
  banner: options.banner ?? null,
2992
2947
  sitemap: options.sitemap ?? [],
2993
2948
  github: options.github ? {
@@ -1,9 +1,29 @@
1
- <script setup lang="ts">
1
+ <script lang="ts">
2
2
  import { createDocsSearch, docsAppPath, docsSectionHome } from "#docs/navigation"
3
3
 
4
4
  import type { DocsSearchSection } from "@vite-hub/docs"
5
5
 
6
- // A result shows the page path over its heading. One line, "Page > Section > Heading", cut off the heading on a phone.
6
+ type DocsSearch = ReturnType<typeof createDocsSearch>
7
+
8
+ let loading: Promise<DocsSearch> | undefined
9
+
10
+ function loadDocsSearch(url: string): Promise<DocsSearch> {
11
+ if (!import.meta.dev && loading) return loading
12
+ const request = $fetch<DocsSearchSection[]>(url).then(createDocsSearch)
13
+ if (import.meta.dev) return request
14
+ return loading = request.catch((error: unknown) => {
15
+ loading = undefined
16
+ throw error
17
+ })
18
+ }
19
+
20
+ function savesData(): boolean {
21
+ const connection: { saveData?: boolean } | undefined = Reflect.get(navigator, "connection")
22
+ return connection?.saveData === true
23
+ }
24
+ </script>
25
+
26
+ <script setup lang="ts">
7
27
  const { appBase } = useDocsConfig()
8
28
  const manifest = useDocsManifest()
9
29
  const icons = useDocsIcons()
@@ -15,31 +35,33 @@ const navigation = manifest.sections.map(section => ({
15
35
  }))
16
36
  const links = navigation.map((item, index) => ({ label: item.title, icon: item.icon, to: docsSectionHome(manifest.sections[index]!) }))
17
37
 
18
- // The index loads when the dialog first opens, so pages do not pay for it.
19
38
  const status = ref<"idle" | "loading" | "ready" | "error">("idle")
20
- let rank: ReturnType<typeof createDocsSearch> | undefined
39
+ let rank: DocsSearch | undefined
21
40
  const { open } = useContentSearch()
22
- watch(open, async (value) => {
23
- if (!value || status.value === "loading" || status.value === "ready") return
41
+
42
+ async function load() {
43
+ if (status.value === "loading" || status.value === "ready") return
24
44
  status.value = "loading"
25
45
  try {
26
- const records = await $fetch<DocsSearchSection[]>(docsAppPath("/api/_docs/search.json", appBase))
27
- rank = createDocsSearch(records)
46
+ rank = await loadDocsSearch(docsAppPath("/api/_docs/search.json", appBase))
28
47
  status.value = "ready"
29
48
  }
30
49
  catch {
31
50
  status.value = "error"
32
51
  }
52
+ }
53
+
54
+ watch(open, (value) => {
55
+ if (value) void load()
33
56
  })
57
+ if (!import.meta.dev && !savesData()) onNuxtReady(() => load())
34
58
 
35
59
  async function search(query: string, options?: { limit?: number }) {
36
60
  return rank?.(query, options?.limit ?? 30) ?? []
37
61
  }
38
62
 
39
- // The section list helps before the first key press. After it, the ranked results are the whole list.
40
63
  const searchTerm = ref("")
41
64
 
42
- // Nuxt UI builds the prefix as "Page > Section >".
43
65
  function searchPath(prefix: string) {
44
66
  return prefix.replace(/\s*>$/, "").split(" > ").join(" / ")
45
67
  }
@@ -52,6 +74,7 @@ function searchPath(prefix: string) {
52
74
  :navigation="navigation"
53
75
  :search="search"
54
76
  :search-status="status"
77
+ :search-delay="0"
55
78
  :fuse="{ resultLimit: 30 }"
56
79
  >
57
80
  <template #item-label="{ item }">
@@ -0,0 +1,31 @@
1
+ <script setup lang="ts">
2
+ const { builtWith } = useDocsConfig()
3
+ </script>
4
+
5
+ <template>
6
+ <p v-if="builtWith" class="vh-docs-credit">
7
+ Built with <a href="https://vitehub.dev/docs/docs-site" target="_blank" rel="noopener">ViteHub Docs</a>
8
+ </p>
9
+ </template>
10
+
11
+ <style scoped>
12
+ .vh-docs-credit {
13
+ color: var(--ui-text-dimmed);
14
+ font-size: 0.75rem;
15
+ line-height: 1.25rem;
16
+ }
17
+
18
+ .vh-docs-credit a {
19
+ color: var(--ui-text-muted);
20
+ text-decoration: underline;
21
+ text-decoration-color: var(--ui-border-accented);
22
+ text-underline-offset: 3px;
23
+ }
24
+
25
+ @media (hover: hover) {
26
+ .vh-docs-credit a:hover {
27
+ color: var(--ui-text-highlighted);
28
+ text-decoration-color: currentcolor;
29
+ }
30
+ }
31
+ </style>
@@ -1,5 +1,4 @@
1
1
  <script setup lang="ts">
2
- // The end of every docs page: every documented area by category, with the current one marked.
3
2
  import { docsCatalog, docsSectionHome } from "#docs/navigation"
4
3
 
5
4
  import type { DocsAppPage, DocsSection } from "@vite-hub/docs"
@@ -8,7 +7,7 @@ const props = defineProps<{
8
7
  current?: DocsSection<DocsAppPage> | null
9
8
  }>()
10
9
 
11
- const { categories, footer, site } = useDocsConfig()
10
+ const { builtWith, categories, footer, site } = useDocsConfig()
12
11
  const icons = useDocsIcons()
13
12
  const groups = docsCatalog(useDocsManifest(), categories)
14
13
 
@@ -20,7 +19,7 @@ function isCurrent(section: DocsSection<DocsAppPage>) {
20
19
  <template>
21
20
  <!-- The rail and the sidebar already mark the current page, so the catalog marks the current section as the current
22
21
  item of its list. Sections join the catalog through their `category`. A site without categories has no catalog. -->
23
- <footer v-if="groups.length || footer.length" class="vh-product-footer" :aria-label="`Explore ${site.name} documentation`">
22
+ <footer v-if="groups.length || footer.length || builtWith" class="vh-product-footer" :aria-label="`Explore ${site.name} documentation`">
24
23
  <h2 v-if="groups.length" class="vh-product-footer-title">Explore {{ site.name }}</h2>
25
24
 
26
25
  <div v-if="groups.length" class="vh-product-footer-grid">
@@ -45,6 +44,8 @@ function isCurrent(section: DocsSection<DocsAppPage>) {
45
44
  <nav v-if="footer.length" class="vh-product-footer-site" :aria-label="site.name">
46
45
  <NuxtLink v-for="link in footer" :key="link.to" :to="link.to" class="vh-product-footer-link">{{ link.label }}</NuxtLink>
47
46
  </nav>
47
+
48
+ <DocsBuiltWith class="mt-8" />
48
49
  </footer>
49
50
  </template>
50
51
 
@@ -1,9 +1,6 @@
1
1
  <script setup lang="ts">
2
2
  import type { DocsPageResponse } from "@vite-hub/docs"
3
3
 
4
- // A landing is a wide Overview. A section Overview opens with its own hero in the Markdown, so it shows only the page
5
- // actions above the body and ends with the catalog footer. The docs base page is the catalog itself: it keeps the
6
- // page header and has no footer.
7
4
  const props = defineProps<{
8
5
  response: DocsPageResponse
9
6
  header?: boolean
@@ -24,6 +21,7 @@ const page = computed(() => props.response.page)
24
21
  <UPageBody prose class="docs-content docs-catalog-content pb-16">
25
22
  <DocsMarkdown :document="response.document" />
26
23
  <DocsPageCredits v-if="response.credits" :credits="response.credits" class="not-prose mt-10" />
24
+ <DocsBuiltWith class="not-prose mt-8" />
27
25
  </UPageBody>
28
26
  </UPage>
29
27
 
@@ -1,7 +1,8 @@
1
1
  <script setup lang="ts">
2
2
  import { MarkdownDocument } from "@comark/vue/components/MarkdownDocument"
3
+ import { useViteHubUIMotionEnabled } from "@vite-hub/ui"
4
+ import { components as lazyBlocks } from "comark-ui/vue/lazy"
3
5
  import { camelize, capitalize, defineAsyncComponent } from "vue"
4
- import blocks from "#docs/blocks"
5
6
  import customComponents from "#docs/custom-components"
6
7
  import contentComponents from "#docs/components"
7
8
 
@@ -19,6 +20,9 @@ const props = defineProps<{
19
20
  components?: Record<string, Component>
20
21
  }>()
21
22
 
23
+ const blocks: Record<string, Component> = lazyBlocks
24
+ const motionEnabled = useViteHubUIMotionEnabled()
25
+
22
26
  // `::note`, `::tip`, and the other callout components draw comark-ui's GitHub callout, the same as a `> [!NOTE]` quote.
23
27
  const callout = (type: string, title?: string): Component => defineComponent({
24
28
  name: `${type[0]!.toUpperCase()}${type.slice(1)}Callout`,
@@ -38,19 +42,27 @@ const componentKey = (tag: string) => capitalize(camelize(tag))
38
42
  // Comark looks up PascalCase before the raw tag, so all maps must use the same keys for precedence to hold.
39
43
  const byKey = (maps: Record<string, Component>[]) => Object.fromEntries(maps.flatMap(map => Object.entries(map).map(([tag, component]) => [componentKey(tag), component])))
40
44
  const overrides = computed(() => byKey([contentBlocks, customComponents, props.components ?? {}]))
41
- const resolved = computed(() => ({ ...byKey([blocks, callouts]), ...overrides.value }))
45
+ const resolved = computed(() => ({
46
+ ...byKey([blocks, callouts]),
47
+ ...overrides.value,
48
+ ...(motionEnabled ? {} : { ProseMotionRuntime: () => null }),
49
+ }))
42
50
 
43
51
  // HTML is the fallback. An app component still receives the original tag, props, and source children. comark-ui's own
44
52
  // component doesn't: the parser drew the block as HTML because that component can't, as with a chart's marks.
45
- function renderNodes(nodes: ComarkNode[]): ComarkNode[] {
53
+ const unbrokenCodeLength = 24
54
+ const isShortText = (children: ComarkNode[]) => children.length === 1 && typeof children[0] === "string" && children[0].length <= unbrokenCodeLength
55
+
56
+ function renderNodes(nodes: ComarkNode[], inPre = false): ComarkNode[] {
46
57
  return nodes.map((node): ComarkNode => {
47
58
  if (typeof node === "string" || node[0] === null) return node
48
59
  const [tag, attributes, ...children] = node
49
60
  const { block, blockProps } = attributes
50
61
  if (tag === "comark-html" && typeof block === "string" && overrides.value[componentKey(block)]) {
51
- return [block, (blockProps ?? {}) as ElementNode[1], ...renderNodes(children)]
62
+ return [block, (blockProps ?? {}) as ElementNode[1], ...renderNodes(children, inPre)]
52
63
  }
53
- return [tag, attributes, ...renderNodes(children)]
64
+ if (tag === "code" && !inPre && isShortText(children)) return [tag, { ...attributes, "data-nowrap": "" }, ...children]
65
+ return [tag, attributes, ...renderNodes(children, inPre || tag === "pre")]
54
66
  })
55
67
  }
56
68
  const nodes = computed(() => renderNodes(props.document.nodes))
@@ -75,8 +75,11 @@ useDocsSeo({
75
75
 
76
76
  <template>
77
77
  <!-- The layout's UMain is the page's only main landmark. -->
78
- <LazyDocsLearn v-if="workspace?.layout === 'learn'" :key="page.path" :response="response" :data="workspace" />
79
- <LazyDocsPlayground v-else-if="workspace" :key="page.path" :response="response" :data="workspace" />
78
+ <div v-if="workspace" :key="page.path" class="vh-docs-workspace-page">
79
+ <LazyDocsLearn v-if="workspace.layout === 'learn'" :response="response" :data="workspace" />
80
+ <LazyDocsPlayground v-else :response="response" :data="workspace" />
81
+ <DocsBuiltWith class="shrink-0 px-4 py-2" />
82
+ </div>
80
83
 
81
84
  <div v-else-if="isStandalone" class="mx-auto w-full max-w-3xl px-4 pb-24 pt-14 sm:px-6 sm:pt-20 lg:px-8 lg:pt-24" :data-path="page.path">
82
85
  <UPageHeader
@@ -94,11 +97,13 @@ useDocsSeo({
94
97
  <DocsMarkdown :document="response.document" />
95
98
  <DocsPageCredits v-if="response.credits" :credits="response.credits" class="not-prose mt-10" />
96
99
  </UPageBody>
100
+ <DocsBuiltWith class="mt-8" />
97
101
  </div>
98
102
 
99
103
  <div v-else-if="home" :data-path="page.path">
100
104
  <DocsMarkdown :document="home" />
101
105
  <DocsPageCredits v-if="response.credits" :credits="response.credits" class="mx-auto w-full max-w-(--vh-content-width) px-4 sm:px-6" />
106
+ <DocsBuiltWith class="mx-auto w-full max-w-(--vh-content-width) px-4 pb-8 pt-8 sm:px-6" />
102
107
  </div>
103
108
 
104
109
  <div v-else-if="page.layout === 'landing'" class="vh-docs-landing">
@@ -112,6 +117,25 @@ useDocsSeo({
112
117
  </template>
113
118
 
114
119
  <style scoped>
120
+ .vh-docs-workspace-page {
121
+ display: contents;
122
+ }
123
+
124
+ .vh-docs-workspace-page:has(> .vh-docs-credit) {
125
+ display: flex;
126
+ flex-direction: column;
127
+ min-height: 0;
128
+ }
129
+
130
+ .vh-docs-workspace-page > :deep(.vh-docs-workspace) {
131
+ flex: 1 1 0;
132
+ }
133
+
134
+ .vh-docs-workspace-page:has(> .vh-docs-credit) > :deep(.vh-docs-workspace:has(.vh-workspace-gate)) {
135
+ flex: 1 0 auto;
136
+ height: auto;
137
+ }
138
+
115
139
  /* Below 40rem the article and the product landing set the only gutter, so the text keeps the width. */
116
140
  .vh-docs-main,
117
141
  .vh-docs-landing,
@@ -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-CxBzPBZ9.js";
1
+ export { t as docsAppConfigUi, n as docsThemeAdditions, i as docsThemeScope, r as docsUi } from "./theme-DRktv19v.js";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@vite-hub/docs",
3
- "version": "0.5.1",
3
+ "version": "0.6.1",
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,15 @@
71
71
  "@nuxt/fonts": "^1.2.0",
72
72
  "@nuxt/kit": "4.6.4",
73
73
  "@takumi-rs/core": "2.22.1",
74
- "@vite-hub/content": "0.5.1",
75
- "@vite-hub/rate-limit": "0.5.1",
76
- "@vite-hub/source": "0.5.1",
77
- "@vite-hub/ui": "0.5.1",
78
- "@vite-hub/web-container": "0.5.1",
79
- "@vite-hub/workspace": "0.5.1",
74
+ "@vite-hub/content": "0.6.1",
75
+ "@vite-hub/rate-limit": "0.6.1",
76
+ "@vite-hub/source": "0.6.1",
77
+ "@vite-hub/ui": "0.6.1",
78
+ "@vite-hub/web-container": "0.6.1",
79
+ "@vite-hub/workspace": "0.6.1",
80
80
  "@vueuse/core": "^15.0.0",
81
81
  "comark-content": "0.5.1",
82
- "comark-zoom": "^0.12.2",
82
+ "comark-zoom": "^0.14.3",
83
83
  "defu": "^6.1.7",
84
84
  "nostics": "1.4.0",
85
85
  "nuxt-agent-discovery": "^0.8.2",
@@ -100,12 +100,12 @@
100
100
  "@nuxt/ui": "^4.13.0",
101
101
  "@types/node": "^24.19.2",
102
102
  "@vue/test-utils": "2.6.0",
103
- "@vite-hub/agent": "0.5.1",
104
- "@vite-hub/gateways": "0.5.1",
103
+ "@vite-hub/agent": "0.6.1",
104
+ "@vite-hub/gateways": "0.6.1",
105
105
  "@vite-hub/icons": "0.1.0",
106
106
  "@vite-hub/internal": "0.0.1",
107
107
  "comark": "^0.9.2",
108
- "comark-ui": "^0.12.2",
108
+ "comark-ui": "^0.14.3",
109
109
  "h3": "^2.0.8",
110
110
  "happy-dom": "21.0.4",
111
111
  "linkedom": "^0.18.15",
@@ -125,10 +125,10 @@
125
125
  "@comark/html": "^0.8.1 || ^0.9.0",
126
126
  "@comark/vue": "^0.8.1 || ^0.9.0",
127
127
  "@nuxt/ui": "^4.11.0",
128
- "@vite-hub/agent": "0.5.1",
129
- "@vite-hub/gateways": "0.5.1",
128
+ "@vite-hub/agent": "0.6.1",
129
+ "@vite-hub/gateways": "0.6.1",
130
130
  "comark": "^0.8.1 || ^0.9.0",
131
- "comark-ui": "^0.12.0",
131
+ "comark-ui": "^0.14.3",
132
132
  "nuxt": "^4.7.0 || >=5.0.0-0",
133
133
  "vue": "^3.5.0"
134
134
  },