@vercel/geistdocs 2.16.0-canary.abbda54 → 3.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (74) hide show
  1. package/dist/cli/index.js +1 -1
  2. package/dist/config.d.ts +12 -0
  3. package/dist/config.d.ts.map +1 -1
  4. package/dist/internal/lazy-mdx-components.d.ts +0 -2
  5. package/dist/internal/lazy-mdx-components.d.ts.map +1 -1
  6. package/dist/internal/lazy-mdx-components.js +0 -1
  7. package/dist/internal/mermaid-source.d.ts +5 -0
  8. package/dist/internal/mermaid-source.d.ts.map +1 -0
  9. package/dist/internal/mermaid-source.js +5 -0
  10. package/dist/internal/page-action-options.d.ts +9 -4
  11. package/dist/internal/page-action-options.d.ts.map +1 -1
  12. package/dist/internal/page-action-options.js +19 -12
  13. package/dist/internal/page-actions-client.d.ts.map +1 -1
  14. package/dist/internal/page-actions-client.js +19 -112
  15. package/dist/internal/page-actions-gate.d.ts +6 -0
  16. package/dist/internal/page-actions-gate.d.ts.map +1 -1
  17. package/dist/internal/page-actions-gate.js +11 -9
  18. package/dist/internal/page-actions-menu-client.d.ts +8 -0
  19. package/dist/internal/page-actions-menu-client.d.ts.map +1 -0
  20. package/dist/internal/page-actions-menu-client.js +105 -0
  21. package/dist/internal/page-markdown.d.ts +3 -0
  22. package/dist/internal/page-markdown.d.ts.map +1 -0
  23. package/dist/internal/page-markdown.js +45 -0
  24. package/dist/internal/toc-actions-client.d.ts +3 -1
  25. package/dist/internal/toc-actions-client.d.ts.map +1 -1
  26. package/dist/internal/toc-actions-client.js +7 -9
  27. package/dist/mdx.js +3 -2
  28. package/dist/next.d.ts +2 -15
  29. package/dist/next.d.ts.map +1 -1
  30. package/dist/next.js +5 -27
  31. package/dist/pages/docs.d.ts +6 -1
  32. package/dist/pages/docs.d.ts.map +1 -1
  33. package/dist/pages/docs.js +11 -6
  34. package/dist/routes/search.d.ts +1 -8
  35. package/dist/routes/search.d.ts.map +1 -1
  36. package/dist/routes/search.js +82 -120
  37. package/dist/source-config.d.ts +0 -2
  38. package/dist/source-config.d.ts.map +1 -1
  39. package/dist/source-config.js +0 -2
  40. package/docs/agents.md +2 -3
  41. package/docs/llms.txt +31 -250
  42. package/docs/manifest.json +2 -11
  43. package/docs/pages/changelog.md +1 -1
  44. package/docs/pages/components/index.md +0 -1
  45. package/docs/pages/configuration.md +24 -73
  46. package/docs/pages/edit-on-github.md +1 -1
  47. package/docs/pages/index.md +0 -29
  48. package/docs/pages/md.md +1 -1
  49. package/docs/pages/migration.md +1 -1
  50. package/docs/pages/syntax.md +1 -107
  51. package/docs/sitemap.md +1 -2
  52. package/package.json +14 -14
  53. package/source-config.js +0 -2
  54. package/template/AGENTS.md +0 -4
  55. package/template/app/[lang]/docs/[[...slug]]/page.tsx +1 -0
  56. package/template/app/api/search/route.ts +2 -7
  57. package/template/content/docs/changelog.mdx +1 -1
  58. package/template/content/docs/components/index.mdx +0 -1
  59. package/template/content/docs/components/meta.json +0 -1
  60. package/template/content/docs/configuration.mdx +24 -73
  61. package/template/content/docs/edit-on-github.mdx +1 -1
  62. package/template/content/docs/index.mdx +0 -28
  63. package/template/content/docs/md.mdx +1 -1
  64. package/template/content/docs/migration.mdx +1 -1
  65. package/template/content/docs/syntax.cn.mdx +1 -107
  66. package/template/content/docs/syntax.mdx +1 -107
  67. package/template/next.config.ts +1 -1
  68. package/template/package.json +1 -2
  69. package/template/source.config.ts +1 -1
  70. package/docs/pages/components/mermaid.md +0 -29
  71. package/search-index.d.ts +0 -14
  72. package/search-index.js +0 -447
  73. package/template/content/docs/components/mermaid.mdx +0 -25
  74. package/template/lib/geistdocs/search-source.ts +0 -6
@@ -0,0 +1,105 @@
1
+ "use client";
2
+ import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
3
+ import { useCopyButton } from "fumadocs-ui/utils/use-copy-button";
4
+ import { useRef, useState, } from "react";
5
+ import { IconAcronymMarkdown, IconCheck, IconChevronDown, IconChevronLeft, IconChevronRight, IconCopy, IconExternal, IconMessage, } from "#geistdocs-assets/icons";
6
+ import { LogoIconV0 } from "#geistdocs-assets/logos";
7
+ import { cn } from "#geistdocs-ui/utils";
8
+ import { useGeistdocsChatContext } from "./chat/context";
9
+ import { getPageActionOptions, } from "./page-action-options";
10
+ import { getMarkdown, getPageQuery } from "./page-markdown";
11
+ import { DropdownMenu, DropdownMenuContent, DropdownMenuItem, DropdownMenuSeparator, DropdownMenuSub, DropdownMenuSubContent, DropdownMenuSubTrigger, DropdownMenuTrigger, } from "./ui/dropdown-menu";
12
+ import { useIsMobile } from "./use-mobile";
13
+ const openInProviders = [
14
+ {
15
+ id: "v0",
16
+ label: "Open in v0",
17
+ getHref: (query) => `https://v0.app?${new URLSearchParams({ q: query }).toString()}`,
18
+ },
19
+ {
20
+ id: "chatgpt",
21
+ label: "Open in ChatGPT",
22
+ getHref: (query) => `https://chatgpt.com/?${new URLSearchParams({ hints: "search", prompt: query }).toString()}`,
23
+ },
24
+ {
25
+ id: "claude",
26
+ label: "Open in Claude",
27
+ getHref: (query) => `https://claude.ai/new?${new URLSearchParams({ q: query }).toString()}`,
28
+ },
29
+ {
30
+ id: "cursor",
31
+ label: "Open in Cursor",
32
+ getHref: (query) => {
33
+ const url = new URL("https://cursor.com/link/prompt");
34
+ url.searchParams.set("text", query);
35
+ return url.toString();
36
+ },
37
+ },
38
+ ];
39
+ const PageActionMenuItemContent = ({ description, icon, title, }) => (_jsxs("span", { className: "grid w-full grid-cols-[20px_minmax(0,1fr)] items-center gap-3 text-left", children: [_jsx("span", { className: "flex size-5 items-center justify-center text-gray-900", children: icon }), _jsxs("span", { className: "flex min-w-0 flex-col items-start gap-0.5", children: [_jsx("span", { className: "text-gray-1000 text-label-14", children: title }), _jsx("span", { className: "text-copy-13 text-gray-900", children: description })] })] }));
40
+ const OpenInProviderItems = ({ providers, query, }) => providers.map((provider) => (_jsx(DropdownMenuItem, { asChild: true, children: _jsxs("a", { className: "flex items-center gap-2 text-label-14", href: provider.getHref(query), rel: "noopener noreferrer", target: "_blank", children: [_jsx("span", { className: "flex-1", translate: "no", children: provider.label }), _jsx(IconExternal, { className: "size-4 shrink-0" })] }) }, provider.id)));
41
+ const ProviderMenuView = ({ backRef, onBack, providers, query, }) => (_jsxs(_Fragment, { children: [_jsxs(DropdownMenuItem, { className: "text-label-14", onSelect: (event) => {
42
+ event.preventDefault();
43
+ onBack();
44
+ }, ref: backRef, children: [_jsx(IconChevronLeft, { className: "size-4" }), _jsx("span", { children: "Back to page actions" })] }), _jsx(DropdownMenuSeparator, {}), _jsx(OpenInProviderItems, { providers: providers, query: query })] }));
45
+ const PageActionsMainMenu = ({ askAIEnabled, copyEnabled, handleCopy, isMobile, onAskAI, onShowProviders, onViewMarkdown, openInChatEnabled, openInChatRef, otherProviders, query, v0Provider, }) => {
46
+ return (_jsxs(_Fragment, { children: [copyEnabled ? (_jsxs(_Fragment, { children: [_jsx(DropdownMenuItem, { asChild: true, className: "h-auto w-full p-2", children: _jsx("button", { onClick: handleCopy, type: "button", children: _jsx(PageActionMenuItemContent, { description: "Copy page as Markdown for LLMs", icon: _jsx(IconCopy, { className: "size-4" }), title: "Copy page" }) }) }), _jsx(DropdownMenuItem, { asChild: true, className: "h-auto w-full p-2", children: _jsx("button", { onClick: onViewMarkdown, type: "button", children: _jsx(PageActionMenuItemContent, { description: "Open this page as plain text", icon: _jsx(IconAcronymMarkdown, { "aria-hidden": "true", className: "size-4" }), title: "View as Markdown" }) }) })] })) : null, openInChatEnabled ? (_jsxs(_Fragment, { children: [_jsx(DropdownMenuItem, { asChild: true, className: "h-auto p-2", children: _jsx("a", { href: v0Provider.getHref(query), rel: "noopener noreferrer", target: "_blank", children: _jsx(PageActionMenuItemContent, { description: "Ask v0 to help apply this page", icon: _jsx(LogoIconV0, { "aria-hidden": "true", size: 16 }), title: v0Provider.label }) }) }), isMobile ? (_jsxs(DropdownMenuItem, { className: "h-auto p-2", onSelect: (event) => {
47
+ event.preventDefault();
48
+ onShowProviders();
49
+ }, ref: openInChatRef, children: [_jsx(PageActionMenuItemContent, { description: "Use this page in another AI chat", icon: _jsx(IconExternal, { className: "size-4" }), title: "Open in another chat" }), _jsx(IconChevronRight, { className: "size-4" })] })) : (_jsxs(DropdownMenuSub, { children: [_jsx(DropdownMenuSubTrigger, { className: "h-auto p-2", children: _jsx(PageActionMenuItemContent, { description: "Use this page in another AI chat", icon: _jsx(IconExternal, { className: "size-4" }), title: "Open in another chat" }) }), _jsx(DropdownMenuSubContent, { className: "w-52", sideOffset: 12, children: _jsx(OpenInProviderItems, { providers: otherProviders, query: query }) })] }))] })) : null, askAIEnabled ? (_jsx(DropdownMenuItem, { className: "h-auto p-2", onSelect: onAskAI, children: _jsx(PageActionMenuItemContent, { description: "Chat with this page as context", icon: _jsx(IconMessage, { className: "size-4" }), title: "Ask AI about this page" }) })) : null] }));
50
+ };
51
+ // The desktop action control: a compact copy button plus an actions dropdown,
52
+ // aligned beside the page title.
53
+ const DesktopPageActions = ({ askAIEnabled, checked, copyEnabled, isMobile, menuView, onAskAI, onCopy, onPrefetchMarkdown, onViewMarkdown, openInChatEnabled, openInChatRef, otherProviders, providersBackRef, query, setMenuView, v0Provider, }) => {
54
+ return (_jsxs("div", { className: "inline-flex shrink-0 overflow-hidden rounded-md border border-gray-400 bg-background-100", children: [copyEnabled ? (_jsx("button", { "aria-label": "Copy page", className: "inline-flex size-8 touch-manipulation items-center justify-center transition-colors hover:bg-gray-100 hover:text-gray-1000 focus-visible:outline-none focus-visible:ring-[3px] focus-visible:ring-gray-600/50", onClick: onCopy, onFocus: onPrefetchMarkdown, onPointerEnter: onPrefetchMarkdown, title: "Copy page", type: "button", children: _jsxs("span", { className: "relative size-4", children: [_jsx(IconCopy, { className: cn("absolute inset-0 size-4 transition-[transform,opacity] duration-200", checked ? "scale-75 opacity-0" : "scale-100 opacity-100") }), _jsx(IconCheck, { className: cn("absolute inset-0 size-4 transition-[transform,opacity] duration-200", checked ? "scale-100 opacity-100" : "scale-75 opacity-0") })] }) })) : null, _jsxs(DropdownMenu, { onOpenChange: (open) => {
55
+ if (!open) {
56
+ setMenuView("main");
57
+ }
58
+ }, children: [_jsx(DropdownMenuTrigger, { asChild: true, children: _jsxs("button", { "aria-label": copyEnabled ? "Open page actions" : "Page actions", className: "inline-flex h-8 touch-manipulation items-center justify-center gap-1.5 border-gray-400 border-l px-2 transition-colors hover:text-gray-1000 focus-visible:outline-none focus-visible:ring-[3px] focus-visible:ring-gray-600/50 data-[state=closed]:bg-transparent data-[state=open]:bg-gray-100 data-[state=closed]:hover:bg-gray-100", type: "button", children: [copyEnabled ? null : _jsx("span", { children: "Page actions" }), _jsx(IconChevronDown, { className: "size-4" })] }) }), _jsx(DropdownMenuContent, { align: "end", className: "w-80 max-w-[calc(100vw-1rem)]", sideOffset: 8, children: isMobile && menuView === "providers" ? (_jsx(ProviderMenuView, { backRef: providersBackRef, onBack: () => {
59
+ setMenuView("main");
60
+ requestAnimationFrame(() => openInChatRef.current?.focus());
61
+ }, providers: otherProviders, query: query })) : (_jsx(PageActionsMainMenu, { askAIEnabled: askAIEnabled, copyEnabled: copyEnabled, handleCopy: onCopy, isMobile: isMobile, onAskAI: onAskAI, onShowProviders: () => {
62
+ setMenuView("providers");
63
+ requestAnimationFrame(() => providersBackRef.current?.focus());
64
+ }, onViewMarkdown: onViewMarkdown, openInChatEnabled: openInChatEnabled, openInChatRef: openInChatRef, otherProviders: otherProviders, query: query, v0Provider: v0Provider })) })] })] }));
65
+ };
66
+ /**
67
+ * The opt-in desktop page actions (`pageActions.menu: true`): the Copy page
68
+ * button plus a dropdown with View as Markdown, Open in chat and Ask AI. Kept
69
+ * in its own module so sites that don't opt in never download the menu.
70
+ */
71
+ export const GeistdocsPageActionsMenu = ({ config, page, }) => {
72
+ const isMobile = useIsMobile();
73
+ const { enabled: chatEnabled, openWithPage, preloadChat, setIsOpen, setPrompt, } = useGeistdocsChatContext();
74
+ const [menuView, setMenuView] = useState("main");
75
+ const openInChatRef = useRef(null);
76
+ const providersBackRef = useRef(null);
77
+ const markdownUrl = page.markdownUrl;
78
+ const prefetchMarkdown = () => {
79
+ getMarkdown(markdownUrl).catch(() => undefined);
80
+ };
81
+ const [checked, handleCopy] = useCopyButton(async () => {
82
+ await navigator.clipboard.writeText(await getMarkdown(markdownUrl));
83
+ });
84
+ const handleViewMarkdown = () => {
85
+ window.open(markdownUrl, "_blank", "noopener");
86
+ };
87
+ const { askAIEnabled, copyEnabled, openInChatEnabled, showMenu } = getPageActionOptions(config, chatEnabled, "desktop");
88
+ if (!showMenu) {
89
+ return null;
90
+ }
91
+ const query = getPageQuery(page.url);
92
+ const v0Provider = openInProviders[0];
93
+ const otherProviders = openInProviders.slice(1);
94
+ const onAskAI = () => {
95
+ preloadChat();
96
+ if (page.attachToChat === false) {
97
+ setPrompt(getPageQuery(page.url, window.location.origin));
98
+ setIsOpen(true);
99
+ return;
100
+ }
101
+ openWithPage({ title: page.title, url: page.url });
102
+ };
103
+ const preloadChatOnIntent = askAIEnabled ? preloadChat : undefined;
104
+ return (_jsxs("div", { className: "mb-2 @max-[961px]:hidden self-end", onFocusCapture: preloadChatOnIntent, onPointerEnter: preloadChatOnIntent, children: [_jsx(DesktopPageActions, { askAIEnabled: askAIEnabled, checked: checked, copyEnabled: copyEnabled, isMobile: isMobile, menuView: menuView, onAskAI: onAskAI, onCopy: handleCopy, onPrefetchMarkdown: prefetchMarkdown, onViewMarkdown: handleViewMarkdown, openInChatEnabled: openInChatEnabled, openInChatRef: openInChatRef, otherProviders: otherProviders, providersBackRef: providersBackRef, query: query, setMenuView: setMenuView, v0Provider: v0Provider }), _jsx("span", { "aria-live": "polite", className: "sr-only", children: checked ? "Page copied" : "" })] }));
105
+ };
@@ -0,0 +1,3 @@
1
+ export declare const getMarkdown: (url: string) => Promise<string>;
2
+ export declare const getPageQuery: (href: string, origin?: string) => string;
3
+ //# sourceMappingURL=page-markdown.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"page-markdown.d.ts","sourceRoot":"","sources":["../../src/internal/page-markdown.ts"],"names":[],"mappings":"AAIA,eAAO,MAAM,WAAW,GAAI,KAAK,MAAM,KAAG,OAAO,CAAC,MAAM,CAqBvD,CAAC;AAEF,eAAO,MAAM,YAAY,GAAI,MAAM,MAAM,EAAE,SAAS,MAAM,WAuBzD,CAAC"}
@@ -0,0 +1,45 @@
1
+ // Shared by the page actions client components, so Copy page reuses one
2
+ // in-flight Markdown request per URL.
3
+ const markdownRequests = new Map();
4
+ export const getMarkdown = (url) => {
5
+ const cached = markdownRequests.get(url);
6
+ if (cached) {
7
+ return cached;
8
+ }
9
+ const request = fetch(url)
10
+ .then((response) => {
11
+ if (!response.ok) {
12
+ throw new Error(`Failed to fetch markdown from ${url}`);
13
+ }
14
+ return response.text();
15
+ })
16
+ .catch((error) => {
17
+ markdownRequests.delete(url);
18
+ throw error;
19
+ });
20
+ markdownRequests.set(url, request);
21
+ return request;
22
+ };
23
+ export const getPageQuery = (href, origin) => {
24
+ const protocol = process.env.NODE_ENV === "production" ? "https" : "http";
25
+ const productionHost = process.env.NEXT_PUBLIC_VERCEL_PROJECT_PRODUCTION_URL;
26
+ let configuredBaseUrl;
27
+ if (productionHost) {
28
+ configuredBaseUrl =
29
+ productionHost.startsWith("http://") ||
30
+ productionHost.startsWith("https://")
31
+ ? productionHost
32
+ : `${protocol}://${productionHost}`;
33
+ }
34
+ const baseUrl = origin ?? configuredBaseUrl;
35
+ let url = href;
36
+ if (baseUrl) {
37
+ try {
38
+ url = new URL(href, baseUrl).toString();
39
+ }
40
+ catch {
41
+ // Keep the app-local href when the optional production URL is malformed.
42
+ }
43
+ }
44
+ return `Read this page, I want to ask questions about it. ${url}`;
45
+ };
@@ -2,8 +2,10 @@ import { type ReactNode } from "react";
2
2
  import type { GeistdocsConfig } from "../config";
3
3
  interface GeistdocsTableOfContentsActionsProps {
4
4
  config: Pick<GeistdocsConfig, "feedback" | "pageActions" | "siteId">;
5
+ /** Resolved "Edit this page on GitHub" URL; omit to hide the action. */
6
+ editSourceUrl?: string;
5
7
  extraActions: ReactNode[];
6
8
  }
7
- export declare const GeistdocsTableOfContentsActions: ({ config, extraActions, }: GeistdocsTableOfContentsActionsProps) => import("react/jsx-runtime").JSX.Element;
9
+ export declare const GeistdocsTableOfContentsActions: ({ config, editSourceUrl, extraActions, }: GeistdocsTableOfContentsActionsProps) => import("react/jsx-runtime").JSX.Element;
8
10
  export {};
9
11
  //# sourceMappingURL=toc-actions-client.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"toc-actions-client.d.ts","sourceRoot":"","sources":["../../src/internal/toc-actions-client.tsx"],"names":[],"mappings":"AAGA,OAAO,EAIL,KAAK,SAAS,EAIf,MAAM,OAAO,CAAC;AAQf,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,WAAW,CAAC;AAKjD,UAAU,oCAAoC;IAC5C,MAAM,EAAE,IAAI,CAAC,eAAe,EAAE,UAAU,GAAG,aAAa,GAAG,QAAQ,CAAC,CAAC;IACrE,YAAY,EAAE,SAAS,EAAE,CAAC;CAC3B;AAwKD,eAAO,MAAM,+BAA+B,GAAI,2BAG7C,oCAAoC,4CAiBtC,CAAC"}
1
+ {"version":3,"file":"toc-actions-client.d.ts","sourceRoot":"","sources":["../../src/internal/toc-actions-client.tsx"],"names":[],"mappings":"AAGA,OAAO,EAIL,KAAK,SAAS,EAIf,MAAM,OAAO,CAAC;AAKf,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,WAAW,CAAC;AAKjD,UAAU,oCAAoC;IAC5C,MAAM,EAAE,IAAI,CAAC,eAAe,EAAE,UAAU,GAAG,aAAa,GAAG,QAAQ,CAAC,CAAC;IACrE,wEAAwE;IACxE,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,YAAY,EAAE,SAAS,EAAE,CAAC;CAC3B;AAoKD,eAAO,MAAM,+BAA+B,GAAI,0CAI7C,oCAAoC,4CAiBtC,CAAC"}
@@ -2,7 +2,8 @@
2
2
  import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
3
3
  import { usePathname } from "next/navigation";
4
4
  import { useEffect, useState, useTransition, } from "react";
5
- import { IconAcronymMarkdown, IconArrowCircleUp, IconThumbUp, } from "#geistdocs-assets/icons";
5
+ import { IconAcronymMarkdown, IconThumbUp } from "#geistdocs-assets/icons";
6
+ import { LogoIconGithub } from "#geistdocs-assets/logos";
6
7
  import { Button } from "#geistdocs-ui/components/button";
7
8
  import { Textarea } from "#geistdocs-ui/components/textarea";
8
9
  import { sendFeedback } from "./feedback-action";
@@ -15,10 +16,7 @@ const feedbackEmotions = [
15
16
  { name: "happy", emoji: "🙂" },
16
17
  { name: "amazed", emoji: "🤩" },
17
18
  ];
18
- const ScrollTopAction = () => (_jsxs("button", { className: actionClassName, onClick: () => {
19
- const reduceMotion = window.matchMedia("(prefers-reduced-motion: reduce)").matches;
20
- window.scrollTo({ top: 0, behavior: reduceMotion ? "auto" : "smooth" });
21
- }, type: "button", children: [_jsx(IconArrowCircleUp, { className: "size-3.5" }), _jsx("span", { children: "Scroll to top" })] }));
19
+ const EditSourceAction = ({ href }) => (_jsxs("a", { className: actionClassName, href: href, rel: "noopener noreferrer", target: "_blank", children: [_jsx(LogoIconGithub, { "aria-hidden": "true", className: "size-3.5" }), _jsx("span", { children: "Edit this page on GitHub" })] }));
22
20
  const FeedbackAction = ({ siteId }) => {
23
21
  const isMobile = useIsMobile();
24
22
  const url = usePathname();
@@ -66,13 +64,13 @@ const FeedbackAction = ({ siteId }) => {
66
64
  ? "bg-gray-100 text-gray-1000"
67
65
  : "text-gray-900 hover:text-gray-1000", onClick: () => setEmotion(entry.name), size: "small", type: "unstyled", typeName: "button", children: [entry.emoji, _jsx("span", { className: "sr-only", children: entry.name })] }, entry.name))) }), _jsx(Button, { disabled: isPending || !emotion || !message, size: "small", typeName: "submit", children: "Send" })] })] })) }) })] }));
68
66
  };
69
- export const GeistdocsTableOfContentsActions = ({ config, extraActions, }) => {
67
+ export const GeistdocsTableOfContentsActions = ({ config, editSourceUrl, extraActions, }) => {
70
68
  const actions = [];
71
- if (config.pageActions?.scrollTop !== false) {
72
- actions.push(_jsx(ScrollTopAction, {}, "scroll-top"));
73
- }
74
69
  if (config.feedback?.enabled !== false) {
75
70
  actions.push(_jsx(FeedbackAction, { siteId: config.siteId }, "feedback"));
76
71
  }
72
+ if (editSourceUrl) {
73
+ actions.push(_jsx(EditSourceAction, { href: editSourceUrl }, "edit-source"));
74
+ }
77
75
  return (_jsxs(_Fragment, { children: [actions, extraActions] }));
78
76
  };
package/dist/mdx.js CHANGED
@@ -14,8 +14,9 @@ import { Step, Steps } from "./components/steps";
14
14
  import { Table } from "./components/table";
15
15
  import { TypeTable } from "./components/type-table";
16
16
  import { Video } from "./components/video";
17
- import { CodeBlockTab, CodeBlockTabs, CodeBlockTabsList, CodeBlockTabsTrigger, CompactCodeBlockTabs, CopyPrompt, Mermaid, TabContent, Tabs, TabsWithChildren, } from "./internal/lazy-mdx-components";
17
+ import { CodeBlockTab, CodeBlockTabs, CodeBlockTabsList, CodeBlockTabsTrigger, CompactCodeBlockTabs, CopyPrompt, TabContent, Tabs, TabsWithChildren, } from "./internal/lazy-mdx-components";
18
18
  import { LocalizedLink } from "./internal/localized-link";
19
+ import { MermaidSource } from "./internal/mermaid-source";
19
20
  import { geistShikiTheme as shikiTheme } from "./shiki-theme";
20
21
  // The source-config exports live on @vercel/geistdocs/source-config. Importing
21
22
  // them here would pull fumadocs-mdx/config, and through it Shiki with every
@@ -60,8 +61,8 @@ export const getGeistdocsMDXComponents = (components) => ({
60
61
  CopyPrompt,
61
62
  Details,
62
63
  Summary,
64
+ Mermaid: MermaidSource,
63
65
  Image,
64
- Mermaid,
65
66
  Steps,
66
67
  Step,
67
68
  Tabs,
package/dist/next.d.ts CHANGED
@@ -1,19 +1,6 @@
1
1
  import { type CreateMDXOptions } from "fumadocs-mdx/next";
2
2
  import type { NextConfig } from "next";
3
- export interface CreateGeistdocsOptions extends CreateMDXOptions {
4
- /** Await search-data generation in build/dev, skip it in production servers. */
5
- searchIndex?: boolean;
6
- }
7
- type ConfigInput = NextConfig | Promise<NextConfig>;
8
- type ConfigWrapper = (config?: ConfigInput) => Promise<NextConfig>;
9
- type SearchConfigWrapper = (config?: ConfigInput) => (phase: string) => Promise<NextConfig>;
3
+ export type CreateGeistdocsOptions = CreateMDXOptions;
10
4
  /** Compose Fumadocs MDX with Geistdocs App Router discovery. */
11
- export declare function createGeistdocs(options: CreateGeistdocsOptions & {
12
- searchIndex: true;
13
- }): SearchConfigWrapper;
14
- export declare function createGeistdocs(options?: CreateGeistdocsOptions & {
15
- searchIndex?: false;
16
- }): ConfigWrapper;
17
- export declare function createGeistdocs(options: CreateGeistdocsOptions): ConfigWrapper | SearchConfigWrapper;
18
- export {};
5
+ export declare const createGeistdocs: (options?: CreateGeistdocsOptions) => (nextConfig?: NextConfig | Promise<NextConfig>) => Promise<NextConfig>;
19
6
  //# sourceMappingURL=next.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"next.d.ts","sourceRoot":"","sources":["../src/next.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,gBAAgB,EAAa,MAAM,mBAAmB,CAAC;AACrE,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,MAAM,CAAC;AAevC,MAAM,WAAW,sBAAuB,SAAQ,gBAAgB;IAC9D,gFAAgF;IAChF,WAAW,CAAC,EAAE,OAAO,CAAC;CACvB;AACD,KAAK,WAAW,GAAG,UAAU,GAAG,OAAO,CAAC,UAAU,CAAC,CAAC;AACpD,KAAK,aAAa,GAAG,CAAC,MAAM,CAAC,EAAE,WAAW,KAAK,OAAO,CAAC,UAAU,CAAC,CAAC;AACnE,KAAK,mBAAmB,GAAG,CACzB,MAAM,CAAC,EAAE,WAAW,KACjB,CAAC,KAAK,EAAE,MAAM,KAAK,OAAO,CAAC,UAAU,CAAC,CAAC;AA6B5C,gEAAgE;AAChE,wBAAgB,eAAe,CAC7B,OAAO,EAAE,sBAAsB,GAAG;IAAE,WAAW,EAAE,IAAI,CAAA;CAAE,GACtD,mBAAmB,CAAC;AACvB,wBAAgB,eAAe,CAC7B,OAAO,CAAC,EAAE,sBAAsB,GAAG;IAAE,WAAW,CAAC,EAAE,KAAK,CAAA;CAAE,GACzD,aAAa,CAAC;AACjB,wBAAgB,eAAe,CAC7B,OAAO,EAAE,sBAAsB,GAC9B,aAAa,GAAG,mBAAmB,CAAC"}
1
+ {"version":3,"file":"next.d.ts","sourceRoot":"","sources":["../src/next.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,gBAAgB,EAAa,MAAM,mBAAmB,CAAC;AACrE,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,MAAM,CAAC;AAUvC,MAAM,MAAM,sBAAsB,GAAG,gBAAgB,CAAC;AA6BtD,gEAAgE;AAChE,eAAO,MAAM,eAAe,GAAI,UAAS,sBAA2B,MAIhE,aAAY,UAAU,GAAG,OAAO,CAAC,UAAU,CAAM,KAChD,OAAO,CAAC,UAAU,CAiCtB,CAAC"}
package/dist/next.js CHANGED
@@ -1,6 +1,4 @@
1
1
  import { createMDX } from "fumadocs-mdx/next";
2
- import { PHASE_PRODUCTION_SERVER } from "next/constants.js";
3
- import { prepareSearchIndex, skipSearchIndexGeneration, } from "../search-index.js";
4
2
  import { APP_ROUTE_MANIFEST_DEFINE, APP_ROUTE_MANIFEST_ENV, } from "./internal/app-route-manifest.js";
5
3
  import { mergeRewriteRoutes, scanAppRouteManifest, } from "./internal/app-route-scanner.js";
6
4
  const hasOwn = (value, key) => value ? Object.hasOwn(value, key) : false;
@@ -18,11 +16,10 @@ const flattenRewrites = (rewrites) => Array.isArray(rewrites)
18
16
  ...(rewrites.afterFiles ?? []),
19
17
  ...(rewrites.fallback ?? []),
20
18
  ];
21
- export function createGeistdocs(options = {}) {
22
- const { searchIndex, ...mdxOptions } = options;
23
- let withMDX;
24
- const resolveConfig = async (nextConfig = {}) => {
25
- withMDX ??= createMDX(mdxOptions);
19
+ /** Compose Fumadocs MDX with Geistdocs App Router discovery. */
20
+ export const createGeistdocs = (options = {}) => {
21
+ const withMDX = createMDX(options);
22
+ return async (nextConfig = {}) => {
26
23
  const config = withMDX(await nextConfig);
27
24
  const resolvedRewrites = config.rewrites
28
25
  ? await config.rewrites()
@@ -52,23 +49,4 @@ export function createGeistdocs(options = {}) {
52
49
  },
53
50
  };
54
51
  };
55
- if (!searchIndex) {
56
- return resolveConfig;
57
- }
58
- let prepared;
59
- return (nextConfig = {}) => async (phase) => {
60
- if (phase === PHASE_PRODUCTION_SERVER) {
61
- skipSearchIndexGeneration(mdxOptions);
62
- }
63
- else {
64
- // Fumadocs does not await its own codegen. Prepare search modules before
65
- // bundling, but never read/parse source content in a production server.
66
- prepared ??= prepareSearchIndex(mdxOptions).catch((error) => {
67
- prepared = undefined;
68
- throw error;
69
- });
70
- await prepared;
71
- }
72
- return resolveConfig(nextConfig);
73
- };
74
- }
52
+ };
@@ -79,6 +79,11 @@ export interface CreateDocsPageOptions<Params extends DocsPageParams = DocsPageP
79
79
  pageUrl: string;
80
80
  publicPageUrl: string;
81
81
  }) => ReactNode;
82
+ /**
83
+ * Generate Markdown for renderTop. Defaults to true. When false, renderTop
84
+ * receives an empty string unless pageActions.getExtraActions needs Markdown.
85
+ */
86
+ renderTopMarkdown?: boolean;
82
87
  resolveLink?: (context: {
83
88
  link: DocsPageLink;
84
89
  nativeLink: typeof NativeDocsLink;
@@ -89,7 +94,7 @@ export interface CreateDocsPageOptions<Params extends DocsPageParams = DocsPageP
89
94
  tableOfContent?: TableOfContentOptions;
90
95
  tableOfContentPopover?: ComponentProps<typeof FumadocsDocsPage>["tableOfContentPopover"];
91
96
  }
92
- export declare const createDocsPage: <Params extends DocsPageParams = DocsPageParams>({ canViewPage, config, source, mdx, pageActions, filterStaticParams, getMarkdownUrl, getPageUrl, getPublicPageUrl, metadata, openGraph, renderTop, resolveLink, tableOfContent, tableOfContentPopover, }: CreateDocsPageOptions<Params>) => {
97
+ export declare const createDocsPage: <Params extends DocsPageParams = DocsPageParams>({ canViewPage, config, source, mdx, pageActions, filterStaticParams, getMarkdownUrl, getPageUrl, getPublicPageUrl, metadata, openGraph, renderTop, renderTopMarkdown, resolveLink, tableOfContent, tableOfContentPopover, }: CreateDocsPageOptions<Params>) => {
93
98
  Page: ({ params }: {
94
99
  params: Promise<Params>;
95
100
  }) => import("react/jsx-runtime").JSX.Element;
@@ -1 +1 @@
1
- {"version":3,"file":"docs.d.ts","sourceRoot":"","sources":["../../src/pages/docs.tsx"],"names":[],"mappings":"AACA,OAAO,EAEL,QAAQ,IAAI,gBAAgB,EAE7B,MAAM,+BAA+B,CAAC;AACvC,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,WAAW,CAAC;AAC/C,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,MAAM,CAAC;AAErC,OAAO,EACL,KAAK,cAAc,EACnB,KAAK,aAAa,EAElB,KAAK,SAAS,EACf,MAAM,OAAO,CAAC;AAEf,OAAO,EAAE,cAAc,EAAE,MAAM,oBAAoB,CAAC;AACpD,OAAO,EAAE,KAAK,eAAe,EAA+B,MAAM,WAAW,CAAC;AAgB9E,OAAO,EACL,KAAK,2BAA2B,EAEjC,MAAM,oBAAoB,CAAC;AAC5B,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,WAAW,CAAC;AAEvD,KAAK,YAAY,GAAG,qBAAqB,CAAC;AAC1C,KAAK,aAAa,GAAG,WAAW,CAAC,UAAU,CAAC,YAAY,CAAC,QAAQ,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,CAAC;AAChF,KAAK,iBAAiB,GAAG,UAAU,CAAC,OAAO,iBAAiB,CAAC,CAAC;AAC9D,KAAK,YAAY,GAAG,aAAa,CAAC,GAAG,CAAC,CAAC;AACvC,KAAK,qBAAqB,GAAG,WAAW,CACtC,cAAc,CAAC,OAAO,gBAAgB,CAAC,CAAC,gBAAgB,CAAC,CAC1D,CAAC;AACF,MAAM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EAAE,MAAM,CAAC;QAChB,aAAa,EAAE,MAAM,CAAC;KACvB,KAAK,SAAS,CAAC;IAChB;;;OAGG;IACH,iBAAiB,CAAC,EAAE,OAAO,CAAC;IAC5B,WAAW,CAAC,EAAE,CAAC,OAAO,EAAE;QACtB,IAAI,EAAE,YAAY,CAAC;QACnB,UAAU,EAAE,OAAO,cAAc,CAAC;QAClC,IAAI,EAAE,aAAa,CAAC;QACpB,MAAM,EAAE,YAAY,CAAC;KACtB,KAAK,YAAY,CAAC;IACnB,MAAM,EAAE,YAAY,CAAC;IACrB,cAAc,CAAC,EAAE,qBAAqB,CAAC;IACvC,qBAAqB,CAAC,EAAE,cAAc,CACpC,OAAO,gBAAgB,CACxB,CAAC,uBAAuB,CAAC,CAAC;CAC5B;AAoDD,eAAO,MAAM,cAAc,GAAI,MAAM,SAAS,cAAc,GAAG,cAAc,EAAE,6NAiB5E,qBAAqB,CAAC,MAAM,CAAC;uBAsPJ;QAAE,MAAM,EAAE,OAAO,CAAC,MAAM,CAAC,CAAA;KAAE;0BA7KlB,MAAM;;;;oCA8LtC;QACD,MAAM,EAAE,OAAO,CAAC,MAAM,CAAC,CAAC;KACzB,KAAG,OAAO,CAAC,QAAQ,CAAC;CAqDtB,CAAC;AAEF,eAAO,MAAM,iBAAiB;;;CAA4B,CAAC"}
@@ -12,6 +12,7 @@ import { resolveDocumentTitle } from "../internal/document-title";
12
12
  import { omitLanguageParam, resolveRouteLanguage } from "../internal/languages";
13
13
  import { resolveLinkHref, stripBasePathFromHref } from "../internal/link-href";
14
14
  import { resolvePageMarkdownUrl as resolveInternalPageMarkdownUrl } from "../internal/markdown-url.js";
15
+ import { getEditSourceAction } from "../internal/page-action-options";
15
16
  import { createPageActions as createInternalPageActions } from "../internal/page-actions";
16
17
  import { GeistdocsPageActions } from "../internal/page-actions-gate";
17
18
  import { PageBreadcrumb } from "../internal/page-breadcrumb";
@@ -43,13 +44,13 @@ const DocsTitle = ({ className, ...props }) => (_jsx(FumadocsDocsTitle, { classN
43
44
  const DocsBody = ({ className, ...props }) => (_jsx(FumadocsDocsBody, { className: cn("mx-auto w-full", className), "data-geistdocs-article": "body", ...props }));
44
45
  /** App-provided footer content below the table-of-contents actions. */
45
46
  const TocFooterSlot = ({ children }) => children ? _jsx("div", { className: "mt-4", children: children }) : null;
46
- const hasTableOfContentsActions = (config, extraActions) => config.pageActions?.scrollTop !== false ||
47
- config.feedback?.enabled !== false ||
47
+ const hasTableOfContentsActions = (config, extraActions, editSourceUrl) => config.feedback?.enabled !== false ||
48
+ Boolean(editSourceUrl) ||
48
49
  extraActions.length > 0;
49
50
  const serializeParams = (params) => JSON.stringify(Object.entries(params)
50
51
  .filter(([, value]) => value !== undefined)
51
52
  .sort(([left], [right]) => left.localeCompare(right)));
52
- export const createDocsPage = ({ canViewPage, config, source, mdx, pageActions = createInternalPageActions({ config }), filterStaticParams, getMarkdownUrl, getPageUrl, getPublicPageUrl, metadata, openGraph, renderTop, resolveLink, tableOfContent, tableOfContentPopover, }) => {
53
+ export const createDocsPage = ({ canViewPage, config, source, mdx, pageActions = createInternalPageActions({ config }), filterStaticParams, getMarkdownUrl, getPageUrl, getPublicPageUrl, metadata, openGraph, renderTop, renderTopMarkdown = true, resolveLink, tableOfContent, tableOfContentPopover, }) => {
53
54
  const DocsLink = renderPrefetchedDocsLink.bind(null, config.siteUrl, config.basePath);
54
55
  const resolvePageUrls = (page, params) => {
55
56
  const pageUrl = getPageUrl?.({ page, params }) ?? page.url;
@@ -142,7 +143,7 @@ export const createDocsPage = ({ canViewPage, config, source, mdx, pageActions =
142
143
  previous: resolveFooterItem(footerItems.previous),
143
144
  next: resolveFooterItem(footerItems.next),
144
145
  };
145
- const markdown = pageActions.getExtraActions || renderTop
146
+ const markdown = pageActions.getExtraActions || (renderTop && renderTopMarkdown)
146
147
  ? await source.getPageMarkdown(page)
147
148
  : undefined;
148
149
  const footerActions = markdown
@@ -154,11 +155,15 @@ export const createDocsPage = ({ canViewPage, config, source, mdx, pageActions =
154
155
  },
155
156
  }) ?? [])
156
157
  : [];
157
- const hasTocActions = hasTableOfContentsActions(pageActions.config, footerActions);
158
+ const editSourceUrl = getEditSourceAction({
159
+ config: pageActions.config,
160
+ path: page.path,
161
+ });
162
+ const hasTocActions = hasTableOfContentsActions(pageActions.config, footerActions, editSourceUrl);
158
163
  const hasTocLinks = Boolean(data.toc?.length);
159
164
  // Actions stay adjacent to the table of contents; the app-provided
160
165
  // footer (promos and other custom content) renders below them.
161
- const tocFooter = (_jsxs(_Fragment, { children: [hasTocLinks && hasTocActions ? (_jsx("div", { className: "mt-4 border-gray-alpha-400 border-t pt-4", children: _jsx("nav", { "aria-label": "Page actions", className: "flex min-w-0 flex-col gap-1", children: _jsx(GeistdocsTableOfContentsActions, { config: pageActions.config, extraActions: footerActions }) }) })) : null, _jsx(TocFooterSlot, { children: tableOfContent?.footer })] }));
166
+ const tocFooter = (_jsxs(_Fragment, { children: [hasTocLinks && hasTocActions ? (_jsx("div", { className: "mt-4 border-gray-alpha-400 border-t pt-4", children: _jsx("nav", { "aria-label": "Page actions", className: "flex min-w-0 flex-col gap-1", children: _jsx(GeistdocsTableOfContentsActions, { config: pageActions.config, editSourceUrl: editSourceUrl, extraActions: footerActions }) }) })) : null, _jsx(TocFooterSlot, { children: tableOfContent?.footer })] }));
162
167
  const tocComponent = tableOfContent?.component ?? (_jsx(GeistdocsTableOfContents, { footer: tocFooter, header: tableOfContent?.header, toc: data.toc ?? [] }));
163
168
  return (_jsxs(FumadocsDocsPage, { breadcrumb: {
164
169
  component: _jsx(PageBreadcrumb, { tree: pageTree, url: page.url }),
@@ -7,16 +7,9 @@ type SearchSourceInput = SearchSource | SourceBundle;
7
7
  interface CreateSearchRouteOptions {
8
8
  config: Pick<GeistdocsConfig, "defaultLanguage" | "translations">;
9
9
  filterPage?: GeistdocsPageFilter<ReturnType<SearchSource["getPages"]>[number], SearchSourceInput>;
10
- /**
11
- * Load sources on the first nonempty query for a configured locale.
12
- * Mutually exclusive with source/sources; successful loads are cached.
13
- * Use a dynamic import of a separate search-only source module: sources
14
- * imported by the caller still evaluate eagerly.
15
- */
16
- loadSources?: () => Promise<SearchSourceInput[]>;
17
10
  source?: SearchSourceInput;
18
11
  sources?: SearchSourceInput[];
19
12
  }
20
- export declare const createSearchRoute: ({ config, filterPage, loadSources, source, sources, }: CreateSearchRouteOptions) => (request: Request) => Promise<Response>;
13
+ export declare const createSearchRoute: ({ config, filterPage, source, sources, }: CreateSearchRouteOptions) => (request: Request) => Promise<Response>;
21
14
  export {};
22
15
  //# sourceMappingURL=search.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"search.d.ts","sourceRoot":"","sources":["../../src/routes/search.ts"],"names":[],"mappings":"AAUA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,WAAW,CAAC;AAOjD,OAAO,EACL,KAAK,mBAAmB,EAEzB,MAAM,oBAAoB,CAAC;AAC5B,OAAO,EAAE,KAAK,qBAAqB,EAA2B,MAAM,WAAW,CAAC;AAEhF,KAAK,YAAY,GAAG,qBAAqB,CAAC;AAC1C,KAAK,YAAY,GAAG,YAAY,CAAC,QAAQ,CAAC,CAAC;AAC3C,KAAK,iBAAiB,GAAG,YAAY,GAAG,YAAY,CAAC;AAIrD,UAAU,wBAAwB;IAChC,MAAM,EAAE,IAAI,CAAC,eAAe,EAAE,iBAAiB,GAAG,cAAc,CAAC,CAAC;IAClE,UAAU,CAAC,EAAE,mBAAmB,CAC9B,UAAU,CAAC,YAAY,CAAC,UAAU,CAAC,CAAC,CAAC,MAAM,CAAC,EAC5C,iBAAiB,CAClB,CAAC;IACF;;;;;OAKG;IACH,WAAW,CAAC,EAAE,MAAM,OAAO,CAAC,iBAAiB,EAAE,CAAC,CAAC;IACjD,MAAM,CAAC,EAAE,iBAAiB,CAAC;IAC3B,OAAO,CAAC,EAAE,iBAAiB,EAAE,CAAC;CAC/B;AAiFD,eAAO,MAAM,iBAAiB,GAAI,uDAM/B,wBAAwB,MAyKX,SAAS,OAAO,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