@wrksz/docs 0.0.0-stage → 0.1.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 (156) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +157 -2
  3. package/dist/agents.d.ts +30 -0
  4. package/dist/agents.js +70 -0
  5. package/dist/components/agent-logos.js +90 -0
  6. package/dist/components/agent-prompt.d.ts +29 -0
  7. package/dist/components/agent-prompt.js +100 -0
  8. package/dist/components/badge.d.ts +16 -0
  9. package/dist/components/badge.js +26 -0
  10. package/dist/components/brand.js +32 -0
  11. package/dist/components/callout.d.ts +24 -0
  12. package/dist/components/callout.js +58 -0
  13. package/dist/components/cards.d.ts +26 -0
  14. package/dist/components/cards.js +48 -0
  15. package/dist/components/code-body.js +18 -0
  16. package/dist/components/code-group.d.ts +20 -0
  17. package/dist/components/code-group.js +41 -0
  18. package/dist/components/code-tabs.d.ts +30 -0
  19. package/dist/components/code-tabs.js +49 -0
  20. package/dist/components/content-tabs.d.ts +14 -0
  21. package/dist/components/content-tabs.js +27 -0
  22. package/dist/components/copy-code.js +41 -0
  23. package/dist/components/deferred-analytics.js +5 -0
  24. package/dist/components/details.d.ts +20 -0
  25. package/dist/components/details.js +29 -0
  26. package/dist/components/heading-link.js +23 -0
  27. package/dist/components/heading.d.ts +5 -0
  28. package/dist/components/heading.js +22 -0
  29. package/dist/components/icons.js +362 -0
  30. package/dist/components/image.d.ts +27 -0
  31. package/dist/components/image.js +204 -0
  32. package/dist/components/inline-text.js +14 -0
  33. package/dist/components/install.d.ts +22 -0
  34. package/dist/components/install.js +62 -0
  35. package/dist/components/mdx-tabs.d.ts +22 -0
  36. package/dist/components/mdx-tabs.js +30 -0
  37. package/dist/components/practice.d.ts +41 -0
  38. package/dist/components/practice.js +99 -0
  39. package/dist/components/props.d.ts +37 -0
  40. package/dist/components/props.js +70 -0
  41. package/dist/components/status.js +35 -0
  42. package/dist/components/steps.d.ts +18 -0
  43. package/dist/components/steps.js +23 -0
  44. package/dist/components/theme-switch.js +31 -0
  45. package/dist/components/ui/kbd.js +410 -0
  46. package/dist/components/ui/scroll-area.js +169 -0
  47. package/dist/components/ui/table.d.ts +33 -0
  48. package/dist/components/ui/table.js +103 -0
  49. package/dist/components/ui/tabs.js +69 -0
  50. package/dist/components/ui/toast.js +629 -0
  51. package/dist/components/ui/tooltip.js +31 -0
  52. package/dist/components/wrksz-mark.js +12 -0
  53. package/dist/docs/index.d.ts +8 -0
  54. package/dist/docs/index.js +8 -0
  55. package/dist/docs/layout.d.ts +6 -0
  56. package/dist/docs/layout.js +10 -0
  57. package/dist/docs/page-actions.d.ts +36 -0
  58. package/dist/docs/page-actions.js +136 -0
  59. package/dist/docs/page-footer.d.ts +14 -0
  60. package/dist/docs/page-footer.js +68 -0
  61. package/dist/docs/page-header.d.ts +13 -0
  62. package/dist/docs/page-header.js +57 -0
  63. package/dist/docs/page.d.ts +16 -0
  64. package/dist/docs/page.js +38 -0
  65. package/dist/docs/reading.js +64 -0
  66. package/dist/docs/shell.js +101 -0
  67. package/dist/docs/sidebar.js +161 -0
  68. package/dist/docs/toc-bar.d.ts +12 -0
  69. package/dist/docs/toc-bar.js +132 -0
  70. package/dist/docs/toc.d.ts +11 -0
  71. package/dist/docs/toc.js +127 -0
  72. package/dist/fonts/Inter-Italic.woff2 +0 -0
  73. package/dist/fonts/Inter-LICENSE.txt +92 -0
  74. package/dist/fonts/Inter.woff2 +0 -0
  75. package/dist/fonts/IoskeleyMono-Bold.woff2 +0 -0
  76. package/dist/fonts/IoskeleyMono-Italic.woff2 +0 -0
  77. package/dist/fonts/IoskeleyMono-LICENSE.txt +92 -0
  78. package/dist/fonts/IoskeleyMono-Regular.woff2 +0 -0
  79. package/dist/fonts.d.ts +1 -0
  80. package/dist/fonts.js +38 -0
  81. package/dist/home/features.d.ts +39 -0
  82. package/dist/home/features.js +75 -0
  83. package/dist/home/footer.d.ts +4 -0
  84. package/dist/home/footer.js +79 -0
  85. package/dist/home/hero-content.js +102 -0
  86. package/dist/home/hero-install.js +128 -0
  87. package/dist/home/hero-stage.d.ts +4 -0
  88. package/dist/home/hero-stage.js +9 -0
  89. package/dist/home/hero.d.ts +6 -0
  90. package/dist/home/hero.js +16 -0
  91. package/dist/home/home-header.d.ts +1 -0
  92. package/dist/home/home-header.js +173 -0
  93. package/dist/home/index.d.ts +7 -0
  94. package/dist/home/index.js +7 -0
  95. package/dist/home/layout.d.ts +6 -0
  96. package/dist/home/layout.js +15 -0
  97. package/dist/home/reveal.js +31 -0
  98. package/dist/index.d.ts +4 -0
  99. package/dist/index.js +4 -0
  100. package/dist/lib/clipboard.js +55 -0
  101. package/dist/lib/cn.js +1 -0
  102. package/dist/lib/format.js +9 -0
  103. package/dist/lib/package-manager-script.js +12 -0
  104. package/dist/lib/package-manager.js +54 -0
  105. package/dist/lib/theme-config.js +10 -0
  106. package/dist/llms.d.ts +34 -0
  107. package/dist/llms.js +111 -0
  108. package/dist/next.d.ts +18 -0
  109. package/dist/next.js +45 -0
  110. package/dist/node_modules/.pnpm/@types_mdast@4.0.4/node_modules/@types/mdast/index.d.ts +930 -0
  111. package/dist/node_modules/.pnpm/@types_mdx@2.0.14/node_modules/@types/mdx/types.d.ts +81 -0
  112. package/dist/node_modules/.pnpm/@types_unist@3.0.3/node_modules/@types/unist/index.d.ts +80 -0
  113. package/dist/registry.d.ts +61 -0
  114. package/dist/registry.js +113 -0
  115. package/dist/root.d.ts +9 -0
  116. package/dist/root.js +34 -0
  117. package/dist/search.d.ts +5 -0
  118. package/dist/search.js +43 -0
  119. package/dist/seo/index.d.ts +6 -0
  120. package/dist/seo/index.js +6 -0
  121. package/dist/seo/json-ld.d.ts +17 -0
  122. package/dist/seo/json-ld.js +88 -0
  123. package/dist/seo/metadata.d.ts +21 -0
  124. package/dist/seo/metadata.js +75 -0
  125. package/dist/seo/robots.d.ts +14 -0
  126. package/dist/seo/robots.js +18 -0
  127. package/dist/seo/sitemap.d.ts +16 -0
  128. package/dist/seo/sitemap.js +26 -0
  129. package/dist/seo/url.d.ts +6 -0
  130. package/dist/seo/url.js +11 -0
  131. package/dist/server.js +63 -0
  132. package/dist/site-context.js +17 -0
  133. package/dist/site.d.ts +41 -0
  134. package/dist/site.js +13 -0
  135. package/dist/source/compile.d.ts +6 -0
  136. package/dist/source/compile.js +32 -0
  137. package/dist/source/errors.d.ts +4 -0
  138. package/dist/source/errors.js +10 -0
  139. package/dist/source/frontmatter.d.ts +13 -0
  140. package/dist/source/frontmatter.js +102 -0
  141. package/dist/source/highlight.js +102 -0
  142. package/dist/source/index.d.ts +36 -0
  143. package/dist/source/index.js +102 -0
  144. package/dist/source/markdown.d.ts +48 -0
  145. package/dist/source/markdown.js +393 -0
  146. package/dist/source/prompt.js +33 -0
  147. package/dist/source/scan.d.ts +8 -0
  148. package/dist/source/scan.js +64 -0
  149. package/dist/source/toc.d.ts +5 -0
  150. package/dist/source/toc.js +28 -0
  151. package/dist/source/tree.d.ts +29 -0
  152. package/dist/source/tree.js +91 -0
  153. package/dist/styles.css +879 -0
  154. package/dist/typography.d.ts +101 -0
  155. package/dist/typography.js +232 -0
  156. package/package.json +84 -4
package/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 Jakub
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md CHANGED
@@ -1,3 +1,158 @@
1
- # Temporary Holding Version
1
+ # @wrksz/docs
2
2
 
3
- This version is a temporary placeholder for this package. An operational version to replace this has been submitted for review and is awaiting a staged release.
3
+ A documentation engine for Next.js App Router. Turns a folder of `.mdx` and `.md` files into a full documentation site with a sidebar tree, table of contents, `Cmd+K` search, SEO metadata, and Markdown endpoints for AI agents.
4
+
5
+ ## Features
6
+
7
+ - **MDX and content (`@wrksz/docs/source`)**: folder scanning, validated YAML frontmatter, `meta.json` ordering and section headings, automatic TOC, and syntax highlighting via `@pierre/highlights` with file titles, line highlights, and diffs.
8
+ - **Layouts and components (`@wrksz/docs/docs`, `@wrksz/docs/home`, `@wrksz/docs/typography`)**: `DocsLayout`, `DocsPage`, `PageHeader`, `PageFooter`, sticky TOC, landing primitives, and built-in MDX components (`Callout`, `Install`, `CodeGroup`, `Tabs`, `Steps`, `Props`, `Cards`, `Details`, `Do`/`Dont`, `Badge`, `Image`, `AgentPrompt`).
9
+ - **Search and theming**: built-in `Cmd+K` command palette powered by `@wrksz/cue` and flash-free theming powered by `@wrksz/themes`.
10
+ - **SEO and AI agents (`@wrksz/docs/seo`, `@wrksz/docs/llms`)**: `siteMetadata`, `pageMetadata`, `createSitemap`, `createRobots`, JSON-LD, `/llms.txt`, `/llms-full.txt`, and per-page `/docs/*.md` responses.
11
+
12
+ ## Requirements
13
+
14
+ - Next.js `>=16` (App Router)
15
+ - React `19`
16
+ - Tailwind CSS `v4`
17
+
18
+ ## Quickstart
19
+
20
+ ```sh
21
+ pnpm add @wrksz/docs
22
+ ```
23
+
24
+ 1. Wrap `next.config.ts` with `withDocs` and import `@wrksz/docs/styles.css` in your global stylesheet:
25
+
26
+ ```ts
27
+ // next.config.ts
28
+ import { withDocs } from "@wrksz/docs/next";
29
+
30
+ export default withDocs({ reactStrictMode: true });
31
+ ```
32
+
33
+ ```css
34
+ /* src/app/global.css */
35
+ @import "tailwindcss";
36
+ @import "@wrksz/docs/styles.css";
37
+ ```
38
+
39
+ 2. Define your site and content source:
40
+
41
+ ```ts
42
+ // src/site.ts
43
+ import { defineSite, npm } from "@wrksz/docs";
44
+
45
+ export const site = defineSite({
46
+ name: "my-lib",
47
+ package: { name: "my-lib", registry: npm },
48
+ description: "Documentation for my-lib.",
49
+ url: "https://my-lib.dev",
50
+ repo: { owner: "acme", name: "my-lib" },
51
+ });
52
+ ```
53
+
54
+ ```ts
55
+ // src/source.ts
56
+ import { createSource } from "@wrksz/docs/source";
57
+
58
+ export const source = createSource({ dir: "content/docs" });
59
+ ```
60
+
61
+ 3. Wrap `src/app/layout.tsx` with `DocsRoot` and add `src/app/docs/layout.tsx` + `src/app/docs/[[...slug]]/page.tsx`:
62
+
63
+ ```tsx
64
+ // src/app/layout.tsx
65
+ import { fontVariables } from "@wrksz/docs/fonts";
66
+ import { DocsRoot } from "@wrksz/docs/root";
67
+ import { siteMetadata } from "@wrksz/docs/seo";
68
+ import type { Metadata } from "next";
69
+ import "./global.css";
70
+ import { site } from "../site";
71
+ import { source } from "../source";
72
+
73
+ export const metadata: Metadata = siteMetadata(site);
74
+
75
+ export default function Layout({ children }: LayoutProps<"/">) {
76
+ return (
77
+ <html lang="en" className={fontVariables} suppressHydrationWarning>
78
+ <body className="flex min-h-dvh flex-col antialiased">
79
+ <DocsRoot
80
+ site={site}
81
+ pages={source
82
+ .pages()
83
+ .map((page) => ({ url: page.url, title: page.data.title }))}
84
+ >
85
+ {children}
86
+ </DocsRoot>
87
+ </body>
88
+ </html>
89
+ );
90
+ }
91
+ ```
92
+
93
+ ```tsx
94
+ // src/app/docs/layout.tsx
95
+ import { DocsLayout } from "@wrksz/docs/docs";
96
+ import { source } from "../../source";
97
+
98
+ export default function Layout({ children }: LayoutProps<"/docs">) {
99
+ return <DocsLayout source={source}>{children}</DocsLayout>;
100
+ }
101
+ ```
102
+
103
+ ```tsx
104
+ // src/app/docs/[[...slug]]/page.tsx
105
+ import { DocsPage, PageFooter, PageHeader } from "@wrksz/docs/docs";
106
+ import { pageMetadata } from "@wrksz/docs/seo";
107
+ import { Prose, typography } from "@wrksz/docs/typography";
108
+ import type { Metadata } from "next";
109
+ import { notFound } from "next/navigation";
110
+ import { site } from "../../../site";
111
+ import { source } from "../../../source";
112
+
113
+ export const dynamicParams = false;
114
+
115
+ export function generateStaticParams() {
116
+ return source.params();
117
+ }
118
+
119
+ export async function generateMetadata(props: PageProps<"/docs/[[...slug]]">): Promise<Metadata> {
120
+ const page = source.page((await props.params).slug);
121
+ if (!page) notFound();
122
+ return pageMetadata(site, source, page);
123
+ }
124
+
125
+ export default async function Page(props: PageProps<"/docs/[[...slug]]">) {
126
+ const page = source.page((await props.params).slug);
127
+ if (!page) notFound();
128
+ const { Body, toc } = await source.render(page);
129
+
130
+ return (
131
+ <DocsPage toc={page.data.toc === false ? [] : toc}>
132
+ <PageHeader source={source} page={page} />
133
+ <Prose className="mt-10">
134
+ <Body components={typography} />
135
+ </Prose>
136
+ <PageFooter source={source} page={page} />
137
+ </DocsPage>
138
+ );
139
+ }
140
+ ```
141
+
142
+ 4. Optionally add `src/app/llms.mdx/[[...path]]/route.ts` for `/llms.txt`, `/llms-full.txt`, and `/docs/*.md`:
143
+
144
+ ```ts
145
+ import { createLlmsRoute } from "@wrksz/docs/llms";
146
+ import { site } from "../../../site";
147
+ import { source } from "../../../source";
148
+
149
+ export const { GET, generateStaticParams } = createLlmsRoute(site, source);
150
+ ```
151
+
152
+ ## Documentation
153
+
154
+ Full documentation is available at [docs.wrksz.dev](https://docs.wrksz.dev).
155
+
156
+ ## License
157
+
158
+ MIT
@@ -0,0 +1,30 @@
1
+ /**
2
+ * An AI agent a prompt can open in. `url` is a deep link with `{prompt}` where the encoded
3
+ * prompt goes, so an agent stays plain data that can travel from server to client.
4
+ */
5
+ export type Agent = {
6
+ /** Stable id, used in `defineSite({ agents })` and `<AgentPrompt agents>`. */
7
+ id: string;
8
+ /** Name on the button, e.g. `Claude Code`. */
9
+ label: string;
10
+ /** Deep link or web URL, e.g. `cursor://anysphere.cursor-deeplink/prompt?text={prompt}`. */
11
+ url: string;
12
+ /** Brand mark from the built-in set; without one the button shows only the label. */
13
+ logo?: "claude-code" | "claude" | "codex" | "chatgpt" | "cursor" | "grok";
14
+ };
15
+ export declare function defineAgent(agent: Agent): Agent;
16
+ /** Agents that ship with the engine, by id. */
17
+ export declare const BUILT_IN_AGENTS: Readonly<Record<string, Agent>>;
18
+ /** Agents shown when neither the site nor the prompt picks any. */
19
+ export declare const DEFAULT_AGENTS: readonly ["claude-code", "codex", "cursor"];
20
+ /** The URLs a prompt can name, e.g. this page's Markdown or the site's `llms.txt`. */
21
+ export type PromptLinks = {
22
+ origin: string;
23
+ page: string;
24
+ };
25
+ /**
26
+ * Fills `{origin}`, `{page}`, `{llms}` and `{llms-full}` in a prompt: the site, this page as
27
+ * Markdown, and the two agent indexes. Prompts can then point an agent at the docs without
28
+ * hard-coding a domain.
29
+ */
30
+ export declare function fillPrompt(prompt: string, { origin, page }: PromptLinks): string;
package/dist/agents.js ADDED
@@ -0,0 +1,70 @@
1
+ // src/agents.ts
2
+ function defineAgent(agent) {
3
+ return agent;
4
+ }
5
+ /** Agents that ship with the engine, by id. */
6
+ const BUILT_IN_AGENTS = {
7
+ "claude-code": {
8
+ id: "claude-code",
9
+ label: "Claude Code",
10
+ url: "claude-cli://open?q={prompt}",
11
+ logo: "claude-code"
12
+ },
13
+ codex: {
14
+ id: "codex",
15
+ label: "Codex",
16
+ url: "codex://new?prompt={prompt}",
17
+ logo: "codex"
18
+ },
19
+ cursor: {
20
+ id: "cursor",
21
+ label: "Cursor",
22
+ url: "cursor://anysphere.cursor-deeplink/prompt?text={prompt}",
23
+ logo: "cursor"
24
+ },
25
+ claude: {
26
+ id: "claude",
27
+ label: "Claude",
28
+ url: "https://claude.ai/new?q={prompt}",
29
+ logo: "claude"
30
+ },
31
+ chatgpt: {
32
+ id: "chatgpt",
33
+ label: "ChatGPT",
34
+ url: "https://chatgpt.com/?q={prompt}",
35
+ logo: "chatgpt"
36
+ },
37
+ grok: {
38
+ id: "grok",
39
+ label: "Grok",
40
+ url: "https://grok.com/?q={prompt}",
41
+ logo: "grok"
42
+ }
43
+ };
44
+ /** Agents shown when neither the site nor the prompt picks any. */
45
+ const DEFAULT_AGENTS = [
46
+ "claude-code",
47
+ "codex",
48
+ "cursor"
49
+ ];
50
+ /** Resolves ids and agent objects against the built-in ones; unknown ids are skipped. */
51
+ function resolveAgents(list) {
52
+ return (list ?? DEFAULT_AGENTS).flatMap((item) => {
53
+ if (typeof item !== "string") return [item];
54
+ const agent = BUILT_IN_AGENTS[item];
55
+ return agent ? [agent] : [];
56
+ });
57
+ }
58
+ function agentUrl(agent, prompt) {
59
+ return agent.url.replaceAll("{prompt}", encodeURIComponent(prompt));
60
+ }
61
+ /**
62
+ * Fills `{origin}`, `{page}`, `{llms}` and `{llms-full}` in a prompt: the site, this page as
63
+ * Markdown, and the two agent indexes. Prompts can then point an agent at the docs without
64
+ * hard-coding a domain.
65
+ */
66
+ function fillPrompt(prompt, { origin, page }) {
67
+ const base = origin.replace(/\/$/, "");
68
+ return prompt.replaceAll("{origin}", base).replaceAll("{page}", page).replaceAll("{llms}", `${base}/llms.txt`).replaceAll("{llms-full}", `${base}/llms-full.txt`).trim();
69
+ }
70
+ export { BUILT_IN_AGENTS, DEFAULT_AGENTS, agentUrl, defineAgent, fillPrompt, resolveAgents };
@@ -0,0 +1,90 @@
1
+ import { jsx } from "react/jsx-runtime";
2
+ // src/components/agent-logos.tsx
3
+ function MarkdownLogo(props) {
4
+ return /* @__PURE__ */ jsx("svg", {
5
+ viewBox: "0 0 24 24",
6
+ fill: "currentColor",
7
+ "aria-hidden": true,
8
+ ...props,
9
+ children: /* @__PURE__ */ jsx("path", { d: "M22.27 19.385H1.73A1.73 1.73 0 010 17.655V6.345a1.73 1.73 0 011.73-1.73h20.54A1.73 1.73 0 0124 6.345v11.308a1.73 1.73 0 01-1.73 1.731zM5.769 15.923v-4.5l2.308 2.885 2.307-2.885v4.5h2.308V8.078h-2.308l-2.307 2.885-2.308-2.885H3.46v7.847zM21.232 12h-2.309V8.077h-2.307V12h-2.308l3.461 4.039z" })
10
+ });
11
+ }
12
+ function ChatGPTLogo(props) {
13
+ return /* @__PURE__ */ jsx("svg", {
14
+ viewBox: "0 0 24 24",
15
+ fill: "currentColor",
16
+ fillRule: "evenodd",
17
+ "aria-hidden": true,
18
+ ...props,
19
+ children: /* @__PURE__ */ jsx("path", { d: "M9.205 8.658v-2.26c0-.19.072-.333.238-.428l4.543-2.616c.619-.357 1.356-.523 2.117-.523 2.854 0 4.662 2.212 4.662 4.566 0 .167 0 .357-.024.547l-4.71-2.759a.797.797 0 00-.856 0l-5.97 3.473zm10.609 8.8V12.06c0-.333-.143-.57-.429-.737l-5.97-3.473 1.95-1.118a.433.433 0 01.476 0l4.543 2.617c1.309.76 2.189 2.378 2.189 3.948 0 1.808-1.07 3.473-2.76 4.163zM7.802 12.703l-1.95-1.142c-.167-.095-.239-.238-.239-.428V5.899c0-2.545 1.95-4.472 4.591-4.472 1 0 1.927.333 2.712.928L8.23 5.067c-.285.166-.428.404-.428.737v6.898zM12 15.128l-2.795-1.57v-3.33L12 8.658l2.795 1.57v3.33L12 15.128zm1.796 7.23c-1 0-1.927-.332-2.712-.927l4.686-2.712c.285-.166.428-.404.428-.737v-6.898l1.974 1.142c.167.095.238.238.238.428v5.233c0 2.545-1.974 4.472-4.614 4.472zm-5.637-5.303l-4.544-2.617c-1.308-.761-2.188-2.378-2.188-3.948A4.482 4.482 0 014.21 6.327v5.423c0 .333.143.571.428.738l5.947 3.449-1.95 1.118a.432.432 0 01-.476 0zm-.262 3.9c-2.688 0-4.662-2.021-4.662-4.519 0-.19.024-.38.047-.57l4.686 2.71c.286.167.571.167.856 0l5.97-3.448v2.26c0 .19-.07.333-.237.428l-4.543 2.616c-.619.357-1.356.523-2.117.523zm5.899 2.83a5.947 5.947 0 005.827-4.756C22.287 18.339 24 15.84 24 13.296c0-1.665-.713-3.282-1.998-4.448.119-.5.19-.999.19-1.498 0-3.401-2.759-5.947-5.946-5.947-.642 0-1.26.095-1.88.31A5.962 5.962 0 0010.205 0a5.947 5.947 0 00-5.827 4.757C1.713 5.447 0 7.945 0 10.49c0 1.666.713 3.283 1.998 4.448-.119.5-.19 1-.19 1.499 0 3.401 2.759 5.946 5.946 5.946.642 0 1.26-.095 1.88-.309a5.96 5.96 0 004.162 1.713z" })
20
+ });
21
+ }
22
+ function ClaudeLogo(props) {
23
+ return /* @__PURE__ */ jsx("svg", {
24
+ viewBox: "0 0 24 24",
25
+ fill: "#D97757",
26
+ "aria-hidden": true,
27
+ ...props,
28
+ children: /* @__PURE__ */ jsx("path", { d: "M4.709 15.955l4.72-2.647.08-.23-.08-.128H9.2l-.79-.048-2.698-.073-2.339-.097-2.266-.122-.571-.121L0 11.784l.055-.352.48-.321.686.06 1.52.103 2.278.158 1.652.097 2.449.255h.389l.055-.157-.134-.098-.103-.097-2.358-1.596-2.552-1.688-1.336-.972-.724-.491-.364-.462-.158-1.008.656-.722.881.06.225.061.893.686 1.908 1.476 2.491 1.833.365.304.145-.103.019-.073-.164-.274-1.355-2.446-1.446-2.49-.644-1.032-.17-.619a2.97 2.97 0 01-.104-.729L6.283.134 6.696 0l.996.134.42.364.62 1.414 1.002 2.229 1.555 3.03.456.898.243.832.091.255h.158V9.01l.128-1.706.237-2.095.23-2.695.08-.76.376-.91.747-.492.584.28.48.685-.067.444-.286 1.851-.559 2.903-.364 1.942h.212l.243-.242.985-1.306 1.652-2.064.73-.82.85-.904.547-.431h1.033l.76 1.129-.34 1.166-1.064 1.347-.881 1.142-1.264 1.7-.79 1.36.073.11.188-.02 2.856-.606 1.543-.28 1.841-.315.833.388.091.395-.328.807-1.969.486-2.309.462-3.439.813-.042.03.049.061 1.549.146.662.036h1.622l3.02.225.79.522.474.638-.079.485-1.215.62-1.64-.389-3.829-.91-1.312-.329h-.182v.11l1.093 1.068 2.006 1.81 2.509 2.33.127.578-.322.455-.34-.049-2.205-1.657-.851-.747-1.926-1.62h-.128v.17l.444.649 2.345 3.521.122 1.08-.17.353-.608.213-.668-.122-1.374-1.925-1.415-2.167-1.143-1.943-.14.08-.674 7.254-.316.37-.729.28-.607-.461-.322-.747.322-1.476.389-1.924.315-1.53.286-1.9.17-.632-.012-.042-.14.018-1.434 1.967-2.18 2.945-1.726 1.845-.414.164-.717-.37.067-.662.401-.589 2.388-3.036 1.44-1.882.93-1.086-.006-.158h-.055L4.132 18.56l-1.13.146-.487-.456.061-.746.231-.243 1.908-1.312-.006.006z" })
29
+ });
30
+ }
31
+ function GrokLogo(props) {
32
+ return /* @__PURE__ */ jsx("svg", {
33
+ viewBox: "0 0 24 24",
34
+ fill: "currentColor",
35
+ fillRule: "evenodd",
36
+ "aria-hidden": true,
37
+ ...props,
38
+ children: /* @__PURE__ */ jsx("path", { d: "M9.27 15.29l7.978-5.897c.391-.29.95-.177 1.137.272.98 2.369.542 5.215-1.41 7.169-1.951 1.954-4.667 2.382-7.149 1.406l-2.711 1.257c3.889 2.661 8.611 2.003 11.562-.953 2.341-2.344 3.066-5.539 2.388-8.42l.006.007c-.983-4.232.242-5.924 2.75-9.383.06-.082.12-.164.179-.248l-3.301 3.305v-.01L9.267 15.292M7.623 16.723c-2.792-2.67-2.31-6.801.071-9.184 1.761-1.763 4.647-2.483 7.166-1.425l2.705-1.25a7.808 7.808 0 00-1.829-1A8.975 8.975 0 005.984 5.83c-2.533 2.536-3.33 6.436-1.962 9.764 1.022 2.487-.653 4.246-2.34 6.022-.599.63-1.199 1.259-1.682 1.925l7.62-6.815" })
39
+ });
40
+ }
41
+ function CursorLogo(props) {
42
+ return /* @__PURE__ */ jsx("svg", {
43
+ viewBox: "0 0 24 24",
44
+ fill: "currentColor",
45
+ fillRule: "evenodd",
46
+ "aria-hidden": true,
47
+ ...props,
48
+ children: /* @__PURE__ */ jsx("path", { d: "M22.106 5.68L12.5.135a.998.998 0 00-.998 0L1.893 5.68a.84.84 0 00-.419.726v11.186c0 .3.16.577.42.727l9.607 5.547a.999.999 0 00.998 0l9.608-5.547a.84.84 0 00.42-.727V6.407a.84.84 0 00-.42-.726zm-.603 1.176L12.228 22.92c-.063.108-.228.064-.228-.061V12.34a.59.59 0 00-.295-.51l-9.11-5.26c-.107-.062-.063-.228.062-.228h18.55c.264 0 .428.286.296.514z" })
49
+ });
50
+ }
51
+ function ClaudeCodeLogo(props) {
52
+ return /* @__PURE__ */ jsx("svg", {
53
+ viewBox: "0 0 24 24",
54
+ fill: "#D97757",
55
+ fillRule: "evenodd",
56
+ "aria-hidden": true,
57
+ ...props,
58
+ children: /* @__PURE__ */ jsx("path", {
59
+ clipRule: "evenodd",
60
+ d: "M20.998 10.949H24v3.102h-3v3.028h-1.487V20H18v-2.921h-1.487V20H15v-2.921H9V20H7.488v-2.921H6V20H4.487v-2.921H3V14.05H0V10.95h3V5h17.998v5.949zM6 10.949h1.488V8.102H6v2.847zm10.51 0H18V8.102h-1.49v2.847z"
61
+ })
62
+ });
63
+ }
64
+ function CodexLogo(props) {
65
+ return /* @__PURE__ */ jsx("svg", {
66
+ viewBox: "0 0 24 24",
67
+ fill: "currentColor",
68
+ fillRule: "evenodd",
69
+ "aria-hidden": true,
70
+ ...props,
71
+ children: /* @__PURE__ */ jsx("path", {
72
+ clipRule: "evenodd",
73
+ d: "M8.086.457a6.105 6.105 0 013.046-.415c1.333.153 2.521.72 3.564 1.7a.117.117 0 00.107.029c1.408-.346 2.762-.224 4.061.366l.063.03.154.076c1.357.703 2.33 1.77 2.918 3.198.278.679.418 1.388.421 2.126a5.655 5.655 0 01-.18 1.631.167.167 0 00.04.155 5.982 5.982 0 011.578 2.891c.385 1.901-.01 3.615-1.183 5.14l-.182.22a6.063 6.063 0 01-2.934 1.851.162.162 0 00-.108.102c-.255.736-.511 1.364-.987 1.992-1.199 1.582-2.962 2.462-4.948 2.451-1.583-.008-2.986-.587-4.21-1.736a.145.145 0 00-.14-.032c-.518.167-1.04.191-1.604.185a5.924 5.924 0 01-2.595-.622 6.058 6.058 0 01-2.146-1.781c-.203-.269-.404-.522-.551-.821a7.74 7.74 0 01-.495-1.283 6.11 6.11 0 01-.017-3.064.166.166 0 00.008-.074.115.115 0 00-.037-.064 5.958 5.958 0 01-1.38-2.202 5.196 5.196 0 01-.333-1.589 6.915 6.915 0 01.188-2.132c.45-1.484 1.309-2.648 2.577-3.493.282-.188.55-.334.802-.438.286-.12.573-.22.861-.304a.129.129 0 00.087-.087A6.016 6.016 0 015.635 2.31C6.315 1.464 7.132.846 8.086.457zm-.804 7.85a.848.848 0 00-1.473.842l1.694 2.965-1.688 2.848a.849.849 0 001.46.864l1.94-3.272a.849.849 0 00.007-.854l-1.94-3.393zm5.446 6.24a.849.849 0 000 1.695h4.848a.849.849 0 000-1.696h-4.848z"
74
+ })
75
+ });
76
+ }
77
+ const LOGOS = {
78
+ "claude-code": ClaudeCodeLogo,
79
+ claude: ClaudeLogo,
80
+ codex: CodexLogo,
81
+ chatgpt: ChatGPTLogo,
82
+ cursor: CursorLogo,
83
+ grok: GrokLogo
84
+ };
85
+ /** The logo of a built-in agent, by its `logo` key. */
86
+ function AgentLogo({ logo, ...props }) {
87
+ const Logo = LOGOS[logo];
88
+ return /* @__PURE__ */ jsx(Logo, { ...props });
89
+ }
90
+ export { AgentLogo, ChatGPTLogo, ClaudeCodeLogo, ClaudeLogo, CodexLogo, CursorLogo, GrokLogo, MarkdownLogo };
@@ -0,0 +1,29 @@
1
+ import { ReactNode } from "react";
2
+ import { Agent } from "../agents.js";
3
+ /**
4
+ * A ready prompt for an AI agent: a title, a sentence on what it does, a button that copies
5
+ * it and one per agent that opens it there. The prompt itself sits behind "Show prompt", so
6
+ * readers can see what they send. Write it in a fenced block; `{page}` becomes this page as
7
+ * Markdown, `{llms}` and `{llms-full}` the site's agent indexes and `{origin}` the site.
8
+ *
9
+ * ````mdx
10
+ * <AgentPrompt title="Set up themes with an agent">
11
+ * Paste it into an agent working in your repository.
12
+ *
13
+ * ```text
14
+ * Add theme switching with @wrksz/themes. Follow {page} and use {llms} for anything else.
15
+ * ```
16
+ * </AgentPrompt>
17
+ * ````
18
+ */
19
+ export declare function AgentPrompt({ title, prompt, agents, className, children }: {
20
+ /** What the prompt does, e.g. `Migrate with an AI agent`. */
21
+ title: ReactNode;
22
+ /** The prompt; filled in from the fenced block by the content pipeline. */
23
+ prompt?: string;
24
+ /** Agents to offer, by id or `defineAgent`; defaults to the site's `agents`. */
25
+ agents?: (string | Agent)[];
26
+ className?: string;
27
+ /** A sentence or two under the title. */
28
+ children?: ReactNode;
29
+ }): import("react").JSX.Element;
@@ -0,0 +1,100 @@
1
+ "use client";
2
+ import { usePathname } from "next/navigation";
3
+ import { agentUrl, fillPrompt, resolveAgents } from "../agents.js";
4
+ import { useCopy } from "../lib/clipboard.js";
5
+ import { cn } from "../lib/cn.js";
6
+ import { useSite } from "../site-context.js";
7
+ import { AgentLogo } from "./agent-logos.js";
8
+ import { CheckIcon, ChevronDownIcon, CopyIcon } from "./icons.js";
9
+ import { jsx, jsxs } from "react/jsx-runtime";
10
+ // src/components/agent-prompt.tsx
11
+ const ACTION = "control-raised inline-flex h-8 shrink-0 items-center gap-2 rounded-lg px-3 text-sm font-medium whitespace-nowrap text-fd-foreground outline-none select-none focus-visible:ring-2 focus-visible:ring-fd-ring active:scale-[0.97] motion-reduce:active:scale-100";
12
+ /**
13
+ * A ready prompt for an AI agent: a title, a sentence on what it does, a button that copies
14
+ * it and one per agent that opens it there. The prompt itself sits behind "Show prompt", so
15
+ * readers can see what they send. Write it in a fenced block; `{page}` becomes this page as
16
+ * Markdown, `{llms}` and `{llms-full}` the site's agent indexes and `{origin}` the site.
17
+ *
18
+ * ````mdx
19
+ * <AgentPrompt title="Set up themes with an agent">
20
+ * Paste it into an agent working in your repository.
21
+ *
22
+ * ```text
23
+ * Add theme switching with @wrksz/themes. Follow {page} and use {llms} for anything else.
24
+ * ```
25
+ * </AgentPrompt>
26
+ * ````
27
+ */
28
+ function AgentPrompt({ title, prompt = "", agents, className, children }) {
29
+ const site = useSite();
30
+ const pathname = usePathname();
31
+ const origin = site.url.replace(/\/$/, "");
32
+ const text = fillPrompt(prompt, {
33
+ origin,
34
+ page: `${origin}${pathname.replace(/\/$/, "")}.md`
35
+ });
36
+ const offered = resolveAgents(agents ?? site.agents);
37
+ const { copied, copy } = useCopy();
38
+ return /* @__PURE__ */ jsxs("section", {
39
+ "data-agent-prompt": true,
40
+ className: cn("flex flex-col gap-3.5 rounded-xl bg-fd-card p-4", className),
41
+ children: [
42
+ /* @__PURE__ */ jsxs("div", {
43
+ className: "flex flex-col gap-1",
44
+ children: [/* @__PURE__ */ jsx("p", {
45
+ className: "text-[0.9375rem] font-medium text-fd-foreground",
46
+ children: title
47
+ }), children ? /* @__PURE__ */ jsx("div", {
48
+ className: "docs-compact text-[0.9375rem] leading-relaxed text-fd-muted-foreground",
49
+ children
50
+ }) : null]
51
+ }),
52
+ /* @__PURE__ */ jsxs("div", {
53
+ className: "flex flex-wrap gap-1.5",
54
+ children: [/* @__PURE__ */ jsxs("button", {
55
+ type: "button",
56
+ onClick: () => copy(text),
57
+ className: ACTION,
58
+ children: [/* @__PURE__ */ jsxs("span", {
59
+ className: "swap size-4",
60
+ children: [/* @__PURE__ */ jsx(CopyIcon, {
61
+ "data-active": copied ? void 0 : "",
62
+ className: "size-4"
63
+ }), /* @__PURE__ */ jsx(CheckIcon, {
64
+ "data-active": copied ? "" : void 0,
65
+ className: "size-4"
66
+ })]
67
+ }), "Copy prompt"]
68
+ }), offered.map((agent) => {
69
+ const web = /^https?:\/\//.test(agent.url);
70
+ return /* @__PURE__ */ jsxs("a", {
71
+ href: agentUrl(agent, text),
72
+ ...web ? {
73
+ target: "_blank",
74
+ rel: "noreferrer noopener"
75
+ } : {},
76
+ className: ACTION,
77
+ children: [agent.logo ? /* @__PURE__ */ jsx(AgentLogo, {
78
+ logo: agent.logo,
79
+ className: "size-4 shrink-0"
80
+ }) : null, agent.label]
81
+ }, agent.id);
82
+ })]
83
+ }),
84
+ /* @__PURE__ */ jsxs("details", {
85
+ className: "docs-details group -mx-1",
86
+ children: [/* @__PURE__ */ jsxs("summary", {
87
+ className: "flex w-fit cursor-pointer list-none items-center gap-1.5 rounded-md px-1 py-0.5 text-[0.8125rem] text-fd-muted-foreground outline-none transition-colors duration-150 select-none hover:text-fd-foreground focus-visible:ring-2 focus-visible:ring-fd-ring [&::-webkit-details-marker]:hidden",
88
+ children: [/* @__PURE__ */ jsx(ChevronDownIcon, { className: "size-3.5 -rotate-90 transition-transform duration-200 ease-[cubic-bezier(0.2,0,0,1)] group-open:rotate-0 motion-reduce:transition-none" }), "Show prompt"]
89
+ }), /* @__PURE__ */ jsx("div", {
90
+ className: "px-1 pt-2 pb-px",
91
+ children: /* @__PURE__ */ jsx("pre", {
92
+ className: "rounded-lg bg-(--panel) px-3.5 py-3 font-mono text-[0.8125rem] leading-relaxed whitespace-pre-wrap text-fd-foreground shadow-[0_0_0_1px_var(--control-ring)]",
93
+ children: text
94
+ })
95
+ })]
96
+ })
97
+ ]
98
+ });
99
+ }
100
+ export { AgentPrompt };
@@ -0,0 +1,16 @@
1
+ import { ReactNode } from "react";
2
+ export type BadgeTone = "neutral" | "info" | "success" | "warning" | "danger";
3
+ /**
4
+ * A short label inside text, such as a version or `beta`. Neutral by default; a tone tints
5
+ * the text and adds a faint background of the same colour.
6
+ *
7
+ * ```mdx
8
+ * Added in <Badge>v2.1</Badge>. <Badge tone="warning">beta</Badge>
9
+ * ```
10
+ */
11
+ export declare function Badge({ tone, className, children }: {
12
+ /** Colour of the label; `neutral` stays grey. */
13
+ tone?: BadgeTone;
14
+ className?: string;
15
+ children: ReactNode;
16
+ }): import("react").JSX.Element;
@@ -0,0 +1,26 @@
1
+ import { cn } from "../lib/cn.js";
2
+ import { jsx } from "react/jsx-runtime";
3
+ // src/components/badge.tsx
4
+ const TONES = {
5
+ info: "var(--color-info)",
6
+ success: "var(--color-success)",
7
+ warning: "var(--color-warning)",
8
+ danger: "var(--color-danger)"
9
+ };
10
+ /**
11
+ * A short label inside text, such as a version or `beta`. Neutral by default; a tone tints
12
+ * the text and adds a faint background of the same colour.
13
+ *
14
+ * ```mdx
15
+ * Added in <Badge>v2.1</Badge>. <Badge tone="warning">beta</Badge>
16
+ * ```
17
+ */
18
+ function Badge({ tone = "neutral", className, children }) {
19
+ const color = tone === "neutral" ? void 0 : TONES[tone];
20
+ return /* @__PURE__ */ jsx("span", {
21
+ style: color ? { "--tone": color } : void 0,
22
+ className: cn("inline-flex h-5 items-center rounded-md px-1.5 align-[0.1em] text-xs leading-none font-medium whitespace-nowrap", color ? "bg-[color-mix(in_oklab,var(--tone)_12%,transparent)] text-(--tone)" : "bg-fd-foreground/6 text-fd-muted-foreground", className),
23
+ children
24
+ });
25
+ }
26
+ export { Badge };
@@ -0,0 +1,32 @@
1
+ "use client";
2
+ import { useSite } from "../site-context.js";
3
+ import { WrkszMark } from "./wrksz-mark.js";
4
+ import { jsx, jsxs } from "react/jsx-runtime";
5
+ // src/components/brand.tsx
6
+ function Brand() {
7
+ const { name, version } = useSite();
8
+ return /* @__PURE__ */ jsxs("span", {
9
+ className: "flex items-center gap-1.5",
10
+ children: [
11
+ /* @__PURE__ */ jsx(WrkszMark, {
12
+ "aria-label": "wrksz",
13
+ className: "h-4 w-7 text-fd-foreground"
14
+ }),
15
+ /* @__PURE__ */ jsx("span", {
16
+ className: "text-fd-muted-foreground",
17
+ children: "/"
18
+ }),
19
+ /* @__PURE__ */ jsxs("span", {
20
+ className: "inline-flex items-baseline gap-1.5",
21
+ children: [/* @__PURE__ */ jsx("span", {
22
+ className: "font-medium",
23
+ children: name
24
+ }), version ? /* @__PURE__ */ jsxs("span", {
25
+ className: "text-xs text-fd-muted-foreground tabular-nums",
26
+ children: ["v", version]
27
+ }) : null]
28
+ })
29
+ ]
30
+ });
31
+ }
32
+ export { Brand };
@@ -0,0 +1,24 @@
1
+ import { ReactNode } from "react";
2
+ export type CalloutType = "note" | "info" | "tip" | "warning" | "danger";
3
+ /**
4
+ * A note set apart from the text. By default only the icon carries the colour of its type,
5
+ * so a page full of callouts still reads as one page; `tinted` also tints the card, for
6
+ * notes the reader must not skip. The text stays neutral either way.
7
+ *
8
+ * ```mdx
9
+ * <Callout type="warning" title="Server only">
10
+ * `getTheme` reads cookies, so call it in a Server Component.
11
+ * </Callout>
12
+ * <Callout type="danger" variant="tinted">This deletes the saved theme.</Callout>
13
+ * ```
14
+ */
15
+ export declare function Callout({ type, variant, title, className, children }: {
16
+ /** What kind of note it is; sets the icon and its colour. */
17
+ type?: CalloutType;
18
+ /** `tinted` colours the card with the type's colour too, not only the icon. */
19
+ variant?: "plain" | "tinted";
20
+ /** A short heading in bold above the text. */
21
+ title?: ReactNode;
22
+ className?: string;
23
+ children?: ReactNode;
24
+ }): import("react").JSX.Element;
@@ -0,0 +1,58 @@
1
+ import { cn } from "../lib/cn.js";
2
+ import { DangerIcon, InfoIcon, SuccessIcon, WarningIcon } from "./icons.js";
3
+ import { jsx, jsxs } from "react/jsx-runtime";
4
+ // src/components/callout.tsx
5
+ const TYPES = {
6
+ note: {
7
+ Icon: InfoIcon,
8
+ tone: "var(--color-fd-muted-foreground)"
9
+ },
10
+ info: {
11
+ Icon: InfoIcon,
12
+ tone: "var(--color-info)"
13
+ },
14
+ tip: {
15
+ Icon: SuccessIcon,
16
+ tone: "var(--color-success)"
17
+ },
18
+ warning: {
19
+ Icon: WarningIcon,
20
+ tone: "var(--color-warning)"
21
+ },
22
+ danger: {
23
+ Icon: DangerIcon,
24
+ tone: "var(--color-danger)"
25
+ }
26
+ };
27
+ /**
28
+ * A note set apart from the text. By default only the icon carries the colour of its type,
29
+ * so a page full of callouts still reads as one page; `tinted` also tints the card, for
30
+ * notes the reader must not skip. The text stays neutral either way.
31
+ *
32
+ * ```mdx
33
+ * <Callout type="warning" title="Server only">
34
+ * `getTheme` reads cookies, so call it in a Server Component.
35
+ * </Callout>
36
+ * <Callout type="danger" variant="tinted">This deletes the saved theme.</Callout>
37
+ * ```
38
+ */
39
+ function Callout({ type = "note", variant = "plain", title, className, children }) {
40
+ const { Icon, tone } = TYPES[type];
41
+ return /* @__PURE__ */ jsxs("aside", {
42
+ "data-callout": type,
43
+ "data-variant": variant,
44
+ style: { "--tone": tone },
45
+ className: cn("docs-callout flex gap-3 rounded-xl px-4 py-3.5", variant === "tinted" ? "bg-[color-mix(in_oklab,var(--tone)_9%,var(--color-fd-card))] shadow-[inset_0_0_0_1px_color-mix(in_oklab,var(--tone)_22%,transparent)]" : "bg-fd-card", className),
46
+ children: [/* @__PURE__ */ jsx(Icon, { className: "mt-[0.2em] size-4 shrink-0 text-(--tone)" }), /* @__PURE__ */ jsxs("div", {
47
+ className: "min-w-0 flex-1 text-[0.9375rem] leading-relaxed text-fd-foreground",
48
+ children: [title ? /* @__PURE__ */ jsx("p", {
49
+ className: "font-medium",
50
+ children: title
51
+ }) : null, children ? /* @__PURE__ */ jsx("div", {
52
+ className: "docs-callout-body",
53
+ children
54
+ }) : null]
55
+ })]
56
+ });
57
+ }
58
+ export { Callout };