@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
@@ -0,0 +1,26 @@
1
+ import { ReactNode } from "react";
2
+ /**
3
+ * Links to other pages as a grid of cards, two across on wider screens.
4
+ *
5
+ * ```mdx
6
+ * <Cards>
7
+ * <Card href="/docs/guides" title="Guides">Step-by-step setups for common apps.</Card>
8
+ * </Cards>
9
+ * ```
10
+ */
11
+ export declare function Cards({ className, children }: {
12
+ className?: string;
13
+ children: ReactNode;
14
+ }): import("react").JSX.Element;
15
+ /**
16
+ * One card of `<Cards>`: a title and a sentence about the page. Links that leave the site
17
+ * open in a new tab and show an outward arrow.
18
+ */
19
+ export declare function Card({ href, title, children }: {
20
+ /** Where the card leads, a path on this site or a full URL. */
21
+ href: string;
22
+ /** Name of the page. */
23
+ title: ReactNode;
24
+ /** One sentence on what the reader finds there. */
25
+ children?: ReactNode;
26
+ }): import("react").JSX.Element;
@@ -0,0 +1,48 @@
1
+ import Link from "next/link";
2
+ import { cn } from "../lib/cn.js";
3
+ import { ArrowRightIcon, ArrowUpRightIcon } from "./icons.js";
4
+ import { Fragment, jsx, jsxs } from "react/jsx-runtime";
5
+ // src/components/cards.tsx
6
+ /**
7
+ * Links to other pages as a grid of cards, two across on wider screens.
8
+ *
9
+ * ```mdx
10
+ * <Cards>
11
+ * <Card href="/docs/guides" title="Guides">Step-by-step setups for common apps.</Card>
12
+ * </Cards>
13
+ * ```
14
+ */
15
+ function Cards({ className, children }) {
16
+ return /* @__PURE__ */ jsx("div", {
17
+ className: cn("grid gap-3 sm:grid-cols-2", className),
18
+ children
19
+ });
20
+ }
21
+ /**
22
+ * One card of `<Cards>`: a title and a sentence about the page. Links that leave the site
23
+ * open in a new tab and show an outward arrow.
24
+ */
25
+ function Card({ href, title, children }) {
26
+ const external = /^https?:\/\//.test(href);
27
+ const Arrow = external ? ArrowUpRightIcon : ArrowRightIcon;
28
+ const className = "group flex flex-col gap-1 rounded-xl bg-fd-card px-4 py-3.5 outline-none transition-colors duration-150 hover:bg-fd-accent focus-visible:ring-2 focus-visible:ring-fd-ring";
29
+ const content = /* @__PURE__ */ jsxs(Fragment, { children: [/* @__PURE__ */ jsxs("span", {
30
+ className: "flex items-center gap-2 text-[0.9375rem] font-medium text-fd-foreground",
31
+ children: [title, /* @__PURE__ */ jsx(Arrow, { className: "size-3.5 shrink-0 text-fd-muted-foreground" })]
32
+ }), children ? /* @__PURE__ */ jsx("span", {
33
+ className: "text-sm leading-relaxed text-pretty text-fd-muted-foreground",
34
+ children
35
+ }) : null] });
36
+ return external ? /* @__PURE__ */ jsx("a", {
37
+ href,
38
+ target: "_blank",
39
+ rel: "noreferrer noopener",
40
+ className,
41
+ children: content
42
+ }) : /* @__PURE__ */ jsx(Link, {
43
+ href,
44
+ className,
45
+ children: content
46
+ });
47
+ }
48
+ export { Card, Cards };
@@ -0,0 +1,18 @@
1
+ import { cn } from "../lib/cn.js";
2
+ import { ScrollArea } from "./ui/scroll-area.js";
3
+ import { jsx } from "react/jsx-runtime";
4
+ // src/components/code-body.tsx
5
+ /** The scrolling `<pre>` of a code block, without its frame, title or copy button. */
6
+ function CodeBody({ className, children, ...props }) {
7
+ return /* @__PURE__ */ jsx(ScrollArea, {
8
+ orientation: "horizontal",
9
+ edgeButtons: false,
10
+ className: "rounded-b-xl",
11
+ children: /* @__PURE__ */ jsx("pre", {
12
+ ...props,
13
+ className: cn("docs-code-pre", className),
14
+ children: /* @__PURE__ */ jsx("code", { children })
15
+ })
16
+ });
17
+ }
18
+ export { CodeBody };
@@ -0,0 +1,20 @@
1
+ import { ReactNode } from "react";
2
+ /**
3
+ * Fenced code blocks shown as tabs, one per block, named by each fence's `title="…"`
4
+ * (or its language when it has none).
5
+ *
6
+ * ```mdx
7
+ * <CodeGroup>
8
+ * ```ts title="app/theme.ts"
9
+ * …
10
+ * ```
11
+ * ```tsx title="app/layout.tsx"
12
+ * …
13
+ * ```
14
+ * </CodeGroup>
15
+ * ```
16
+ */
17
+ export declare function CodeGroup({ label, children }: {
18
+ label?: string;
19
+ children: ReactNode;
20
+ }): import("react").JSX.Element;
@@ -0,0 +1,41 @@
1
+ import { Children, isValidElement } from "react";
2
+ import { CodeBody } from "./code-body.js";
3
+ import { CodeTabs } from "./code-tabs.js";
4
+ import { jsx } from "react/jsx-runtime";
5
+ // src/components/code-group.tsx
6
+ /**
7
+ * Fenced code blocks shown as tabs, one per block, named by each fence's `title="…"`
8
+ * (or its language when it has none).
9
+ *
10
+ * ```mdx
11
+ * <CodeGroup>
12
+ * ```ts title="app/theme.ts"
13
+ * …
14
+ * ```
15
+ * ```tsx title="app/layout.tsx"
16
+ * …
17
+ * ```
18
+ * </CodeGroup>
19
+ * ```
20
+ */
21
+ function CodeGroup({ label = "Files", children }) {
22
+ const blocks = Children.toArray(children).filter(isValidElement);
23
+ return /* @__PURE__ */ jsx(CodeTabs, {
24
+ label,
25
+ tabs: blocks.map((block, index) => {
26
+ const { "data-title": title, "data-language": language, className } = block.props;
27
+ const code = block.props.children;
28
+ const lines = isValidElement(code) ? code.props.children : code;
29
+ return {
30
+ value: String(index),
31
+ label: title ?? language ?? `Tab ${index + 1}`,
32
+ content: /* @__PURE__ */ jsx(CodeBody, {
33
+ "data-language": language,
34
+ className,
35
+ children: lines
36
+ })
37
+ };
38
+ })
39
+ });
40
+ }
41
+ export { CodeGroup };
@@ -0,0 +1,30 @@
1
+ import { ReactNode } from "react";
2
+ export type CodeTab = {
3
+ /** Key of the tab; for package managers it is the manager's name. */
4
+ value: string;
5
+ /** Text on the tab, usually a file name. */
6
+ label: ReactNode;
7
+ /** The tab's code, typically a `CodeBody`. */
8
+ content: ReactNode;
9
+ };
10
+ /**
11
+ * Code blocks behind tabs in one frame: the tabs take the place of the title bar and the
12
+ * copy button copies the open tab. Every panel stays in the HTML, so all of the code is
13
+ * there for search engines and Markdown exports. Controlled with `value`, otherwise the
14
+ * first tab opens.
15
+ */
16
+ export declare function CodeTabs({ tabs, label, value, onValueChange, persist }: {
17
+ tabs: CodeTab[];
18
+ /** Names the tab list for screen readers. */
19
+ label: string;
20
+ value?: string;
21
+ onValueChange?: (value: string) => void;
22
+ /**
23
+ * Marks the tabs as a saved package manager choice, so `packageManagerScript` can show
24
+ * the saved tab before hydration. `ready` comes from `usePmReady`.
25
+ */
26
+ persist?: {
27
+ registry: string;
28
+ ready: boolean;
29
+ };
30
+ }): import("react").JSX.Element;
@@ -0,0 +1,49 @@
1
+ "use client";
2
+ import { CopyCode } from "./copy-code.js";
3
+ import { Tab, Tabs, TabsList, TabsPanel } from "./ui/tabs.js";
4
+ import { jsx, jsxs } from "react/jsx-runtime";
5
+ // src/components/code-tabs.tsx
6
+ /**
7
+ * Code blocks behind tabs in one frame: the tabs take the place of the title bar and the
8
+ * copy button copies the open tab. Every panel stays in the HTML, so all of the code is
9
+ * there for search engines and Markdown exports. Controlled with `value`, otherwise the
10
+ * first tab opens.
11
+ */
12
+ function CodeTabs({ tabs, label, value, onValueChange, persist }) {
13
+ return /* @__PURE__ */ jsxs(Tabs, {
14
+ "data-code-block": true,
15
+ "data-pm-registry": persist?.registry,
16
+ "data-pm-ready": persist?.ready ? "" : void 0,
17
+ ...value === void 0 ? { defaultValue: tabs[0]?.value } : { value },
18
+ ...onValueChange ? { onValueChange: (next) => onValueChange(String(next)) } : {},
19
+ className: "docs-code relative gap-0 overflow-hidden rounded-xl bg-fd-card [--scroll-area-bg:var(--color-fd-card)]",
20
+ children: [/* @__PURE__ */ jsxs("div", {
21
+ className: "flex items-center border-b border-fd-border pe-1",
22
+ children: [/* @__PURE__ */ jsx(TabsList, {
23
+ "aria-label": label,
24
+ className: "min-w-0 flex-1 shadow-none ps-1.5",
25
+ children: tabs.map((tab) => /* @__PURE__ */ jsx(Tab, {
26
+ value: tab.value,
27
+ ...persist ? {
28
+ "data-pm-tab": "",
29
+ "data-pm": tab.value
30
+ } : {},
31
+ className: "h-10 px-2.5 font-mono text-[0.8125rem] font-normal",
32
+ children: tab.label
33
+ }, tab.value))
34
+ }), /* @__PURE__ */ jsx(CopyCode, {})]
35
+ }), tabs.map((tab) => /* @__PURE__ */ jsx(TabsPanel, {
36
+ value: tab.value,
37
+ keepMounted: true,
38
+ hidden: false,
39
+ "data-code-panel": true,
40
+ ...persist ? {
41
+ "data-pm-panel": "",
42
+ "data-pm": tab.value
43
+ } : {},
44
+ className: "focus-visible:-outline-offset-2",
45
+ children: tab.content
46
+ }, tab.value))]
47
+ });
48
+ }
49
+ export { CodeTabs };
@@ -0,0 +1,14 @@
1
+ import { ReactNode } from "react";
2
+ /**
3
+ * Tabs around any content, laid out like the page's own prose. Every panel stays in the
4
+ * HTML, so search engines and Markdown exports see all of it.
5
+ */
6
+ export declare function ContentTabs({ label, items }: {
7
+ /** Names the tab list for screen readers. */
8
+ label: string;
9
+ items: {
10
+ value: string;
11
+ label: ReactNode;
12
+ content: ReactNode;
13
+ }[];
14
+ }): import("react").JSX.Element;
@@ -0,0 +1,27 @@
1
+ "use client";
2
+ import { Tab, Tabs, TabsList, TabsPanel } from "./ui/tabs.js";
3
+ import { jsx, jsxs } from "react/jsx-runtime";
4
+ // src/components/content-tabs.tsx
5
+ /**
6
+ * Tabs around any content, laid out like the page's own prose. Every panel stays in the
7
+ * HTML, so search engines and Markdown exports see all of it.
8
+ */
9
+ function ContentTabs({ label, items }) {
10
+ return /* @__PURE__ */ jsxs(Tabs, {
11
+ defaultValue: items[0]?.value,
12
+ className: "gap-5",
13
+ children: [/* @__PURE__ */ jsx(TabsList, {
14
+ "aria-label": label,
15
+ children: items.map((item) => /* @__PURE__ */ jsx(Tab, {
16
+ value: item.value,
17
+ children: item.label
18
+ }, item.value))
19
+ }), items.map((item) => /* @__PURE__ */ jsx(TabsPanel, {
20
+ value: item.value,
21
+ keepMounted: true,
22
+ className: "docs-prose",
23
+ children: item.content
24
+ }, item.value))]
25
+ });
26
+ }
27
+ export { ContentTabs };
@@ -0,0 +1,41 @@
1
+ "use client";
2
+ import { useRef } from "react";
3
+ import { cn } from "../lib/cn.js";
4
+ import { useCopy } from "../lib/clipboard.js";
5
+ import { CheckIcon, CopyIcon } from "./icons.js";
6
+ import { jsx, jsxs } from "react/jsx-runtime";
7
+ // src/components/copy-code.tsx
8
+ /**
9
+ * The code a reader would paste: every line of the open tab, or of the block when it has
10
+ * no tabs, except the ones a diff removes.
11
+ */
12
+ function codeOf(frame) {
13
+ if (!frame) return "";
14
+ const block = frame.querySelector("[data-code-panel]:not([hidden]):not([data-hidden])") ?? frame;
15
+ const lines = block.querySelectorAll(".line");
16
+ if (!lines.length) return block.querySelector("pre")?.textContent ?? "";
17
+ return Array.from(lines, (line) => line.classList.contains("remove") ? null : line.textContent).filter((line) => line !== null).join("\n");
18
+ }
19
+ /** Copies the code of the `[data-code-block]` it sits in. */
20
+ function CopyCode({ className }) {
21
+ const ref = useRef(null);
22
+ const { copied, copy } = useCopy();
23
+ return /* @__PURE__ */ jsx("button", {
24
+ ref,
25
+ type: "button",
26
+ onClick: () => copy(codeOf(ref.current?.closest("[data-code-block]") ?? null)),
27
+ "aria-label": copied ? "Copied" : "Copy code",
28
+ className: cn("flex size-8 shrink-0 items-center justify-center rounded-lg bg-fd-card text-fd-muted-foreground outline-none transition-[color,background-color,scale] duration-150 hover:bg-fd-accent hover:text-fd-foreground focus-visible:ring-2 focus-visible:ring-fd-ring active:scale-96", className),
29
+ children: /* @__PURE__ */ jsxs("span", {
30
+ className: "swap size-4",
31
+ children: [/* @__PURE__ */ jsx(CopyIcon, {
32
+ "data-active": copied ? void 0 : "",
33
+ className: "size-4"
34
+ }), /* @__PURE__ */ jsx(CheckIcon, {
35
+ "data-active": copied ? "" : void 0,
36
+ className: "size-4"
37
+ })]
38
+ })
39
+ });
40
+ }
41
+ export { CopyCode };
@@ -0,0 +1,5 @@
1
+ "use client";
2
+ import dynamic from "next/dynamic";
3
+ // src/components/deferred-analytics.tsx
4
+ const Analytics = dynamic(() => import("@vercel/analytics/next").then((mod) => mod.Analytics), { ssr: false });
5
+ export { Analytics };
@@ -0,0 +1,20 @@
1
+ import { ReactNode } from "react";
2
+ /**
3
+ * A closed section for side notes. It is a native `<details>`, so it works without
4
+ * JavaScript, find-in-page opens it, and its content is in the HTML. Browsers that support
5
+ * `::details-content` animate the height; the rest open it at once.
6
+ *
7
+ * ```mdx
8
+ * <Details title="Why not next-themes?">
9
+ * …
10
+ * </Details>
11
+ * ```
12
+ */
13
+ export declare function Details({ title, open, className, children }: {
14
+ /** Text on the row that opens the section. */
15
+ title: ReactNode;
16
+ /** Starts open. */
17
+ open?: boolean;
18
+ className?: string;
19
+ children: ReactNode;
20
+ }): import("react").JSX.Element;
@@ -0,0 +1,29 @@
1
+ import { cn } from "../lib/cn.js";
2
+ import { ChevronDownIcon } from "./icons.js";
3
+ import { jsx, jsxs } from "react/jsx-runtime";
4
+ // src/components/details.tsx
5
+ /**
6
+ * A closed section for side notes. It is a native `<details>`, so it works without
7
+ * JavaScript, find-in-page opens it, and its content is in the HTML. Browsers that support
8
+ * `::details-content` animate the height; the rest open it at once.
9
+ *
10
+ * ```mdx
11
+ * <Details title="Why not next-themes?">
12
+ * …
13
+ * </Details>
14
+ * ```
15
+ */
16
+ function Details({ title, open = false, className, children }) {
17
+ return /* @__PURE__ */ jsxs("details", {
18
+ open,
19
+ className: cn("docs-details group rounded-xl bg-fd-card", className),
20
+ children: [/* @__PURE__ */ jsxs("summary", {
21
+ className: "flex min-h-11 cursor-pointer list-none items-center gap-2.5 rounded-xl px-4 py-2.5 text-[0.9375rem] font-medium text-fd-foreground outline-none select-none focus-visible:ring-2 focus-visible:ring-fd-ring [&::-webkit-details-marker]:hidden",
22
+ children: [/* @__PURE__ */ jsx(ChevronDownIcon, { className: "size-4 shrink-0 -rotate-90 text-fd-muted-foreground transition-transform duration-200 ease-[cubic-bezier(0.2,0,0,1)] group-open:rotate-0 motion-reduce:transition-none" }), title]
23
+ }), /* @__PURE__ */ jsx("div", {
24
+ className: "docs-prose px-4 pt-1 pb-4 ps-10.5",
25
+ children
26
+ })]
27
+ });
28
+ }
29
+ export { Details };
@@ -0,0 +1,23 @@
1
+ "use client";
2
+ import { copyText } from "../lib/clipboard.js";
3
+ import { HashIcon } from "./icons.js";
4
+ import { jsx, jsxs } from "react/jsx-runtime";
5
+ // src/components/heading-link.tsx
6
+ /**
7
+ * The text of a heading as a link to its own section. A click jumps there as usual and
8
+ * also copies the section's URL, quietly: the jump is the visible feedback.
9
+ */
10
+ function HeadingLink({ id, children }) {
11
+ return /* @__PURE__ */ jsxs("a", {
12
+ href: `#${id}`,
13
+ onClick: () => {
14
+ copyText(`${location.origin}${location.pathname}#${id}`);
15
+ },
16
+ className: "rounded-sm outline-none focus-visible:ring-2 focus-visible:ring-fd-ring",
17
+ children: [children, /* @__PURE__ */ jsx(HashIcon, {
18
+ "aria-hidden": true,
19
+ className: "ms-1.5 inline-block size-[0.8em] align-[-0.05em] text-fd-muted-foreground opacity-0 transition-opacity duration-150 group-hover/heading:opacity-100 group-focus-within/heading:opacity-100"
20
+ })]
21
+ });
22
+ }
23
+ export { HeadingLink };
@@ -0,0 +1,5 @@
1
+ import { ComponentProps } from "react";
2
+ export declare function Heading({ level, id, className, children, ...props }: Omit<ComponentProps<"h2">, "id"> & {
3
+ level?: 2 | 3 | 4;
4
+ id?: string | undefined;
5
+ }): import("react").JSX.Element;
@@ -0,0 +1,22 @@
1
+ import { cn } from "../lib/cn.js";
2
+ import { HeadingLink } from "./heading-link.js";
3
+ import { jsx } from "react/jsx-runtime";
4
+ // src/components/heading.tsx
5
+ const HEADINGS = {
6
+ 2: "text-xl leading-snug font-medium tracking-[-0.01em]",
7
+ 3: "text-base leading-snug font-medium",
8
+ 4: "text-[0.9375rem] leading-snug font-medium text-fd-muted-foreground"
9
+ };
10
+ function Heading({ level = 2, id, className, children, ...props }) {
11
+ const Tag = `h${level}`;
12
+ return /* @__PURE__ */ jsx(Tag, {
13
+ id,
14
+ className: cn("group/heading scroll-mt-20 text-fd-foreground xl:scroll-mt-8", HEADINGS[level], className),
15
+ ...props,
16
+ children: id ? /* @__PURE__ */ jsx(HeadingLink, {
17
+ id,
18
+ children
19
+ }) : children
20
+ });
21
+ }
22
+ export { Heading };