@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.
Files changed (111) hide show
  1. package/LICENSE +201 -0
  2. package/README.md +453 -2
  3. package/dist/agent-copy-BJp_Yf5d.js +33 -0
  4. package/dist/assistant-shared-CdtXowot.js +97 -0
  5. package/dist/assistant-shared-Dll_F_yy.d.ts +27 -0
  6. package/dist/assistant-worker.d.ts +11 -0
  7. package/dist/assistant-worker.js +16 -0
  8. package/dist/assistant.d.ts +14 -0
  9. package/dist/assistant.js +19 -0
  10. package/dist/content-9CINWiRf.js +171 -0
  11. package/dist/draft-DUBx--r9.js +45 -0
  12. package/dist/error-diagnostics-BoOsP6Y4.js +53 -0
  13. package/dist/index.d.ts +28 -0
  14. package/dist/index.js +27 -0
  15. package/dist/link-checker-redirects.d.ts +13 -0
  16. package/dist/link-checker-redirects.js +25 -0
  17. package/dist/manifest-D66AEF8F.js +420 -0
  18. package/dist/manifest-Dzp5-_AJ.d.ts +74 -0
  19. package/dist/markdown-Cn9-4oVG.js +378 -0
  20. package/dist/navigation.d.ts +284 -0
  21. package/dist/navigation.js +520 -0
  22. package/dist/nuxt-B5LrERKc.d.ts +240 -0
  23. package/dist/nuxt.d.ts +3 -0
  24. package/dist/nuxt.js +1485 -0
  25. package/dist/page-BbmSfZO8.js +81 -0
  26. package/dist/page-Dx2JD3y1.d.ts +74 -0
  27. package/dist/primitive-rail.d.ts +110 -0
  28. package/dist/primitive-rail.js +284 -0
  29. package/dist/raw-C03EUJKw.js +851 -0
  30. package/dist/redirects-BrbWFSzW.js +62 -0
  31. package/dist/runtime/app/app.vue +11 -0
  32. package/dist/runtime/app/assistant/DocsAssistant.vue +81 -0
  33. package/dist/runtime/app/assistant/DocsAssistantOff.vue +8 -0
  34. package/dist/runtime/app/assistant/DocsAssistantPanel.vue +322 -0
  35. package/dist/runtime/app/components/AppHeader.vue +368 -0
  36. package/dist/runtime/app/components/AppSearch.vue +68 -0
  37. package/dist/runtime/app/components/DocsAppShell.vue +62 -0
  38. package/dist/runtime/app/components/DocsArticle.vue +184 -0
  39. package/dist/runtime/app/components/DocsAsideFooter.vue +94 -0
  40. package/dist/runtime/app/components/DocsAsideLeftBody.vue +584 -0
  41. package/dist/runtime/app/components/DocsAsideLeftTop.vue +132 -0
  42. package/dist/runtime/app/components/DocsBrandMark.vue +52 -0
  43. package/dist/runtime/app/components/DocsCatalogFooter.vue +129 -0
  44. package/dist/runtime/app/components/DocsCodePanel.vue +388 -0
  45. package/dist/runtime/app/components/DocsCodePre.vue +120 -0
  46. package/dist/runtime/app/components/DocsHeaderActions.vue +4 -0
  47. package/dist/runtime/app/components/DocsLanding.vue +83 -0
  48. package/dist/runtime/app/components/DocsMarkdown.vue +64 -0
  49. package/dist/runtime/app/components/DocsPage.vue +149 -0
  50. package/dist/runtime/app/components/DocsPageCredits.vue +41 -0
  51. package/dist/runtime/app/components/DocsPageHeaderLinks.vue +120 -0
  52. package/dist/runtime/app/components/DocsRail.vue +239 -0
  53. package/dist/runtime/app/components/DocsSidebarStrip.vue +81 -0
  54. package/dist/runtime/app/components/DocsSidebars.vue +63 -0
  55. package/dist/runtime/app/components/OgImage/DocsPage.takumi.vue +33 -0
  56. package/dist/runtime/app/components/content/AgentOnly.vue +9 -0
  57. package/dist/runtime/app/components/content/CodeTree.vue +203 -0
  58. package/dist/runtime/app/components/content/ComarkHtml.vue +31 -0
  59. package/dist/runtime/app/components/content/Correct.vue +17 -0
  60. package/dist/runtime/app/components/content/Example.vue +260 -0
  61. package/dist/runtime/app/components/content/ExamplePreview.vue +6 -0
  62. package/dist/runtime/app/components/content/Examples.vue +71 -0
  63. package/dist/runtime/app/components/content/Incorrect.vue +17 -0
  64. package/dist/runtime/app/components/content/PageList.vue +206 -0
  65. package/dist/runtime/app/components/content/ProductFeatureItem.vue +43 -0
  66. package/dist/runtime/app/components/content/ProductFeatures.vue +17 -0
  67. package/dist/runtime/app/components/content/TutorialStep.vue +39 -0
  68. package/dist/runtime/app/composables/docs-assistant-problem.ts +59 -0
  69. package/dist/runtime/app/composables/docs-theme.ts +15 -0
  70. package/dist/runtime/app/composables/docs.ts +83 -0
  71. package/dist/runtime/app/composables/headerActions.ts +6 -0
  72. package/dist/runtime/app/composables/icons.ts +14 -0
  73. package/dist/runtime/app/composables/seo.ts +64 -0
  74. package/dist/runtime/app/composables/tutorial.ts +40 -0
  75. package/dist/runtime/app/composables/useDocsAssistant.ts +17 -0
  76. package/dist/runtime/app/error.vue +88 -0
  77. package/dist/runtime/app/layouts/default.vue +7 -0
  78. package/dist/runtime/app/layouts/docs.vue +104 -0
  79. package/dist/runtime/app/middleware/docs-layout.ts +23 -0
  80. package/dist/runtime/app/pages/docs-page.vue +3 -0
  81. package/dist/runtime/app/plugins/comark-css.ts +14 -0
  82. package/dist/runtime/app/plugins/icon-stroke.ts +12 -0
  83. package/dist/runtime/app/plugins/theme-color.ts +18 -0
  84. package/dist/runtime/app/utils/docs-theme.ts +43 -0
  85. package/dist/runtime/app/utils/file-tree.ts +40 -0
  86. package/dist/runtime/server/llms.d.ts +6 -0
  87. package/dist/runtime/server/llms.js +7 -0
  88. package/dist/runtime/server/markdown.d.ts +10 -0
  89. package/dist/runtime/server/markdown.js +11 -0
  90. package/dist/runtime/server/mcp.d.ts +6 -0
  91. package/dist/runtime/server/mcp.js +7 -0
  92. package/dist/runtime/server/page.d.ts +7 -0
  93. package/dist/runtime/server/page.js +27 -0
  94. package/dist/runtime/server/raw.d.ts +10 -0
  95. package/dist/runtime/server/raw.js +23 -0
  96. package/dist/runtime/server/search.d.ts +6 -0
  97. package/dist/runtime/server/search.js +32 -0
  98. package/dist/runtime/server/sitemap.d.ts +6 -0
  99. package/dist/runtime/server/sitemap.js +52 -0
  100. package/dist/runtime/server/trailing-slash.d.ts +10 -0
  101. package/dist/runtime/server/trailing-slash.js +28 -0
  102. package/dist/runtime/theme/design.css +464 -0
  103. package/dist/schema-DwpXW0VZ.js +98 -0
  104. package/dist/server.d.ts +15 -0
  105. package/dist/server.js +5 -0
  106. package/dist/theme-BXyu4uFL.d.ts +32 -0
  107. package/dist/theme-DzC8LtMH.js +237 -0
  108. package/dist/theme.d.ts +2 -0
  109. package/dist/theme.js +2 -0
  110. package/dist/types-BhG6vGfG.d.ts +212 -0
  111. package/package.json +141 -3
@@ -0,0 +1,81 @@
1
+ import { docsManifestPages, docsPanelOf, docsPanelPages, isDocsPath } from "./navigation.js";
2
+ //#region src/page.ts
3
+ /** Previous and next follow the sidebar order of the page's section, or of its panel for a page inside one. */
4
+ function docsPageResponse(manifest, found, document, credits = null) {
5
+ const section = found.section;
6
+ const pages = section ? docsPanelPages(section, docsPanelOf(section, found.page)).filter((page) => page.navigation) : [];
7
+ const index = pages.findIndex((page) => page.path === found.page.path);
8
+ const link = (page) => page ? {
9
+ path: page.path,
10
+ title: page.title,
11
+ description: page.description
12
+ } : null;
13
+ return {
14
+ page: found.page,
15
+ section: found.section?.id ?? null,
16
+ document,
17
+ credits,
18
+ prev: index > 0 ? link(pages[index - 1]) : null,
19
+ next: index >= 0 ? link(pages[index + 1]) : null
20
+ };
21
+ }
22
+ /** A page from its validated frontmatter. The build and the draft preview build pages the same way. */
23
+ function docsPageOf(frontmatter, at) {
24
+ const navigation = frontmatter.navigation === false ? void 0 : frontmatter.navigation;
25
+ const layout = frontmatter.layout ?? "article";
26
+ return {
27
+ id: at.id,
28
+ path: at.path || "/",
29
+ file: at.file,
30
+ title: navigation?.title ?? frontmatter.title,
31
+ sourceTitle: frontmatter.title,
32
+ description: frontmatter.description ?? null,
33
+ tagline: frontmatter.tagline ?? frontmatter.description ?? null,
34
+ eyebrow: frontmatter.eyebrow ?? null,
35
+ credits: frontmatter.credits?.trim() || null,
36
+ keywords: (typeof frontmatter.keywords === "string" ? frontmatter.keywords.split(",") : frontmatter.keywords ?? []).map((word) => word.trim()).filter(Boolean),
37
+ icon: frontmatter.icon ?? null,
38
+ layout,
39
+ ...frontmatter.tutorial ? { tutorial: frontmatter.tutorial } : {},
40
+ ...frontmatter.codePanel ? { codePanel: true } : {},
41
+ ...frontmatter.seo ? { seo: frontmatter.seo } : {},
42
+ sidebar: frontmatter.sidebar ?? true,
43
+ toc: frontmatter.toc ?? (layout !== "landing" && layout !== "home"),
44
+ kind: navigation?.kind ?? null,
45
+ group: navigation?.group ?? null,
46
+ navigation: frontmatter.navigation !== false,
47
+ ...navigation?.panel && at.id !== "index" && at.file.endsWith("/index.md") ? { panel: true } : {},
48
+ order: navigation?.order ?? Number.MAX_SAFE_INTEGER
49
+ };
50
+ }
51
+ /**
52
+ * The URL of a page file, from its path below the content folder without `.md`: `docs/kv/index` is `/docs/kv`, `about`
53
+ * is `/about`, and `index` is `/`.
54
+ */
55
+ function docsPagePath(file) {
56
+ return `/${file.replaceAll("\\", "/").replace(/\.md$/, "").replace(/(^|\/)index$/, "")}`;
57
+ }
58
+ /**
59
+ * The URL prefix of every page: the docs base when all pages sit below it, else `/`. The docs page answers only below
60
+ * it, so an app that keeps its docs under `/docs` keeps its own pages and its own "Page not found" everywhere else.
61
+ */
62
+ function docsMount(manifest) {
63
+ return docsManifestPages(manifest).every((page) => isDocsPath(page.path, manifest.base)) ? manifest.base : "/";
64
+ }
65
+ /**
66
+ * Whether the app has its own catch-all page at the docs mount, which then replaces the docs page:
67
+ * `pages/[...slug].vue` for docs at `/`, `pages/docs/[...slug].vue` for docs at `/docs`. A catch-all at another
68
+ * prefix, such as `pages/blog/[...slug].vue` or the app's root catch-all beside docs at `/docs`, does not.
69
+ */
70
+ function replacesDocsPage(routes, mount) {
71
+ const prefix = mount === "/" ? "" : mount;
72
+ return routePaths(routes).some((path) => /^(.*?)\/:\w+\(\.\*\)\*?$/.exec(path)?.[1] === prefix);
73
+ }
74
+ function routePaths(routes, parent = "") {
75
+ return routes.flatMap((route) => {
76
+ const path = route.path.startsWith("/") ? route.path : `${parent.replace(/\/+$/, "")}/${route.path}`;
77
+ return [path, ...routePaths(route.children ?? [], path)];
78
+ });
79
+ }
80
+ //#endregion
81
+ export { replacesDocsPage as a, docsPageResponse as i, docsPageOf as n, docsPagePath as r, docsMount as t };
@@ -0,0 +1,74 @@
1
+ import { a as DocsSection, i as DocsSearchSection, n as DocsManifest, o as DocsTocLink, r as DocsPage } from "./types-BhG6vGfG.js";
2
+ import { PresetOptions } from "comark-ui/vue";
3
+ import { Node, ParserOptions } from "comark";
4
+ //#region src/markdown.d.ts
5
+ /** A page parsed on the server. The client renders `nodes` and never parses Markdown itself. */
6
+ interface DocsDocument {
7
+ nodes: Node[];
8
+ toc: DocsTocLink[];
9
+ }
10
+ interface DocsParserOptions {
11
+ /**
12
+ * comark-ui's preset options, merged over the built-in ones: `{ typeset: false, chips: false, diagrams: false,
13
+ * badge: { download: false } }`. Such as `{ chips: true }` or `{ github: { references: { repo: "owner/name" } } }`.
14
+ * `diagrams: true` draws D2, PlantUML, and Graphviz fences through kroki.io, which receives their source. Set
15
+ * `diagrams: { server }` to use your own Kroki server.
16
+ */
17
+ comarkUi?: PresetOptions;
18
+ /** Blocks that show their first fenced block rendered, next to its source. */
19
+ examples?: DocsExamplesOptions | Record<string, string>;
20
+ /** Named Vue example sources supplied by the framework integration. */
21
+ exampleSources?: Record<string, string>;
22
+ /** More Comark plugins, after the built-in ones. A plugin with a built-in name replaces it. */
23
+ plugins?: ParserOptions["plugins"];
24
+ }
25
+ interface DocsExamplesOptions {
26
+ /** Tags of the blocks that get a preview of their first fenced block. `["example", "correct", "incorrect"]` by default. */
27
+ tags?: string[];
28
+ /** A playground URL for a block's Markdown, written as its `play`. `undefined` writes none. */
29
+ play?: (source: string, tag: string) => string | undefined | Promise<string | undefined>;
30
+ }
31
+ /**
32
+ * The Comark parser options of a docs page: components (`::name`), comark-ui's blocks, GitHub alerts, task lists,
33
+ * highlighted code, and a heading outline. The page route parses through Content with these options, and drafts,
34
+ * credits, and search parse with the same ones through `createDocsParser()`, so every path gives the same nodes.
35
+ *
36
+ * Pass them to `defineContent({ markdown })`. `preset: false` keeps Content's own comark-ui preset out, since these
37
+ * plugins already hold the docs configuration of comark-ui.
38
+ */
39
+ declare function docsMarkdown(options?: DocsParserOptions): {
40
+ preset: false;
41
+ autoClose: true;
42
+ plugins: NonNullable<ParserOptions["plugins"]>;
43
+ };
44
+ /**
45
+ * Parse Markdown with the plugins of `docsMarkdown()`. The client renders the nodes with comark-ui's components.
46
+ */
47
+ declare function createDocsParser(options?: DocsParserOptions): (markdown: string) => Promise<DocsDocument>;
48
+ /** Split a page into one search entry per h2 and h3, like Nuxt UI's content search expects. */
49
+ declare function docsSearchSections(path: string, title: string, nodes: Node[]): DocsSearchSection[];
50
+ //#endregion
51
+ //#region src/page.d.ts
52
+ interface DocsPageLink {
53
+ path: string;
54
+ title: string;
55
+ description: string | null;
56
+ }
57
+ /** What the page route returns for one URL. The client renders it as is. */
58
+ interface DocsPageResponse {
59
+ page: DocsPage;
60
+ /** Id of the section that owns the page, or `null` for the root page and pages outside the base. */
61
+ section: string | null;
62
+ document: DocsDocument;
63
+ /** The page's `credits`, parsed like its body, or `null` without them. */
64
+ credits: DocsDocument | null;
65
+ prev: DocsPageLink | null;
66
+ next: DocsPageLink | null;
67
+ }
68
+ /** Previous and next follow the sidebar order of the page's section, or of its panel for a page inside one. */
69
+ declare function docsPageResponse(manifest: DocsManifest, found: {
70
+ page: DocsPage;
71
+ section: DocsSection | null;
72
+ }, document: DocsDocument, credits?: DocsDocument | null): DocsPageResponse;
73
+ //#endregion
74
+ export { DocsParserOptions as a, docsSearchSections as c, DocsDocument as i, DocsPageResponse as n, createDocsParser as o, docsPageResponse as r, docsMarkdown as s, DocsPageLink as t };
@@ -0,0 +1,110 @@
1
+ import { Component, PropType, SlotsType, VNode } from "vue";
2
+ //#region ../icons/dist/index.d.ts
3
+ /** Name of an icon in the ViteHub set, such as `kv` for `i-vitehub-kv`. */
4
+ type ViteHubIconName = "agent" | "auth" | "blob" | "browser" | "bundle" | "cache" | "channels" | "cms" | "codemods" | "comments" | "compare" | "connections" | "content" | "database" | "decisions" | "development" | "device" | "docs" | "email" | "env" | "forge" | "forms" | "gateways" | "guides" | "hosts" | "i18n" | "kv" | "logs" | "mcp" | "queue" | "rate-limit" | "realtime" | "reference" | "sandbox" | "schedule" | "shell" | "skills" | "source" | "start" | "sync" | "ui" | "usage" | "web-container" | "webhooks" | "workflow" | "workspace";
5
+ //#endregion
6
+ //#region src/components/primitive-icon.d.ts
7
+ /** Name of an icon in the `@vite-hub/icons` set: one for each Server Primitive, Console area, and docs area. */
8
+ type PrimitiveIconName = ViteHubIconName;
9
+ export declare function isPrimitiveIconName(value: unknown): value is PrimitiveIconName;
10
+ export declare const primitiveIconNames: readonly PrimitiveIconName[];
11
+ /** Returns the set icon that an Iconify name such as `i-vitehub-kv` or `vitehub:kv` names, or a bare name such as `kv`. */
12
+ export declare function resolvePrimitiveIconName(icon: string): PrimitiveIconName | undefined;
13
+ /**
14
+ * Inline SVG of a `@vite-hub/icons` icon, so the part that each icon marks with `data-motion` can move when its rail item
15
+ * gets a pointer or keyboard focus. `styles.css` sets the motion of each icon. Strokes use currentColor.
16
+ */
17
+ export declare const PrimitiveIcon: import("vue").DefineComponent<import("vue").ExtractPropTypes<{
18
+ name: {
19
+ required: true;
20
+ type: PropType<PrimitiveIconName>;
21
+ };
22
+ }>, () => import("vue").VNode<import("vue").RendererNode, import("vue").RendererElement, {
23
+ [key: string]: any;
24
+ }>, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<import("vue").ExtractPropTypes<{
25
+ name: {
26
+ required: true;
27
+ type: PropType<PrimitiveIconName>;
28
+ };
29
+ }>> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
30
+ //#endregion
31
+ //#region src/components/primitive-rail.d.ts
32
+ /** Props of every rail slot. `expanded` is true while the rail shows its labels, for example to turn off tooltips. */
33
+ interface PrimitiveRailSlotProps {
34
+ expanded: boolean;
35
+ }
36
+ type PrimitiveRailSlot = (props: PrimitiveRailSlotProps) => VNode[];
37
+ /**
38
+ * The narrow icon rail that ViteHub docs and the Console show at the left edge.
39
+ * It always takes 3.5rem of the layout. On hover or keyboard focus, its surface expands over the next element to show the labels.
40
+ * A selected item closes it until the pointer leaves the rail, so the page that the item opens is not covered.
41
+ */
42
+ export declare const PrimitiveRail: import("vue").DefineComponent<import("vue").ExtractPropTypes<{
43
+ /** Accessible name of the navigation landmark. */
44
+ label: {
45
+ required: true;
46
+ type: StringConstructor;
47
+ };
48
+ }>, () => VNode<import("vue").RendererNode, import("vue").RendererElement, {
49
+ [key: string]: any;
50
+ }>, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<import("vue").ExtractPropTypes<{
51
+ /** Accessible name of the navigation landmark. */
52
+ label: {
53
+ required: true;
54
+ type: StringConstructor;
55
+ };
56
+ }>> & Readonly<{}>, {}, SlotsType<{
57
+ default?: PrimitiveRailSlot;
58
+ footer?: PrimitiveRailSlot;
59
+ header?: PrimitiveRailSlot;
60
+ }>, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
61
+ /** A group of rail items. A short rule separates consecutive groups. */
62
+ export declare const PrimitiveRailGroup: import("vue").DefineComponent<{}, () => VNode<import("vue").RendererNode, import("vue").RendererElement, {
63
+ [key: string]: any;
64
+ }>, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<{}> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
65
+ /**
66
+ * One rail target: a square icon that becomes a labeled row when the rail expands. It renders a button by default.
67
+ * Pass a link component in `as` and its props, such as `to`, as attributes.
68
+ * The default slot replaces the primitive icon, for example with a host icon component. The icon is decorative.
69
+ * The `label` slot replaces the visible label, for example to add a badge. `label` stays the accessible name.
70
+ */
71
+ export declare const PrimitiveRailItem: import("vue").DefineComponent<import("vue").ExtractPropTypes<{
72
+ as: {
73
+ default: string;
74
+ type: PropType<string | Component>;
75
+ };
76
+ /** Marks the item as the current page with `aria-current="page"`. */
77
+ current: BooleanConstructor;
78
+ icon: {
79
+ required: false;
80
+ type: PropType<PrimitiveIconName>;
81
+ };
82
+ /** Visible label and accessible name. The label shows when the rail expands. */
83
+ label: {
84
+ required: true;
85
+ type: StringConstructor;
86
+ };
87
+ }>, () => VNode<import("vue").RendererNode, import("vue").RendererElement, {
88
+ [key: string]: any;
89
+ }>, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<import("vue").ExtractPropTypes<{
90
+ as: {
91
+ default: string;
92
+ type: PropType<string | Component>;
93
+ };
94
+ /** Marks the item as the current page with `aria-current="page"`. */
95
+ current: BooleanConstructor;
96
+ icon: {
97
+ required: false;
98
+ type: PropType<PrimitiveIconName>;
99
+ };
100
+ /** Visible label and accessible name. The label shows when the rail expands. */
101
+ label: {
102
+ required: true;
103
+ type: StringConstructor;
104
+ };
105
+ }>> & Readonly<{}>, {
106
+ current: boolean;
107
+ as: string | Component;
108
+ }, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
109
+ //#endregion
110
+ export type { PrimitiveIconName, PrimitiveRailSlotProps };
@@ -0,0 +1,284 @@
1
+ import { computed, defineComponent, getCurrentInstance, h, onBeforeUnmount, onMounted, ref, watch } from "vue";
2
+ //#region ../icons/dist/index.js
3
+ const icons = {
4
+ "prefix": "vitehub",
5
+ "info": {
6
+ "name": "ViteHub",
7
+ "total": 46,
8
+ "author": {
9
+ "name": "ViteHub",
10
+ "url": "https://github.com/vite-hub/vitehub/tree/main/packages/icons"
11
+ },
12
+ "license": {
13
+ "title": "Apache 2.0",
14
+ "spdx": "Apache-2.0",
15
+ "url": "https://github.com/vite-hub/vitehub/blob/main/LICENSE"
16
+ },
17
+ "height": 24,
18
+ "category": "UI 24px",
19
+ "palette": false
20
+ },
21
+ "icons": {
22
+ "agent": { "body": "<g fill=\"none\" stroke=\"currentColor\" stroke-linecap=\"round\" stroke-linejoin=\"round\" stroke-width=\"1.5\"><rect x=\"3.5\" y=\"8\" width=\"17\" height=\"12.5\" rx=\"2.5\"/><path d=\"M12 8V5.5\"/><path d=\"M12 3.5h.01\"/><g data-motion=\"\"><path d=\"M9 12.5v3M15 12.5v3\"/></g></g>" },
23
+ "auth": { "body": "<g fill=\"none\" stroke=\"currentColor\" stroke-linecap=\"round\" stroke-linejoin=\"round\" stroke-width=\"1.5\"><rect x=\"4.5\" y=\"10.5\" width=\"15\" height=\"10.5\" rx=\"2\"/><path d=\"M12 14.5v2.5\"/><g data-motion=\"\"><path d=\"M7.5 10.5V7.5a4.5 4.5 0 0 1 9 0v3\"/></g></g>" },
24
+ "blob": { "body": "<g fill=\"none\" stroke=\"currentColor\" stroke-linecap=\"round\" stroke-linejoin=\"round\" stroke-width=\"1.5\"><path d=\"M4 11a2 2 0 0 1 2-2h4l4 4v6a2 2 0 0 1-2 2H6a2 2 0 0 1-2-2z\"/><path d=\"M10 9v4h4\"/><g data-motion=\"\"><path d=\"M10 7V5a2 2 0 0 1 2-2h4l4 4v6a2 2 0 0 1-2 2h-2.5\"/><path d=\"M16 3v4h4\"/></g></g>" },
25
+ "browser": { "body": "<g fill=\"none\" stroke=\"currentColor\" stroke-linecap=\"round\" stroke-linejoin=\"round\" stroke-width=\"1.5\"><rect x=\"3\" y=\"4\" width=\"18\" height=\"16\" rx=\"2\"/><path d=\"M3 9h18M6.5 6.5h.01M9.5 6.5h.01\"/><g data-motion=\"\"><path d=\"m11 12.5 5.5 2-2.25 1-1 2.25z\"/></g></g>" },
26
+ "bundle": { "body": "<g fill=\"none\" stroke=\"currentColor\" stroke-linecap=\"round\" stroke-linejoin=\"round\" stroke-width=\"1.5\"><path d=\"m21 7.5-9-4.5-9 4.5v9l9 4.5 9-4.5zM3 7.5l9 4.5 9-4.5M12 12v9\"/><g data-motion=\"\"><path d=\"m7 5.5 9 4.5\"/></g></g>" },
27
+ "cache": { "body": "<g fill=\"none\" stroke=\"currentColor\" stroke-linecap=\"round\" stroke-linejoin=\"round\" stroke-width=\"1.5\"><rect x=\"3\" y=\"4\" width=\"18\" height=\"16\" rx=\"2\"/><g data-motion=\"\"><path d=\"M13 7.5 9 12.5h3.5l-1 4 4-5H12z\"/></g></g>" },
28
+ "channels": { "body": "<g fill=\"none\" stroke=\"currentColor\" stroke-linecap=\"round\" stroke-linejoin=\"round\" stroke-width=\"1.5\"><path d=\"M3 16.5V6a2 2 0 0 1 2-2h8a2 2 0 0 1 2 2v5a2 2 0 0 1-2 2H6.5z\"/><g data-motion=\"\"><path d=\"M18 8h1a2 2 0 0 1 2 2v10.5L17.5 17H11a2 2 0 0 1-2-2v-.5\"/></g></g>" },
29
+ "cms": { "body": "<g fill=\"none\" stroke=\"currentColor\" stroke-linecap=\"round\" stroke-linejoin=\"round\" stroke-width=\"1.5\"><path d=\"M19 10.5V5a2 2 0 0 0-2-2H7a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h3.5\"/><path d=\"M9 7.5h6M9 11.5h3\"/><g data-motion=\"\"><path d=\"M17.5 13.5l2.5 2.5-5 5h-2.5v-2.5z\"/></g></g>" },
30
+ "codemods": { "body": "<g fill=\"none\" stroke=\"currentColor\" stroke-linecap=\"round\" stroke-linejoin=\"round\" stroke-width=\"1.5\"><path d=\"m7.5 7-4.5 5 4.5 5\"/><g data-motion=\"\"><path d=\"M11 12h10m-3.5-3.5L21 12l-3.5 3.5\"/></g></g>" },
31
+ "comments": { "body": "<g fill=\"none\" stroke=\"currentColor\" stroke-linecap=\"round\" stroke-linejoin=\"round\" stroke-width=\"1.5\"><path d=\"M12 20H4v-8a8 8 0 1 1 8 8z\"/><g data-motion=\"\"><path d=\"M8.5 10.5h7M8.5 14h4.5\"/></g></g>" },
32
+ "compare": { "body": "<g fill=\"none\" stroke=\"currentColor\" stroke-linecap=\"round\" stroke-linejoin=\"round\" stroke-width=\"1.5\"><path d=\"M4 8h16M16 4l4 4-4 4\"/><g data-motion=\"\"><path d=\"M20 16H4M8 12l-4 4 4 4\"/></g></g>" },
33
+ "connections": { "body": "<g fill=\"none\" stroke=\"currentColor\" stroke-linecap=\"round\" stroke-linejoin=\"round\" stroke-width=\"1.5\"><path d=\"M12 16.5V21\"/><g data-motion=\"\"><path d=\"M9 3v4M15 3v4M6.5 7h11v4a5.5 5.5 0 0 1-11 0z\"/></g></g>" },
34
+ "content": { "body": "<g fill=\"none\" stroke=\"currentColor\" stroke-linecap=\"round\" stroke-linejoin=\"round\" stroke-width=\"1.5\"><rect x=\"5\" y=\"3\" width=\"14\" height=\"18\" rx=\"2\"/><path d=\"M9 7.5h6\"/><g data-motion=\"\"><path d=\"M9 11.5h6M9 15.5h4\"/></g></g>" },
35
+ "database": { "body": "<g fill=\"none\" stroke=\"currentColor\" stroke-linecap=\"round\" stroke-linejoin=\"round\" stroke-width=\"1.5\"><path d=\"M4 6v12c0 1.66 3.58 3 8 3s8-1.34 8-3V6\"/><path d=\"M4 12c0 1.66 3.58 3 8 3s8-1.34 8-3\"/><g data-motion=\"\"><path d=\"M4 6c0-1.66 3.58-3 8-3s8 1.34 8 3-3.58 3-8 3-8-1.34-8-3z\"/></g></g>" },
36
+ "decisions": { "body": "<g fill=\"none\" stroke=\"currentColor\" stroke-linecap=\"round\" stroke-linejoin=\"round\" stroke-width=\"1.5\"><path d=\"M12 21v-9\"/><path d=\"M12 12 3 3M3 7.5V3h4.5M12 12l9-9\"/><g data-motion=\"\"><path d=\"M21 7.5V3h-4.5\"/></g></g>" },
37
+ "development": { "body": "<g fill=\"none\" stroke=\"currentColor\" stroke-linecap=\"round\" stroke-linejoin=\"round\" stroke-width=\"1.5\"><path d=\"m8 7-5 5 5 5M16 7l5 5-5 5\"/><g data-motion=\"\"><path d=\"m13.5 5-3 14\"/></g></g>" },
38
+ "device": { "body": "<g fill=\"none\" stroke=\"currentColor\" stroke-linecap=\"round\" stroke-linejoin=\"round\" stroke-width=\"1.5\"><rect x=\"6.5\" y=\"3\" width=\"11\" height=\"18\" rx=\"2.5\"/><path d=\"M10.5 18h3\"/><g data-motion=\"\"><path d=\"M9.5 7.5h5M9.5 10.5h5M9.5 13.5h3\"/></g></g>" },
39
+ "docs": { "body": "<g fill=\"none\" stroke=\"currentColor\" stroke-linecap=\"round\" stroke-linejoin=\"round\" stroke-width=\"1.5\"><path d=\"M12 6.5C10.5 5 8 4.5 3 4.5v14c5 0 7.5.5 9 2\"/><g data-motion=\"\"><path d=\"M12 6.5c1.5-1.5 4-2 9-2v14c-5 0-7.5.5-9 2V6.5\"/></g></g>" },
40
+ "email": { "body": "<g fill=\"none\" stroke=\"currentColor\" stroke-linecap=\"round\" stroke-linejoin=\"round\" stroke-width=\"1.5\"><rect x=\"3\" y=\"5\" width=\"18\" height=\"14\" rx=\"2\"/><g data-motion=\"\"><path d=\"m3.5 7 8.5 6 8.5-6\"/></g></g>" },
41
+ "env": { "body": "<g fill=\"none\" stroke=\"currentColor\" stroke-linecap=\"round\" stroke-linejoin=\"round\" stroke-width=\"1.5\"><g data-motion=\"\"><circle cx=\"7.5\" cy=\"16.5\" r=\"4.5\"/><path d=\"M10.7 13.3 20 4M16.5 7.5 19 10M14 10l2 2\"/></g></g>" },
42
+ "forge": { "body": "<g fill=\"none\" stroke=\"currentColor\" stroke-linecap=\"round\" stroke-linejoin=\"round\" stroke-width=\"1.5\"><circle cx=\"6\" cy=\"6\" r=\"2.5\"/><circle cx=\"6\" cy=\"18\" r=\"2.5\"/><path d=\"M6 8.5v7\"/><g data-motion=\"\"><circle cx=\"18\" cy=\"18\" r=\"2.5\"/><path d=\"M18 15.5V9a3 3 0 0 0-3-3h-4.5M13 3.5 10.5 6 13 8.5\"/></g></g>" },
43
+ "forms": { "body": "<g fill=\"none\" stroke=\"currentColor\" stroke-linecap=\"round\" stroke-linejoin=\"round\" stroke-width=\"1.5\"><rect x=\"3\" y=\"3\" width=\"18\" height=\"5\" rx=\"1.5\"/><rect x=\"3\" y=\"10\" width=\"18\" height=\"5\" rx=\"1.5\"/><g data-motion=\"\"><rect x=\"13\" y=\"17\" width=\"8\" height=\"4\" rx=\"1\"/></g></g>" },
44
+ "gateways": { "body": "<g fill=\"none\" stroke=\"currentColor\" stroke-linecap=\"round\" stroke-linejoin=\"round\" stroke-width=\"1.5\"><path d=\"M3 12h6\"/><rect x=\"9\" y=\"9\" width=\"6\" height=\"6\" rx=\"1.5\"/><g data-motion=\"\"><path d=\"M15 12h6M15 10.5l3.5-4H21M15 13.5l3.5 4H21\"/></g></g>" },
45
+ "guides": { "body": "<g fill=\"none\" stroke=\"currentColor\" stroke-linecap=\"round\" stroke-linejoin=\"round\" stroke-width=\"1.5\"><circle cx=\"12\" cy=\"12\" r=\"9\"/><g data-motion=\"\"><path d=\"m15.5 8.5-2 5-5 2 2-5z\"/></g></g>" },
46
+ "hosts": { "body": "<g fill=\"none\" stroke=\"currentColor\" stroke-linecap=\"round\" stroke-linejoin=\"round\" stroke-width=\"1.5\"><path d=\"m3 12.5 9 4.5 9-4.5M3 16.5l9 4.5 9-4.5\"/><g data-motion=\"\"><path d=\"m12 3 9 4.5-9 4.5-9-4.5z\"/></g></g>" },
47
+ "i18n": { "body": "<g fill=\"none\" stroke=\"currentColor\" stroke-linecap=\"round\" stroke-linejoin=\"round\" stroke-width=\"1.5\"><path d=\"M3.5 6h9M8 3.5V6\"/><path d=\"M5 9.5l5 5M4 15l5-5 2-4\"/><g data-motion=\"\"><path d=\"M12.5 21l4-9 4 9M14 18h5\"/></g></g>" },
48
+ "kv": { "body": "<g fill=\"none\" stroke=\"currentColor\" stroke-linecap=\"round\" stroke-linejoin=\"round\" stroke-width=\"1.5\"><rect x=\"3\" y=\"5\" width=\"18\" height=\"14\" rx=\"2\"/><path d=\"M9 5v14M3 12h18\"/><g data-motion=\"\"><path d=\"M12.5 8.5h5M12.5 15.5h3.5\"/></g></g>" },
49
+ "logs": { "body": "<g fill=\"none\" stroke=\"currentColor\" stroke-linecap=\"round\" stroke-linejoin=\"round\" stroke-width=\"1.5\"><path d=\"M4 6h2M4 12h2M4 18h2\"/><g data-motion=\"\"><path d=\"M9.5 6H20M9.5 12h7.5M9.5 18H19\"/></g></g>" },
50
+ "mcp": { "body": "<g fill=\"none\" stroke=\"currentColor\" stroke-linecap=\"round\" stroke-linejoin=\"round\" stroke-width=\"1.5\"><rect x=\"3\" y=\"3\" width=\"18\" height=\"18\" rx=\"2\"/><path d=\"M12 15.5v1.5\"/><g data-motion=\"\"><path d=\"M9.5 8.5v3.5M14.5 8.5v3.5\"/></g></g>" },
51
+ "queue": { "body": "<g fill=\"none\" stroke=\"currentColor\" stroke-linecap=\"round\" stroke-linejoin=\"round\" stroke-width=\"1.5\"><path d=\"M16.5 12H21M18 9l3 3-3 3\"/><g data-motion=\"\"><rect x=\"3\" y=\"7\" width=\"5\" height=\"10\" rx=\"1.5\"/><rect x=\"9.5\" y=\"7\" width=\"5\" height=\"10\" rx=\"1.5\"/></g></g>" },
52
+ "rate-limit": { "body": "<g fill=\"none\" stroke=\"currentColor\" stroke-linecap=\"round\" stroke-linejoin=\"round\" stroke-width=\"1.5\"><path d=\"M3 16a9 9 0 0 1 18 0M6 20h12\"/><path d=\"M12 16h.01\"/><g data-motion=\"\"><path d=\"m12 16 4-5\"/></g></g>" },
53
+ "realtime": { "body": "<g fill=\"none\" stroke=\"currentColor\" stroke-linecap=\"round\" stroke-linejoin=\"round\" stroke-width=\"1.5\"><circle cx=\"12\" cy=\"12\" r=\"1.5\"/><path d=\"M8.5 8.5a5 5 0 0 0 0 7M15.5 8.5a5 5 0 0 1 0 7\"/><g data-motion=\"\"><path d=\"M5.5 5.5a9.2 9.2 0 0 0 0 13M18.5 5.5a9.2 9.2 0 0 1 0 13\"/></g></g>" },
54
+ "reference": { "body": "<g fill=\"none\" stroke=\"currentColor\" stroke-linecap=\"round\" stroke-linejoin=\"round\" stroke-width=\"1.5\"><path d=\"M8 3.5H7a2 2 0 0 0-2 2V10a2 2 0 0 1-2 2 2 2 0 0 1 2 2v4.5a2 2 0 0 0 2 2h1\"/><g data-motion=\"\"><path d=\"M16 3.5h1a2 2 0 0 1 2 2V10a2 2 0 0 0 2 2 2 2 0 0 0-2 2v4.5a2 2 0 0 1-2 2h-1\"/></g></g>" },
55
+ "sandbox": { "body": "<g fill=\"none\" stroke=\"currentColor\" stroke-linecap=\"round\" stroke-linejoin=\"round\" stroke-width=\"1.5\"><path d=\"M3 8V5a2 2 0 0 1 2-2h3M16 3h3a2 2 0 0 1 2 2v3M21 16v3a2 2 0 0 1-2 2h-3M8 21H5a2 2 0 0 1-2-2v-3\"/><g data-motion=\"\"><rect x=\"8\" y=\"8\" width=\"8\" height=\"8\" rx=\"1.5\"/></g></g>" },
56
+ "schedule": { "body": "<g fill=\"none\" stroke=\"currentColor\" stroke-linecap=\"round\" stroke-linejoin=\"round\" stroke-width=\"1.5\"><rect x=\"3\" y=\"5\" width=\"18\" height=\"16\" rx=\"2\"/><path d=\"M3 10h18M8 3v4M16 3v4\"/><g data-motion=\"\"><rect x=\"7\" y=\"13.5\" width=\"3.5\" height=\"3.5\" rx=\"1\"/></g></g>" },
57
+ "shell": { "body": "<g fill=\"none\" stroke=\"currentColor\" stroke-linecap=\"round\" stroke-linejoin=\"round\" stroke-width=\"1.5\"><rect x=\"3\" y=\"4\" width=\"18\" height=\"16\" rx=\"2\"/><path d=\"m7 9.5 3 2.5-3 2.5\"/><g data-motion=\"\"><path d=\"M12.5 15h4.5\"/></g></g>" },
58
+ "skills": { "body": "<g fill=\"none\" stroke=\"currentColor\" stroke-linecap=\"round\" stroke-linejoin=\"round\" stroke-width=\"1.5\"><path d=\"M5 19V5a2 2 0 0 1 2-2h12v14H7a2 2 0 0 0 0 4h12\"/><g data-motion=\"\"><path d=\"M10 3v6.5l2-1.5 2 1.5V3\"/></g></g>" },
59
+ "source": { "body": "<g fill=\"none\" stroke=\"currentColor\" stroke-linecap=\"round\" stroke-linejoin=\"round\" stroke-width=\"1.5\"><path d=\"M3 14v5a2 2 0 0 0 2 2h14a2 2 0 0 0 2-2v-5\"/><g data-motion=\"\"><path d=\"M12 3v11.5M8 10.5l4 4 4-4\"/></g></g>" },
60
+ "start": { "body": "<g fill=\"none\" stroke=\"currentColor\" stroke-linecap=\"round\" stroke-linejoin=\"round\" stroke-width=\"1.5\"><path d=\"M5 21V3.5\"/><g data-motion=\"\"><path d=\"M5 4h13l-3 4.5 3 4.5H5\"/></g></g>" },
61
+ "sync": { "body": "<g fill=\"none\" stroke=\"currentColor\" stroke-linecap=\"round\" stroke-linejoin=\"round\" stroke-width=\"1.5\"><path d=\"M4 10a8 8 0 0 1 13.5-3.5L20 9M20 4v5h-5\"/><path d=\"M20 14a8 8 0 0 1-13.5 3.5L4 15M4 20v-5h5\"/></g>" },
62
+ "ui": { "body": "<g fill=\"none\" stroke=\"currentColor\" stroke-linecap=\"round\" stroke-linejoin=\"round\" stroke-width=\"1.5\"><rect x=\"3.5\" y=\"3.5\" width=\"7\" height=\"7\" rx=\"1.5\"/><rect x=\"13.5\" y=\"3.5\" width=\"7\" height=\"7\" rx=\"1.5\"/><rect x=\"3.5\" y=\"13.5\" width=\"7\" height=\"7\" rx=\"1.5\"/><g data-motion=\"\"><rect x=\"13.5\" y=\"13.5\" width=\"7\" height=\"7\" rx=\"1.5\"/></g></g>" },
63
+ "usage": { "body": "<g fill=\"none\" stroke=\"currentColor\" stroke-linecap=\"round\" stroke-linejoin=\"round\" stroke-width=\"1.5\"><path d=\"M3 20.5h18\"/><g data-motion=\"\"><rect x=\"5\" y=\"11\" width=\"3\" height=\"6\" rx=\"0.5\"/><rect x=\"10.5\" y=\"5\" width=\"3\" height=\"12\" rx=\"0.5\"/><rect x=\"16\" y=\"8\" width=\"3\" height=\"9\" rx=\"0.5\"/></g></g>" },
64
+ "web-container": { "body": "<g fill=\"none\" stroke=\"currentColor\" stroke-linecap=\"round\" stroke-linejoin=\"round\" stroke-width=\"1.5\"><rect x=\"3\" y=\"4\" width=\"18\" height=\"16\" rx=\"2\"/><path d=\"M3 8.5h18\"/><g data-motion=\"\"><path d=\"m12 11 3.5 2v3.5L12 18.5l-3.5-2V13zM8.5 13l3.5 2 3.5-2M12 15v3.5\"/></g></g>" },
65
+ "webhooks": { "body": "<g fill=\"none\" stroke=\"currentColor\" stroke-linecap=\"round\" stroke-linejoin=\"round\" stroke-width=\"1.5\"><path d=\"M11 3H5a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h14a2 2 0 0 0 2-2v-6\"/><g data-motion=\"\"><path d=\"M15 3h6v6M21 3l-9 9\"/></g></g>" },
66
+ "workflow": { "body": "<g fill=\"none\" stroke=\"currentColor\" stroke-linecap=\"round\" stroke-linejoin=\"round\" stroke-width=\"1.5\"><rect x=\"3\" y=\"3\" width=\"6\" height=\"6\" rx=\"1.5\"/><rect x=\"3\" y=\"15\" width=\"6\" height=\"6\" rx=\"1.5\"/><path d=\"M9 6h2.5a1 1 0 0 1 1 1v10a1 1 0 0 1-1 1H9M12.5 12H15\"/><g data-motion=\"\"><rect x=\"15\" y=\"9\" width=\"6\" height=\"6\" rx=\"1.5\"/></g></g>" },
67
+ "workspace": { "body": "<g fill=\"none\" stroke=\"currentColor\" stroke-linecap=\"round\" stroke-linejoin=\"round\" stroke-width=\"1.5\"><path d=\"M3 7a2 2 0 0 1 2-2h4l2 2h8a2 2 0 0 1 2 2v9a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2z\"/><g data-motion=\"\"><path d=\"M3 11h18\"/></g></g>" }
68
+ },
69
+ "width": 24,
70
+ "height": 24
71
+ };
72
+ //#endregion
73
+ //#region src/components/primitive-icon.ts
74
+ function isPrimitiveIconName(value) {
75
+ return typeof value === "string" && Object.hasOwn(icons.icons, value);
76
+ }
77
+ const primitiveIconNames = Object.keys(icons.icons).filter(isPrimitiveIconName);
78
+ /** Returns the set icon that an Iconify name such as `i-vitehub-kv` or `vitehub:kv` names, or a bare name such as `kv`. */
79
+ function resolvePrimitiveIconName(icon) {
80
+ const name = icon.replace(/^(?:i-vitehub-|vitehub:)/, "");
81
+ return isPrimitiveIconName(name) ? name : void 0;
82
+ }
83
+ /**
84
+ * Inline SVG of a `@vite-hub/icons` icon, so the part that each icon marks with `data-motion` can move when its rail item
85
+ * gets a pointer or keyboard focus. `styles.css` sets the motion of each icon. Strokes use currentColor.
86
+ */
87
+ const PrimitiveIcon = defineComponent({
88
+ name: "PrimitiveIcon",
89
+ props: { name: {
90
+ required: true,
91
+ type: String
92
+ } },
93
+ setup(props) {
94
+ return () => h("svg", {
95
+ "aria-hidden": "true",
96
+ class: "vh-primitive-icon",
97
+ "data-icon": props.name,
98
+ innerHTML: icons.icons[props.name].body,
99
+ viewBox: "0 0 24 24",
100
+ xmlns: "http://www.w3.org/2000/svg"
101
+ });
102
+ }
103
+ });
104
+ //#endregion
105
+ //#region src/components/primitive-rail.ts
106
+ const hoverIntentDelay = 200;
107
+ /**
108
+ * The narrow icon rail that ViteHub docs and the Console show at the left edge.
109
+ * It always takes 3.5rem of the layout. On hover or keyboard focus, its surface expands over the next element to show the labels.
110
+ * A selected item closes it until the pointer leaves the rail, so the page that the item opens is not covered.
111
+ */
112
+ const PrimitiveRail = defineComponent({
113
+ name: "PrimitiveRail",
114
+ props: {
115
+ /** Accessible name of the navigation landmark. */
116
+ label: {
117
+ required: true,
118
+ type: String
119
+ } },
120
+ slots: Object,
121
+ setup(props, { slots }) {
122
+ const hovered = ref(false);
123
+ const focused = ref(false);
124
+ const dismissed = ref(false);
125
+ const selected = ref();
126
+ const root = ref();
127
+ const expanded = computed(() => (hovered.value || focused.value) && !dismissed.value && !selected.value);
128
+ let intent;
129
+ const cancelIntent = () => {
130
+ clearTimeout(intent);
131
+ intent = void 0;
132
+ };
133
+ const release = () => {
134
+ if (!hovered.value && !focused.value) dismissed.value = false;
135
+ };
136
+ function onPointerenter(event) {
137
+ if (event.pointerType === "touch" || !globalThis.matchMedia?.("(hover: hover) and (pointer: fine)").matches) return;
138
+ cancelIntent();
139
+ intent = setTimeout(() => {
140
+ intent = void 0;
141
+ hovered.value = true;
142
+ }, hoverIntentDelay);
143
+ }
144
+ function onPointerleave() {
145
+ cancelIntent();
146
+ hovered.value = false;
147
+ selected.value = void 0;
148
+ release();
149
+ }
150
+ function onClick(event) {
151
+ const item = event.target instanceof Element ? event.target.closest(".vh-primitive-rail__item") : null;
152
+ if (!item || !root.value?.contains(item) || item.matches("[aria-haspopup]")) return;
153
+ cancelIntent();
154
+ selected.value = item;
155
+ }
156
+ function dismissForMenu(event) {
157
+ if (!(event.target instanceof Element) || !root.value?.contains(event.target) || !event.target.closest("[aria-haspopup]")) return;
158
+ cancelIntent();
159
+ dismissed.value = true;
160
+ }
161
+ function onFocusin(event) {
162
+ focused.value = event.target instanceof Element && event.target.matches(":focus-visible");
163
+ if (focused.value && event.target !== selected.value) selected.value = void 0;
164
+ }
165
+ function onFocusout(event) {
166
+ const rail = event.currentTarget;
167
+ if (rail instanceof Element && event.relatedTarget instanceof Node && rail.contains(event.relatedTarget)) return;
168
+ focused.value = false;
169
+ if (!hovered.value) selected.value = void 0;
170
+ release();
171
+ }
172
+ function onKeydown(event) {
173
+ if ([
174
+ "Enter",
175
+ " ",
176
+ "ArrowDown"
177
+ ].includes(event.key)) dismissForMenu(event);
178
+ else if (event.key === "Escape" && expanded.value) {
179
+ cancelIntent();
180
+ dismissed.value = true;
181
+ }
182
+ }
183
+ onMounted(() => document.addEventListener("keydown", onKeydown));
184
+ onBeforeUnmount(() => {
185
+ cancelIntent();
186
+ document.removeEventListener("keydown", onKeydown);
187
+ });
188
+ return () => {
189
+ const slotProps = { expanded: expanded.value };
190
+ return h("nav", {
191
+ "aria-label": props.label,
192
+ class: "vh-primitive-rail",
193
+ "data-dismissed": dismissed.value ? "" : void 0,
194
+ "data-expanded": expanded.value ? "" : void 0,
195
+ onClick,
196
+ onFocusin,
197
+ onFocusout,
198
+ onPointerdown: dismissForMenu,
199
+ onPointerenter,
200
+ onPointerleave,
201
+ ref: root
202
+ }, h("div", { class: "vh-primitive-rail__surface" }, [
203
+ slots.header ? h("div", { class: "vh-primitive-rail__header" }, slots.header(slotProps)) : null,
204
+ h("div", { class: "vh-primitive-rail__body" }, slots.default?.(slotProps)),
205
+ slots.footer ? h("div", { class: "vh-primitive-rail__footer" }, slots.footer(slotProps)) : null
206
+ ]));
207
+ };
208
+ }
209
+ });
210
+ /**
211
+ * Scrolls the rail body the least amount that shows the whole item, with no animation.
212
+ * It changes only the rail's own scroll position, never the page scroll.
213
+ */
214
+ function revealInRail(item) {
215
+ const body = item.closest(".vh-primitive-rail__body");
216
+ if (!body) return;
217
+ const itemBox = item.getBoundingClientRect();
218
+ const bodyBox = body.getBoundingClientRect();
219
+ if (itemBox.top < bodyBox.top) body.scrollTop -= bodyBox.top - itemBox.top;
220
+ else if (itemBox.bottom > bodyBox.bottom) body.scrollTop += itemBox.bottom - bodyBox.bottom;
221
+ }
222
+ /** A group of rail items. A short rule separates consecutive groups. */
223
+ const PrimitiveRailGroup = defineComponent({
224
+ name: "PrimitiveRailGroup",
225
+ setup(_props, { slots }) {
226
+ return () => h("div", { class: "vh-primitive-rail__group" }, slots.default?.());
227
+ }
228
+ });
229
+ /**
230
+ * One rail target: a square icon that becomes a labeled row when the rail expands. It renders a button by default.
231
+ * Pass a link component in `as` and its props, such as `to`, as attributes.
232
+ * The default slot replaces the primitive icon, for example with a host icon component. The icon is decorative.
233
+ * The `label` slot replaces the visible label, for example to add a badge. `label` stays the accessible name.
234
+ */
235
+ const PrimitiveRailItem = defineComponent({
236
+ name: "PrimitiveRailItem",
237
+ props: {
238
+ as: {
239
+ default: "button",
240
+ type: [
241
+ String,
242
+ Object,
243
+ Function
244
+ ]
245
+ },
246
+ /** Marks the item as the current page with `aria-current="page"`. */
247
+ current: Boolean,
248
+ icon: {
249
+ required: false,
250
+ type: String
251
+ },
252
+ /** Visible label and accessible name. The label shows when the rail expands. */
253
+ label: {
254
+ required: true,
255
+ type: String
256
+ }
257
+ },
258
+ setup(props, { slots }) {
259
+ const instance = getCurrentInstance();
260
+ const revealIfCurrent = () => {
261
+ const element = instance?.proxy?.$el;
262
+ if (props.current && typeof globalThis.Element === "function" && element instanceof Element) revealInRail(element);
263
+ };
264
+ onMounted(revealIfCurrent);
265
+ watch(() => props.current, revealIfCurrent, { flush: "post" });
266
+ const content = () => [h("span", {
267
+ "aria-hidden": "true",
268
+ class: "vh-primitive-rail__icon"
269
+ }, slots.default?.() ?? (props.icon ? [h(PrimitiveIcon, { name: props.icon })] : [])), h("span", { class: "vh-primitive-rail__label" }, slots.label?.() ?? props.label)];
270
+ return () => {
271
+ const attributes = {
272
+ "aria-current": props.current ? "page" : void 0,
273
+ "aria-label": props.label,
274
+ class: "vh-primitive-rail__item"
275
+ };
276
+ return typeof props.as === "string" ? h(props.as, {
277
+ ...attributes,
278
+ type: props.as === "button" ? "button" : void 0
279
+ }, content()) : h(props.as, attributes, { default: content });
280
+ };
281
+ }
282
+ });
283
+ //#endregion
284
+ export { PrimitiveIcon, PrimitiveRail, PrimitiveRailGroup, PrimitiveRailItem, isPrimitiveIconName, primitiveIconNames, resolvePrimitiveIconName };