@vite-hub/docs 0.4.1 → 0.5.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 (75) hide show
  1. package/README.md +167 -7
  2. package/dist/{agent-copy-xPaWye_g.js → agent-copy-CY9_RkHN.js} +2 -3
  3. package/dist/{assistant-pages-BN7hNsSZ.js → assistant-pages-BbWfd69g.js} +3 -4
  4. package/dist/{assistant-shared-CWIKRtBv.d.ts → assistant-shared-BWeRcmVS.d.ts} +0 -2
  5. package/dist/{assistant-shared-WzButktj.js → assistant-shared-JcfjK-qg.js} +3 -4
  6. package/dist/assistant-worker.d.ts +1 -3
  7. package/dist/assistant-worker.js +2 -3
  8. package/dist/assistant.d.ts +1 -3
  9. package/dist/assistant.js +2 -3
  10. package/dist/{content-CPZGnn3S.js → content-C_WXjV3y.js} +60 -28
  11. package/dist/{draft-BjWmaiLn.js → draft-rOGhtXch.js} +3 -4
  12. package/dist/{error-diagnostics-B_ZOy7kF.js → error-diagnostics-Daz9oBJS.js} +65 -2
  13. package/dist/{files-UY4h1_36.js → files-BBoAGhhM.js} +1 -2
  14. package/dist/index.d.ts +7 -8
  15. package/dist/index.js +5 -6
  16. package/dist/link-checker-redirects.d.ts +0 -2
  17. package/dist/link-checker-redirects.js +2 -3
  18. package/dist/{manifest-ZdxLrcvt.js → manifest-Bti_WxDZ.js} +64 -30
  19. package/dist/{manifest-CMoxcwPm.d.ts → manifest-DJ2DyNue.d.ts} +1 -5
  20. package/dist/{page-Dx2JD3y1.d.ts → markdown-B97RuMXs.d.ts} +2 -27
  21. package/dist/{markdown-DUWnEMPp.js → markdown-BzZkYb24.js} +2 -3
  22. package/dist/navigation.d.ts +10 -6
  23. package/dist/navigation.js +23 -10
  24. package/dist/{nuxt-CAGpKl_-.d.ts → nuxt-CYAIBEHE.d.ts} +74 -8
  25. package/dist/nuxt.d.ts +3 -3
  26. package/dist/nuxt.js +1286 -89
  27. package/dist/page-B8_70-5D.d.ts +24 -0
  28. package/dist/{page-GPt09oex.js → page-DWsretqk.js} +20 -5
  29. package/dist/primitive-rail.d.ts +1 -10
  30. package/dist/primitive-rail.js +4 -10
  31. package/dist/{raw-BChwipz_.js → raw-CQukuLuj.js} +1 -2
  32. package/dist/{redirects-CmR1yu5A.js → redirects-BEFu4KLR.js} +35 -23
  33. package/dist/runnable.d.ts +33 -0
  34. package/dist/runnable.js +104 -0
  35. package/dist/runtime/app/components/DocsAsideLeftBody.vue +2 -8
  36. package/dist/runtime/app/components/DocsLearn.vue +215 -0
  37. package/dist/runtime/app/components/DocsLearnCodePre.vue +98 -0
  38. package/dist/runtime/app/components/DocsLearnFile.vue +21 -0
  39. package/dist/runtime/app/components/DocsPage.vue +11 -5
  40. package/dist/runtime/app/components/DocsPlayground.vue +117 -0
  41. package/dist/runtime/app/components/content/Example.vue +18 -49
  42. package/dist/runtime/app/components/content/PageList.vue +1 -5
  43. package/dist/runtime/app/layouts/docs.vue +36 -8
  44. package/dist/runtime/app/middleware/docs-layout.ts +2 -2
  45. package/dist/runtime/app/utils/docs-learn.ts +31 -0
  46. package/dist/runtime/app/utils/docs-playground.ts +3 -0
  47. package/dist/runtime/server/llms.d.ts +0 -2
  48. package/dist/runtime/server/llms.js +2 -3
  49. package/dist/runtime/server/markdown.d.ts +0 -7
  50. package/dist/runtime/server/markdown.js +11 -3
  51. package/dist/runtime/server/mcp.d.ts +0 -2
  52. package/dist/runtime/server/mcp.js +2 -3
  53. package/dist/runtime/server/page.d.ts +1 -3
  54. package/dist/runtime/server/page.js +4 -5
  55. package/dist/runtime/server/raw.d.ts +0 -2
  56. package/dist/runtime/server/raw.js +3 -11
  57. package/dist/runtime/server/search.d.ts +1 -3
  58. package/dist/runtime/server/search.js +4 -4
  59. package/dist/runtime/server/sitemap.d.ts +0 -2
  60. package/dist/runtime/server/sitemap.js +3 -5
  61. package/dist/runtime/server/trailing-slash.d.ts +0 -2
  62. package/dist/runtime/server/trailing-slash.js +1 -2
  63. package/dist/schema-CmSiwC4t.js +189 -0
  64. package/dist/server.d.ts +3 -4
  65. package/dist/server.js +4 -4
  66. package/dist/snapshot-worker.mjs +40 -0
  67. package/dist/steps-C3tGwhNK.d.ts +103 -0
  68. package/dist/steps-muDP1nYT.js +31 -0
  69. package/dist/{theme-BXyu4uFL.d.ts → theme-CgJRnVdT.d.ts} +0 -4
  70. package/dist/{theme-DzC8LtMH.js → theme-CxBzPBZ9.js} +2 -4
  71. package/dist/theme.d.ts +1 -1
  72. package/dist/theme.js +1 -2
  73. package/dist/{types-BhG6vGfG.d.ts → types-B6YlHil4.d.ts} +69 -8
  74. package/package.json +40 -32
  75. package/dist/schema-DwpXW0VZ.js +0 -98
@@ -1,12 +1,42 @@
1
1
  import { z } from "zod";
2
- //#region src/schema.d.ts
2
+ import { ConnectProviderName } from "@vite-hub/web-container/connect";
3
3
  /**
4
4
  * How a page renders. `article` is prose with an outline, `tutorial` numbers its steps, `landing` is a wide Overview,
5
5
  * and `home` is the page's own blocks at full width under the site header, without the docs sidebar, such as a
6
- * product home page.
6
+ * product home page. `playground` and `learn` fill the page with a code workspace: `playground` opens the apps of
7
+ * `examples`, and `learn` runs the `::tutorial-step` blocks of a lesson on its `fixture`.
7
8
  */
8
- declare const docsLayouts: readonly ["article", "tutorial", "landing", "home"];
9
+ declare const docsLayouts: readonly ["article", "tutorial", "landing", "home", "playground", "learn"];
9
10
  type DocsLayout = (typeof docsLayouts)[number];
11
+ /** An app of a `layout: playground` page. */
12
+ interface DocsPlaygroundExample {
13
+ /** The `?example=` value and the id in share links. */
14
+ id: string;
15
+ label: string;
16
+ /** The heading of the example in the examples menu. */
17
+ group?: string;
18
+ /** One line under the label in the examples menu and on the start screen. */
19
+ description?: string;
20
+ /** The folder of the app, relative to the app root, such as `examples/hello`. */
21
+ dir: string;
22
+ /** The file that the editor opens first. Defaults to the first file. */
23
+ open?: string;
24
+ /** The path that the preview opens when the dev server is ready. Defaults to `/`. */
25
+ preview?: string;
26
+ /**
27
+ * Text files of `dir` that the editor does not let the reader change, such as `["model.ts"]`. Code can still change
28
+ * them. A path that is not a text file of `dir` fails the build with `DOCS_WORKSPACE_READONLY_MISSING`.
29
+ */
30
+ readonly?: string[];
31
+ }
32
+ /** An output tab of a `layout: playground` page. */
33
+ interface DocsPlaygroundTab {
34
+ /** Names the component that draws the tab: `messages` is `app/components/playground/PlaygroundTabMessages.vue`. */
35
+ value: string;
36
+ label: string;
37
+ }
38
+ /** An account that a playground page can connect: each one takes a token in its Connect tab. */
39
+ type DocsConnectProvider = Exclude<ConnectProviderName, "cloudflare">;
10
40
  /** Navigation fields of a page. `false` keeps the page out of the sidebar. */
11
41
  type DocsPageNavigation = false | {
12
42
  /** Label in the sidebar. Defaults to the page title. */
@@ -49,6 +79,33 @@ interface DocsPageFrontmatter {
49
79
  /** `false` hides the "On this page" outline. */
50
80
  toc?: boolean;
51
81
  navigation?: DocsPageNavigation;
82
+ /** `layout: playground` only. The apps that the workspace opens, in menu order. */
83
+ examples?: DocsPlaygroundExample[];
84
+ /** `layout: playground` only. More output tabs after the tabs of the runner. */
85
+ tabs?: DocsPlaygroundTab[];
86
+ /**
87
+ * `layout: playground` only. A module, relative to the app root, such as `app/playground/render.ts`, whose default
88
+ * export renders the files to HTML in the page. Without it, the examples run in a WebContainer.
89
+ */
90
+ render?: string;
91
+ /**
92
+ * `layout: playground` without `render`. The accounts that the reader can connect in a Connect tab, such as
93
+ * `[github, vercel]`. A credential stays in the browser tab and reaches the app as an environment variable.
94
+ */
95
+ connect?: DocsConnectProvider[];
96
+ /** `playground` and `learn` without `render`. The port of the dev server of the app. Defaults to `3000`. */
97
+ port?: number;
98
+ /** `layout: learn` only. The folder of the app after the last step, in the `docs.runnable.fixtures` folder. */
99
+ fixture?: string;
100
+ /** `layout: learn` only. Where the step text goes: `side` in a column beside the code (the default), or `top` over it. */
101
+ guide?: "top" | "side";
102
+ /**
103
+ * `layout: learn` only. The URL of the docs page whose `::tutorial-step` blocks are the steps, such as
104
+ * `/docs/getting-started/first-agent`. Defaults to this page, so the steps can live in the page itself.
105
+ */
106
+ lesson?: string;
107
+ /** `layout: learn` only. The path that the preview opens when the dev server is ready. Defaults to `/`. */
108
+ preview?: string;
52
109
  /**
53
110
  * Search and share fields, when they differ from the page's own. `image` is the share image: a path in `public/` or a
54
111
  * URL, or `false` for none. Without it the build renders one from the title and description. `index: false` asks
@@ -98,13 +155,16 @@ type Fields<T> = { [K in keyof T]-?: z.ZodType<T[K]>; };
98
155
  * dotted keys back as dotted keys.
99
156
  */
100
157
  declare const docsPageFields: Fields<DocsPageFile>;
101
- /** The build validates frontmatter with this schema after `docsFrontmatter()` expanded its dotted keys. */
158
+ /**
159
+ * The build validates frontmatter with this schema after `docsFrontmatter()` expanded its dotted keys. It also checks
160
+ * that the workspace fields sit on the layouts that read them.
161
+ */
102
162
  declare const docsPageSchema: z.ZodType<DocsPageFrontmatter>;
103
163
  declare const docsSectionSchema: z.ZodType<DocsSectionFile>;
104
164
  /** YAML keys such as `navigation.order: 2` become nested objects, as Markdown frontmatter writers expect. */
105
165
  declare function expandDottedKeys(input: Record<string, unknown>): Record<string, unknown>;
106
- //#endregion
107
- //#region src/types.d.ts
166
+ /** The workspace fields of a `layout: playground` or `layout: learn` page, as its frontmatter sets them. */
167
+ type DocsPageWorkspace = Pick<DocsPageFrontmatter, "examples" | "tabs" | "render" | "connect" | "port" | "fixture" | "guide" | "lesson" | "preview">;
108
168
  /**
109
169
  * The fields of a page that the app reads. `useDocsManifest()` returns pages with only these fields, so every page of
110
170
  * the site does not carry the text and SEO options of every other page. The page route returns the whole `DocsPage`.
@@ -161,6 +221,8 @@ interface DocsPage extends DocsAppPage {
161
221
  image?: string | false;
162
222
  index?: boolean;
163
223
  };
224
+ /** On a `playground` or `learn` page: the fields that set up its workspace. */
225
+ workspace?: DocsPageWorkspace;
164
226
  }
165
227
  /** A folder under the docs base: one rail entry with its own page list. */
166
228
  interface DocsSection<Page extends DocsAppPage = DocsPage> {
@@ -208,5 +270,4 @@ interface DocsSearchSection {
208
270
  /** `false` on the one record of a page that search engines skip, such as a generated error code page. */
209
271
  indexed?: false;
210
272
  }
211
- //#endregion
212
- export { DocsSection as a, DocsPageFile as c, DocsSectionFile as d, docsLayouts as f, expandDottedKeys as g, docsSectionSchema as h, DocsSearchSection as i, DocsPageFrontmatter as l, docsPageSchema as m, DocsManifest as n, DocsTocLink as o, docsPageFields as p, DocsPage as r, DocsLayout as s, DocsAppPage as t, DocsPageNavigation as u };
273
+ export { docsPageFields as _, DocsSearchSection as a, expandDottedKeys as b, DocsConnectProvider as c, DocsPageFrontmatter as d, DocsPageNavigation as f, docsLayouts as g, DocsSectionFile as h, DocsPageWorkspace as i, DocsLayout as l, DocsPlaygroundTab as m, DocsManifest as n, DocsSection as o, DocsPlaygroundExample as p, DocsPage as r, DocsTocLink as s, DocsAppPage as t, DocsPageFile as u, docsPageSchema as v, docsSectionSchema as y };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@vite-hub/docs",
3
- "version": "0.4.1",
3
+ "version": "0.5.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",
@@ -50,6 +50,11 @@
50
50
  "import": "./dist/nuxt.js",
51
51
  "default": "./dist/nuxt.js"
52
52
  },
53
+ "./runnable": {
54
+ "types": "./dist/runnable.d.ts",
55
+ "import": "./dist/runnable.js",
56
+ "default": "./dist/runnable.js"
57
+ },
53
58
  "./server": {
54
59
  "types": "./dist/server.d.ts",
55
60
  "import": "./dist/server.js",
@@ -64,16 +69,17 @@
64
69
  },
65
70
  "dependencies": {
66
71
  "@nuxt/fonts": "^1.2.0",
67
- "@nuxt/kit": "4.6.2",
68
- "@takumi-rs/core": "2.19.0",
69
- "@vite-hub/content": "0.4.1",
70
- "@vite-hub/rate-limit": "0.4.1",
71
- "@vite-hub/source": "0.4.1",
72
- "@vite-hub/ui": "0.4.1",
73
- "@vite-hub/workspace": "0.4.1",
74
- "@vueuse/core": "^14.4.0",
72
+ "@nuxt/kit": "4.6.4",
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",
80
+ "@vueuse/core": "^15.0.0",
75
81
  "comark-content": "0.5.1",
76
- "comark-zoom": "^0.12.0",
82
+ "comark-zoom": "^0.12.2",
77
83
  "defu": "^6.1.7",
78
84
  "nostics": "1.4.0",
79
85
  "nuxt-agent-discovery": "^0.8.2",
@@ -81,47 +87,49 @@
81
87
  "nuxt-og-image": "^7.0.7",
82
88
  "nuxt-schema-org": "^7.0.1",
83
89
  "nuxt-site-config": "^5.0.3",
84
- "postcss": "^8.5.29",
90
+ "postcss": "^8.5.33",
85
91
  "rou3": "^1.0.0",
86
- "shiki": "^4.5.0",
92
+ "shiki": "^4.6.0",
87
93
  "ultrahtml": "^1.7.0",
88
94
  "yaml": "^2.9.1",
89
95
  "zod": "^4.6.7"
90
96
  },
91
97
  "devDependencies": {
92
- "@comark/html": "^0.9.0",
93
- "@comark/vue": "0.9.0",
94
- "@nuxt/ui": "^4.12.0",
95
- "@types/node": "^24.19.1",
96
- "@vue/test-utils": "2.5.1",
97
- "@vite-hub/agent": "0.4.1",
98
- "@vite-hub/gateways": "0.4.1",
98
+ "@comark/html": "^0.9.2",
99
+ "@comark/vue": "0.9.2",
100
+ "@nuxt/ui": "^4.13.0",
101
+ "@types/node": "^24.19.2",
102
+ "@vue/test-utils": "2.6.0",
103
+ "@vite-hub/agent": "0.5.1",
104
+ "@vite-hub/gateways": "0.5.1",
99
105
  "@vite-hub/icons": "0.1.0",
100
106
  "@vite-hub/internal": "0.0.1",
101
- "comark": "^0.9.0",
102
- "comark-ui": "^0.12.0",
107
+ "comark": "^0.9.2",
108
+ "comark-ui": "^0.12.2",
103
109
  "h3": "^2.0.8",
104
- "happy-dom": "21.0.3",
105
- "linkedom": "^0.18.13",
110
+ "happy-dom": "21.0.4",
111
+ "linkedom": "^0.18.15",
106
112
  "nitro": "^3.0.261103-rc",
107
- "nuxt": "npm:nuxt-nightly@5.0.0-2611052317-a04317f",
113
+ "nuxt": "npm:nuxt-nightly@5.0.0-2611222336-0ed8910",
114
+ "playwright-core": "^1.65.1",
108
115
  "publint": "^0.3.25",
109
- "tailwindcss": "^4.3.3",
116
+ "tailwindcss": "^4.3.5",
110
117
  "typescript": "^6.0.3",
111
- "vite": "^8.2.2",
112
- "vite-plus": "^0.3.3",
113
- "vitest": "^4.1.11",
114
- "vue": "3.5.44"
118
+ "vite": "^8.3.8",
119
+ "vite-plus": "^1.7.0",
120
+ "vitest": "5.1.0",
121
+ "vue": "3.5.46",
122
+ "workerd": "1.20260730.1"
115
123
  },
116
124
  "peerDependencies": {
117
125
  "@comark/html": "^0.8.1 || ^0.9.0",
118
126
  "@comark/vue": "^0.8.1 || ^0.9.0",
119
127
  "@nuxt/ui": "^4.11.0",
120
- "@vite-hub/agent": "0.4.1",
121
- "@vite-hub/gateways": "0.4.1",
128
+ "@vite-hub/agent": "0.5.1",
129
+ "@vite-hub/gateways": "0.5.1",
122
130
  "comark": "^0.8.1 || ^0.9.0",
123
131
  "comark-ui": "^0.12.0",
124
- "nuxt": ">=5.0.0-0",
132
+ "nuxt": "^4.7.0 || >=5.0.0-0",
125
133
  "vue": "^3.5.0"
126
134
  },
127
135
  "peerDependenciesMeta": {
@@ -1,98 +0,0 @@
1
- import { z } from "zod";
2
- //#region src/schema.ts
3
- /**
4
- * How a page renders. `article` is prose with an outline, `tutorial` numbers its steps, `landing` is a wide Overview,
5
- * and `home` is the page's own blocks at full width under the site header, without the docs sidebar, such as a
6
- * product home page.
7
- */
8
- const docsLayouts = [
9
- "article",
10
- "tutorial",
11
- "landing",
12
- "home"
13
- ];
14
- const navigationFields = {
15
- title: z.string().optional(),
16
- order: z.number().optional(),
17
- group: z.string().optional(),
18
- kind: z.string().optional(),
19
- panel: z.boolean().optional()
20
- };
21
- const seoFields = {
22
- title: z.string().optional(),
23
- description: z.string().optional(),
24
- image: z.union([z.string(), z.literal(false)]).optional(),
25
- index: z.boolean().optional()
26
- };
27
- const pageFields = {
28
- title: z.string(),
29
- description: z.string().optional(),
30
- tagline: z.string().optional(),
31
- eyebrow: z.string().optional(),
32
- credits: z.string().optional(),
33
- keywords: z.union([z.string(), z.array(z.string())]).optional(),
34
- icon: z.string().optional(),
35
- layout: z.enum(docsLayouts).optional(),
36
- tutorial: z.enum(["project", "quickstart"]).optional(),
37
- codePanel: z.boolean().optional(),
38
- sidebar: z.union([z.boolean(), z.literal("collapsed")]).optional(),
39
- toc: z.boolean().optional(),
40
- navigation: z.union([z.literal(false), z.strictObject(navigationFields)]).optional(),
41
- seo: z.strictObject(seoFields).optional()
42
- };
43
- /**
44
- * Frontmatter fields of a docs page as files store them, one Standard Schema per field. `docsCollection()` passes them
45
- * to `documents()`, so the Console editor validates the same values that the build validates, and a save writes
46
- * dotted keys back as dotted keys.
47
- */
48
- const docsPageFields = {
49
- ...pageFields,
50
- "navigation.title": navigationFields.title,
51
- "navigation.order": navigationFields.order,
52
- "navigation.group": navigationFields.group,
53
- "navigation.kind": navigationFields.kind,
54
- "navigation.panel": navigationFields.panel,
55
- "seo.title": seoFields.title,
56
- "seo.description": seoFields.description,
57
- "seo.image": seoFields.image,
58
- "seo.index": seoFields.index
59
- };
60
- /** The build validates frontmatter with this schema after `docsFrontmatter()` expanded its dotted keys. */
61
- const docsPageSchema = z.strictObject(pageFields);
62
- const docsSectionSchema = z.strictObject({
63
- title: z.string().optional(),
64
- icon: z.string().optional(),
65
- order: z.number().optional(),
66
- category: z.string().optional(),
67
- group: z.string().optional(),
68
- fold: z.boolean().optional(),
69
- related: z.array(z.string()).optional()
70
- });
71
- /** YAML keys such as `navigation.order: 2` become nested objects, as Markdown frontmatter writers expect. */
72
- function expandDottedKeys(input) {
73
- const output = {};
74
- for (const [key, value] of Object.entries(input)) {
75
- const parts = key.split(".");
76
- let target = output;
77
- for (const part of parts.slice(0, -1)) {
78
- const next = target[part];
79
- target = isRecord(next) ? next : target[part] = {};
80
- }
81
- target[parts.at(-1)] = value;
82
- }
83
- return output;
84
- }
85
- /**
86
- * Frontmatter with its dotted keys expanded. `navigation: false` hides the page even when dotted keys such as
87
- * `navigation.title` also set fields.
88
- */
89
- function docsFrontmatter(input) {
90
- const expanded = expandDottedKeys(input);
91
- if (input.navigation === false) expanded.navigation = false;
92
- return expanded;
93
- }
94
- function isRecord(value) {
95
- return typeof value === "object" && value !== null && !Array.isArray(value);
96
- }
97
- //#endregion
98
- export { docsSectionSchema as a, docsPageSchema as i, docsLayouts as n, expandDottedKeys as o, docsPageFields as r, docsFrontmatter as t };