Skip to content

armgit / dbx

Public Imported from GitHub
0

25 MB lightweight cross-platform database client for 100+ databases, including MySQL, PostgreSQL, SQLite, Redis, MongoDB, DuckDB, SQL Server, and Dameng. Built-in AI, MCP Server, CLI, desktop and Docker. | 轻量级跨平台数据库管理工具,支持 MySQL、PostgreSQL、SQLite、Redis、MongoDB、达梦等 100+ 数据库,提供桌面端、Docker、CLI、内置 AI 助手和 MCP。

docs(site): update theme and search

t8y2218b1d79a184
diff --git a/docs/app/[lang]/api/search/route.ts b/docs/app/[lang]/api/search/route.ts
index 5ad6afa071..feaae7751b 100644
--- a/docs/app/[lang]/api/search/route.ts
+++ b/docs/app/[lang]/api/search/route.ts
@@ -1,10 +1,11 @@
import { createFromSource } from 'fumadocs-core/search/server';
+import { createCjkSearchTokenizer } from '@/lib/cjkSearchTokenizer';
import { source } from '@/lib/source';
export const revalidate = false;
export const { staticGET: GET } = createFromSource(source, {
localeMap: {
- cn: { language: 'english' },
+ cn: { components: { tokenizer: createCjkSearchTokenizer() } },
},
});
diff --git a/docs/app/[lang]/docs/layout.tsx b/docs/app/[lang]/docs/layout.tsx
index dc14d61780..5eb37ec573 100644
--- a/docs/app/[lang]/docs/layout.tsx
+++ b/docs/app/[lang]/docs/layout.tsx
@@ -1,25 +1,8 @@
import type { ReactNode } from 'react';
import { DocsLayout } from 'fumadocs-ui/layouts/docs';
+import { DocsSidebarFooter, DocsSidebarLanguageButton } from '@/components/DocsSidebarFooter';
import { source } from '@/lib/source';
-function DiscordIcon() {
- return (
- <svg viewBox="0 0 24 24" fill="currentColor" width="1em" height="1em">
- <path d="M20.317 4.37a19.791 19.791 0 0 0-4.885-1.515.074.074 0 0 0-.079.037c-.21.375-.444.864-.608 1.25a18.27 18.27 0 0 0-5.487 0 12.64 12.64 0 0 0-.617-1.25.077.077 0 0 0-.079-.037A19.736 19.736 0 0 0 3.677 4.37a.07.07 0 0 0-.032.027C.533 9.046-.32 13.58.099 18.057a.082.082 0 0 0 .031.057 19.9 19.9 0 0 0 5.993 3.03.078.078 0 0 0 .084-.028c.462-.63.874-1.295 1.226-1.994a.076.076 0 0 0-.041-.106 13.107 13.107 0 0 1-1.872-.892.077.077 0 0 1-.008-.128 10.2 10.2 0 0 0 .372-.292.074.074 0 0 1 .077-.01c3.928 1.793 8.18 1.793 12.062 0a.074.074 0 0 1 .078.01c.12.098.246.198.373.292a.077.077 0 0 1-.006.127 12.299 12.299 0 0 1-1.873.892.077.077 0 0 0-.041.107c.36.698.772 1.362 1.225 1.993a.076.076 0 0 0 .084.028 19.839 19.839 0 0 0 6.002-3.03.077.077 0 0 0 .032-.054c.5-5.177-.838-9.674-3.549-13.66a.061.061 0 0 0-.031-.03zM8.02 15.33c-1.183 0-2.157-1.085-2.157-2.419 0-1.333.956-2.419 2.157-2.419 1.21 0 2.176 1.096 2.157 2.42 0 1.333-.956 2.418-2.157 2.418zm7.975 0c-1.183 0-2.157-1.085-2.157-2.419 0-1.333.955-2.419 2.157-2.419 1.21 0 2.176 1.096 2.157 2.42 0 1.333-.946 2.418-2.157 2.418z" />
- </svg>
- );
-}
-
-function QQIcon() {
- return (
- <svg viewBox="0 0 120 145" fill="currentColor" width="1em" height="1em">
- <path d="M60.503 142.237c-12.533 0-24.038-4.195-31.445-10.46-3.762 1.124-8.574 2.932-11.61 5.175-2.6 1.918-2.275 3.874-1.807 4.663 2.056 3.47 35.273 2.216 44.862 1.136zm0 0c12.535 0 24.039-4.195 31.447-10.46 3.76 1.124 8.573 2.932 11.61 5.175 2.598 1.918 2.274 3.874 1.805 4.663-2.056 3.47-35.272 2.216-44.862 1.136zm0 0" />
- <path d="M60.576 67.119c20.698-.14 37.286-4.147 42.907-5.683 1.34-.367 2.056-1.024 2.056-1.024.005-.189.085-3.37.085-5.01C105.624 27.768 92.58.001 60.5 0 28.42.001 15.375 27.769 15.375 55.401c0 1.642.08 4.822.086 5.01 0 0 .583.615 1.65.913 5.19 1.444 22.09 5.65 43.312 5.795zm56.245 23.02c-1.283-4.129-3.034-8.944-4.808-13.568 0 0-1.02-.126-1.537.023-15.913 4.623-35.202 7.57-49.9 7.392h-.153c-14.616.175-33.774-2.737-49.634-7.315-.606-.175-1.802-.1-1.802-.1-1.774 4.624-3.525 9.44-4.808 13.568-6.119 19.69-4.136 27.838-2.627 28.02 3.239.392 12.606-14.821 12.606-14.821 0 15.459 13.957 39.195 45.918 39.413h.848c31.96-.218 45.917-23.954 45.917-39.413 0 0 9.368 15.213 12.607 14.822 1.508-.183 3.491-8.332-2.627-28.021" />
- <path fill="#fff" d="M49.085 40.824c-4.352.197-8.07-4.76-8.304-11.063-.236-6.305 3.098-11.576 7.45-11.773 4.347-.195 8.064 4.76 8.3 11.065.238 6.306-3.097 11.577-7.446 11.771m31.133-11.063c-.233 6.302-3.951 11.26-8.303 11.063-4.35-.195-7.684-5.465-7.446-11.77.236-6.305 3.952-11.26 8.3-11.066 4.352.197 7.686 5.468 7.449 11.773" />
- </svg>
- );
-}
-
export default async function Layout({
params,
children,
@@ -39,26 +22,13 @@ export default async function Layout({
<span className="font-semibold">DBX</span>
</div>
),
+ children: <DocsSidebarLanguageButton />,
}}
- githubUrl="https://github.com/t8y2/dbx"
- links={[
- {
- type: 'icon',
- icon: <DiscordIcon />,
- text: 'Discord',
- url: 'https://discord.gg/W7NyVDRt6a',
- external: true,
- },
- {
- type: 'icon',
- icon: <QQIcon />,
- text: 'QQ',
- url: 'https://qm.qq.com/cgi-bin/qm/qr?k=&group_code=1087880322',
- external: true,
- },
- ]}
+ i18n={false}
+ themeSwitch={{ enabled: false }}
sidebar={{
defaultOpenLevel: 1,
+ footer: <DocsSidebarFooter />,
}}
>
{children}
diff --git a/docs/app/[lang]/layout.tsx b/docs/app/[lang]/layout.tsx
index 9c45b01741..e735122ea3 100644
--- a/docs/app/[lang]/layout.tsx
+++ b/docs/app/[lang]/layout.tsx
@@ -1,6 +1,7 @@
import type { ReactNode } from 'react';
import type { Metadata } from 'next';
import { RootProvider } from 'fumadocs-ui/provider/next';
+import { StaticSearchDialog } from '@/components/StaticSearchDialog';
import { i18nUI } from '@/lib/i18n';
import { SITE_URL, SITE_NAME, DEFAULT_DESCRIPTION } from '@/lib/metadata';
@@ -58,7 +59,13 @@ export default async function LangLayout({
const { lang } = await params;
return (
- <RootProvider i18n={i18nUI.provider(lang)} theme={{ enabled: false }}>
+ <RootProvider
+ i18n={i18nUI.provider(lang)}
+ search={{
+ SearchDialog: StaticSearchDialog,
+ }}
+ theme={{ defaultTheme: 'system', enableSystem: true }}
+ >
{children}
</RootProvider>
);
diff --git a/docs/app/global.css b/docs/app/global.css
index 7fff2a3c3c..e470f6dbe4 100644
--- a/docs/app/global.css
+++ b/docs/app/global.css
@@ -15,53 +15,53 @@
}
:root {
- --color-fd-background: hsl(210 58% 98.8%);
- --color-fd-foreground: hsl(222 48% 9%);
- --color-fd-muted: hsl(211 72% 95.5%);
- --color-fd-muted-foreground: hsl(217 13% 41%);
- --color-fd-popover: hsl(0 0% 100%);
- --color-fd-popover-foreground: hsl(222 48% 9%);
- --color-fd-card: hsl(0 0% 100%);
- --color-fd-card-foreground: hsl(222 48% 9%);
- --color-fd-border: hsl(213 42% 87%);
- --color-fd-primary: hsl(217 88% 47%);
- --color-fd-primary-foreground: hsl(0 0% 100%);
- --color-fd-secondary: hsl(211 70% 96%);
- --color-fd-secondary-foreground: hsl(222 38% 14%);
- --color-fd-accent: hsl(213 72% 93%);
- --color-fd-accent-foreground: hsl(222 42% 12%);
- --color-fd-ring: hsl(217 85% 55%);
- --dbx-surface: hsl(0 0% 100%);
- --dbx-surface-soft: hsl(211 80% 97%);
- --dbx-line: color-mix(in srgb, var(--color-fd-border) 82%, transparent);
- --dbx-blue: #2563eb;
- --dbx-sky: #0ea5e9;
- --dbx-green: #0f9f6e;
+ --color-fd-background: #fafafa;
+ --color-fd-foreground: #0a0a0a;
+ --color-fd-muted: #f5f5f5;
+ --color-fd-muted-foreground: #737373;
+ --color-fd-popover: #fff;
+ --color-fd-popover-foreground: #272727;
+ --color-fd-card: #fefefe;
+ --color-fd-card-foreground: #0a0a0a;
+ --color-fd-border: #9993;
+ --color-fd-primary: #171717;
+ --color-fd-primary-foreground: #fafafa;
+ --color-fd-secondary: #f5f5f5;
+ --color-fd-secondary-foreground: #171717;
+ --color-fd-accent: #f0f0f0;
+ --color-fd-accent-foreground: #171717;
+ --color-fd-ring: #a3a3a3;
+ --dbx-surface: #fefefe;
+ --dbx-surface-soft: #f7f7f7;
+ --dbx-line: var(--color-fd-border);
+ --dbx-blue: #171717;
+ --dbx-sky: #737373;
+ --dbx-green: #525252;
}
.dark {
- --color-fd-background: hsl(225 10% 7%);
- --color-fd-foreground: hsl(220 14% 92%);
- --color-fd-muted: hsl(225 8% 13%);
- --color-fd-muted-foreground: hsl(220 9% 68%);
- --color-fd-popover: hsl(225 10% 9%);
- --color-fd-popover-foreground: hsl(220 14% 92%);
- --color-fd-card: hsl(225 9% 10%);
- --color-fd-card-foreground: hsl(220 14% 92%);
- --color-fd-border: hsl(225 8% 22%);
- --color-fd-primary: hsl(214 100% 78%);
- --color-fd-primary-foreground: hsl(225 10% 7%);
- --color-fd-secondary: hsl(225 8% 14%);
- --color-fd-secondary-foreground: hsl(220 14% 90%);
- --color-fd-accent: hsl(225 8% 18%);
- --color-fd-accent-foreground: hsl(220 14% 94%);
- --color-fd-ring: hsl(214 100% 75%);
- --dbx-surface: hsl(225 9% 10%);
- --dbx-surface-soft: hsl(225 8% 13%);
- --dbx-line: color-mix(in srgb, var(--color-fd-border) 78%, transparent);
- --dbx-blue: #60a5fa;
- --dbx-sky: #38bdf8;
- --dbx-green: #34d399;
+ --color-fd-background: #050505;
+ --color-fd-foreground: #fafafa;
+ --color-fd-muted: #141414;
+ --color-fd-muted-foreground: #999;
+ --color-fd-popover: #0a0a0a;
+ --color-fd-popover-foreground: #fafafa;
+ --color-fd-card: #0a0a0a;
+ --color-fd-card-foreground: #fafafa;
+ --color-fd-border: #80808033;
+ --color-fd-primary: #fafafa;
+ --color-fd-primary-foreground: #171717;
+ --color-fd-secondary: #212121;
+ --color-fd-secondary-foreground: #fafafa;
+ --color-fd-accent: #262626;
+ --color-fd-accent-foreground: #fff;
+ --color-fd-ring: #595959;
+ --dbx-surface: #0a0a0a;
+ --dbx-surface-soft: #141414;
+ --dbx-line: var(--color-fd-border);
+ --dbx-blue: #fafafa;
+ --dbx-sky: #999;
+ --dbx-green: #d4d4d4;
}
html {
@@ -75,11 +75,7 @@ html {
body {
min-height: 100vh;
- background:
- radial-gradient(circle at 18% -8%, color-mix(in srgb, var(--dbx-sky) 13%, transparent), transparent 340px),
- radial-gradient(circle at 84% 2%, color-mix(in srgb, var(--dbx-blue) 10%, transparent), transparent 330px),
- linear-gradient(180deg, color-mix(in srgb, var(--color-fd-muted) 58%, transparent), transparent 390px),
- var(--color-fd-background);
+ background: var(--color-fd-background);
text-rendering: optimizeLegibility;
}
@@ -88,7 +84,7 @@ body {
}
::selection {
- background: color-mix(in srgb, var(--dbx-blue) 22%, transparent);
+ background: color-mix(in srgb, var(--color-fd-primary) 18%, transparent);
}
article {
@@ -123,7 +119,7 @@ article p {
article a:not([class]) {
color: var(--dbx-blue);
font-weight: 560;
- text-decoration-color: color-mix(in srgb, var(--dbx-blue) 34%, transparent);
+ text-decoration-color: color-mix(in srgb, var(--color-fd-primary) 32%, transparent);
text-underline-offset: 3px;
}
@@ -170,7 +166,7 @@ article tr:last-child td {
article pre {
border: 1px solid color-mix(in srgb, var(--color-fd-border) 70%, transparent);
border-radius: 10px;
- background: #0b1220 !important;
+ background: #0a0a0a !important;
margin: 1rem 0 1.35rem;
padding: 0.9rem 0;
overflow-x: auto;
@@ -182,13 +178,13 @@ article pre code {
min-width: max-content;
border: 0;
background: transparent !important;
- color: #d7e2f0;
+ color: #e5e5e5;
font-size: 0.92rem;
line-height: 1.72;
}
article pre code span {
- color: var(--shiki-dark, #d7e2f0) !important;
+ color: var(--shiki-dark, #e5e5e5) !important;
font-style: var(--shiki-dark-font-style, inherit);
}
@@ -200,7 +196,7 @@ article pre .line {
article figure.shiki {
border-color: color-mix(in srgb, var(--color-fd-border) 74%, transparent);
border-radius: 9px;
- background: #0b1220 !important;
+ background: #0a0a0a !important;
margin: 0.85rem 0 1.05rem;
box-shadow: 0 12px 28px color-mix(in srgb, black 12%, transparent);
}
@@ -236,18 +232,15 @@ article a.block.rounded-xl,
article a.flex.rounded-lg {
border-color: var(--dbx-line);
border-radius: 9px;
- background:
- linear-gradient(180deg, color-mix(in srgb, var(--dbx-sky) 4%, var(--dbx-surface)), var(--dbx-surface)),
- var(--dbx-surface);
+ background: var(--dbx-surface);
box-shadow: 0 1px 2px color-mix(in srgb, black 4%, transparent);
}
article a.block.rounded-xl:hover,
article a.flex.rounded-lg:hover {
- border-color: color-mix(in srgb, var(--dbx-blue) 42%, var(--dbx-line));
- background:
- linear-gradient(180deg, color-mix(in srgb, var(--dbx-sky) 9%, var(--dbx-surface)), var(--dbx-surface));
- box-shadow: 0 12px 34px color-mix(in srgb, var(--dbx-blue) 12%, transparent);
+ border-color: color-mix(in srgb, var(--color-fd-primary) 28%, var(--dbx-line));
+ background: color-mix(in srgb, var(--color-fd-accent) 58%, var(--dbx-surface));
+ box-shadow: 0 10px 28px color-mix(in srgb, black 7%, transparent);
}
article [role='tablist'].not-prose {
@@ -278,15 +271,57 @@ article div[class*='border'] {
aside a[href*='/docs/'][class*='rounded-lg'][data-active='true'],
aside a[href*='/docs/'][class*='rounded-lg'][aria-current='page'] {
- background: linear-gradient(
- 90deg,
- color-mix(in srgb, var(--dbx-blue) 18%, var(--color-fd-accent)),
- color-mix(in srgb, var(--dbx-sky) 10%, var(--color-fd-accent))
- );
- color: var(--color-fd-foreground);
+ background: color-mix(in srgb, var(--color-fd-primary) 5%, var(--color-fd-accent));
+ color: var(--color-fd-primary);
font-weight: 650;
}
+.dbx-docs-sidebar-footer {
+ padding-top: 0.5rem;
+}
+
+#nd-sidebar .dbx-docs-sidebar-footer {
+ border-top: 1px solid var(--dbx-line);
+ margin-inline: -1rem;
+ padding: 0.8rem 1rem 0;
+}
+
+.dbx-docs-sidebar-tools {
+ display: flex;
+ align-items: center;
+ justify-content: space-between;
+ gap: 0.75rem;
+}
+
+.dbx-docs-sidebar-tools a,
+.dbx-docs-sidebar-tools button {
+ outline-offset: 2px;
+}
+
+.dbx-docs-theme-switch {
+ border-color: color-mix(in srgb, var(--color-fd-border) 82%, transparent);
+ background: color-mix(in srgb, var(--color-fd-secondary) 72%, transparent);
+ padding: 0.125rem;
+ box-shadow: 0 1px 2px color-mix(in srgb, black 5%, transparent);
+}
+
+.dbx-docs-theme-switch [class*='size-6.5'] {
+ width: 1.55rem;
+ height: 1.55rem;
+ padding: 0.33rem;
+}
+
+.dbx-docs-theme-switch [class*='bg-fd-accent'] {
+ background: var(--color-fd-popover);
+ box-shadow:
+ 0 1px 2px color-mix(in srgb, black 8%, transparent),
+ 0 0 0 1px color-mix(in srgb, var(--color-fd-border) 64%, transparent);
+}
+
+.dark .dbx-docs-theme-switch [class*='bg-fd-accent'] {
+ background: color-mix(in srgb, var(--color-fd-accent) 72%, var(--color-fd-popover));
+}
+
button,
a {
-webkit-tap-highlight-color: transparent;
diff --git a/docs/app/layout.tsx b/docs/app/layout.tsx
index c4124c5b40..96426552f5 100644
--- a/docs/app/layout.tsx
+++ b/docs/app/layout.tsx
@@ -26,7 +26,7 @@ export const metadata: Metadata = {
export default function RootLayout({ children }: { children: ReactNode }) {
return (
- <html className="dark" suppressHydrationWarning>
+ <html suppressHydrationWarning>
<head>
<script
type="application/ld+json"
diff --git a/docs/components/DocsSidebarFooter.tsx b/docs/components/DocsSidebarFooter.tsx
new file mode 100644
index 0000000000..4559a1c878
--- /dev/null
+++ b/docs/components/DocsSidebarFooter.tsx
@@ -0,0 +1,100 @@
+'use client';
+
+import { Languages } from 'lucide-react';
+import { LanguageSelect } from 'fumadocs-ui/layouts/shared/slots/language-select';
+import { ThemeSwitch } from 'fumadocs-ui/layouts/shared/slots/theme-switch';
+
+const iconButton =
+ 'inline-flex size-8 items-center justify-center rounded-md text-fd-muted-foreground transition-colors hover:bg-fd-accent hover:text-fd-accent-foreground';
+
+function GithubIcon() {
+ return (
+ <svg role="img" viewBox="0 0 24 24" fill="currentColor" className="size-4.5">
+ <path d="M12 .297c-6.63 0-12 5.373-12 12 0 5.303 3.438 9.8 8.205 11.385.6.113.82-.258.82-.577 0-.285-.01-1.04-.015-2.04-3.338.724-4.042-1.61-4.042-1.61C4.422 18.07 3.633 17.7 3.633 17.7c-1.087-.744.084-.729.084-.729 1.205.084 1.838 1.236 1.838 1.236 1.07 1.835 2.809 1.305 3.495.998.108-.776.417-1.305.76-1.605-2.665-.3-5.466-1.332-5.466-5.93 0-1.31.465-2.38 1.235-3.22-.135-.303-.54-1.523.105-3.176 0 0 1.005-.322 3.3 1.23.96-.267 1.98-.399 3-.405 1.02.006 2.04.138 3 .405 2.28-1.552 3.285-1.23 3.285-1.23.645 1.653.24 2.873.12 3.176.765.84 1.23 1.91 1.23 3.22 0 4.61-2.805 5.625-5.475 5.92.42.36.81 1.096.81 2.22 0 1.606-.015 2.896-.015 3.286 0 .315.21.69.825.57C20.565 22.092 24 17.592 24 12.297c0-6.627-5.373-12-12-12" />
+ </svg>
+ );
+}
+
+function DiscordIcon() {
+ return (
+ <svg viewBox="0 0 24 24" fill="currentColor" className="size-4.5">
+ <path d="M20.317 4.37a19.791 19.791 0 0 0-4.885-1.515.074.074 0 0 0-.079.037c-.21.375-.444.864-.608 1.25a18.27 18.27 0 0 0-5.487 0 12.64 12.64 0 0 0-.617-1.25.077.077 0 0 0-.079-.037A19.736 19.736 0 0 0 3.677 4.37a.07.07 0 0 0-.032.027C.533 9.046-.32 13.58.099 18.057a.082.082 0 0 0 .031.057 19.9 19.9 0 0 0 5.993 3.03.078.078 0 0 0 .084-.028c.462-.63.874-1.295 1.226-1.994a.076.076 0 0 0-.041-.106 13.107 13.107 0 0 1-1.872-.892.077.077 0 0 1-.008-.128 10.2 10.2 0 0 0 .372-.292.074.074 0 0 1 .077-.01c3.928 1.793 8.18 1.793 12.062 0a.074.074 0 0 1 .078.01c.12.098.246.198.373.292a.077.077 0 0 1-.006.127 12.299 12.299 0 0 1-1.873.892.077.077 0 0 0-.041.107c.36.698.772 1.362 1.225 1.993a.076.076 0 0 0 .084.028 19.839 19.839 0 0 0 6.002-3.03.077.077 0 0 0 .032-.054c.5-5.177-.838-9.674-3.549-13.66a.061.061 0 0 0-.031-.03zM8.02 15.33c-1.183 0-2.157-1.085-2.157-2.419 0-1.333.956-2.419 2.157-2.419 1.21 0 2.176 1.096 2.157 2.42 0 1.333-.956 2.418-2.157 2.418zm7.975 0c-1.183 0-2.157-1.085-2.157-2.419 0-1.333.955-2.419 2.157-2.419 1.21 0 2.176 1.096 2.157 2.42 0 1.333-.946 2.418-2.157 2.418z" />
+ </svg>
+ );
+}
+
+function QQIcon() {
+ return (
+ <svg viewBox="0 0 120 145" fill="currentColor" className="size-4.5">
+ <path d="M60.503 142.237c-12.533 0-24.038-4.195-31.445-10.46-3.762 1.124-8.574 2.932-11.61 5.175-2.6 1.918-2.275 3.874-1.807 4.663 2.056 3.47 35.273 2.216 44.862 1.136zm0 0c12.535 0 24.039-4.195 31.447-10.46 3.76 1.124 8.573 2.932 11.61 5.175 2.598 1.918 2.274 3.874 1.805 4.663-2.056 3.47-35.272 2.216-44.862 1.136zm0 0" />
+ <path d="M60.576 67.119c20.698-.14 37.286-4.147 42.907-5.683 1.34-.367 2.056-1.024 2.056-1.024.005-.189.085-3.37.085-5.01C105.624 27.768 92.58.001 60.5 0 28.42.001 15.375 27.769 15.375 55.401c0 1.642.08 4.822.086 5.01 0 0 .583.615 1.65.913 5.19 1.444 22.09 5.65 43.312 5.795zm56.245 23.02c-1.283-4.129-3.034-8.944-4.808-13.568 0 0-1.02-.126-1.537.023-15.913 4.623-35.202 7.57-49.9 7.392h-.153c-14.616.175-33.774-2.737-49.634-7.315-.606-.175-1.802-.1-1.802-.1-1.774 4.624-3.525 9.44-4.808 13.568-6.119 19.69-4.136 27.838-2.627 28.02 3.239.392 12.606-14.821 12.606-14.821 0 15.459 13.957 39.195 45.918 39.413h.848c31.96-.218 45.917-23.954 45.917-39.413 0 0 9.368 15.213 12.607 14.822 1.508-.183 3.491-8.332-2.627-28.021" />
+ <path fill="#fff" d="M49.085 40.824c-4.352.197-8.07-4.76-8.304-11.063-.236-6.305 3.098-11.576 7.45-11.773 4.347-.195 8.064 4.76 8.3 11.065.238 6.306-3.097 11.577-7.446 11.771m31.133-11.063c-.233 6.302-3.951 11.26-8.303 11.063-4.35-.195-7.684-5.465-7.446-11.77.236-6.305 3.952-11.26 8.3-11.066 4.352.197 7.686 5.468 7.449 11.773" />
+ </svg>
+ );
+}
+
+function WeChatIcon() {
+ return (
+ <svg viewBox="1.5 3 21 17" fill="currentColor" className="size-4.5">
+ <path d="M9.5 4C5.36 4 2 6.69 2 10c0 1.89 1.08 3.56 2.78 4.66l-.7 2.1 2.46-1.23c.87.27 1.8.42 2.78.42.24 0 .48-.01.71-.03A5.93 5.93 0 0 1 10 14c0-3.31 3.13-6 7-6 .34 0 .67.03 1 .07C17.27 5.56 13.72 4 9.5 4zm-3 4.5a1 1 0 1 1 0-2 1 1 0 0 1 0 2zm5 0a1 1 0 1 1 0-2 1 1 0 0 1 0 2zM22 14c0-2.76-2.69-5-6-5s-6 2.24-6 5 2.69 5 6 5c.73 0 1.43-.11 2.09-.3l1.72.86-.49-1.46C20.94 17.07 22 15.64 22 14zm-7.5-.5a.75.75 0 1 1 0-1.5.75.75 0 0 1 0 1.5zm4 0a.75.75 0 1 1 0-1.5.75.75 0 0 1 0 1.5z" />
+ </svg>
+ );
+}
+
+export function DocsSidebarLanguageButton() {
+ return (
+ <div className="flex justify-end pe-1">
+ <LanguageSelect className={iconButton} variant="ghost">
+ <Languages className="size-4.5" />
+ </LanguageSelect>
+ </div>
+ );
+}
+
+export function DocsSidebarFooter() {
+ return (
+ <div className="dbx-docs-sidebar-footer">
+ <div className="dbx-docs-sidebar-tools">
+ <div className="flex items-center gap-1">
+ <a
+ className={iconButton}
+ href="https://github.com/t8y2/dbx"
+ target="_blank"
+ rel="noreferrer"
+ aria-label="GitHub"
+ >
+ <GithubIcon />
+ </a>
+ <a
+ className={iconButton}
+ href="https://discord.gg/W7NyVDRt6a"
+ target="_blank"
+ rel="noreferrer"
+ aria-label="Discord"
+ >
+ <DiscordIcon />
+ </a>
+ <a
+ className={iconButton}
+ href="https://qm.qq.com/cgi-bin/qm/qr?k=&group_code=1087880322"
+ target="_blank"
+ rel="noreferrer"
+ aria-label="QQ"
+ >
+ <QQIcon />
+ </a>
+ <a
+ className={iconButton}
+ href="https://docs.qq.com/doc/DVVhMY0h1ekJqc0tz"
+ target="_blank"
+ rel="noreferrer"
+ aria-label="WeChat"
+ >
+ <WeChatIcon />
+ </a>
+ </div>
+ <ThemeSwitch mode="light-dark" className="dbx-docs-theme-switch" />
+ </div>
+ </div>
+ );
+}
diff --git a/docs/components/StaticSearchDialog.tsx b/docs/components/StaticSearchDialog.tsx
new file mode 100644
index 0000000000..2069b641bd
--- /dev/null
+++ b/docs/components/StaticSearchDialog.tsx
@@ -0,0 +1,66 @@
+'use client';
+
+import { create } from '@orama/orama';
+import { useDocsSearch } from 'fumadocs-core/search/client';
+import {
+ SearchDialog,
+ SearchDialogClose,
+ SearchDialogContent,
+ SearchDialogFooter,
+ SearchDialogHeader,
+ SearchDialogIcon,
+ SearchDialogInput,
+ SearchDialogList,
+ SearchDialogOverlay,
+} from 'fumadocs-ui/components/dialog/search';
+import type { SharedProps } from 'fumadocs-ui/contexts/search';
+import { useI18n } from 'fumadocs-ui/contexts/i18n';
+import { useMemo, useState } from 'react';
+import { createCjkSearchTokenizer } from '@/lib/cjkSearchTokenizer';
+
+export function StaticSearchDialog(props: SharedProps) {
+ const { locale } = useI18n();
+ const [tag] = useState<string | undefined>();
+ const api = `/${locale ?? 'en'}/api/search`;
+ const { search, setSearch, query } = useDocsSearch({
+ type: 'static',
+ from: api,
+ locale,
+ tag,
+ delayMs: 100,
+ initOrama: (dbLocale) => {
+ if (dbLocale === 'cn') {
+ return create({
+ schema: { _: 'string' },
+ components: { tokenizer: createCjkSearchTokenizer() },
+ });
+ }
+
+ return create({
+ schema: { _: 'string' },
+ language: 'english',
+ });
+ },
+ });
+ const defaultItems = useMemo(() => null, []);
+
+ return (
+ <SearchDialog
+ search={search}
+ onSearchChange={setSearch}
+ isLoading={query.isLoading}
+ {...props}
+ >
+ <SearchDialogOverlay />
+ <SearchDialogContent>
+ <SearchDialogHeader>
+ <SearchDialogIcon />
+ <SearchDialogInput />
+ <SearchDialogClose />
+ </SearchDialogHeader>
+ <SearchDialogList items={query.data !== 'empty' ? query.data : defaultItems} />
+ </SearchDialogContent>
+ <SearchDialogFooter />
+ </SearchDialog>
+ );
+}
diff --git a/docs/lib/cjkSearchTokenizer.ts b/docs/lib/cjkSearchTokenizer.ts
new file mode 100644
index 0000000000..f80421fe40
--- /dev/null
+++ b/docs/lib/cjkSearchTokenizer.ts
@@ -0,0 +1,41 @@
+const asciiTokenPattern = /[a-z0-9_'-]+/gi;
+const hanTokenPattern = /[\u3400-\u9fff]+/g;
+
+function unique(tokens: string[]) {
+ return Array.from(new Set(tokens.filter(Boolean)));
+}
+
+function tokenizeCjkText(input: string) {
+ const source = input.toLowerCase();
+ const tokens: string[] = [];
+
+ for (const match of source.matchAll(asciiTokenPattern)) {
+ tokens.push(match[0]);
+ }
+
+ for (const match of source.matchAll(hanTokenPattern)) {
+ const text = match[0];
+ tokens.push(text);
+
+ for (const char of text) {
+ tokens.push(char);
+ }
+
+ for (let index = 0; index < text.length - 1; index += 1) {
+ tokens.push(text.slice(index, index + 2));
+ }
+ }
+
+ return unique(tokens);
+}
+
+export function createCjkSearchTokenizer() {
+ return {
+ language: 'cjk',
+ normalizationCache: new Map<string, string>(),
+ tokenize(raw: string) {
+ if (typeof raw !== 'string') return [raw];
+ return tokenizeCjkText(raw);
+ },
+ };
+}
diff --git a/docs/lib/i18n.ts b/docs/lib/i18n.ts
index 80f0d3f7d3..a7908108e8 100644
--- a/docs/lib/i18n.ts
+++ b/docs/lib/i18n.ts
@@ -8,5 +8,17 @@ export const i18n = defineI18n({
export const i18nUI = defineI18nUI(i18n, {
en: { displayName: 'English' },
- cn: { displayName: '简体中文' },
+ cn: {
+ displayName: '简体中文',
+ search: '搜索',
+ searchNoResult: '没有找到结果',
+ toc: '本页目录',
+ tocNoHeadings: '没有目录',
+ lastUpdate: '最后更新',
+ chooseLanguage: '选择语言',
+ nextPage: '下一页',
+ previousPage: '上一页',
+ chooseTheme: '选择主题',
+ editOnGithub: '在 GitHub 上编辑',
+ },
});
diff --git a/docs/lib/source.ts b/docs/lib/source.ts
index 7b267de326..7dddf33dcb 100644
--- a/docs/lib/source.ts
+++ b/docs/lib/source.ts
@@ -1,9 +1,64 @@
import { loader } from 'fumadocs-core/source';
+import { icons } from 'lucide-react';
+import { createElement } from 'react';
import { i18n } from '@/lib/i18n';
import { docs } from '@/.source/server';
+const pageIcons: Record<string, keyof typeof icons> = {
+ 'what-is-dbx': 'BookOpen',
+ changelog: 'History',
+ 'getting-started': 'Rocket',
+ databases: 'Database',
+ 'query-editor': 'SquareTerminal',
+ 'data-grid': 'Table2',
+ 'schema-browser': 'Network',
+ redis: 'KeyRound',
+ mongodb: 'Braces',
+ 'object-browser': 'Package',
+ 'schema-diff': 'GitCompareArrows',
+ 'data-transfer': 'ArrowRightLeft',
+ 'table-structure': 'TableProperties',
+ 'field-lineage': 'GitBranch',
+ 'table-import': 'Upload',
+ 'sql-file': 'FileCode2',
+ 'database-export': 'Download',
+ 'sql-snippets': 'ScrollText',
+ 'ai-assistant': 'Bot',
+ cli: 'Terminal',
+ mcp: 'Cable',
+ plugins: 'Plug',
+ 'driver-management': 'Package',
+ 'keyboard-shortcuts': 'Keyboard',
+ 'connection-import': 'Import',
+ 'config-export': 'FileUp',
+ 'ssh-tunnel': 'ShieldCheck',
+};
+
export const source = loader({
baseUrl: '/docs',
source: docs.toFumadocsSource(),
i18n,
+ plugins: [
+ {
+ name: 'dbx-sidebar-icons',
+ transformPageTree: {
+ file(node) {
+ const slug = node.url.split('/').filter(Boolean).at(-1);
+ const iconName = slug ? pageIcons[slug] : undefined;
+ const Icon = iconName ? icons[iconName] : undefined;
+
+ if (!Icon) return node;
+
+ return {
+ ...node,
+ icon: createElement(Icon, {
+ 'aria-hidden': true,
+ className: 'size-4',
+ strokeWidth: 2,
+ }),
+ };
+ },
+ },
+ },
+ ],
});
diff --git a/docs/package.json b/docs/package.json
index a6d01e30e7..5bc479685c 100644
--- a/docs/package.json
+++ b/docs/package.json
@@ -9,6 +9,7 @@
"postinstall": "fumadocs-mdx"
},
"dependencies": {
+ "@orama/orama": "3.1.18",
"@tailwindcss/postcss": "^4.2.4",
"@types/mdx": "^2.0.13",
"@types/react": "^19.2.14",
diff --git a/docs/pnpm-lock.yaml b/docs/pnpm-lock.yaml
index 77239b432f..3f1abade17 100644
--- a/docs/pnpm-lock.yaml
+++ b/docs/pnpm-lock.yaml
@@ -8,6 +8,9 @@ importers:
.:
dependencies:
+ '@orama/orama':
+ specifier: 3.1.18
+ version: 3.1.18
'@tailwindcss/postcss':
specifier: ^4.2.4
version: 4.2.4