doccupine 0.0.136 → 0.0.138

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 (60) hide show
  1. package/dist/index.js +27 -0
  2. package/dist/lib/layout.js +3 -1
  3. package/dist/lib/mdxToMarkdown.d.ts +1 -0
  4. package/dist/lib/mdxToMarkdown.js +134 -0
  5. package/dist/lib/structures.js +6 -0
  6. package/dist/templates/components/Chat.d.ts +1 -1
  7. package/dist/templates/components/Chat.js +2 -2
  8. package/dist/templates/components/Docs.d.ts +1 -1
  9. package/dist/templates/components/Docs.js +7 -2
  10. package/dist/templates/components/DocsSideBar.d.ts +1 -1
  11. package/dist/templates/components/DocsSideBar.js +1 -1
  12. package/dist/templates/components/MDXComponents.d.ts +1 -1
  13. package/dist/templates/components/MDXComponents.js +2 -0
  14. package/dist/templates/components/SideBar.d.ts +1 -1
  15. package/dist/templates/components/SideBar.js +5 -0
  16. package/dist/templates/components/layout/ActionBar.d.ts +1 -1
  17. package/dist/templates/components/layout/ActionBar.js +64 -31
  18. package/dist/templates/components/layout/Badge.d.ts +1 -1
  19. package/dist/templates/components/layout/Badge.js +16 -5
  20. package/dist/templates/components/layout/DocsComponents.d.ts +1 -1
  21. package/dist/templates/components/layout/DocsComponents.js +43 -2
  22. package/dist/templates/components/layout/DocsNavigation.d.ts +1 -1
  23. package/dist/templates/components/layout/DocsNavigation.js +8 -1
  24. package/dist/templates/components/layout/FocusModeToggle.d.ts +1 -0
  25. package/dist/templates/components/layout/FocusModeToggle.js +103 -0
  26. package/dist/templates/components/layout/Footer.d.ts +1 -1
  27. package/dist/templates/components/layout/Footer.js +7 -0
  28. package/dist/templates/components/layout/SharedStyles.d.ts +1 -1
  29. package/dist/templates/components/layout/SharedStyles.js +47 -0
  30. package/dist/templates/components/layout/SidePanel.d.ts +1 -0
  31. package/dist/templates/components/layout/SidePanel.js +65 -0
  32. package/dist/templates/components/layout/StaticLinks.d.ts +1 -1
  33. package/dist/templates/components/layout/StaticLinks.js +8 -1
  34. package/dist/templates/llms/llmsIndex.d.ts +13 -0
  35. package/dist/templates/llms/llmsIndex.js +18 -10
  36. package/dist/templates/llms/llmsPage.js +2 -0
  37. package/dist/templates/llms/skillMd.d.ts +10 -0
  38. package/dist/templates/llms/skillMd.js +59 -0
  39. package/dist/templates/mdx/api-playground.mdx.d.ts +1 -1
  40. package/dist/templates/mdx/api-playground.mdx.js +1 -1
  41. package/dist/templates/mdx/badges.mdx.d.ts +1 -1
  42. package/dist/templates/mdx/badges.mdx.js +2 -0
  43. package/dist/templates/mdx/color-swatches.mdx.d.ts +1 -1
  44. package/dist/templates/mdx/color-swatches.mdx.js +1 -1
  45. package/dist/templates/mdx/components.mdx.d.ts +1 -1
  46. package/dist/templates/mdx/components.mdx.js +3 -0
  47. package/dist/templates/mdx/fields.mdx.d.ts +1 -1
  48. package/dist/templates/mdx/fields.mdx.js +1 -1
  49. package/dist/templates/mdx/mermaid.mdx.d.ts +1 -1
  50. package/dist/templates/mdx/mermaid.mdx.js +1 -1
  51. package/dist/templates/mdx/navigation.mdx.d.ts +1 -1
  52. package/dist/templates/mdx/navigation.mdx.js +1 -0
  53. package/dist/templates/mdx/side-panel.mdx.d.ts +1 -0
  54. package/dist/templates/mdx/side-panel.mdx.js +62 -0
  55. package/dist/templates/mdx/update.mdx.d.ts +1 -1
  56. package/dist/templates/mdx/update.mdx.js +1 -1
  57. package/dist/templates/next.config.js +17 -0
  58. package/dist/templates/package.js +2 -2
  59. package/dist/templates/proxy.js +30 -2
  60. package/package.json +2 -2
@@ -0,0 +1,103 @@
1
+ export const focusModeToggleTemplate = `"use client";
2
+ import { useEffect, useRef, useState } from "react";
3
+ import styled from "styled-components";
4
+ import { resetButton } from "cherry-styled-components";
5
+ import { Icon } from "@/components/layout/Icon";
6
+ import { mq, Theme } from "@/app/theme";
7
+ import { interactiveStyles } from "@/components/layout/SharedStyled";
8
+
9
+ // Desktop-only affordance that collapses both rails for distraction-free
10
+ // reading. The button is fixed rather than living in the sidebar footer next
11
+ // to the ThemeToggle: the footer slides away with the sidebar, and the way
12
+ // back out of focus mode has to stay on screen.
13
+ const StyledFocusToggle = styled.button<{ theme: Theme }>\`
14
+ display: none;
15
+
16
+ \${mq("lg")} {
17
+ \${resetButton};
18
+ \${interactiveStyles};
19
+ display: flex;
20
+ align-items: center;
21
+ justify-content: center;
22
+ position: fixed;
23
+ /* Above the sidebar (99) so it stays clickable once the rails are out,
24
+ below the chat panel (1000). */
25
+ z-index: 100;
26
+ /* Sidebar footer row, flush with the footer's left padding (the
27
+ ThemeToggle holds the right end of the same row). */
28
+ left: 20px;
29
+ bottom: 16px;
30
+ width: 30px;
31
+ height: 30px;
32
+ border-radius: 50%;
33
+ background: \${({ theme }) => theme.colors.light};
34
+ border-color: \${({ theme }) => theme.colors.grayLight};
35
+
36
+ & svg {
37
+ width: 16px;
38
+ height: 16px;
39
+ }
40
+
41
+ & svg[stroke] {
42
+ stroke: \${({ theme }) => theme.colors.primary};
43
+ }
44
+
45
+ &:hover svg[stroke] {
46
+ stroke: \${({ theme }) => theme.colors.accent};
47
+ }
48
+ }
49
+ \`;
50
+
51
+ function FocusModeToggle() {
52
+ const [isFocusMode, setIsFocusMode] = useState(false);
53
+ const buttonRef = useRef<HTMLButtonElement>(null);
54
+
55
+ // Cmd/Ctrl+B, the editor convention for collapsing the side columns. Sits
56
+ // alongside the app's other chords (Cmd+K search, Cmd+I chat,
57
+ // Cmd+Shift+L theme) and stays out of the way while the reader is typing.
58
+ useEffect(() => {
59
+ function handleKeyDown(e: KeyboardEvent) {
60
+ if (!(e.metaKey || e.ctrlKey) || e.shiftKey || e.altKey) return;
61
+ if (e.key.toLowerCase() !== "b") return;
62
+ const target = e.target as HTMLElement | null;
63
+ if (target?.closest("input, textarea, [contenteditable='true']")) return;
64
+ // The button is display:none below "lg" and focus mode is a desktop
65
+ // layout, so the shortcut is live exactly when the button is.
66
+ const button = buttonRef.current;
67
+ if (!button || getComputedStyle(button).display === "none") return;
68
+ e.preventDefault();
69
+ setIsFocusMode((value) => !value);
70
+ }
71
+ document.addEventListener("keydown", handleKeyDown);
72
+ return () => document.removeEventListener("keydown", handleKeyDown);
73
+ }, []);
74
+
75
+ // The nav sidebar, the right rail and the content columns sit in separate
76
+ // subtrees, so the state rides on the root element and each of them reacts
77
+ // in CSS (see focusModeHide / focusModeColumn in SharedStyled).
78
+ useEffect(() => {
79
+ const root = document.documentElement;
80
+ if (isFocusMode) {
81
+ root.setAttribute("data-focus-mode", "");
82
+ } else {
83
+ root.removeAttribute("data-focus-mode");
84
+ }
85
+ return () => root.removeAttribute("data-focus-mode");
86
+ }, [isFocusMode]);
87
+
88
+ return (
89
+ <StyledFocusToggle
90
+ ref={buttonRef}
91
+ type="button"
92
+ onClick={() => setIsFocusMode((value) => !value)}
93
+ aria-pressed={isFocusMode}
94
+ aria-label={isFocusMode ? "Exit focus mode" : "Enter focus mode"}
95
+ title={isFocusMode ? "Exit focus mode (⌘B)" : "Focus mode (⌘B)"}
96
+ >
97
+ <Icon name={isFocusMode ? "minimize" : "maximize"} size={16} />
98
+ </StyledFocusToggle>
99
+ );
100
+ }
101
+
102
+ export { FocusModeToggle };
103
+ `;
@@ -1 +1 @@
1
- export declare const footerTemplate = "\"use client\";\nimport { useContext } from \"react\";\nimport styled, { css } from \"styled-components\";\nimport { Space, styledSmall } from \"cherry-styled-components\";\nimport { ChatContext } from \"@/components/Chat\";\nimport { mq, Theme } from \"@/app/theme\";\nimport { GitHubLogo } from \"@/components/layout/Pictograms\";\nimport linksData from \"@/links.json\";\n\ninterface LinkProps {\n title: string;\n url: string;\n icon?: string;\n}\n\nconst links = linksData as LinkProps[];\n\nconst StyledFooter = styled.footer<{\n theme: Theme;\n $isChatOpen?: boolean;\n $hasLinks?: boolean;\n}>`\n padding: 0 20px;\n transition: all 0.3s ease;\n\n ${({ $hasLinks }) =>\n $hasLinks &&\n css`\n margin-top: 20px;\n `}\n\n ${mq(\"lg\")} {\n margin: 0;\n padding: 0 300px 0 300px;\n\n ${({ $isChatOpen }) =>\n $isChatOpen &&\n css`\n padding: 0 440px 0 300px;\n `}\n }\n`;\n\nconst StyledFooterInner = styled.div<{ theme: Theme }>`\n border-top: solid 1px ${({ theme }) => theme.colors.grayLight};\n max-width: 640px;\n margin: 0 auto;\n padding: 28px 0;\n color: ${({ theme }) => theme.colors.grayDark};\n ${({ theme }) => styledSmall(theme)};\n\n ${mq(\"lg\")} {\n padding: 20px 0;\n }\n\n & a {\n font-weight: 700;\n color: ${({ theme }) => theme.colors.accent};\n text-decoration: none;\n transition: all 0.3s ease;\n display: inline-flex;\n\n &:hover {\n color: ${({ theme }) => theme.colors.primary};\n }\n\n /* The GitHub logo is an icon-only link - round the global focus ring so it\n hugs the icon instead of drawing a rectangle. */\n &:has(svg):focus-visible {\n border-radius: 100%;\n }\n\n & svg {\n width: 18px;\n height: 18px;\n }\n }\n`;\n\nconst StyledFooterFlex = styled.div`\n display: flex;\n justify-content: flex-start;\n align-items: center;\n gap: 20px;\n\n ${mq(\"lg\")} {\n justify-content: space-between;\n }\n`;\n\nfunction Footer({ hideBranding }: { hideBranding?: boolean }) {\n const { isOpen } = useContext(ChatContext);\n\n if (hideBranding) return <Space $xs={80} $lg=\"none\" />;\n\n return (\n <StyledFooter $isChatOpen={isOpen} $hasLinks={links.length > 0}>\n <StyledFooterInner>\n <StyledFooterFlex>\n <span>\n Powered by{\" \"}\n <a\n href=\"https://doccupine.com\"\n target=\"_blank\"\n rel=\"noopener noreferrer\"\n >\n Doccupine\n </a>\n </span>\n <a\n href=\"https://github.com/doccupine/cli\"\n target=\"_blank\"\n rel=\"noopener noreferrer\"\n aria-label=\"Doccupine on GitHub\"\n >\n <GitHubLogo />\n </a>\n </StyledFooterFlex>\n </StyledFooterInner>\n </StyledFooter>\n );\n}\n\nexport { Footer };\n";
1
+ export declare const footerTemplate = "\"use client\";\nimport { useContext } from \"react\";\nimport styled, { css } from \"styled-components\";\nimport { Space, styledSmall } from \"cherry-styled-components\";\nimport { ChatContext } from \"@/components/Chat\";\nimport { mq, Theme } from \"@/app/theme\";\nimport { GitHubLogo } from \"@/components/layout/Pictograms\";\nimport {\n focusModeColumn,\n sidePanelOffset,\n} from \"@/components/layout/SharedStyled\";\nimport linksData from \"@/links.json\";\n\ninterface LinkProps {\n title: string;\n url: string;\n icon?: string;\n}\n\nconst links = linksData as LinkProps[];\n\nconst StyledFooter = styled.footer<{\n theme: Theme;\n $isChatOpen?: boolean;\n $hasLinks?: boolean;\n}>`\n padding: 0 20px;\n transition: all 0.3s ease;\n\n ${({ $hasLinks }) =>\n $hasLinks &&\n css`\n margin-top: 20px;\n `}\n\n ${mq(\"lg\")} {\n margin: 0;\n padding: 0 300px 0 300px;\n\n ${({ $isChatOpen }) =>\n $isChatOpen &&\n css`\n padding: 0 440px 0 300px;\n `}\n }\n\n ${sidePanelOffset};\n ${({ $isChatOpen }) => !$isChatOpen && focusModeColumn};\n`;\n\nconst StyledFooterInner = styled.div<{ theme: Theme }>`\n border-top: solid 1px ${({ theme }) => theme.colors.grayLight};\n max-width: 640px;\n margin: 0 auto;\n padding: 28px 0;\n color: ${({ theme }) => theme.colors.grayDark};\n ${({ theme }) => styledSmall(theme)};\n\n ${mq(\"lg\")} {\n padding: 20px 0;\n }\n\n & a {\n font-weight: 700;\n color: ${({ theme }) => theme.colors.accent};\n text-decoration: none;\n transition: all 0.3s ease;\n display: inline-flex;\n\n &:hover {\n color: ${({ theme }) => theme.colors.primary};\n }\n\n /* The GitHub logo is an icon-only link - round the global focus ring so it\n hugs the icon instead of drawing a rectangle. */\n &:has(svg):focus-visible {\n border-radius: 100%;\n }\n\n & svg {\n width: 18px;\n height: 18px;\n }\n }\n`;\n\nconst StyledFooterFlex = styled.div`\n display: flex;\n justify-content: flex-start;\n align-items: center;\n gap: 20px;\n\n ${mq(\"lg\")} {\n justify-content: space-between;\n }\n`;\n\nfunction Footer({ hideBranding }: { hideBranding?: boolean }) {\n const { isOpen } = useContext(ChatContext);\n\n if (hideBranding) return <Space $xs={80} $lg=\"none\" />;\n\n return (\n <StyledFooter $isChatOpen={isOpen} $hasLinks={links.length > 0}>\n <StyledFooterInner>\n <StyledFooterFlex>\n <span>\n Powered by{\" \"}\n <a\n href=\"https://doccupine.com\"\n target=\"_blank\"\n rel=\"noopener noreferrer\"\n >\n Doccupine\n </a>\n </span>\n <a\n href=\"https://github.com/doccupine/cli\"\n target=\"_blank\"\n rel=\"noopener noreferrer\"\n aria-label=\"Doccupine on GitHub\"\n >\n <GitHubLogo />\n </a>\n </StyledFooterFlex>\n </StyledFooterInner>\n </StyledFooter>\n );\n}\n\nexport { Footer };\n";
@@ -6,6 +6,10 @@ import { Space, styledSmall } from "cherry-styled-components";
6
6
  import { ChatContext } from "@/components/Chat";
7
7
  import { mq, Theme } from "@/app/theme";
8
8
  import { GitHubLogo } from "@/components/layout/Pictograms";
9
+ import {
10
+ focusModeColumn,
11
+ sidePanelOffset,
12
+ } from "@/components/layout/SharedStyled";
9
13
  import linksData from "@/links.json";
10
14
 
11
15
  interface LinkProps {
@@ -40,6 +44,9 @@ const StyledFooter = styled.footer<{
40
44
  padding: 0 ${CHAT_WIDTH + 20}px 0 ${SIDEBAR_WIDTH + 20}px;
41
45
  \`}
42
46
  }
47
+
48
+ \${sidePanelOffset};
49
+ \${({ $isChatOpen }) => !$isChatOpen && focusModeColumn};
43
50
  \`;
44
51
 
45
52
  const StyledFooterInner = styled.div<{ theme: Theme }>\`
@@ -1 +1 @@
1
- export declare const sharedStyledTemplate = "\"use client\";\nimport { styledSmall, styledText } from \"cherry-styled-components\";\nimport { mq, Theme } from \"@/app/theme\";\nimport styled, { css } from \"styled-components\";\n\n/** Slim, theme-aware scrollbar for internal scroll areas (code blocks,\n modals, tables) so the chunky native bar doesn't stand out, especially\n in dark mode. */\nexport const thinScrollbar = css<{ theme: Theme }>`\n scrollbar-width: thin;\n scrollbar-color: ${({ theme }) => theme.colors.grayLight} transparent;\n`;\n\nexport const interactiveStyles = css<{ theme: Theme }>`\n transition: all 0.3s ease;\n border: solid 1px transparent;\n box-shadow: 0 0 0 0px ${({ theme }) => theme.colors.primary};\n\n &:hover {\n border-color: ${({ theme }) => theme.colors.primary};\n }\n\n &:focus {\n border-color: ${({ theme }) => theme.colors.primary};\n box-shadow: 0 0 0 4px ${({ theme }) => theme.colors.primaryLight};\n }\n\n &:active {\n box-shadow: 0 0 0 2px ${({ theme }) => theme.colors.primaryLight};\n }\n`;\n\nexport const styledAnchor = css<{ theme: Theme }>`\n & a:not([class]):not(:has(img)) {\n color: inherit;\n transition: all 0.3s ease;\n text-decoration: none;\n box-shadow: 0 2px 0 0 ${({ theme }) => theme.colors.primary};\n\n &:hover {\n color: ${({ theme }) => theme.colors.accent};\n box-shadow: 0 1px 0 0 ${({ theme }) => theme.colors.primary};\n }\n\n /* Same primaryLight focus glow as the global a:focus-visible ring, but\n layered over the link's own box-shadow underline (same property) so the\n underline is preserved. */\n &:focus-visible {\n outline: none;\n border-radius: ${({ theme }) => theme.spacing.radius.xs};\n box-shadow:\n 0 2px 0 0 ${({ theme }) => theme.colors.primary},\n 0 0 0 2px ${({ theme }) => theme.colors.primaryLight};\n }\n }\n`;\n\nexport const stylesLists = css<{ theme: Theme }>`\n & ul,\n & ol {\n & li {\n & > .code-wrapper {\n margin: 10px 0;\n }\n\n & p {\n display: inline;\n }\n }\n }\n\n & ul {\n list-style: none;\n padding: 0;\n margin: 0;\n\n & li {\n text-indent: 0;\n display: block;\n position: relative;\n padding: 0 0 0 24px;\n margin: 0;\n ${({ theme }) => styledText(theme)};\n min-height: 23px;\n\n ${mq(\"lg\")} {\n min-height: 27px;\n }\n\n &::before {\n content: \"\";\n display: block;\n width: 6px;\n height: 6px;\n border-radius: 50%;\n background: ${({ theme }) => theme.colors.primary};\n position: absolute;\n top: 8px;\n left: 9px;\n\n ${mq(\"lg\")} {\n top: 10px;\n }\n }\n }\n }\n\n & ol {\n counter-reset: item;\n padding: 0;\n margin: 0;\n\n & > li {\n counter-increment: item;\n padding: 0 0 0 24px;\n margin: 0;\n ${({ theme }) => styledText(theme)};\n\n &::before {\n content: counter(item) \".\";\n display: inline-block;\n min-width: 20px;\n margin-left: -24px;\n margin-right: 4px;\n text-align: right;\n font-weight: 700;\n color: ${({ theme }) => theme.colors.primary};\n }\n }\n }\n`;\n\nexport const styledTable = css<{ theme: Theme }>`\n & .table-wrapper {\n overflow-x: auto;\n width: 100%;\n ${thinScrollbar};\n }\n\n & table {\n margin: 0;\n padding: 0;\n border-collapse: collapse;\n width: 100%;\n text-align: left;\n\n & tr {\n margin: 0;\n padding: 0;\n }\n\n & th {\n border-bottom: solid 1px ${({ theme }) => theme.colors.grayLight};\n padding: 10px 10px 10px 0;\n ${({ theme }) => styledSmall(theme)};\n font-weight: 600;\n color: ${({ theme }) => theme.colors.dark};\n }\n\n & td {\n border-bottom: solid 1px ${({ theme }) => theme.colors.grayLight};\n padding: 10px 10px 10px 0;\n color: ${({ theme }) => theme.colors.grayDark};\n ${({ theme }) => styledSmall(theme)};\n }\n }\n`;\n\nexport const StyledSmallButton = styled.button<{ theme: Theme }>`\n ${interactiveStyles};\n background: ${({ theme }) => theme.colors.light};\n border: solid 1px ${({ theme }) => theme.colors.grayLight};\n color: ${({ theme }) => theme.colors.accent};\n border-radius: ${({ theme }) => theme.spacing.radius.xs};\n padding: 6px 8px;\n font-size: 12px;\n font-family: inherit;\n font-weight: 600;\n cursor: pointer;\n transition: all 0.2s ease;\n display: flex;\n align-items: center;\n gap: 6px;\n margin-right: -6px;\n\n & svg.lucide {\n color: inherit;\n }\n`;\n";
1
+ export declare const sharedStyledTemplate = "\"use client\";\nimport { styledSmall, styledText } from \"cherry-styled-components\";\nimport { mq, Theme } from \"@/app/theme\";\nimport styled, { css } from \"styled-components\";\n\n/** From \"xl\" a <SidePanel> widens from the navigation rail's width to the\n chat panel's, so every column that already shifts for an open chat shifts\n by the same amount when a panel is on the page. Below \"xl\" the panel fits\n the space the table of contents already reserved, so no offset applies and\n the content column keeps its width. :has() reads the server-rendered\n panel, so the layout is right on first paint with no client state. */\nexport const sidePanelOffset = css`\n ${mq(\"xl\")} {\n body:has([data-side-panel]) & {\n padding-right: 440px;\n }\n }\n`;\n\n/** Focus mode: FocusModeToggle sets data-focus-mode on <html> and the rails\n slide out of view, left rail leftwards and right rail rightwards. Keyed\n off the root element because the sidebar, the rails and the content\n columns live in separate subtrees. Desktop only - below \"lg\" the rails are\n already collapsed or inline. */\nexport const focusModeHide = (edge: \"left\" | \"right\") => css`\n ${mq(\"lg\")} {\n transition:\n transform 0.3s ease,\n opacity 0.3s ease;\n\n html[data-focus-mode] & {\n transform: translateX(${edge === \"left\" ? \"-100%\" : \"100%\"});\n opacity: 0;\n pointer-events: none;\n }\n }\n`;\n\n/** The other half of focus mode: a content column drops the padding it was\n reserving for the rails and centers on the full viewport. Interpolate it\n last so it wins over the equally specific sidePanelOffset rule, and skip\n it while the chat is open - that panel is still there to make room for. */\nexport const focusModeColumn = css`\n ${mq(\"lg\")} {\n html[data-focus-mode] & {\n padding-left: 20px;\n padding-right: 20px;\n }\n }\n`;\n\n/** Slim, theme-aware scrollbar for internal scroll areas (code blocks,\n modals, tables) so the chunky native bar doesn't stand out, especially\n in dark mode. */\nexport const thinScrollbar = css<{ theme: Theme }>`\n scrollbar-width: thin;\n scrollbar-color: ${({ theme }) => theme.colors.grayLight} transparent;\n`;\n\nexport const interactiveStyles = css<{ theme: Theme }>`\n transition: all 0.3s ease;\n border: solid 1px transparent;\n box-shadow: 0 0 0 0px ${({ theme }) => theme.colors.primary};\n\n &:hover {\n border-color: ${({ theme }) => theme.colors.primary};\n }\n\n &:focus {\n border-color: ${({ theme }) => theme.colors.primary};\n box-shadow: 0 0 0 4px ${({ theme }) => theme.colors.primaryLight};\n }\n\n &:active {\n box-shadow: 0 0 0 2px ${({ theme }) => theme.colors.primaryLight};\n }\n`;\n\nexport const styledAnchor = css<{ theme: Theme }>`\n & a:not([class]):not(:has(img)) {\n color: inherit;\n transition: all 0.3s ease;\n text-decoration: none;\n box-shadow: 0 2px 0 0 ${({ theme }) => theme.colors.primary};\n\n &:hover {\n color: ${({ theme }) => theme.colors.accent};\n box-shadow: 0 1px 0 0 ${({ theme }) => theme.colors.primary};\n }\n\n /* Same primaryLight focus glow as the global a:focus-visible ring, but\n layered over the link's own box-shadow underline (same property) so the\n underline is preserved. */\n &:focus-visible {\n outline: none;\n border-radius: ${({ theme }) => theme.spacing.radius.xs};\n box-shadow:\n 0 2px 0 0 ${({ theme }) => theme.colors.primary},\n 0 0 0 2px ${({ theme }) => theme.colors.primaryLight};\n }\n }\n`;\n\nexport const stylesLists = css<{ theme: Theme }>`\n & ul,\n & ol {\n & li {\n & > .code-wrapper {\n margin: 10px 0;\n }\n\n & p {\n display: inline;\n }\n }\n }\n\n & ul {\n list-style: none;\n padding: 0;\n margin: 0;\n\n & li {\n text-indent: 0;\n display: block;\n position: relative;\n padding: 0 0 0 24px;\n margin: 0;\n ${({ theme }) => styledText(theme)};\n min-height: 23px;\n\n ${mq(\"lg\")} {\n min-height: 27px;\n }\n\n &::before {\n content: \"\";\n display: block;\n width: 6px;\n height: 6px;\n border-radius: 50%;\n background: ${({ theme }) => theme.colors.primary};\n position: absolute;\n top: 8px;\n left: 9px;\n\n ${mq(\"lg\")} {\n top: 10px;\n }\n }\n }\n }\n\n & ol {\n counter-reset: item;\n padding: 0;\n margin: 0;\n\n & > li {\n counter-increment: item;\n padding: 0 0 0 24px;\n margin: 0;\n ${({ theme }) => styledText(theme)};\n\n &::before {\n content: counter(item) \".\";\n display: inline-block;\n min-width: 20px;\n margin-left: -24px;\n margin-right: 4px;\n text-align: right;\n font-weight: 700;\n color: ${({ theme }) => theme.colors.primary};\n }\n }\n }\n`;\n\nexport const styledTable = css<{ theme: Theme }>`\n & .table-wrapper {\n overflow-x: auto;\n width: 100%;\n ${thinScrollbar};\n }\n\n & table {\n margin: 0;\n padding: 0;\n border-collapse: collapse;\n width: 100%;\n text-align: left;\n\n & tr {\n margin: 0;\n padding: 0;\n }\n\n & th {\n border-bottom: solid 1px ${({ theme }) => theme.colors.grayLight};\n padding: 10px 10px 10px 0;\n ${({ theme }) => styledSmall(theme)};\n font-weight: 600;\n color: ${({ theme }) => theme.colors.dark};\n }\n\n & td {\n border-bottom: solid 1px ${({ theme }) => theme.colors.grayLight};\n padding: 10px 10px 10px 0;\n color: ${({ theme }) => theme.colors.grayDark};\n ${({ theme }) => styledSmall(theme)};\n }\n }\n`;\n\nexport const StyledSmallButton = styled.button<{ theme: Theme }>`\n ${interactiveStyles};\n background: ${({ theme }) => theme.colors.light};\n border: solid 1px ${({ theme }) => theme.colors.grayLight};\n color: ${({ theme }) => theme.colors.accent};\n border-radius: ${({ theme }) => theme.spacing.radius.xs};\n padding: 6px 8px;\n font-size: 12px;\n font-family: inherit;\n font-weight: 600;\n cursor: pointer;\n transition: all 0.2s ease;\n display: flex;\n align-items: center;\n gap: 6px;\n margin-right: -6px;\n\n & svg.lucide {\n color: inherit;\n }\n`;\n";
@@ -1,8 +1,55 @@
1
+ import { CHAT_WIDTH } from "../../app/theme.js";
1
2
  export const sharedStyledTemplate = `"use client";
2
3
  import { styledSmall, styledText } from "cherry-styled-components";
3
4
  import { mq, Theme } from "@/app/theme";
4
5
  import styled, { css } from "styled-components";
5
6
 
7
+ /** From "xl" a <SidePanel> widens from the navigation rail's width to the
8
+ chat panel's, so every column that already shifts for an open chat shifts
9
+ by the same amount when a panel is on the page. Below "xl" the panel fits
10
+ the space the table of contents already reserved, so no offset applies and
11
+ the content column keeps its width. :has() reads the server-rendered
12
+ panel, so the layout is right on first paint with no client state. */
13
+ export const sidePanelOffset = css\`
14
+ \${mq("xl")} {
15
+ body:has([data-side-panel]) & {
16
+ padding-right: ${CHAT_WIDTH + 20}px;
17
+ }
18
+ }
19
+ \`;
20
+
21
+ /** Focus mode: FocusModeToggle sets data-focus-mode on <html> and the rails
22
+ slide out of view, left rail leftwards and right rail rightwards. Keyed
23
+ off the root element because the sidebar, the rails and the content
24
+ columns live in separate subtrees. Desktop only - below "lg" the rails are
25
+ already collapsed or inline. */
26
+ export const focusModeHide = (edge: "left" | "right") => css\`
27
+ \${mq("lg")} {
28
+ transition:
29
+ transform 0.3s ease,
30
+ opacity 0.3s ease;
31
+
32
+ html[data-focus-mode] & {
33
+ transform: translateX(\${edge === "left" ? "-100%" : "100%"});
34
+ opacity: 0;
35
+ pointer-events: none;
36
+ }
37
+ }
38
+ \`;
39
+
40
+ /** The other half of focus mode: a content column drops the padding it was
41
+ reserving for the rails and centers on the full viewport. Interpolate it
42
+ last so it wins over the equally specific sidePanelOffset rule, and skip
43
+ it while the chat is open - that panel is still there to make room for. */
44
+ export const focusModeColumn = css\`
45
+ \${mq("lg")} {
46
+ html[data-focus-mode] & {
47
+ padding-left: 20px;
48
+ padding-right: 20px;
49
+ }
50
+ }
51
+ \`;
52
+
6
53
  /** Slim, theme-aware scrollbar for internal scroll areas (code blocks,
7
54
  modals, tables) so the chunky native bar doesn't stand out, especially
8
55
  in dark mode. */
@@ -0,0 +1 @@
1
+ export declare const sidePanelTemplate = "\"use client\";\nimport React from \"react\";\nimport styled from \"styled-components\";\nimport { mq, Theme } from \"@/app/theme\";\nimport { focusModeHide } from \"@/components/layout/SharedStyled\";\n\n// Below \"lg\" the panel stays in the document flow, rendering inline exactly\n// where it sits in the MDX source. From \"lg\" up it is lifted out of the flow\n// into the fixed right rail, at the 280px width the table of\n// contents it replaces would have used - the content column already reserves\n// exactly that much, so nothing has to move. Only from \"xl\", where there is\n// room to spare, does it widen to the chat panel's 420px and pull\n// the other columns left with it (see sidePanelOffset, keyed off the data\n// attribute below).\nconst StyledSidePanel = styled.aside<{ theme: Theme }>`\n display: flex;\n flex-direction: column;\n gap: 20px;\n padding: 20px;\n border-radius: ${({ theme }) => theme.spacing.radius.lg};\n background: ${({ theme }) =>\n `color-mix(in srgb, ${theme.colors.primaryLight} 10%, transparent)`};\n\n ${mq(\"lg\")} {\n position: fixed;\n top: 0;\n right: 0;\n z-index: 1;\n width: 280px;\n height: 100dvh;\n overflow-y: auto;\n gap: 15px;\n padding: 82px 20px 20px 20px;\n border-left: solid 1px ${({ theme }) => theme.colors.grayLight};\n border-radius: 0;\n background: ${({ theme }) => theme.colors.light};\n -webkit-overflow-scrolling: touch;\n\n &::-webkit-scrollbar {\n display: none;\n }\n }\n\n ${mq(\"xl\")} {\n width: 420px;\n }\n\n ${focusModeHide(\"right\")};\n`;\n\ninterface SidePanelProps {\n children?: React.ReactNode;\n}\n\nfunction SidePanel({ children }: SidePanelProps) {\n return (\n <StyledSidePanel aria-label=\"Page panel\" data-side-panel>\n {children}\n </StyledSidePanel>\n );\n}\n\nexport { SidePanel };\n";
@@ -0,0 +1,65 @@
1
+ import { CHAT_WIDTH, SIDEBAR_WIDTH } from "../../app/theme.js";
2
+ export const sidePanelTemplate = `"use client";
3
+ import React from "react";
4
+ import styled from "styled-components";
5
+ import { mq, Theme } from "@/app/theme";
6
+ import { focusModeHide } from "@/components/layout/SharedStyled";
7
+
8
+ // Below "lg" the panel stays in the document flow, rendering inline exactly
9
+ // where it sits in the MDX source. From "lg" up it is lifted out of the flow
10
+ // into the fixed right rail, at the ${SIDEBAR_WIDTH}px width the table of
11
+ // contents it replaces would have used - the content column already reserves
12
+ // exactly that much, so nothing has to move. Only from "xl", where there is
13
+ // room to spare, does it widen to the chat panel's ${CHAT_WIDTH}px and pull
14
+ // the other columns left with it (see sidePanelOffset, keyed off the data
15
+ // attribute below).
16
+ const StyledSidePanel = styled.aside<{ theme: Theme }>\`
17
+ display: flex;
18
+ flex-direction: column;
19
+ gap: 20px;
20
+ padding: 20px;
21
+ border-radius: \${({ theme }) => theme.spacing.radius.lg};
22
+ background: \${({ theme }) =>
23
+ \`color-mix(in srgb, \${theme.colors.primaryLight} 10%, transparent)\`};
24
+
25
+ \${mq("lg")} {
26
+ position: fixed;
27
+ top: 0;
28
+ right: 0;
29
+ z-index: 1;
30
+ width: ${SIDEBAR_WIDTH}px;
31
+ height: 100dvh;
32
+ overflow-y: auto;
33
+ gap: 15px;
34
+ padding: 82px 20px 20px 20px;
35
+ border-left: solid 1px \${({ theme }) => theme.colors.grayLight};
36
+ border-radius: 0;
37
+ background: \${({ theme }) => theme.colors.light};
38
+ -webkit-overflow-scrolling: touch;
39
+
40
+ &::-webkit-scrollbar {
41
+ display: none;
42
+ }
43
+ }
44
+
45
+ \${mq("xl")} {
46
+ width: ${CHAT_WIDTH}px;
47
+ }
48
+
49
+ \${focusModeHide("right")};
50
+ \`;
51
+
52
+ interface SidePanelProps {
53
+ children?: React.ReactNode;
54
+ }
55
+
56
+ function SidePanel({ children }: SidePanelProps) {
57
+ return (
58
+ <StyledSidePanel aria-label="Page panel" data-side-panel>
59
+ {children}
60
+ </StyledSidePanel>
61
+ );
62
+ }
63
+
64
+ export { SidePanel };
65
+ `;
@@ -1 +1 @@
1
- export declare const staticLinksTemplate = "\"use client\";\nimport styled, { css } from \"styled-components\";\nimport { useContext } from \"react\";\nimport { ChatContext } from \"@/components/Chat\";\nimport { mq, Theme } from \"@/app/theme\";\nimport { interactiveStyles } from \"@/components/layout/SharedStyled\";\nimport { Icon } from \"@/components/layout/Icon\";\nimport linksData from \"@/links.json\";\n\ninterface LinkProps {\n title: string;\n url: string;\n icon?: string;\n}\n\nconst links = linksData as LinkProps[];\n\nconst StyledStaticLinks = styled.div<{ theme: Theme; $isChatOpen: boolean }>`\n display: flex;\n margin: 0 auto;\n transition: all 0.3s ease;\n padding: 0 20px;\n margin-bottom: 20px;\n\n ${mq(\"lg\")} {\n margin: 0;\n padding: 0 300px 20px 300px;\n\n ${({ $isChatOpen }) =>\n $isChatOpen &&\n css`\n padding: 0 440px 20px 300px;\n `}\n }\n`;\n\nconst StyledStaticLinksContent = styled.div`\n max-width: 640px;\n margin: auto 0;\n display: flex;\n gap: 16px;\n flex-wrap: wrap;\n width: 100%;\n margin: 0 auto;\n`;\n\nconst StyledLink = styled.a<{ theme: Theme; $hasIcon?: boolean }>`\n position: relative;\n text-decoration: none;\n font-size: ${({ theme }) => theme.fontSizes.small.lg};\n line-height: 1;\n color: ${({ theme }) => theme.colors.accent};\n padding: 0;\n display: flex;\n gap: 6px;\n transition: all 0.3s ease;\n font-weight: 600;\n white-space: nowrap;\n min-width: fit-content;\n background: ${({ theme }) =>\n `color-mix(in srgb, ${theme.colors.primaryLight} 10%, transparent)`};\n padding: 6px 8px;\n border-radius: ${({ theme }) => theme.spacing.radius.xs};\n ${interactiveStyles};\n\n ${({ $hasIcon }) =>\n $hasIcon &&\n css`\n padding-left: 30px;\n `}\n\n & * {\n margin: auto 0;\n }\n\n & svg {\n position: absolute;\n top: 50%;\n left: 8px;\n transform: translateY(-50%);\n }\n\n &:hover {\n color: ${({ theme }) => theme.colors.accent};\n }\n`;\n\nfunction StaticLinks() {\n const { isOpen } = useContext(ChatContext);\n\n if (links.length === 0) {\n return null;\n }\n\n return (\n <>\n <StyledStaticLinks $isChatOpen={isOpen}>\n <StyledStaticLinksContent>\n {links.map((link, index) => (\n <StyledLink\n key={index}\n href={link.url}\n target=\"_blank\"\n rel=\"noopener noreferrer\"\n $hasIcon={link.icon ? true : false}\n >\n {link.icon && <Icon name={link.icon} size={16} />}\n <span>{link.title}</span>\n </StyledLink>\n ))}\n </StyledStaticLinksContent>\n </StyledStaticLinks>\n </>\n );\n}\n\nexport { StaticLinks };\n";
1
+ export declare const staticLinksTemplate = "\"use client\";\nimport styled, { css } from \"styled-components\";\nimport { useContext } from \"react\";\nimport { ChatContext } from \"@/components/Chat\";\nimport { mq, Theme } from \"@/app/theme\";\nimport {\n focusModeColumn,\n interactiveStyles,\n sidePanelOffset,\n} from \"@/components/layout/SharedStyled\";\nimport { Icon } from \"@/components/layout/Icon\";\nimport linksData from \"@/links.json\";\n\ninterface LinkProps {\n title: string;\n url: string;\n icon?: string;\n}\n\nconst links = linksData as LinkProps[];\n\nconst StyledStaticLinks = styled.div<{ theme: Theme; $isChatOpen: boolean }>`\n display: flex;\n margin: 0 auto;\n transition: all 0.3s ease;\n padding: 0 20px;\n margin-bottom: 20px;\n\n ${mq(\"lg\")} {\n margin: 0;\n padding: 0 300px 20px 300px;\n\n ${({ $isChatOpen }) =>\n $isChatOpen &&\n css`\n padding: 0 440px 20px 300px;\n `}\n }\n\n ${sidePanelOffset};\n ${({ $isChatOpen }) => !$isChatOpen && focusModeColumn};\n`;\n\nconst StyledStaticLinksContent = styled.div`\n max-width: 640px;\n margin: auto 0;\n display: flex;\n gap: 16px;\n flex-wrap: wrap;\n width: 100%;\n margin: 0 auto;\n`;\n\nconst StyledLink = styled.a<{ theme: Theme; $hasIcon?: boolean }>`\n position: relative;\n text-decoration: none;\n font-size: ${({ theme }) => theme.fontSizes.small.lg};\n line-height: 1;\n color: ${({ theme }) => theme.colors.accent};\n padding: 0;\n display: flex;\n gap: 6px;\n transition: all 0.3s ease;\n font-weight: 600;\n white-space: nowrap;\n min-width: fit-content;\n background: ${({ theme }) =>\n `color-mix(in srgb, ${theme.colors.primaryLight} 10%, transparent)`};\n padding: 6px 8px;\n border-radius: ${({ theme }) => theme.spacing.radius.xs};\n ${interactiveStyles};\n\n ${({ $hasIcon }) =>\n $hasIcon &&\n css`\n padding-left: 30px;\n `}\n\n & * {\n margin: auto 0;\n }\n\n & svg {\n position: absolute;\n top: 50%;\n left: 8px;\n transform: translateY(-50%);\n }\n\n &:hover {\n color: ${({ theme }) => theme.colors.accent};\n }\n`;\n\nfunction StaticLinks() {\n const { isOpen } = useContext(ChatContext);\n\n if (links.length === 0) {\n return null;\n }\n\n return (\n <>\n <StyledStaticLinks $isChatOpen={isOpen}>\n <StyledStaticLinksContent>\n {links.map((link, index) => (\n <StyledLink\n key={index}\n href={link.url}\n target=\"_blank\"\n rel=\"noopener noreferrer\"\n $hasIcon={link.icon ? true : false}\n >\n {link.icon && <Icon name={link.icon} size={16} />}\n <span>{link.title}</span>\n </StyledLink>\n ))}\n </StyledStaticLinksContent>\n </StyledStaticLinks>\n </>\n );\n}\n\nexport { StaticLinks };\n";
@@ -4,7 +4,11 @@ import styled, { css } from "styled-components";
4
4
  import { useContext } from "react";
5
5
  import { ChatContext } from "@/components/Chat";
6
6
  import { mq, Theme } from "@/app/theme";
7
- import { interactiveStyles } from "@/components/layout/SharedStyled";
7
+ import {
8
+ focusModeColumn,
9
+ interactiveStyles,
10
+ sidePanelOffset,
11
+ } from "@/components/layout/SharedStyled";
8
12
  import { Icon } from "@/components/layout/Icon";
9
13
  import linksData from "@/links.json";
10
14
 
@@ -33,6 +37,9 @@ const StyledStaticLinks = styled.div<{ theme: Theme; $isChatOpen: boolean }>\`
33
37
  padding: 0 ${CHAT_WIDTH + 20}px 20px ${SIDEBAR_WIDTH + 20}px;
34
38
  \`}
35
39
  }
40
+
41
+ \${sidePanelOffset};
42
+ \${({ $isChatOpen }) => !$isChatOpen && focusModeColumn};
36
43
  \`;
37
44
 
38
45
  const StyledStaticLinksContent = styled.div\`
@@ -6,4 +6,17 @@ export interface LlmsIndexArgs {
6
6
  pages: PageMeta[];
7
7
  sectionsConfig: SectionConfig[] | null;
8
8
  }
9
+ export interface CategoryGroup {
10
+ category: string;
11
+ minCategoryOrder: number;
12
+ pages: PageMeta[];
13
+ }
14
+ export interface SectionGroup {
15
+ sectionSlug: string;
16
+ sectionLabel: string;
17
+ sectionOrder: number;
18
+ categories: CategoryGroup[];
19
+ }
20
+ export declare function pageUrl(slug: string, baseUrl: string | null): string;
21
+ export declare function buildSectionGroups(pages: PageMeta[], sectionsConfig: SectionConfig[] | null): SectionGroup[];
9
22
  export declare function llmsIndexTemplate(args: LlmsIndexArgs): string;
@@ -1,15 +1,16 @@
1
- function pageUrl(slug, baseUrl) {
2
- if (baseUrl) {
3
- return slug === "" ? `${baseUrl}/` : `${baseUrl}/${slug}`;
4
- }
5
- return slug === "" ? "/" : `/${slug}`;
1
+ // Index links point at the static markdown mirrors (public/{slug}.md) so
2
+ // agents get clean markdown directly; the HTML page is the same URL without
3
+ // the .md suffix.
4
+ export function pageUrl(slug, baseUrl) {
5
+ const prefix = baseUrl ?? "";
6
+ return slug === "" ? `${prefix}/index.md` : `${prefix}/${slug}.md`;
6
7
  }
7
8
  function comparePages(a, b) {
8
9
  if (a.order !== b.order)
9
10
  return a.order - b.order;
10
11
  return a.title.localeCompare(b.title);
11
12
  }
12
- function buildSectionGroups(pages, sectionsConfig) {
13
+ export function buildSectionGroups(pages, sectionsConfig) {
13
14
  const sectionOrderIndex = new Map();
14
15
  sectionOrderIndex.set("", 0);
15
16
  if (sectionsConfig) {
@@ -71,12 +72,19 @@ function buildSectionGroups(pages, sectionsConfig) {
71
72
  export function llmsIndexTemplate(args) {
72
73
  const { siteName, siteDescription, baseUrl, pages, sectionsConfig } = args;
73
74
  const lines = [];
75
+ const prefix = baseUrl ?? "";
74
76
  lines.push(`# ${siteName}`);
75
77
  lines.push("");
76
- if (siteDescription && siteDescription.trim() !== "") {
77
- lines.push(`> ${siteDescription.trim()}`);
78
- lines.push("");
79
- }
78
+ const summary = siteDescription && siteDescription.trim() !== ""
79
+ ? siteDescription.trim()
80
+ : `Documentation for ${siteName}.`;
81
+ lines.push(`> ${summary}`);
82
+ lines.push("");
83
+ lines.push("Every page link below points to a markdown mirror; drop the .md suffix for the HTML version.");
84
+ lines.push(`Full corpus in one file: ${prefix}/llms-full.txt`);
85
+ lines.push(`Agent skill: ${prefix}/skill.md`);
86
+ lines.push(`MCP server (streamable HTTP; tools: search_docs, get_doc, list_docs): ${prefix}/api/mcp`);
87
+ lines.push("");
80
88
  if (pages.length === 0) {
81
89
  return lines.join("\n") + "\n";
82
90
  }
@@ -14,6 +14,8 @@ export function llmsPageTemplate(page, baseUrl) {
14
14
  }
15
15
  lines.push(`Source: ${pageUrl(page.slug, baseUrl)}`);
16
16
  lines.push("");
17
+ lines.push(`> For the complete documentation index, see [llms.txt](${baseUrl ?? ""}/llms.txt).`);
18
+ lines.push("");
17
19
  lines.push(page.body.trim());
18
20
  lines.push("");
19
21
  return lines.join("\n");
@@ -0,0 +1,10 @@
1
+ import type { PageMeta, SectionConfig } from "../../lib/types.js";
2
+ export interface SkillMdArgs {
3
+ siteName: string;
4
+ siteDescription?: string;
5
+ baseUrl: string | null;
6
+ pages: PageMeta[];
7
+ sectionsConfig: SectionConfig[] | null;
8
+ }
9
+ export declare function siteDocsSlug(siteName: string): string;
10
+ export declare function skillMdTemplate(args: SkillMdArgs): string;
@@ -0,0 +1,59 @@
1
+ import { buildSectionGroups, pageUrl } from "./llmsIndex.js";
2
+ const KEY_PAGE_LIMIT = 8;
3
+ function slugifySiteName(siteName) {
4
+ const slug = siteName
5
+ .toLowerCase()
6
+ .replace(/[^a-z0-9]+/g, "-")
7
+ .replace(/^-+|-+$/g, "");
8
+ return slug === "" ? "docs" : slug;
9
+ }
10
+ // Identifier for the skill name and the MCP discovery manifest. Skips the
11
+ // -docs suffix when the site name already ends in "docs" ("Acme Docs" ->
12
+ // acme-docs, not acme-docs-docs).
13
+ export function siteDocsSlug(siteName) {
14
+ const slug = slugifySiteName(siteName);
15
+ return slug === "docs" || slug.endsWith("-docs") ? slug : `${slug}-docs`;
16
+ }
17
+ // Agent skill definition served at /skill.md: tells agents how to read the
18
+ // docs (llms.txt index, .md mirrors, MCP server) and lists the first pages in
19
+ // navigation order as entry points. A user-authored public/skill.md in the
20
+ // watch dir overrides this file, since public assets are copied afterwards.
21
+ export function skillMdTemplate(args) {
22
+ const { siteName, siteDescription, baseUrl, pages, sectionsConfig } = args;
23
+ const prefix = baseUrl ?? "";
24
+ const description = `Navigate and use the ${siteName} documentation. Use when answering questions about ${siteName} or working with its docs.`;
25
+ const keyPages = buildSectionGroups(pages, sectionsConfig)
26
+ .flatMap((group) => group.categories)
27
+ .flatMap((cat) => cat.pages)
28
+ .slice(0, KEY_PAGE_LIMIT);
29
+ const lines = [];
30
+ lines.push("---");
31
+ lines.push(`name: ${siteDocsSlug(siteName)}`);
32
+ lines.push(`description: ${JSON.stringify(description)}`);
33
+ lines.push("---");
34
+ lines.push("");
35
+ lines.push(`# ${siteName} documentation`);
36
+ lines.push("");
37
+ if (siteDescription && siteDescription.trim() !== "") {
38
+ lines.push(siteDescription.trim());
39
+ lines.push("");
40
+ }
41
+ lines.push("## Reading these docs");
42
+ lines.push("");
43
+ lines.push(`- Documentation index: ${prefix}/llms.txt (full corpus: ${prefix}/llms-full.txt)`);
44
+ lines.push("- Every page has a markdown mirror: append .md to the page URL");
45
+ lines.push(`- MCP server with search_docs, get_doc, and list_docs tools: ${prefix}/api/mcp (streamable HTTP)`);
46
+ lines.push("");
47
+ if (keyPages.length > 0) {
48
+ lines.push("## Key pages");
49
+ lines.push("");
50
+ for (const page of keyPages) {
51
+ const desc = page.description && page.description.trim() !== ""
52
+ ? ` - ${page.description.trim()}`
53
+ : "";
54
+ lines.push(`- [${page.title}](${pageUrl(page.slug, baseUrl)})${desc}`);
55
+ }
56
+ lines.push("");
57
+ }
58
+ return lines.join("\n");
59
+ }
@@ -1 +1 @@
1
- export declare const apiPlaygroundMdxTemplate = "---\ntitle: \"API Playground\"\ndescription: \"Turn an OpenAPI document into an interactive API reference where readers send real requests and see live responses, right inside your docs.\"\ndate: \"2026-07-25\"\ncategory: \"Components\"\ncategoryOrder: 1\norder: 19\n---\n# API Playground\n\nPoint Doccupine at an OpenAPI document and it generates a complete, interactive API reference: one page per endpoint, grouped by tag in the sidebar, each with a \"Send request\" panel that makes real calls and shows the live response - plus copy-pasteable code snippets.\n\n<Callout type=\"note\">\nThe playground is driven entirely by your OpenAPI document. There is nothing to wire up by hand - add one line of config and every endpoint becomes a documented, runnable page.\n</Callout>\n\n## Try it\n\nPress **Try it** below to open the playground, tweak the request body, and send a real request to a live API - right from these docs.\n\n<ApiPlaygroundDemo />\n\n## Enabling the playground\n\n<Steps>\n <Step title=\"Add an openapi path to doccupine.json.\">\n Point at a local `.json`, `.yaml`, or `.yml` OpenAPI 3.0 or 3.1 document.\n\n```json\n{\n \"watchDir\": \"docs\",\n \"outputDir\": \"nextjs-app\",\n \"openapi\": \"openapi.yaml\"\n}\n```\n </Step>\n <Step title=\"Run Doccupine.\">\n On the next build (or live, while watching) Doccupine parses the document, resolves every `$ref`, and writes an endpoint page for each operation.\n </Step>\n <Step title=\"Open the API Reference section.\">\n Endpoints appear in the sidebar grouped by their OpenAPI tag. Editing the spec regenerates the pages automatically.\n </Step>\n</Steps>\n\n## Example spec\n\nDo not have a document yet? This `openapi.yaml` points at [JSONPlaceholder](https://jsonplaceholder.typicode.com), a free public test API, so it works end to end - save it, set `openapi` to it, and the generated pages can send real requests:\n\n```yaml\nopenapi: 3.1.0\ninfo:\n title: JSONPlaceholder\n version: 1.0.0\nservers:\n - url: https://jsonplaceholder.typicode.com\ntags:\n - name: Todos\n - name: Posts\npaths:\n /todos/{id}:\n get:\n summary: Get a to-do\n tags: [Todos]\n parameters:\n - name: id\n in: path\n required: true\n schema:\n type: integer\n responses:\n \"200\":\n description: Just a demo of a to-do item\n /posts:\n post:\n summary: Create a post\n tags: [Posts]\n requestBody:\n required: true\n content:\n application/json:\n example:\n title: Hello\n body: Sent from the docs\n userId: 1\n responses:\n \"201\":\n description: Just a demo of the created post\n```\n\nEach part maps to something in the playground: `servers` sets the request target - and the only host the proxy will call - `tags` group endpoints in the sidebar, and `parameters` and `requestBody` become the inputs (adding a `securitySchemes` entry would produce authentication fields). Doccupine reads OpenAPI 3.0 and 3.1; see the [OpenAPI specification](https://spec.openapis.org) for the full format.\n\n## What gets generated\n\nEvery operation becomes its own page under `/api-reference/{tag}/{operation}`, showing:\n\n<Field value=\"Parameters\" type=\"path, query, header, cookie\">\nEach parameter is rendered with its name, type, and whether it is required, grouped into a collapsible section with an input to fill in.\n</Field>\n\n<Field value=\"Request body\" type=\"editable\">\nA JSON editor prefilled from the schema's example, ready to tweak and send.\n</Field>\n\n<Field value=\"Authentication\" type=\"from securitySchemes\">\nInputs for the endpoint's security schemes - API keys, bearer tokens, or basic auth - generated from the document.\n</Field>\n\n<Field value=\"Response\" type=\"live\">\nThe real status, timing, and body from your API, rendered to match its content type.\n</Field>\n\n## Embedding a single endpoint\n\nTo mix prose and a live endpoint on a hand-written page, reference an operation from the page's frontmatter with `openapi`. Use `METHOD /path` or an `operationId`:\n\n```mdx\n---\ntitle: \"Create a post\"\nopenapi: \"POST /posts\"\n---\n\nPosts are created for a user. The playground above is fully live - fill in the\nbody and send a real request.\n```\n\nDoccupine renders that endpoint's playground above your prose. If the reference does not match any operation in your document, the page still renders its prose and a warning is logged.\n\n## Running requests\n\nRequests run one of two ways, and readers can switch between them:\n\n<Callout type=\"note\">\n**Proxy (default).** The request is forwarded server-side, so it works even when the target API blocks cross-origin browser calls. **Direct.** The browser calls the API itself - useful when the API allows CORS and you want requests to never leave the reader's machine.\n</Callout>\n\nThe proxy is deliberately locked down. It only forwards to the servers declared in your OpenAPI document, refuses to reach private or internal network addresses, and never logs request URLs, headers, or bodies - so API keys a reader enters are not written anywhere.\n\n<Callout type=\"warning\">\nKeys and tokens a reader types are used only to make the request. Turn on \"Show secrets\" to reveal them in the generated code snippets; they are redacted by default.\n</Callout>\n\n## Responses and snippets\n\nResponses render to match their type: images and video play inline, everything else is shown as a formatted, syntax-highlighted body. Alongside the response, the playground generates ready-to-run **cURL**, **JavaScript**, and **Python** snippets for the exact request you built.\n\n## Documenting more than one API\n\nPass an array to document several APIs at once. Each spec becomes its own namespaced section:\n\n```json\n{\n \"openapi\": [\n { \"name\": \"public\", \"file\": \"specs/public.yaml\" },\n { \"name\": \"admin\", \"file\": \"specs/admin.yaml\" }\n ]\n}\n```\n";
1
+ export declare const apiPlaygroundMdxTemplate = "---\ntitle: \"API Playground\"\ndescription: \"Turn an OpenAPI document into an interactive API reference where readers send real requests and see live responses, right inside your docs.\"\ndate: \"2026-07-25\"\ncategory: \"Components\"\ncategoryOrder: 1\norder: 20\n---\n# API Playground\n\nPoint Doccupine at an OpenAPI document and it generates a complete, interactive API reference: one page per endpoint, grouped by tag in the sidebar, each with a \"Send request\" panel that makes real calls and shows the live response - plus copy-pasteable code snippets.\n\n<Callout type=\"note\">\nThe playground is driven entirely by your OpenAPI document. There is nothing to wire up by hand - add one line of config and every endpoint becomes a documented, runnable page.\n</Callout>\n\n## Try it\n\nPress **Try it** below to open the playground, tweak the request body, and send a real request to a live API - right from these docs.\n\n<ApiPlaygroundDemo />\n\n## Enabling the playground\n\n<Steps>\n <Step title=\"Add an openapi path to doccupine.json.\">\n Point at a local `.json`, `.yaml`, or `.yml` OpenAPI 3.0 or 3.1 document.\n\n```json\n{\n \"watchDir\": \"docs\",\n \"outputDir\": \"nextjs-app\",\n \"openapi\": \"openapi.yaml\"\n}\n```\n </Step>\n <Step title=\"Run Doccupine.\">\n On the next build (or live, while watching) Doccupine parses the document, resolves every `$ref`, and writes an endpoint page for each operation.\n </Step>\n <Step title=\"Open the API Reference section.\">\n Endpoints appear in the sidebar grouped by their OpenAPI tag. Editing the spec regenerates the pages automatically.\n </Step>\n</Steps>\n\n## Example spec\n\nDo not have a document yet? This `openapi.yaml` points at [JSONPlaceholder](https://jsonplaceholder.typicode.com), a free public test API, so it works end to end - save it, set `openapi` to it, and the generated pages can send real requests:\n\n```yaml\nopenapi: 3.1.0\ninfo:\n title: JSONPlaceholder\n version: 1.0.0\nservers:\n - url: https://jsonplaceholder.typicode.com\ntags:\n - name: Todos\n - name: Posts\npaths:\n /todos/{id}:\n get:\n summary: Get a to-do\n tags: [Todos]\n parameters:\n - name: id\n in: path\n required: true\n schema:\n type: integer\n responses:\n \"200\":\n description: Just a demo of a to-do item\n /posts:\n post:\n summary: Create a post\n tags: [Posts]\n requestBody:\n required: true\n content:\n application/json:\n example:\n title: Hello\n body: Sent from the docs\n userId: 1\n responses:\n \"201\":\n description: Just a demo of the created post\n```\n\nEach part maps to something in the playground: `servers` sets the request target - and the only host the proxy will call - `tags` group endpoints in the sidebar, and `parameters` and `requestBody` become the inputs (adding a `securitySchemes` entry would produce authentication fields). Doccupine reads OpenAPI 3.0 and 3.1; see the [OpenAPI specification](https://spec.openapis.org) for the full format.\n\n## What gets generated\n\nEvery operation becomes its own page under `/api-reference/{tag}/{operation}`, showing:\n\n<Field value=\"Parameters\" type=\"path, query, header, cookie\">\nEach parameter is rendered with its name, type, and whether it is required, grouped into a collapsible section with an input to fill in.\n</Field>\n\n<Field value=\"Request body\" type=\"editable\">\nA JSON editor prefilled from the schema's example, ready to tweak and send.\n</Field>\n\n<Field value=\"Authentication\" type=\"from securitySchemes\">\nInputs for the endpoint's security schemes - API keys, bearer tokens, or basic auth - generated from the document.\n</Field>\n\n<Field value=\"Response\" type=\"live\">\nThe real status, timing, and body from your API, rendered to match its content type.\n</Field>\n\n## Embedding a single endpoint\n\nTo mix prose and a live endpoint on a hand-written page, reference an operation from the page's frontmatter with `openapi`. Use `METHOD /path` or an `operationId`:\n\n```mdx\n---\ntitle: \"Create a post\"\nopenapi: \"POST /posts\"\n---\n\nPosts are created for a user. The playground above is fully live - fill in the\nbody and send a real request.\n```\n\nDoccupine renders that endpoint's playground above your prose. If the reference does not match any operation in your document, the page still renders its prose and a warning is logged.\n\n## Running requests\n\nRequests run one of two ways, and readers can switch between them:\n\n<Callout type=\"note\">\n**Proxy (default).** The request is forwarded server-side, so it works even when the target API blocks cross-origin browser calls. **Direct.** The browser calls the API itself - useful when the API allows CORS and you want requests to never leave the reader's machine.\n</Callout>\n\nThe proxy is deliberately locked down. It only forwards to the servers declared in your OpenAPI document, refuses to reach private or internal network addresses, and never logs request URLs, headers, or bodies - so API keys a reader enters are not written anywhere.\n\n<Callout type=\"warning\">\nKeys and tokens a reader types are used only to make the request. Turn on \"Show secrets\" to reveal them in the generated code snippets; they are redacted by default.\n</Callout>\n\n## Responses and snippets\n\nResponses render to match their type: images and video play inline, everything else is shown as a formatted, syntax-highlighted body. Alongside the response, the playground generates ready-to-run **cURL**, **JavaScript**, and **Python** snippets for the exact request you built.\n\n## Documenting more than one API\n\nPass an array to document several APIs at once. Each spec becomes its own namespaced section:\n\n```json\n{\n \"openapi\": [\n { \"name\": \"public\", \"file\": \"specs/public.yaml\" },\n { \"name\": \"admin\", \"file\": \"specs/admin.yaml\" }\n ]\n}\n```\n";
@@ -4,7 +4,7 @@ description: "Turn an OpenAPI document into an interactive API reference where r
4
4
  date: "2026-07-25"
5
5
  category: "Components"
6
6
  categoryOrder: 1
7
- order: 19
7
+ order: 20
8
8
  ---
9
9
  # API Playground
10
10
 
@@ -1 +1 @@
1
- export declare const badgesMdxTemplate = "---\ntitle: \"Badges\"\ndescription: \"Highlight statuses, version labels, and metadata inline with colored badges.\"\ndate: \"2026-07-27\"\ncategory: \"Components\"\ncategoryOrder: 1\norder: 12\n---\n# Badges\n\nHighlight statuses, version labels, and metadata with small colored badges - inline within text or standing on their own.\n\n## Basic badge\n\nYou can use the Badge component directly within your MDX files without any import:\n\n```html\n<Badge>Badge</Badge>\n```\n\n<Badge>Badge</Badge>\n\n## Colors\n\nThe `color` property selects one of eleven variants to convey different meanings:\n\n```html\n<Badge color=\"gray\">Badge</Badge>\n<Badge color=\"blue\">Badge</Badge>\n<Badge color=\"green\">Badge</Badge>\n<Badge color=\"yellow\">Badge</Badge>\n<Badge color=\"orange\">Badge</Badge>\n<Badge color=\"red\">Badge</Badge>\n<Badge color=\"purple\">Badge</Badge>\n<Badge color=\"white\">Badge</Badge>\n<Badge color=\"surface\">Badge</Badge>\n<Badge color=\"white-destructive\">Badge</Badge>\n<Badge color=\"surface-destructive\">Badge</Badge>\n```\n\n<Badge color=\"gray\">Badge</Badge>\n<Badge color=\"blue\">Badge</Badge>\n<Badge color=\"green\">Badge</Badge>\n<Badge color=\"yellow\">Badge</Badge>\n<Badge color=\"orange\">Badge</Badge>\n<Badge color=\"red\">Badge</Badge>\n<Badge color=\"purple\">Badge</Badge>\n<Badge color=\"white\">Badge</Badge>\n<Badge color=\"surface\">Badge</Badge>\n<Badge color=\"white-destructive\">Badge</Badge>\n<Badge color=\"surface-destructive\">Badge</Badge>\n\n## Sizes\n\nFour sizes match different content hierarchies:\n\n```html\n<Badge size=\"xs\">Badge</Badge>\n<Badge size=\"sm\">Badge</Badge>\n<Badge size=\"md\">Badge</Badge>\n<Badge size=\"lg\">Badge</Badge>\n```\n\n<Badge size=\"xs\">Badge</Badge>\n<Badge size=\"sm\">Badge</Badge>\n<Badge size=\"md\">Badge</Badge>\n<Badge size=\"lg\">Badge</Badge>\n\n## Shapes\n\nChoose between rounded corners and a pill shape:\n\n```html\n<Badge shape=\"rounded\">Badge</Badge>\n<Badge shape=\"pill\">Badge</Badge>\n```\n\n<Badge shape=\"rounded\">Badge</Badge>\n<Badge shape=\"pill\">Badge</Badge>\n\n## Icons\n\nAdd a [Lucide](https://lucide.dev/icons) icon (kebab-case name) for extra context. Unknown names render nothing, so a typo never breaks the page:\n\n```html\n<Badge icon=\"circle-check\" color=\"green\">Passing</Badge>\n<Badge icon=\"clock\" color=\"orange\">Pending</Badge>\n<Badge icon=\"ban\" color=\"red\">Blocked</Badge>\n```\n\n<Badge icon=\"circle-check\" color=\"green\">Passing</Badge>\n<Badge icon=\"clock\" color=\"orange\">Pending</Badge>\n<Badge icon=\"ban\" color=\"red\">Blocked</Badge>\n\n## Stroke variant\n\nSet `stroke` for an outline instead of a filled background:\n\n```html\n<Badge stroke color=\"blue\">Badge</Badge>\n<Badge stroke color=\"green\">Badge</Badge>\n<Badge stroke color=\"orange\">Badge</Badge>\n<Badge stroke color=\"red\">Badge</Badge>\n```\n\n<Badge stroke color=\"blue\">Badge</Badge>\n<Badge stroke color=\"green\">Badge</Badge>\n<Badge stroke color=\"orange\">Badge</Badge>\n<Badge stroke color=\"red\">Badge</Badge>\n\n## Solid variant\n\nSet `solid` for a strong filled background with contrasting text:\n\n```html\n<Badge solid color=\"blue\">Badge</Badge>\n<Badge solid color=\"green\">Badge</Badge>\n<Badge solid color=\"red\">Badge</Badge>\n<Badge solid color=\"purple\">Badge</Badge>\n```\n\n<Badge solid color=\"blue\">Badge</Badge>\n<Badge solid color=\"green\">Badge</Badge>\n<Badge solid color=\"red\">Badge</Badge>\n<Badge solid color=\"purple\">Badge</Badge>\n\n## Semantic colors\n\nThe `info`, `success`, `warning`, and `error` colors come from your theme rather than the fixed palette, so they follow your `theme.json` and the light/dark toggle. They support the same `stroke` and `solid` variations:\n\n```html\n<Badge color=\"info\">Badge</Badge>\n<Badge color=\"success\">Badge</Badge>\n<Badge color=\"warning\">Badge</Badge>\n<Badge color=\"error\">Badge</Badge>\n<Badge solid color=\"info\">Badge</Badge>\n<Badge solid color=\"success\">Badge</Badge>\n```\n\n<Badge color=\"info\">Badge</Badge>\n<Badge color=\"success\">Badge</Badge>\n<Badge color=\"warning\">Badge</Badge>\n<Badge color=\"error\">Badge</Badge>\n<Badge solid color=\"info\">Badge</Badge>\n<Badge solid color=\"success\">Badge</Badge>\n\n## HTTP method badges\n\nSet `mono` for a monospace, uppercase label. Combining `mono`, `solid`, and the semantic colors gives the method chips Doccupine itself uses in the sidebar navigation and the API playground:\n\n```html\n<Badge mono solid color=\"info\" size=\"sm\">GET</Badge>\n<Badge mono solid color=\"success\" size=\"sm\">POST</Badge>\n<Badge mono solid color=\"warning\" size=\"sm\">PUT</Badge>\n<Badge mono solid color=\"error\" size=\"sm\">DELETE</Badge>\n```\n\n<Badge mono solid color=\"info\" size=\"sm\">GET</Badge>\n<Badge mono solid color=\"success\" size=\"sm\">POST</Badge>\n<Badge mono solid color=\"warning\" size=\"sm\">PUT</Badge>\n<Badge mono solid color=\"error\" size=\"sm\">DELETE</Badge>\n\n## Disabled state\n\nSet `disabled` to indicate inactive or unavailable states with reduced opacity:\n\n```html\n<Badge disabled icon=\"lock\" color=\"gray\">Badge</Badge>\n<Badge disabled icon=\"lock\" color=\"blue\">Badge</Badge>\n```\n\n<Badge disabled icon=\"lock\" color=\"gray\">Badge</Badge>\n<Badge disabled icon=\"lock\" color=\"blue\">Badge</Badge>\n\n## Inline usage\n\nBadges flow naturally with the surrounding text. For example, this feature requires a <Badge color=\"orange\" size=\"sm\">Premium</Badge> subscription, and this endpoint returns <Badge color=\"green\" size=\"sm\">JSON</Badge>.\n\n```html\nThis feature requires a <Badge color=\"orange\" size=\"sm\">Premium</Badge> subscription.\n```\n\n## Combined properties\n\nAll properties compose freely:\n\n```html\n<Badge icon=\"star\" color=\"purple\" size=\"lg\" shape=\"pill\">Pro</Badge>\n<Badge icon=\"check\" stroke color=\"green\" size=\"sm\">Verified</Badge>\n<Badge icon=\"flask-conical\" color=\"blue\" shape=\"rounded\">Beta</Badge>\n```\n\n<Badge icon=\"star\" color=\"purple\" size=\"lg\" shape=\"pill\">Pro</Badge>\n<Badge icon=\"check\" stroke color=\"green\" size=\"sm\">Verified</Badge>\n<Badge icon=\"flask-conical\" color=\"blue\" shape=\"rounded\">Beta</Badge>\n\n## Properties\n\n<Field value=\"color\" type=\"string\">\n Badge color variant. Defaults to `gray`. Options: `gray`, `blue`, `green`, `yellow`, `orange`, `red`, `purple`, `white`, `surface`, `white-destructive`, `surface-destructive`, plus the theme-driven `info`, `success`, `warning`, and `error`.\n</Field>\n\n<Field value=\"size\" type=\"string\">\n Badge size. Defaults to `md`. Options: `xs`, `sm`, `md`, `lg`.\n</Field>\n\n<Field value=\"shape\" type=\"string\">\n Badge shape. Defaults to `rounded`. Options: `rounded`, `pill`.\n</Field>\n\n<Field value=\"icon\" type=\"string\">\n A [Lucide](https://lucide.dev/icons) icon name in kebab-case, displayed before the badge text.\n</Field>\n\n<Field value=\"stroke\" type=\"boolean\">\n Display the badge with an outline instead of a filled background. Defaults to `false`.\n</Field>\n\n<Field value=\"solid\" type=\"boolean\">\n Display the badge with a strong filled background and contrasting text. Takes precedence over `stroke`. Defaults to `false`.\n</Field>\n\n<Field value=\"mono\" type=\"boolean\">\n Render the label in monospace uppercase, for code-like labels such as HTTP methods. Defaults to `false`.\n</Field>\n\n<Field value=\"disabled\" type=\"boolean\">\n Display the badge in a disabled state with reduced opacity. Defaults to `false`.\n</Field>\n\n<Field value=\"className\" type=\"string\">\n Additional CSS classes to apply to the badge.\n</Field>\n\n<Field value=\"children\" type=\"node\" required>\n The badge label.\n</Field>";
1
+ export declare const badgesMdxTemplate = "---\ntitle: \"Badges\"\ndescription: \"Highlight statuses, version labels, and metadata inline with colored badges.\"\ndate: \"2026-07-27\"\ncategory: \"Components\"\ncategoryOrder: 1\norder: 12\n---\n# Badges\n\nHighlight statuses, version labels, and metadata with small colored badges - inline within text or standing on their own.\n\n## Basic badge\n\nYou can use the Badge component directly within your MDX files without any import:\n\n```html\n<Badge>Badge</Badge>\n```\n\n<Badge>Badge</Badge>\n\n## Colors\n\nThe `color` property selects one of eleven variants to convey different meanings:\n\n```html\n<Badge color=\"gray\">Badge</Badge>\n<Badge color=\"blue\">Badge</Badge>\n<Badge color=\"green\">Badge</Badge>\n<Badge color=\"yellow\">Badge</Badge>\n<Badge color=\"orange\">Badge</Badge>\n<Badge color=\"red\">Badge</Badge>\n<Badge color=\"purple\">Badge</Badge>\n<Badge color=\"white\">Badge</Badge>\n<Badge color=\"surface\">Badge</Badge>\n<Badge color=\"white-destructive\">Badge</Badge>\n<Badge color=\"surface-destructive\">Badge</Badge>\n```\n\n<Badge color=\"gray\">Badge</Badge>\n<Badge color=\"blue\">Badge</Badge>\n<Badge color=\"green\">Badge</Badge>\n<Badge color=\"yellow\">Badge</Badge>\n<Badge color=\"orange\">Badge</Badge>\n<Badge color=\"red\">Badge</Badge>\n<Badge color=\"purple\">Badge</Badge>\n<Badge color=\"white\">Badge</Badge>\n<Badge color=\"surface\">Badge</Badge>\n<Badge color=\"white-destructive\">Badge</Badge>\n<Badge color=\"surface-destructive\">Badge</Badge>\n\nThe `white` and `white-destructive` badges stay literally white in both light and dark mode, which keeps them legible on top of images, colored frames, and hero areas. Their `surface` counterparts follow the active theme instead - white on light pages, dark on dark ones - so reach for those when the badge sits in regular page content.\n\n## Sizes\n\nFour sizes match different content hierarchies:\n\n```html\n<Badge size=\"xs\">Badge</Badge>\n<Badge size=\"sm\">Badge</Badge>\n<Badge size=\"md\">Badge</Badge>\n<Badge size=\"lg\">Badge</Badge>\n```\n\n<Badge size=\"xs\">Badge</Badge>\n<Badge size=\"sm\">Badge</Badge>\n<Badge size=\"md\">Badge</Badge>\n<Badge size=\"lg\">Badge</Badge>\n\n## Shapes\n\nChoose between rounded corners and a pill shape:\n\n```html\n<Badge shape=\"rounded\">Badge</Badge>\n<Badge shape=\"pill\">Badge</Badge>\n```\n\n<Badge shape=\"rounded\">Badge</Badge>\n<Badge shape=\"pill\">Badge</Badge>\n\n## Icons\n\nAdd a [Lucide](https://lucide.dev/icons) icon (kebab-case name) for extra context. Unknown names render nothing, so a typo never breaks the page:\n\n```html\n<Badge icon=\"circle-check\" color=\"green\">Passing</Badge>\n<Badge icon=\"clock\" color=\"orange\">Pending</Badge>\n<Badge icon=\"ban\" color=\"red\">Blocked</Badge>\n```\n\n<Badge icon=\"circle-check\" color=\"green\">Passing</Badge>\n<Badge icon=\"clock\" color=\"orange\">Pending</Badge>\n<Badge icon=\"ban\" color=\"red\">Blocked</Badge>\n\n## Stroke variant\n\nSet `stroke` for an outline instead of a filled background:\n\n```html\n<Badge stroke color=\"blue\">Badge</Badge>\n<Badge stroke color=\"green\">Badge</Badge>\n<Badge stroke color=\"orange\">Badge</Badge>\n<Badge stroke color=\"red\">Badge</Badge>\n```\n\n<Badge stroke color=\"blue\">Badge</Badge>\n<Badge stroke color=\"green\">Badge</Badge>\n<Badge stroke color=\"orange\">Badge</Badge>\n<Badge stroke color=\"red\">Badge</Badge>\n\n## Solid variant\n\nSet `solid` for a strong filled background with contrasting text:\n\n```html\n<Badge solid color=\"blue\">Badge</Badge>\n<Badge solid color=\"green\">Badge</Badge>\n<Badge solid color=\"red\">Badge</Badge>\n<Badge solid color=\"purple\">Badge</Badge>\n```\n\n<Badge solid color=\"blue\">Badge</Badge>\n<Badge solid color=\"green\">Badge</Badge>\n<Badge solid color=\"red\">Badge</Badge>\n<Badge solid color=\"purple\">Badge</Badge>\n\n## Semantic colors\n\nThe `info`, `success`, `warning`, and `error` colors come from your theme rather than the fixed palette, so they follow your `theme.json` and the light/dark toggle. They support the same `stroke` and `solid` variations:\n\n```html\n<Badge color=\"info\">Badge</Badge>\n<Badge color=\"success\">Badge</Badge>\n<Badge color=\"warning\">Badge</Badge>\n<Badge color=\"error\">Badge</Badge>\n<Badge solid color=\"info\">Badge</Badge>\n<Badge solid color=\"success\">Badge</Badge>\n```\n\n<Badge color=\"info\">Badge</Badge>\n<Badge color=\"success\">Badge</Badge>\n<Badge color=\"warning\">Badge</Badge>\n<Badge color=\"error\">Badge</Badge>\n<Badge solid color=\"info\">Badge</Badge>\n<Badge solid color=\"success\">Badge</Badge>\n\n## HTTP method badges\n\nSet `mono` for a monospace, uppercase label. Combining `mono`, `solid`, and the semantic colors gives the method chips Doccupine itself uses in the sidebar navigation and the API playground:\n\n```html\n<Badge mono solid color=\"info\" size=\"sm\">GET</Badge>\n<Badge mono solid color=\"success\" size=\"sm\">POST</Badge>\n<Badge mono solid color=\"warning\" size=\"sm\">PUT</Badge>\n<Badge mono solid color=\"error\" size=\"sm\">DELETE</Badge>\n```\n\n<Badge mono solid color=\"info\" size=\"sm\">GET</Badge>\n<Badge mono solid color=\"success\" size=\"sm\">POST</Badge>\n<Badge mono solid color=\"warning\" size=\"sm\">PUT</Badge>\n<Badge mono solid color=\"error\" size=\"sm\">DELETE</Badge>\n\n## Disabled state\n\nSet `disabled` to indicate inactive or unavailable states with reduced opacity:\n\n```html\n<Badge disabled icon=\"lock\" color=\"gray\">Badge</Badge>\n<Badge disabled icon=\"lock\" color=\"blue\">Badge</Badge>\n```\n\n<Badge disabled icon=\"lock\" color=\"gray\">Badge</Badge>\n<Badge disabled icon=\"lock\" color=\"blue\">Badge</Badge>\n\n## Inline usage\n\nBadges flow naturally with the surrounding text. For example, this feature requires a <Badge color=\"orange\" size=\"sm\">Premium</Badge> subscription, and this endpoint returns <Badge color=\"green\" size=\"sm\">JSON</Badge>.\n\n```html\nThis feature requires a <Badge color=\"orange\" size=\"sm\">Premium</Badge> subscription.\n```\n\n## Combined properties\n\nAll properties compose freely:\n\n```html\n<Badge icon=\"star\" color=\"purple\" size=\"lg\" shape=\"pill\">Pro</Badge>\n<Badge icon=\"check\" stroke color=\"green\" size=\"sm\">Verified</Badge>\n<Badge icon=\"flask-conical\" color=\"blue\" shape=\"rounded\">Beta</Badge>\n```\n\n<Badge icon=\"star\" color=\"purple\" size=\"lg\" shape=\"pill\">Pro</Badge>\n<Badge icon=\"check\" stroke color=\"green\" size=\"sm\">Verified</Badge>\n<Badge icon=\"flask-conical\" color=\"blue\" shape=\"rounded\">Beta</Badge>\n\n## Properties\n\n<Field value=\"color\" type=\"string\">\n Badge color variant. Defaults to `gray`. Options: `gray`, `blue`, `green`, `yellow`, `orange`, `red`, `purple`, `white`, `surface`, `white-destructive`, `surface-destructive`, plus the theme-driven `info`, `success`, `warning`, and `error`.\n</Field>\n\n<Field value=\"size\" type=\"string\">\n Badge size. Defaults to `md`. Options: `xs`, `sm`, `md`, `lg`.\n</Field>\n\n<Field value=\"shape\" type=\"string\">\n Badge shape. Defaults to `rounded`. Options: `rounded`, `pill`.\n</Field>\n\n<Field value=\"icon\" type=\"string\">\n A [Lucide](https://lucide.dev/icons) icon name in kebab-case, displayed before the badge text.\n</Field>\n\n<Field value=\"stroke\" type=\"boolean\">\n Display the badge with an outline instead of a filled background. Defaults to `false`.\n</Field>\n\n<Field value=\"solid\" type=\"boolean\">\n Display the badge with a strong filled background and contrasting text. Takes precedence over `stroke`. Defaults to `false`.\n</Field>\n\n<Field value=\"mono\" type=\"boolean\">\n Render the label in monospace uppercase, for code-like labels such as HTTP methods. Defaults to `false`.\n</Field>\n\n<Field value=\"disabled\" type=\"boolean\">\n Display the badge in a disabled state with reduced opacity. Defaults to `false`.\n</Field>\n\n<Field value=\"className\" type=\"string\">\n Additional CSS classes to apply to the badge.\n</Field>\n\n<Field value=\"children\" type=\"node\" required>\n The badge label.\n</Field>";
@@ -50,6 +50,8 @@ The \`color\` property selects one of eleven variants to convey different meanin
50
50
  <Badge color="white-destructive">Badge</Badge>
51
51
  <Badge color="surface-destructive">Badge</Badge>
52
52
 
53
+ The \`white\` and \`white-destructive\` badges stay literally white in both light and dark mode, which keeps them legible on top of images, colored frames, and hero areas. Their \`surface\` counterparts follow the active theme instead - white on light pages, dark on dark ones - so reach for those when the badge sits in regular page content.
54
+
53
55
  ## Sizes
54
56
 
55
57
  Four sizes match different content hierarchies:
@@ -1 +1 @@
1
- export declare const colorSwatchesMdxTemplate = "---\ntitle: \"Color Swatches\"\ndescription: \"Display color palettes with labeled swatches to document your theme colors.\"\ndate: \"2026-02-19\"\ncategory: \"Components\"\ncategoryOrder: 1\norder: 21\n---\n# Color Swatches\n\nDisplay color palettes with labeled swatches to document your theme colors.\n\nThe `ColorSwatch` component renders a visual preview of a color alongside its token name, and `ColorSwatchGroup` arranges multiple swatches in a responsive grid.\n\n## Usage\n\nYou can use the ColorSwatch components directly within your MDX files without any import:\n\n```html\n<ColorSwatchGroup>\n <ColorSwatch token=\"primary\" value=\"#6366F1\" />\n <ColorSwatch token=\"secondary\" value=\"#EC4899\" />\n <ColorSwatch token=\"success\" value=\"#10B981\" />\n <ColorSwatch token=\"warning\" value=\"#F59E0B\" />\n <ColorSwatch token=\"danger\" value=\"#EF4444\" />\n <ColorSwatch token=\"info\" value=\"#3B82F6\" />\n</ColorSwatchGroup>\n```\n\n<ColorSwatchGroup>\n <ColorSwatch token=\"primary\" value=\"#6366F1\" />\n <ColorSwatch token=\"secondary\" value=\"#EC4899\" />\n <ColorSwatch token=\"success\" value=\"#10B981\" />\n <ColorSwatch token=\"warning\" value=\"#F59E0B\" />\n <ColorSwatch token=\"danger\" value=\"#EF4444\" />\n <ColorSwatch token=\"info\" value=\"#3B82F6\" />\n</ColorSwatchGroup>\n\n## Dark Colors\n\nText color automatically adapts based on the background luminance, so dark swatches display white text:\n\n```html\n<ColorSwatchGroup>\n <ColorSwatch token=\"dark\" value=\"#1E1E2E\" />\n <ColorSwatch token=\"grayDark\" value=\"#374151\" />\n <ColorSwatch token=\"gray\" value=\"#6B7280\" />\n <ColorSwatch token=\"grayLight\" value=\"#D1D5DB\" />\n <ColorSwatch token=\"light\" value=\"#F9FAFB\" />\n <ColorSwatch token=\"white\" value=\"#FFFFFF\" />\n</ColorSwatchGroup>\n```\n\n<ColorSwatchGroup>\n <ColorSwatch token=\"dark\" value=\"#1E1E2E\" />\n <ColorSwatch token=\"grayDark\" value=\"#374151\" />\n <ColorSwatch token=\"gray\" value=\"#6B7280\" />\n <ColorSwatch token=\"grayLight\" value=\"#D1D5DB\" />\n <ColorSwatch token=\"light\" value=\"#F9FAFB\" />\n <ColorSwatch token=\"white\" value=\"#FFFFFF\" />\n</ColorSwatchGroup>\n\n## ColorSwatch Properties\n\n<Field value=\"token\" type=\"string\" required>\n The name or label displayed below the color preview (e.g. a design token name).\n</Field>\n\n<Field value=\"value\" type=\"string\" required>\n A hex color value (e.g. `#6366F1`). Displayed inside the color preview and used as the background.\n</Field>\n\n## ColorSwatchGroup Properties\n\n<Field value=\"children\" type=\"node\" required>\n One or more `ColorSwatch` components to display in a responsive grid.\n</Field>";
1
+ export declare const colorSwatchesMdxTemplate = "---\ntitle: \"Color Swatches\"\ndescription: \"Display color palettes with labeled swatches to document your theme colors.\"\ndate: \"2026-02-19\"\ncategory: \"Components\"\ncategoryOrder: 1\norder: 22\n---\n# Color Swatches\n\nDisplay color palettes with labeled swatches to document your theme colors.\n\nThe `ColorSwatch` component renders a visual preview of a color alongside its token name, and `ColorSwatchGroup` arranges multiple swatches in a responsive grid.\n\n## Usage\n\nYou can use the ColorSwatch components directly within your MDX files without any import:\n\n```html\n<ColorSwatchGroup>\n <ColorSwatch token=\"primary\" value=\"#6366F1\" />\n <ColorSwatch token=\"secondary\" value=\"#EC4899\" />\n <ColorSwatch token=\"success\" value=\"#10B981\" />\n <ColorSwatch token=\"warning\" value=\"#F59E0B\" />\n <ColorSwatch token=\"danger\" value=\"#EF4444\" />\n <ColorSwatch token=\"info\" value=\"#3B82F6\" />\n</ColorSwatchGroup>\n```\n\n<ColorSwatchGroup>\n <ColorSwatch token=\"primary\" value=\"#6366F1\" />\n <ColorSwatch token=\"secondary\" value=\"#EC4899\" />\n <ColorSwatch token=\"success\" value=\"#10B981\" />\n <ColorSwatch token=\"warning\" value=\"#F59E0B\" />\n <ColorSwatch token=\"danger\" value=\"#EF4444\" />\n <ColorSwatch token=\"info\" value=\"#3B82F6\" />\n</ColorSwatchGroup>\n\n## Dark Colors\n\nText color automatically adapts based on the background luminance, so dark swatches display white text:\n\n```html\n<ColorSwatchGroup>\n <ColorSwatch token=\"dark\" value=\"#1E1E2E\" />\n <ColorSwatch token=\"grayDark\" value=\"#374151\" />\n <ColorSwatch token=\"gray\" value=\"#6B7280\" />\n <ColorSwatch token=\"grayLight\" value=\"#D1D5DB\" />\n <ColorSwatch token=\"light\" value=\"#F9FAFB\" />\n <ColorSwatch token=\"white\" value=\"#FFFFFF\" />\n</ColorSwatchGroup>\n```\n\n<ColorSwatchGroup>\n <ColorSwatch token=\"dark\" value=\"#1E1E2E\" />\n <ColorSwatch token=\"grayDark\" value=\"#374151\" />\n <ColorSwatch token=\"gray\" value=\"#6B7280\" />\n <ColorSwatch token=\"grayLight\" value=\"#D1D5DB\" />\n <ColorSwatch token=\"light\" value=\"#F9FAFB\" />\n <ColorSwatch token=\"white\" value=\"#FFFFFF\" />\n</ColorSwatchGroup>\n\n## ColorSwatch Properties\n\n<Field value=\"token\" type=\"string\" required>\n The name or label displayed below the color preview (e.g. a design token name).\n</Field>\n\n<Field value=\"value\" type=\"string\" required>\n A hex color value (e.g. `#6366F1`). Displayed inside the color preview and used as the background.\n</Field>\n\n## ColorSwatchGroup Properties\n\n<Field value=\"children\" type=\"node\" required>\n One or more `ColorSwatch` components to display in a responsive grid.\n</Field>";
@@ -4,7 +4,7 @@ description: "Display color palettes with labeled swatches to document your them
4
4
  date: "2026-02-19"
5
5
  category: "Components"
6
6
  categoryOrder: 1
7
- order: 21
7
+ order: 22
8
8
  ---
9
9
  # Color Swatches
10
10