diff --git a/examples/next/app/global.css b/examples/next/app/global.css index 3c489baa..570aa881 100644 --- a/examples/next/app/global.css +++ b/examples/next/app/global.css @@ -1,2 +1,2 @@ @import "tailwindcss"; -@import "@farming-labs/theme/colorful/css"; +@import "@farming-labs/theme/threadline/css"; diff --git a/examples/next/app/layout.tsx b/examples/next/app/layout.tsx index c6731981..f2680d01 100644 --- a/examples/next/app/layout.tsx +++ b/examples/next/app/layout.tsx @@ -45,7 +45,7 @@ export const metadata: Metadata = { export default function RootLayout({ children }: { children: React.ReactNode }) { return ( - + diff --git a/examples/next/docs.config.tsx b/examples/next/docs.config.tsx index 3364638b..5de5e033 100644 --- a/examples/next/docs.config.tsx +++ b/examples/next/docs.config.tsx @@ -18,7 +18,7 @@ import { Users, Mail, } from "lucide-react"; -import { colorful } from "@farming-labs/theme/colorful"; +import { threadline, threadlinePageActions } from "@farming-labs/theme/threadline"; const typesenseBaseUrl = process.env.TYPESENSE_URL ?? process.env.TYPESENSE_BASE_URL; const typesenseCollection = process.env.TYPESENSE_COLLECTION ?? "docs"; @@ -97,13 +97,7 @@ export default defineDocs({ baseBranch: "main", }, }, - theme: colorful({ - ui: { - layout: { - sidebarWidth: 300, - }, - }, - }), + theme: threadline(), ai: { enabled: true, // mode: "sidebar-icon", @@ -183,56 +177,9 @@ export default defineDocs({ sidebar: { flat: true }, breadcrumb: { enabled: true }, - lastUpdated: { position: "below-title" }, + lastUpdated: false, - pageActions: { - alignment: "right", - copyMarkdown: { enabled: true }, - openDocs: { - enabled: true, - target: "markdown", - prompt: "Read this documentation: {url}", - providers: [ - { - id: "github", - name: "GitHub", - icon: ( - - - - ), - }, - { - id: "chatgpt", - name: "ChatGPT", - icon: ( - - - - ), - }, - { - id: "claude", - name: "Claude", - icon: ( - - - - - ), - }, - { - id: "cursor", - name: "Cursor", - icon: ( - - - - ), - }, - ], - }, - }, + pageActions: threadlinePageActions, ordering: "numeric", metadata: { titleTemplate: "%s – Docs", @@ -240,7 +187,7 @@ export default defineDocs({ }, themeToggle: { enabled: true, - default: "dark", + default: "light", }, og: { enabled: true, diff --git a/examples/next/next.config.ts b/examples/next/next.config.ts index fc3d41d5..7be56ae6 100644 --- a/examples/next/next.config.ts +++ b/examples/next/next.config.ts @@ -8,6 +8,7 @@ export default withDocs({ // workspace builds don't fail when example dev is already running. distDir: process.env.NODE_ENV === "production" && !process.env.VERCEL ? ".next-build" : ".next", allowedDevOrigins: ["127.0.0.1"], + devIndicators: false, turbopack: { root: repoRoot, }, diff --git a/packages/docs/src/types.ts b/packages/docs/src/types.ts index d0e32655..b865607b 100644 --- a/packages/docs/src/types.ts +++ b/packages/docs/src/types.ts @@ -718,10 +718,11 @@ export interface PageActionsConfig { * * - `"below-title"` — render below the first `

` heading (default) * - `"above-title"` — render above the page title / content + * - `"toc"` — render as a compact rail in the table-of-contents column * * @default "below-title" */ - position?: "above-title" | "below-title"; + position?: "above-title" | "below-title" | "toc"; /** * Horizontal alignment of page action buttons. * diff --git a/packages/fumadocs/package.json b/packages/fumadocs/package.json index 612871a5..e5de1418 100644 --- a/packages/fumadocs/package.json +++ b/packages/fumadocs/package.json @@ -88,6 +88,11 @@ "import": "./dist/ledger/index.mjs", "default": "./dist/ledger/index.mjs" }, + "./threadline": { + "types": "./dist/threadline/index.d.mts", + "import": "./dist/threadline/index.mjs", + "default": "./dist/threadline/index.mjs" + }, "./search": { "types": "./dist/search.d.mts", "import": "./dist/search.mjs", @@ -121,6 +126,7 @@ "./concrete/css": "./styles/concrete.css", "./command-grid/css": "./styles/command-grid.css", "./ledger/css": "./styles/ledger.css", + "./threadline/css": "./styles/threadline.css", "./presets/neutral": "./styles/presets/neutral.css", "./presets/black": "./styles/presets/black.css", "./presets/base": "./styles/presets/base.css" diff --git a/packages/fumadocs/src/docs-page-client.tsx b/packages/fumadocs/src/docs-page-client.tsx index d68a5024..688088e1 100644 --- a/packages/fumadocs/src/docs-page-client.tsx +++ b/packages/fumadocs/src/docs-page-client.tsx @@ -1,16 +1,7 @@ "use client"; import { DocsBody, DocsPage, EditOnGitHub } from "fumadocs-ui/layouts/docs/page"; -import { - Children, - Fragment, - cloneElement, - isValidElement, - useEffect, - useState, - type CSSProperties, - type ReactNode, -} from "react"; +import { Children, Fragment, useEffect, useState, type CSSProperties, type ReactNode } from "react"; import { createPortal } from "react-dom"; import { usePathname, useRouter } from "fumadocs-core/framework"; import type { DocsFeedbackData } from "@farming-labs/docs"; @@ -39,11 +30,6 @@ interface TOCItem { depth: number; } -interface TitleInsertions { - description?: ReactNode; - belowTitle?: ReactNode; -} - /** Serializable provider — icon is an HTML string, not JSX. */ interface SerializedProvider { name: string; @@ -70,7 +56,7 @@ interface DocsPageClientProps { openDocsTarget?: "markdown" | "page" | "source" | "github"; openDocsPrompt?: string; /** Where to render page actions relative to the title */ - pageActionsPosition?: "above-title" | "below-title"; + pageActionsPosition?: "above-title" | "below-title" | "toc"; /** Horizontal alignment of page action buttons */ pageActionsAlignment?: "left" | "right"; /** GitHub repository URL (e.g. "https://github.com/user/repo") */ @@ -158,7 +144,7 @@ function PathBreadcrumb({ return (