style: fix prettier formatting
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
parent
52c3252902
commit
ab84469997
30 changed files with 255 additions and 213 deletions
|
|
@ -6,7 +6,15 @@ import remarkGfm from "remark-gfm";
|
|||
import rehypeSlug from "rehype-slug";
|
||||
import rehypeAutolinkHeadings from "rehype-autolink-headings";
|
||||
import rehypePrismPlus from "rehype-prism-plus";
|
||||
import { loadMdxFile, getHeadings, getAllDocTitles, getAllDocSlugs, docsNav, resolveDocsRedirect, docsRedirects } from "@/lib/docs";
|
||||
import {
|
||||
loadMdxFile,
|
||||
getHeadings,
|
||||
getAllDocTitles,
|
||||
getAllDocSlugs,
|
||||
docsNav,
|
||||
resolveDocsRedirect,
|
||||
docsRedirects,
|
||||
} from "@/lib/docs";
|
||||
import { getPageNavigation } from "@/config/docsNav";
|
||||
import { mdxComponents } from "@/components/docs/mdx";
|
||||
import { DocsShell } from "@/components/docs/DocsShell";
|
||||
|
|
@ -58,7 +66,9 @@ export default async function DocsPage({ params }: Props) {
|
|||
// Check redirect first
|
||||
const redirectTo = resolveDocsRedirect(slugPath);
|
||||
if (redirectTo) {
|
||||
const target = redirectTo.startsWith("http") ? redirectTo : `/docs${redirectTo}`;
|
||||
const target = redirectTo.startsWith("http")
|
||||
? redirectTo
|
||||
: `/docs${redirectTo}`;
|
||||
return <ClientRedirect to={target} />;
|
||||
}
|
||||
|
||||
|
|
@ -95,9 +105,14 @@ export default async function DocsPage({ params }: Props) {
|
|||
const { prev, next } = getPageNavigation(docsNav, currentSlug, titleMap);
|
||||
|
||||
return (
|
||||
<DocsShell currentSlug={currentSlug} headings={headings} titleMap={titleMap} docsNav={docsNav}>
|
||||
<DocsShell
|
||||
currentSlug={currentSlug}
|
||||
headings={headings}
|
||||
titleMap={titleMap}
|
||||
docsNav={docsNav}
|
||||
>
|
||||
{doc.frontmatter.title && (
|
||||
<div className="flex items-start justify-between gap-4 mb-2">
|
||||
<div className="mb-2 flex items-start justify-between gap-4">
|
||||
<h1 className="text-3xl font-light tracking-tight text-black/90 dark:text-white/90">
|
||||
{doc.frontmatter.title}
|
||||
</h1>
|
||||
|
|
@ -105,7 +120,7 @@ export default async function DocsPage({ params }: Props) {
|
|||
</div>
|
||||
)}
|
||||
{doc.frontmatter.description && (
|
||||
<p className="text-lg text-black/50 dark:text-white/50 mb-8">
|
||||
<p className="mb-8 text-lg text-black/50 dark:text-white/50">
|
||||
{doc.frontmatter.description.replace(/\*\*/g, "")}
|
||||
</p>
|
||||
)}
|
||||
|
|
|
|||
|
|
@ -8,10 +8,8 @@ export function ClientRedirect({ to }: { to: string }) {
|
|||
}, [to]);
|
||||
|
||||
return (
|
||||
<div className="flex items-center justify-center min-h-[60vh]">
|
||||
<p className="text-sm text-black/40 dark:text-white/40">
|
||||
Redirecting...
|
||||
</p>
|
||||
<div className="flex min-h-[60vh] items-center justify-center">
|
||||
<p className="text-sm text-black/40 dark:text-white/40">Redirecting...</p>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -2,9 +2,14 @@ import Link from "next/link";
|
|||
|
||||
export default function NotFoundPage() {
|
||||
return (
|
||||
<div className="flex flex-col items-center justify-center min-h-[60vh] gap-4">
|
||||
<h1 className="text-2xl font-light text-black/80 dark:text-white/80">Page not found</h1>
|
||||
<Link href="/" className="text-sm text-black/40 dark:text-white/40 hover:text-black/70 dark:hover:text-white/70">
|
||||
<div className="flex min-h-[60vh] flex-col items-center justify-center gap-4">
|
||||
<h1 className="text-2xl font-light text-black/80 dark:text-white/80">
|
||||
Page not found
|
||||
</h1>
|
||||
<Link
|
||||
href="/"
|
||||
className="text-sm text-black/40 hover:text-black/70 dark:text-white/40 dark:hover:text-white/70"
|
||||
>
|
||||
Back to docs
|
||||
</Link>
|
||||
</div>
|
||||
|
|
|
|||
|
|
@ -7,7 +7,8 @@ import "./docs.css";
|
|||
|
||||
export const metadata: Metadata = {
|
||||
title: "Continue Docs",
|
||||
description: "Documentation for Continue — the open-source AI code assistant.",
|
||||
description:
|
||||
"Documentation for Continue — the open-source AI code assistant.",
|
||||
};
|
||||
|
||||
export default function RootLayout({
|
||||
|
|
|
|||
|
|
@ -19,7 +19,7 @@ export function CopyPageButton({ slug }: { slug: string }) {
|
|||
return (
|
||||
<button
|
||||
onClick={handleCopy}
|
||||
className="flex items-center gap-1.5 px-2 py-1 text-[13px] whitespace-nowrap rounded-md text-black/35 hover:text-black/60 dark:text-white/35 dark:hover:text-white/60 hover:bg-black/[0.04] dark:hover:bg-white/[0.04] transition-colors"
|
||||
className="flex items-center gap-1.5 whitespace-nowrap rounded-md px-2 py-1 text-[13px] text-black/35 transition-colors hover:bg-black/[0.04] hover:text-black/60 dark:text-white/35 dark:hover:bg-white/[0.04] dark:hover:text-white/60"
|
||||
>
|
||||
{copied ? <Check className="h-4 w-4" /> : <Copy className="h-4 w-4" />}
|
||||
<span>{copied ? "Copied" : "Copy page"}</span>
|
||||
|
|
|
|||
|
|
@ -60,7 +60,9 @@ export function DocsSearch({ resolve }: { resolve: (path: string) => string }) {
|
|||
// Get all docs for showing when query is empty
|
||||
const allResult = search(db, { term: "", limit: 100 });
|
||||
const toResults = (r: typeof allResult) =>
|
||||
(r as Awaited<typeof allResult>).hits.map((hit: { document: unknown }) => hit.document as SearchResult);
|
||||
(r as Awaited<typeof allResult>).hits.map(
|
||||
(hit: { document: unknown }) => hit.document as SearchResult,
|
||||
);
|
||||
setAllDocs(toResults(allResult));
|
||||
})
|
||||
.finally(() => setLoading(false));
|
||||
|
|
@ -78,7 +80,11 @@ export function DocsSearch({ resolve }: { resolve: (path: string) => string }) {
|
|||
tolerance: 1,
|
||||
boost: { title: 3, section: 1.5 },
|
||||
}) as Awaited<ReturnType<typeof search>>;
|
||||
setResults(res.hits.map((hit: { document: unknown }) => hit.document as SearchResult));
|
||||
setResults(
|
||||
res.hits.map(
|
||||
(hit: { document: unknown }) => hit.document as SearchResult,
|
||||
),
|
||||
);
|
||||
}, [query]);
|
||||
|
||||
const displayResults = query.trim() ? results : allDocs;
|
||||
|
|
@ -93,15 +99,19 @@ export function DocsSearch({ resolve }: { resolve: (path: string) => string }) {
|
|||
<>
|
||||
<button
|
||||
onClick={() => setOpen(true)}
|
||||
className="flex items-center gap-2 w-full max-w-md h-9 rounded-lg border border-black/10 dark:border-white/10 bg-black/[0.02] dark:bg-white/[0.04] px-3 text-[13px] text-black/40 dark:text-white/40 hover:border-black/20 dark:hover:border-white/20 transition-colors"
|
||||
className="flex h-9 w-full max-w-md items-center gap-2 rounded-lg border border-black/10 bg-black/[0.02] px-3 text-[13px] text-black/40 transition-colors hover:border-black/20 dark:border-white/10 dark:bg-white/[0.04] dark:text-white/40 dark:hover:border-white/20"
|
||||
>
|
||||
<Search className="h-4 w-4 flex-shrink-0" />
|
||||
<span className="flex-1 text-left">Search...</span>
|
||||
<kbd className="hidden sm:inline-flex h-5 items-center gap-0.5 rounded border border-black/10 dark:border-white/10 bg-black/[0.03] dark:bg-white/[0.06] px-1.5 font-mono text-[10px] text-black/40 dark:text-white/40">
|
||||
<kbd className="hidden h-5 items-center gap-0.5 rounded border border-black/10 bg-black/[0.03] px-1.5 font-mono text-[10px] text-black/40 sm:inline-flex dark:border-white/10 dark:bg-white/[0.06] dark:text-white/40">
|
||||
<span className="text-xs">⌘</span>K
|
||||
</kbd>
|
||||
</button>
|
||||
<CommandDialog open={open} onOpenChange={setOpen} dialogClassName="top-[15%] translate-y-0 data-[state=closed]:slide-out-to-top-[10%] data-[state=open]:slide-in-from-top-[10%]">
|
||||
<CommandDialog
|
||||
open={open}
|
||||
onOpenChange={setOpen}
|
||||
dialogClassName="top-[15%] translate-y-0 data-[state=closed]:slide-out-to-top-[10%] data-[state=open]:slide-in-from-top-[10%]"
|
||||
>
|
||||
<CommandInput
|
||||
placeholder="Search documentation..."
|
||||
value={query}
|
||||
|
|
@ -109,7 +119,7 @@ export function DocsSearch({ resolve }: { resolve: (path: string) => string }) {
|
|||
/>
|
||||
<CommandList className="max-h-[400px]">
|
||||
{loading ? (
|
||||
<div className="py-6 text-center text-sm text-muted-foreground">
|
||||
<div className="text-muted-foreground py-6 text-center text-sm">
|
||||
Loading search index...
|
||||
</div>
|
||||
) : (
|
||||
|
|
@ -125,7 +135,7 @@ export function DocsSearch({ resolve }: { resolve: (path: string) => string }) {
|
|||
>
|
||||
<div className="flex flex-col gap-0.5">
|
||||
<span className="font-medium">{result.title}</span>
|
||||
<span className="text-xs text-muted-foreground line-clamp-1">
|
||||
<span className="text-muted-foreground line-clamp-1 text-xs">
|
||||
{result.content.slice(0, 120)}
|
||||
</span>
|
||||
</div>
|
||||
|
|
|
|||
|
|
@ -66,13 +66,13 @@ function ThemeToggle() {
|
|||
useEffect(() => setMounted(true), []);
|
||||
|
||||
if (!mounted) {
|
||||
return <div className="w-8 h-8" />;
|
||||
return <div className="h-8 w-8" />;
|
||||
}
|
||||
|
||||
return (
|
||||
<button
|
||||
onClick={() => setTheme(resolvedTheme === "dark" ? "light" : "dark")}
|
||||
className="p-2 text-black/40 dark:text-white/40 hover:text-black/70 dark:hover:text-white/70 transition-colors"
|
||||
className="p-2 text-black/40 transition-colors hover:text-black/70 dark:text-white/40 dark:hover:text-white/70"
|
||||
aria-label="Toggle theme"
|
||||
>
|
||||
{resolvedTheme === "dark" ? (
|
||||
|
|
@ -131,17 +131,17 @@ function SidebarGroup({
|
|||
<div>
|
||||
<button
|
||||
onClick={() => setOpen(!open)}
|
||||
className="flex w-full items-center justify-between py-1.5 px-2.5 -mx-2.5 text-[13px] text-black/45 dark:text-white/45 hover:text-black/70 dark:hover:text-white/70"
|
||||
className="-mx-2.5 flex w-full items-center justify-between px-2.5 py-1.5 text-[13px] text-black/45 hover:text-black/70 dark:text-white/45 dark:hover:text-white/70"
|
||||
>
|
||||
<span>{group.group}</span>
|
||||
<ChevronDown
|
||||
className={`h-3.5 w-3.5 text-black/30 dark:text-white/30 transition-transform ${
|
||||
className={`h-3.5 w-3.5 text-black/30 transition-transform dark:text-white/30 ${
|
||||
open ? "rotate-0" : "-rotate-90"
|
||||
}`}
|
||||
/>
|
||||
</button>
|
||||
{open && (
|
||||
<div className="ml-3 border-l border-black/[0.06] dark:border-white/[0.06] pl-3 space-y-0.5">
|
||||
<div className="ml-3 space-y-0.5 border-l border-black/[0.06] pl-3 dark:border-white/[0.06]">
|
||||
{group.pages.map((item, i) => (
|
||||
<SidebarItem
|
||||
key={i}
|
||||
|
|
@ -176,10 +176,10 @@ function SidebarItem({
|
|||
return (
|
||||
<Link
|
||||
href={resolve(`/docs/${item}`)}
|
||||
className={`block py-1.5 px-2.5 -mx-2.5 rounded text-[13px] transition-colors no-underline ${
|
||||
className={`-mx-2.5 block rounded px-2.5 py-1.5 text-[13px] no-underline transition-colors ${
|
||||
isActive
|
||||
? "text-black/90 dark:text-white/90 font-medium bg-black/[0.04] dark:bg-white/[0.06]"
|
||||
: "text-black/45 dark:text-white/45 hover:text-black/70 dark:hover:text-white/70"
|
||||
? "bg-black/[0.04] font-medium text-black/90 dark:bg-white/[0.06] dark:text-white/90"
|
||||
: "text-black/45 hover:text-black/70 dark:text-white/45 dark:hover:text-white/70"
|
||||
}`}
|
||||
>
|
||||
{slugToLabel(item, titleMap)}
|
||||
|
|
@ -188,7 +188,13 @@ function SidebarItem({
|
|||
}
|
||||
|
||||
return (
|
||||
<SidebarGroup group={item} currentSlug={currentSlug} titleMap={titleMap} resolve={resolve} depth={depth} />
|
||||
<SidebarGroup
|
||||
group={item}
|
||||
currentSlug={currentSlug}
|
||||
titleMap={titleMap}
|
||||
resolve={resolve}
|
||||
depth={depth}
|
||||
/>
|
||||
);
|
||||
}
|
||||
|
||||
|
|
@ -213,19 +219,20 @@ export function DocsShell({
|
|||
const [selectedTab, setSelectedTab] = useState(activeTab.tab);
|
||||
const [mobileOpen, setMobileOpen] = useState(false);
|
||||
const [mobileMenuOpen, setMobileMenuOpen] = useState(false);
|
||||
const currentTab =
|
||||
docsNav.find((t) => t.tab === selectedTab) ?? docsNav[0]!;
|
||||
const currentTab = docsNav.find((t) => t.tab === selectedTab) ?? docsNav[0]!;
|
||||
const navLinks = NAV_LINKS;
|
||||
|
||||
return (
|
||||
<div className="flex flex-col h-full">
|
||||
<div className="flex h-full flex-col">
|
||||
{/* ---- Header: nav + tabs ---- */}
|
||||
<div className="flex-shrink-0 z-30 bg-white dark:bg-[#0a0a0a]">
|
||||
<div className="z-30 flex-shrink-0 bg-white dark:bg-[#0a0a0a]">
|
||||
{/* Top nav bar */}
|
||||
<nav className="border-b border-black/[0.06] dark:border-white/[0.06]">
|
||||
<div className="flex items-center max-w-[90rem] mx-auto">
|
||||
<div className="mx-auto flex max-w-[90rem] items-center">
|
||||
{/* Logo — same width & padding as sidebar */}
|
||||
<div className={`hidden lg:flex items-center ${SIDEBAR_W} flex-shrink-0 px-5 py-3`}>
|
||||
<div
|
||||
className={`hidden items-center lg:flex ${SIDEBAR_W} flex-shrink-0 px-5 py-3`}
|
||||
>
|
||||
<Link href={resolveHref("/")} className="flex items-center">
|
||||
<img
|
||||
src="/images/continue-logo-light.png"
|
||||
|
|
@ -235,7 +242,7 @@ export function DocsShell({
|
|||
</Link>
|
||||
</div>
|
||||
{/* Mobile logo */}
|
||||
<div className="lg:hidden flex items-center px-5 py-3">
|
||||
<div className="flex items-center px-5 py-3 lg:hidden">
|
||||
<Link href={resolveHref("/")} className="flex items-center">
|
||||
<img
|
||||
src="/images/continue-logo-light.png"
|
||||
|
|
@ -245,18 +252,20 @@ export function DocsShell({
|
|||
</Link>
|
||||
</div>
|
||||
{/* Centered search */}
|
||||
<div className="flex-1 flex items-center justify-center px-5 py-3">
|
||||
<div className="flex flex-1 items-center justify-center px-5 py-3">
|
||||
<DocsSearch resolve={resolveHref} />
|
||||
</div>
|
||||
{/* Right nav */}
|
||||
<div className="flex items-center gap-6 px-5 py-3">
|
||||
<div className="hidden md:flex items-center gap-6">
|
||||
<div className="hidden items-center gap-6 md:flex">
|
||||
{navLinks.map((link) => (
|
||||
<Link
|
||||
key={link.label}
|
||||
href={link.href}
|
||||
className={`${NAV_LINK_CLASSES} ${
|
||||
link.label === "Docs" ? "text-black/70 dark:text-white/70" : ""
|
||||
link.label === "Docs"
|
||||
? "text-black/70 dark:text-white/70"
|
||||
: ""
|
||||
}`}
|
||||
>
|
||||
{link.label}
|
||||
|
|
@ -269,20 +278,20 @@ export function DocsShell({
|
|||
<ThemeToggle />
|
||||
{/* Mobile menu button */}
|
||||
<button
|
||||
className="md:hidden p-2 text-black/40 dark:text-white/40 hover:text-black/70 dark:hover:text-white/70 transition-colors"
|
||||
className="p-2 text-black/40 transition-colors hover:text-black/70 md:hidden dark:text-white/40 dark:hover:text-white/70"
|
||||
onClick={() => setMobileMenuOpen((prev) => !prev)}
|
||||
aria-label="Toggle menu"
|
||||
>
|
||||
{mobileMenuOpen ? (
|
||||
<X className="w-5 h-5" />
|
||||
<X className="h-5 w-5" />
|
||||
) : (
|
||||
<Menu className="w-5 h-5" />
|
||||
<Menu className="h-5 w-5" />
|
||||
)}
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
{mobileMenuOpen && (
|
||||
<div className="md:hidden flex flex-col gap-4 px-5 pt-4 pb-2">
|
||||
<div className="flex flex-col gap-4 px-5 pb-2 pt-4 md:hidden">
|
||||
{navLinks.map((link) => (
|
||||
<Link
|
||||
key={link.label}
|
||||
|
|
@ -306,7 +315,7 @@ export function DocsShell({
|
|||
|
||||
{/* Tab bar — aligned with sidebar */}
|
||||
<div className="border-b border-black/[0.06] dark:border-white/[0.06]">
|
||||
<div className="max-w-[90rem] mx-auto px-5 flex gap-6">
|
||||
<div className="mx-auto flex max-w-[90rem] gap-6 px-5">
|
||||
{docsNav.map((tab) => (
|
||||
<button
|
||||
key={tab.tab}
|
||||
|
|
@ -314,12 +323,12 @@ export function DocsShell({
|
|||
className={`relative py-2.5 text-sm font-medium transition-colors ${
|
||||
selectedTab === tab.tab
|
||||
? "text-black/80 dark:text-white/80"
|
||||
: "text-black/35 dark:text-white/35 hover:text-black/60 dark:hover:text-white/60"
|
||||
: "text-black/35 hover:text-black/60 dark:text-white/35 dark:hover:text-white/60"
|
||||
}`}
|
||||
>
|
||||
{tab.tab}
|
||||
{selectedTab === tab.tab && (
|
||||
<span className="absolute bottom-0 left-0 right-0 h-[2px] bg-black/70 dark:bg-white/70 rounded-full" />
|
||||
<span className="absolute bottom-0 left-0 right-0 h-[2px] rounded-full bg-black/70 dark:bg-white/70" />
|
||||
)}
|
||||
</button>
|
||||
))}
|
||||
|
|
@ -328,18 +337,28 @@ export function DocsShell({
|
|||
</div>
|
||||
|
||||
{/* ---- Content area ---- */}
|
||||
<div className="flex-1 min-h-0 flex w-full max-w-[90rem] mx-auto">
|
||||
<div className="mx-auto flex min-h-0 w-full max-w-[90rem] flex-1">
|
||||
{/* Desktop sidebar */}
|
||||
<aside className={`hidden lg:block ${SIDEBAR_W} flex-shrink-0 border-r border-black/[0.06] dark:border-white/[0.06] overflow-y-auto pt-5 pb-8 px-5`}>
|
||||
<aside
|
||||
className={`hidden lg:block ${SIDEBAR_W} flex-shrink-0 overflow-y-auto border-r border-black/[0.06] px-5 pb-8 pt-5 dark:border-white/[0.06]`}
|
||||
>
|
||||
<nav className="space-y-5">
|
||||
{currentTab.groups.map((group, i) => (
|
||||
<SidebarGroup key={i} group={group} currentSlug={currentSlug} titleMap={titleMap} resolve={resolveHref} />
|
||||
<SidebarGroup
|
||||
key={i}
|
||||
group={group}
|
||||
currentSlug={currentSlug}
|
||||
titleMap={titleMap}
|
||||
resolve={resolveHref}
|
||||
/>
|
||||
))}
|
||||
</nav>
|
||||
</aside>
|
||||
|
||||
{/* Main content */}
|
||||
<main className="flex-1 min-w-0 overflow-y-auto px-8 pt-10 pb-8 lg:px-20">{children}</main>
|
||||
<main className="min-w-0 flex-1 overflow-y-auto px-8 pb-8 pt-10 lg:px-20">
|
||||
{children}
|
||||
</main>
|
||||
|
||||
{/* Table of contents */}
|
||||
<TableOfContents headings={headings} />
|
||||
|
|
@ -347,25 +366,21 @@ export function DocsShell({
|
|||
|
||||
{/* ---- Mobile sidebar ---- */}
|
||||
<button
|
||||
className="lg:hidden fixed bottom-4 left-4 z-50 p-3 bg-black/80 dark:bg-white/80 text-white dark:text-black rounded-full shadow-lg"
|
||||
className="fixed bottom-4 left-4 z-50 rounded-full bg-black/80 p-3 text-white shadow-lg lg:hidden dark:bg-white/80 dark:text-black"
|
||||
onClick={() => setMobileOpen(!mobileOpen)}
|
||||
aria-label="Toggle sidebar"
|
||||
>
|
||||
{mobileOpen ? (
|
||||
<X className="h-5 w-5" />
|
||||
) : (
|
||||
<Menu className="h-5 w-5" />
|
||||
)}
|
||||
{mobileOpen ? <X className="h-5 w-5" /> : <Menu className="h-5 w-5" />}
|
||||
</button>
|
||||
|
||||
{mobileOpen && (
|
||||
<>
|
||||
<div
|
||||
className="lg:hidden fixed inset-0 z-40 bg-black/20 dark:bg-black/50"
|
||||
className="fixed inset-0 z-40 bg-black/20 lg:hidden dark:bg-black/50"
|
||||
onClick={() => setMobileOpen(false)}
|
||||
/>
|
||||
<aside className="lg:hidden fixed inset-y-0 left-0 z-40 w-72 bg-white dark:bg-[#0a0a0a] border-r border-black/[0.06] dark:border-white/[0.06] overflow-y-auto pt-4 pb-8 px-4 shadow-xl">
|
||||
<div className="flex gap-4 mb-4 border-b border-black/[0.06] dark:border-white/[0.06] pb-2">
|
||||
<aside className="fixed inset-y-0 left-0 z-40 w-72 overflow-y-auto border-r border-black/[0.06] bg-white px-4 pb-8 pt-4 shadow-xl lg:hidden dark:border-white/[0.06] dark:bg-[#0a0a0a]">
|
||||
<div className="mb-4 flex gap-4 border-b border-black/[0.06] pb-2 dark:border-white/[0.06]">
|
||||
{docsNav.map((tab) => (
|
||||
<button
|
||||
key={tab.tab}
|
||||
|
|
@ -373,12 +388,12 @@ export function DocsShell({
|
|||
className={`relative pb-2 text-sm font-medium transition-colors ${
|
||||
selectedTab === tab.tab
|
||||
? "text-black/80 dark:text-white/80"
|
||||
: "text-black/35 dark:text-white/35 hover:text-black/60 dark:hover:text-white/60"
|
||||
: "text-black/35 hover:text-black/60 dark:text-white/35 dark:hover:text-white/60"
|
||||
}`}
|
||||
>
|
||||
{tab.tab}
|
||||
{selectedTab === tab.tab && (
|
||||
<span className="absolute bottom-0 left-0 right-0 h-[2px] bg-black/70 dark:bg-white/70 rounded-full" />
|
||||
<span className="absolute bottom-0 left-0 right-0 h-[2px] rounded-full bg-black/70 dark:bg-white/70" />
|
||||
)}
|
||||
</button>
|
||||
))}
|
||||
|
|
|
|||
|
|
@ -14,11 +14,11 @@ export function PageNav({
|
|||
if (!prev && !next) return null;
|
||||
|
||||
return (
|
||||
<div className="flex justify-between items-center mt-16 pt-6 border-t border-black/[0.06] dark:border-white/[0.06]">
|
||||
<div className="mt-16 flex items-center justify-between border-t border-black/[0.06] pt-6 dark:border-white/[0.06]">
|
||||
{prev ? (
|
||||
<Link
|
||||
href={resolveHref(`/docs/${prev.slug}`)}
|
||||
className="flex items-center gap-2 text-sm text-black/40 dark:text-white/40 hover:text-black/70 dark:hover:text-white/70 transition-colors no-underline"
|
||||
className="flex items-center gap-2 text-sm text-black/40 no-underline transition-colors hover:text-black/70 dark:text-white/40 dark:hover:text-white/70"
|
||||
>
|
||||
<ChevronLeft className="h-4 w-4" />
|
||||
<span>{prev.title}</span>
|
||||
|
|
@ -29,7 +29,7 @@ export function PageNav({
|
|||
{next ? (
|
||||
<Link
|
||||
href={resolveHref(`/docs/${next.slug}`)}
|
||||
className="flex items-center gap-2 text-sm text-black/40 dark:text-white/40 hover:text-black/70 dark:hover:text-white/70 transition-colors no-underline"
|
||||
className="flex items-center gap-2 text-sm text-black/40 no-underline transition-colors hover:text-black/70 dark:text-white/40 dark:hover:text-white/70"
|
||||
>
|
||||
<span>{next.title}</span>
|
||||
<ChevronRight className="h-4 w-4" />
|
||||
|
|
|
|||
|
|
@ -29,8 +29,8 @@ export function TableOfContents({ headings }: { headings: Heading[] }) {
|
|||
if (headings.length === 0) return null;
|
||||
|
||||
return (
|
||||
<aside className="hidden xl:block w-56 flex-shrink-0 pt-8 pb-8 px-4 overflow-y-auto">
|
||||
<h4 className="text-xs font-medium uppercase tracking-wider text-black/30 dark:text-white/30 mb-3">
|
||||
<aside className="hidden w-56 flex-shrink-0 overflow-y-auto px-4 pb-8 pt-8 xl:block">
|
||||
<h4 className="mb-3 text-xs font-medium uppercase tracking-wider text-black/30 dark:text-white/30">
|
||||
On this page
|
||||
</h4>
|
||||
<nav className="space-y-1">
|
||||
|
|
@ -38,16 +38,12 @@ export function TableOfContents({ headings }: { headings: Heading[] }) {
|
|||
<a
|
||||
key={heading.id}
|
||||
href={`#${heading.id}`}
|
||||
className={`block text-[13px] transition-colors py-1 ${
|
||||
heading.level === 3
|
||||
? "pl-3"
|
||||
: heading.level === 4
|
||||
? "pl-6"
|
||||
: ""
|
||||
className={`block py-1 text-[13px] transition-colors ${
|
||||
heading.level === 3 ? "pl-3" : heading.level === 4 ? "pl-6" : ""
|
||||
} ${
|
||||
activeId === heading.id
|
||||
? "text-black/80 dark:text-white/80 font-medium"
|
||||
: "text-black/35 dark:text-white/35 hover:text-black/60 dark:hover:text-white/60"
|
||||
? "font-medium text-black/80 dark:text-white/80"
|
||||
: "text-black/35 hover:text-black/60 dark:text-white/35 dark:hover:text-white/60"
|
||||
}`}
|
||||
>
|
||||
{heading.text}
|
||||
|
|
|
|||
|
|
@ -39,9 +39,9 @@ export function Callout({
|
|||
|
||||
return (
|
||||
<div
|
||||
className={`my-4 flex gap-3 border-l-4 ${config.borderColor} ${config.bgColor} p-4 rounded-r-md`}
|
||||
className={`my-4 flex gap-3 border-l-4 ${config.borderColor} ${config.bgColor} rounded-r-md p-4`}
|
||||
>
|
||||
<Icon className={`h-5 w-5 mt-0.5 flex-shrink-0 ${config.iconColor}`} />
|
||||
<Icon className={`mt-0.5 h-5 w-5 flex-shrink-0 ${config.iconColor}`} />
|
||||
<div className="flex-1 text-sm [&>p:last-child]:mb-0">{children}</div>
|
||||
</div>
|
||||
);
|
||||
|
|
|
|||
|
|
@ -16,13 +16,10 @@ export function CardGroup({
|
|||
3: "grid-cols-1 sm:grid-cols-2 lg:grid-cols-3",
|
||||
4: "grid-cols-1 sm:grid-cols-2 lg:grid-cols-4",
|
||||
};
|
||||
const colClass = colClasses[Math.min(cols, 4) as 1 | 2 | 3 | 4] || colClasses[2];
|
||||
const colClass =
|
||||
colClasses[Math.min(cols, 4) as 1 | 2 | 3 | 4] || colClasses[2];
|
||||
|
||||
return (
|
||||
<div className={`my-6 grid gap-4 ${colClass}`}>
|
||||
{children}
|
||||
</div>
|
||||
);
|
||||
return <div className={`my-6 grid gap-4 ${colClass}`}>{children}</div>;
|
||||
}
|
||||
|
||||
export function Card({
|
||||
|
|
@ -37,13 +34,19 @@ export function Card({
|
|||
children?: React.ReactNode;
|
||||
}) {
|
||||
const inner = (
|
||||
<div className={`rounded-lg border border-black/[0.08] dark:border-white/[0.08] bg-white dark:bg-white/5 p-5 h-full${href ? " transition-colors hover:border-black/[0.18] dark:hover:border-white/[0.18]" : ""}`}>
|
||||
<div
|
||||
className={`rounded-lg border border-black/[0.08] bg-white p-5 dark:border-white/[0.08] dark:bg-white/5 h-full${href ? "transition-colors hover:border-black/[0.18] dark:hover:border-white/[0.18]" : ""}`}
|
||||
>
|
||||
{title && (
|
||||
<h3 className="text-[15px] font-medium text-black/80 dark:text-white/80 mb-1 !mt-0">
|
||||
<h3 className="!mt-0 mb-1 text-[15px] font-medium text-black/80 dark:text-white/80">
|
||||
{title}
|
||||
</h3>
|
||||
)}
|
||||
{children && <div className="text-sm text-black/50 dark:text-white/50">{children}</div>}
|
||||
{children && (
|
||||
<div className="text-sm text-black/50 dark:text-white/50">
|
||||
{children}
|
||||
</div>
|
||||
)}
|
||||
</div>
|
||||
);
|
||||
|
||||
|
|
@ -58,7 +61,7 @@ export function Card({
|
|||
href={href}
|
||||
target="_blank"
|
||||
rel="noopener noreferrer"
|
||||
className="no-underline !text-inherit"
|
||||
className="!text-inherit no-underline"
|
||||
>
|
||||
{inner}
|
||||
</a>
|
||||
|
|
@ -69,7 +72,7 @@ export function Card({
|
|||
const resolved = resolve(internalPath);
|
||||
|
||||
return (
|
||||
<Link href={resolved} className="no-underline !text-inherit">
|
||||
<Link href={resolved} className="!text-inherit no-underline">
|
||||
{inner}
|
||||
</Link>
|
||||
);
|
||||
|
|
|
|||
|
|
@ -58,9 +58,9 @@ export function CodeBlock({
|
|||
{children}
|
||||
</pre>
|
||||
{/* Overlay: inset matches pre's border (1px) so gradient fills to the edge */}
|
||||
<div className="absolute inset-[1px] pointer-events-none flex items-start justify-end rounded-[5px] overflow-hidden">
|
||||
<div className="pointer-events-none absolute inset-[1px] flex items-start justify-end overflow-hidden rounded-[5px]">
|
||||
<div
|
||||
className="pointer-events-auto flex items-start pt-2 pl-8"
|
||||
className="pointer-events-auto flex items-start pl-8 pt-2"
|
||||
style={{
|
||||
background:
|
||||
"linear-gradient(to right, transparent, var(--docs-code-bg-solid) 40%)",
|
||||
|
|
@ -68,7 +68,7 @@ export function CodeBlock({
|
|||
>
|
||||
<button
|
||||
onClick={handleCopy}
|
||||
className="mr-2 p-1.5 rounded-md text-black/30 dark:text-white/30 hover:text-black/60 dark:hover:text-white/60 hover:bg-black/[0.06] dark:hover:bg-white/[0.08] transition-colors"
|
||||
className="mr-2 rounded-md p-1.5 text-black/30 transition-colors hover:bg-black/[0.06] hover:text-black/60 dark:text-white/30 dark:hover:bg-white/[0.08] dark:hover:text-white/60"
|
||||
aria-label="Copy code"
|
||||
>
|
||||
{copied ? checkIcon : copyIcon}
|
||||
|
|
|
|||
|
|
@ -45,7 +45,7 @@ export function CodeGroup({ children }: { children: React.ReactNode }) {
|
|||
<TabsPrimitive.Trigger
|
||||
key={i}
|
||||
value={String(i)}
|
||||
className="px-4 py-2 text-sm text-black/40 dark:text-white/40 data-[state=active]:text-black/80 dark:data-[state=active]:text-white/80 data-[state=active]:border-b-2 data-[state=active]:border-black/80 dark:data-[state=active]:border-white/80 transition-colors -mb-px"
|
||||
className="-mb-px px-4 py-2 text-sm text-black/40 transition-colors data-[state=active]:border-b-2 data-[state=active]:border-black/80 data-[state=active]:text-black/80 dark:text-white/40 dark:data-[state=active]:border-white/80 dark:data-[state=active]:text-white/80"
|
||||
>
|
||||
{block.label}
|
||||
</TabsPrimitive.Trigger>
|
||||
|
|
@ -65,7 +65,13 @@ function extractTextContent(element: React.ReactElement): string {
|
|||
if (typeof props.children === "string") return props.children;
|
||||
if (Array.isArray(props.children)) {
|
||||
return props.children
|
||||
.map((c: any) => (typeof c === "string" ? c : isValidElement(c) ? extractTextContent(c) : ""))
|
||||
.map((c: any) =>
|
||||
typeof c === "string"
|
||||
? c
|
||||
: isValidElement(c)
|
||||
? extractTextContent(c)
|
||||
: "",
|
||||
)
|
||||
.join("");
|
||||
}
|
||||
if (isValidElement(props.children)) {
|
||||
|
|
|
|||
|
|
@ -11,11 +11,8 @@ export function Columns({
|
|||
3: "grid-cols-1 sm:grid-cols-2 lg:grid-cols-3",
|
||||
4: "grid-cols-1 sm:grid-cols-2 lg:grid-cols-4",
|
||||
};
|
||||
const colClass = colClasses[Math.min(cols, 4) as 1 | 2 | 3 | 4] || colClasses[2];
|
||||
const colClass =
|
||||
colClasses[Math.min(cols, 4) as 1 | 2 | 3 | 4] || colClasses[2];
|
||||
|
||||
return (
|
||||
<div className={`my-6 grid gap-6 ${colClass}`}>
|
||||
{children}
|
||||
</div>
|
||||
);
|
||||
return <div className={`my-6 grid gap-6 ${colClass}`}>{children}</div>;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -31,23 +31,21 @@ export function DocsAccordionGroup({
|
|||
<AccordionPrimitive.Root
|
||||
type="single"
|
||||
collapsible
|
||||
className="my-4 rounded-lg border border-black/[0.06] dark:border-white/[0.06] overflow-hidden"
|
||||
className="my-4 overflow-hidden rounded-lg border border-black/[0.06] dark:border-white/[0.06]"
|
||||
>
|
||||
{items.map((item, i) => (
|
||||
<AccordionPrimitive.Item
|
||||
key={item.value}
|
||||
value={item.value}
|
||||
className={
|
||||
i > 0
|
||||
? "border-t border-black/[0.06] dark:border-white/[0.06]"
|
||||
: ""
|
||||
i > 0 ? "border-t border-black/[0.06] dark:border-white/[0.06]" : ""
|
||||
}
|
||||
>
|
||||
<AccordionPrimitive.Trigger className="flex w-full items-center justify-between px-4 py-3 text-sm font-medium text-black/70 dark:text-white/70 hover:text-black/90 dark:hover:text-white/90 transition-colors [&[data-state=open]>svg]:rotate-180">
|
||||
<AccordionPrimitive.Trigger className="flex w-full items-center justify-between px-4 py-3 text-sm font-medium text-black/70 transition-colors hover:text-black/90 dark:text-white/70 dark:hover:text-white/90 [&[data-state=open]>svg]:rotate-180">
|
||||
{item.title}
|
||||
<ChevronDown className="h-4 w-4 flex-shrink-0 text-black/30 dark:text-white/30 transition-transform duration-200" />
|
||||
<ChevronDown className="h-4 w-4 flex-shrink-0 text-black/30 transition-transform duration-200 dark:text-white/30" />
|
||||
</AccordionPrimitive.Trigger>
|
||||
<AccordionPrimitive.Content className="overflow-hidden text-sm data-[state=closed]:animate-accordion-up data-[state=open]:animate-accordion-down">
|
||||
<AccordionPrimitive.Content className="data-[state=closed]:animate-accordion-up data-[state=open]:animate-accordion-down overflow-hidden text-sm">
|
||||
<div className="px-4 pb-4 text-black/60 dark:text-white/60">
|
||||
{item.content}
|
||||
</div>
|
||||
|
|
@ -70,14 +68,14 @@ export function DocsAccordion({
|
|||
<AccordionPrimitive.Root
|
||||
type="single"
|
||||
collapsible
|
||||
className="my-4 rounded-lg border border-black/[0.06] dark:border-white/[0.06] overflow-hidden"
|
||||
className="my-4 overflow-hidden rounded-lg border border-black/[0.06] dark:border-white/[0.06]"
|
||||
>
|
||||
<AccordionPrimitive.Item value="item">
|
||||
<AccordionPrimitive.Trigger className="flex w-full items-center justify-between px-4 py-3 text-sm font-medium text-black/70 dark:text-white/70 hover:text-black/90 dark:hover:text-white/90 transition-colors [&[data-state=open]>svg]:rotate-180">
|
||||
<AccordionPrimitive.Trigger className="flex w-full items-center justify-between px-4 py-3 text-sm font-medium text-black/70 transition-colors hover:text-black/90 dark:text-white/70 dark:hover:text-white/90 [&[data-state=open]>svg]:rotate-180">
|
||||
{title}
|
||||
<ChevronDown className="h-4 w-4 flex-shrink-0 text-black/30 dark:text-white/30 transition-transform duration-200" />
|
||||
<ChevronDown className="h-4 w-4 flex-shrink-0 text-black/30 transition-transform duration-200 dark:text-white/30" />
|
||||
</AccordionPrimitive.Trigger>
|
||||
<AccordionPrimitive.Content className="overflow-hidden text-sm data-[state=closed]:animate-accordion-up data-[state=open]:animate-accordion-down">
|
||||
<AccordionPrimitive.Content className="data-[state=closed]:animate-accordion-up data-[state=open]:animate-accordion-down overflow-hidden text-sm">
|
||||
<div className="px-4 pb-4 text-black/60 dark:text-white/60">
|
||||
{children}
|
||||
</div>
|
||||
|
|
|
|||
|
|
@ -29,7 +29,7 @@ export function DocsTabs({ children }: { children: React.ReactNode }) {
|
|||
<TabsPrimitive.Trigger
|
||||
key={i}
|
||||
value={String(i)}
|
||||
className="px-4 py-2 text-sm text-black/40 dark:text-white/40 data-[state=active]:text-black/80 dark:data-[state=active]:text-white/80 data-[state=active]:border-b-2 data-[state=active]:border-black/80 dark:data-[state=active]:border-white/80 transition-colors -mb-px"
|
||||
className="-mb-px px-4 py-2 text-sm text-black/40 transition-colors data-[state=active]:border-b-2 data-[state=active]:border-black/80 data-[state=active]:text-black/80 dark:text-white/40 dark:data-[state=active]:border-white/80 dark:data-[state=active]:text-white/80"
|
||||
>
|
||||
{tab.title}
|
||||
</TabsPrimitive.Trigger>
|
||||
|
|
|
|||
|
|
@ -13,9 +13,7 @@ export function OSAutoDetect() {
|
|||
if (isMac || isLinux) tabIndex = 0;
|
||||
else if (isWindows) tabIndex = 1;
|
||||
|
||||
const tabButtons = document.querySelectorAll(
|
||||
'[role="tablist"] button',
|
||||
);
|
||||
const tabButtons = document.querySelectorAll('[role="tablist"] button');
|
||||
if (tabButtons[tabIndex]) {
|
||||
(tabButtons[tabIndex] as HTMLButtonElement).click();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -16,7 +16,7 @@ const Command = React.forwardRef<
|
|||
<CommandPrimitive
|
||||
ref={ref}
|
||||
className={cn(
|
||||
"flex h-full w-full flex-col overflow-hidden rounded-md bg-popover text-popover-foreground",
|
||||
"bg-popover text-popover-foreground flex h-full w-full flex-col overflow-hidden rounded-md",
|
||||
className,
|
||||
)}
|
||||
{...props}
|
||||
|
|
@ -28,14 +28,20 @@ interface CommandDialogProps extends DialogProps {
|
|||
dialogClassName?: string;
|
||||
}
|
||||
|
||||
const CommandDialog = ({ children, dialogClassName, ...props }: CommandDialogProps) => {
|
||||
const CommandDialog = ({
|
||||
children,
|
||||
dialogClassName,
|
||||
...props
|
||||
}: CommandDialogProps) => {
|
||||
return (
|
||||
<Dialog {...props}>
|
||||
<DialogContent className={cn("overflow-hidden p-0 shadow-lg", dialogClassName)}>
|
||||
<DialogContent
|
||||
className={cn("overflow-hidden p-0 shadow-lg", dialogClassName)}
|
||||
>
|
||||
<VisuallyHidden>
|
||||
<DialogTitle>Search</DialogTitle>
|
||||
</VisuallyHidden>
|
||||
<Command className="[&_[cmdk-group-heading]]:px-2 [&_[cmdk-group-heading]]:font-medium [&_[cmdk-group-heading]]:text-muted-foreground [&_[cmdk-group]:not([hidden])_~[cmdk-group]]:pt-0 [&_[cmdk-group]]:px-2 [&_[cmdk-input-wrapper]_svg]:h-5 [&_[cmdk-input-wrapper]_svg]:w-5 [&_[cmdk-input]]:h-12 [&_[cmdk-item]]:px-2 [&_[cmdk-item]]:py-3 [&_[cmdk-item]_svg]:h-5 [&_[cmdk-item]_svg]:w-5">
|
||||
<Command className="[&_[cmdk-group-heading]]:text-muted-foreground [&_[cmdk-group-heading]]:px-2 [&_[cmdk-group-heading]]:font-medium [&_[cmdk-group]:not([hidden])_~[cmdk-group]]:pt-0 [&_[cmdk-group]]:px-2 [&_[cmdk-input-wrapper]_svg]:h-5 [&_[cmdk-input-wrapper]_svg]:w-5 [&_[cmdk-input]]:h-12 [&_[cmdk-item]]:px-2 [&_[cmdk-item]]:py-3 [&_[cmdk-item]_svg]:h-5 [&_[cmdk-item]_svg]:w-5">
|
||||
{children}
|
||||
</Command>
|
||||
</DialogContent>
|
||||
|
|
@ -52,7 +58,7 @@ const CommandInput = React.forwardRef<
|
|||
<CommandPrimitive.Input
|
||||
ref={ref}
|
||||
className={cn(
|
||||
"flex h-11 w-full rounded-md bg-transparent py-3 text-sm outline-none placeholder:text-muted-foreground disabled:cursor-not-allowed disabled:opacity-50",
|
||||
"placeholder:text-muted-foreground flex h-11 w-full rounded-md bg-transparent py-3 text-sm outline-none disabled:cursor-not-allowed disabled:opacity-50",
|
||||
className,
|
||||
)}
|
||||
{...props}
|
||||
|
|
@ -95,7 +101,7 @@ const CommandGroup = React.forwardRef<
|
|||
<CommandPrimitive.Group
|
||||
ref={ref}
|
||||
className={cn(
|
||||
"overflow-hidden p-1 text-foreground [&_[cmdk-group-heading]]:px-2 [&_[cmdk-group-heading]]:py-1.5 [&_[cmdk-group-heading]]:text-xs [&_[cmdk-group-heading]]:font-medium [&_[cmdk-group-heading]]:text-muted-foreground",
|
||||
"text-foreground [&_[cmdk-group-heading]]:text-muted-foreground overflow-hidden p-1 [&_[cmdk-group-heading]]:px-2 [&_[cmdk-group-heading]]:py-1.5 [&_[cmdk-group-heading]]:text-xs [&_[cmdk-group-heading]]:font-medium",
|
||||
className,
|
||||
)}
|
||||
{...props}
|
||||
|
|
@ -110,7 +116,7 @@ const CommandSeparator = React.forwardRef<
|
|||
>(({ className, ...props }, ref) => (
|
||||
<CommandPrimitive.Separator
|
||||
ref={ref}
|
||||
className={cn("-mx-1 h-px bg-border", className)}
|
||||
className={cn("bg-border -mx-1 h-px", className)}
|
||||
{...props}
|
||||
/>
|
||||
));
|
||||
|
|
@ -123,7 +129,7 @@ const CommandItem = React.forwardRef<
|
|||
<CommandPrimitive.Item
|
||||
ref={ref}
|
||||
className={cn(
|
||||
"relative flex cursor-default gap-2 select-none items-center rounded-sm px-2 py-1.5 text-sm outline-none data-[disabled=true]:pointer-events-none data-[selected='true']:bg-accent data-[selected=true]:text-accent-foreground data-[disabled=true]:opacity-50 [&_svg]:pointer-events-none [&_svg]:size-4 [&_svg]:shrink-0",
|
||||
"data-[selected='true']:bg-accent data-[selected=true]:text-accent-foreground relative flex cursor-default select-none items-center gap-2 rounded-sm px-2 py-1.5 text-sm outline-none data-[disabled=true]:pointer-events-none data-[disabled=true]:opacity-50 [&_svg]:pointer-events-none [&_svg]:size-4 [&_svg]:shrink-0",
|
||||
className,
|
||||
)}
|
||||
{...props}
|
||||
|
|
@ -139,7 +145,7 @@ const CommandShortcut = ({
|
|||
return (
|
||||
<span
|
||||
className={cn(
|
||||
"ml-auto text-xs tracking-widest text-muted-foreground",
|
||||
"text-muted-foreground ml-auto text-xs tracking-widest",
|
||||
className,
|
||||
)}
|
||||
{...props}
|
||||
|
|
|
|||
|
|
@ -21,7 +21,7 @@ const DialogOverlay = React.forwardRef<
|
|||
<DialogPrimitive.Overlay
|
||||
ref={ref}
|
||||
className={cn(
|
||||
"fixed inset-0 z-50 bg-background/80 backdrop-blur-sm data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0",
|
||||
"bg-background/80 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 fixed inset-0 z-50 backdrop-blur-sm",
|
||||
className,
|
||||
)}
|
||||
{...props}
|
||||
|
|
@ -34,17 +34,17 @@ const DialogContent = React.forwardRef<
|
|||
React.ComponentPropsWithoutRef<typeof DialogPrimitive.Content>
|
||||
>(({ className, children, ...props }, ref) => (
|
||||
<DialogPortal>
|
||||
<DialogOverlay className="overflow-y-auto flex items-center justify-center p-4">
|
||||
<DialogOverlay className="flex items-center justify-center overflow-y-auto p-4">
|
||||
<DialogPrimitive.Content
|
||||
ref={ref}
|
||||
className={cn(
|
||||
"relative z-50 my-auto grid w-full max-w-lg gap-4 border bg-background p-6 shadow-lg duration-200 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 sm:rounded-lg",
|
||||
"bg-background data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 relative z-50 my-auto grid w-full max-w-lg gap-4 border p-6 shadow-lg duration-200 sm:rounded-lg",
|
||||
className,
|
||||
)}
|
||||
{...props}
|
||||
>
|
||||
{children}
|
||||
<DialogPrimitive.Close className="absolute right-4 top-4 rounded-sm opacity-70 ring-offset-background transition-opacity hover:opacity-100 focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2 disabled:pointer-events-none data-[state=open]:bg-accent data-[state=open]:text-muted-foreground">
|
||||
<DialogPrimitive.Close className="ring-offset-background focus:ring-ring data-[state=open]:bg-accent data-[state=open]:text-muted-foreground absolute right-4 top-4 rounded-sm opacity-70 transition-opacity hover:opacity-100 focus:outline-none focus:ring-2 focus:ring-offset-2 disabled:pointer-events-none">
|
||||
<X className="h-4 w-4" />
|
||||
<span className="sr-only">Close</span>
|
||||
</DialogPrimitive.Close>
|
||||
|
|
@ -103,7 +103,7 @@ const DialogDescription = React.forwardRef<
|
|||
>(({ className, ...props }, ref) => (
|
||||
<DialogPrimitive.Description
|
||||
ref={ref}
|
||||
className={cn("text-sm text-muted-foreground", className)}
|
||||
className={cn("text-muted-foreground text-sm", className)}
|
||||
{...props}
|
||||
/>
|
||||
));
|
||||
|
|
|
|||
|
|
@ -3,8 +3,7 @@ import path from "path";
|
|||
import matter from "gray-matter";
|
||||
import { type NavItem, type NavTab } from "@/config/docsNav";
|
||||
|
||||
const DOCS_DIR =
|
||||
process.env.DOCS_DIR || path.resolve(process.cwd(), "../docs");
|
||||
const DOCS_DIR = process.env.DOCS_DIR || path.resolve(process.cwd(), "../docs");
|
||||
|
||||
export function getDocsDir() {
|
||||
return DOCS_DIR;
|
||||
|
|
@ -50,7 +49,7 @@ export function resolveDocsRedirect(slug: string[]): string | null {
|
|||
const key = slug.join("/");
|
||||
const dest = docsRedirects.get(key);
|
||||
if (!dest) return null;
|
||||
|
||||
|
||||
// Handle external URLs
|
||||
if (dest.startsWith("https://") || dest.startsWith("http://")) {
|
||||
try {
|
||||
|
|
@ -66,7 +65,7 @@ export function resolveDocsRedirect(slug: string[]): string | null {
|
|||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// Internal redirects - ensure they start with /
|
||||
return dest.startsWith("/") ? dest : `/${dest}`;
|
||||
}
|
||||
|
|
@ -77,9 +76,7 @@ export interface DocFile {
|
|||
slug: string[];
|
||||
}
|
||||
|
||||
export async function loadMdxFile(
|
||||
slug: string[],
|
||||
): Promise<DocFile | null> {
|
||||
export async function loadMdxFile(slug: string[]): Promise<DocFile | null> {
|
||||
const slugPath = slug.join("/");
|
||||
const filePath = path.join(DOCS_DIR, slugPath + ".mdx");
|
||||
|
||||
|
|
@ -103,7 +100,9 @@ export async function loadRawMdxFile(
|
|||
const filePath = path.join(DOCS_DIR, slugPath + ".mdx");
|
||||
|
||||
// Prevent path traversal — ensure the resolved path stays inside DOCS_DIR.
|
||||
const docsDirNormalized = DOCS_DIR.endsWith(path.sep) ? DOCS_DIR : DOCS_DIR + path.sep;
|
||||
const docsDirNormalized = DOCS_DIR.endsWith(path.sep)
|
||||
? DOCS_DIR
|
||||
: DOCS_DIR + path.sep;
|
||||
const isWithinDocsDir = (p: string) => p.startsWith(docsDirNormalized);
|
||||
|
||||
if (isWithinDocsDir(filePath) && fs.existsSync(filePath)) {
|
||||
|
|
@ -163,19 +162,13 @@ function preprocessMdx(content: string, slug: string[]): string {
|
|||
// Replace <SnippetName /> with inlined content
|
||||
for (const [name, body] of Array.from(snippets.entries())) {
|
||||
const selfClosing = new RegExp(`<${name}\\s*/>`, "g");
|
||||
const withChildren = new RegExp(
|
||||
`<${name}\\s*>[\\s\\S]*?</${name}>`,
|
||||
"g",
|
||||
);
|
||||
const withChildren = new RegExp(`<${name}\\s*>[\\s\\S]*?</${name}>`, "g");
|
||||
result = result.replace(selfClosing, body);
|
||||
result = result.replace(withChildren, body);
|
||||
}
|
||||
|
||||
// Strip all remaining import statements (JSX snippets handled via components map)
|
||||
result = result.replace(
|
||||
/^import\s+.*from\s+['"].*['"];?\s*$/gm,
|
||||
"",
|
||||
);
|
||||
result = result.replace(/^import\s+.*from\s+['"].*['"];?\s*$/gm, "");
|
||||
|
||||
// Convert :::warning / :::info / :::tip admonitions to JSX components
|
||||
result = result.replace(
|
||||
|
|
@ -198,16 +191,10 @@ function preprocessMdx(content: string, slug: string[]): string {
|
|||
);
|
||||
|
||||
// Rewrite image paths: /images/... → /images/docs/...
|
||||
result = result.replace(
|
||||
/src=["']\/images\//g,
|
||||
'src="/images/docs/',
|
||||
);
|
||||
result = result.replace(/src=["']\/images\//g, 'src="/images/docs/');
|
||||
|
||||
// Rewrite markdown image paths:  → 
|
||||
result = result.replace(
|
||||
/\]\(\/images\//g,
|
||||
"](/images/docs/",
|
||||
);
|
||||
result = result.replace(/\]\(\/images\//g, "](/images/docs/");
|
||||
|
||||
// Rewrite relative image paths:  → 
|
||||
// Resolve relative to the current file's directory
|
||||
|
|
|
|||
|
|
@ -10,7 +10,8 @@ export function resolveHref(path: string): string {
|
|||
if (path === "/docs") return "/";
|
||||
|
||||
// Cross-app links → absolute URLs
|
||||
if (path.startsWith("/blog")) return `https://blog.continue.dev${path.slice(5) || ""}`;
|
||||
if (path.startsWith("/blog"))
|
||||
return `https://blog.continue.dev${path.slice(5) || ""}`;
|
||||
if (path === "/login") return "https://continue.dev/login";
|
||||
if (path === "/") return "https://continue.dev";
|
||||
|
||||
|
|
|
|||
|
|
@ -97,8 +97,13 @@ async function main() {
|
|||
const data = save(db);
|
||||
const outDir = path.resolve(__dirname, "../public");
|
||||
if (!fs.existsSync(outDir)) fs.mkdirSync(outDir, { recursive: true });
|
||||
fs.writeFileSync(path.join(outDir, "search-index.json"), JSON.stringify(data));
|
||||
console.log(`Search index written to public/search-index.json (${slugs.length} docs)`);
|
||||
fs.writeFileSync(
|
||||
path.join(outDir, "search-index.json"),
|
||||
JSON.stringify(data),
|
||||
);
|
||||
console.log(
|
||||
`Search index written to public/search-index.json (${slugs.length} docs)`,
|
||||
);
|
||||
}
|
||||
|
||||
main().catch((err) => {
|
||||
|
|
|
|||
|
|
@ -8,7 +8,15 @@ import path from "path";
|
|||
const DOCS_DIR = path.resolve(__dirname, "../../docs");
|
||||
const OUT_DIR = path.resolve(__dirname, "../public/images/docs");
|
||||
|
||||
const IMAGE_EXTENSIONS = new Set([".png", ".jpg", ".jpeg", ".gif", ".svg", ".webp", ".ico"]);
|
||||
const IMAGE_EXTENSIONS = new Set([
|
||||
".png",
|
||||
".jpg",
|
||||
".jpeg",
|
||||
".gif",
|
||||
".svg",
|
||||
".webp",
|
||||
".ico",
|
||||
]);
|
||||
|
||||
function copyImagesRecursive(srcDir: string, destDir: string) {
|
||||
if (!fs.existsSync(srcDir)) return;
|
||||
|
|
|
|||
|
|
@ -1,11 +1,7 @@
|
|||
{
|
||||
"compilerOptions": {
|
||||
"target": "es5",
|
||||
"lib": [
|
||||
"dom",
|
||||
"dom.iterable",
|
||||
"esnext"
|
||||
],
|
||||
"lib": ["dom", "dom.iterable", "esnext"],
|
||||
"allowJs": true,
|
||||
"skipLibCheck": true,
|
||||
"strict": true,
|
||||
|
|
@ -23,9 +19,7 @@
|
|||
}
|
||||
],
|
||||
"paths": {
|
||||
"@/*": [
|
||||
"./*"
|
||||
]
|
||||
"@/*": ["./*"]
|
||||
}
|
||||
},
|
||||
"include": [
|
||||
|
|
@ -35,7 +29,5 @@
|
|||
".next/types/**/*.ts",
|
||||
".next/dev/types/**/*.ts"
|
||||
],
|
||||
"exclude": [
|
||||
"node_modules"
|
||||
]
|
||||
"exclude": ["node_modules"]
|
||||
}
|
||||
|
|
|
|||
|
|
@ -166,9 +166,12 @@ describe("NavigationContext", () => {
|
|||
|
||||
it("closes from any screen back to chat", () => {
|
||||
const { result } = renderHook(() => useNavigation(), { wrapper });
|
||||
const screens: Array<
|
||||
"config" | "model" | "login" | "mcp"
|
||||
> = ["config", "model", "login", "mcp"];
|
||||
const screens: Array<"config" | "model" | "login" | "mcp"> = [
|
||||
"config",
|
||||
"model",
|
||||
"login",
|
||||
"mcp",
|
||||
];
|
||||
|
||||
screens.forEach((screen) => {
|
||||
act(() => {
|
||||
|
|
|
|||
|
|
@ -27,7 +27,6 @@ export class RecentlyVisitedRangesService {
|
|||
>({
|
||||
max: this.maxRecentFiles,
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
private cacheCurrentSelectionContext = async (
|
||||
|
|
|
|||
|
|
@ -25,7 +25,6 @@ import {
|
|||
} from "./OnboardingCard";
|
||||
import OSRContextMenu from "./OSRContextMenu";
|
||||
|
||||
|
||||
const LayoutTopDiv = styled(CustomScrollbarDiv)`
|
||||
height: 100%;
|
||||
position: relative;
|
||||
|
|
@ -220,44 +219,44 @@ const Layout = () => {
|
|||
return (
|
||||
<LocalStorageProvider>
|
||||
<AuthProvider>
|
||||
<LayoutTopDiv>
|
||||
{showStagingIndicator && (
|
||||
<span
|
||||
title="Staging environment"
|
||||
className="absolute right-0 mx-1.5 h-1.5 w-1.5 rounded-full"
|
||||
style={{
|
||||
backgroundColor: "var(--vscode-list-warningForeground)",
|
||||
}}
|
||||
/>
|
||||
)}
|
||||
<OSRContextMenu />
|
||||
<div
|
||||
<LayoutTopDiv>
|
||||
{showStagingIndicator && (
|
||||
<span
|
||||
title="Staging environment"
|
||||
className="absolute right-0 mx-1.5 h-1.5 w-1.5 rounded-full"
|
||||
style={{
|
||||
scrollbarGutter: "stable both-edges",
|
||||
minHeight: "100%",
|
||||
display: "grid",
|
||||
gridTemplateRows: "1fr auto",
|
||||
backgroundColor: "var(--vscode-list-warningForeground)",
|
||||
}}
|
||||
>
|
||||
<TextDialog
|
||||
showDialog={showDialog}
|
||||
onEnter={() => {
|
||||
dispatch(setShowDialog(false));
|
||||
}}
|
||||
onClose={() => {
|
||||
dispatch(setShowDialog(false));
|
||||
}}
|
||||
message={dialogMessage}
|
||||
/>
|
||||
/>
|
||||
)}
|
||||
<OSRContextMenu />
|
||||
<div
|
||||
style={{
|
||||
scrollbarGutter: "stable both-edges",
|
||||
minHeight: "100%",
|
||||
display: "grid",
|
||||
gridTemplateRows: "1fr auto",
|
||||
}}
|
||||
>
|
||||
<TextDialog
|
||||
showDialog={showDialog}
|
||||
onEnter={() => {
|
||||
dispatch(setShowDialog(false));
|
||||
}}
|
||||
onClose={() => {
|
||||
dispatch(setShowDialog(false));
|
||||
}}
|
||||
message={dialogMessage}
|
||||
/>
|
||||
|
||||
<GridDiv>
|
||||
<Outlet />
|
||||
{/* The fatal error for chat is shown below input */}
|
||||
{!isHome && <FatalErrorIndicator />}
|
||||
</GridDiv>
|
||||
</div>
|
||||
<div style={{ fontSize: fontSize(-4) }} id="tooltip-portal-div" />
|
||||
</LayoutTopDiv>
|
||||
<GridDiv>
|
||||
<Outlet />
|
||||
{/* The fatal error for chat is shown below input */}
|
||||
{!isHome && <FatalErrorIndicator />}
|
||||
</GridDiv>
|
||||
</div>
|
||||
<div style={{ fontSize: fontSize(-4) }} id="tooltip-portal-div" />
|
||||
</LayoutTopDiv>
|
||||
</AuthProvider>
|
||||
</LocalStorageProvider>
|
||||
);
|
||||
|
|
|
|||
|
|
@ -39,8 +39,7 @@ export const streamThunkWrapper = createAsyncThunk<
|
|||
// Get the selected model from the state for error analysis
|
||||
const state = getState();
|
||||
const selectedModel = selectSelectedChatModel(state);
|
||||
const { message } =
|
||||
analyzeError(e, selectedModel);
|
||||
const { message } = analyzeError(e, selectedModel);
|
||||
|
||||
const shouldRetry =
|
||||
isOverloadedErrorMessage(message) && attempt < OVERLOADED_RETRIES;
|
||||
|
|
|
|||
|
|
@ -5,10 +5,7 @@ import { defineConfig } from "vitest/config";
|
|||
|
||||
// https://vitejs.dev/config/
|
||||
export default defineConfig({
|
||||
plugins: [
|
||||
react(),
|
||||
tailwindcss(),
|
||||
],
|
||||
plugins: [react(), tailwindcss()],
|
||||
build: {
|
||||
sourcemap: true,
|
||||
|
||||
|
|
|
|||
4
package-lock.json
generated
4
package-lock.json
generated
|
|
@ -434,6 +434,7 @@
|
|||
"integrity": "sha512-NZyJarBfL7nWwIq+FDL6Zp/yHEhePMNnnJ0y3qfieCrmNvYct8uvtiV41UvlSe6apAfk0fY1FbWx+NwfmpvtTg==",
|
||||
"dev": true,
|
||||
"license": "MIT",
|
||||
"peer": true,
|
||||
"bin": {
|
||||
"acorn": "bin/acorn"
|
||||
},
|
||||
|
|
@ -1313,6 +1314,7 @@
|
|||
"deprecated": "This version is no longer supported. Please see https://eslint.org/version-support for other options.",
|
||||
"dev": true,
|
||||
"license": "MIT",
|
||||
"peer": true,
|
||||
"dependencies": {
|
||||
"@eslint-community/eslint-utils": "^4.2.0",
|
||||
"@eslint-community/regexpp": "^4.6.1",
|
||||
|
|
@ -3539,6 +3541,7 @@
|
|||
"integrity": "sha512-QQtaxnoDJeAkDvDKWCLiwIXkTgRhwYDEQCghU9Z6q03iyek/rxRh/2lC3HB7P8sWT2xC/y5JDctPLBIGzHKbhw==",
|
||||
"dev": true,
|
||||
"license": "MIT",
|
||||
"peer": true,
|
||||
"bin": {
|
||||
"prettier": "bin/prettier.cjs"
|
||||
},
|
||||
|
|
@ -4478,6 +4481,7 @@
|
|||
"integrity": "sha512-p1diW6TqL9L07nNxvRMM7hMMw4c5XOo/1ibL4aAIGmSAt9slTE1Xgw5KWuof2uTOvCg9BY7ZRi+GaF+7sfgPeQ==",
|
||||
"dev": true,
|
||||
"license": "Apache-2.0",
|
||||
"peer": true,
|
||||
"bin": {
|
||||
"tsc": "bin/tsc",
|
||||
"tsserver": "bin/tsserver"
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue