doccupine 0.0.140 → 0.0.142
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.
- package/README.md +14 -7
- package/dist/cli.d.ts +1 -0
- package/dist/cli.js +191 -0
- package/dist/index.d.ts +3 -7
- package/dist/index.js +5 -1894
- package/dist/lib/config-manager.d.ts +1 -0
- package/dist/lib/config-manager.js +63 -3
- package/dist/lib/generated-artifacts.d.ts +26 -0
- package/dist/lib/generated-artifacts.js +147 -0
- package/dist/lib/layout.js +30 -30
- package/dist/lib/metadata.js +58 -30
- package/dist/lib/openapi-types.d.ts +2 -2
- package/dist/lib/openapi.d.ts +6 -3
- package/dist/lib/openapi.js +330 -50
- package/dist/lib/output-safety.d.ts +15 -0
- package/dist/lib/output-safety.js +428 -0
- package/dist/lib/structures.js +11 -0
- package/dist/lib/utils.d.ts +10 -5
- package/dist/lib/utils.js +108 -5
- package/dist/mdx-to-nextjs-generator.d.ts +166 -0
- package/dist/mdx-to-nextjs-generator.js +2229 -0
- package/dist/templates/app/api/gate/route.d.ts +1 -1
- package/dist/templates/app/api/gate/route.js +18 -6
- package/dist/templates/app/api/mcp/route.d.ts +1 -1
- package/dist/templates/app/api/mcp/route.js +181 -111
- package/dist/templates/app/api/playground/route.d.ts +1 -1
- package/dist/templates/app/api/playground/route.js +45 -13
- package/dist/templates/app/api/rag/route.d.ts +1 -1
- package/dist/templates/app/api/rag/route.js +72 -20
- package/dist/templates/app/api/search/route.d.ts +1 -1
- package/dist/templates/app/api/search/route.js +5 -0
- package/dist/templates/app/robots.d.ts +1 -1
- package/dist/templates/app/robots.js +1 -26
- package/dist/templates/app/theme.d.ts +1 -1
- package/dist/templates/app/theme.js +31 -19
- package/dist/templates/components/Chat.d.ts +1 -1
- package/dist/templates/components/Chat.js +342 -34
- package/dist/templates/components/SearchDocs.d.ts +1 -1
- package/dist/templates/components/SearchDocs.js +63 -11
- package/dist/templates/components/SearchModalContent.d.ts +1 -1
- package/dist/templates/components/SearchModalContent.js +191 -49
- package/dist/templates/components/SideBar.d.ts +1 -1
- package/dist/templates/components/SideBar.js +8 -2
- package/dist/templates/components/layout/Accordion.d.ts +1 -1
- package/dist/templates/components/layout/Accordion.js +26 -3
- package/dist/templates/components/layout/Badge.d.ts +1 -1
- package/dist/templates/components/layout/Badge.js +1 -1
- package/dist/templates/components/layout/Button.d.ts +1 -1
- package/dist/templates/components/layout/Button.js +4 -4
- package/dist/templates/components/layout/Callout.d.ts +1 -1
- package/dist/templates/components/layout/Callout.js +6 -6
- package/dist/templates/components/layout/Card.d.ts +1 -1
- package/dist/templates/components/layout/Card.js +9 -4
- package/dist/templates/components/layout/CherryThemeProvider.d.ts +1 -1
- package/dist/templates/components/layout/CherryThemeProvider.js +63 -12
- package/dist/templates/components/layout/Code.d.ts +1 -1
- package/dist/templates/components/layout/Code.js +5 -5
- package/dist/templates/components/layout/CopyButton.d.ts +1 -1
- package/dist/templates/components/layout/CopyButton.js +1 -1
- package/dist/templates/components/layout/DemoTheme.d.ts +1 -1
- package/dist/templates/components/layout/DemoTheme.js +8 -28
- package/dist/templates/components/layout/DocsComponents.d.ts +1 -1
- package/dist/templates/components/layout/DocsComponents.js +57 -6
- package/dist/templates/components/layout/GlobalStyles.d.ts +1 -1
- package/dist/templates/components/layout/GlobalStyles.js +15 -9
- package/dist/templates/components/layout/Prompt.d.ts +1 -1
- package/dist/templates/components/layout/Prompt.js +4 -7
- package/dist/templates/components/layout/Steps.d.ts +1 -1
- package/dist/templates/components/layout/Steps.js +7 -1
- package/dist/templates/components/layout/Tabs.d.ts +1 -1
- package/dist/templates/components/layout/Tabs.js +108 -19
- package/dist/templates/env.example.d.ts +1 -1
- package/dist/templates/env.example.js +11 -0
- package/dist/templates/eslint.config.d.ts +1 -1
- package/dist/templates/eslint.config.js +20 -0
- package/dist/templates/gitignore.d.ts +1 -1
- package/dist/templates/gitignore.js +4 -3
- package/dist/templates/lib/access.d.ts +1 -0
- package/dist/templates/lib/access.js +41 -0
- package/dist/templates/mdx/ai-assistant.mdx.d.ts +1 -1
- package/dist/templates/mdx/ai-assistant.mdx.js +17 -1
- package/dist/templates/mdx/api-playground.mdx.d.ts +1 -1
- package/dist/templates/mdx/api-playground.mdx.js +5 -3
- package/dist/templates/mdx/authentication.mdx.d.ts +1 -1
- package/dist/templates/mdx/authentication.mdx.js +5 -3
- package/dist/templates/mdx/commands.mdx.d.ts +1 -1
- package/dist/templates/mdx/commands.mdx.js +20 -6
- package/dist/templates/mdx/components.mdx.d.ts +1 -1
- package/dist/templates/mdx/components.mdx.js +3 -0
- package/dist/templates/mdx/deployment-and-hosting.mdx.d.ts +1 -1
- package/dist/templates/mdx/deployment-and-hosting.mdx.js +2 -2
- package/dist/templates/mdx/globals.mdx.d.ts +1 -1
- package/dist/templates/mdx/globals.mdx.js +14 -11
- package/dist/templates/mdx/model-context-protocol.mdx.d.ts +1 -1
- package/dist/templates/mdx/model-context-protocol.mdx.js +22 -35
- package/dist/templates/mdx/platform/ai-assistant.mdx.d.ts +1 -1
- package/dist/templates/mdx/platform/ai-assistant.mdx.js +23 -0
- package/dist/templates/mdx/platform/api-playground.mdx.d.ts +1 -1
- package/dist/templates/mdx/platform/api-playground.mdx.js +7 -0
- package/dist/templates/mdx/platform/authentication.mdx.d.ts +1 -0
- package/dist/templates/mdx/platform/authentication.mdx.js +63 -0
- package/dist/templates/mdx/platform/import-from-github.mdx.d.ts +1 -1
- package/dist/templates/mdx/platform/import-from-github.mdx.js +2 -2
- package/dist/templates/mdx/platform/index.mdx.d.ts +1 -1
- package/dist/templates/mdx/platform/index.mdx.js +1 -0
- package/dist/templates/mdx/platform/mcp.mdx.d.ts +1 -1
- package/dist/templates/mdx/platform/mcp.mdx.js +2 -1
- package/dist/templates/mdx/platform/navigation-settings.mdx.d.ts +1 -1
- package/dist/templates/mdx/platform/navigation-settings.mdx.js +12 -1
- package/dist/templates/mdx/platform/publishing.mdx.d.ts +1 -1
- package/dist/templates/mdx/platform/publishing.mdx.js +43 -10
- package/dist/templates/mdx/platform/self-updating-docs.mdx.d.ts +1 -1
- package/dist/templates/mdx/platform/self-updating-docs.mdx.js +48 -9
- package/dist/templates/mdx/sections.mdx.d.ts +1 -1
- package/dist/templates/mdx/sections.mdx.js +4 -0
- package/dist/templates/mdx/space.mdx.d.ts +1 -0
- package/dist/templates/mdx/space.mdx.js +125 -0
- package/dist/templates/mdx/tabs.mdx.d.ts +1 -1
- package/dist/templates/mdx/tabs.mdx.js +4 -0
- package/dist/templates/next.config.js +20 -8
- package/dist/templates/package.js +3 -3
- package/dist/templates/prettierignore.d.ts +1 -1
- package/dist/templates/prettierignore.js +1 -0
- package/dist/templates/proxy.js +47 -19
- package/dist/templates/scripts/build-docs-index.d.ts +1 -1
- package/dist/templates/scripts/build-docs-index.js +1 -0
- package/dist/templates/services/mcp/docsContentStub.d.ts +1 -0
- package/dist/templates/services/mcp/docsContentStub.js +1 -0
- package/dist/templates/services/mcp/server.d.ts +1 -1
- package/dist/templates/services/mcp/server.js +140 -83
- package/dist/templates/services/mcp/tools.d.ts +1 -1
- package/dist/templates/services/mcp/tools.js +65 -137
- package/dist/templates/utils/playgroundAllowlist.d.ts +1 -1
- package/dist/templates/utils/playgroundAllowlist.js +13 -4
- package/dist/templates/utils/rateLimit.d.ts +1 -1
- package/dist/templates/utils/rateLimit.js +40 -3
- package/dist/templates/utils/requestBody.d.ts +1 -0
- package/dist/templates/utils/requestBody.js +56 -0
- package/dist/templates/utils/ssrfGuard.d.ts +1 -1
- package/dist/templates/utils/ssrfGuard.js +138 -33
- package/package.json +13 -5
- package/dist/lib/mdxToMarkdown.d.ts +0 -1
- package/dist/lib/mdxToMarkdown.js +0 -134
- package/dist/templates/mdx/image-and-embeds.mdx.d.ts +0 -1
- package/dist/templates/mdx/image-and-embeds.mdx.js +0 -118
|
@@ -1 +1 @@
|
|
|
1
|
-
export declare const demoThemeTemplate = "\"use client\";\nimport { useContext } from \"react\";\nimport { useTheme } from \"styled-components\";\nimport { ThemeContext } from \"cherry-styled-components\";\nimport {
|
|
1
|
+
export declare const demoThemeTemplate = "\"use client\";\nimport { useContext } from \"react\";\nimport { useTheme } from \"styled-components\";\nimport { ThemeContext } from \"cherry-styled-components\";\nimport { theme, themeDark, Theme } from \"@/app/theme\";\nimport { Button } from \"@/components/layout/Button\";\nimport { Columns } from \"@/components/layout/Columns\";\n\ninterface DemoThemeProps {\n variant: \"purple\" | \"green\" | \"yellow\";\n}\n\ntype Palette = Record<string, string>;\n\n// Each preset is light + dark color overrides, mirroring what a user editing\n// theme.json would see. Applying one does two things: writes the overrides as\n// --color-* custom properties on <html>, which is where every painted color\n// resolves from, and switches the mode through Cherry's setTheme so the choice\n// persists and the \"dark\" class follows. Reset removes the properties so the\n// values from theme.json (or the defaults) take over again.\nconst PRESETS: Record<\n DemoThemeProps[\"variant\"],\n { light: Palette; dark: Palette; label: string }\n> = {\n purple: {\n label: \"Purple\",\n light: {\n primaryLight: \"#c4b5fd\",\n primary: \"#8b5cf6\",\n primaryDark: \"#5b21b6\",\n },\n dark: {\n primaryLight: \"#ddd6fe\",\n primary: \"#a78bfa\",\n primaryDark: \"#7c3aed\",\n },\n },\n green: {\n label: \"Green\",\n light: {\n primaryLight: \"#86efac\",\n primary: \"#22c55e\",\n primaryDark: \"#15803d\",\n },\n dark: {\n primaryLight: \"#6ee7b7\",\n primary: \"#10b981\",\n primaryDark: \"#065f46\",\n },\n },\n yellow: {\n label: \"Yellow\",\n light: {\n primaryLight: \"#fbbf24\",\n primary: \"#f59e0b\",\n primaryDark: \"#d97706\",\n },\n dark: {\n primaryLight: \"#fed7aa\",\n primary: \"#fb923c\",\n primaryDark: \"#ea580c\",\n },\n },\n};\n\nconst PRESET_KEYS = [\"primaryLight\", \"primary\", \"primaryDark\"] as const;\n\nfunction applyPresetVars(palette: Palette) {\n const root = document.documentElement;\n for (const key of PRESET_KEYS) {\n if (palette[key]) root.style.setProperty(`--color-${key}`, palette[key]);\n }\n}\n\nfunction clearPresetVars() {\n const root = document.documentElement;\n for (const key of PRESET_KEYS) {\n root.style.removeProperty(`--color-${key}`);\n }\n}\n\nfunction DemoTheme({ variant }: DemoThemeProps) {\n const { setTheme } = useContext(ThemeContext);\n const activeTheme = useTheme() as Theme;\n const preset = PRESETS[variant];\n\n if (!preset) {\n return (\n <Columns cols={2}>\n <Button\n onClick={() => {\n clearPresetVars();\n setTheme(activeTheme.isDark ? themeDark : theme);\n }}\n fullWidth\n >\n Reset to Default\n </Button>\n </Columns>\n );\n }\n\n return (\n <Columns cols={2}>\n <Button\n onClick={() => {\n applyPresetVars(preset.light);\n setTheme(theme);\n }}\n icon=\"sun\"\n fullWidth\n >\n Demo {preset.label} Light\n </Button>\n <Button\n outline\n onClick={() => {\n applyPresetVars(preset.dark);\n setTheme(themeDark);\n }}\n icon=\"moon-star\"\n fullWidth\n >\n Demo {preset.label} Dark\n </Button>\n </Columns>\n );\n}\n\nexport { DemoTheme };\n";
|
|
@@ -2,14 +2,7 @@ export const demoThemeTemplate = `"use client";
|
|
|
2
2
|
import { useContext } from "react";
|
|
3
3
|
import { useTheme } from "styled-components";
|
|
4
4
|
import { ThemeContext } from "cherry-styled-components";
|
|
5
|
-
import {
|
|
6
|
-
buildColors,
|
|
7
|
-
colorsLight,
|
|
8
|
-
colorsDark,
|
|
9
|
-
theme,
|
|
10
|
-
themeDark,
|
|
11
|
-
Theme,
|
|
12
|
-
} from "@/app/theme";
|
|
5
|
+
import { theme, themeDark, Theme } from "@/app/theme";
|
|
13
6
|
import { Button } from "@/components/layout/Button";
|
|
14
7
|
import { Columns } from "@/components/layout/Columns";
|
|
15
8
|
|
|
@@ -20,12 +13,11 @@ interface DemoThemeProps {
|
|
|
20
13
|
type Palette = Record<string, string>;
|
|
21
14
|
|
|
22
15
|
// Each preset is light + dark color overrides, mirroring what a user editing
|
|
23
|
-
// theme.json would see. Applying one does two things:
|
|
24
|
-
//
|
|
25
|
-
//
|
|
26
|
-
//
|
|
27
|
-
//
|
|
28
|
-
// defaults take over again.
|
|
16
|
+
// theme.json would see. Applying one does two things: writes the overrides as
|
|
17
|
+
// --color-* custom properties on <html>, which is where every painted color
|
|
18
|
+
// resolves from, and switches the mode through Cherry's setTheme so the choice
|
|
19
|
+
// persists and the "dark" class follows. Reset removes the properties so the
|
|
20
|
+
// values from theme.json (or the defaults) take over again.
|
|
29
21
|
const PRESETS: Record<
|
|
30
22
|
DemoThemeProps["variant"],
|
|
31
23
|
{ light: Palette; dark: Palette; label: string }
|
|
@@ -87,18 +79,6 @@ function clearPresetVars() {
|
|
|
87
79
|
}
|
|
88
80
|
}
|
|
89
81
|
|
|
90
|
-
// Rebuilds a mode's theme with the preset palette merged in, so the semantic
|
|
91
|
-
// tokens (accent, accentStrong, …) derive from the preset colors exactly like
|
|
92
|
-
// they would from a theme.json override.
|
|
93
|
-
function presetTheme(palette: Palette, dark: boolean): Theme {
|
|
94
|
-
const base = dark ? themeDark : theme;
|
|
95
|
-
const paletteBase = dark ? colorsDark : colorsLight;
|
|
96
|
-
return {
|
|
97
|
-
...base,
|
|
98
|
-
colors: buildColors({ ...paletteBase, ...palette }, dark),
|
|
99
|
-
};
|
|
100
|
-
}
|
|
101
|
-
|
|
102
82
|
function DemoTheme({ variant }: DemoThemeProps) {
|
|
103
83
|
const { setTheme } = useContext(ThemeContext);
|
|
104
84
|
const activeTheme = useTheme() as Theme;
|
|
@@ -125,7 +105,7 @@ function DemoTheme({ variant }: DemoThemeProps) {
|
|
|
125
105
|
<Button
|
|
126
106
|
onClick={() => {
|
|
127
107
|
applyPresetVars(preset.light);
|
|
128
|
-
setTheme(
|
|
108
|
+
setTheme(theme);
|
|
129
109
|
}}
|
|
130
110
|
icon="sun"
|
|
131
111
|
fullWidth
|
|
@@ -136,7 +116,7 @@ function DemoTheme({ variant }: DemoThemeProps) {
|
|
|
136
116
|
outline
|
|
137
117
|
onClick={() => {
|
|
138
118
|
applyPresetVars(preset.dark);
|
|
139
|
-
setTheme(
|
|
119
|
+
setTheme(themeDark);
|
|
140
120
|
}}
|
|
141
121
|
icon="moon-star"
|
|
142
122
|
fullWidth
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export declare const docsComponentsTemplate = "\"use client\";\nimport React, { createContext, useContext } from \"react\";\nimport styled, { css } from \"styled-components\";\nimport {\n resetButton,\n styledSmall,\n styledStrong,\n styledText,\n} from \"cherry-styled-components\";\nimport Link from \"next/link\";\nimport { mq, Theme } from \"@/app/theme\";\nimport {\n focusModeColumn,\n focusModeHide,\n sidePanelOffset,\n styledAnchor,\n styledTable,\n stylesLists,\n} from \"@/components/layout/SharedStyled\";\nimport { Badge } from \"@/components/layout/Badge\";\nimport { ChatContext } from \"@/components/Chat\";\n\nconst SectionBarContext = createContext(false);\n\nfunction SectionBarProvider({\n hasSectionBar,\n children,\n}: {\n hasSectionBar: boolean;\n children: React.ReactNode;\n}) {\n return (\n <SectionBarContext.Provider value={hasSectionBar}>\n {children}\n </SectionBarContext.Provider>\n );\n}\n\ninterface DocsProps {\n children: React.ReactNode;\n}\n\nconst StyledDocsWrapper = styled.div<{ theme: Theme }>`\n position: relative;\n`;\n\nconst StyledDocsSidebar = styled.div<{ theme: Theme }>`\n clear: both;\n`;\n\n// The <main> landmark wraps only the article content: the sidebar, footer,\n// and nav render outside it so content extractors and assistive tech start at\n// the article.\nconst StyledDocsContainer = styled.main<{\n theme: Theme;\n $isChatOpen?: boolean;\n}>`\n position: relative;\n padding: 0 20px 100px 20px;\n width: 100%;\n ${({ theme }) => styledText(theme)};\n transition: all 0.3s ease;\n\n ${mq(\"lg\")} {\n padding: 0 300px 80px 300px;\n\n ${({ $isChatOpen }) =>\n $isChatOpen &&\n css`\n padding: 0 440px 80px 300px;\n `}\n }\n\n ${sidePanelOffset};\n ${({ $isChatOpen }) => !$isChatOpen && focusModeColumn};\n\n & p {\n color: ${({ theme }) => theme.colors.grayDark};\n hyphens: auto;\n }\n\n & pre {\n max-width: 100%;\n }\n\n ${styledAnchor};\n ${stylesLists};\n ${styledTable};\n\n & img,\n & video,\n & iframe {\n max-width: 100%;\n border-radius: ${({ theme }) => theme.spacing.radius.lg};\n }\n\n & code:not([class]),\n & kbd {\n background: ${({ theme }) =>\n `color-mix(in srgb, ${theme.colors.primaryLight} 20%, transparent)`};\n color: ${({ theme }) => theme.colors.dark};\n padding: 2px 4px;\n border-radius: ${({ theme }) => theme.spacing.radius.xs};\n overflow-wrap: anywhere;\n }\n\n & .lucide {\n color: ${({ theme }) => theme.colors.primary};\n }\n\n & .aspect-video {\n aspect-ratio: 16 / 9;\n border-radius: ${({ theme }) => theme.spacing.radius.lg};\n }\n`;\n\nexport const StyledMarkdownContainer = styled.div`\n display: flex;\n flex-direction: column;\n gap: 20px;\n flex: 1;\n max-width: 640px;\n margin: auto;\n`;\n\ninterface Props {\n theme?: Theme;\n $isActive?: boolean;\n $isOpen?: boolean;\n $hasSectionBar?: boolean;\n}\n\nexport const StyledSidebar = styled.nav<Props>`\n position: fixed;\n overflow-y: auto;\n max-height: calc(\n 100dvh - ${({ $hasSectionBar }) => ($hasSectionBar ? 104 : 62)}px\n );\n width: 100%;\n z-index: 99;\n top: ${({ $hasSectionBar }) => ($hasSectionBar ? 104 : 62)}px;\n height: 100%;\n padding: 20px;\n opacity: 0;\n pointer-events: none;\n transition: all 0.3s ease;\n transform: translateY(30px);\n left: 0;\n background: ${({ theme }) => theme.colors.light};\n -webkit-overflow-scrolling: touch;\n display: flex;\n flex-direction: column;\n\n &::-webkit-scrollbar {\n display: none;\n }\n\n ${mq(\"lg\")} {\n border-right: solid 1px ${({ theme }) => theme.colors.grayLight};\n transition: none;\n max-height: 100dvh;\n width: 220px;\n background: transparent;\n padding: 82px 20px 20px 20px;\n opacity: 1;\n pointer-events: all;\n transform: translateY(0);\n background: ${({ theme }) =>\n `color-mix(in srgb, ${theme.colors.primaryLight} 5%, transparent)`};\n top: 0;\n width: 280px;\n }\n\n ${({ $isActive }) =>\n $isActive &&\n css`\n transform: translateY(0);\n opacity: 1;\n pointer-events: all;\n `}\n\n ${focusModeHide(\"left\")};\n`;\n\nexport const StyledSidebarFooter = styled.div`\n padding: 22px 20px;\n position: sticky;\n border-top: 1px solid ${({ theme }) => theme.colors.grayLight};\n background: ${({ theme }) =>\n `color-mix(in srgb, ${theme.colors.primaryLight} 5%, transparent)`};\n margin: 0 -20px -20px;\n bottom: -20px;\n backdrop-filter: blur(10px);\n\n ${mq(\"lg\")} {\n padding: 16px 20px;\n }\n`;\n\nexport const StyledIndexSidebar = styled.ul<{ theme: Theme }>`\n display: none;\n list-style: none;\n margin: 0;\n padding: 0;\n position: fixed;\n top: 0;\n right: 0;\n width: 280px;\n height: 100dvh;\n overflow-y: auto;\n z-index: 1;\n padding: 82px 20px 20px 20px;\n background: ${({ theme }) => theme.colors.light};\n border-left: solid 1px ${({ theme }) => theme.colors.grayLight};\n -webkit-overflow-scrolling: touch;\n\n &::-webkit-scrollbar {\n display: none;\n }\n\n ${mq(\"lg\")} {\n display: block;\n }\n\n & li {\n padding: 5px 0;\n }\n\n ${focusModeHide(\"right\")};\n`;\n\nexport const StyledIndexSidebarLabel = styled.span<{ theme: Theme }>`\n ${({ theme }) => styledSmall(theme)};\n color: ${({ theme }) => theme.colors.grayDark};\n`;\n\nexport const StyledIndexSidebarLi = styled.li<{\n theme: Theme;\n $isActive: boolean;\n}>`\n &::before {\n content: \"\";\n display: block;\n position: absolute;\n left: 0;\n height: 20px;\n width: 1px;\n background: transparent;\n transition: all 0.3s ease;\n }\n\n ${({ $isActive, theme }) =>\n $isActive &&\n css`\n &::before {\n background: ${theme.colors.primary};\n }\n `}\n`;\n\nexport const StyledIndexSidebarLink = styled.a<{\n theme: Theme;\n $isActive: boolean;\n}>`\n ${({ theme }) => styledSmall(theme)};\n color: ${({ theme, $isActive }) =>\n $isActive ? theme.colors.primary : theme.colors.dark};\n font-weight: ${({ $isActive }) => ($isActive ? \"600\" : \"400\")};\n text-decoration: none;\n transition: all 0.3s ease;\n\n &:hover {\n color: ${({ theme }) => theme.colors.primary};\n }\n`;\n\nexport const StyledSidebarList = styled.ul`\n list-style: none;\n margin: 0;\n padding: 0;\n\n &:last-of-type {\n margin-bottom: auto;\n }\n`;\n\nexport const StyledStrong = styled.strong<{ theme: Theme }>`\n font-weight: 600;\n ${({ theme }) => styledStrong(theme)};\n color: ${({ theme }) => theme.colors.accentStrong};\n display: inline-flex;\n align-items: center;\n gap: 8px;\n\n & svg {\n flex-shrink: 0;\n }\n`;\n\nexport const StyledSidebarListItem = styled.li`\n display: flex;\n gap: 10px;\n clear: both;\n`;\n\n// Shared appearance for every sidebar row - leaf links AND nested group\n// headers - so hover, active state, and the left rail read identically.\nconst sidebarRowStyles = css<Props>`\n text-decoration: none;\n font-size: ${({ theme }) => theme.fontSizes.small.lg};\n line-height: 1.6;\n color: ${({ theme }) => theme.colors.accentMuted};\n padding: 5px 0 5px 20px;\n display: flex;\n align-items: center;\n gap: 8px;\n flex: 1;\n min-width: 0;\n transition: all 0.3s ease;\n border-left: solid 1px ${({ theme }) => theme.colors.grayLight};\n\n & svg {\n flex-shrink: 0;\n }\n\n &:hover {\n color: ${({ theme }) => theme.colors.accent};\n border-color: ${({ theme }) => theme.colors.primary};\n }\n\n ${({ $isActive, theme }) =>\n $isActive &&\n css`\n color: ${theme.colors.accentStrong};\n border-color: ${theme.colors.primary};\n font-weight: 600;\n `};\n`;\n\n// The collapse chevron points right when closed and rotates to point down\n// when the group is open.\nconst sidebarChevron = css<Props>`\n & .lucide-chevron-right {\n margin-left: auto;\n transition: transform 0.3s ease;\n\n ${({ $isOpen }) =>\n $isOpen &&\n css`\n transform: rotate(90deg);\n `}\n }\n`;\n\nexport const StyledSidebarListItemLink = styled(Link)<Props>`\n ${sidebarRowStyles};\n`;\n\n// Compact HTTP-method label shown before a generated API endpoint link, colored\n// by verb so endpoints are scannable in the sidebar. Only rendered when a link\n// carries an `httpMethod` (endpoint pages do; hand-written pages do not).\n// The look is Badge's mono variation (tinted, solid when active); only\n// sidebar metrics are adjusted here.\nexport const StyledSidebarMethodTag = styled(Badge)`\n flex-shrink: 0;\n font-size: 9px;\n letter-spacing: 0.02em;\n padding: 1px 4px;\n border: none;\n`;\n\n// Nested navigation group. The header shares the link appearance/hover; a\n// non-navigable group is a single toggle button, while a group that is also a\n// page pairs a link with a chevron toggle. Children live in\n// StyledSidebarGroupContent, which animates open/closed via height 0 <-> auto\n// (enabled by interpolate-size in GlobalStyles, same as the Accordion).\nexport const StyledSidebarGroupButton = styled.button<Props>`\n ${resetButton};\n ${sidebarRowStyles};\n ${sidebarChevron};\n width: 100%;\n text-align: left;\n\n /* Buttons aren't covered by the global a:focus-visible ring, so this\n nav-row toggle carries its own copy of it. */\n &:focus-visible {\n outline: none;\n border-radius: ${({ theme }) => theme.spacing.radius.xs};\n box-shadow: 0 0 0 2px ${({ theme }) => theme.colors.primaryLight};\n }\n`;\n\nexport const StyledSidebarGroupRow = styled.div<Props>`\n ${sidebarRowStyles};\n ${sidebarChevron};\n\n /* The row is a plain div, so it never matches :focus-visible itself. Ring the\n whole row when its inner link or chevron takes keyboard focus instead, to\n match the leaf-row focus treatment. */\n &:has(:focus-visible) {\n border-radius: ${({ theme }) => theme.spacing.radius.xs};\n box-shadow: 0 0 0 2px ${({ theme }) => theme.colors.primaryLight};\n }\n`;\n\nexport const StyledSidebarGroupLink = styled(Link)`\n display: flex;\n align-items: center;\n gap: 8px;\n flex: 1;\n min-width: 0;\n color: inherit;\n text-decoration: none;\n\n & svg {\n flex-shrink: 0;\n }\n\n /* Ring is drawn on the parent row via :has(:focus-visible); suppress the\n global a:focus-visible glow so it isn't drawn twice. */\n &:focus-visible {\n outline: none;\n box-shadow: none;\n }\n`;\n\nexport const StyledSidebarGroupChevron = styled.button`\n display: inline-flex;\n align-items: center;\n justify-content: center;\n flex-shrink: 0;\n padding: 0;\n border: 0;\n background: none;\n color: inherit;\n cursor: pointer;\n\n /* Ring is drawn on the parent row via :has(:focus-visible). */\n &:focus-visible {\n outline: none;\n }\n`;\n\nexport const StyledSidebarGroupContent = styled.ul<Props>`\n list-style: none;\n margin: 0;\n padding: 0;\n height: 0;\n overflow: clip;\n transition: all 0.3s ease;\n\n ${({ $isOpen }) =>\n $isOpen &&\n css`\n height: auto;\n `}\n`;\n\nexport const StyleMobileBar = styled.button<Props>`\n ${resetButton};\n position: fixed;\n z-index: 999;\n bottom: 0;\n right: 20px;\n font-size: ${({ theme }) => theme.fontSizes.strong.lg};\n line-height: ${({ theme }) => theme.fontSizes.strong.lg};\n box-shadow: ${({ theme }) => theme.shadows.sm};\n background: ${({ theme }) => theme.colors.primary};\n color: ${({ theme }) => theme.colors.surface};\n backdrop-filter: blur(10px);\n -webkit-backdrop-filter: blur(10px);\n padding: 10px;\n border-radius: 100px;\n margin: 0 0 20px 0;\n font-weight: 600;\n display: flex;\n justify-content: flex-start;\n width: auto;\n\n ${mq(\"lg\")} {\n display: none;\n }\n\n ${({ $isActive }) => $isActive && `position: fixed;`};\n`;\n\nexport const StyledMobileBurger = styled.span<Props>`\n display: block;\n margin: auto 0;\n width: 18px;\n height: 18px;\n position: relative;\n overflow: hidden;\n background: transparent;\n position: relative;\n transform: scale(0.8);\n\n &::before,\n &::after {\n content: \"\";\n display: block;\n position: absolute;\n width: 18px;\n height: 3px;\n border-radius: 3px;\n background: ${({ theme }) => theme.colors.surface};\n transition: all 0.3s ease;\n }\n\n &::before {\n top: 3px;\n }\n\n &::after {\n bottom: 3px;\n }\n\n ${({ $isActive }) =>\n $isActive &&\n css`\n &::before {\n transform: translateY(5px) rotate(45deg);\n }\n\n &::after {\n transform: translateY(-4px) rotate(-45deg);\n }\n `};\n`;\n\n// Visually hidden but present for crawlers and agents: points at llms.txt and\n// the .md mirrors. Rendered as the first element of the site layout.\nconst StyledLlmsDirective = styled.div`\n position: absolute;\n width: 1px;\n height: 1px;\n padding: 0;\n margin: -1px;\n overflow: hidden;\n clip: rect(0 0 0 0);\n white-space: nowrap;\n border: 0;\n`;\n\nfunction LlmsDirective() {\n return (\n <StyledLlmsDirective data-markdown-ignore>\n <a href=\"/llms.txt\">Documentation index for AI agents (llms.txt)</a>.\n Markdown versions of every page are available by appending .md to the page\n URL. The full corpus is at <a href=\"/llms-full.txt\">/llms-full.txt</a>.\n </StyledLlmsDirective>\n );\n}\n\ninterface DocsWrapperProps {\n children: React.ReactNode;\n}\n\nfunction DocsWrapper({ children }: DocsWrapperProps) {\n return <StyledDocsWrapper>{children}</StyledDocsWrapper>;\n}\n\nfunction DocsSidebar({ children }: DocsProps) {\n return <StyledDocsSidebar>{children}</StyledDocsSidebar>;\n}\n\nfunction DocsContainer({ children }: DocsProps) {\n const { isOpen } = useContext(ChatContext);\n\n return (\n <StyledDocsContainer $isChatOpen={isOpen}>{children}</StyledDocsContainer>\n );\n}\n\nexport {\n DocsWrapper,\n DocsSidebar,\n DocsContainer,\n LlmsDirective,\n SectionBarContext,\n SectionBarProvider,\n};\n";
|
|
1
|
+
export declare const docsComponentsTemplate = "\"use client\";\nimport React, { createContext, useContext } from \"react\";\nimport styled, { css } from \"styled-components\";\nimport {\n Button,\n resetButton,\n styledSmall,\n styledStrong,\n styledText,\n} from \"cherry-styled-components\";\nimport Link from \"next/link\";\nimport { mq, Theme } from \"@/app/theme\";\nimport {\n focusModeColumn,\n focusModeHide,\n sidePanelOffset,\n styledAnchor,\n styledTable,\n stylesLists,\n} from \"@/components/layout/SharedStyled\";\nimport { Badge } from \"@/components/layout/Badge\";\nimport { ChatContext } from \"@/components/Chat\";\n\nconst SectionBarContext = createContext(false);\n\nfunction SectionBarProvider({\n hasSectionBar,\n children,\n}: {\n hasSectionBar: boolean;\n children: React.ReactNode;\n}) {\n return (\n <SectionBarContext.Provider value={hasSectionBar}>\n {children}\n </SectionBarContext.Provider>\n );\n}\n\ninterface DocsProps {\n children: React.ReactNode;\n}\n\nconst StyledDocsWrapper = styled.div<{ theme: Theme }>`\n position: relative;\n`;\n\nconst StyledDocsSidebar = styled.div<{ theme: Theme }>`\n clear: both;\n`;\n\n// The <main> landmark wraps only the article content: the sidebar, footer,\n// and nav render outside it so content extractors and assistive tech start at\n// the article.\nconst StyledDocsContainer = styled.main<{\n theme: Theme;\n $isChatOpen?: boolean;\n}>`\n position: relative;\n padding: 0 20px 100px 20px;\n width: 100%;\n ${({ theme }) => styledText(theme)};\n transition: all 0.3s ease;\n\n ${mq(\"lg\")} {\n padding: 0 300px 80px 300px;\n\n ${({ $isChatOpen }) =>\n $isChatOpen &&\n css`\n padding: 0 440px 80px 300px;\n `}\n }\n\n ${sidePanelOffset};\n ${({ $isChatOpen }) => !$isChatOpen && focusModeColumn};\n\n & p {\n color: ${({ theme }) => theme.colors.grayDark};\n hyphens: auto;\n }\n\n & pre {\n max-width: 100%;\n }\n\n ${styledAnchor};\n ${stylesLists};\n ${styledTable};\n\n & img,\n & video,\n & iframe {\n max-width: 100%;\n border-radius: ${({ theme }) => theme.spacing.radius.lg};\n }\n\n & code:not([class]),\n & kbd {\n max-width: max-content;\n background: ${({ theme }) =>\n `color-mix(in srgb, ${theme.colors.primaryLight} 20%, transparent)`};\n color: ${({ theme }) => theme.colors.dark};\n padding: 2px 4px;\n border-radius: ${({ theme }) => theme.spacing.radius.xs};\n overflow-wrap: anywhere;\n }\n\n & .lucide {\n color: ${({ theme }) => theme.colors.primary};\n }\n\n & .aspect-video {\n aspect-ratio: 16 / 9;\n border-radius: ${({ theme }) => theme.spacing.radius.lg};\n }\n`;\n\nexport const StyledMarkdownContainer = styled.div`\n display: flex;\n flex-direction: column;\n gap: 20px;\n flex: 1;\n max-width: 640px;\n margin: auto;\n`;\n\ninterface Props {\n theme?: Theme;\n $isActive?: boolean;\n $isOpen?: boolean;\n $hasSectionBar?: boolean;\n}\n\nexport const StyledSidebar = styled.nav<Props>`\n position: fixed;\n overflow-y: auto;\n max-height: calc(\n 100dvh - ${({ $hasSectionBar }) => ($hasSectionBar ? 104 : 62)}px\n );\n width: 100%;\n z-index: 99;\n top: ${({ $hasSectionBar }) => ($hasSectionBar ? 104 : 62)}px;\n height: 100%;\n padding: 20px;\n opacity: 0;\n pointer-events: none;\n visibility: hidden;\n transition:\n transform 0.3s ease,\n opacity 0.3s ease,\n visibility 0s linear 0.3s;\n transform: translateY(30px);\n left: 0;\n background: ${({ theme }) => theme.colors.light};\n -webkit-overflow-scrolling: touch;\n display: flex;\n flex-direction: column;\n\n &::-webkit-scrollbar {\n display: none;\n }\n\n ${mq(\"lg\")} {\n border-right: solid 1px ${({ theme }) => theme.colors.grayLight};\n transition: none;\n max-height: 100dvh;\n width: 220px;\n background: transparent;\n padding: 82px 20px 20px 20px;\n opacity: 1;\n pointer-events: all;\n visibility: visible;\n transform: translateY(0);\n background: ${({ theme }) =>\n `color-mix(in srgb, ${theme.colors.primaryLight} 5%, transparent)`};\n top: 0;\n width: 280px;\n }\n\n ${({ $isActive }) =>\n $isActive &&\n css`\n transform: translateY(0);\n opacity: 1;\n pointer-events: all;\n visibility: visible;\n transition-delay: 0s;\n `}\n\n ${focusModeHide(\"left\")};\n\n ${mq(\"lg\")} {\n html[data-focus-mode] & {\n visibility: hidden;\n transition:\n transform 0.3s ease,\n opacity 0.3s ease,\n visibility 0s linear 0.3s;\n }\n }\n`;\n\nexport const StyledSidebarFooter = styled.div`\n padding: 22px 20px;\n position: sticky;\n border-top: 1px solid ${({ theme }) => theme.colors.grayLight};\n background: ${({ theme }) =>\n `color-mix(in srgb, ${theme.colors.primaryLight} 5%, transparent)`};\n margin: 0 -20px -20px;\n bottom: -20px;\n backdrop-filter: blur(10px);\n\n ${mq(\"lg\")} {\n padding: 16px 20px;\n }\n`;\n\nexport const StyledIndexSidebar = styled.ul<{ theme: Theme }>`\n display: none;\n list-style: none;\n margin: 0;\n padding: 0;\n position: fixed;\n top: 0;\n right: 0;\n width: 280px;\n height: 100dvh;\n overflow-y: auto;\n z-index: 1;\n padding: 82px 20px 20px 20px;\n background: ${({ theme }) => theme.colors.light};\n border-left: solid 1px ${({ theme }) => theme.colors.grayLight};\n -webkit-overflow-scrolling: touch;\n\n &::-webkit-scrollbar {\n display: none;\n }\n\n ${mq(\"lg\")} {\n display: block;\n }\n\n & li {\n padding: 5px 0;\n }\n\n ${focusModeHide(\"right\")};\n\n ${mq(\"lg\")} {\n html[data-focus-mode] & {\n visibility: hidden;\n transition:\n transform 0.3s ease,\n opacity 0.3s ease,\n visibility 0s linear 0.3s;\n }\n }\n`;\n\nexport const StyledIndexSidebarLabel = styled.span<{ theme: Theme }>`\n ${({ theme }) => styledSmall(theme)};\n color: ${({ theme }) => theme.colors.grayDark};\n`;\n\nexport const StyledIndexSidebarLi = styled.li<{\n theme: Theme;\n $isActive: boolean;\n}>`\n &::before {\n content: \"\";\n display: block;\n position: absolute;\n left: 0;\n height: 20px;\n width: 1px;\n background: transparent;\n transition: all 0.3s ease;\n }\n\n ${({ $isActive, theme }) =>\n $isActive &&\n css`\n &::before {\n background: ${theme.colors.primary};\n }\n `}\n`;\n\nexport const StyledIndexSidebarLink = styled.a<{\n theme: Theme;\n $isActive: boolean;\n}>`\n ${({ theme }) => styledSmall(theme)};\n color: ${({ theme, $isActive }) =>\n $isActive ? theme.colors.primary : theme.colors.dark};\n font-weight: ${({ $isActive }) => ($isActive ? \"600\" : \"400\")};\n text-decoration: none;\n transition: all 0.3s ease;\n\n &:hover {\n color: ${({ theme }) => theme.colors.primary};\n }\n`;\n\nexport const StyledSidebarList = styled.ul`\n list-style: none;\n margin: 0;\n padding: 0;\n\n &:last-of-type {\n margin-bottom: auto;\n }\n`;\n\nexport const StyledStrong = styled.strong<{ theme: Theme }>`\n font-weight: 600;\n ${({ theme }) => styledStrong(theme)};\n color: ${({ theme }) => theme.colors.accentStrong};\n display: inline-flex;\n align-items: center;\n gap: 8px;\n\n & svg {\n flex-shrink: 0;\n }\n`;\n\nexport const StyledSidebarListItem = styled.li`\n display: flex;\n gap: 10px;\n clear: both;\n`;\n\n// Shared appearance for every sidebar row - leaf links AND nested group\n// headers - so hover, active state, and the left rail read identically.\nconst sidebarRowStyles = css<Props>`\n text-decoration: none;\n font-size: ${({ theme }) => theme.fontSizes.small.lg};\n line-height: 1.6;\n color: ${({ theme }) => theme.colors.accentMuted};\n padding: 5px 0 5px 20px;\n display: flex;\n align-items: center;\n gap: 8px;\n flex: 1;\n min-width: 0;\n transition: all 0.3s ease;\n border-left: solid 1px ${({ theme }) => theme.colors.grayLight};\n\n & svg {\n flex-shrink: 0;\n }\n\n &:hover {\n color: ${({ theme }) => theme.colors.accent};\n border-color: ${({ theme }) => theme.colors.primary};\n }\n\n ${({ $isActive, theme }) =>\n $isActive &&\n css`\n color: ${theme.colors.accentStrong};\n border-color: ${theme.colors.primary};\n font-weight: 600;\n `};\n`;\n\n// The collapse chevron points right when closed and rotates to point down\n// when the group is open.\nconst sidebarChevron = css<Props>`\n & .lucide-chevron-right {\n margin-left: auto;\n transition: transform 0.3s ease;\n\n ${({ $isOpen }) =>\n $isOpen &&\n css`\n transform: rotate(90deg);\n `}\n }\n`;\n\nexport const StyledSidebarListItemLink = styled(Link)<Props>`\n ${sidebarRowStyles};\n`;\n\n// Compact HTTP-method label shown before a generated API endpoint link, colored\n// by verb so endpoints are scannable in the sidebar. Only rendered when a link\n// carries an `httpMethod` (endpoint pages do; hand-written pages do not).\n// The look is Badge's mono variation (tinted, solid when active); only\n// sidebar metrics are adjusted here.\nexport const StyledSidebarMethodTag = styled(Badge)`\n flex-shrink: 0;\n font-size: 9px;\n letter-spacing: 0.02em;\n padding: 1px 4px;\n border: none;\n`;\n\n// Nested navigation group. The header shares the link appearance/hover; a\n// non-navigable group is a single toggle button, while a group that is also a\n// page pairs a link with a chevron toggle. Children live in\n// StyledSidebarGroupContent, which animates open/closed via height 0 <-> auto\n// (enabled by interpolate-size in GlobalStyles, same as the Accordion).\nexport const StyledSidebarGroupButton = styled(Button)<Props>`\n ${resetButton};\n ${sidebarRowStyles};\n ${sidebarChevron};\n width: 100%;\n height: auto;\n min-height: 0;\n text-align: left;\n\n /* Buttons aren't covered by the global a:focus-visible ring, so this\n nav-row toggle carries its own copy of it. */\n &:focus-visible {\n outline: none;\n border-radius: ${({ theme }) => theme.spacing.radius.xs};\n box-shadow: 0 0 0 2px ${({ theme }) => theme.colors.primaryLight};\n }\n`;\n\nexport const StyledSidebarGroupRow = styled.div<Props>`\n ${sidebarRowStyles};\n ${sidebarChevron};\n\n /* The row is a plain div, so it never matches :focus-visible itself. Ring the\n whole row when its inner link or chevron takes keyboard focus instead, to\n match the leaf-row focus treatment. */\n &:has(:focus-visible) {\n border-radius: ${({ theme }) => theme.spacing.radius.xs};\n box-shadow: 0 0 0 2px ${({ theme }) => theme.colors.primaryLight};\n }\n`;\n\nexport const StyledSidebarGroupLink = styled(Link)`\n display: flex;\n align-items: center;\n gap: 8px;\n flex: 1;\n min-width: 0;\n color: inherit;\n text-decoration: none;\n\n & svg {\n flex-shrink: 0;\n }\n\n /* Ring is drawn on the parent row via :has(:focus-visible); suppress the\n global a:focus-visible glow so it isn't drawn twice. */\n &:focus-visible {\n outline: none;\n box-shadow: none;\n }\n`;\n\nexport const StyledSidebarGroupChevron = styled(Button)`\n ${resetButton};\n display: inline-flex;\n align-items: center;\n justify-content: center;\n flex-shrink: 0;\n width: auto;\n height: auto;\n min-height: 0;\n padding: 0;\n border: 0;\n background: none;\n color: inherit;\n cursor: pointer;\n\n /* Ring is drawn on the parent row via :has(:focus-visible). */\n &:focus-visible {\n outline: none;\n }\n`;\n\nexport const StyledSidebarGroupContent = styled.ul.attrs<Props>(\n ({ $isOpen }) => ({\n \"aria-hidden\": !$isOpen,\n inert: !$isOpen,\n }),\n)<Props>`\n list-style: none;\n margin: 0;\n padding: 0;\n height: 0;\n overflow: clip;\n visibility: hidden;\n transition:\n height 0.3s ease,\n visibility 0s linear 0.3s;\n\n ${({ $isOpen }) =>\n $isOpen &&\n css`\n height: auto;\n visibility: visible;\n transition-delay: 0s;\n `}\n\n @media (prefers-reduced-motion: reduce) {\n transition: none;\n }\n`;\n\nexport const StyleMobileBar = styled(Button)<Props>`\n ${resetButton};\n position: fixed;\n z-index: 999;\n bottom: 0;\n right: 20px;\n font-size: ${({ theme }) => theme.fontSizes.strong.lg};\n line-height: ${({ theme }) => theme.fontSizes.strong.lg};\n box-shadow: ${({ theme }) => theme.shadows.sm};\n background: ${({ theme }) => theme.colors.primary};\n color: ${({ theme }) => theme.colors.surface};\n backdrop-filter: blur(10px);\n -webkit-backdrop-filter: blur(10px);\n padding: 10px;\n border-radius: 100px;\n margin: 0 0 20px 0;\n font-weight: 600;\n display: flex;\n justify-content: flex-start;\n width: auto;\n height: auto;\n min-height: 0;\n\n ${mq(\"lg\")} {\n display: none;\n }\n\n ${({ $isActive }) => $isActive && `position: fixed;`};\n`;\n\nexport const StyledMobileBurger = styled.span<Props>`\n display: block;\n margin: auto 0;\n width: 18px;\n height: 18px;\n position: relative;\n overflow: hidden;\n background: transparent;\n position: relative;\n transform: scale(0.8);\n\n &::before,\n &::after {\n content: \"\";\n display: block;\n position: absolute;\n width: 18px;\n height: 3px;\n border-radius: 3px;\n background: ${({ theme }) => theme.colors.surface};\n transition: all 0.3s ease;\n }\n\n &::before {\n top: 3px;\n }\n\n &::after {\n bottom: 3px;\n }\n\n ${({ $isActive }) =>\n $isActive &&\n css`\n &::before {\n transform: translateY(5px) rotate(45deg);\n }\n\n &::after {\n transform: translateY(-4px) rotate(-45deg);\n }\n `};\n`;\n\n// Visually hidden but present for crawlers and agents: points at llms.txt and\n// the .md mirrors. Rendered as the first element of the site layout.\nconst StyledLlmsDirective = styled.div`\n position: absolute;\n width: 1px;\n height: 1px;\n padding: 0;\n margin: -1px;\n overflow: hidden;\n clip: rect(0 0 0 0);\n white-space: nowrap;\n border: 0;\n`;\n\nfunction LlmsDirective() {\n return (\n <StyledLlmsDirective data-markdown-ignore>\n <a href=\"/llms.txt\">Documentation index for AI agents (llms.txt)</a>.\n Markdown versions of every page are available by appending .md to the page\n URL. The full corpus is at <a href=\"/llms-full.txt\">/llms-full.txt</a>.\n </StyledLlmsDirective>\n );\n}\n\ninterface DocsWrapperProps {\n children: React.ReactNode;\n}\n\nfunction DocsWrapper({ children }: DocsWrapperProps) {\n return <StyledDocsWrapper>{children}</StyledDocsWrapper>;\n}\n\nfunction DocsSidebar({ children }: DocsProps) {\n return <StyledDocsSidebar>{children}</StyledDocsSidebar>;\n}\n\nfunction DocsContainer({ children }: DocsProps) {\n const { isOpen } = useContext(ChatContext);\n\n return (\n <StyledDocsContainer $isChatOpen={isOpen}>{children}</StyledDocsContainer>\n );\n}\n\nexport {\n DocsWrapper,\n DocsSidebar,\n DocsContainer,\n LlmsDirective,\n SectionBarContext,\n SectionBarProvider,\n};\n";
|
|
@@ -3,6 +3,7 @@ export const docsComponentsTemplate = `"use client";
|
|
|
3
3
|
import React, { createContext, useContext } from "react";
|
|
4
4
|
import styled, { css } from "styled-components";
|
|
5
5
|
import {
|
|
6
|
+
Button,
|
|
6
7
|
resetButton,
|
|
7
8
|
styledSmall,
|
|
8
9
|
styledStrong,
|
|
@@ -97,6 +98,7 @@ const StyledDocsContainer = styled.main<{
|
|
|
97
98
|
|
|
98
99
|
& code:not([class]),
|
|
99
100
|
& kbd {
|
|
101
|
+
max-width: max-content;
|
|
100
102
|
background: \${({ theme }) =>
|
|
101
103
|
\`color-mix(in srgb, \${theme.colors.primaryLight} 20%, transparent)\`};
|
|
102
104
|
color: \${({ theme }) => theme.colors.dark};
|
|
@@ -144,7 +146,11 @@ export const StyledSidebar = styled.nav<Props>\`
|
|
|
144
146
|
padding: 20px;
|
|
145
147
|
opacity: 0;
|
|
146
148
|
pointer-events: none;
|
|
147
|
-
|
|
149
|
+
visibility: hidden;
|
|
150
|
+
transition:
|
|
151
|
+
transform 0.3s ease,
|
|
152
|
+
opacity 0.3s ease,
|
|
153
|
+
visibility 0s linear 0.3s;
|
|
148
154
|
transform: translateY(30px);
|
|
149
155
|
left: 0;
|
|
150
156
|
background: \${({ theme }) => theme.colors.light};
|
|
@@ -165,6 +171,7 @@ export const StyledSidebar = styled.nav<Props>\`
|
|
|
165
171
|
padding: 82px 20px 20px 20px;
|
|
166
172
|
opacity: 1;
|
|
167
173
|
pointer-events: all;
|
|
174
|
+
visibility: visible;
|
|
168
175
|
transform: translateY(0);
|
|
169
176
|
background: \${({ theme }) =>
|
|
170
177
|
\`color-mix(in srgb, \${theme.colors.primaryLight} 5%, transparent)\`};
|
|
@@ -178,9 +185,21 @@ export const StyledSidebar = styled.nav<Props>\`
|
|
|
178
185
|
transform: translateY(0);
|
|
179
186
|
opacity: 1;
|
|
180
187
|
pointer-events: all;
|
|
188
|
+
visibility: visible;
|
|
189
|
+
transition-delay: 0s;
|
|
181
190
|
\`}
|
|
182
191
|
|
|
183
192
|
\${focusModeHide("left")};
|
|
193
|
+
|
|
194
|
+
\${mq("lg")} {
|
|
195
|
+
html[data-focus-mode] & {
|
|
196
|
+
visibility: hidden;
|
|
197
|
+
transition:
|
|
198
|
+
transform 0.3s ease,
|
|
199
|
+
opacity 0.3s ease,
|
|
200
|
+
visibility 0s linear 0.3s;
|
|
201
|
+
}
|
|
202
|
+
}
|
|
184
203
|
\`;
|
|
185
204
|
|
|
186
205
|
export const StyledSidebarFooter = styled.div\`
|
|
@@ -228,6 +247,16 @@ export const StyledIndexSidebar = styled.ul<{ theme: Theme }>\`
|
|
|
228
247
|
}
|
|
229
248
|
|
|
230
249
|
\${focusModeHide("right")};
|
|
250
|
+
|
|
251
|
+
\${mq("lg")} {
|
|
252
|
+
html[data-focus-mode] & {
|
|
253
|
+
visibility: hidden;
|
|
254
|
+
transition:
|
|
255
|
+
transform 0.3s ease,
|
|
256
|
+
opacity 0.3s ease,
|
|
257
|
+
visibility 0s linear 0.3s;
|
|
258
|
+
}
|
|
259
|
+
}
|
|
231
260
|
\`;
|
|
232
261
|
|
|
233
262
|
export const StyledIndexSidebarLabel = styled.span<{ theme: Theme }>\`
|
|
@@ -375,11 +404,13 @@ export const StyledSidebarMethodTag = styled(Badge)\`
|
|
|
375
404
|
// page pairs a link with a chevron toggle. Children live in
|
|
376
405
|
// StyledSidebarGroupContent, which animates open/closed via height 0 <-> auto
|
|
377
406
|
// (enabled by interpolate-size in GlobalStyles, same as the Accordion).
|
|
378
|
-
export const StyledSidebarGroupButton = styled
|
|
407
|
+
export const StyledSidebarGroupButton = styled(Button)<Props>\`
|
|
379
408
|
\${resetButton};
|
|
380
409
|
\${sidebarRowStyles};
|
|
381
410
|
\${sidebarChevron};
|
|
382
411
|
width: 100%;
|
|
412
|
+
height: auto;
|
|
413
|
+
min-height: 0;
|
|
383
414
|
text-align: left;
|
|
384
415
|
|
|
385
416
|
/* Buttons aren't covered by the global a:focus-visible ring, so this
|
|
@@ -425,11 +456,15 @@ export const StyledSidebarGroupLink = styled(Link)\`
|
|
|
425
456
|
}
|
|
426
457
|
\`;
|
|
427
458
|
|
|
428
|
-
export const StyledSidebarGroupChevron = styled
|
|
459
|
+
export const StyledSidebarGroupChevron = styled(Button)\`
|
|
460
|
+
\${resetButton};
|
|
429
461
|
display: inline-flex;
|
|
430
462
|
align-items: center;
|
|
431
463
|
justify-content: center;
|
|
432
464
|
flex-shrink: 0;
|
|
465
|
+
width: auto;
|
|
466
|
+
height: auto;
|
|
467
|
+
min-height: 0;
|
|
433
468
|
padding: 0;
|
|
434
469
|
border: 0;
|
|
435
470
|
background: none;
|
|
@@ -442,22 +477,36 @@ export const StyledSidebarGroupChevron = styled.button\`
|
|
|
442
477
|
}
|
|
443
478
|
\`;
|
|
444
479
|
|
|
445
|
-
export const StyledSidebarGroupContent = styled.ul<Props
|
|
480
|
+
export const StyledSidebarGroupContent = styled.ul.attrs<Props>(
|
|
481
|
+
({ $isOpen }) => ({
|
|
482
|
+
"aria-hidden": !$isOpen,
|
|
483
|
+
inert: !$isOpen,
|
|
484
|
+
}),
|
|
485
|
+
)<Props>\`
|
|
446
486
|
list-style: none;
|
|
447
487
|
margin: 0;
|
|
448
488
|
padding: 0;
|
|
449
489
|
height: 0;
|
|
450
490
|
overflow: clip;
|
|
451
|
-
|
|
491
|
+
visibility: hidden;
|
|
492
|
+
transition:
|
|
493
|
+
height 0.3s ease,
|
|
494
|
+
visibility 0s linear 0.3s;
|
|
452
495
|
|
|
453
496
|
\${({ $isOpen }) =>
|
|
454
497
|
$isOpen &&
|
|
455
498
|
css\`
|
|
456
499
|
height: auto;
|
|
500
|
+
visibility: visible;
|
|
501
|
+
transition-delay: 0s;
|
|
457
502
|
\`}
|
|
503
|
+
|
|
504
|
+
@media (prefers-reduced-motion: reduce) {
|
|
505
|
+
transition: none;
|
|
506
|
+
}
|
|
458
507
|
\`;
|
|
459
508
|
|
|
460
|
-
export const StyleMobileBar = styled
|
|
509
|
+
export const StyleMobileBar = styled(Button)<Props>\`
|
|
461
510
|
\${resetButton};
|
|
462
511
|
position: fixed;
|
|
463
512
|
z-index: 999;
|
|
@@ -477,6 +526,8 @@ export const StyleMobileBar = styled.button<Props>\`
|
|
|
477
526
|
display: flex;
|
|
478
527
|
justify-content: flex-start;
|
|
479
528
|
width: auto;
|
|
529
|
+
height: auto;
|
|
530
|
+
min-height: 0;
|
|
480
531
|
|
|
481
532
|
\${mq("lg")} {
|
|
482
533
|
display: none;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export declare const globalStylesTemplate = "\"use client\";\nimport { createGlobalStyle } from \"styled-components\";\nimport {\n colorsLight,\n colorsDark,\n shadowsLight,\n shadowsDark,\n} from \"@/app/theme\";\n\n// Build \"name: value;\" lines for every entry in a record. Used to emit\n// :root and
|
|
1
|
+
export declare const globalStylesTemplate = "\"use client\";\nimport { createGlobalStyle } from \"styled-components\";\nimport {\n colorsLight,\n colorsDark,\n shadowsLight,\n shadowsDark,\n} from \"@/app/theme\";\n\n// Build \"name: value;\" lines for every entry in a record. Used to emit the\n// :root and dark-mode blocks from the resolved hex objects in theme.ts. Custom\n// theme.json overrides flow through automatically because they are already\n// merged into colorsLight / colorsDark.\nfunction toCssVars<T extends object>(prefix: string, record: T): string {\n return Object.entries(record)\n .map(([k, v]) => ` --${prefix}-${k}: ${v};`)\n .join(\"\\n\");\n}\n\nconst lightVars = [\n toCssVars(\"color\", colorsLight),\n toCssVars(\"shadow\", shadowsLight),\n // Semantic tokens \u2014 derived from the brand palette per mode. See the\n // SemanticColors interface in theme.ts for the intent of each.\n // These reference the palette via var() (not baked hex) so that any\n // runtime override of --color-primary* (e.g. the DemoTheme presets)\n // cascades into the semantic tokens automatically.\n ` --color-accent: var(--color-primaryDark);`,\n // accentStrong = accent shifted ~10% toward black (light mode) or white (dark\n // mode). color-mix in sRGB is not identical to polished's HSL darken/lighten\n // but the visual difference at 10% on a UI accent is imperceptible.\n ` --color-accentStrong: color-mix(in srgb, var(--color-primaryDark) 90%, black);`,\n ` --color-accentMuted: var(--color-primary);`,\n ` --color-surface: var(--color-light);`,\n].join(\"\\n\");\n\nconst darkVars = [\n toCssVars(\"color\", colorsDark),\n toCssVars(\"shadow\", shadowsDark),\n ` --color-accent: var(--color-primaryLight);`,\n ` --color-accentStrong: color-mix(in srgb, var(--color-primaryLight) 90%, white);`,\n ` --color-accentMuted: var(--color-grayDark);`,\n ` --color-surface: var(--color-dark);`,\n].join(\"\\n\");\n\nconst diagramVars = [\n ` --mermaid-bg: var(--color-light);`,\n ` --mermaid-fg: var(--color-dark);`,\n ` --mermaid-line: var(--color-grayDark);`,\n ` --mermaid-accent: var(--color-accent);`,\n ` --mermaid-muted: var(--color-grayDark);`,\n ` --mermaid-surface: var(--color-grayLight);`,\n ` --mermaid-border: var(--color-gray);`,\n].join(\"\\n\");\n\nconst GlobalStyles = createGlobalStyle`\n:root {\n color-scheme: light;\n${lightVars}\n${diagramVars}\n}\n\n/* The blocking theme-init script in the root layout stamps this attribute\n before the first paint, so a statically rendered page arrives already dark.\n Declaring color-scheme here rather than inline on <html> keeps native form\n controls and scrollbars following the mode when the theme is toggled. */\n:root[data-theme=\"dark\"] {\n color-scheme: dark;\n${darkVars}\n}\n\nhtml,\nbody {\n margin: 0;\n padding: 0;\n min-height: 100%;\n background-color: var(--color-light);\n scroll-padding-top: 80px;\n}\n\nhtml:has(:target) {\n scroll-behavior: smooth;\n}\n\nbody {\n font-family: \"Inter\", sans-serif;\n -moz-osx-font-smoothing: grayscale;\n -webkit-text-size-adjust: 100%;\n -webkit-font-smoothing: antialiased;\n}\n\n:root {\n interpolate-size: allow-keywords;\n}\n\n* {\n box-sizing: border-box;\n min-width: 0;\n}\n\nhr {\n border: none;\n border-bottom: solid 1px var(--color-grayLight);\n margin: 10px 0;\n}\n\npre,\ncode,\nkbd,\nsamp {\n font-family: monospace, monospace;\n}\n\npre,\ncode,\nkbd,\nsamp,\nblockquote,\np,\na,\nh1,\nh2,\nh3,\nh4,\nh5,\nh6,\nul li,\nol li {\n margin: 0;\n padding: 0;\n color: var(--color-dark);\n}\n\na {\n color: var(--color-primary);\n}\n\n/* Keyboard-focus ring, defined once globally so links don't each re-declare it.\n :focus-visible keeps it keyboard-only (no ring on mouse click); box-shadow\n gives a soft primaryLight glow that follows the element's border-radius. The\n 6px radius mirrors theme.spacing.radius.xs so the ring rounds on links that\n have no radius of their own. Cherry link-buttons (.button-link) are excluded\n via :where() so the exclusion adds no specificity - this keeps the selector\n at (0,1,1) so bespoke per-component :focus-visible rules (inline content\n links, the section bar, the sidebar group rows) still override it. */\na:focus-visible:where(:not(.button-link)) {\n outline: none;\n border-radius: 6px;\n box-shadow: 0 0 0 2px var(--color-primaryLight);\n}\n\nol,\nul {\n list-style: none;\n margin: 0;\n padding: 0;\n max-width: 100%;\n}\n\nfigure {\n margin: 0;\n}\n\nfieldset {\n appearance: none;\n border: none;\n}\n\nbutton,\ninput,\na,\nimg,\nsvg,\nsvg * {\n transition: all 0.3s ease;\n}\n\nstrong,\nb {\n font-weight: 700;\n}\n\n.full-width {\n width: 100%;\n}\n\n/* Mode-conditional visibility helpers. ThemeToggle uses these to swap Sun\n and Moon icons; Header uses them to swap light/dark logos. Pure CSS so the\n swap happens via the active <html> attribute without JS or re-render. */\n:root[data-theme=\"dark\"] .light-only {\n display: none !important;\n}\n:root:not([data-theme=\"dark\"]) .dark-only {\n display: none !important;\n}\n`;\n\nexport { GlobalStyles };\n";
|
|
@@ -7,10 +7,10 @@ import {
|
|
|
7
7
|
shadowsDark,
|
|
8
8
|
} from "@/app/theme";
|
|
9
9
|
|
|
10
|
-
// Build "name: value;" lines for every entry in a record. Used to emit
|
|
11
|
-
// :root and
|
|
12
|
-
//
|
|
13
|
-
//
|
|
10
|
+
// Build "name: value;" lines for every entry in a record. Used to emit the
|
|
11
|
+
// :root and dark-mode blocks from the resolved hex objects in theme.ts. Custom
|
|
12
|
+
// theme.json overrides flow through automatically because they are already
|
|
13
|
+
// merged into colorsLight / colorsDark.
|
|
14
14
|
function toCssVars<T extends object>(prefix: string, record: T): string {
|
|
15
15
|
return Object.entries(record)
|
|
16
16
|
.map(([k, v]) => \` --\${prefix}-\${k}: \${v};\`)
|
|
@@ -55,11 +55,17 @@ const diagramVars = [
|
|
|
55
55
|
|
|
56
56
|
const GlobalStyles = createGlobalStyle\`
|
|
57
57
|
:root {
|
|
58
|
+
color-scheme: light;
|
|
58
59
|
\${lightVars}
|
|
59
60
|
\${diagramVars}
|
|
60
61
|
}
|
|
61
62
|
|
|
62
|
-
|
|
63
|
+
/* The blocking theme-init script in the root layout stamps this attribute
|
|
64
|
+
before the first paint, so a statically rendered page arrives already dark.
|
|
65
|
+
Declaring color-scheme here rather than inline on <html> keeps native form
|
|
66
|
+
controls and scrollbars following the mode when the theme is toggled. */
|
|
67
|
+
:root[data-theme="dark"] {
|
|
68
|
+
color-scheme: dark;
|
|
63
69
|
\${darkVars}
|
|
64
70
|
}
|
|
65
71
|
|
|
@@ -179,12 +185,12 @@ b {
|
|
|
179
185
|
}
|
|
180
186
|
|
|
181
187
|
/* Mode-conditional visibility helpers. ThemeToggle uses these to swap Sun
|
|
182
|
-
and Moon icons; Header uses them to swap light/dark logos. Pure CSS so
|
|
183
|
-
|
|
184
|
-
:root
|
|
188
|
+
and Moon icons; Header uses them to swap light/dark logos. Pure CSS so the
|
|
189
|
+
swap happens via the active <html> attribute without JS or re-render. */
|
|
190
|
+
:root[data-theme="dark"] .light-only {
|
|
185
191
|
display: none !important;
|
|
186
192
|
}
|
|
187
|
-
:root:not(
|
|
193
|
+
:root:not([data-theme="dark"]) .dark-only {
|
|
188
194
|
display: none !important;
|
|
189
195
|
}
|
|
190
196
|
\`;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export declare const promptTemplate = "\"use client\";\nimport React from \"react\";\nimport styled from \"styled-components\";\nimport {
|
|
1
|
+
export declare const promptTemplate = "\"use client\";\nimport React from \"react\";\nimport styled from \"styled-components\";\nimport { interactiveStyles, styledText } from \"cherry-styled-components\";\nimport { Theme } from \"@/app/theme\";\nimport { Icon } from \"@/components/layout/Icon\";\nimport { CopyButton } from \"@/components/layout/CopyButton\";\n\ntype PromptAction = \"copy\" | \"cursor\";\n\nconst CURSOR_DEEPLINK = \"cursor://anysphere.cursor-deeplink/prompt?text=\";\n\n// The prompt body arrives as rendered MDX elements, but the copy and Cursor\n// actions need plain text. Paragraphs and lists become separate lines and\n// list items keep a \"- \" marker so the copied prompt stays readable.\nfunction promptText(node: React.ReactNode): string {\n if (node == null || typeof node === \"boolean\") return \"\";\n if (typeof node === \"string\" || typeof node === \"number\") {\n return String(node);\n }\n if (Array.isArray(node)) return node.map(promptText).join(\"\");\n if (React.isValidElement(node)) {\n const element = node as React.ReactElement<{\n children?: React.ReactNode;\n }>;\n const inner = promptText(element.props.children);\n if (element.type === \"p\") return inner + \"\\n\\n\";\n if (element.type === \"ul\" || element.type === \"ol\") return inner + \"\\n\";\n if (element.type === \"li\") return \"- \" + inner + \"\\n\";\n return inner;\n }\n return \"\";\n}\n\nconst StyledPrompt = styled.div<{ theme: Theme }>`\n background: ${({ theme }) => theme.colors.light};\n border: solid 1px ${({ theme }) => theme.colors.grayLight};\n border-radius: ${({ theme }) => theme.spacing.radius.lg};\n padding: 20px;\n width: 100%;\n`;\n\nconst StyledPromptHeader = styled.div<{ theme: Theme }>`\n display: flex;\n align-items: flex-start;\n gap: 10px;\n margin: 0 0 15px;\n ${({ theme }) => styledText(theme)};\n font-weight: 700;\n color: ${({ theme }) => theme.colors.dark};\n\n & > svg.lucide {\n flex-shrink: 0;\n margin-top: 4px;\n color: inherit;\n }\n`;\n\nconst StyledPromptDescription = styled.span`\n flex: 1;\n min-width: 0;\n`;\n\nconst StyledPromptActions = styled.span`\n display: flex;\n align-items: center;\n gap: 5px;\n flex-shrink: 0;\n`;\n\n// Matches the CopyButton chrome so the two actions read as one control\n// group; a link rather than a button because it navigates to the Cursor\n// deeplink.\nconst StyledCursorLink = styled.a<{ theme: Theme }>`\n ${interactiveStyles}\n display: flex;\n align-items: center;\n gap: 5px;\n background: ${({ theme }) => theme.colors.light};\n border-color: ${({ theme }) => theme.colors.grayLight};\n border-radius: ${({ theme }) => theme.spacing.radius.xs};\n padding: 4px 8px;\n font-size: 12px;\n line-height: 16px;\n font-weight: 600;\n color: ${({ theme }) => theme.colors.grayDark};\n text-decoration: none;\n\n & svg.lucide {\n margin: 0;\n color: inherit;\n }\n`;\n\nconst StyledPromptBody = styled.div<{ theme: Theme }>`\n ${({ theme }) => styledText(theme)};\n color: ${({ theme }) => theme.colors.grayDark};\n display: flex;\n flex-direction: column;\n gap: 20px;\n`;\n\ninterface PromptProps {\n children: React.ReactNode;\n description: string;\n icon?: string;\n actions?: PromptAction[];\n}\n\nfunction Prompt({\n children,\n description,\n icon,\n actions = [\"copy\"],\n}: PromptProps) {\n const text = promptText(children)\n .replace(/\\n{3,}/g, \"\\n\\n\")\n .trim();\n\n return (\n <StyledPrompt>\n <StyledPromptHeader>\n {icon ? <Icon name={icon} size={16} /> : null}\n <StyledPromptDescription>{description}</StyledPromptDescription>\n <StyledPromptActions>\n {actions.includes(\"copy\") && (\n <CopyButton text={text} label=\"Copy prompt\" size={16} />\n )}\n {actions.includes(\"cursor\") && (\n <StyledCursorLink\n href={CURSOR_DEEPLINK + encodeURIComponent(text)}\n aria-label=\"Open prompt in Cursor\"\n >\n Cursor\n <Icon name=\"arrow-up-right\" size={12} />\n </StyledCursorLink>\n )}\n </StyledPromptActions>\n </StyledPromptHeader>\n <StyledPromptBody>{children}</StyledPromptBody>\n </StyledPrompt>\n );\n}\n\nexport { Prompt };\n";
|
|
@@ -1,11 +1,7 @@
|
|
|
1
1
|
export const promptTemplate = `"use client";
|
|
2
2
|
import React from "react";
|
|
3
3
|
import styled from "styled-components";
|
|
4
|
-
import {
|
|
5
|
-
interactiveStyles,
|
|
6
|
-
styledSmall,
|
|
7
|
-
styledText,
|
|
8
|
-
} from "cherry-styled-components";
|
|
4
|
+
import { interactiveStyles, styledText } from "cherry-styled-components";
|
|
9
5
|
import { Theme } from "@/app/theme";
|
|
10
6
|
import { Icon } from "@/components/layout/Icon";
|
|
11
7
|
import { CopyButton } from "@/components/layout/CopyButton";
|
|
@@ -46,15 +42,16 @@ const StyledPrompt = styled.div<{ theme: Theme }>\`
|
|
|
46
42
|
|
|
47
43
|
const StyledPromptHeader = styled.div<{ theme: Theme }>\`
|
|
48
44
|
display: flex;
|
|
49
|
-
align-items:
|
|
45
|
+
align-items: flex-start;
|
|
50
46
|
gap: 10px;
|
|
51
47
|
margin: 0 0 15px;
|
|
52
|
-
\${({ theme }) =>
|
|
48
|
+
\${({ theme }) => styledText(theme)};
|
|
53
49
|
font-weight: 700;
|
|
54
50
|
color: \${({ theme }) => theme.colors.dark};
|
|
55
51
|
|
|
56
52
|
& > svg.lucide {
|
|
57
53
|
flex-shrink: 0;
|
|
54
|
+
margin-top: 4px;
|
|
58
55
|
color: inherit;
|
|
59
56
|
}
|
|
60
57
|
\`;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export declare const stepsTemplate = "\"use client\";\nimport React from \"react\";\nimport styled, { useTheme } from \"styled-components\";\nimport { styledText } from \"cherry-styled-components\";\nimport { Theme } from \"@/app/theme\";\nimport { Icon, IconProps } from \"@/components/layout/Icon\";\n\nconst StyledStepsContainer = styled.div<{ theme: Theme }>`\n position: relative;\n width: 100%;\n`;\n\nconst StyledStep = styled.div<{ theme: Theme }>`\n border-radius: ${({ theme }) => theme.spacing.radius.lg};\n padding: 0 0 20px 52px;\n margin: 0;\n position: relative;\n ${({ theme }) => styledText(theme)}\n color: ${({ theme }) => theme.colors.grayDark};\n\n &::after {\n content: \"\";\n position: absolute;\n left: 16px;\n top: 0;\n width: 1px;\n height: 100%;\n background: ${({ theme }) => theme.colors.primary};\n background: linear-gradient(\n 180deg,\n ${({ theme }) => theme.colors.primary},\n transparent\n );\n border-radius: 4px;\n }\n`;\n\nconst StepNumber = styled.div<{ theme: Theme }>`\n width: 32px;\n height: 32px;\n border-radius: 50%;\n background: ${({ theme }) => theme.colors.primary};\n color: ${({ theme }) => theme.colors.light};\n display: flex;\n align-items: center;\n justify-content: center;\n font-weight: 700;\n margin-bottom: 12px;\n ${({ theme }) => styledText(theme)};\n position: absolute;\n left: 0;\n top: 0;\n z-index: 1;\n`;\n\nconst StyledStepTitle = styled.div<{ theme: Theme }>`\n margin: 0 0 10px 0;\n padding: 2px 0 0 0;\n color: ${({ theme }) => theme.colors.dark};\n ${({ theme }) => styledText(theme)};\n font-weight: 700;\n display: flex;\n align-items: center;\n gap: 10px;\n`;\n\nconst StepContent = styled.div<{ theme: Theme }>`\n color: ${({ theme }) => theme.colors.grayDark};\n ${({ theme }) => styledText(theme)};\n\n & > .code-wrapper {\n margin: 10px 0;\n }\n`;\n\ninterface StepProps extends React.HTMLAttributes<HTMLDivElement> {\n title?: string;\n children: React.ReactNode;\n icon?: IconProps;\n}\n\nfunction Step(_props: StepProps) {\n return null;\n}\n\ninterface StepsProps extends React.HTMLAttributes<HTMLDivElement> {\n children: React.ReactNode;\n}\n\nfunction Steps({ children }: StepsProps) {\n const theme = useTheme() as Theme;\n\n const steps = React.Children.toArray(children).filter(\n (child): child is React.ReactElement<StepProps> =>\n React.isValidElement(child),\n );\n\n return (\n <StyledStepsContainer theme={theme}>\n {steps.map((step, index) => {\n const { title, children: stepContent, icon } = step.props;\n\n return (\n <StyledStep key={index} theme={theme}>\n <StepNumber theme={theme}>{index + 1}</StepNumber>\n {(title || icon) && (\n <StyledStepTitle theme={theme}>\n {icon && <Icon name={icon}
|
|
1
|
+
export declare const stepsTemplate = "\"use client\";\nimport React from \"react\";\nimport styled, { useTheme } from \"styled-components\";\nimport { styledText } from \"cherry-styled-components\";\nimport { Theme } from \"@/app/theme\";\nimport { Icon, IconProps } from \"@/components/layout/Icon\";\n\nconst StyledStepsContainer = styled.div<{ theme: Theme }>`\n position: relative;\n width: 100%;\n`;\n\nconst StyledStep = styled.div<{ theme: Theme }>`\n border-radius: ${({ theme }) => theme.spacing.radius.lg};\n padding: 0 0 20px 52px;\n margin: 0;\n position: relative;\n ${({ theme }) => styledText(theme)}\n color: ${({ theme }) => theme.colors.grayDark};\n\n &::after {\n content: \"\";\n position: absolute;\n left: 16px;\n top: 0;\n width: 1px;\n height: 100%;\n background: ${({ theme }) => theme.colors.primary};\n background: linear-gradient(\n 180deg,\n ${({ theme }) => theme.colors.primary},\n transparent\n );\n border-radius: 4px;\n }\n`;\n\nconst StepNumber = styled.div<{ theme: Theme }>`\n width: 32px;\n height: 32px;\n border-radius: 50%;\n background: ${({ theme }) => theme.colors.primary};\n color: ${({ theme }) => theme.colors.light};\n display: flex;\n align-items: center;\n justify-content: center;\n font-weight: 700;\n margin-bottom: 12px;\n ${({ theme }) => styledText(theme)};\n position: absolute;\n left: 0;\n top: 0;\n z-index: 1;\n`;\n\nconst StyledStepTitle = styled.div<{ theme: Theme }>`\n margin: 0 0 10px 0;\n padding: 2px 0 0 0;\n color: ${({ theme }) => theme.colors.dark};\n ${({ theme }) => styledText(theme)};\n font-weight: 700;\n display: flex;\n align-items: center;\n gap: 10px;\n\n /* See Card: lucide's color prop lands on an SVG presentation attribute,\n where a CSS custom property would not resolve. */\n & > svg.lucide {\n color: ${({ theme }) => theme.colors.primary};\n }\n`;\n\nconst StepContent = styled.div<{ theme: Theme }>`\n color: ${({ theme }) => theme.colors.grayDark};\n ${({ theme }) => styledText(theme)};\n\n & > .code-wrapper {\n margin: 10px 0;\n }\n`;\n\ninterface StepProps extends React.HTMLAttributes<HTMLDivElement> {\n title?: string;\n children: React.ReactNode;\n icon?: IconProps;\n}\n\nfunction Step(_props: StepProps) {\n return null;\n}\n\ninterface StepsProps extends React.HTMLAttributes<HTMLDivElement> {\n children: React.ReactNode;\n}\n\nfunction Steps({ children }: StepsProps) {\n const theme = useTheme() as Theme;\n\n const steps = React.Children.toArray(children).filter(\n (child): child is React.ReactElement<StepProps> =>\n React.isValidElement(child),\n );\n\n return (\n <StyledStepsContainer theme={theme}>\n {steps.map((step, index) => {\n const { title, children: stepContent, icon } = step.props;\n\n return (\n <StyledStep key={index} theme={theme}>\n <StepNumber theme={theme}>{index + 1}</StepNumber>\n {(title || icon) && (\n <StyledStepTitle theme={theme}>\n {icon && <Icon name={icon} />}\n {title}\n </StyledStepTitle>\n )}\n <StepContent theme={theme}>{stepContent}</StepContent>\n </StyledStep>\n );\n })}\n </StyledStepsContainer>\n );\n}\n\nexport { Steps, Step };\n";
|
|
@@ -62,6 +62,12 @@ const StyledStepTitle = styled.div<{ theme: Theme }>\`
|
|
|
62
62
|
display: flex;
|
|
63
63
|
align-items: center;
|
|
64
64
|
gap: 10px;
|
|
65
|
+
|
|
66
|
+
/* See Card: lucide's color prop lands on an SVG presentation attribute,
|
|
67
|
+
where a CSS custom property would not resolve. */
|
|
68
|
+
& > svg.lucide {
|
|
69
|
+
color: \${({ theme }) => theme.colors.primary};
|
|
70
|
+
}
|
|
65
71
|
\`;
|
|
66
72
|
|
|
67
73
|
const StepContent = styled.div<{ theme: Theme }>\`
|
|
@@ -105,7 +111,7 @@ function Steps({ children }: StepsProps) {
|
|
|
105
111
|
<StepNumber theme={theme}>{index + 1}</StepNumber>
|
|
106
112
|
{(title || icon) && (
|
|
107
113
|
<StyledStepTitle theme={theme}>
|
|
108
|
-
{icon && <Icon name={icon}
|
|
114
|
+
{icon && <Icon name={icon} />}
|
|
109
115
|
{title}
|
|
110
116
|
</StyledStepTitle>
|
|
111
117
|
)}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export declare const tabsTemplate = "\"use client\";\nimport { Theme } from \"@/app/theme\";\nimport { styledText } from \"cherry-styled-components\";\nimport React, {
|
|
1
|
+
export declare const tabsTemplate = "\"use client\";\nimport { Theme } from \"@/app/theme\";\nimport { Button, resetButton, styledText } from \"cherry-styled-components\";\nimport React, { ReactNode, useId, useRef, useState } from \"react\";\nimport styled, { css } from \"styled-components\";\nimport { thinScrollbar } from \"@/components/layout/SharedStyled\";\nimport { Icon } from \"@/components/layout/Icon\";\n\ninterface TabContentProps {\n title: string;\n icon?: string;\n children: ReactNode;\n}\n\ninterface TabsProps {\n children: React.ReactElement<TabContentProps>[];\n}\n\nconst TabsContainer = styled.div`\n width: 100%;\n margin: 0 auto;\n`;\n\nconst TabsList = styled.div<{ theme: Theme }>`\n display: flex;\n overflow: hidden;\n border-radius: ${({ theme }) => theme.spacing.radius.lg};\n border-bottom-left-radius: 0;\n border-bottom-right-radius: 0;\n background-color: ${({ theme }) => theme.colors.light};\n border: solid 1px ${({ theme }) => theme.colors.grayLight};\n overflow-x: auto;\n ${thinScrollbar};\n`;\n\nconst TabButton = styled(Button)<{ theme: Theme; $isActive?: boolean }>`\n ${resetButton};\n appearance: none;\n flex: 1;\n display: flex;\n align-items: center;\n justify-content: center;\n gap: 8px;\n padding: 12px 20px;\n border: none;\n border-radius: 0;\n background: ${({ theme }) => theme.colors.light};\n cursor: pointer;\n transition: all 0.2s ease;\n border-bottom: 3px solid transparent;\n min-width: fit-content;\n height: auto;\n min-height: 0;\n ${({ theme }) => styledText(theme)};\n color: ${({ theme }) => theme.colors.dark};\n font-weight: 600;\n position: relative;\n\n & svg {\n flex-shrink: 0;\n }\n\n ${({ theme, $isActive }) =>\n $isActive &&\n css`\n color: ${theme.colors.primary};\n border-bottom-color: ${theme.colors.primary};\n `}\n\n &:hover {\n ${({ theme, $isActive }) =>\n !$isActive &&\n css`\n color: ${theme.colors.primary};\n background-color: color-mix(\n in srgb,\n ${theme.colors.primaryLight} 10%,\n transparent\n );\n `}\n }\n\n &:focus-visible {\n outline: none;\n z-index: 1;\n box-shadow: inset 0 0 0 2px ${({ theme }) => theme.colors.primaryLight};\n }\n\n &:not(:last-child) {\n border-right: 1px solid ${({ theme }) => theme.colors.grayLight};\n }\n\n @media (prefers-reduced-motion: reduce) {\n transition: none;\n }\n`;\n\nconst TabPanel = styled.div<{ theme: Theme }>`\n background-color: ${({ theme }) => theme.colors.light};\n padding: 20px;\n border-radius: 0 0 ${({ theme }) => theme.spacing.radius.lg}\n ${({ theme }) => theme.spacing.radius.lg};\n color: ${({ theme }) => theme.colors.grayDark};\n ${({ theme }) => styledText(theme)}\n border: solid 1px ${({ theme }) => theme.colors.grayLight};\n border-top: none;\n display: flex;\n flex-direction: column;\n gap: 20px;\n flex-wrap: wrap;\n flex: 1;\n\n &[hidden] {\n display: none;\n }\n\n &:focus-visible {\n outline: none;\n box-shadow: inset 0 0 0 2px ${({ theme }) => theme.colors.primaryLight};\n }\n`;\n\nconst TabContent: React.FC<TabContentProps> = ({ children }) => {\n return <>{children}</>;\n};\n\nconst Tabs: React.FC<TabsProps> = ({ children }) => {\n const [activeTab, setActiveTab] = useState(0);\n const tabsId = useId();\n const tabRefs = useRef<Array<HTMLButtonElement | null>>([]);\n const tabs = React.Children.toArray(children).filter(\n (child): child is React.ReactElement<TabContentProps> =>\n Boolean(\n React.isValidElement(child) &&\n child.props &&\n typeof child.props === \"object\" &&\n \"title\" in child.props &&\n typeof child.props.title === \"string\" &&\n child.props.title.trim() !== \"\",\n ),\n );\n\n const selectTab = (index: number) => {\n setActiveTab(index);\n tabRefs.current[index]?.focus();\n };\n\n const handleTabKeyDown = (\n event: React.KeyboardEvent<HTMLButtonElement>,\n index: number,\n ) => {\n let nextIndex: number | null = null;\n if (event.key === \"ArrowRight\") {\n nextIndex = index === tabs.length - 1 ? 0 : index + 1;\n } else if (event.key === \"ArrowLeft\") {\n nextIndex = index === 0 ? tabs.length - 1 : index - 1;\n } else if (event.key === \"Home\") {\n nextIndex = 0;\n } else if (event.key === \"End\") {\n nextIndex = tabs.length - 1;\n }\n\n if (nextIndex === null) return;\n event.preventDefault();\n selectTab(nextIndex);\n };\n\n return (\n <TabsContainer>\n <TabsList\n role=\"tablist\"\n aria-label=\"Content tabs\"\n aria-orientation=\"horizontal\"\n >\n {tabs.map((tab, index) => {\n const tabId = tabsId + \"-tab-\" + index;\n const panelId = tabsId + \"-panel-\" + index;\n return (\n <TabButton\n key={tabId}\n ref={(element) => {\n tabRefs.current[index] = element;\n }}\n id={tabId}\n role=\"tab\"\n aria-selected={activeTab === index}\n aria-controls={panelId}\n tabIndex={activeTab === index ? 0 : -1}\n $isActive={activeTab === index}\n onClick={() => setActiveTab(index)}\n onKeyDown={(event) => handleTabKeyDown(event, index)}\n type=\"button\"\n >\n {tab.props.icon && <Icon name={tab.props.icon} size={18} />}\n {tab.props.title}\n </TabButton>\n );\n })}\n </TabsList>\n {tabs.map((tab, index) => (\n <TabPanel\n key={tabsId + \"-panel-\" + index}\n id={tabsId + \"-panel-\" + index}\n role=\"tabpanel\"\n aria-labelledby={tabsId + \"-tab-\" + index}\n tabIndex={activeTab === index ? 0 : -1}\n hidden={activeTab !== index}\n >\n {tab.props.children}\n </TabPanel>\n ))}\n </TabsContainer>\n );\n};\n\nexport { Tabs, TabContent };\n";
|